From 3cf126e1c67faa9d8eaaf4e6a4290ccd22947964 Mon Sep 17 00:00:00 2001 From: Carlo Barazzetta Date: Thu, 27 Feb 2025 23:46:13 +0100 Subject: [PATCH] - Added "Wordwrap option" for the editor (active by default) - Added "Layout Views" - Fixed Menu over Editor Toolbar and Captions when collapsed - Updated the latest Image32 library --- .../package/Rad Studio 12/FrameViewer.dproj | 2 +- .../Rad Studio 12/dclFrameViewer.dproj | 2 +- .../source/MarkdownCommonMark.pas | 2 +- .../source/MarkdownDaringFireball.pas | 2 +- .../source/MarkdownMathCode.pas | 2 +- .../source/MarkdownProcessor.pas | 2 +- .../source/MarkdownTables.pas | 2 +- .../source/MarkdownTxtMark.pas | 2 +- .../source/MarkdownUtils.pas | 2 +- .../Image32/source/Clipper.Core.pas | 4 +- .../Image32/source/Clipper.Engine.pas | 10 +- .../Image32/source/Clipper.Minkowski.pas | 2 +- .../Image32/source/Clipper.Offset.pas | 37 +- .../Image32/source/Clipper.RectClip.pas | 4 +- .../Image32/source/Clipper.inc | 2 +- .../Image32/source/Clipper.pas | 6 +- .../Image32/source/Img32.CQ.pas | 4 +- .../Image32/source/Img32.Clipper2.pas | 4 +- .../Image32/source/Img32.Draw.pas | 175 +- .../Image32/source/Img32.Extra.pas | 235 +- .../Image32/source/Img32.FMX.pas | 4 +- .../Image32/source/Img32.Fmt.BMP.pas | 4 +- .../Image32/source/Img32.Fmt.GIF.pas | 4 +- .../Image32/source/Img32.Fmt.JPG.pas | 4 +- .../Image32/source/Img32.Fmt.PNG.pas | 4 +- .../Image32/source/Img32.Fmt.QOI.pas | 6 +- .../Image32/source/Img32.Fmt.SVG.pas | 4 +- .../Image32/source/Img32.Layers.pas | 319 +- .../Image32/source/Img32.Panels.pas | 54 +- .../Image32/source/Img32.Resamplers.pas | 10 +- .../Image32/source/Img32.SVG.Core.pas | 8 +- .../Image32/source/Img32.SVG.Path.pas | 4 +- .../Image32/source/Img32.SVG.PathDesign.pas | 4 +- .../Image32/source/Img32.SVG.Reader.pas | 32 +- .../Image32/source/Img32.Storage.pas | 31 +- .../Image32/source/Img32.Text.pas | 98 +- .../Image32/source/Img32.Transform.pas | 12 +- .../Image32/source/Img32.Vector.pas | 65 +- .../Image32/source/Img32.Vectorizer.pas | 4 +- Ext/SVGIconImageList/Image32/source/Img32.pas | 73 +- .../Packages/D12/SVGIconImageList.dproj | 11 +- .../Packages/D12/SVGIconImageListFMX.dproj | 2 +- .../SVGIconImageListGroupPackages.groupproj | 4 +- .../D12/SVGIconImageListRestClient.dproj | 5 +- .../Packages/D12/SVGImage32Package.dproj | 10 +- .../Packages/D12/dclSVGIconImageList.dproj | 15 +- .../Packages/D12/dclSVGIconImageListFMX.dproj | 7 +- .../Packages/FMX.SVGIconImageRegister.pas | 4 +- .../Packages/FMX.SVGRESTClientFormUnit.fmx | 24 +- .../Packages/FMX.SVGRESTClientFormUnit.pas | 131 +- .../Packages/SVGRESTClientFormUnit.dfm | 63 +- .../Packages/SVGRESTClientFormUnit.pas | 112 +- .../Source/Browser.IconifyApi.pas | 135 +- Ext/SVGIconImageList/Source/SVGInterfaces.pas | 2 +- .../D12/1.Vcl.StyledComponents.groupproj | 2 +- .../2.Vcl.StyledAnimatedComponents.groupproj | 2 +- .../D12/dclStyledAnimatedComponents.dproj | 6 +- .../packages/D12/dclStyledComponents.dproj | 11 +- .../packages/StyledComponentsSplash.res | Bin 0 -> 9252 bytes .../source/Vcl.StyledButton.pas | 33 +- Ext/SynEdit/Packaged/Delphi10_2.groupproj | 41 - Ext/SynEdit/Packaged/Delphi10_3.groupproj | 41 - Ext/SynEdit/Packaged/Delphi10_4.groupproj | 41 - Ext/SynEdit/Packaged/Delphi11.groupproj | 41 - Ext/SynEdit/Packaged/Delphi2010.groupproj | 48 - Ext/SynEdit/Packaged/DelphiXE3.groupproj | 48 - Ext/SynEdit/Packaged/DelphiXE5.groupproj | 48 - Ext/SynEdit/Packaged/DelphiXE6.groupproj | 48 - Ext/SynEdit/Packaged/DelphiXE7.groupproj | 48 - Ext/SynEdit/Packaged/SynEdit_D10.dpk | 50 - Ext/SynEdit/Packaged/SynEdit_D10.dproj | 533 - Ext/SynEdit/Packaged/SynEdit_D10.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_D10_1.dpk | 50 - Ext/SynEdit/Packaged/SynEdit_D10_1.dproj | 560 - Ext/SynEdit/Packaged/SynEdit_D10_1.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_D10_2.dpk | 50 - Ext/SynEdit/Packaged/SynEdit_D10_2.dproj | 543 - Ext/SynEdit/Packaged/SynEdit_D10_2.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_D10_3.dpk | 50 - Ext/SynEdit/Packaged/SynEdit_D10_3.dproj | 986 -- Ext/SynEdit/Packaged/SynEdit_D10_3.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_D10_4.dpk | 50 - Ext/SynEdit/Packaged/SynEdit_D10_4.dproj | 1202 -- Ext/SynEdit/Packaged/SynEdit_D10_4.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_D11.dpk | 50 - Ext/SynEdit/Packaged/SynEdit_D11.dproj | 166 - Ext/SynEdit/Packaged/SynEdit_D11.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_D12.dpk | 50 - Ext/SynEdit/Packaged/SynEdit_D12.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_D2010.dproj | 115 - Ext/SynEdit/Packaged/SynEdit_D2010.res | Bin 5056 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_DXE3.dpk | 50 - Ext/SynEdit/Packaged/SynEdit_DXE3.dproj | 187 - Ext/SynEdit/Packaged/SynEdit_DXE3.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_DXE5.dpk | 50 - Ext/SynEdit/Packaged/SynEdit_DXE5.dproj | 158 - Ext/SynEdit/Packaged/SynEdit_DXE5.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_DXE6.dpk | 50 - Ext/SynEdit/Packaged/SynEdit_DXE6.dproj | 173 - Ext/SynEdit/Packaged/SynEdit_DXE6.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_DXE7.dpk | 50 - Ext/SynEdit/Packaged/SynEdit_DXE7.dproj | 476 - Ext/SynEdit/Packaged/SynEdit_DXE7.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_DXE8.dpk | 50 - Ext/SynEdit/Packaged/SynEdit_DXE8.dproj | 535 - Ext/SynEdit/Packaged/SynEdit_DXE8.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_DXE_Icon.ico | Bin 4286 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_R10.dpk | 142 - Ext/SynEdit/Packaged/SynEdit_R10.dproj | 619 - Ext/SynEdit/Packaged/SynEdit_R10.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_R10_1.dpk | 142 - Ext/SynEdit/Packaged/SynEdit_R10_1.dproj | 638 - Ext/SynEdit/Packaged/SynEdit_R10_1.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_R10_2.dpk | 142 - Ext/SynEdit/Packaged/SynEdit_R10_2.dproj | 628 - Ext/SynEdit/Packaged/SynEdit_R10_2.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_R10_3.dpk | 142 - Ext/SynEdit/Packaged/SynEdit_R10_3.dproj | 1022 -- Ext/SynEdit/Packaged/SynEdit_R10_3.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_R10_4.dpk | 142 - Ext/SynEdit/Packaged/SynEdit_R10_4.dproj | 1238 -- Ext/SynEdit/Packaged/SynEdit_R10_4.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_R11.dpk | 142 - Ext/SynEdit/Packaged/SynEdit_R11.dproj | 272 - Ext/SynEdit/Packaged/SynEdit_R11.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_R12.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_R2010.dpk | 146 - Ext/SynEdit/Packaged/SynEdit_R2010.dproj | 229 - Ext/SynEdit/Packaged/SynEdit_R2010.res | Bin 5056 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_RXE3.dpk | 142 - Ext/SynEdit/Packaged/SynEdit_RXE3.dproj | 274 - Ext/SynEdit/Packaged/SynEdit_RXE3.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_RXE5.dpk | 142 - Ext/SynEdit/Packaged/SynEdit_RXE5.dproj | 284 - Ext/SynEdit/Packaged/SynEdit_RXE5.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_RXE6.dpk | 142 - Ext/SynEdit/Packaged/SynEdit_RXE6.dproj | 283 - Ext/SynEdit/Packaged/SynEdit_RXE6.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_RXE7.dpk | 142 - Ext/SynEdit/Packaged/SynEdit_RXE7.dproj | 287 - Ext/SynEdit/Packaged/SynEdit_RXE7.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_RXE8.dpk | 142 - Ext/SynEdit/Packaged/SynEdit_RXE8.dproj | 620 - Ext/SynEdit/Packaged/SynEdit_RXE8.res | Bin 4812 -> 0 bytes Ext/SynEdit/Packaged/SynEdit_RXE_Icon.ico | Bin 4286 -> 0 bytes .../{Packaged => Packages}/Delphi12.groupproj | 0 .../SynEdit_D12.dpk} | 15 +- .../{Packaged => Packages}/SynEdit_D12.dproj | 14 +- .../{Packaged => Packages}/SynEdit_R12.dpk | 45 +- .../{Packaged => Packages}/SynEdit_R12.dproj | 56 +- Ext/SynEdit/Source/Contributors.txt | 40 - Ext/SynEdit/Source/DPageSetup.dfm | 204 +- Ext/SynEdit/Source/FSynHighlightProp.pas | 2 +- Ext/SynEdit/Source/FTestPrintPreview.pas | 2 +- Ext/SynEdit/Source/SynAccessibility.pas | 1333 ++ Ext/SynEdit/Source/SynAutoCorrect.pas | 116 +- Ext/SynEdit/Source/SynAutoCorrectEditor.dfm | 2 - Ext/SynEdit/Source/SynAutoCorrectEditor.pas | 46 +- Ext/SynEdit/Source/SynCompletionProposal.pas | 1873 ++- Ext/SynEdit/Source/SynDBEdit.pas | 82 +- Ext/SynEdit/Source/SynDWrite.pas | 2226 +++ Ext/SynEdit/Source/SynEdit.inc | 1350 -- Ext/SynEdit/Source/SynEdit.pas | 13368 +++++++--------- Ext/SynEdit/Source/SynEdit.res | Bin 1268 -> 7244 bytes Ext/SynEdit/Source/SynEditAutoComplete.pas | 517 - Ext/SynEdit/Source/SynEditCodeFolding.pas | 908 +- Ext/SynEdit/Source/SynEditDataObject.pas | 400 + Ext/SynEdit/Source/SynEditDocumentManager.pas | 492 - Ext/SynEdit/Source/SynEditDragDrop.pas | 190 + Ext/SynEdit/Source/SynEditExport.pas | 387 +- Ext/SynEdit/Source/SynEditHighlighter.pas | 740 +- Ext/SynEdit/Source/SynEditJedi.inc | 1333 +- Ext/SynEdit/Source/SynEditKbdHandler.pas | 192 +- Ext/SynEdit/Source/SynEditKeyCmdEditor.dfm | 7 +- Ext/SynEdit/Source/SynEditKeyCmdEditor.pas | 82 +- Ext/SynEdit/Source/SynEditKeyCmds.pas | 643 +- Ext/SynEdit/Source/SynEditKeyCmdsEditor.dfm | 2 - Ext/SynEdit/Source/SynEditKeyCmdsEditor.pas | 61 +- Ext/SynEdit/Source/SynEditKeyConst.pas | 9 - Ext/SynEdit/Source/SynEditMiscClasses.pas | 3849 ++++- Ext/SynEdit/Source/SynEditMiscProcs.pas | 929 +- Ext/SynEdit/Source/SynEditOptionsDialog.dfm | 835 +- Ext/SynEdit/Source/SynEditOptionsDialog.pas | 867 +- Ext/SynEdit/Source/SynEditPlugins.pas | 120 +- Ext/SynEdit/Source/SynEditPrint.pas | 1027 +- .../Source/SynEditPrintHeaderFooter.pas | 337 +- Ext/SynEdit/Source/SynEditPrintMargins.pas | 61 +- .../Source/SynEditPrintMarginsDialog.dfm | 90 +- .../Source/SynEditPrintMarginsDialog.pas | 38 +- Ext/SynEdit/Source/SynEditPrintPreview.pas | 375 +- Ext/SynEdit/Source/SynEditPrintTypes.pas | 62 +- Ext/SynEdit/Source/SynEditPrinterInfo.pas | 9 - Ext/SynEdit/Source/SynEditPropertyReg.pas | 176 +- Ext/SynEdit/Source/SynEditPythonBehaviour.pas | 30 +- Ext/SynEdit/Source/SynEditReg.dcr | Bin 32920 -> 39356 bytes Ext/SynEdit/Source/SynEditReg.pas | 77 +- Ext/SynEdit/Source/SynEditRegexSearch.pas | 137 +- Ext/SynEdit/Source/SynEditScrollBars.pas | 789 + Ext/SynEdit/Source/SynEditSearch.pas | 302 +- Ext/SynEdit/Source/SynEditStrConst.pas | 292 +- Ext/SynEdit/Source/SynEditTextBuffer.pas | 1411 +- Ext/SynEdit/Source/SynEditTypes.pas | 463 +- Ext/SynEdit/Source/SynEditUndo.pas | 955 ++ Ext/SynEdit/Source/SynEditWildcardSearch.pas | 27 +- Ext/SynEdit/Source/SynEditWordWrap.pas | 601 +- Ext/SynEdit/Source/SynExportHTML.pas | 337 +- Ext/SynEdit/Source/SynExportRTF.pas | 65 +- Ext/SynEdit/Source/SynExportTeX.pas | 71 +- Ext/SynEdit/Source/SynHighlighterADSP21xx.pas | 808 +- Ext/SynEdit/Source/SynHighlighterAWK.pas | 268 +- Ext/SynEdit/Source/SynHighlighterAsm.pas | 301 +- Ext/SynEdit/Source/SynHighlighterAsmMASM.pas | 749 - Ext/SynEdit/Source/SynHighlighterBaan.pas | 325 +- Ext/SynEdit/Source/SynHighlighterBat.pas | 228 +- Ext/SynEdit/Source/SynHighlighterCAC.pas | 233 +- Ext/SynEdit/Source/SynHighlighterCPM.pas | 586 +- Ext/SynEdit/Source/SynHighlighterCS.pas | 976 +- Ext/SynEdit/Source/SynHighlighterCache.pas | 412 +- Ext/SynEdit/Source/SynHighlighterCobol.pas | 988 +- Ext/SynEdit/Source/SynHighlighterCpp.pas | 1002 +- Ext/SynEdit/Source/SynHighlighterCss.pas | 511 +- Ext/SynEdit/Source/SynHighlighterDOT.pas | 568 +- Ext/SynEdit/Source/SynHighlighterDWS.pas | 923 +- Ext/SynEdit/Source/SynHighlighterDfm.pas | 361 +- Ext/SynEdit/Source/SynHighlighterDml.pas | 856 +- .../Source/SynHighlighterECMAScript.pas | 889 - Ext/SynEdit/Source/SynHighlighterEiffel.pas | 530 +- Ext/SynEdit/Source/SynHighlighterFortran.pas | 282 +- Ext/SynEdit/Source/SynHighlighterFoxpro.pas | 1772 +- Ext/SynEdit/Source/SynHighlighterGLSL.pas | 1623 -- Ext/SynEdit/Source/SynHighlighterGWS.pas | 303 +- Ext/SynEdit/Source/SynHighlighterGalaxy.pas | 211 +- Ext/SynEdit/Source/SynHighlighterGeneral.pas | 591 +- Ext/SynEdit/Source/SynHighlighterGo.pas | 959 -- Ext/SynEdit/Source/SynHighlighterHC11.pas | 300 +- Ext/SynEdit/Source/SynHighlighterHP48.pas | 620 +- .../Source/SynHighlighterHashEntries.pas | 251 - Ext/SynEdit/Source/SynHighlighterHaskell.pas | 318 +- Ext/SynEdit/Source/SynHighlighterHtml.pas | 387 +- Ext/SynEdit/Source/SynHighlighterIDL.pas | 368 +- Ext/SynEdit/Source/SynHighlighterIni.pas | 905 +- Ext/SynEdit/Source/SynHighlighterInno.pas | 390 +- Ext/SynEdit/Source/SynHighlighterJSON.pas | 124 +- Ext/SynEdit/Source/SynHighlighterJScript.pas | 4986 +----- Ext/SynEdit/Source/SynHighlighterJava.pas | 534 +- Ext/SynEdit/Source/SynHighlighterKix.pas | 240 +- Ext/SynEdit/Source/SynHighlighterLDraw.pas | 278 +- Ext/SynEdit/Source/SynHighlighterLLVM.pas | 24 +- Ext/SynEdit/Source/SynHighlighterM3.pas | 426 +- Ext/SynEdit/Source/SynHighlighterManager.pas | 178 +- Ext/SynEdit/Source/SynHighlighterModelica.pas | 305 +- Ext/SynEdit/Source/SynHighlighterMsg.pas | 218 +- Ext/SynEdit/Source/SynHighlighterMulti.pas | 640 +- Ext/SynEdit/Source/SynHighlighterOmni.pas | 2631 +++ Ext/SynEdit/Source/SynHighlighterPHP.pas | 1025 +- Ext/SynEdit/Source/SynHighlighterPas.pas | 1296 +- Ext/SynEdit/Source/SynHighlighterPerl.pas | 4061 +---- Ext/SynEdit/Source/SynHighlighterProgress.pas | 605 +- Ext/SynEdit/Source/SynHighlighterPython.pas | 844 +- Ext/SynEdit/Source/SynHighlighterRC.pas | 265 +- Ext/SynEdit/Source/SynHighlighterRexx.pas | 26 +- Ext/SynEdit/Source/SynHighlighterRuby.pas | 350 +- Ext/SynEdit/Source/SynHighlighterSDD.pas | 254 +- Ext/SynEdit/Source/SynHighlighterSQL.pas | 847 +- Ext/SynEdit/Source/SynHighlighterST.pas | 295 +- Ext/SynEdit/Source/SynHighlighterSml.pas | 333 +- Ext/SynEdit/Source/SynHighlighterTclTk.pas | 481 +- Ext/SynEdit/Source/SynHighlighterTeX.pas | 198 +- .../Source/SynHighlighterUNIXShellScript.pas | 329 +- Ext/SynEdit/Source/SynHighlighterURI.pas | 212 +- Ext/SynEdit/Source/SynHighlighterUnreal.pas | 719 +- Ext/SynEdit/Source/SynHighlighterVB.pas | 640 +- Ext/SynEdit/Source/SynHighlighterVBScript.pas | 577 +- Ext/SynEdit/Source/SynHighlighterVrml97.pas | 814 +- Ext/SynEdit/Source/SynHighlighterWebIDL.pas | 24 +- Ext/SynEdit/Source/SynHighlighterXML.pas | 656 +- Ext/SynEdit/Source/SynHighlighterYAML.pas | 172 +- Ext/SynEdit/Source/SynHighlighterZPL.pas | 322 - Ext/SynEdit/Source/SynMacroRecorder.pas | 354 +- Ext/SynEdit/Source/SynMemo.pas | 260 - Ext/SynEdit/Source/SynOmniSetupDialog.dfm | 946 ++ Ext/SynEdit/Source/SynOmniSetupDialog.pas | 473 + Ext/SynEdit/Source/SynRegExpr.pas | 4107 ----- Ext/SynEdit/Source/SynSpellCheck.dcr | Bin 0 -> 484 bytes Ext/SynEdit/Source/SynSpellCheck.pas | 1058 ++ Ext/SynEdit/Source/SynTextDrawer.pas | 1043 -- Ext/SynEdit/Source/SynURIOpener.pas | 90 +- Ext/SynEdit/Source/SynUnicode.pas | 3786 +---- Ext/SynEdit/Source/SynUsp10.pas | 2631 --- Ext/SynEdit/Source/dlgConfirmReplace.dfm | 6 +- Ext/SynEdit/Source/dlgReplaceText.dfm | 31 +- Ext/SynEdit/Source/dlgSearchText.dfm | 35 +- Ext/SynEdit/Source/dlgSearchText.pas | 105 +- Ext/SynEdit/Source/kTextDrawer.pas | 722 - README.htm | 11 +- README.md | 14 +- Setup/License_ENG.rtf | Bin 4314 -> 4302 bytes Setup/Licenza_ITA.rtf | Bin 4335 -> 4323 bytes Setup/MDShellExtensions.iss | 2 +- Source/MDShellEx.Resources.dfm | 33 + Source/MDShellEx.Resources.pas | 6 +- Source/MDShellEx.Settings.pas | 131 +- Source/MDShellEx.SettingsForm.dfm | 50 +- Source/MDShellEx.SettingsForm.pas | 11 + Source/MDShellExtensions.dproj | 35 +- Source/MDShellExtensions.res | Bin 2557192 -> 2557192 bytes Source/MDShellExtensions32.dproj | 25 +- Source/MDShellExtensions32.res | Bin 2444904 -> 2444904 bytes Source/MDTextEditor.ViewerMainForm.dfm | 103 +- Source/MDTextEditor.ViewerMainForm.pas | 164 +- Source/MDTextEditor.dpr | 2 +- Source/MDTextEditor.dproj | 39 +- Source/MDTextEditor.res | Bin 2444868 -> 2444868 bytes Source/SynEditOptionsDialog.dfm | 923 +- Source/SynEditOptionsDialog.pas | 893 +- Source/dlgInputUrl.pas | 4 +- Source/dlgReplaceText.dfm | 16 +- 317 files changed, 47640 insertions(+), 74825 deletions(-) create mode 100644 Ext/StyledComponents/packages/StyledComponentsSplash.res delete mode 100644 Ext/SynEdit/Packaged/Delphi10_2.groupproj delete mode 100644 Ext/SynEdit/Packaged/Delphi10_3.groupproj delete mode 100644 Ext/SynEdit/Packaged/Delphi10_4.groupproj delete mode 100644 Ext/SynEdit/Packaged/Delphi11.groupproj delete mode 100644 Ext/SynEdit/Packaged/Delphi2010.groupproj delete mode 100644 Ext/SynEdit/Packaged/DelphiXE3.groupproj delete mode 100644 Ext/SynEdit/Packaged/DelphiXE5.groupproj delete mode 100644 Ext/SynEdit/Packaged/DelphiXE6.groupproj delete mode 100644 Ext/SynEdit/Packaged/DelphiXE7.groupproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10_1.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10_1.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10_1.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10_2.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10_2.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10_2.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10_3.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10_3.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10_3.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10_4.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10_4.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D10_4.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D11.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D11.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D11.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D12.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D12.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D2010.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_D2010.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE3.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE3.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE3.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE5.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE5.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE5.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE6.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE6.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE6.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE7.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE7.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE7.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE8.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE8.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE8.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_DXE_Icon.ico delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10_1.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10_1.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10_1.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10_2.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10_2.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10_2.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10_3.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10_3.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10_3.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10_4.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10_4.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R10_4.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R11.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R11.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R11.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R12.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R2010.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R2010.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_R2010.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE3.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE3.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE3.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE5.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE5.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE5.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE6.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE6.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE6.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE7.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE7.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE7.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE8.dpk delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE8.dproj delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE8.res delete mode 100644 Ext/SynEdit/Packaged/SynEdit_RXE_Icon.ico rename Ext/SynEdit/{Packaged => Packages}/Delphi12.groupproj (100%) rename Ext/SynEdit/{Packaged/SynEdit_D2010.dpk => Packages/SynEdit_D12.dpk} (74%) rename Ext/SynEdit/{Packaged => Packages}/SynEdit_D12.dproj (89%) rename Ext/SynEdit/{Packaged => Packages}/SynEdit_R12.dpk (87%) rename Ext/SynEdit/{Packaged => Packages}/SynEdit_R12.dproj (91%) delete mode 100644 Ext/SynEdit/Source/Contributors.txt create mode 100644 Ext/SynEdit/Source/SynAccessibility.pas create mode 100644 Ext/SynEdit/Source/SynDWrite.pas delete mode 100644 Ext/SynEdit/Source/SynEditAutoComplete.pas create mode 100644 Ext/SynEdit/Source/SynEditDataObject.pas delete mode 100644 Ext/SynEdit/Source/SynEditDocumentManager.pas create mode 100644 Ext/SynEdit/Source/SynEditDragDrop.pas create mode 100644 Ext/SynEdit/Source/SynEditScrollBars.pas create mode 100644 Ext/SynEdit/Source/SynEditUndo.pas delete mode 100644 Ext/SynEdit/Source/SynHighlighterAsmMASM.pas delete mode 100644 Ext/SynEdit/Source/SynHighlighterECMAScript.pas delete mode 100644 Ext/SynEdit/Source/SynHighlighterGLSL.pas delete mode 100644 Ext/SynEdit/Source/SynHighlighterGo.pas delete mode 100644 Ext/SynEdit/Source/SynHighlighterHashEntries.pas create mode 100644 Ext/SynEdit/Source/SynHighlighterOmni.pas delete mode 100644 Ext/SynEdit/Source/SynHighlighterZPL.pas delete mode 100644 Ext/SynEdit/Source/SynMemo.pas create mode 100644 Ext/SynEdit/Source/SynOmniSetupDialog.dfm create mode 100644 Ext/SynEdit/Source/SynOmniSetupDialog.pas delete mode 100644 Ext/SynEdit/Source/SynRegExpr.pas create mode 100644 Ext/SynEdit/Source/SynSpellCheck.dcr create mode 100644 Ext/SynEdit/Source/SynSpellCheck.pas delete mode 100644 Ext/SynEdit/Source/SynTextDrawer.pas delete mode 100644 Ext/SynEdit/Source/SynUsp10.pas delete mode 100644 Ext/SynEdit/Source/kTextDrawer.pas diff --git a/Ext/HTMLViewer/package/Rad Studio 12/FrameViewer.dproj b/Ext/HTMLViewer/package/Rad Studio 12/FrameViewer.dproj index e024e66..7bb0a33 100644 --- a/Ext/HTMLViewer/package/Rad Studio 12/FrameViewer.dproj +++ b/Ext/HTMLViewer/package/Rad Studio 12/FrameViewer.dproj @@ -7,7 +7,7 @@ 3 Package VCL - 20.1 + 20.2 Win32 FrameViewer diff --git a/Ext/HTMLViewer/package/Rad Studio 12/dclFrameViewer.dproj b/Ext/HTMLViewer/package/Rad Studio 12/dclFrameViewer.dproj index c6bd9f2..4e48a5e 100644 --- a/Ext/HTMLViewer/package/Rad Studio 12/dclFrameViewer.dproj +++ b/Ext/HTMLViewer/package/Rad Studio 12/dclFrameViewer.dproj @@ -4,7 +4,7 @@ dclFrameViewer.dpk Release DCC32 - 20.1 + 20.2 VCL True Win32 diff --git a/Ext/MarkdownProcessor/source/MarkdownCommonMark.pas b/Ext/MarkdownProcessor/source/MarkdownCommonMark.pas index 8260486..c22c5d4 100644 --- a/Ext/MarkdownProcessor/source/MarkdownCommonMark.pas +++ b/Ext/MarkdownProcessor/source/MarkdownCommonMark.pas @@ -3,7 +3,7 @@ { MarkDown Processor } { Delphi version of FPC-markdown by Miguel A. Risco-Castillo } { } -{ Copyright (c) 2022-2024 (Ethea S.r.l.) } +{ Copyright (c) 2022-2025 (Ethea S.r.l.) } { Author: Carlo Barazzetta } { } { https://github.com/EtheaDev/MarkdownProcessor } diff --git a/Ext/MarkdownProcessor/source/MarkdownDaringFireball.pas b/Ext/MarkdownProcessor/source/MarkdownDaringFireball.pas index 2960e7c..c593d4e 100644 --- a/Ext/MarkdownProcessor/source/MarkdownDaringFireball.pas +++ b/Ext/MarkdownProcessor/source/MarkdownDaringFireball.pas @@ -3,7 +3,7 @@ { MarkDown Processor } { Delphi version of FPC-markdown by Miguel A. Risco-Castillo } { } -{ Copyright (c) 2022-2024 (Ethea S.r.l.) } +{ Copyright (c) 2022-2025 (Ethea S.r.l.) } { Author: Carlo Barazzetta } { } { https://github.com/EtheaDev/MarkdownProcessor } diff --git a/Ext/MarkdownProcessor/source/MarkdownMathCode.pas b/Ext/MarkdownProcessor/source/MarkdownMathCode.pas index 63327ad..cc8902b 100644 --- a/Ext/MarkdownProcessor/source/MarkdownMathCode.pas +++ b/Ext/MarkdownProcessor/source/MarkdownMathCode.pas @@ -3,7 +3,7 @@ { MarkDown Processor } { Delphi version of FPC-markdown by Miguel A. Risco-Castillo } { } -{ Copyright (c) 2022-2024 (Ethea S.r.l.) } +{ Copyright (c) 2022-2025 (Ethea S.r.l.) } { Author: Carlo Barazzetta } { } { https://github.com/EtheaDev/MarkdownProcessor } diff --git a/Ext/MarkdownProcessor/source/MarkdownProcessor.pas b/Ext/MarkdownProcessor/source/MarkdownProcessor.pas index abf9348..17af2e8 100644 --- a/Ext/MarkdownProcessor/source/MarkdownProcessor.pas +++ b/Ext/MarkdownProcessor/source/MarkdownProcessor.pas @@ -3,7 +3,7 @@ { MarkDown Processor } { Delphi version of FPC-markdown by Miguel A. Risco-Castillo } { } -{ Copyright (c) 2022-2024 (Ethea S.r.l.) } +{ Copyright (c) 2022-2025 (Ethea S.r.l.) } { Author: Carlo Barazzetta } { } { https://github.com/EtheaDev/MarkdownProcessor } diff --git a/Ext/MarkdownProcessor/source/MarkdownTables.pas b/Ext/MarkdownProcessor/source/MarkdownTables.pas index c509433..813a96e 100644 --- a/Ext/MarkdownProcessor/source/MarkdownTables.pas +++ b/Ext/MarkdownProcessor/source/MarkdownTables.pas @@ -3,7 +3,7 @@ { MarkDown Processor } { Delphi version of FPC-markdown by Miguel A. Risco-Castillo } { } -{ Copyright (c) 2022-2024 (Ethea S.r.l.) } +{ Copyright (c) 2022-2025 (Ethea S.r.l.) } { Author: Carlo Barazzetta } { } { https://github.com/EtheaDev/MarkdownProcessor } diff --git a/Ext/MarkdownProcessor/source/MarkdownTxtMark.pas b/Ext/MarkdownProcessor/source/MarkdownTxtMark.pas index 2ce278f..cc94619 100644 --- a/Ext/MarkdownProcessor/source/MarkdownTxtMark.pas +++ b/Ext/MarkdownProcessor/source/MarkdownTxtMark.pas @@ -3,7 +3,7 @@ { MarkDown Processor } { Delphi version of FPC-markdown by Miguel A. Risco-Castillo } { } -{ Copyright (c) 2022-2024 (Ethea S.r.l.) } +{ Copyright (c) 2022-2025 (Ethea S.r.l.) } { Author: Carlo Barazzetta } { } { https://github.com/EtheaDev/MarkdownProcessor } diff --git a/Ext/MarkdownProcessor/source/MarkdownUtils.pas b/Ext/MarkdownProcessor/source/MarkdownUtils.pas index 4c7863e..fe1da50 100644 --- a/Ext/MarkdownProcessor/source/MarkdownUtils.pas +++ b/Ext/MarkdownProcessor/source/MarkdownUtils.pas @@ -3,7 +3,7 @@ { MarkDown Processor } { Delphi version of FPC-markdown by Miguel A. Risco-Castillo } { } -{ Copyright (c) 2022-2024 (Ethea S.r.l.) } +{ Copyright (c) 2022-2025 (Ethea S.r.l.) } { Author: Carlo Barazzetta } { } { https://github.com/EtheaDev/MarkdownProcessor } diff --git a/Ext/SVGIconImageList/Image32/source/Clipper.Core.pas b/Ext/SVGIconImageList/Image32/source/Clipper.Core.pas index c726bec..77bc276 100644 --- a/Ext/SVGIconImageList/Image32/source/Clipper.Core.pas +++ b/Ext/SVGIconImageList/Image32/source/Clipper.Core.pas @@ -3,11 +3,11 @@ (******************************************************************************* * Author : Angus Johnson * * Date : 22 November 2024 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2010-2024 * * Purpose : Core Clipper Library module * * Contains structures and functions used throughout the library * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) {$I Clipper.inc} diff --git a/Ext/SVGIconImageList/Image32/source/Clipper.Engine.pas b/Ext/SVGIconImageList/Image32/source/Clipper.Engine.pas index 2903403..e66db76 100644 --- a/Ext/SVGIconImageList/Image32/source/Clipper.Engine.pas +++ b/Ext/SVGIconImageList/Image32/source/Clipper.Engine.pas @@ -3,10 +3,10 @@ (******************************************************************************* * Author : Angus Johnson * * Date : 22 November 2024 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2010-2024 * * Purpose : This is the main polygon clipping module * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -899,7 +899,7 @@ function PointInOpPolygon(const pt: TPoint64; op: POutPt): TPointInPolygonResult while (op2 <> op) and (op2.pt.Y > pt.Y) do op2 := op2.next; if (op2 = op) then break; - // must have touched or crossed the pt.Y horizonal + // must have touched or crossed the pt.Y horizontal // and this must happen an even number of times if (op2.pt.Y = pt.Y) then // touching the horizontal @@ -2690,7 +2690,7 @@ procedure TClipperBase.IntersectEdges(e1, e2: PActive; pt: TPoint64); end else if IsFront(e1) or (e1.outrec = e2.outrec) then begin // this 'else if' condition isn't strictly needed but - // it's sensible to split polygons that ony touch at + // it's sensible to split polygons that only touch at // a common vertex (not at common edges). op := AddLocalMaxPoly(e1, e2, pt); {$IFDEF USINGZ} @@ -3528,7 +3528,7 @@ procedure TClipperBase.DoHorizontal(horzEdge: PActive); end; if IsHotEdge(horzEdge) then begin - //nb: The outrec containining the op returned by IntersectEdges + //nb: The outrec containing the op returned by IntersectEdges //above may no longer be associated with horzEdge. FHorzSegList.Add(GetLastOp(horzEdge)); end; diff --git a/Ext/SVGIconImageList/Image32/source/Clipper.Minkowski.pas b/Ext/SVGIconImageList/Image32/source/Clipper.Minkowski.pas index bacb3ea..d2e9705 100644 --- a/Ext/SVGIconImageList/Image32/source/Clipper.Minkowski.pas +++ b/Ext/SVGIconImageList/Image32/source/Clipper.Minkowski.pas @@ -5,7 +5,7 @@ * Date : 21 December 2023 * * Copyright : Angus Johnson 2010-2022 * * Purpose : Minkowski Addition and Difference * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) {$I Clipper.inc} diff --git a/Ext/SVGIconImageList/Image32/source/Clipper.Offset.pas b/Ext/SVGIconImageList/Image32/source/Clipper.Offset.pas index 7759097..e9c474b 100644 --- a/Ext/SVGIconImageList/Image32/source/Clipper.Offset.pas +++ b/Ext/SVGIconImageList/Image32/source/Clipper.Offset.pas @@ -2,11 +2,11 @@ (******************************************************************************* * Author : Angus Johnson * -* Date : 22 November 2024 * -* Website : http://www.angusj.com * -* Copyright : Angus Johnson 2010-2024 * +* Date : 22 January 2025 * +* Website : https://www.angusj.com * +* Copyright : Angus Johnson 2010-2025 * * Purpose : Path Offset (Inflate/Shrink) * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) {$I Clipper.inc} @@ -142,6 +142,20 @@ implementation TwoPi : Double = 2 * PI; InvTwoPi : Double = 1/(2 * PI); +// Clipper2 approximates arcs by using series of relatively short straight +//line segments. And logically, shorter line segments will produce better arc +// approximations. But very short segments can degrade performance, usually +// with little or no discernable improvement in curve quality. Very short +// segments can even detract from curve quality, due to the effects of integer +// rounding. Since there isn't an optimal number of line segments for any given +// arc radius (that perfectly balances curve approximation with performance), +// arc tolerance is user defined. Nevertheless, when the user doesn't define +// an arc tolerance (ie leaves alone the 0 default value), the calculated +// default arc tolerance (offset_radius / 500) generally produces good (smooth) +// arc approximations without producing excessively small segment lengths. +// See also: https://www.angusj.com/clipper2/Docs/Trigonometry.htm +const arc_const = 0.002; // <-- 1/500 + //------------------------------------------------------------------------------ // Miscellaneous offset support functions //------------------------------------------------------------------------------ @@ -364,13 +378,12 @@ procedure TClipperOffset.DoGroupOffset(group: TGroup); if (group.joinType = jtRound) or (group.endType = etRound) then begin // calculate the number of steps required to approximate a circle - // (see http://www.angusj.com/clipper2/Docs/Trigonometry.htm) + // (see https://www.angusj.com/clipper2/Docs/Trigonometry.htm) // arcTol - when arc_tolerance_ is undefined (0) then curve imprecision // will be relative to the size of the offset (delta). Obviously very //large offsets will almost always require much less precision. - arcTol := Iif(fArcTolerance > 0.01, - Min(absDelta, fArcTolerance), - Log10(2 + absDelta) * 0.25); // empirically derived + arcTol := Iif(fArcTolerance > 0.0, + Min(absDelta, fArcTolerance), absDelta * arc_const); stepsPer360 := Pi / ArcCos(1 - arcTol / absDelta); if (stepsPer360 > absDelta * Pi) then @@ -745,7 +758,7 @@ function IntersectPoint(const ln1a, ln1b, ln2a, ln2b: TPointD): TPointD; m1,b1,m2,b2: double; begin result := NullPointD; - //see http://astronomy.swin.edu.au/~pbourke/geometry/lineline2d/ + //see https://paulbourke.net/geometry/pointlineplane/#i2l if (ln1B.X = ln1A.X) then begin if (ln2B.X = ln2A.X) then exit; //parallel lines @@ -917,10 +930,8 @@ procedure TClipperOffset.DoRound(j, k: Integer; angle: double); // when fDeltaCallback64 is assigned, fGroupDelta won't be constant, // so we'll need to do the following calculations for *every* vertex. absDelta := Abs(fGroupDelta); - arcTol := Iif(fArcTolerance > 0.01, - Min(absDelta, fArcTolerance), - Log10(2 + absDelta) * 0.25); // empirically derived - //http://www.angusj.com/clipper2/Docs/Trigonometry.htm + arcTol := Iif(fArcTolerance > 0.0, + Min(absDelta, fArcTolerance), absDelta * arc_const); stepsPer360 := Pi / ArcCos(1 - arcTol / absDelta); if (stepsPer360 > absDelta * Pi) then stepsPer360 := absDelta * Pi; // avoid excessive precision diff --git a/Ext/SVGIconImageList/Image32/source/Clipper.RectClip.pas b/Ext/SVGIconImageList/Image32/source/Clipper.RectClip.pas index 91fbba6..a6898ba 100644 --- a/Ext/SVGIconImageList/Image32/source/Clipper.RectClip.pas +++ b/Ext/SVGIconImageList/Image32/source/Clipper.RectClip.pas @@ -3,10 +3,10 @@ (******************************************************************************* * Author : Angus Johnson * * Date : 5 July 2024 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2010-2024 * * Purpose : FAST rectangular clipping * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface diff --git a/Ext/SVGIconImageList/Image32/source/Clipper.inc b/Ext/SVGIconImageList/Image32/source/Clipper.inc index 5b15f92..17da40d 100644 --- a/Ext/SVGIconImageList/Image32/source/Clipper.inc +++ b/Ext/SVGIconImageList/Image32/source/Clipper.inc @@ -7,7 +7,7 @@ {.$DEFINE USINGZ} /////////////////////////////////////////////////////////////////////////////// -//COMPILER DIFINED PREPROCESSOR DIRECTIVES (ie. do not touch ;)) +//COMPILER DEFINED PREPROCESSOR DIRECTIVES (ie. do not touch ;)) /////////////////////////////////////////////////////////////////////////////// {$IFDEF FPC} diff --git a/Ext/SVGIconImageList/Image32/source/Clipper.pas b/Ext/SVGIconImageList/Image32/source/Clipper.pas index 1520c67..09a33f4 100644 --- a/Ext/SVGIconImageList/Image32/source/Clipper.pas +++ b/Ext/SVGIconImageList/Image32/source/Clipper.pas @@ -3,10 +3,10 @@ (******************************************************************************* * Author : Angus Johnson * * Date : 7 May 2024 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2010-2024 * * Purpose : This module provides a simple interface to the Clipper Library * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -821,7 +821,7 @@ function DistanceSqrd(const pt1, pt2: TPoint64): double; var x1,y1,x2,y2: double; begin - // nb: older versions of Delphi don't allow explicit typcasting + // nb: older versions of Delphi don't allow explicit typecasting x1 := pt1.X; y1 := pt1.Y; x2 := pt2.X; y2 := pt2.Y; result := Sqr(x1 - x2) + Sqr(y1 - y2); diff --git a/Ext/SVGIconImageList/Image32/source/Img32.CQ.pas b/Ext/SVGIconImageList/Image32/source/Img32.CQ.pas index be23b72..2fae705 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.CQ.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.CQ.pas @@ -4,11 +4,11 @@ * Author : Angus Johnson * * Version : 4.7 * * Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : Color reduction for TImage32 * * : Uses Octree Color Quantization & Floyd / Steinberg Dithering * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Clipper2.pas b/Ext/SVGIconImageList/Image32/source/Img32.Clipper2.pas index ef09151..eccd8dc 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Clipper2.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Clipper2.pas @@ -4,10 +4,10 @@ * Author : Angus Johnson * * Version : 4.7 * * Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : Wrapper module for the Clipper library * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Draw.pas b/Ext/SVGIconImageList/Image32/source/Img32.Draw.pas index 9e9fb33..6aea69c 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Draw.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Draw.pas @@ -3,15 +3,15 @@ (******************************************************************************* * Author : Angus Johnson * * Version : 4.8 * -* Date : 10 January 2025 * -* Website : http://www.angusj.com * +* Date : 2 February 2025 * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * * * Purpose : Polygon renderer for TImage32 * * * * License : Use, modification & distribution is subject to * * Boost Software License Ver 1 * -* http://www.boost.org/LICENSE_1_0.txt * +* https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -144,8 +144,15 @@ TEraseRenderer = class(TCustomRenderer) end; TInverseRenderer = class(TCustomRenderer) + private + fBackImage : TImage32; + fCurrBackY : integer; + fCurrBkLinePtr : Pointer; protected + function GetSrcPixel(x, y: integer): Pointer; procedure RenderProc(x1, x2, y: integer; alpha: PByte); override; + public + constructor Create(bkImg: TImage32 = nil); reintroduce; end; TImageRenderer = class(TCustomRenderer) @@ -321,8 +328,18 @@ TBarycentricRenderer = class(TCustomRenderer) joinStyle: TJoinStyle = jsAuto); overload; procedure DrawInvertedDashedLine(img: TImage32; const lines: TPathsD; dashPattern: TArrayOfDouble; - patternOffset: PDouble; lineWidth: double; - endStyle: TEndStyle; joinStyle: TJoinStyle = jsAuto); overload; + patternOffset: PDouble; lineWidth: double; endStyle: TEndStyle; + joinStyle: TJoinStyle = jsAuto); overload; + // bkgndImg - an alternative background image + // (useful when drawing on a layered image) + procedure DrawInvertedDashedLine(img, bkgndImg: TImage32; + const line: TPathD; dashPattern: TArrayOfDouble; + patternOffset: PDouble; lineWidth: double; endStyle: TEndStyle; + joinStyle: TJoinStyle = jsAuto); overload; + procedure DrawInvertedDashedLine(img, bkgndImg: TImage32; + const lines: TPathsD; dashPattern: TArrayOfDouble; + patternOffset: PDouble; lineWidth: double; endStyle: TEndStyle; + joinStyle: TJoinStyle = jsAuto); overload; procedure DrawPolygon(img: TImage32; const polygon: TPathD; fillRule: TFillRule; color: TColor32); overload; @@ -354,6 +371,13 @@ TBarycentricRenderer = class(TCustomRenderer) // MISCELLANEOUS FUNCTIONS // ///////////////////////////////////////////////////////////////////////// + procedure EraseLine(img: TImage32; const line: TPathD; lineWidth: double; + endStyle: TEndStyle; joinStyle: TJoinStyle = jsAuto; + miterLimit: double = 2); overload; + procedure EraseLine(img: TImage32; const lines: TPathsD; lineWidth: double; + endStyle: TEndStyle; joinStyle: TJoinStyle = jsAuto; + miterLimit: double = 2); overload; + procedure ErasePolygon(img: TImage32; const polygon: TPathD; fillRule: TFillRule); overload; procedure ErasePolygon(img: TImage32; const polygons: TPathsD; @@ -506,7 +530,7 @@ function GetPixel(current: PARGB; delta: integer): PARGB; end; // ------------------------------------------------------------------------------ -// Here "const" is used for opimization reasons, to skip the +// Here "const" is used for optimization reasons, to skip the // dyn-array reference counting. "const" for dyn-arrays doesn't // prevent one from changing the array's content. procedure ReverseColors(const colors: TArrayOfGradientColor); @@ -1249,7 +1273,7 @@ procedure Rasterize(const paths: TPathsD; const clipRec: TRect; FillByteBuffer: procedure(byteBuffer: PByte; windingAccum: PDouble; count: nativeint); begin // See also https://nothings.org/gamedev/rasterize/ - if not assigned(renderer) then Exit; + if not assigned(paths) or not assigned(renderer) then Exit; renderer.SetClipRect(clipRec); skipRenderer := renderer.SupportsRenderProcSkip; @@ -1395,7 +1419,7 @@ function TCustomRenderer.Initialize(imgBase: Pointer; fPixelSize := pixelSize; fCurrLinePtr := fImgBase; - fCurrY := 0; + fCurrY := -1; result := true; end; // ------------------------------------------------------------------------------ @@ -1848,7 +1872,7 @@ procedure TCustomGradientRenderer.SetParameters(startColor, endColor: TColor32; gradFillStyle: TGradientFillStyle = gfsClamp); begin SetGradientFillStyle(gradFillStyle); - // reset gradient colors if perviously set + // reset gradient colors if previously set SetLength(fGradientColors, 2); fGradientColors[0].offset := 0; fGradientColors[0].color := startColor; @@ -2239,23 +2263,74 @@ procedure TEraseRenderer.RenderProc(x1, x2, y: integer; alpha: PByte); // TInverseRenderer // ------------------------------------------------------------------------------ +constructor TInverseRenderer.Create(bkImg: TImage32); +begin + inherited Create; + fCurrBackY := -1; + // bkImg, when assigned, is the background master image + // and fImage is very likely a transparent (layered) image + fBackImage := bkImg; +end; +// ------------------------------------------------------------------------------ + +function TInverseRenderer.GetSrcPixel(x, y: integer): Pointer; +begin + if (y <> fCurrBackY) then + begin + fCurrBackY := y; + fCurrBkLinePtr := fBackImage.PixelBase; + inc(PByte(fCurrBkLinePtr), y * fImgWidth * fPixelSize); + end; + Result := fCurrBkLinePtr; + inc(PByte(Result), x * fPixelSize); +end; +// ------------------------------------------------------------------------------ + +function IsMidColor(const color: TARGB): Boolean; +{$IFDEF INLINE} inline; {$ENDIF} +begin + // not too dark and not too light :)) + Result := Abs(color.R + color.G + color.B - 383) < 64; +end; +// ------------------------------------------------------------------------------ + procedure TInverseRenderer.RenderProc(x1, x2, y: integer; alpha: PByte); var i: integer; - dst: PARGB; + src, dst: PARGB; c: TARGB; begin dst := PARGB(GetDstPixel(x1,y)); - for i := x1 to x2 do + if Assigned(fBackImage) then begin - c.Color := not dst.Color; - c.A := MulTable[dst.A, Ord(alpha^)]; - dst.Color := BlendToAlpha(dst.Color, c.Color); - inc(dst); inc(alpha); + src := PARGB(GetSrcPixel(x1,y)); + for i := x1 to x2 do + begin + if src.Color = 0 then c.Color := clBlack32 + else if IsMidColor(src^) then c.Color := clWhite32 + else c.Color := not src.Color; + c.A := Ord(alpha^); + dst.Color := BlendToAlpha(dst.Color, c.Color); + inc(dst); inc(src); inc(alpha); + end; + end else + begin + for i := x1 to x2 do + begin + if dst.Color = 0 then c.Color := clBlack32 + else if IsMidColor(dst^) then c.Color := clWhite32 + else c.Color := not dst.Color; + c.A := Ord(alpha^); + dst.Color := BlendToAlpha(dst.Color, c.Color); + inc(dst); inc(alpha); + end; end; end; // ------------------------------------------------------------------------------ +// TBarycentricRenderer +// ------------------------------------------------------------------------------ + procedure TBarycentricRenderer.SetParameters(const a, b, c: TPointD; c1, c2, c3: TColor32); @@ -2615,7 +2690,7 @@ procedure DrawDashedLine(img: TImage32; const lines: TPathsD; end; // ------------------------------------------------------------------------------ -procedure DrawInvertedDashedLine(img: TImage32; +procedure DrawInvertedDashedLine(img, bkgndImg: TImage32; const line: TPathD; dashPattern: TArrayOfDouble; patternOffset: PDouble; lineWidth: double; endStyle: TEndStyle; joinStyle: TJoinStyle = jsAuto); @@ -2624,7 +2699,14 @@ procedure DrawInvertedDashedLine(img: TImage32; lines: TPathsD; renderer: TInverseRenderer; begin - if not assigned(line) then exit; + // when using an alterate background image, + // make sure it's the same size as img ... + if Assigned(bkgndImg) and + (bkgndImg.Width <> img.Width) or + (bkgndImg.Height <> img.Height) then bkgndImg := nil; + + if not assigned(line) or img.IsEmpty then exit; + if (lineWidth < MinStrokeWidth) then lineWidth := MinStrokeWidth; for i := 0 to High(dashPattern) do @@ -2633,7 +2715,7 @@ procedure DrawInvertedDashedLine(img: TImage32; lines := GetDashedPath(line, endStyle = esPolygon, dashPattern, patternOffset); if Length(lines) = 0 then Exit; lines := RoughOutline(lines, lineWidth, joinStyle, endStyle); - renderer := TInverseRenderer.Create; + renderer := TInverseRenderer.Create(bkgndImg); try Rasterize(img, lines, img.bounds, frNonZero, renderer); finally @@ -2642,16 +2724,40 @@ procedure DrawInvertedDashedLine(img: TImage32; end; // ------------------------------------------------------------------------------ +procedure DrawInvertedDashedLine(img, bkgndImg: TImage32; + const lines: TPathsD; dashPattern: TArrayOfDouble; + patternOffset: PDouble; lineWidth: double; endStyle: TEndStyle; + joinStyle: TJoinStyle = jsAuto); +var + i: integer; +begin + if not assigned(lines) then exit; + for i := 0 to high(lines) do + DrawInvertedDashedLine(img, bkgndImg, lines[i], + dashPattern, patternOffset, lineWidth, endStyle, joinStyle); +end; +// ------------------------------------------------------------------------------ + +procedure DrawInvertedDashedLine(img: TImage32; + const line: TPathD; dashPattern: TArrayOfDouble; + patternOffset: PDouble; lineWidth: double; endStyle: TEndStyle; + joinStyle: TJoinStyle); +begin + DrawInvertedDashedLine(img, nil, line, + dashPattern, patternOffset, lineWidth, endStyle, joinStyle); +end; +// ------------------------------------------------------------------------------ + procedure DrawInvertedDashedLine(img: TImage32; const lines: TPathsD; dashPattern: TArrayOfDouble; - patternOffset: PDouble; lineWidth: double; - endStyle: TEndStyle; joinStyle: TJoinStyle = jsAuto); + patternOffset: PDouble; lineWidth: double; endStyle: TEndStyle; + joinStyle: TJoinStyle); var i: integer; begin if not assigned(lines) then exit; for i := 0 to high(lines) do - DrawInvertedDashedLine(img, lines[i], + DrawInvertedDashedLine(img, nil, lines[i], dashPattern, patternOffset, lineWidth, endStyle, joinStyle); end; // ------------------------------------------------------------------------------ @@ -2783,6 +2889,33 @@ procedure DrawPolygon_ClearType(img: TImage32; const polygons: TPathsD; end; // ------------------------------------------------------------------------------ +procedure EraseLine(img: TImage32; const line: TPathD; lineWidth: double; + endStyle: TEndStyle; joinStyle: TJoinStyle = jsAuto; miterLimit: double = 2); +var + lines: TPathsD; +begin + if not assigned(line) then exit; + setLength(lines, 1); + lines[0] := line; + EraseLine(img, lines, lineWidth, endStyle, joinStyle, miterLimit); +end; +// ------------------------------------------------------------------------------ + +procedure EraseLine(img: TImage32; const lines: TPathsD; lineWidth: double; + endStyle: TEndStyle; joinStyle: TJoinStyle = jsAuto; miterLimit: double = 2); +var + er: TEraseRenderer; +begin + if not assigned(lines) then exit; + er := TEraseRenderer.Create; + try + DrawLine(img, lines, lineWidth, er, endStyle, joinStyle, miterLimit); + finally + er.Free; + end; +end; +// ------------------------------------------------------------------------------ + procedure ErasePolygon(img: TImage32; const polygon: TPathD; fillRule: TFillRule); var diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Extra.pas b/Ext/SVGIconImageList/Image32/source/Img32.Extra.pas index bf667b5..a639e12 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Extra.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Extra.pas @@ -3,11 +3,11 @@ (******************************************************************************* * Author : Angus Johnson * * Version : 4.8 * -* Date : 10 January 2025 * -* Website : http://www.angusj.com * +* Date : 2 February 2025 * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : Miscellaneous routines that don't belong in other modules. * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -30,7 +30,7 @@ procedure DrawEdge(img: TImage32; const path: TPathD; topLeftColor, bottomRightColor: TColor32; penWidth: double = 1.0; closePath: Boolean = true); overload; -//DrawShadowRect: is **much** faster than DrawShadow +// DrawShadowRect: is **much** faster than DrawShadow procedure DrawShadowRect(img: TImage32; const rec: TRect; depth: double; angle: double = angle45; color: TColor32 = $80000000); procedure DrawShadow(img: TImage32; const polygon: TPathD; @@ -45,8 +45,8 @@ procedure DrawGlow(img: TImage32; const polygon: TPathD; procedure DrawGlow(img: TImage32; const polygons: TPathsD; fillRule: TFillRule; color: TColor32; blurRadius: integer); overload; -//FloodFill: If no CompareFunc is provided, FloodFill will fill whereever -//adjoining pixels exactly match the starting pixel - Point(x,y). +// FloodFill: If no CompareFunc is provided, FloodFill will fill wherever +// adjoining pixels exactly match the starting pixel - Point(x,y). procedure FloodFill(img: TImage32; x, y: Integer; newColor: TColor32; tolerance: Byte = 0; compareFunc: TCompareFunctionEx = nil); @@ -57,16 +57,24 @@ procedure FastGaussianBlur(img: TImage32; procedure GaussianBlur(img: TImage32; rec: TRect; radius: Integer); -//Emboss: A smaller radius is sharper. Increasing depth increases contrast. -//Luminance changes grayscale balance (unless preserveColor = true) +// Emboss: A smaller radius is sharper. Increasing depth increases contrast. +// Luminance changes grayscale balance (unless preserveColor = true) procedure Emboss(img: TImage32; radius: Integer = 1; depth: Integer = 10; luminance: Integer = 75; preserveColor: Boolean = false); -//Sharpen: Radius range is 1 - 10; amount range is 1 - 50.
-//see https://en.wikipedia.org/wiki/Unsharp_masking +// Sharpen: Radius range is 1 - 10; amount range is 1 - 50.
+// see https://en.wikipedia.org/wiki/Unsharp_masking procedure Sharpen(img: TImage32; radius: Integer = 2; amount: Integer = 10); -//HatchBackground: Assumes the current image is semi-transparent. +// Hatch: This will overwrite the image and ignore any transparency +procedure Hatch(img: TImage32; color1: TColor32 = clWhite32; + color2: TColor32= $FFE8E8E8; hatchSize: Integer = 10); overload; +procedure Hatch(img: TImage32; const rec: TRect; + color1: TColor32 = clWhite32; color2: TColor32= $FFE8E8E8; + hatchSize: Integer = 10); overload; + +// HatchBackground: hatches behind the existing image, so +// it assumes the current image is semi-transparent. procedure HatchBackground(img: TImage32; color1: TColor32 = clWhite32; color2: TColor32= $FFE8E8E8; hatchSize: Integer = 10); overload; procedure HatchBackground(img: TImage32; const rec: TRect; @@ -77,22 +85,27 @@ procedure GridBackground(img: TImage32; majorInterval, minorInterval: integer; fillColor: TColor32 = clWhite32; majColor: TColor32 = $30000000; minColor: TColor32 = $20000000); +procedure ReplaceColor(img: TImage32; oldColor, newColor: TColor32; + channelTolerance: Byte; preserveAlpha: Boolean = false); procedure ReplaceExactColor(img: TImage32; oldColor, newColor: TColor32); -//RemoveColor: Removes the specified color from the image, even from -//pixels that are a blend of colors including the specified color.
-//see https://stackoverflow.com/questions/9280902/ +// RemoveColor: Removes the specified color from the image, even from +// pixels that are a blend of colors including the specified color.
+// see https://stackoverflow.com/questions/9280902/ procedure RemoveColor(img: TImage32; color: TColor32); +procedure RemoveExactColor(img: TImage32; color: TColor32); +// RemoveAllExceptColor: Opposite of RemoveColor +procedure RemoveAllExceptColor(img: TImage32; color: TColor32); -//FilterOnColor: Removes everything not nearly matching 'color' -//This uses an algorithm that's very similar to the one in RemoveColor. -procedure FilterOnColor(img: TImage32; color: TColor32); - -procedure FilterOnExactColor(img: TImage32; color: TColor32); +// FilterOnColor - renamed RemoveAllExceptColor +procedure FilterOnColor(img: TImage32; color: TColor32); deprecated; +// FilterOnExactColor - renamed RemoveExactColor +procedure FilterOnExactColor(img: TImage32; color: TColor32); deprecated; -procedure FilterOnAlpha(img: TImage32; alpha: byte; tolerance: byte); +// FilterOnAlpha - simpler just to set alpha to zero below a specified alpha +// procedure FilterOnAlpha(img: TImage32; alpha: byte; tolerance: byte); -//RedEyeRemove: Removes 'red eye' from flash photo images. +// RedEyeRemove: Removes 'red eye' from flash photo images. procedure RedEyeRemove(img: TImage32; const rect: TRect); procedure PencilEffect(img: TImage32; intensity: integer = 0); @@ -173,12 +186,9 @@ function SmoothPath(const path: TPathD; isClosedPath: Boolean; function SmoothPaths(const paths: TPathsD; isClosedPath: Boolean; tension: double = 0; shapeTolerance: double = 0.1): TPathsD; -function GetFloodFillMask(imgIn, imgMaskOut: TImage32; x, y: Integer; - tolerance: Byte; compareFunc: TCompareFunctionEx): Boolean; - -procedure SymmetricCropTransparent(img: TImage32); +function SymmetricCropTransparent(img: TImage32): TPoint; -//3 additional blend functions (see TImage32.CopyBlend) +// Three additional blend functions (see TImage32.CopyBlend) function BlendAverage(bgColor, fgColor: TColor32): TColor32; function BlendLinearBurn(bgColor, fgColor: TColor32): TColor32; function BlendColorDodge(bgColor, fgColor: TColor32): TColor32; @@ -293,14 +303,15 @@ function GetSymmetricCropTransparentRect(img: TImage32): TRect; end; //------------------------------------------------------------------------------ -//SymmetricCropTransparent: after cropping, the image's midpoint -//will be the same pixel as before cropping. (Important for rotating.) -procedure SymmetricCropTransparent(img: TImage32); +// SymmetricCropTransparent: after cropping, the image's midpoint +// will be the same pixel as before cropping. (Important for rotating.) +function SymmetricCropTransparent(img: TImage32): TPoint; var rec: TRect; begin rec := GetSymmetricCropTransparentRect(img); - if (rec.Top > 0) or (rec.Left > 0) then img.Crop(rec); + Result := rec.TopLeft; + if (Result.X > 0) or (Result.Y > 0) then img.Crop(rec); end; //------------------------------------------------------------------------------ @@ -651,6 +662,60 @@ procedure Sharpen(img: TImage32; radius: Integer; amount: Integer); end; //------------------------------------------------------------------------------ +procedure InternalHatch(img: TImage32; const rec: TRect; + color1, color2: TColor32; hatchSize: Integer = 10); +var + i, j, imgWidth: Integer; + pc: PColor32; + colors: array[boolean] of TColor32; + hatch: Boolean; + x: integer; +begin + colors[false] := color1; + colors[true] := color2; + imgWidth := img.Width; + + for i := rec.Top to rec.Bottom -1 do + begin + pc := @img.Pixels[i * imgWidth + rec.Left]; + hatch := Odd(i div hatchSize); + x := (rec.Left + 1) mod hatchSize; + if x = 0 then hatch := not hatch; + for j := rec.Left to rec.Right -1 do + begin + pc^ := colors[hatch]; + inc(pc); inc(x); + if x >= hatchSize then + begin + x := 0; + hatch := not hatch; + end; + end; + end; +end; +//------------------------------------------------------------------------------ + +procedure Hatch(img: TImage32; color1: TColor32 = clWhite32; + color2: TColor32= $FFE8E8E8; hatchSize: Integer = 10); +begin + Hatch(img, img.Bounds, color1, color2, hatchSize); +end; +//------------------------------------------------------------------------------ + +procedure Hatch(img: TImage32; const rec: TRect; + color1: TColor32 = clWhite32; color2: TColor32= $FFE8E8E8; + hatchSize: Integer = 10); +begin + if (rec.Right <= rec.Left) or (rec.Bottom - rec.Top <= 0) then Exit; + img.BeginUpdate; + try + InternalHatch(img, rec, color1, color2, hatchSize); + finally + img.EndUpdate; + end; +end; +//------------------------------------------------------------------------------ + procedure InternalHatchBackground(img: TImage32; const rec: TRect; color1, color2: TColor32; hatchSize: Integer = 10); var @@ -727,8 +792,6 @@ procedure GridBackground(img: TImage32; majorInterval, minorInterval: integer; try if minorInterval > 0 then begin - //cr.SetColor(minColor); - x := minorInterval; path[0] := PointD(x, 0); path[1] := PointD(x, h);; for i := 1 to (w div minorInterval) do @@ -798,6 +861,40 @@ procedure ReplaceExactColor(img: TImage32; oldColor, newColor: TColor32); end; //------------------------------------------------------------------------------ +procedure ReplaceColor(img: TImage32; oldColor, newColor: TColor32; + channelTolerance: Byte; preserveAlpha: Boolean); +var + c: PARGB; + a,r,g,b: Byte; + i: Integer; +begin + c := PARGB(img.PixelBase); + a := TARGB(oldColor).A; + r := TARGB(oldColor).R; + g := TARGB(oldColor).G; + b := TARGB(oldColor).B; + + if preserveAlpha then + begin + newColor := newColor and $FFFFFF; + for i := 0 to img.Width * img.Height -1 do + begin + if Abs(c.R - r) + Abs(c.G - g) + Abs(c.B - b) <= channelTolerance then + c.Color := a or newColor; + inc(c); + end + end else + for i := 0 to img.Width * img.Height -1 do + begin + if (Abs(c.A - a) <= channelTolerance) and + (Abs(c.R - r) <= channelTolerance) and + (Abs(c.G - g) <= channelTolerance) and + (Abs(c.B - b) <= channelTolerance) then c.Color := newColor; + inc(c); + end +end; +//------------------------------------------------------------------------------ + procedure RemoveColor(img: TImage32; color: TColor32); var fg: TARGB absolute color; @@ -827,12 +924,14 @@ procedure RemoveColor(img: TImage32; color: TColor32); if (Q = 0) then bg.Color := clNone32 - else if (Q < 255) then + else if (Q = 255) then + // do nothing + else begin bg.A := MulTable[bg.A, Q]; - bg.R := DivTable[bg.R - MulTable[not Q, fg.R], Q]; - bg.G := DivTable[bg.G - MulTable[not Q, fg.G], Q]; - bg.B := DivTable[bg.B - MulTable[not Q, fg.B], Q]; + bg.R := DivTable[ClampByte(bg.R - MulTable[not Q, fg.R]), Q]; + bg.G := DivTable[ClampByte(bg.G - MulTable[not Q, fg.G]), Q]; + bg.B := DivTable[ClampByte(bg.B - MulTable[not Q, fg.B]), Q]; end; end; inc(bg); @@ -840,7 +939,7 @@ procedure RemoveColor(img: TImage32; color: TColor32); end; //------------------------------------------------------------------------------ -procedure FilterOnColor(img: TImage32; color: TColor32); +procedure RemoveAllExceptColor(img: TImage32; color: TColor32); var fg: TARGB absolute color; bg: PARGB; @@ -854,24 +953,16 @@ procedure FilterOnColor(img: TImage32; color: TColor32); if bg.A > 0 then begin // red - if (bg.R > fg.R) then - Q := bg.R - fg.R - else if (bg.R < fg.R) then - Q := DivTable[fg.R - bg.R, fg.R] - else - Q := 0; - + if (bg.R > fg.R) then Q := bg.R - fg.R + else if (bg.R < fg.R) then Q := DivTable[fg.R - bg.R, fg.R] + else Q := 0; // green - if (bg.G > fg.G) then - Q := Max(Q, bg.G - fg.G) - else if (bg.G < fg.G) then - Q := Max(Q, DivTable[fg.G - bg.G, fg.G]); + if (bg.G > fg.G) then Q := Max(Q, bg.G - fg.G) + else if (bg.G < fg.G) then Q := Max(Q, DivTable[fg.G - bg.G, fg.G]); // blue - if (bg.B > fg.B) then - Q := Max(Q, bg.B - fg.B) - else if (bg.B < fg.B) then - Q := Max(Q, DivTable[fg.B - bg.B, fg.B]); + if (bg.B > fg.B) then Q := Max(Q, bg.B - fg.B) + else if (bg.B < fg.B) then Q := Max(Q, DivTable[fg.B - bg.B, fg.B]); // weight Q toward either fully opaque or fully translucent Q := Sigmoid[Q]; @@ -885,7 +976,13 @@ procedure FilterOnColor(img: TImage32; color: TColor32); end; //------------------------------------------------------------------------------ -procedure FilterOnExactColor(img: TImage32; color: TColor32); +procedure FilterOnColor(img: TImage32; color: TColor32); +begin + RemoveAllExceptColor(img, color); +end; +//------------------------------------------------------------------------------ + +procedure RemoveExactColor(img: TImage32; color: TColor32); var pc: PColor32; i: Integer; @@ -904,20 +1001,26 @@ procedure FilterOnExactColor(img: TImage32; color: TColor32); end; //------------------------------------------------------------------------------ -procedure FilterOnAlpha(img: TImage32; alpha: byte; tolerance: byte); -var - bg: PARGB; - i: Integer; +procedure FilterOnExactColor(img: TImage32; color: TColor32); begin - bg := PARGB(img.PixelBase); - for i := 0 to img.Width * img.Height -1 do - begin - if abs(bg.A - alpha) > tolerance then bg.A := 0; - inc(bg); - end; + RemoveExactColor(img, color); end; //------------------------------------------------------------------------------ +// procedure FilterOnAlpha(img: TImage32; alpha: byte; tolerance: byte); +// var +// bg: PARGB; +// i: Integer; +// begin +// bg := PARGB(img.PixelBase); +// for i := 0 to img.Width * img.Height -1 do +// begin +// if abs(bg.A - alpha) > tolerance then bg.A := 0; +// inc(bg); +// end; +// end; +//------------------------------------------------------------------------------ + procedure RedEyeRemove(img: TImage32; const rect: TRect); var k: integer; @@ -1216,7 +1319,7 @@ function DrawButton(img: TImage32; const pt: TPointD; if ba3D in buttonAttributes then Draw3D(img, Result, frNonZero, lightSize*2, Ceil(lightSize), $CCFFFFFF, $AA000000, lightAngle); - DrawLine(img, Result, dpiAware1, clBlack32, esPolygon); + DrawLine(img, Result, dpiAware1, clBlack32, esPolygon, jsButt); finally img.EndUpdate; end; @@ -2299,8 +2402,8 @@ procedure GaussianBlur(img: TImage32; rec: TRect; radius: Integer); // FastGaussian blur - and support functions //------------------------------------------------------------------------------ -//http://blog.ivank.net/fastest-gaussian-blur.html -//https://www.peterkovesi.com/papers/FastGaussianSmoothing.pdf +// http://blog.ivank.net/fastest-gaussian-blur.html +// https://www.peterkovesi.com/papers/FastGaussianSmoothing.pdf function BoxesForGauss(stdDev, boxCnt: integer): TArrayOfInteger; var diff --git a/Ext/SVGIconImageList/Image32/source/Img32.FMX.pas b/Ext/SVGIconImageList/Image32/source/Img32.FMX.pas index a624bc2..060873f 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.FMX.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.FMX.pas @@ -4,10 +4,10 @@ * Author : Angus Johnson * * Version : 4.7 * * Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : Image file format support for TImage32 and FMX * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Fmt.BMP.pas b/Ext/SVGIconImageList/Image32/source/Img32.Fmt.BMP.pas index 091b6ac..84bfc9b 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Fmt.BMP.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Fmt.BMP.pas @@ -4,10 +4,10 @@ * Author : Angus Johnson * * Version : 4.7 * * Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : BMP file format extension for TImage32 * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Fmt.GIF.pas b/Ext/SVGIconImageList/Image32/source/Img32.Fmt.GIF.pas index 79f9274..bb0b2de 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Fmt.GIF.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Fmt.GIF.pas @@ -3,10 +3,10 @@ * Author : Angus Johnson * * Version : 4.7 * * Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : GIF file format extension for TImage32 * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Fmt.JPG.pas b/Ext/SVGIconImageList/Image32/source/Img32.Fmt.JPG.pas index 35cdc56..9c9e291 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Fmt.JPG.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Fmt.JPG.pas @@ -4,10 +4,10 @@ * Author : Angus Johnson * * Version : 4.7 * * Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : JPG/JPEG file format extension for TImage32 * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Fmt.PNG.pas b/Ext/SVGIconImageList/Image32/source/Img32.Fmt.PNG.pas index fbb6583..f44381d 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Fmt.PNG.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Fmt.PNG.pas @@ -4,10 +4,10 @@ * Author : Angus Johnson * * Version : 4.7 * * Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : PNG file format extension for TImage32 * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Fmt.QOI.pas b/Ext/SVGIconImageList/Image32/source/Img32.Fmt.QOI.pas index 5b21f3d..f88a68d 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Fmt.QOI.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Fmt.QOI.pas @@ -3,10 +3,10 @@ * Author : Angus Johnson * * Version : 4.7 * * Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : QOI file format extension for TImage32 * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) (******************************************************************************* @@ -99,7 +99,7 @@ function SwapBytes(Value: Cardinal): Cardinal; function ReadByte(var p: PByte): Byte; {$IFDEF INLINE} inline; {$ENDIF} begin - Result := Byte(p^); //nb: Delphi 7 compatability + Result := Byte(p^); //nb: Delphi 7 compatibility inc(p); end; diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Fmt.SVG.pas b/Ext/SVGIconImageList/Image32/source/Img32.Fmt.SVG.pas index 7d12357..02fabbe 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Fmt.SVG.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Fmt.SVG.pas @@ -4,10 +4,10 @@ * Author : Angus Johnson * * Version : 4.7 * * Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : SVG file format extension for TImage32 * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Layers.pas b/Ext/SVGIconImageList/Image32/source/Img32.Layers.pas index 06c3e8d..ec6996d 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Layers.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Layers.pas @@ -2,12 +2,12 @@ (******************************************************************************* * Author : Angus Johnson * -* Version : 4.7 * -* Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Version : 4.8 * +* Date : 11 Febuary 2025 * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : Layered images support * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -74,7 +74,6 @@ TLayer32 = class(TStorage) {$IFNDEF NO_STORAGE} fStreamingRec : TRectWH; {$ENDIF} - fDesignerLayer : Boolean; function GetMidPoint: TPointD; procedure SetVisible(value: Boolean); procedure SetHeight(value: double); @@ -88,11 +87,12 @@ TLayer32 = class(TStorage) function GetPrevLayerInGroup: TLayer32; function GetLayer32Parent: TLayer32; procedure SetLayer32Parent(parent: TLayer32); - procedure SetOuterMargin(value: double); procedure CreateInternal(parent: TStorage = nil; const name: string = ''); protected - UpdateInfo : TUpdateInfo; + fIsDesignLayer : Boolean; + fUpdateInfo : TUpdateInfo; procedure SetDesignerLayer(value: Boolean); + procedure SetOuterMargin(value: double); virtual; function GetUpdateNeeded: Boolean; procedure DoBeforeMerge; virtual; procedure PreMerge(hideDesigners: Boolean); virtual; @@ -111,6 +111,7 @@ TLayer32 = class(TStorage) procedure SetOpacity(value: Byte); virtual; procedure ImageChanged(Sender: TImage32); virtual; procedure UpdateLayeredImage(newLayeredImage: TLayeredImage32); + property UpdateInfo: TUpdateInfo read fUpdateInfo; property UpdateNeeded : Boolean read GetUpdateNeeded; public constructor Create(parent: TStorage = nil; const name: string = ''); overload; override; @@ -152,7 +153,7 @@ TLayer32 = class(TStorage) //Portions of child layers residing outside this region will be clipped. property ClipPath: TPathsD read fClipPath write SetClipPath; procedure Offset(dx, dy: double); overload; virtual; - property IsDesignerLayer: Boolean read fDesignerLayer; + property IsDesignerLayer: Boolean read fIsDesignLayer write SetDesignerLayer; property InnerBounds: TRectD read GetInnerBounds; property InnerRect: TRectD read GetInnerRectD; property OuterBounds: TRectD read GetOuterBounds; @@ -202,16 +203,19 @@ THitTestLayer32 = class(TLayer32) //abstract class property HitTestEnabled: Boolean read GetEnabled write SetEnabled; end; - //TRotLayer32: rotation methods added + //TRotLayer32: rotating and scaling methods added //(abstract base layer for TVectorLayer32 and TRasterLayer32) TRotLayer32 = class(THitTestLayer32) private fAngle : double; + fScaleX : double; + fScaleY : double; fPivotPt : TPointD; fAutoPivot : Boolean; function GetPivotPt: TPointD; procedure SetAutoPivot(val: Boolean); procedure SetAngle(newAngle: double); + procedure Scale(sx, sy: double); virtual; protected procedure SetPivotPt(const pivot: TPointD); virtual; {$IFNDEF NO_STORAGE} @@ -221,7 +225,7 @@ TRotLayer32 = class(THitTestLayer32) public constructor Create(parent: TLayer32 = nil; const name: string = ''); override; function Rotate(angleDelta: double): Boolean; virtual; - procedure ResetAngle; + procedure Reset; procedure Offset(dx, dy: double); override; property Angle: double read fAngle write SetAngle; property PivotPt: TPointD read GetPivotPt write SetPivotPt; @@ -232,10 +236,15 @@ TRotLayer32 = class(THitTestLayer32) //or transforms Paths when bounds change TVectorLayer32 = class(TRotLayer32) private - fPaths : TPathsD; - fOnDraw : TNotifyEvent; + fPaths : TPathsD; + fIsDrawing : Boolean; + fOnDraw : TNotifyEvent; procedure RepositionAndDraw; + function GetRelativePaths: TPathsD; protected + // we need to accommodate drawing bezier splines on TVectorLayer32 where + // the drawn path goes well outside the stored control points (Paths). + //procedure SetOuterMargin(value: double); override; procedure SetPaths(const newPaths: TPathsD); virtual; procedure Draw; virtual; public @@ -243,20 +252,22 @@ TVectorLayer32 = class(TRotLayer32) procedure SetInnerBounds(const newBounds: TRectD); override; procedure Offset(dx,dy: double); override; function Rotate(angleDelta: double): Boolean; override; + procedure Scale(sx, sy: double); override; procedure UpdateHitTestMask(const vectorRegions: TPathsD); virtual; procedure UpdateHitTestMaskFromImage; + procedure AppendPoint(const pt: TPointD); + procedure AppendPath(const path: TPathD); property Paths: TPathsD read fPaths write SetPaths; + property PathsRelativeToLayer: TPathsD read GetRelativePaths; property OnDraw: TNotifyEvent read fOnDraw write fOnDraw; end; TRasterLayer32 = class(TRotLayer32) //display layer for raster images private fMasterImg : TImage32; - //fMatrix: allows combining any number of scaling & rotating ops. - fMatrix : TMatrixD; - fRotating : Boolean; - fPreScaleSize : TSize; fAutoHitTest : Boolean; + fAutoCrop : Boolean; + fCropMargins : TPoint; procedure DoAutoHitTest; protected procedure ImageChanged(Sender: TImage32); override; @@ -269,9 +280,11 @@ TRasterLayer32 = class(TRotLayer32) //display layer for raster images procedure UpdateHitTestMaskTransparent(alphaValue: Byte = 127); overload; virtual; procedure SetInnerBounds(const newBounds: TRectD); override; function Rotate(angleDelta: double): Boolean; override; + procedure Scale(sx, sy: double); override; property AutoSetHitTestMask: Boolean read fAutoHitTest write fAutoHitTest; - property MasterImage: TImage32 read fMasterImg; + property AutoCrop : Boolean read fAutoCrop write fAutoCrop; + property MasterImage : TImage32 read fMasterImg; end; TButtonDesignerLayer32 = class; @@ -469,6 +482,7 @@ implementation rsUpdateRotateGroupError = 'UpdateRotateGroup - invalid group'; rsLayeredImage32Error = 'TLayeredImage32: ''root'' must be a TGroupLayer32'; rsLayer32Error = 'TLayer32 - children must also be TLayer32'; + rsVectorLayer32Error = 'TVectorLayer32 - updating Paths during draw events will cause recursion.'; //------------------------------------------------------------------------------ // TLayerNotifyImage32 @@ -579,11 +593,11 @@ procedure TLayer32.CreateInternal(parent: TStorage = nil; const name: string = ' constructor TLayer32.Create(parent: TStorage; const name: string); begin - fDesignerLayer := true; //must do this first + fIsDesignLayer := true; //must do this first if not Assigned(parent) then CreateInternal(nil, name) else if parent.InheritsFrom(TLayer32) then - //this constructor is commonly overrided in descendant layer classes + //this constructor is commonly overridden in descendant layer classes Create(TLayer32(parent), name) else begin @@ -612,9 +626,9 @@ destructor TLayer32.Destroy; begin Invalidate; rec := OuterBounds; - if not UpdateInfo.priorPosition.IsEmpty then + if not fUpdateInfo.priorPosition.IsEmpty then begin - rec := Parent.MakeAbsolute(UpdateInfo.priorPosition); + rec := Parent.MakeAbsolute(fUpdateInfo.priorPosition); with fLayeredImage do fInvalidRect := UnionRect(fInvalidRect, rec); end; @@ -628,7 +642,7 @@ destructor TLayer32.Destroy; procedure TLayer32.SetDesignerLayer(value: Boolean); begin - fDesignerLayer := value; + fIsDesignLayer := value; end; //------------------------------------------------------------------------------ @@ -653,7 +667,7 @@ procedure TLayer32.SetLayer32Parent(parent: TLayer32); function TLayer32.GetUpdateNeeded: Boolean; begin - Result := (UpdateInfo.updateMethod <> umNone); + Result := (fUpdateInfo.updateMethod <> umNone); end; //------------------------------------------------------------------------------ @@ -661,14 +675,14 @@ procedure TLayer32.Invalidate; var layer : TLayer32; begin - if (UpdateInfo.updateMethod = umSelf) then Exit; - UpdateInfo.updateMethod := umSelf; + if (fUpdateInfo.updateMethod = umSelf) then Exit; + fUpdateInfo.updateMethod := umSelf; layer := Parent; while Assigned(layer) do begin - if layer.UpdateInfo.updateMethod <> umNone then Break; - layer.UpdateInfo.updateMethod := umChild; + if layer.fUpdateInfo.updateMethod <> umNone then Break; + layer.fUpdateInfo.updateMethod := umChild; layer := layer.Parent; end; end; @@ -1118,16 +1132,16 @@ procedure TLayer32.PreMerge(hideDesigners: Boolean); begin if not Visible or (hideDesigners and IsDesignerLayer) or - (UpdateInfo.updateMethod = umNone) then + (fUpdateInfo.updateMethod = umNone) then Continue; - if UpdateInfo.updateMethod = umSelf then + if fUpdateInfo.updateMethod = umSelf then begin - rec := Parent.MakeAbsolute(UpdateInfo.priorPosition); + rec := Parent.MakeAbsolute(fUpdateInfo.priorPosition); with fLayeredImage do fInvalidRect := UnionRect(fInvalidRect, rec); - UpdateInfo.priorPosition := OuterBounds; - rec := Parent.MakeAbsolute(UpdateInfo.priorPosition); + fUpdateInfo.priorPosition := OuterBounds; + rec := Parent.MakeAbsolute(fUpdateInfo.priorPosition); with fLayeredImage do fInvalidRect := UnionRect(fInvalidRect, rec); end; @@ -1180,7 +1194,7 @@ procedure TLayer32.Merge(hideDesigners: Boolean; updateRect: TRect); Continue; //recursive merge - if (UpdateInfo.updateMethod <> umNone) then + if (fUpdateInfo.updateMethod <> umNone) then Merge(hideDesigners, updateRect); if Assigned(fMergeImage) then @@ -1250,7 +1264,7 @@ procedure TLayer32.Merge(hideDesigners: Boolean; updateRect: TRect); end; end; - with UpdateInfo do + with fUpdateInfo do begin priorPosition := OuterBounds; updateMethod := umNone; @@ -1381,7 +1395,7 @@ procedure TGroupLayer32.Invalidate; procedure TGroupLayer32.PreMerge(hideDesigners: Boolean); begin inherited; - if (self <> Root) and (UpdateInfo.updateMethod <> umNone) then + if (self <> Root) and (fUpdateInfo.updateMethod <> umNone) then UpdateGroupBounds; end; //------------------------------------------------------------------------------ @@ -1471,7 +1485,7 @@ constructor TRotLayer32.Create(parent: TLayer32; const name: string); begin inherited; fAutoPivot := true; - fPivotPt := InvalidPointD; + Reset; end; //------------------------------------------------------------------------------ @@ -1479,12 +1493,18 @@ procedure TRotLayer32.SetAngle(newAngle: double); begin NormalizeAngle(newAngle); if newAngle = fAngle then Exit; - if PointsEqual(fPivotPt, InvalidPointD) then - fPivotPt := MidPoint; + if not IsValid(fPivotPt) then fPivotPt := MidPoint; Rotate(newAngle - fAngle); end; //------------------------------------------------------------------------------ +procedure TRotLayer32.Scale(sx, sy: double); +begin + if (sx > 0) then fScaleX := fScaleX * sx; + if (sy > 0) then fScaleY := fScaleY * sy; +end; +//------------------------------------------------------------------------------ + function TRotLayer32.Rotate(angleDelta: double): Boolean; begin Result := (angleDelta <> 0) and not HasChildren; @@ -1496,10 +1516,12 @@ function TRotLayer32.Rotate(angleDelta: double): Boolean; end; //------------------------------------------------------------------------------ -procedure TRotLayer32.ResetAngle; +procedure TRotLayer32.Reset; begin - fAngle := 0; fPivotPt := InvalidPointD; + fAngle := 0; + fScaleX := 1.0; + fScaleY := 1.0; end; //------------------------------------------------------------------------------ @@ -1581,12 +1603,26 @@ function TVectorLayer32.Rotate(angleDelta: double): Boolean; end; //------------------------------------------------------------------------------ +procedure TVectorLayer32.Scale(sx, sy: double); +begin + inherited; + SetInnerBounds(RectD(fLeft, fTop, fWidth * sx, fHeight * sy)); +end; +//------------------------------------------------------------------------------ + procedure TVectorLayer32.SetPaths(const newPaths: TPathsD); begin fPaths := CopyPaths(newPaths); fPivotPt := InvalidPointD; - if Assigned(fPaths) then RepositionAndDraw - else inherited SetInnerBounds(NullRectD); + if not Assigned(fPaths) then inherited SetInnerBounds(NullRectD) + else if fIsDrawing then Raise Exception.Create(rsVectorLayer32Error) + else RepositionAndDraw; +end; +//------------------------------------------------------------------------------ + +function TVectorLayer32.GetRelativePaths: TPathsD; +begin + Result := TranslatePath(fPaths, -Left + fOuterMargin, -Top + fOuterMargin); end; //------------------------------------------------------------------------------ @@ -1628,6 +1664,33 @@ procedure TVectorLayer32.Offset(dx,dy: double); end; //------------------------------------------------------------------------------ +procedure TVectorLayer32.AppendPoint(const pt: TPointD); +var + highPaths, lenPts: integer; +begin + highPaths := High(fPaths); + if highPaths < 0 then + begin + SetLength(fPaths, 1); + SetLength(fPaths[0], 1); + fPaths[0][0] := pt; + end else + begin + lenPts := Length(fPaths[highPaths]); + SetLength(fPaths[highPaths], lenPts +1); + fPaths[highPaths][lenPts] := pt; + end; + RepositionAndDraw; +end; +//------------------------------------------------------------------------------ + +procedure TVectorLayer32.AppendPath(const path: TPathD); +begin + Img32.Vector.AppendPath(fPaths, path); + RepositionAndDraw; +end; +//------------------------------------------------------------------------------ + procedure TVectorLayer32.RepositionAndDraw; var rec: TRectD; @@ -1650,7 +1713,10 @@ procedure TVectorLayer32.Draw; begin //to draw the layer, either override this event //in a descendant class or assign the OnDraw property - if Assigned(fOnDraw) then fOnDraw(self); + if not Assigned(fOnDraw) then Exit; + fIsDrawing := true; + fOnDraw(self); + fIsDrawing := false; end; //------------------------------------------------------------------------------ @@ -1679,6 +1745,7 @@ constructor TRasterLayer32.Create(parent: TLayer32; const name: string); fCursorId := crHandPoint; fAutoHitTest := true; fOuterMargin := 0; + fAutoCrop := true; end; //------------------------------------------------------------------------------ @@ -1733,28 +1800,28 @@ procedure TRasterLayer32.ImageChanged(Sender: TImage32); begin if (Sender = MasterImage) then begin + Reset; if MasterImage.IsEmpty then Exit; - MasterImage.BlockNotify; - MasterImage.CropTransparentPixels; - MasterImage.UnblockNotify; - Invalidate; - + if fAutoCrop then + begin + MasterImage.BlockNotify; + MasterImage.CropTransparentPixels; + MasterImage.UnblockNotify; + end; //reset whenever MasterImage changes - fAngle := 0; - fMatrix := IdentityMatrix; - fRotating := false; - fPreScaleSize := Size(MasterImage.Width, MasterImage.Height); - - if Image.IsEmpty and - (TLayerNotifyImage32(Image).UpdateCount = 0) then - Image.Assign(MasterImage); + if Image.IsEmpty and (TLayerNotifyImage32(Image).UpdateCount = 0) then + Image.Assign(MasterImage); + fCropMargins := NullPoint; + Invalidate; end else begin if MasterImage.IsEmpty and not Image.IsEmpty then begin Image.BlockNotify; try - Image.CropTransparentPixels; + if fAutoCrop then + fCropMargins := SymmetricCropTransparent(Image); + PositionAt(Left + fCropMargins.X, Top + fCropMargins.Y); MasterImage.Assign(Image); finally Image.UnblockNotify; @@ -1768,42 +1835,79 @@ procedure TRasterLayer32.ImageChanged(Sender: TImage32); procedure TRasterLayer32.SetInnerBounds(const newBounds: TRectD); var - newWidth, newHeight: double; - w,h: integer; + x,y, rx,ry: double; + mat: TMatrixD; + sinA, cosA, tanA: double; begin - - if fRotating and Assigned(Image) then - begin - //rotation has just ended - fRotating := false; - //update fMatrix with the new rotation angle - if (fAngle <> 0) then - MatrixRotate(fMatrix, Image.MidPoint, fAngle); - - //and since we're about to start scaling, we need - //to store the starting size, and reset the angle - fPreScaleSize := Size(Image.Width, Image.Height); - fAngle := 0; - end; - - newWidth := newBounds.Width; - newHeight := newBounds.Height; - - //make sure the image is large enough to scale safely - if not MasterImage.IsEmpty and (newWidth > 1) and (newHeight > 1) then + if not MasterImage.IsEmpty and + //the image must be large enough to scale safely + (newBounds.Width > 1) and (newBounds.Height > 1) then begin Image.BeginUpdate; try + // determine the amount of scaling in the **un-rotated** + // image that will fit 'newBounds' once the image is rotated + + // given: + // the pivot point is unimportant (final position already defined) + // rotated x = sin(angle)*y + cos(angle)*x + // rotated y = cos(angle)*y + sin(angle)*x + // let: + // X, Y : unrotated image width & height + // rX, rY : rotated image width & height + + // rX = sinA * Y + cosA * X + // X = rX / cosA - sinA/cosA * Y + // X = rX / cosA - tanA * Y + // rY = cosA*Y + sinA*X + // Y = rY/cosA - tanA * X + // X = rX / cosA - tanA * (rY / cosA - tanA * X) + // X = rX / cosA - tanA * rY/cosA + tanA*tanA * X + // X - tanA*tanA * X = rX / cosA - tanA * rY/cosA + // X * (1 - tanA*tanA) = rX / cosA - tanA * rY/cosA + // X = (rX / cosA - tanA * rY/cosA) / (1 - tanA*tanA) + // Y := (rY - sinA * x) /cosA; + + sinA := Abs(Sin(fAngle)); + cosA := Abs(Cos(fAngle)); + if sinA = 0.0 then // no rotation (or 180 deg. rotation) + begin + fScaleX := newBounds.Width / MasterImage.Width; + fScaleY := newBounds.Height / MasterImage.Height; + end + else if cosA = 0.0 then // rotated 90 or 270 degrees + begin + fScaleX := newBounds.Height / MasterImage.Width; + fScaleY := newBounds.Width / MasterImage.Height; + end else + begin + tanA := sinA/cosA; + // adjust for rotational cropping + rx := newBounds.Width + fCropMargins.X * 2; + ry := newBounds.Height + fCropMargins.Y * 2; + x := (rx /cosA - tanA * ry / cosA) / (1 - tanA*tanA); + y := (ry - sinA * x) /cosA; + + if (x <= 0) or (y <= 0) then + begin + Image.SetSize(Round(newBounds.Width), Round(newBounds.Height)); + PositionAt(newBounds.Left, newBounds.Top); + Exit; + end; + + fScaleX := x / MasterImage.Width; + fScaleY := y / MasterImage.Height; + end; + Image.AssignSettings(MasterImage); - //apply any prior transformations Image.Resampler := rWeightedBilinear; - AffineTransformImage(MasterImage, Image, fMatrix, true); // assumes no skew - //cropping is very important with rotation - SymmetricCropTransparent(Image); - w := Ceil(newBounds.Right) - Floor(newBounds.Left); - h := Ceil(newBounds.Bottom) - Floor(newBounds.Top); - Image.Resize(w, h); //nb: stretch resizes - PositionAt(newBounds.TopLeft); + mat := IdentityMatrix; + MatrixScale(mat, fScaleX, fScaleY); + MatrixRotate(mat, fAngle); + AffineTransformImage(MasterImage, Image, mat, true); + if fAutoCrop then + fCropMargins := SymmetricCropTransparent(Image); + PositionAt(newBounds.Left, newBounds.Top); finally Image.EndUpdate; end; @@ -1815,8 +1919,8 @@ procedure TRasterLayer32.SetInnerBounds(const newBounds: TRectD); function TRasterLayer32.Rotate(angleDelta: double): Boolean; var - mat: TMatrixD; - pt, mp: TPointD; + mat : TMatrixD; + mp : TPointD; begin Result := (angleDelta <> 0) and not MasterImage.IsEmpty and @@ -1825,38 +1929,37 @@ function TRasterLayer32.Rotate(angleDelta: double): Boolean; if not Result then Exit; mp := MidPoint; - - //if not already rotating, then update fMatrix with prior scaling - if not fRotating then - begin - Assert((fPreScaleSize.cx > 0) and (fPreScaleSize.cy > 0), 'oops!'); - MatrixScale(fMatrix, - Image.Width/fPreScaleSize.cx, - Image.Height/fPreScaleSize.cy); - - fRotating := true; - if fAutoPivot then fPivotPt := mp; - end; - + mat := IdentityMatrix; + MatrixScale(mat, fScaleX, fScaleY); + MatrixRotate(mat, fAngle); RotatePoint(mp, PivotPt, angleDelta); Image.BlockNotify; try Image.AssignSettings(MasterImage); - mat := fMatrix; - pt := PointD(PivotPt.X - fLeft, PivotPt.Y - fTop); - MatrixRotate(mat, pt, Angle); Image.Resampler := rWeightedBilinear; - AffineTransformImage(MasterImage, Image, mat, true); // assumes no skew + AffineTransformImage(MasterImage, Image, mat, true); finally Image.UnblockNotify; end; + // cropping the image significantly improves performance + if fAutoCrop then + fCropMargins := SymmetricCropTransparent(Image); + fWidth := Image.Width; fHeight := Image.Height; PositionCenteredAt(mp); DoAutoHitTest; end; +//------------------------------------------------------------------------------ + +procedure TRasterLayer32.Scale(sx, sy: double); +begin + inherited; + SetInnerBounds(RectD(fLeft, fTop, + MasterImage.Width * fSCaleX, MasterImage.Height * fSCaleY)); +end; //------------------------------------------------------------------------------ // TRotatingGroupLayer32 class @@ -2054,7 +2157,7 @@ procedure TButtonDesignerLayer32.Draw; constructor TLayeredImage32.Create(parent: TStorage; const name: string); begin inherited; - fBackColor := clBtnFace32; + fBackColor := clNone32; fResampler := DefaultResampler; fLastUpdateType := utUndefined; @@ -2170,7 +2273,7 @@ procedure TLayeredImage32.Invalidate; function TLayeredImage32.GetRepaintNeeded: Boolean; begin - Result := Root.UpdateInfo.updateMethod <> umNone; + Result := Root.fUpdateInfo.updateMethod <> umNone; end; //------------------------------------------------------------------------------ diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Panels.pas b/Ext/SVGIconImageList/Image32/source/Img32.Panels.pas index 20b9915..fd614a8 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Panels.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Panels.pas @@ -2,12 +2,12 @@ (******************************************************************************* * Author : Angus Johnson * -* Version : 4.7 * -* Date : 16 January 2025 * -* Website : http:// $1ww.angusj.com * +* Version : 4.8 * +* Date : 2 Febuary 2025 * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : Component that displays images on a TPanel descendant * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -65,6 +65,7 @@ TBaseImgPanel = class(TPanel) fOnScrolling : TNotifyEvent; fOnZooming : TNotifyEvent; fOnMouseWheel : TMouseWheelEvent; + fCursor : TCursor; {$IFDEF GESTURES} fLastDistance: integer; fLastLocation: TPoint; @@ -73,6 +74,7 @@ TBaseImgPanel = class(TPanel) fBkgChBrdColor1 : TColor32; fBkgChBrdColor2 : TColor32; fBkgChBrdSize : Integer; + procedure SetCursor(cursor: TCursor); procedure UpdateOffsetDelta(resetOrigin: Boolean); function GetMinScrollBtnSize: integer; function GetDstOffset: TPoint; @@ -92,6 +94,8 @@ TBaseImgPanel = class(TPanel) procedure SetBkgChBrdColor1(value : TColor32); procedure SetBkgChBrdColor2(value : TColor32); procedure SetBkgChBrdSize(value : Integer); + function GetTabStop: Boolean; + procedure SetTabStop(tabstop: Boolean); {$IFDEF GESTURES} procedure Gesture(Sender: TObject; const EventInfo: TGestureEventInfo; var Handled: Boolean); @@ -163,6 +167,8 @@ TBaseImgPanel = class(TPanel) property OnMouseWheel: TMouseWheelEvent read FOnMouseWheel write FOnMouseWheel; property OnScrolling: TNotifyEvent read fOnScrolling write fOnScrolling; property OnZooming: TNotifyEvent read fOnZooming write fOnZooming; + property Cursor: TCursor read fCursor write SetCursor; + property TabStop: Boolean read GetTabStop write SetTabStop stored True; end; TImage32Panel = class(TBaseImgPanel) @@ -375,8 +381,8 @@ constructor TBaseImgPanel.Create(AOwner: TComponent); BevelWidth := 1; BorderWidth := 12; BevelInner := bvLowered; - DoubleBuffered := true; - TabStop := true; + //DoubleBuffered := true; + inherited TabStop := true; {$IFDEF GESTURES} OnGesture := Gesture; Touch.InteractiveGestures := [igPressAndTap, igZoom, igPan]; @@ -388,6 +394,7 @@ constructor TBaseImgPanel.Create(AOwner: TComponent); fAutoCenter := true; fFocusedColor := RgbColor(clActiveCaption); fUnfocusedColor := clBtnFace; + fCursor := inherited Cursor; fScale := 1.0; fScaleMin := 0.05; fScaleMax := 20; @@ -555,6 +562,18 @@ procedure TBaseImgPanel.SetColor(acolor: TColor); end; //------------------------------------------------------------------------------ +function TBaseImgPanel.GetTabStop: Boolean; +begin + Result := inherited TabStop; +end; +//------------------------------------------------------------------------------ + +procedure TBaseImgPanel.SetTabStop(tabstop: Boolean); +begin + inherited TabStop := tabstop; +end; +//------------------------------------------------------------------------------ + procedure TBaseImgPanel.SetAutoCenter(value: Boolean); begin if value = fAutoCenter then Exit; @@ -771,10 +790,11 @@ procedure TBaseImgPanel.MouseMove(Shift: TShiftState; X, Y: Integer); fScrollbarHorz.MouseOver := false; fScrollbarVert.MouseOver := false; end; - cursor := crDefault; + inherited cursor := fCursor; inherited; Exit; end; + if not fMouseDown or not (fAllowScrnScroll or fAllowKeyScroll) then begin @@ -786,19 +806,19 @@ procedure TBaseImgPanel.MouseMove(Shift: TShiftState; X, Y: Integer); begin if (Y < rec.Bottom) then begin - cursor := crSizeNS; + inherited cursor := crSizeNS; if not fScrollbarVert.MouseOver then Invalidate; fScrollbarVert.MouseOver := true; end else - cursor := crDefault; + inherited cursor := fCursor; end else if (Y >= rec.Bottom) and (fScrollbarHorz.btnSize > 0) then begin - Cursor := crSizeWE; + inherited cursor := crSizeWE; if not fScrollbarHorz.MouseOver then Invalidate; fScrollbarHorz.MouseOver := true; end else - cursor := crDefault; + inherited cursor := fCursor; end; Exit; end; @@ -836,11 +856,10 @@ procedure TBaseImgPanel.MouseMove(Shift: TShiftState; X, Y: Integer); MouseDownPos := X; end; end else - begin Exit; // ie exit here if NOT scrolling - end; if assigned(fOnScrolling) then fOnScrolling(self); Invalidate; + inherited; end; //------------------------------------------------------------------------------ @@ -1145,6 +1164,14 @@ procedure TBaseImgPanel.WMMouseHWheel(var Message: TCMMouseWheel); end; //------------------------------------------------------------------------------ +procedure TBaseImgPanel.SetCursor(cursor: TCursor); +begin + if cursor = inherited Cursor then Exit; + inherited Cursor := cursor; + fCursor := cursor; +end; +//------------------------------------------------------------------------------ + function TBaseImgPanel.DoMouseHWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; begin @@ -1265,6 +1292,7 @@ constructor TImage32Panel.Create(AOwner: TComponent); fImage.SetSize(200,200); fAllowCopy := true; fAllowPaste := true; + DoubleBuffered := true; end; //------------------------------------------------------------------------------ diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Resamplers.pas b/Ext/SVGIconImageList/Image32/source/Img32.Resamplers.pas index d064ed6..606bed1 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Resamplers.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Resamplers.pas @@ -4,10 +4,10 @@ * Author : Angus Johnson * * Version : 4.8 * * Date : 10 January 2025 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : For image transformations (scaling, rotating etc.) * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -386,7 +386,7 @@ function CubicInterpolate(aclr: PColor32; // let m2 = slope at pixel_c (using slope of pixel_d - pixel_b) // then t(0) = aa(0^3) + bb(0^2) + cc(0) + dd = dd // then t(1) = aa(1^3) + bb(1^2) + cc(1) + dd = aa + bb + cc + dd - // differentiating parametic equation at t'(0) and t'(1) ... + // differentiating parametric equation at t'(0) and t'(1) ... // t'(0) = m0 = 3*aa(0^2) + 2*bb(0) + cc = cc // t'(1) = m1 = 3*aa(1^2) + 2*bb(1) + cc = 3*aa + 2*bb + cc // t(0) = dd ::EQ1 @@ -539,8 +539,8 @@ procedure PremultiplyAlpha(pSrc, pDst: PARGB; count: nativeint); inc(pDst, count); count := -count; - // This function is optmized with the assumption that if a pixel has a certain - // alpha channel, then the propability that the following pixels have the same + // This function is optimized with the assumption that if a pixel has a certain + // alpha channel, then the probability that the following pixels have the same // alpha channel, is very high. c := PColor32Array(pSrc)[count]; diff --git a/Ext/SVGIconImageList/Image32/source/Img32.SVG.Core.pas b/Ext/SVGIconImageList/Image32/source/Img32.SVG.Core.pas index 97e6cf6..520c7ac 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.SVG.Core.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.SVG.Core.pas @@ -4,14 +4,14 @@ * Author : Angus Johnson * * Version : 4.7 * * Date : 12 January 2025 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * * * Purpose : Essential structures and functions to read SVG files * * * * License : Use, modification & distribution is subject to * * Boost Software License Ver 1 * -* http://www.boost.org/LICENSE_1_0.txt * +* https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -1069,7 +1069,7 @@ function ParseDigitsToDouble(c, endC: PUTF8Char; out val: double): PUTF8Char; end; val := v64; - // Use Double for the remaining digits and loose precision (we are beyong 16 digits anyway) + // Use Double for the remaining digits and loose precision (we are beyond 16 digits anyway) if (Result < endC) and (Result >= blockEndC) then begin while Result < endC do @@ -2232,7 +2232,7 @@ procedure TXmlEl.ParseStyleAttribute(const style: UTF8String); attrib: PSvgAttrib; begin //there are 4 ways to load styles (in ascending precedence) - - //1. a class element style (called during element contruction) + //1. a class element style (called during element construction) //2. a non-element class style (called via a class attribute) //3. an inline style (called via a style attribute) //4. an id specific class style diff --git a/Ext/SVGIconImageList/Image32/source/Img32.SVG.Path.pas b/Ext/SVGIconImageList/Image32/source/Img32.SVG.Path.pas index be9dbb6..61cfdeb 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.SVG.Path.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.SVG.Path.pas @@ -4,14 +4,14 @@ * Author : Angus Johnson * * Version : 4.7 * * Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * * * Purpose : Essential structures and functions to read SVG Path elements * * * * License : Use, modification & distribution is subject to * * Boost Software License Ver 1 * -* http://www.boost.org/LICENSE_1_0.txt * +* https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface diff --git a/Ext/SVGIconImageList/Image32/source/Img32.SVG.PathDesign.pas b/Ext/SVGIconImageList/Image32/source/Img32.SVG.PathDesign.pas index d1b33a1..3c8bc20 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.SVG.PathDesign.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.SVG.PathDesign.pas @@ -4,14 +4,14 @@ * Author : Angus Johnson * * Version : 4.0 * * Date : 10 January 2022 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2022 * * * * Purpose : Supports designing SVG paths * * * * License : Use, modification & distribution is subject to * * Boost Software License Ver 1 * -* http://www.boost.org/LICENSE_1_0.txt * +* https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface diff --git a/Ext/SVGIconImageList/Image32/source/Img32.SVG.Reader.pas b/Ext/SVGIconImageList/Image32/source/Img32.SVG.Reader.pas index 450c2b2..db918e3 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.SVG.Reader.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.SVG.Reader.pas @@ -3,15 +3,15 @@ (******************************************************************************* * Author : Angus Johnson * * Version : 4.8 * -* Date : 12 January 2025 * -* Website : http://www.angusj.com * +* Date : 2 Febuary 2025 * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * * * Purpose : Read SVG 2.0 files * * * * License : Use, modification & distribution is subject to * * Boost Software License Ver 1 * -* http://www.boost.org/LICENSE_1_0.txt * +* https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -369,7 +369,7 @@ TTextElement = class(TShapeElement) angle : TArrayOfDouble; currentPt : TPointD; currSpanEl : TTSpanElement; //the current 'real' - lastChrSpc : Boolean; + lastChrWasSpc : Boolean; procedure Draw(img: TImage32; drawDat: TDrawData); override; public constructor Create(parent: TBaseElement; svgEl: TSvgXmlEl); override; @@ -1323,7 +1323,7 @@ procedure TGroupElement.Draw(image: TImage32; drawDat: TDrawData); clipRec := maskRec; end; - // Translate the maskRec, the matix and the clipRec to minimize + // Translate the maskRec, the matrix and the clipRec to minimize // the size of the mask image. dstClipRec := clipRec; // save for blending tmpImg to image offsetX := -clipRec.Left; @@ -3411,7 +3411,7 @@ procedure TTextElement.Draw(img: TImage32; drawDat: TDrawData); else currentPt.Y := 0; - lastChrSpc := false; + lastChrWasSpc := false; textDx := 0; currSpanEl := nil; @@ -3488,12 +3488,18 @@ procedure TTSpanElement.GetPaths(const drawDat: TDrawData); fontScale := fontSize / fSvgReader.fFontCache.FontHeight; if elRectWH.left.IsValid then + begin textEl.currentPt.X := elRectWH.left.rawVal; + textEl.lastChrWasSpc := false; + end; if elRectWH.top.IsValid then textEl.currentPt.Y := elRectWH.top.rawVal; if offset.X.IsValid then + begin textEl.currentPt.X := textEl.currentPt.X + offset.X.GetValue(0, 0); + //textEl.lastChrWasSpc := false; + end; if offset.Y.IsValid then textEl.currentPt.Y := textEl.currentPt.Y + offset.Y.GetValue(0, 0); @@ -3524,16 +3530,16 @@ procedure TTSpanElement.GetPaths(const drawDat: TDrawData); s := DecodeUtf8ToUnicode(HtmlDecode(fXmlEl.text)); // don't allow a dup. spaces or a space at the beginning of a text - s := FixSpaces(s, textEl.lastChrSpc or + s := FixSpaces(s, textEl.lastChrWasSpc or ((fParent = textEl) and (self = textEl.Child[0]))); if IsBlankText(s) then begin drawPathsC := nil; // don't allow duplicate spaces or a space at the beginning of text - if textEl.lastChrSpc or (self = textEl.Child[0]) then Exit; + if textEl.lastChrWasSpc or (self = textEl.Child[0]) then Exit; tmpX := fSvgReader.fFontCache.GetSpaceWidth; - textEl.lastChrSpc := true; + textEl.lastChrWasSpc := true; end else if Assigned(angles) then begin @@ -3550,7 +3556,7 @@ procedure TTSpanElement.GetPaths(const drawDat: TDrawData); for i := j +1 to len -1 do angles[i] := angles[j]; end; - textEl.lastChrSpc := (codepoints[len -1] = 32); + textEl.lastChrWasSpc := (codepoints[len -1] = 32); // now get each rotated glyph and append to drawPathsC ... for i := 0 to len -1 do begin @@ -3568,7 +3574,7 @@ procedure TTSpanElement.GetPaths(const drawDat: TDrawData); end else begin drawPathsC := fSvgReader.fFontCache.GetTextOutline(0, 0, s, tmpX); - textEl.lastChrSpc := s[length(s)] = space; + textEl.lastChrWasSpc := s[length(s)] = space; end; chunkDx := tmpX * fontScale; @@ -5564,7 +5570,9 @@ procedure TSvgReader.DrawImage(img: TImage32; scaleToImage: Boolean); if viewboxWH.IsEmpty then begin CalcViewBoxOfRootElement; - if viewboxWH.IsEmpty then Exit; // this should never happen + if not elRectWH.IsValid then Exit; // should never happen + viewboxWH.Width := elRectWH.width.GetValue(defaultSvgWidth, 0); + viewboxWH.height := elRectWH.height.GetValue(defaultSvgHeight, 0); end; fBackgndImage := img; diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Storage.pas b/Ext/SVGIconImageList/Image32/source/Img32.Storage.pas index 462f864..d09d90e 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Storage.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Storage.pas @@ -4,10 +4,10 @@ * Author : Angus Johnson * * Version : 4.7 * * Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : Object persistence * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -117,6 +117,7 @@ TStorageManager = class(TStorage) public constructor Create(parent: TStorage = nil; const name: string = ''); override; procedure LoadFromFile(const filename: string); + procedure LoadFromStream(stream: TStream); procedure LoadFromResource(const resName: string; resType: PChar); procedure AddWriteString(const str: Utf8String); procedure SaveToFile(const filename: string; @@ -1429,39 +1430,41 @@ procedure TStorageManager.DoAfterLoad; end; //------------------------------------------------------------------------------ +procedure TStorageManager.LoadFromStream(stream: TStream); +var + utf8: Utf8String; +begin + SetLength(utf8, stream.Size - stream.Position); + stream.ReadBuffer(utf8[1], stream.Size - stream.Position); + DoBeforeLoad; + LoadStoredObjects(utf8, self); + DoAfterLoad; +end; +//------------------------------------------------------------------------------ + procedure TStorageManager.LoadFromFile(const filename: string); var fs: TFileStream; - utf8: Utf8String; begin fs := TFileStream.Create(filename, fmOpenRead or fmShareDenyWrite); try - SetLength(utf8, fs.Size); - fs.ReadBuffer(utf8[1], fs.Size); + LoadFromStream(fs); finally fs.Free; end; - DoBeforeLoad; - LoadStoredObjects(utf8, self); - DoAfterLoad; end; //------------------------------------------------------------------------------ procedure TStorageManager.LoadFromResource(const resName: string; resType: PChar); var rs: TResourceStream; - utf8: Utf8String; begin rs := TResourceStream.Create(hInstance, resName, resType); try - SetLength(utf8, rs.Size); - rs.ReadBuffer(utf8[1], rs.Size); + LoadFromStream(rs); finally rs.Free; end; - DoBeforeLoad; - LoadStoredObjects(utf8, self); - DoAfterLoad; end; //------------------------------------------------------------------------------ diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Text.pas b/Ext/SVGIconImageList/Image32/source/Img32.Text.pas index 9c43bc4..fe61402 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Text.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Text.pas @@ -3,11 +3,11 @@ (******************************************************************************* * Author : Angus Johnson * * Version : 4.8 * -* Date : 17 January 2025 * -* Website : http://www.angusj.com * +* Date : 22 January 2025 * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : TrueType fonts for TImage32 (without Windows dependencies) * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -354,7 +354,7 @@ TFontManager = class function GetBestMatchFont(const fontInfo: TFontInfo): TFontReader; overload; function GetBestMatchFont(const styles: TMacStyles): TFontReader; overload; // FindReaderContainingGlyph: returns a TFontReader object containing the - // specified glyph, otherwise nil. If a fontfamily is spedified, then the + // specified glyph, otherwise nil. If a fontfamily is specified, then the // search is limited to within that font family. If a TFontReader is found // then the out 'glyphIdx' parameter contains the index to the glyph // matching the supplied codepoint. @@ -486,7 +486,7 @@ TTextChunk = class TDrawChunkEvent = procedure(chunk: TTextChunk; const chunkRec: TRectD) of object; // TChunkedText: A font formatted list of text 'chunks' (usually space - // seperated words) that will greatly speed up displaying word-wrapped text. + // separated words) that will greatly speed up displaying word-wrapped text. TChunkedText = class private fSpaceWidth : double; @@ -586,7 +586,7 @@ TFontCache = class(TInterfacedObj, INotifySender, INotifyRecipient) procedure Clear; // TFontCache is both an INotifySender and an INotifyRecipient. // It receives notifications from a TFontReader object and it sends - // notificiations to any number of TFontCache object users + // notifications to any number of TFontCache object users procedure ReceiveNotification(Sender: TObject; notify: TImg32Notification); procedure AddRecipient(recipient: INotifyRecipient); procedure DeleteRecipient(recipient: INotifyRecipient); @@ -697,6 +697,9 @@ TFontCache = class(TInterfacedObj, INotifySender, INotifyRecipient) implementation +uses + Img32.Transform; + resourcestring rsChunkedTextRangeError = 'TChunkedText: range error.'; @@ -733,9 +736,9 @@ procedure GetMeaningfulDateTime(const secsSince1904: Uint64; secsPerLeapYr = secsPerNormYr + secsPerDay; secsPer4Years = secsPerNormYr * 3 + secsPerLeapYr; // 126230400; begin - // Leap years are divisble by 4, except for centuries which are not - // leap years unless they are divisble by 400. (Hence 2000 was a leap year, - // but 1900 was not. But 1904 was a leap year because it's divisble by 4.) + // Leap years are divisible by 4, except for centuries which are not + // leap years unless they are divisible by 400. (Hence 2000 was a leap year, + // but 1900 was not. But 1904 was a leap year because it's divisible by 4.) // Validate at http://www.mathcats.com/explore/elapsedtime.html ss := (secsSince1904 div secsPer4Years); // count '4years' since 1904 @@ -1979,19 +1982,14 @@ procedure AppendPathsEx(var paths: TPathsEx; const extra: TPathsEx); //------------------------------------------------------------------------------ procedure AffineTransform(const a,b,c,d,e,f: double; var pathsEx: TPathsEx); -const - q = 9.2863575e-4; // 33/35536 var i,j: integer; - m0,n0,m,n,xx,me,nf: double; + mat: TMatrixD; begin - m0 := max(abs(a), abs(b)); - n0 := max(abs(c), abs(d)); - - if (m0 = 0) or (n0 = 0) then + // https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html + if ((a = 0) and (b = 0)) or ((c = 0) and (d = 0)) then begin if (e = 0) and (f = 0) then Exit; - for i := 0 to High(pathsEx) do for j := 0 to High(pathsEx[i]) do with pathsEx[i][j].pt do @@ -1999,23 +1997,18 @@ procedure AffineTransform(const a,b,c,d,e,f: double; var pathsEx: TPathsEx); X := X + e; y := Y + f; end; - end else begin - // https://developer.apple.com/fonts/TrueType-Reference-Manual/RM06/Chap6glyf.html + mat[0,0] := a; + mat[0,1] := b; + mat[1,0] := c; + mat[1,1] := d; + mat[2][0] := e; + mat[2][1] := f; - if (abs(a)-abs(c))< q then m := 2 * m0 else m := m0; - if (abs(b)-abs(d))< q then n := 2 * n0 else n := n0; - - me := m*e; nf := n*f; for i := 0 to High(pathsEx) do for j := 0 to High(pathsEx[i]) do - with pathsEx[i][j].pt do - begin - xx :=a*X + c*Y + me; - y := b*X + d*Y + nf; // (#23) - X := xx; - end; + MatrixApply(mat, pathsEx[i][j].pt); end; end; //------------------------------------------------------------------------------ @@ -2025,9 +2018,9 @@ function TFontReader.GetCompositeGlyph(var tbl_glyf: TFontTable_Glyf; var streamPos: integer; flag, glyphIndex: WORD; - arg1b, arg2b: ShortInt; - arg1i, arg2i: Int16; - tmp: single; + arg1_i8, arg2_i8: ShortInt; + arg1_i16, arg2_i16: Int16; + tmp_single: single; a,b,c,d,e,f: double; componentPaths: TPathsEx; component_tbl_glyf: TFontTable_Glyf; @@ -2055,56 +2048,59 @@ function TFontReader.GetCompositeGlyph(var tbl_glyf: TFontTable_Glyf; if (flag and ARG_1_AND_2_ARE_WORDS <> 0) then begin - GetInt16(fStream, arg1i); - GetInt16(fStream, arg2i); + GetInt16(fStream, arg1_i16); + GetInt16(fStream, arg2_i16); if (flag and ARGS_ARE_XY_VALUES <> 0) then begin - e := arg1i; - f := arg2i; + e := arg1_i16; + f := arg2_i16; end; end else begin - GetShortInt(fStream, arg1b); - GetShortInt(fStream, arg2b); + GetShortInt(fStream, arg1_i8); + GetShortInt(fStream, arg2_i8); if (flag and ARGS_ARE_XY_VALUES <> 0) then begin - e := arg1b; - f := arg2b; + e := arg1_i8; + f := arg2_i8; end; end; if (flag and WE_HAVE_A_SCALE <> 0) then begin - Get2Dot14(fStream, tmp); - a := tmp; d := tmp; + Get2Dot14(fStream, tmp_single); + a := tmp_single; d := tmp_single; end else if (flag and WE_HAVE_AN_X_AND_Y_SCALE <> 0) then begin - Get2Dot14(fStream, tmp); a := tmp; - Get2Dot14(fStream, tmp); d := tmp; + Get2Dot14(fStream, tmp_single); a := tmp_single; + Get2Dot14(fStream, tmp_single); d := tmp_single; end else if (flag and WE_HAVE_A_TWO_BY_TWO <> 0) then begin - Get2Dot14(fStream, tmp); a := tmp; - Get2Dot14(fStream, tmp); b := tmp; - Get2Dot14(fStream, tmp); c := tmp; - Get2Dot14(fStream, tmp); d := tmp; + Get2Dot14(fStream, tmp_single); a := tmp_single; + Get2Dot14(fStream, tmp_single); b := tmp_single; + Get2Dot14(fStream, tmp_single); c := tmp_single; + Get2Dot14(fStream, tmp_single); d := tmp_single; end; + component_tbl_hmtx := tbl_hmtx; + // GetGlyphPaths() will change the stream position, so save it. streamPos := fStream.Position; - component_tbl_hmtx := tbl_hmtx; componentPaths := GetGlyphPaths(glyphIndex, component_tbl_hmtx, component_tbl_glyf); + // return to saved stream position fStream.Position := streamPos; if (flag and ARGS_ARE_XY_VALUES <> 0) then - AffineTransform(a,b,c,d,e,f, componentPaths); + AffineTransform(a,b,c,d,e,f, componentPaths); // (#131) if (flag and USE_MY_METRICS <> 0) then tbl_hmtx := component_tbl_hmtx; // (#24) if component_tbl_glyf.numContours > 0 then begin + if tbl_glyf.numContours < 0 then tbl_glyf.numContours := 0; inc(tbl_glyf.numContours, component_tbl_glyf.numContours); tbl_glyf.xMin := Min(tbl_glyf.xMin, component_tbl_glyf.xMin); tbl_glyf.xMax := Max(tbl_glyf.xMax, component_tbl_glyf.xMax); @@ -3238,7 +3234,7 @@ function GetTextOutlineOnPath(const text: UnicodeString; out charsThatFit: integer; out outX: double): TPathsD; var pathLen, pathLenMin1: integer; - cummDists: TArrayOfDouble; // cummulative distances + cummDists: TArrayOfDouble; // cumulative distances i, currentPathIdx: integer; textWidth, glyphCenterX, glyphCenterOnPath, dist, dx: double; glyph: PGlyphInfo; diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Transform.pas b/Ext/SVGIconImageList/Image32/source/Img32.Transform.pas index 6ad36ac..8a4f536 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Transform.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Transform.pas @@ -2,12 +2,12 @@ (******************************************************************************* * Author : Angus Johnson * -* Version : 4.7 * -* Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Version : 4.8 * +* Date : 16 January 2025 * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : Affine and projective transformation routines for TImage32 * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -467,7 +467,9 @@ procedure MatrixExtractScale(const mat: TMatrixD; out X, Y: double); // https://stackoverflow.com/a/32125700/359538 X := Sqrt(Sqr(mat[0,0]) + Sqr(mat[0,1])); //Y := Sqrt(Sqr(mat[1,0]) + Sqr(mat[1,1])); - Y := Abs((mat[0,0] * mat[1,1] - mat[1,0] * mat[0,1]) / X); + if IsZero(X) then + Y := 0 else + Y := Abs(mat[0,0] * mat[1,1] - mat[1,0] * mat[0,1]) / X; end; //------------------------------------------------------------------------------ diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Vector.pas b/Ext/SVGIconImageList/Image32/source/Img32.Vector.pas index 2fa75fc..e64b37f 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Vector.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Vector.pas @@ -2,16 +2,16 @@ (******************************************************************************* * Author : Angus Johnson * -* Version : 4.7 * -* Date : 6 January 2025 * -* Website : http://www.angusj.com * +* Version : 4.8 * +* Date : 21 February 2025 * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * * * Purpose : Vector drawing for TImage32 * * * * License : Use, modification & distribution is subject to * * Boost Software License Ver 1 * -* http://www.boost.org/LICENSE_1_0.txt * +* https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -159,13 +159,11 @@ interface pathEnd: TPathEnd; amount: double): TPathD; //GetDashPath: Returns a polyline (not polygons) - function GetDashedPath(const path: TPathD; - closed: Boolean; const pattern: TArrayOfDouble; - patternOffset: PDouble): TPathsD; + function GetDashedPath(const path: TPathD; closed: Boolean; + const pattern: TArrayOfDouble; patternOffset: PDouble): TPathsD; - function GetDashedOutLine(const path: TPathD; - closed: Boolean; const pattern: TArrayOfDouble; - patternOffset: PDouble; lineWidth: double; + function GetDashedOutLine(const path: TPathD; closed: Boolean; + const pattern: TArrayOfDouble; patternOffset: PDouble; lineWidth: double; joinStyle: TJoinStyle; endStyle: TEndStyle): TPathsD; function TranslatePoint(const pt: TPoint; dx, dy: integer): TPoint; overload; @@ -418,7 +416,7 @@ interface //GetLineEllipseIntersects: Gets the intersection of a line and //an ellipse. The function succeeds when the line either touches //tangentially or passes through the ellipse. If the line touches - //tangentially, the coordintates returned in pt1 and pt2 will match. + //tangentially, the coordinates returned in pt1 and pt2 will match. function GetLineEllipseIntersects(const ellipseRec: TRect; var linePt1, linePt2: TPointD): Boolean; @@ -473,7 +471,7 @@ interface //AutoWidthThreshold: When JoinStyle = jsAuto, this is the threshold at //which line joins will be rounded instead of squared. With wider strokes, //rounded joins generally look better, but as rounding is more complex it - //also requries more processing and hence is slower to execute. + //also requires more processing and hence is slower to execute. AutoWidthThreshold: double = 5.0; //When lines are too narrow, they become too faint to sensibly draw MinStrokeWidth: double = 0.5; @@ -1469,29 +1467,30 @@ function GetVectors(const path: TPathD): TPathD; function GetNormals(const path: TPathD): TPathD; var - i, highI: integer; - last: TPointD; + i,j, highI: integer; begin highI := High(path); NewPointDArray(result, highI+1, True); if highI < 0 then Exit; + j := highI -1; + while (j >= 0) and PointsEqual(path[j], path[j+1]) do dec(j); - last := NullPointD; - for i := 0 to highI -1 do + if j < 0 then // all points on path are identical begin - if GetUnitNormal(path[i], path[i+1], result[i]) then - last := result[i] else - result[i] := last; - end; - if GetUnitNormal(path[highI], path[0], result[highI]) then - last := result[highI]; - - for i := 0 to highI do + for i := 0 to highI do + result[i] := NullPointD; + end else begin - if (result[i].X <> 0) or (result[i].Y <> 0) then Break; - result[i] := last; + GetUnitNormal(path[j], path[j+1], result[j]); + for i := j +1 to highI do + if GetUnitNormal(path[i], path[0], result[i]) then + j := i else + result[i] := result[j]; + for i := 0 to j - 1 do + if GetUnitNormal(path[i], path[i+1], result[i]) then + j := i else + result[i] := result[j]; end; - end; //------------------------------------------------------------------------------ @@ -2265,6 +2264,7 @@ function SegmentsIntersect(const ln1a, ln1b, ln2a, ln2b: TPointD; function CalcRoundingSteps(radius: double): double; begin + if radius < 0 then radius := Abs(radius); //the results of this function have been derived empirically //and may need further adjustment if radius < 0.55 then result := 4 @@ -2454,7 +2454,7 @@ function Grow(const path, normals: TPathD; delta: double; stepsPerRadian := 0; if joinStyle = jsRound then begin - steps := CalcRoundingSteps(delta * scale); + steps := 2 * CalcRoundingSteps(delta * scale); stepSin := sin(TwoPi/steps); stepCos := cos(TwoPi/steps); if (delta < 0) then stepSin := -stepSin; @@ -2746,7 +2746,7 @@ function GrowOpenLine(const line: TPathD; delta: double; stepsPerRadian := 0; if (joinStyle = jsRound) or (endStyle = esRound) then begin - steps := CalcRoundingSteps(delta * scale); + steps := 2 * CalcRoundingSteps(delta * scale); stepSin := sin(TwoPi/steps); stepCos := cos(TwoPi/steps); if (delta < 0) then stepSin := -stepSin; @@ -3137,7 +3137,7 @@ function Ellipse(const rec: TRectD; steps: integer): TPathD; centre := rec.MidPoint; radius := PointD(Width * 0.5, Height * 0.5); end; - if steps < 4 then + if steps < 3 then steps := Round(CalcRoundingSteps(rec.width + rec.height)); GetSinCos(2 * Pi / Steps, sinA, cosA); delta.x := cosA; delta.y := sinA; @@ -3441,9 +3441,8 @@ function ShortenPath(const path: TPathD; end; //------------------------------------------------------------------------------ -function GetDashedPath(const path: TPathD; - closed: Boolean; const pattern: TArrayOfDouble; - patternOffset: PDouble): TPathsD; +function GetDashedPath(const path: TPathD; closed: Boolean; + const pattern: TArrayOfDouble; patternOffset: PDouble): TPathsD; var i, highI, paIdx: integer; vecs, path2, dash: TPathD; diff --git a/Ext/SVGIconImageList/Image32/source/Img32.Vectorizer.pas b/Ext/SVGIconImageList/Image32/source/Img32.Vectorizer.pas index 4451326..94863d7 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.Vectorizer.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.Vectorizer.pas @@ -4,10 +4,10 @@ * Author : Angus Johnson * * Version : 4.6 * * Date : 18 September 2024 * -* Website : http://www.angusj.com * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2023 * * Purpose : Converts raster images to vector paths * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface diff --git a/Ext/SVGIconImageList/Image32/source/Img32.pas b/Ext/SVGIconImageList/Image32/source/Img32.pas index 282a689..21a4df1 100644 --- a/Ext/SVGIconImageList/Image32/source/Img32.pas +++ b/Ext/SVGIconImageList/Image32/source/Img32.pas @@ -3,11 +3,11 @@ (******************************************************************************* * Author : Angus Johnson * * Version : 4.8 * -* Date : 10 January 2025 * -* Website : http://www.angusj.com * +* Date : 24 Febuary 2025 * +* Website : https://www.angusj.com * * Copyright : Angus Johnson 2019-2025 * * Purpose : The core module of the Image32 library * -* License : http://www.boost.org/LICENSE_1_0.txt * +* License : https://www.boost.org/LICENSE_1_0.txt * *******************************************************************************) interface @@ -141,9 +141,9 @@ TPointD = record //A INotifyRecipient receives change notifications though a property //interface from a single NotifySender (eg a Font property). - //A NotifySender can send change notificatons to multiple NotifyRecipients + //A NotifySender can send change notifications to multiple NotifyRecipients //(eg where multiple object use the same font property). NotifyRecipients can - //still receive change notificatons from mulitple NotifySenders, but it + //still receive change notifications from multiple NotifySenders, but it //must use a separate property for each NotifySender. (Also there's little //benefit in using INotifySender and INotifyRecipient interfaces where there //will only be one receiver - eg scroll - scrolling window.) @@ -271,9 +271,10 @@ TImage32 = class(TObject) procedure Assign(src: TImage32); procedure AssignTo(dst: TImage32); procedure AssignSettings(src: TImage32); - //AssignPixelArray: Replaces the content and takes ownership of src. - // Uses src for the pixels without copying it. - procedure AssignPixelArray(const src: TArrayOfColor32; width: Integer; height: Integer); + // AssignPixelArray: Replaces the image content and + // takes ownership of 'src' unless forceCopy is true + procedure AssignPixelArray(const src: TArrayOfColor32; + width: Integer; height: Integer; forceCopy: Boolean = false); //SetSize: Erases any current image, and fills with the specified color. procedure SetSize(newWidth, newHeight: Integer; color: TColor32 = 0); @@ -478,7 +479,7 @@ TImageList32 = class function BlendToAlpha(bgColor, fgColor: TColor32): TColor32; function BlendToAlpha3(bgColor, fgColor: TColor32; blendOpacity: Byte): TColor32; procedure BlendToAlphaLine(bgColor, fgColor: PColor32; width: nativeint); - //BlendMask: Whereever the mask is, preserves the background + //BlendMask: Wherever the mask is, preserves the background function BlendMask(bgColor, alphaMask: TColor32): TColor32; procedure BlendMaskLine(bgColor, alphaMask: PColor32; width: nativeint); function BlendAltMask(bgColor, alphaMask: TColor32): TColor32; @@ -534,6 +535,7 @@ TImageList32 = class function ArrayOfHSLToArrayColor32(const hslArr: TArrayofHSL): TArrayOfColor32; function GetAlpha(color: TColor32): Byte; {$IFDEF INLINE} inline; {$ENDIF} + function SetAlpha(color: TColor32; alpha: Byte): TColor32; {$IFDEF INLINE} inline; {$ENDIF} function PointD(const X, Y: Double): TPointD; overload; {$IFDEF INLINE} inline; {$ENDIF} function PointD(const pt: TPoint): TPointD; overload; {$IFDEF INLINE} inline; {$ENDIF} @@ -1075,9 +1077,9 @@ function BlendToOpaque(bgColor, fgColor: TColor32): TColor32; bw := PByteArray(@MulTable[not fgA]); //ie weight of background Result := $FF000000 - or (TColor32(Byte(fw[Byte(fgColor shr 16)] + bw[Byte(bgColor shr 16)])) shl 16) - or (TColor32(Byte(fw[Byte(fgColor shr 8 )] + bw[Byte(bgColor shr 8)])) shl 8) - or (TColor32(Byte(fw[Byte(fgColor )] + bw[Byte(bgColor )])) ); + or (TColor32(Byte(fw[Byte(fgColor shr 16)] + bw[Byte(bgColor shr 16)])) shl 16) + or (TColor32(Byte(fw[Byte(fgColor shr 8 )] + bw[Byte(bgColor shr 8)])) shl 8) + or (TColor32(Byte(fw[Byte(fgColor )] + bw[Byte(bgColor )])) ); end; end; //------------------------------------------------------------------------------ @@ -1098,15 +1100,15 @@ function BlendToAlpha(bgColor, fgColor: TColor32): TColor32; //combine alphas ... bgA := not MulTable[not fgA, not bgA]; fgWeight := DivTable[fgA, bgA]; // fgWeight = amount foreground color - // contibutes to the result color + // contributes to the result color R := PByteArray(@MulTable[fgWeight]); // ie weight of foreground InvR := PByteArray(@MulTable[not fgWeight]); // ie weight of background Result := bgA shl 24 - or (TColor32(R[Byte(fgColor shr 16)] + InvR[Byte(bgColor shr 16)]) shl 16) - or (TColor32(R[Byte(fgColor shr 8 )] + InvR[Byte(bgColor shr 8)]) shl 8) - or (TColor32(R[Byte(fgColor) ] + InvR[Byte(bgColor) ]) ); + or (TColor32(R[Byte(fgColor shr 16)] + InvR[Byte(bgColor shr 16)]) shl 16) + or (TColor32(R[Byte(fgColor shr 8 )] + InvR[Byte(bgColor shr 8)]) shl 8) + or (TColor32(R[Byte(fgColor) ] + InvR[Byte(bgColor) ]) ); end; end; //------------------------------------------------------------------------------ @@ -1128,15 +1130,15 @@ function BlendToAlpha3(bgColor, fgColor: TColor32; blendOpacity: Byte): TColor32 //combine alphas ... bgA := not MulTable[not fgA, not bgA]; fgWeight := DivTable[fgA, bgA]; // fgWeight = amount foreground color - // contibutes to the result color + // contributes to the result color R := PByteArray(@MulTable[fgWeight]); // ie weight of foreground InvR := PByteArray(@MulTable[not fgWeight]); // ie weight of background Result := bgA shl 24 - or (TColor32(R[Byte(fgColor shr 16)] + InvR[Byte(bgColor shr 16)]) shl 16) - or (TColor32(R[Byte(fgColor shr 8 )] + InvR[Byte(bgColor shr 8)]) shl 8) - or (TColor32(R[Byte(fgColor) ] + InvR[Byte(bgColor) ]) ); + or (TColor32(R[Byte(fgColor shr 16)] + InvR[Byte(bgColor shr 16)]) shl 16) + or (TColor32(R[Byte(fgColor shr 8 )] + InvR[Byte(bgColor shr 8)]) shl 8) + or (TColor32(R[Byte(fgColor) ] + InvR[Byte(bgColor) ]) ); end; end; //------------------------------------------------------------------------------ @@ -1166,7 +1168,7 @@ function BlendToAlphaLineX86(bgColorArr, fgColorArr: PColor32Array; //combine alphas ... newBgA := not MulTable[not fgA, not bgA]; fgWeight := DivTable[fgA, newBgA]; //fgWeight = amount foreground color - //contibutes to total (result) color + //contributes to total (result) color R := PByteArray(@MulTable[fgWeight]); //ie weight of foreground InvR := PByteArray(@MulTable[not fgWeight]); //ie weight of foreground @@ -1264,7 +1266,7 @@ procedure BlendToAlphaLine(bgColor, fgColor: PColor32; width: nativeint); bgA := bgCol shr 24; bgA := not MulTable[not fgA, not bgA]; fgWeight := DivTable[fgA, bgA]; //fgWeight = amount foreground color - //contibutes to total (result) color + //contributes to total (result) color R := PByteArray(@MulTable[fgWeight]); //ie weight of foreground InvR := PByteArray(@MulTable[not fgWeight]); //ie weight of foreground @@ -1323,7 +1325,7 @@ procedure BlendToAlphaLine(bgColor, fgColor: PColor32; width: nativeint); //combine alphas ... bgA := not MulTable[not fgA, not bgA]; fgWeight := DivTable[fgA, bgA]; //fgWeight = amount foreground color - //contibutes to total (result) color + //contributes to total (result) color R := PByteArray(@MulTable[fgWeight]); //ie weight of foreground InvR := PByteArray(@MulTable[not fgWeight]); //ie weight of foreground @@ -1736,6 +1738,12 @@ function GetAlpha(color: TColor32): Byte; end; //------------------------------------------------------------------------------ +function SetAlpha(color: TColor32; alpha: Byte): TColor32; +begin + Result := (color and $FFFFFF) or (alpha shl 24); +end; +//------------------------------------------------------------------------------ + function RGBColor(color: TColor32): Cardinal; var c : TARGB absolute color; @@ -2426,7 +2434,8 @@ procedure TImage32.AssignSettings(src: TImage32); end; //------------------------------------------------------------------------------ -procedure TImage32.AssignPixelArray(const src: TArrayOfColor32; width: Integer; height: Integer); +procedure TImage32.AssignPixelArray(const src: TArrayOfColor32; + width: Integer; height: Integer; forceCopy: Boolean = false); var wasResized: Boolean; begin @@ -2436,12 +2445,16 @@ procedure TImage32.AssignPixelArray(const src: TArrayOfColor32; width: Integer; raise Exception.Create(rsInvalidImageArrayData); wasResized := (fWidth <> width) or (fHeight <> height); - BeginUpdate; try fWidth := width; fHeight := height; - fPixels := src; + if forceCopy then + begin + SetLength(fPixels, width * height); + Move(src[0], fPixels[0], width * height * SizeOf(TColor32)); + end else + fPixels := src; finally EndUpdate; end; @@ -2666,7 +2679,7 @@ function TImage32.CopyPixels(const rec: TRect): TArrayOfColor32; if w * h = 0 then Exit; Types.IntersectRect(recClipped, rec, Bounds); - //if recClipped is wholely outside the bounds of the image ... + //if recClipped is completely outside the bounds of the image ... if IsEmptyRect(recClipped) then begin //rec is considered valid even when completely outside the image bounds, @@ -2675,7 +2688,7 @@ function TImage32.CopyPixels(const rec: TRect): TArrayOfColor32; Exit; end; - //if recClipped is wholely within the bounds of the image ... + //if recClipped is completely within the bounds of the image ... if RectsEqual(recClipped, rec) then begin pDst := @Result[0]; @@ -3012,7 +3025,7 @@ function TImage32.GetColorCount: Integer; c := PixelBase; for i := 0 to Width * Height -1 do begin - //ignore colors with signifcant transparency + //ignore colors with significant transparency if GetAlpha(c^) > $80 then allColors[c^ and $FFFFFF] := 1; inc(c); @@ -3910,7 +3923,7 @@ procedure TImage32.Grayscale(mode: TGrayscaleMode; begin if cLinear <= (0.0031308 * 255) then // adjust for cLinear being "cLiniear * 255" c := ClampByte(Integer(Round(12.92 * cLinear))) - else // for Power we must divide by 255 and then later multipy by 255 + else // for Power we must divide by 255 and then later multiply by 255 //c := ClampByte(Integer(Round((1.055 * 255) * Power(cLinear / 255, 1/2.4) - (0.055 * 255)))); end; diff --git a/Ext/SVGIconImageList/Packages/D12/SVGIconImageList.dproj b/Ext/SVGIconImageList/Packages/D12/SVGIconImageList.dproj index 3941361..8c9d7d6 100644 --- a/Ext/SVGIconImageList/Packages/D12/SVGIconImageList.dproj +++ b/Ext/SVGIconImageList/Packages/D12/SVGIconImageList.dproj @@ -2,7 +2,7 @@ {B5E8B9F1-C42D-4AFC-AE08-193731C6515B} SVGIconImageList.dpk - 20.2 + 20.3 VCL True Release @@ -24,6 +24,11 @@ Base true + + true + Base + true + true Base @@ -65,6 +70,9 @@ Debug + + Debug + DEBUG;$(DCC_Define) true @@ -129,6 +137,7 @@ True True + False 12 diff --git a/Ext/SVGIconImageList/Packages/D12/SVGIconImageListFMX.dproj b/Ext/SVGIconImageList/Packages/D12/SVGIconImageListFMX.dproj index b9a32e9..c4806bb 100644 --- a/Ext/SVGIconImageList/Packages/D12/SVGIconImageListFMX.dproj +++ b/Ext/SVGIconImageList/Packages/D12/SVGIconImageListFMX.dproj @@ -2,7 +2,7 @@ {45F75DEA-42F2-4C8C-AA3A-0C8FF47BEE1F} SVGIconImageListFMX.dpk - 20.2 + 20.3 FMX True Release diff --git a/Ext/SVGIconImageList/Packages/D12/SVGIconImageListGroupPackages.groupproj b/Ext/SVGIconImageList/Packages/D12/SVGIconImageListGroupPackages.groupproj index 1f8d4dd..da40948 100644 --- a/Ext/SVGIconImageList/Packages/D12/SVGIconImageListGroupPackages.groupproj +++ b/Ext/SVGIconImageList/Packages/D12/SVGIconImageListGroupPackages.groupproj @@ -115,7 +115,7 @@ {265E39DA-3CDF-4D32-A71B-DE971C864350} Release - Win32 + Win32;Win64 True @@ -127,7 +127,7 @@ {D45ECCFB-40F6-46F7-8BC3-DBFAA3C12B32} Release - Win32 + Win32;Win64 True diff --git a/Ext/SVGIconImageList/Packages/D12/SVGIconImageListRestClient.dproj b/Ext/SVGIconImageList/Packages/D12/SVGIconImageListRestClient.dproj index 682b9f8..e97db26 100644 --- a/Ext/SVGIconImageList/Packages/D12/SVGIconImageListRestClient.dproj +++ b/Ext/SVGIconImageList/Packages/D12/SVGIconImageListRestClient.dproj @@ -2,7 +2,7 @@ {6b429884-4359-4314-9d3c-af318ff8d6c2} SVGIconImageListRestClient.dpk - 20.2 + 20.3 None True Release @@ -58,9 +58,6 @@ true true - - false - false RELEASE;$(DCC_Define) diff --git a/Ext/SVGIconImageList/Packages/D12/SVGImage32Package.dproj b/Ext/SVGIconImageList/Packages/D12/SVGImage32Package.dproj index 4e83985..046ef8c 100644 --- a/Ext/SVGIconImageList/Packages/D12/SVGImage32Package.dproj +++ b/Ext/SVGIconImageList/Packages/D12/SVGImage32Package.dproj @@ -2,7 +2,7 @@ {D0A69637-2974-4401-9226-4F66893CB5CE} SVGImage32Package.dpk - 20.2 + 20.3 None True Release @@ -95,10 +95,6 @@ - - Cfg_2 - Base - Base @@ -106,6 +102,10 @@ Cfg_1 Base + + Cfg_2 + Base + Delphi.Personality.12 diff --git a/Ext/SVGIconImageList/Packages/D12/dclSVGIconImageList.dproj b/Ext/SVGIconImageList/Packages/D12/dclSVGIconImageList.dproj index 1c1b738..b2b0369 100644 --- a/Ext/SVGIconImageList/Packages/D12/dclSVGIconImageList.dproj +++ b/Ext/SVGIconImageList/Packages/D12/dclSVGIconImageList.dproj @@ -2,12 +2,12 @@ {265E39DA-3CDF-4D32-A71B-DE971C864350} dclSVGIconImageList.dpk - 20.2 + 20.3 VCL True Release Win32 - 1 + 3 Package dclSVGIconImageList @@ -59,6 +59,7 @@ SVGIconImageList;$(DCC_UsePackage) + Debug DEBUG;$(DCC_Define) @@ -94,10 +95,6 @@
SVGIconSetForm
- - Cfg_2 - Base - Base @@ -105,6 +102,10 @@ Cfg_1 Base + + Cfg_2 + Base + Delphi.Personality.12 @@ -118,7 +119,7 @@ True - False + True False diff --git a/Ext/SVGIconImageList/Packages/D12/dclSVGIconImageListFMX.dproj b/Ext/SVGIconImageList/Packages/D12/dclSVGIconImageListFMX.dproj index 60d906e..96b7928 100644 --- a/Ext/SVGIconImageList/Packages/D12/dclSVGIconImageListFMX.dproj +++ b/Ext/SVGIconImageList/Packages/D12/dclSVGIconImageListFMX.dproj @@ -2,12 +2,12 @@ {D45ECCFB-40F6-46F7-8BC3-DBFAA3C12B32} dclSVGIconImageListFMX.dpk - 20.2 + 20.3 FMX True Release Win32 - 1 + 3 Package dclSVGIconImageListFMX @@ -124,6 +124,7 @@
rtl;$(DCC_UsePackage) + Debug DEBUG;$(DCC_Define) @@ -192,7 +193,7 @@ False False True - False + True False diff --git a/Ext/SVGIconImageList/Packages/FMX.SVGIconImageRegister.pas b/Ext/SVGIconImageList/Packages/FMX.SVGIconImageRegister.pas index d538e84..a3ad8dc 100644 --- a/Ext/SVGIconImageList/Packages/FMX.SVGIconImageRegister.pas +++ b/Ext/SVGIconImageList/Packages/FMX.SVGIconImageRegister.pas @@ -69,7 +69,7 @@ implementation uses FMX.SVGIconImageList {$IFDEF D10_3+} - , FmxAnimationEditors +// , FmxAnimationEditors {$ENDIF} , FMX.SVGIconImage , Winapi.ShellApi @@ -199,11 +199,13 @@ function TSVGTextPropertyFMX.GetValue: string; procedure Register; begin {$IFDEF D10_3+} +(* RegisterPropertyEditor(TypeInfo(Single), TSVGIconBitmapItem, '', TFmxFloatProperty); RegisterPropertyEditor(TypeInfo(Single), TSVGIconSourceItem, '', TFmxFloatProperty); RegisterPropertyEditor(TypeInfo(Single), TSVGIconImageList, '', TFmxFloatProperty); RegisterPropertyEditor(TypeInfo(string), TSVGIconImage, 'SVGText', TSVGTextPropertyFMX); RegisterPropertyEditor(TypeInfo(string), TSVGIconSourceItem, 'SVGText', TSVGTextPropertyFMX); +*) {$ENDIF} RegisterComponents('Ethea', diff --git a/Ext/SVGIconImageList/Packages/FMX.SVGRESTClientFormUnit.fmx b/Ext/SVGIconImageList/Packages/FMX.SVGRESTClientFormUnit.fmx index 891a368..c7c03fa 100644 --- a/Ext/SVGIconImageList/Packages/FMX.SVGRESTClientFormUnit.fmx +++ b/Ext/SVGIconImageList/Packages/FMX.SVGRESTClientFormUnit.fmx @@ -1,6 +1,7 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm Left = 0 Top = 0 + ActiveControl = CollectionsCombo Caption = 'SVG REST Client Search %s - Copyright Ethea S.r.l.' ClientHeight = 530 ClientWidth = 720 @@ -32,31 +33,32 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm object SearchEdit: TEdit Touch.InteractiveGestures = [LongTap, DoubleTap] Align = Client - TabOrder = 3 + TabOrder = 4 Hint = 'Insert Icon Name to search' Margins.Left = 8.000000000000000000 Margins.Top = 10.000000000000000000 Margins.Right = 8.000000000000000000 Margins.Bottom = 8.000000000000000000 - Size.Width = 444.000000000000000000 + Size.Width = 240.000000000000000000 Size.Height = 23.000000000000000000 Size.PlatformDefault = False TextPrompt = 'Icon Name' end object OpacityLabel: TLabel Align = Right + Margins.Left = 4.000000000000000000 Position.X = 460.000000000000000000 Size.Width = 56.000000000000000000 Size.Height = 41.000000000000000000 Size.PlatformDefault = False TextSettings.Trimming = None Text = 'Max Icons:' - TabOrder = 1 + TabOrder = 2 end object MaxIconsEdit: TSpinBox Touch.InteractiveGestures = [LongTap, DoubleTap] Align = Right - TabOrder = 2 + TabOrder = 3 Cursor = crIBeam Value = 50.000000000000000000 Position.X = 524.000000000000000000 @@ -86,6 +88,20 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm TextSettings.Trimming = None OnClick = SearchButtonClick end + object CollectionsCombo: TComboBox + Align = Right + Hint = 'Select Icons Collection' + Margins.Top = 10.000000000000000000 + Margins.Bottom = 8.000000000000000000 + Position.X = 256.000000000000000000 + Position.Y = 10.000000000000000000 + Size.Width = 200.000000000000000000 + Size.Height = 23.000000000000000000 + Size.PlatformDefault = False + TabOrder = 1 + OnChange = CollectionsComboChange + OnKeyDown = CollectionsComboKeyDown + end end object IconsGroupBox: TGroupBox Align = Client diff --git a/Ext/SVGIconImageList/Packages/FMX.SVGRESTClientFormUnit.pas b/Ext/SVGIconImageList/Packages/FMX.SVGRESTClientFormUnit.pas index 0825697..b2179cf 100644 --- a/Ext/SVGIconImageList/Packages/FMX.SVGRESTClientFormUnit.pas +++ b/Ext/SVGIconImageList/Packages/FMX.SVGRESTClientFormUnit.pas @@ -54,6 +54,7 @@ TSVGRESTClientSearchForm = class(TForm) SelectedView: TListBox; RemovePrefixCheckBox: TCheckBox; TrackBar: TTrackBar; + CollectionsCombo: TComboBox; procedure SearchButtonClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure FormDestroy(Sender: TObject); @@ -61,14 +62,22 @@ TSVGRESTClientSearchForm = class(TForm) procedure SelectedViewDblClick(Sender: TObject); procedure HelpButtonClick(Sender: TObject); procedure TrackBarTracking(Sender: TObject); + procedure CollectionsComboKeyDown(Sender: TObject; var Key: Word; + var KeyChar: Char; Shift: TShiftState); + procedure CollectionsComboChange(Sender: TObject); private FIconify: TIconifyApi; FSearchList, FSelectedList: TSVGIconImageList; FIconsSize: Integer; + FCollections: TIconifyCollections; procedure AddImagesToSource(const ASourceList: TSVGIconImageList); procedure UpdateGUI; procedure SetIconsSize(const AValue: Integer); + procedure LoadCollections; + function GetIconList: TArray; public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; property IconsSize: Integer read FIconsSize write SetIconsSize; end; @@ -128,10 +137,13 @@ function SearchSVGIconsFromWeb(var AImageList: TSVGIconImageList): Boolean; end; end; +{ TSVGRESTClientSearchForm } + procedure TSVGRESTClientSearchForm.UpdateGUI; begin OKButton.Enabled := FSelectedList.Count > 0; SearchView.ItemHeight := FIconsSize; + SearchButton.Enabled := (SearchEdit.Text <> '') or (CollectionsCombo.ItemHeight >= 0); end; procedure TSVGRESTClientSearchForm.AddImagesToSource( @@ -147,15 +159,106 @@ procedure TSVGRESTClientSearchForm.AddImagesToSource( end; end; -procedure TSVGRESTClientSearchForm.FormCreate(Sender: TObject); +function TSVGRESTClientSearchForm.GetIconList: TArray; +var + LSearch: TIconifySearch; + LCollectionIcons: TIconifyCollectionIcons; + LPrefix: string; +begin + Result := []; + LPrefix := ''; + if CollectionsCombo.ItemIndex >= 0 then + LPrefix := FCollections[CollectionsCombo.ItemIndex].Prefix; + + if SearchEdit.Text <> '' then + begin + LSearch := TIconifySearch.Create; + try + FIconify.Search(SearchEdit.Text, LPrefix, Round(MaxIconsEdit.Value), LSearch); + Result := LSearch.Icons; + finally + LSearch.Free; + end; + end + else if CollectionsCombo.ItemIndex >= 0 then + begin + LCollectionIcons := TIconifyCollectionIcons.Create; + try + FIconify.Collection(LPrefix, LCollectionIcons); + Result := LCollectionIcons.Icons; + finally + LCollectionIcons.Free; + end; + end +end; + +procedure TSVGRESTClientSearchForm.SearchButtonClick(Sender: TObject); +var + LName: string; + LSvgString: string; + LIndex: Integer; + LIcons: TArray; begin + LIndex := 0; + SearchButton.Cursor := crHourGlass; + try + FSearchList.ClearIcons; + LIcons := GetIconList(); + + for LName in LIcons do + begin + if LIndex > MaxIconsEdit.Value then + Break; + LSvgString := FIconify.Download(LName); + FSearchList.AddIcon(LSvgString, LName); + Inc(LIndex); + end; + UpdateSVGIconListView(SearchView); + finally + SearchButton.Cursor := crDefault; + end; +end; + +procedure TSVGRESTClientSearchForm.CollectionsComboChange(Sender: TObject); +begin + UpdateGUI; +// SearchButtonClick(SearchButton); +end; + +procedure TSVGRESTClientSearchForm.CollectionsComboKeyDown(Sender: TObject; + var Key: Word; var KeyChar: Char; Shift: TShiftState); +begin + if (key = VK_BACK) or (key = VK_DELETE) then + CollectionsCombo.ItemIndex := -1; +end; + +constructor TSVGRESTClientSearchForm.Create(AOwner: TComponent); +begin + inherited; + FIconify := TIconifyApi.Create; FIconsSize := 48; + FCollections := TIconifyCollections.Create; + + LoadCollections; +end; + +destructor TSVGRESTClientSearchForm.Destroy; +begin + FIconify.Free; + FCollections.Free; + inherited; +end; + +procedure TSVGRESTClientSearchForm.FormCreate(Sender: TObject); +begin {$IFDEF D11+} Constraints.MinHeight := 500; Constraints.MinWidth := 700; {$ENDIF} FSearchList := TSVGIconImageList.Create(nil); FSelectedList := TSVGIconImageList.Create(nil); + FIconsSize := 48; + MaxIconsEdit.Value := 100; SearchView.Images := FSearchList; SelectedView.Images := FSelectedList; Caption := Format(Caption, [SVGIconImageListVersion]); @@ -177,27 +280,21 @@ procedure TSVGRESTClientSearchForm.HelpButtonClick(Sender: TObject); {$ENDIF} end; -procedure TSVGRESTClientSearchForm.SearchButtonClick(Sender: TObject); +procedure TSVGRESTClientSearchForm.LoadCollections; var - LSearch: TIconifySearch; - LName: string; - LSvgString: string; + LCollection: TIconifyCollection; begin - LSearch := TIconifySearch.Create; - try - FSearchList.ClearIcons; - FIconify.Search(SearchEdit.Text, Round(MaxIconsEdit.Value), LSearch); - for LName in LSearch.Icons do - begin - LSvgString := FIconify.Download(LName); - FSearchList.AddIcon(LSvgString, LName); - end; - UpdateSVGIconListView(SearchView); - finally - LSearch.Free; + if FCollections.Count = 0 then + begin + FCollections.Clear; + CollectionsCombo.Clear; + FIconify.Collections(FCollections); + for LCollection in FCollections do + CollectionsCombo.Items.Add(LCollection.Name); end; end; + procedure TSVGRESTClientSearchForm.SearchViewDblClick(Sender: TObject); var LItem: TSVGIconSourceItem; diff --git a/Ext/SVGIconImageList/Packages/SVGRESTClientFormUnit.dfm b/Ext/SVGIconImageList/Packages/SVGRESTClientFormUnit.dfm index 871f9d9..6928374 100644 --- a/Ext/SVGIconImageList/Packages/SVGRESTClientFormUnit.dfm +++ b/Ext/SVGIconImageList/Packages/SVGRESTClientFormUnit.dfm @@ -2,8 +2,8 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm Left = 0 Top = 0 Caption = 'SVG REST Client Search %s - Copyright Ethea S.r.l.' - ClientHeight = 530 - ClientWidth = 720 + ClientHeight = 529 + ClientWidth = 716 Color = clBtnFace Constraints.MinHeight = 500 Constraints.MinWidth = 700 @@ -20,7 +20,7 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm object SearchGroupBox: TGroupBox Left = 0 Top = 0 - Width = 720 + Width = 716 Height = 55 Align = alTop Caption = 'Search for Icons from the Web' @@ -42,7 +42,7 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm AlignWithMargins = True Left = 5 Top = 25 - Width = 469 + Width = 297 Height = 24 Hint = 'Insert Icon Name to search' Margins.Top = 8 @@ -57,7 +57,7 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm end object MaxIconsPanel: TPanel AlignWithMargins = True - Left = 546 + Left = 542 Top = 25 Width = 48 Height = 24 @@ -65,7 +65,7 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm Margins.Bottom = 4 Align = alRight BevelOuter = bvNone - TabOrder = 1 + TabOrder = 2 object MaxIconsEdit: TSpinEdit Left = 0 Top = 0 @@ -79,28 +79,44 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm end object SearchButton: TButton AlignWithMargins = True - Left = 600 + Left = 596 Top = 20 Width = 115 Height = 30 Align = alRight Caption = 'Search...' Enabled = False - TabOrder = 2 + TabOrder = 3 OnClick = SearchButtonClick end + object CollectionsCombo: TComboBox + AlignWithMargins = True + Left = 308 + Top = 25 + Width = 200 + Height = 23 + Hint = 'Select Icons Collection' + Margins.Top = 8 + Margins.Bottom = 4 + Align = alRight + Style = csDropDownList + DropDownCount = 20 + TabOrder = 1 + OnChange = CollectionsComboChange + OnKeyDown = CollectionsComboKeyDown + end end object BottomPanel: TPanel Left = 0 - Top = 492 - Width = 720 + Top = 491 + Width = 716 Height = 38 Align = alBottom BevelOuter = bvNone TabOrder = 2 object OKButton: TButton AlignWithMargins = True - Left = 451 + Left = 447 Top = 6 Width = 85 Height = 26 @@ -117,7 +133,7 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm end object CancelButton: TButton AlignWithMargins = True - Left = 540 + Left = 536 Top = 6 Width = 85 Height = 26 @@ -133,7 +149,7 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm end object HelpButton: TButton AlignWithMargins = True - Left = 629 + Left = 625 Top = 6 Width = 85 Height = 26 @@ -150,7 +166,7 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm AlignWithMargins = True Left = 183 Top = 3 - Width = 263 + Width = 259 Height = 32 Hint = 'Icon Preview Size' Align = alClient @@ -180,8 +196,8 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm object ClientPanel: TPanel Left = 0 Top = 55 - Width = 720 - Height = 437 + Width = 716 + Height = 436 Align = alClient BevelOuter = bvNone TabOrder = 1 @@ -195,8 +211,8 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm object AvailGroupBox: TGroupBox Left = 0 Top = 0 - Width = 524 - Height = 437 + Width = 520 + Height = 436 Align = alClient Caption = 'Available Icons: double click to select or drag and drop' TabOrder = 0 @@ -204,8 +220,8 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm AlignWithMargins = True Left = 5 Top = 21 - Width = 514 - Height = 411 + Width = 510 + Height = 410 Margins.Top = 4 Align = alClient Columns = <> @@ -221,10 +237,10 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm end end object SelectedGroupBox: TGroupBox - Left = 528 + Left = 524 Top = 0 Width = 192 - Height = 437 + Height = 436 Align = alRight Caption = 'Selected Icons' TabOrder = 1 @@ -233,7 +249,7 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm Left = 5 Top = 23 Width = 182 - Height = 409 + Height = 408 Margins.Top = 6 Align = alClient Columns = <> @@ -244,6 +260,7 @@ object SVGRESTClientSearchForm: TSVGRESTClientSearchForm MultiSelect = True ReadOnly = True TabOrder = 0 + OnDblClick = SelectedViewDblClick OnDragDrop = SelectedViewDragDrop OnDragOver = SelectedViewDragOver end diff --git a/Ext/SVGIconImageList/Packages/SVGRESTClientFormUnit.pas b/Ext/SVGIconImageList/Packages/SVGRESTClientFormUnit.pas index ef5e24b..9f11546 100644 --- a/Ext/SVGIconImageList/Packages/SVGRESTClientFormUnit.pas +++ b/Ext/SVGIconImageList/Packages/SVGRESTClientFormUnit.pas @@ -63,6 +63,7 @@ TSVGRESTClientSearchForm = class(TForm) MaxLabel: TLabel; MaxIconsEdit: TSpinEdit; RemovePrefixCheckBox: TCheckBox; + CollectionsCombo: TComboBox; procedure SearchButtonClick(Sender: TObject); procedure FormCreate(Sender: TObject); procedure HelpButtonClick(Sender: TObject); @@ -79,13 +80,17 @@ TSVGRESTClientSearchForm = class(TForm) procedure SearchEditExit(Sender: TObject); procedure OKButtonClick(Sender: TObject); procedure TrackBarChange(Sender: TObject); + procedure CollectionsComboKeyDown(Sender: TObject; var Key: Word; + Shift: TShiftState); + procedure CollectionsComboChange(Sender: TObject); + procedure SelectedViewDblClick(Sender: TObject); private - FUpdating: Boolean; FIconify: TIconifyApi; FIconsSize: Integer; FSourceList, FSearchList, FSelectedList: TSVGIconImageList; FSVG: ISVG; FReplaceIndex: Integer; + FCollections: TIconifyCollections; procedure AddImage(AStream: TStream; const AName: string); procedure SetIconsSize(const AValue: Integer); procedure UpdateGUI; @@ -94,6 +99,8 @@ TSVGRESTClientSearchForm = class(TForm) procedure MoveIconToSelectView(const AIndex: Integer); procedure Apply; procedure SetReplaceIndex(const AValue: Integer); + procedure LoadCollections; + function GetIconList: TArray; protected procedure Loaded; override; public @@ -161,13 +168,8 @@ function SearchSVGIconsFromWeb(var AImageList: TSVGIconImageList; procedure TSVGRESTClientSearchForm.UpdateGUI; begin - FUpdating := True; - try - OKButton.Enabled := FSelectedList.Count > 0; - SearchButton.Enabled := SearchEdit.Text <> ''; - finally - FUpdating := False; - end; + OKButton.Enabled := FSelectedList.Count > 0; + SearchButton.Enabled := (SearchEdit.Text <> '') or (CollectionsCombo.ItemHeight >= 0); end; procedure TSVGRESTClientSearchForm.AddImage(AStream: TStream; @@ -178,20 +180,57 @@ procedure TSVGRESTClientSearchForm.AddImage(AStream: TStream; FSearchList.Add(FSVG, AName); end; -procedure TSVGRESTClientSearchForm.SearchButtonClick(Sender: TObject); +function TSVGRESTClientSearchForm.GetIconList: TArray; var LSearch: TIconifySearch; + LCollectionIcons: TIconifyCollectionIcons; + LPrefix: string; +begin + Result := []; + LPrefix := ''; + if CollectionsCombo.ItemIndex >= 0 then + LPrefix := FCollections[CollectionsCombo.ItemIndex].Prefix; + + if SearchEdit.Text <> '' then + begin + LSearch := TIconifySearch.Create; + try + FIconify.Search(SearchEdit.Text, LPrefix, MaxIconsEdit.Value, LSearch); + Result := LSearch.Icons; + finally + LSearch.Free; + end; + end + else if CollectionsCombo.ItemIndex >= 0 then + begin + LCollectionIcons := TIconifyCollectionIcons.Create; + try + FIconify.Collection(LPrefix, LCollectionIcons); + Result := LCollectionIcons.Icons; + finally + LCollectionIcons.Free; + end; + end +end; + +procedure TSVGRESTClientSearchForm.SearchButtonClick(Sender: TObject); +var LName: string; LSvgString: string; LStringStream: TStringStream; + LIndex: Integer; + LIcons: TArray; begin - LSearch := TIconifySearch.Create; + LIndex := 0; + Screen.Cursor := crHourglass; try - Screen.Cursor := crHourglass; FSearchList.ClearIcons; - FIconify.Search(SearchEdit.Text, MaxIconsEdit.Value, LSearch); - for LName in LSearch.Icons do + LIcons := GetIconList(); + + for LName in LIcons do begin + if LIndex > MaxIconsEdit.Value then + Break; LSvgString := FIconify.Download(LName); LStringStream := TStringStream.Create(LSvgString, TEncoding.UTF8); try @@ -199,24 +238,41 @@ procedure TSVGRESTClientSearchForm.SearchButtonClick(Sender: TObject); finally LStringStream.Free; end; + Inc(LIndex); end; BuildList(SearchView, FSearchList); finally - LSearch.Free; Screen.Cursor := crDefault; end; end; +procedure TSVGRESTClientSearchForm.CollectionsComboChange(Sender: TObject); +begin + UpdateGUI; +// SearchButton.Click; +end; + +procedure TSVGRESTClientSearchForm.CollectionsComboKeyDown(Sender: TObject; + var Key: Word; Shift: TShiftState); +begin + if (key = VK_BACK) or (key = VK_DELETE) then + CollectionsCombo.ItemIndex := -1; +end; + constructor TSVGRESTClientSearchForm.Create(AOwner: TComponent); begin inherited; FIconify := TIconifyApi.Create; FIconsSize := 48; + FCollections := TIconifyCollections.Create; + + LoadCollections; end; destructor TSVGRESTClientSearchForm.Destroy; begin FIconify.Free; + FCollections.Free; inherited; end; @@ -280,7 +336,7 @@ procedure TSVGRESTClientSearchForm.FormCreate(Sender: TObject); FSearchList := TSVGIconImageList.Create(Self); FSelectedList := TSVGIconImageList.Create(Self); IconsSize := 32; - MaxIconsEdit.Value := 50; + MaxIconsEdit.Value := 100; SearchView.LargeImages := FSearchList; SelectedView.LargeImages := FSelectedList; Caption := Format(Caption, [SVGIconImageListVersion]); @@ -288,8 +344,8 @@ procedure TSVGRESTClientSearchForm.FormCreate(Sender: TObject); procedure TSVGRESTClientSearchForm.FormDestroy(Sender: TObject); begin - FSearchList.Free; - FSelectedList.Free; + FreeAndNil(FSearchList); + FreeAndNil(FSelectedList); end; procedure TSVGRESTClientSearchForm.FormShow(Sender: TObject); @@ -311,6 +367,20 @@ procedure TSVGRESTClientSearchForm.HelpButtonClick(Sender: TObject); SW_SHOWNORMAL) end; +procedure TSVGRESTClientSearchForm.LoadCollections; +var + LCollection: TIconifyCollection; +begin + if FCollections.Count = 0 then + begin + FCollections.Clear; + CollectionsCombo.Clear; + FIconify.Collections(FCollections); + for LCollection in FCollections do + CollectionsCombo.Items.Add(LCollection.Name); + end; +end; + procedure TSVGRESTClientSearchForm.Loaded; begin inherited; @@ -400,6 +470,14 @@ procedure TSVGRESTClientSearchForm.SearchViewDblClick(Sender: TObject); end; end; +procedure TSVGRESTClientSearchForm.SelectedViewDblClick(Sender: TObject); +begin + //Delete selected Icon + FSelectedList.Delete(SelectedView.ItemIndex); + UpdateSVGIconListView(SelectedView); + UpdateGUI; +end; + procedure TSVGRESTClientSearchForm.SelectedViewDragDrop(Sender, Source: TObject; X, Y: Integer); var diff --git a/Ext/SVGIconImageList/Source/Browser.IconifyApi.pas b/Ext/SVGIconImageList/Source/Browser.IconifyApi.pas index 0c20db3..09ee551 100644 --- a/Ext/SVGIconImageList/Source/Browser.IconifyApi.pas +++ b/Ext/SVGIconImageList/Source/Browser.IconifyApi.pas @@ -27,6 +27,7 @@ interface , System.SysUtils , System.Json , System.Net.HttpClient + , System.Generics.Collections , REST.Json ; @@ -46,11 +47,42 @@ TIconifySearch = class property Start: Integer read FStart write FStart; end; + TIconifyCollection = class + private + FName: string; + FTotal: Integer; + FCategory: string; + FPrefix: string; + public + property Name: string read FName write FName; + property Prefix: string read FPrefix write FPrefix; + property Total: Integer read FTotal write FTotal; + property Category: string read FCategory write FCategory; + end; + + TIconifyCollections = class(TObjectList) + end; + + TIconifyCollectionIcons = class + private + FTotal: Integer; + FTitle: string; + FIcons: TArray; + FPrefix: string; + public + property Title: string read FTitle write FTitle; + property Prefix: string read FPrefix write FPrefix; + property Total: Integer read FTotal write FTotal; + property Icons: TArray read FIcons write FIcons; + end; + TIconifyApi = class public - procedure Search(const APattern: string; const AMaxIcons: Integer; + procedure Search(const APattern, APrefix: string; const AMaxIcons: Integer; AResult: TIconifySearch); function Download(const AName: string): string; + procedure Collections(AResult: TIconifyCollections); + procedure Collection(const APrefix: string; AResult: TIconifyCollectionIcons); end; implementation @@ -60,6 +92,103 @@ implementation const BaseUrl = 'https://api.iconify.design/'; +procedure TIconifyApi.Collection(const APrefix: string; + AResult: TIconifyCollectionIcons); +var + LHttpClient: THTTPClient; + LHttpResponse: IHTTPResponse; + LJsonObject: TJSONObject; + LJsonString: string; + LURL: string; + LIconName: TJSONValue; + LJsonPair: TJSONPair; +begin + LHttpClient := THTTPClient.Create; + try + LURL := Format('%scollection?prefix=%s', [BaseUrl, APrefix]); + LHttpResponse := LHttpClient.Get(LURL); + if LHttpResponse.StatusCode >= 400 then + raise TIconifyError.Create(LHttpResponse.StatusText); + LJsonString := LHttpResponse.ContentAsString(TEncoding.UTF8); + {$if compilerversion > 32} + LJsonObject := TJSONObject.ParseJSONValue(LJsonString, False, True) as TJSONObject; + {$else} + LJsonObject := TJSONObject.ParseJSONValue(LJsonString) as TJSONObject; + {$endif} + try + //TJson.JsonToObject(AResult, LJsonObject); + AResult.Prefix := LJsonObject.GetValue('prefix'); + AResult.Total := LJsonObject.GetValue('total'); + AResult.Title := LJsonObject.GetValue('title'); + AResult.Icons := []; + if LJsonObject.GetValue('categories') <> nil then + begin + for LJsonPair in LJsonObject.GetValue('categories') as TJSONObject do + begin + for LIconName in LJsonPair.JsonValue as TJSONArray do + begin + AResult.Icons := AResult.Icons + [AResult.Prefix + ':' + LIconName.Value]; + end; + end; + end + else if LJsonObject.GetValue('uncategorized') <> nil then + begin + for LIconName in LJsonObject.GetValue('uncategorized') as TJSONArray do + begin + AResult.Icons := AResult.Icons + [AResult.Prefix + ':' + LIconName.Value]; + end; + end; + finally + LJsonObject.Free; + end; + finally + LHttpClient.Free; + end;end; + +procedure TIconifyApi.Collections(AResult: TIconifyCollections); +var + LHttpClient: THTTPClient; + LHttpResponse: IHTTPResponse; + LJsonObject: TJSONObject; + LJsonString: string; + LURL: string; + LItem: TIconifyCollection; + LJsonPair: TJSONPair; + LJsonItem: TJSONObject; + LHidden: Boolean; +begin + LHttpClient := THTTPClient.Create; + try + LURL := Format('%scollections', [BaseUrl]); + LHttpResponse := LHttpClient.Get(LURL); + if LHttpResponse.StatusCode >= 400 then + raise TIconifyError.Create(LHttpResponse.StatusText + ' - ' + LURL); + LJsonString := LHttpResponse.ContentAsString(TEncoding.UTF8); + {$if compilerversion > 32} + LJsonObject := TJSONObject.ParseJSONValue(LJsonString, False, True) as TJSONObject; + {$else} + LJsonObject := TJSONObject.ParseJSONValue(LJsonString) as TJSONObject; + {$endif} + try + AResult.Clear; + for LJsonPair in LJsonObject do + begin + LJsonItem := LJsonPair.JsonValue as TJSONObject; + if LJsonItem.TryGetValue('hidden', LHidden) and LHidden then + Continue; + LItem := TIconifyCollection.Create; + LItem.Prefix := LJsonPair.JsonString.Value; + TJson.JsonToObject(LItem, LJsonItem); + AResult.Add(LItem); + end; + finally + LJsonObject.Free; + end; + finally + LHttpClient.Free; + end; +end; + function TIconifyApi.Download(const AName: string): string; var LHttpClient: THTTPClient; @@ -76,7 +205,7 @@ function TIconifyApi.Download(const AName: string): string; end; end; -procedure TIconifyApi.Search(const APattern: string; +procedure TIconifyApi.Search(const APattern, APrefix: string; const AMaxIcons: Integer; AResult: TIconifySearch); var LHttpClient: THTTPClient; @@ -87,7 +216,7 @@ procedure TIconifyApi.Search(const APattern: string; begin LHttpClient := THTTPClient.Create; try - LURL := Format('%ssearch?query=%s&limit=%d', [BaseUrl, APattern, AMaxIcons]); + LURL := Format('%ssearch?query=%s&limit=%d&prefix=%s', [BaseUrl, APattern, AMaxIcons, APrefix]); LHttpResponse := LHttpClient.Get(LURL); if LHttpResponse.StatusCode >= 400 then raise TIconifyError.Create(LHttpResponse.StatusText); diff --git a/Ext/SVGIconImageList/Source/SVGInterfaces.pas b/Ext/SVGIconImageList/Source/SVGInterfaces.pas index 4a271c2..b2705de 100644 --- a/Ext/SVGIconImageList/Source/SVGInterfaces.pas +++ b/Ext/SVGIconImageList/Source/SVGInterfaces.pas @@ -97,7 +97,7 @@ implementation {$IFNDEF SvgDisableEngineHint} {$MESSAGE HINT 'but Prefer Windows Direct-2D SVG-Engine if available'} {$ENDIF} - D2DSVGFactory + , D2DSVGFactory {$ENDIF} ; diff --git a/Ext/StyledComponents/packages/D12/1.Vcl.StyledComponents.groupproj b/Ext/StyledComponents/packages/D12/1.Vcl.StyledComponents.groupproj index 121a91b..39ab996 100644 --- a/Ext/StyledComponents/packages/D12/1.Vcl.StyledComponents.groupproj +++ b/Ext/StyledComponents/packages/D12/1.Vcl.StyledComponents.groupproj @@ -55,7 +55,7 @@ {03F938E4-4CBD-4FD4-86A2-084115D91AA9} Release - Win32 + Win32;Win64 True diff --git a/Ext/StyledComponents/packages/D12/2.Vcl.StyledAnimatedComponents.groupproj b/Ext/StyledComponents/packages/D12/2.Vcl.StyledAnimatedComponents.groupproj index 4279d19..b6b2281 100644 --- a/Ext/StyledComponents/packages/D12/2.Vcl.StyledAnimatedComponents.groupproj +++ b/Ext/StyledComponents/packages/D12/2.Vcl.StyledAnimatedComponents.groupproj @@ -55,7 +55,7 @@ {EBF448F0-3AF1-4B95-B1AD-5874F1BABAEC} Release - Win32 + Win32;Win64 True diff --git a/Ext/StyledComponents/packages/D12/dclStyledAnimatedComponents.dproj b/Ext/StyledComponents/packages/D12/dclStyledAnimatedComponents.dproj index 844a2b1..4ac4e55 100644 --- a/Ext/StyledComponents/packages/D12/dclStyledAnimatedComponents.dproj +++ b/Ext/StyledComponents/packages/D12/dclStyledAnimatedComponents.dproj @@ -7,7 +7,7 @@ True Release Win32 - 1 + 3 Package dclStyledAnimatedComponents @@ -68,6 +68,7 @@
StyledComponents;StyledAnimatedComponents;$(DCC_UsePackage) + Debug DEBUG;$(DCC_Define) @@ -121,7 +122,8 @@ True - False + True + False 12 diff --git a/Ext/StyledComponents/packages/D12/dclStyledComponents.dproj b/Ext/StyledComponents/packages/D12/dclStyledComponents.dproj index aa786a4..790fe4c 100644 --- a/Ext/StyledComponents/packages/D12/dclStyledComponents.dproj +++ b/Ext/StyledComponents/packages/D12/dclStyledComponents.dproj @@ -7,7 +7,7 @@ True Release Win32 - 1 + 3 Package dclStyledComponents @@ -29,12 +29,6 @@ Base true
- - true - Cfg_1 - true - true - true Base @@ -123,7 +117,8 @@ True - False + True + False 12 diff --git a/Ext/StyledComponents/packages/StyledComponentsSplash.res b/Ext/StyledComponents/packages/StyledComponentsSplash.res new file mode 100644 index 0000000000000000000000000000000000000000..7d61095c7d19c4d220f4dd92431fdd620de58e2d GIT binary patch literal 9252 zcmeHLcT`i&wm&3*l+Z!3f)y3)NKsHkl%gUkNKug@C>@jzA}B>bY7!EPbSX+NApwCP zV55o%NJkM-x(FoXBzY51ub=PU@7=ZDTW`HT-dX!h_Uzg7n?1iX$=)Xr1VNJEW-^y= zp#J3=<%A#&U|}*5&;>{rGK5Y;Cm=QGICK^|1L**p4zL^ppBm79NET9Evi=2Psk0rl z;y-S-B@Kee0Q=92$%^EESmM0A@V9TX#M^sWV!gd%eSCm`E=yk;0`0QGGWz&nU0i;T zB+lKPjK^2~RjOlSE6`{lKmkKfF_`M5wi1T}O4U+Z858r+$>|pq&dsd?k1s)^%dpsG zDMh1;BO_}wGHM<@DvF38V6o)1w9@G4s^nx+Y%F2PlYqex@%R{9+uw1X;_+aV2!@uV zBs{#czJ6hL7D!t~MFkEw_4#u{Vd3|wsk)2|FiHX|qS56sF*rNBUpRO-Hx|w^2o_6- zimHf>o%{CfMNUprY3a<^Sao9Jw~2{`@8A1dT1p}!00>yF41+1h;r=NO35x+fr4bQe z;`EmZBwP7>!CL;cz99k^dzQmZdS1W&g#(=bjK|&WDUQVt*fJO;Vz9+w;qRW+&d<&QX(1BJV`HaAzcdz?%uYe5mPkrCxs%(IkaB08F!l=w6b z58TS}m@+^D;AiQ1Jy55ObQY|HQc|OuK=E0~P5L12jt^7;}-{_Z+^ngFZVB1on}kU1wjy;s3jM zZV16nf;4*+d{d16p@rT;ppSIG`<^1@LbxLvmoH7<`+Lj z1}vVh3&D?=dBPlSmfG$hTOo>#Fx5enYK2<3x`JY|f@&v7u@R)0t)SQlQLcejfMPF7u@j~^ z2vco^=UqjaFQJ;UsAZmOO2e6NASRKGS&CqmA(#XrY0zsr}BAUU$`pZO93*neLC%ljvjNXb}idTeYe z9{=BwNAd9qk&%A{UzC}d>gbqv_ip~bkOF`If_wLVjk5Hm?l0xn5CF+=cFsVfe_tZn z(Xluzj1(6Kews;m{2x*t7e~b5fB@yk5O4!s;Q5C?4p$KuR}dbKv9S0ZKf=L*ghqo@ zN{EgIiR71nE|8+oP+(yx4<0Nl%l6W!sAVbpISbf9eg(!bQ`6t^BOM)yOGChODW$Oz z|MDuOk&&IXwII`jWcIeQ5-b7I{N%_8$eJMg0^{@SY}VeFlQ$Y9Gc3rRVPjtab@M{9nfp zV1fLOKQ=T3z<~uU1n`MyG*}31VYsssfD?a$|CqIm|5yHhkDrKPMg9x_b5GC2@NoY9 z`+#H+b6;a47+S^$RV-e99;0gG7|KbG*wUtP0udZe( zBoeUGVR-26Tk8D$*MWh56gudosFwNvD?gErtmg|RmZ8D<0r4*jsAi(TAs_AQ1IXa| z*wMkV;BbKXrjn9|f&yTC@#G2X{KQ~ECA1trI6r^zALVqDgpMx7U`wN-LH+tm2+?S; zec)f4nYmPHMU+HDfv3>sX3&HGELlMhvhIhm6wJ=p$~_*Mxd6i&#dP3??RkLE9Z~Rg1Z;+YuOsOW ze6RyA-5Lp7An2etutLI?2s*GVc`p0I4m@-#p2aY3W+y~0xc%#Aft+^}Fhjk|3tOXL z2h>s##t%F2(*Ss&0-R zYGF%u7QQ_n*c~0r0(-RPrv{|PnH2M(z9>T&O!8i4;CSy#LsbIz%b+c zB%`N}X3GcLa!I4`Q@O`o7r`%_qpXz+iKh7uR4hpv9r-NPF@X>7ms{-&1E*8nxQLq`3 zX2k{D39>AfE9f@-@O5sQ5q|fHR9LKJdk%TMAGESm&oI&;1|x`7R*-c{I#+>$2Tm@M3sECiIMRNA;@9lo~PZ10X2ZA(eLNEUAmxx1;fq_ni->^Un7A+_zqQXj&k zuPATo_CbVNYNx_0B##JZtRgKSjH3@>$(|cBJ2HlA84CPV+7rcjl|;{u((Zy+4)NR%-)&+xFFx=3{C{ygt9bgrE6<?5Az=8r+6**D{nceIoh3XmV7|X%KDYCqgT;IeN$Y9*SZhJ$Ob|!dv#hiI@b% z4Q-`D0^36a)kCIV-nb;*tu0jaIEQ_%U@s=->{#3pMMrvWg!l^O$PB{D4}J* zH-ErGk}DZK!M3?K_lm+TLHWv?2T11eJ@M|Zd3H?5CmHSARpG?715$Rb-Mev0r>eZ7q3&5igu`#8Es?mQ^0>Zv+}Y1|0yjvhk>|X7*5^3@iS#=mHT1{>fgkB)?xXLbm@5AZfal5?w zdMcEL3_4~nH z@~=Kz-qhbJW_lxFAg}O&_D72~nglG+| z>al#-)TgR^AoKl(u7x*BxgMWuELC6BY=n%uF`p9Zkoc49&77hYUaH!R#JzC6!?6W%cB}5}SFKb?KCHG>@*%5pXa}Luca_{>dolX}X z3Y{-nLq4(=qq@&c6H2Ii99i?#@QO@zOU9w5`Ugs$&o@>?av0u6D_kwSa6fy^xc*dI z{MItu(Ii)$yCW;Bip&!lvxgTJcP9lH6loDdw>hCl9-6jacqg;vXu_K?Y;ktD*t>eW zVt(D?*0}eT$vJzcUMRNY@oh42!6u$xOP$twVzD42cD|b+KUwgNP zZwbV{xx9iHS@SqE@7>2sW%uy@{3fwgMqWjJVUF96lnyAN%bq-U?=9D8XzN~Bz2of$ z_<>B~MQ8W*tGeQK>dL;bn?suA+e}h=x^+TqEf-tK4bh$hN)`-W8P+oy}juPhZcEUmwU24ry^0 z&pxHd=j`au6Eiv|_+a&Qm4)!|$i5)ojyqa%(%(me9miTA47z0{GRJ^tP@Y>vIP&>f z=u&vOuAbpMzs@-!d5%NRt}NW`Dhj^lvs>PJ=*C*)U7E*JfBNED*-cGsCF5b8CPT;z z2J-x-(#dnLynDZTbt)Y$yIFko_#5V`mRG}hwaK)|{?iwPD^Vp`gcJCS6?2j|`d@!h z=Fyh?^eMG3q~wNXYru3iiX-RzOV6)73R+#b^O6eBYoKR0jkXOYpgmjhUxQwq5DB+jiCgQ; z?UlU-7n0zfcO`^t&3s*BfaTq~#~XWv>Q-~g;1{>ZT-_Tnd+u|>zOlwqW{W2!VtSaj zrFMa#qDyE!chGlDgx)1in+a9zmH=&MoEJ7wJLwvcYtv=l1oH$Lr4gr#b;Q-;Hpb^( zB@BM>7C7$gD`#@bYb{2jm)E?Wi=Zv+Wx{CBMwuMj9&59+tSP{|kI^bIcy>=E*9l9> zZ?{rHcbY-R#KtuA-`w?wBXYGePPnhltl?V^X+2ipa1|O(;0Un@kf!^i?Hz5WJ8)|D z$mut0g$N@^+h(bdy#`v!v-&-!ZgRM6zGzvnLijy$R>BpgnR>t45U0 zh`wAZBwamvgw1U}JN7x1*Dzl=w@+Pk6}P)*l?oO&IiMAX3z(*yK^*Npj-eL$cikA- zR%G#RfXpVifju%EYM&)D*F&>gkM8<7bCvIe_uK}*%#dKqyse`>D~CF31+^I}UFL-2 z(&{5zGP#Jj!a$QR*Zho+*0g@!GGY3`t`Vuv3t{zys}^k7%)K`E&%~uK5T*&XGkY?5 z%2SXZ_-40G96IJ`ok+$zN(wBPI7M+?h|%)26FDc7bY73L(G1D1&qtq}%9{%;a?;+8U3za5%59dW;C4-enzYT|7Ls1AvJxp?uF@9% z(f{j%?+npnJndwv+;&c16uGcSYxq?tSDf0-@rLKQcl6kDJawQ0f|g2qtUeyg6rc`A zAnYdt74XLt17=f$owPL!!FyDBA2y^s2ZRz=Hx*(J5gM|jPr z51PH)sV~m9Ct$tJwmg%xOgx`g?qIvwb76ozYIlk9%)-pe33l=p?fwoYs6j%I_+f1- zPEPpXxp&kTP?l=U2881))%n)rmxHgGLEDh6{y4V#<%?<7689gU$(0#1ADLMsHSHt1 zMa>st#fq^yxd;z99DccX@NrXE#-X-vhwSC=k8a9$9=~|^MJ*(~Km9~-Z`E%6BKxkZ zdnH_I#l{21I|ACHI*n!LhnRPzj19Qz!&j7;eezoq{4&Vv)W;*QvuyTooYU*pkE3U?^iR_yxahvO+(n8tEZ7a&ekL>1MnPb3h;gd9f z&t6-I+GZWFpP8Y(CU41_zh8mR@d`&fevh{(Bi=M||hF+*7>9MF;T>VwUPsa&* zi6vx@1HvOK2YK8+gxeX{FJiEIHO&v7Osdd=*93=$-m{u|%H0_uUjO<0-1*RPyxW*# zU&k4R;Xzm1qXhy172i+QsjNS^CXP@ee(;;JxNVB46!yxyn(Ra)_3#89X&D*C3v{DL zo~o*29my5X+IK$BI7imsU(nFfzedinZj@jr(xgJRO)weDUcK}DN(uh<+zjp>?G$gF zBvD)biG#!2?IYfivm=_DFJI{_Ect%7x0+dSaco_Lc!@1?c77_pbjxkE4*%g{im#Pc zZWO{OO-V8Jw4My*l&&uE<`!LDcTGPowsW^A8$32-*M^%;TU~u4HNZRMo}6*AEZ@6=rm-%rb2ql^x<&RqjC=GbtV&vu6pKjiq!3c(kA2!9Cnp@le=1;D zu4(*j*PFD@CJiy`rah7Aj`%8(5V<(%K(lC5=Xh3llBBf99aw$73Vnw*{#Xm zCc9Q^7j%^2`4B4v1h)zp+TLGi-r zsp@L9Ox_8%0cCa(VYBJnGPyTgmuot_!ujsRyCfIPccPuVUoE>3v*}-Gi zEz2WyTHN~V>n7zigJ8pL+{(T8_FO3!d)=Tc>jRtgAVXI)c!alF2}c~zKK~cd zX6<_?mHpW|50R7pwR}FU=$&U`ZQl)!iGd`k-5e?(IXVVwMEb|yN=-1DA6}wTVxM%> zj0;OzE9q57J?Z<@?p`vP5UQe5yLUKPgrj@rN3lwI# ru1K@G7p|;eFEjuB`}`w}qnLbA#W nil) and Parent.Showing then begin Click; Result := 1; @@ -4821,25 +4822,24 @@ procedure TCustomStyledGraphicButton.Loaded; procedure TCustomStyledGraphicButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin - FRender.MouseDown(Button, Shift, X, Y); - if Enabled then - inherited; + if Assigned(FRender) then + FRender.MouseDown(Button, Shift, X, Y); + inherited; end; procedure TCustomStyledGraphicButton.MouseMove(Shift: TShiftState; X, Y: Integer); begin + if Assigned(FRender) then + FRender.MouseMove(Shift, X, Y); inherited; - FRender.MouseMove(Shift, X, Y); end; procedure TCustomStyledGraphicButton.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin - if Enabled then - begin + if Assigned(FRender) then FRender.MouseUp(Button, Shift, X, Y); - inherited; - end; + inherited; end; procedure TCustomStyledGraphicButton.ControlClick(Sender: TObject); @@ -6055,25 +6055,24 @@ procedure TCustomStyledButton.Loaded; procedure TCustomStyledButton.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin - FRender.MouseDown(Button, Shift, X, Y); - if Enabled then - inherited; + if Assigned(FRender) then + FRender.MouseDown(Button, Shift, X, Y); + inherited; end; procedure TCustomStyledButton.MouseMove(Shift: TShiftState; X, Y: Integer); begin + if Assigned(FRender) then + FRender.MouseMove(Shift, X, Y); inherited; - FRender.MouseMove(Shift, X, Y); end; procedure TCustomStyledButton.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin - if Enabled then - begin + if Assigned(FRender) then FRender.MouseUp(Button, Shift, X, Y); - inherited; - end; + inherited; end; procedure TCustomStyledButton.ControlClick(Sender: TObject); diff --git a/Ext/SynEdit/Packaged/Delphi10_2.groupproj b/Ext/SynEdit/Packaged/Delphi10_2.groupproj deleted file mode 100644 index b1c20cf..0000000 --- a/Ext/SynEdit/Packaged/Delphi10_2.groupproj +++ /dev/null @@ -1,41 +0,0 @@ - - - {40A3A173-BE4A-46F8-8D45-8D8ABA7A4079} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Ext/SynEdit/Packaged/Delphi10_3.groupproj b/Ext/SynEdit/Packaged/Delphi10_3.groupproj deleted file mode 100644 index 0e7a18c..0000000 --- a/Ext/SynEdit/Packaged/Delphi10_3.groupproj +++ /dev/null @@ -1,41 +0,0 @@ - - - {B9315DE2-89D5-4699-ACDD-50CC0BA87BED} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Ext/SynEdit/Packaged/Delphi10_4.groupproj b/Ext/SynEdit/Packaged/Delphi10_4.groupproj deleted file mode 100644 index e416e1e..0000000 --- a/Ext/SynEdit/Packaged/Delphi10_4.groupproj +++ /dev/null @@ -1,41 +0,0 @@ - - - {ACF465AB-1AD2-441F-BC78-8B1F3A105842} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Ext/SynEdit/Packaged/Delphi11.groupproj b/Ext/SynEdit/Packaged/Delphi11.groupproj deleted file mode 100644 index 9f36da4..0000000 --- a/Ext/SynEdit/Packaged/Delphi11.groupproj +++ /dev/null @@ -1,41 +0,0 @@ - - - {450C8E42-F5B0-4275-9B2A-B95A0ED61BEB} - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Ext/SynEdit/Packaged/Delphi2010.groupproj b/Ext/SynEdit/Packaged/Delphi2010.groupproj deleted file mode 100644 index c3c7cf3..0000000 --- a/Ext/SynEdit/Packaged/Delphi2010.groupproj +++ /dev/null @@ -1,48 +0,0 @@ - - - {A875226E-486B-4ED7-8CF4-620D946B5074} - - - - - - - - - - - Default.Personality.12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Ext/SynEdit/Packaged/DelphiXE3.groupproj b/Ext/SynEdit/Packaged/DelphiXE3.groupproj deleted file mode 100644 index 61a7a70..0000000 --- a/Ext/SynEdit/Packaged/DelphiXE3.groupproj +++ /dev/null @@ -1,48 +0,0 @@ - - - {2F95E7A1-2A4E-443E-9E31-C93E3D8E882D} - - - - - - - - - - - Default.Personality.12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Ext/SynEdit/Packaged/DelphiXE5.groupproj b/Ext/SynEdit/Packaged/DelphiXE5.groupproj deleted file mode 100644 index 83968bd..0000000 --- a/Ext/SynEdit/Packaged/DelphiXE5.groupproj +++ /dev/null @@ -1,48 +0,0 @@ - - - {24481DCC-AF6B-4F56-97E4-89F4C142AB57} - - - - - - - - - - - Default.Personality.12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Ext/SynEdit/Packaged/DelphiXE6.groupproj b/Ext/SynEdit/Packaged/DelphiXE6.groupproj deleted file mode 100644 index 7a680d0..0000000 --- a/Ext/SynEdit/Packaged/DelphiXE6.groupproj +++ /dev/null @@ -1,48 +0,0 @@ - - - {24481DCC-AF6B-4F56-97E4-89F4C142AB57} - - - - - - - - - - - Default.Personality.12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Ext/SynEdit/Packaged/DelphiXE7.groupproj b/Ext/SynEdit/Packaged/DelphiXE7.groupproj deleted file mode 100644 index f55d252..0000000 --- a/Ext/SynEdit/Packaged/DelphiXE7.groupproj +++ /dev/null @@ -1,48 +0,0 @@ - - - {79E6F630-E43D-461A-8923-747555FDBDBE} - - - - - - - - - - - Default.Personality.12 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/Ext/SynEdit/Packaged/SynEdit_D10.dpk b/Ext/SynEdit/Packaged/SynEdit_D10.dpk deleted file mode 100644 index fe86852..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D10.dpk +++ /dev/null @@ -1,50 +0,0 @@ -package SynEdit_D10; - -{$R *.res} -{$R '..\Source\SynEditReg.dcr'} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS ON} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION OFF} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO ON} -{$SAFEDIVIDE OFF} -{$STACKFRAMES ON} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE DEBUG} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite'} -{$DESIGNONLY} -{$IMPLICITBUILD OFF} - -requires - designide, - SynEdit_R10; - -contains - SynEditReg in '..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', - SynEditDocumentManager in '..\Source\SynEditDocumentManager.pas', - SynHighlighterAsmMASM in '..\Source\SynHighlighterAsmMASM.pas', - SynHighlighterGo in '..\Source\SynHighlighterGo.pas', - SynHighlighterJSON in '..\Source\SynHighlighterJSON.pas', - SynHighlighterLLVM in '..\Source\SynHighlighterLLVM.pas', - SynHighlighterManager in '..\Source\SynHighlighterManager.pas', - SynHighlighterRexx in '..\Source\SynHighlighterRexx.pas', - SynHighlighterWebIDL in '..\Source\SynHighlighterWebIDL.pas', - SynHighlighterGLSL in '..\Source\SynHighlighterGLSL.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_D10.dproj b/Ext/SynEdit/Packaged/SynEdit_D10.dproj deleted file mode 100644 index fbef3cb..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D10.dproj +++ /dev/null @@ -1,533 +0,0 @@ - - - {6E21797B-4D50-4028-9D52-05CDFE6CEAEA} - SynEdit_D10.dpk - True - Debug - 1 - Package - None - 18.1 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_D10 - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - 00400000 - true - SynEdit component suite - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;$(DCC_Namespace) - false - false - true - false - 1031 - false - false - - - android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar - Debug - package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=preferExternal;largeHeap=False;theme=TitleBar - - - SynEdit_RXE6;SynEdit_RXE7;SynEdit_R10;$(DCC_UsePackage) - SynEdit_DXE_Icon.ico - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - true - 1033 - - - SynEdit_RXE6;SynEdit_RXE7;SynEdit_R10;$(DCC_UsePackage) - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_DXE_Icon.ico - 1033 - true - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - Delphi.Personality.12 - Package - - - - SynEdit_D10.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - - - - False - False - False - True - False - - - - - true - - - - - true - - - - - true - - - - - true - - - - - SynEdit_D10.bpl - true - - - - - 0 - .dll;.bpl - - - 1 - .dylib - - - - - Contents\Resources - 1 - - - - - classes - 1 - - - - - res\drawable-xxhdpi - 1 - - - - - Contents\MacOS - 0 - - - 1 - - - - - library\lib\mips - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 0 - - - 1 - - - 1 - - - 1 - - - library\lib\armeabi-v7a - 1 - - - 1 - - - - - 0 - - - 1 - .framework - - - - - 1 - - - 1 - - - 1 - - - - - library\lib\x86 - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - - library\lib\armeabi - 1 - - - - - 0 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-normal - 1 - - - - - res\drawable-xhdpi - 1 - - - - - res\drawable-large - 1 - - - - - 1 - - - 1 - - - 1 - - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable-hdpi - 1 - - - - - - - 1 - - - 1 - - - 1 - - - - - res\values - 1 - - - - - res\drawable-small - 1 - - - - - res\drawable - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - - - res\drawable - 1 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 0 - .bpl - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - - - res\drawable-mdpi - 1 - - - - - res\drawable-xlarge - 1 - - - - - res\drawable-ldpi - 1 - - - - - - - - - - - - - 12 - - - - - diff --git a/Ext/SynEdit/Packaged/SynEdit_D10.res b/Ext/SynEdit/Packaged/SynEdit_D10.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_D10_1.dpk b/Ext/SynEdit/Packaged/SynEdit_D10_1.dpk deleted file mode 100644 index 7ed7c92..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D10_1.dpk +++ /dev/null @@ -1,50 +0,0 @@ -package SynEdit_D10_1; - -{$R *.res} -{$R '..\Source\SynEditReg.dcr'} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS ON} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION OFF} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO ON} -{$SAFEDIVIDE OFF} -{$STACKFRAMES ON} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE DEBUG} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite'} -{$DESIGNONLY} -{$IMPLICITBUILD OFF} - -requires - designide, - SynEdit_R10_1; - -contains - SynEditReg in '..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', - SynEditDocumentManager in '..\Source\SynEditDocumentManager.pas', - SynHighlighterAsmMASM in '..\Source\SynHighlighterAsmMASM.pas', - SynHighlighterGo in '..\Source\SynHighlighterGo.pas', - SynHighlighterJSON in '..\Source\SynHighlighterJSON.pas', - SynHighlighterLLVM in '..\Source\SynHighlighterLLVM.pas', - SynHighlighterManager in '..\Source\SynHighlighterManager.pas', - SynHighlighterRexx in '..\Source\SynHighlighterRexx.pas', - SynHighlighterWebIDL in '..\Source\SynHighlighterWebIDL.pas', - SynHighlighterGLSL in '..\Source\SynHighlighterGLSL.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_D10_1.dproj b/Ext/SynEdit/Packaged/SynEdit_D10_1.dproj deleted file mode 100644 index 23d336f..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D10_1.dproj +++ /dev/null @@ -1,560 +0,0 @@ - - - {6E21797B-4D50-4028-9D52-05CDFE6CEAEA} - SynEdit_D10_1.dpk - True - Debug - 1 - Package - VCL - 19.0 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_D10_1 - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - 00400000 - true - SynEdit component suite - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - false - false - true - false - 1031 - false - false - - - SynEdit_RXE6;SynEdit_RXE7;SynEdit_R10;SynEdit_R10_1;$(DCC_UsePackage) - SynEdit_DXE_Icon.ico - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - true - 1033 - - - SynEdit_RXE6;SynEdit_RXE7;SynEdit_R10;SynEdit_R10_1;$(DCC_UsePackage) - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_DXE_Icon.ico - 1033 - true - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - - - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - Delphi.Personality.12 - Package - - - - SynEdit_D10_1.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - - - - True - False - - - - - SynEdit_D10_1.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - - Contents\Resources - 1 - - - - - classes - 1 - - - - - res\drawable-xxhdpi - 1 - - - - - Contents\MacOS - 0 - - - 1 - - - - - library\lib\mips - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 0 - - - 1 - - - 1 - - - library\lib\armeabi-v7a - 1 - - - 1 - - - - - 0 - - - 1 - .framework - - - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - - library\lib\armeabi - 1 - - - - - 0 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-normal - 1 - - - - - res\drawable-xhdpi - 1 - - - - - res\drawable-large - 1 - - - - - 1 - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable-hdpi - 1 - - - - - - - Assets - 1 - - - Assets - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\values - 1 - - - - - res\drawable-small - 1 - - - - - res\drawable - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - - - res\drawable - 1 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 0 - .bpl - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - - - res\drawable-mdpi - 1 - - - - - res\drawable-xlarge - 1 - - - - - res\drawable-ldpi - 1 - - - - - 0 - .dll;.bpl - - - 1 - .dylib - - - - - - - - - - - - - 12 - - - - - diff --git a/Ext/SynEdit/Packaged/SynEdit_D10_1.res b/Ext/SynEdit/Packaged/SynEdit_D10_1.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_D10_2.dpk b/Ext/SynEdit/Packaged/SynEdit_D10_2.dpk deleted file mode 100644 index cde91ef..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D10_2.dpk +++ /dev/null @@ -1,50 +0,0 @@ -package SynEdit_D10_2; - -{$R *.res} -{$R '..\Source\SynEditReg.dcr'} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite'} -{$DESIGNONLY} -{$IMPLICITBUILD OFF} - -requires - designide, - SynEdit_R10_2; - -contains - SynEditReg in '..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', - SynEditDocumentManager in '..\Source\SynEditDocumentManager.pas', - SynHighlighterAsmMASM in '..\Source\SynHighlighterAsmMASM.pas', - SynHighlighterGo in '..\Source\SynHighlighterGo.pas', - SynHighlighterJSON in '..\Source\SynHighlighterJSON.pas', - SynHighlighterLLVM in '..\Source\SynHighlighterLLVM.pas', - SynHighlighterManager in '..\Source\SynHighlighterManager.pas', - SynHighlighterRexx in '..\Source\SynHighlighterRexx.pas', - SynHighlighterWebIDL in '..\Source\SynHighlighterWebIDL.pas', - SynHighlighterGLSL in '..\Source\SynHighlighterGLSL.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_D10_2.dproj b/Ext/SynEdit/Packaged/SynEdit_D10_2.dproj deleted file mode 100644 index a8182f5..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D10_2.dproj +++ /dev/null @@ -1,543 +0,0 @@ - - - {DD43213C-2CD4-43F6-B928-A84DCC1390E0} - SynEdit_D10_2.dpk - True - Release - 1 - Package - VCL - 19.0 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_D10_2 - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - 00400000 - true - SynEdit component suite - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - false - false - true - false - 1031 - false - false - - - SynEdit_RXE6;SynEdit_RXE7;SynEdit_R10;SynEdit_R10_2;$(DCC_UsePackage) - SynEdit_DXE_Icon.ico - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - true - 1033 - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - - - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - Delphi.Personality.12 - Package - - - - SynEdit_D10_2.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - - - - True - - - - - true - - - - - - SynEdit_D10_2.bpl - true - - - - - true - - - - - - true - - - - - true - - - - - 1 - - - Contents\MacOS - 0 - - - - - classes - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - - - library\lib\mips - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - - - res\values - 1 - - - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - 12 - - - - - diff --git a/Ext/SynEdit/Packaged/SynEdit_D10_2.res b/Ext/SynEdit/Packaged/SynEdit_D10_2.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_D10_3.dpk b/Ext/SynEdit/Packaged/SynEdit_D10_3.dpk deleted file mode 100644 index 8d4195a..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D10_3.dpk +++ /dev/null @@ -1,50 +0,0 @@ -package SynEdit_D10_3; - -{$R *.res} -{$R '..\Source\SynEditReg.dcr'} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite'} -{$DESIGNONLY} -{$IMPLICITBUILD OFF} - -requires - designide, - SynEdit_R10_3; - -contains - SynEditReg in '..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', - SynEditDocumentManager in '..\Source\SynEditDocumentManager.pas', - SynHighlighterAsmMASM in '..\Source\SynHighlighterAsmMASM.pas', - SynHighlighterGo in '..\Source\SynHighlighterGo.pas', - SynHighlighterJSON in '..\Source\SynHighlighterJSON.pas', - SynHighlighterLLVM in '..\Source\SynHighlighterLLVM.pas', - SynHighlighterManager in '..\Source\SynHighlighterManager.pas', - SynHighlighterRexx in '..\Source\SynHighlighterRexx.pas', - SynHighlighterWebIDL in '..\Source\SynHighlighterWebIDL.pas', - SynHighlighterGLSL in '..\Source\SynHighlighterGLSL.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_D10_3.dproj b/Ext/SynEdit/Packaged/SynEdit_D10_3.dproj deleted file mode 100644 index 93399b6..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D10_3.dproj +++ /dev/null @@ -1,986 +0,0 @@ - - - {9F3D25A3-62BC-4CD8-AC24-2BCD86FA3C95} - SynEdit_D10_3.dpk - True - Release - 1 - Package - VCL - 19.0 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_D10_3 - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - 00400000 - true - SynEdit component suite - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - false - false - true - false - 1031 - false - false - - - SynEdit_RXE6;SynEdit_RXE7;SynEdit_R10;SynEdit_R10_3;$(DCC_UsePackage) - SynEdit_DXE_Icon.ico - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - true - 1033 - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - - - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - Delphi.Personality.12 - Package - - - - SynEdit_D10_3.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - Chrome Tabs - - - - True - - - - - true - - - - - - SynEdit_D10_3.bpl - true - - - - - true - - - - - true - - - - - - true - - - - - true - - - - - 1 - - - 0 - - - - - classes - 1 - - - classes - 1 - - - - - res\xml - 1 - - - res\xml - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\mips - 1 - - - library\lib\mips - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\values-v21 - 1 - - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-small - 1 - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - - Contents\Resources - 1 - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - - - 12 - - - - - diff --git a/Ext/SynEdit/Packaged/SynEdit_D10_3.res b/Ext/SynEdit/Packaged/SynEdit_D10_3.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_D10_4.dpk b/Ext/SynEdit/Packaged/SynEdit_D10_4.dpk deleted file mode 100644 index 05fe2d6..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D10_4.dpk +++ /dev/null @@ -1,50 +0,0 @@ -package SynEdit_D10_4; - -{$R *.res} -{$R '..\Source\SynEditReg.dcr'} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite'} -{$DESIGNONLY} -{$IMPLICITBUILD OFF} - -requires - designide, - SynEdit_R10_4; - -contains - SynEditReg in '..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', - SynEditDocumentManager in '..\Source\SynEditDocumentManager.pas', - SynHighlighterAsmMASM in '..\Source\SynHighlighterAsmMASM.pas', - SynHighlighterGo in '..\Source\SynHighlighterGo.pas', - SynHighlighterJSON in '..\Source\SynHighlighterJSON.pas', - SynHighlighterLLVM in '..\Source\SynHighlighterLLVM.pas', - SynHighlighterManager in '..\Source\SynHighlighterManager.pas', - SynHighlighterRexx in '..\Source\SynHighlighterRexx.pas', - SynHighlighterWebIDL in '..\Source\SynHighlighterWebIDL.pas', - SynHighlighterGLSL in '..\Source\SynHighlighterGLSL.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_D10_4.dproj b/Ext/SynEdit/Packaged/SynEdit_D10_4.dproj deleted file mode 100644 index 1e05c72..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D10_4.dproj +++ /dev/null @@ -1,1202 +0,0 @@ - - - {1477FBA9-44E9-481F-B952-1D453A400A4E} - SynEdit_D10_4.dpk - True - Release - 1 - Package - VCL - 19.2 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_D10_4 - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - 00400000 - true - SynEdit component suite - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - false - false - true - false - 1031 - false - false - - - SynEdit_RXE6;SynEdit_RXE7;SynEdit_R10;SynEdit_R10_4;$(DCC_UsePackage) - SynEdit_DXE_Icon.ico - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - true - 1033 - - - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - Debug - true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - 1033 - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - - - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - Delphi.Personality.12 - Package - - - - SynEdit_D10_4.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - - - True - False - - - - - true - - - - - SynEdit_D10_4.bpl - true - - - - - - true - - - - - true - - - - - - true - - - - - true - - - - - 1 - - - 0 - - - - - classes - 1 - - - classes - 1 - - - - - res\xml - 1 - - - res\xml - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\mips - 1 - - - library\lib\mips - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\values-v21 - 1 - - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-small - 1 - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - - Contents\Resources - 1 - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - - - 12 - - - - - diff --git a/Ext/SynEdit/Packaged/SynEdit_D10_4.res b/Ext/SynEdit/Packaged/SynEdit_D10_4.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_D11.dpk b/Ext/SynEdit/Packaged/SynEdit_D11.dpk deleted file mode 100644 index a298845..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D11.dpk +++ /dev/null @@ -1,50 +0,0 @@ -package SynEdit_D11; - -{$R *.res} -{$R '..\Source\SynEditReg.dcr'} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite'} -{$DESIGNONLY} -{$IMPLICITBUILD OFF} - -requires - designide, - SynEdit_R11; - -contains - SynEditReg in '..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', - SynEditDocumentManager in '..\Source\SynEditDocumentManager.pas', - SynHighlighterAsmMASM in '..\Source\SynHighlighterAsmMASM.pas', - SynHighlighterGo in '..\Source\SynHighlighterGo.pas', - SynHighlighterJSON in '..\Source\SynHighlighterJSON.pas', - SynHighlighterLLVM in '..\Source\SynHighlighterLLVM.pas', - SynHighlighterManager in '..\Source\SynHighlighterManager.pas', - SynHighlighterRexx in '..\Source\SynHighlighterRexx.pas', - SynHighlighterWebIDL in '..\Source\SynHighlighterWebIDL.pas', - SynHighlighterGLSL in '..\Source\SynHighlighterGLSL.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_D11.dproj b/Ext/SynEdit/Packaged/SynEdit_D11.dproj deleted file mode 100644 index 1bc01f8..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D11.dproj +++ /dev/null @@ -1,166 +0,0 @@ - - - {66F2E936-DD6F-4BBA-A9A9-53437007AA1B} - SynEdit_D11.dpk - True - Release - 1 - Package - VCL - 19.5 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_D11 - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - 00400000 - true - SynEdit component suite - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - false - false - true - false - 1031 - false - false - - - SynEdit_RXE6;SynEdit_RXE7;SynEdit_R10;SynEdit_R11_0;SynEdit_R11;$(DCC_UsePackage) - SynEdit_DXE_Icon.ico - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - true - 1033 - - - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - Debug - true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - 1033 - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - - - - - - - - - - Base - - - Cfg_1 - Base - - - Cfg_2 - Base - - - - Delphi.Personality.12 - Package - - - - SynEdit_D11.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - - - - True - False - - - 12 - - - - diff --git a/Ext/SynEdit/Packaged/SynEdit_D11.res b/Ext/SynEdit/Packaged/SynEdit_D11.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_D12.dpk b/Ext/SynEdit/Packaged/SynEdit_D12.dpk deleted file mode 100644 index 84da24e..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D12.dpk +++ /dev/null @@ -1,50 +0,0 @@ -package SynEdit_D12; - -{$R *.res} -{$R '..\Source\SynEditReg.dcr'} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite'} -{$DESIGNONLY} -{$IMPLICITBUILD OFF} - -requires - designide, - SynEdit_R12; - -contains - SynEditReg in '..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', - SynEditDocumentManager in '..\Source\SynEditDocumentManager.pas', - SynHighlighterAsmMASM in '..\Source\SynHighlighterAsmMASM.pas', - SynHighlighterGo in '..\Source\SynHighlighterGo.pas', - SynHighlighterJSON in '..\Source\SynHighlighterJSON.pas', - SynHighlighterLLVM in '..\Source\SynHighlighterLLVM.pas', - SynHighlighterManager in '..\Source\SynHighlighterManager.pas', - SynHighlighterRexx in '..\Source\SynHighlighterRexx.pas', - SynHighlighterWebIDL in '..\Source\SynHighlighterWebIDL.pas', - SynHighlighterGLSL in '..\Source\SynHighlighterGLSL.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_D12.res b/Ext/SynEdit/Packaged/SynEdit_D12.res deleted file mode 100644 index 4ea92b8ea31127c12db192f8bc54e5ab2798d4a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJcpyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk)-M5O-* z>8vHoEQQR%y|Z*7w%@PnRCnj*CMGu2t@Ef;-&b|&oZGaS*_Nd5L)5(T?5*Yerfk&F zvtti7(r9mOSItNE&}#jDXa{QT+voO~`uqC*NNt{9H~##`jP>Cob>*{WILw(cWT!s% z(7v~)_Sl}-xAOMbzO%38`H6jF$D04qZFX!|tlp9AiUW*x>}B~&`$t;y)ShYeu~zcD zZEwjY#k2bo8OxYsmlhz=IflkCcN}ws3GB zm)GMbr}*?Zu*aYK9P{9qnwyJ1{`y`q)!2yxYs6(L&b3qSWl!8KxGUlhzk$a-28YP2 z&oy95ijJ6q!@Mc`tXLf{HTkEV{i1C$midpk$x$<46A$CDe+9c%EL9^3zb$dqYNHp* z?M!x+@+@IbOml6=T5KfpKd0Ztdho#@=7_tsUN+eeeEDu9!ae)_%Z)>y< z*wkPr2Xw)`f-Mg8HJA9rif^>@=t}JP)Y!a^xZS3UF*wj?{~dcF>=`_zYv~#5B7SS8 zv4byRu3^u^&x_xF4h~&#@H5-UkHl*5Rb%JLVi4c`SW-ea8SDw zHlp>J`~Fh<)m>O}fD@R3jo*SVJL(=x>LA+WxbU1wS6WvG2Vw-n_djvF!a?=PoaeOf z4G!Mc`CyzJItQ?kS?s@KiaVTW!_{*jEU!gz3r+u~wsNm^;BbZqZ25~lE%7IZYK)(p zoBR?#`Qc0lkCA`!a;^zI@M1{JBTIPvlv) z;1HMZz4&qG`Z*OY<6z^%+bi%{@Ad8*}KcFeoaF0g!FYx8boF3$sP?>DRQqo#?w>>d6Uf8x9Ef*;s1 z-!`RwE0H17!L6nrk{!1rKL?l)p6_>q70wYO%R(acSpwPAnYR>@9leSf6A z9_w-@#UcOOS+k7qecg5b-;o%z@&5DrQ=gn5@ZN_JJgmf5 zEyTS>{EA07_>UN)eu$5EAkMjutIs_()TVf013q^k|5f-(K1!muS-XnEwfL#eOYK+r zAE2Fgjn{-Ydff{*YZolPZwhYKAlN*~WfeYS)S~CR8uOibzoIMRj@a|;a?ZdWI5g2F z7t@D%&ed%khMJ#&0hg)1icOBkdzSXd0j%YRF=W+QNKWh#Hh#}ki8t!_-zzw(hkTDr zo%QZMmIdW{qp*Dz-ym2Sehoje$#;5OczW*f$E1-v=fde&0t=&ar>zJxZ z-X9RS`1`Qy$O*ph@+61b>fstM_zpbI%bA43{jif?azJ}*cgTa=btM;yo4rXt>G!@m z*Q3eDtz6E}eIC19cVE1l?9<;}^-X@3$NMw0UW0#2{*t_qJeQmmIgv*0`<&>r19E1z zjyyMeNxokb#!Oh1F#G;&y?@>K=0fLH`_$g^Z$JC?zJCeQus=JK?;3o~(D#h3E&r;) sSCBQ^kkz}AzJEnuVm^_VL;rqsAdiRY9oWbEx^t*6Oz}*=L#=7(UkY_q`v3p{ diff --git a/Ext/SynEdit/Packaged/SynEdit_D2010.dproj b/Ext/SynEdit/Packaged/SynEdit_D2010.dproj deleted file mode 100644 index ed5a006..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_D2010.dproj +++ /dev/null @@ -1,115 +0,0 @@ - - - {8CBEBFBF-6743-43D6-9B6E-A0C60AD65857} - SynEdit_D2010.dpk - Debug - DCC32 - 12.0 - - - true - - - true - Base - true - - - true - Base - true - - - 1 - ..\Dcu\D2010 - WinTypes=Windows;WinProcs=Windows;$(DCC_UnitAlias) - C:\Users\Public\Documents\RAD Studio\7.0\Bpl\SynEdit_D2010.bpl - SynEdit component suite - true - true - true - true - 00400000 - x86 - - - false - RELEASE;$(DCC_Define) - 0 - false - - - DEBUG;$(DCC_Define) - - - - MainSource - - - - - - - - - Base - - - Cfg_2 - Base - - - Cfg_1 - Base - - - - - Delphi.Personality.12 - Package - - - - SynEdit_D2010.dpk - - - False - True - False - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - - - - 12 - - diff --git a/Ext/SynEdit/Packaged/SynEdit_D2010.res b/Ext/SynEdit/Packaged/SynEdit_D2010.res deleted file mode 100644 index 1847268830b40c74a6c7d1d5cc53d7d22c3a88c6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5056 zcmbW5zi%8>5XZ-{rBHzjDw?wpLdXR&QY6X+5h6tbf(Vy(WkCoLi4z4=P_6%yOMwvD zg8u-mYvc;0L~;sxQc@t6?`P)C?%w4bY*w0^_ha6Czu$Rp-<{6PY)97jVQMZtKW*py zreZdHZhQOkRtCML#*XYg*@m~&(3=1I%Llk7>S*pvE7;Yj!H^)8wGGa;|&8!P>=GYp<9J^QiRC`{t12%dXkNqpywX{@?Eb_MKs@29XRNI;2D%DxW zo|xv^jnf#kFIDZr^e=W==PW{#^6Ao{deqzuxId;ujOZ~3;otiwSzBXu3^t3 z&$C~D3=Umz@OQRR9+}nP>x`ZB115dAI{rd2#Mbgv81-@e%IA6)a8SDwHm3Di`~Fn> z)jhG~04Fd5o4f^Iah!WFIS0|E#)aohzS6onIG_;>-~Ytz3J0A}=DenTZ*cIo-Ves9 zp>qHmo5lV+rntk2He9_1!t%2yZsF;l)mH7b4jkU$0bBWEPmBKKP>uSjxhXIDsSodT z@EG|gFZa>|hHF!PaN};FzIxxlpPKT;87{i(!eu7T%H?}r^yeP=K2c}If`cyKd-3DW z_4ib`jDt-MZ?C~;z1O=EKN(!YbpFJR_c`u>(C=ph9O_Y*Jz5Z>`Zs7T9Mn$y@ay$^ z{gulxYxXwGq@TIGbG$~Hi*qk8?9|WMkNweF@MU18F;AQKZ>jcWAL86`f59r^Yh;+XfGU10gV*5=*FT)q#qz2B_Ik28(#vUlW{{>1m(1wXK3zHQ3+RoHfz^$cuqg(^Hlp)z6WUMUE^m$ z9R1u2H_t9ue%}<_JcD5KB$svgjBysd-ql#|toxF$&>h1Qc)Vw6j~u{SeHg>my$i{SJtD^MnJV!{AK!ZgN9Q4bN2bs7?m1Qo zsLwc-cxU?4_%7jWppm+9C(?(bpCye?f6Mv)ml~{r9)<=EoH5SYc}%g6sWZv%2MjL$ zd)R%{gxu$OlEaJ6!*jggJMcIu?<5>9hMoM91KzcrqYfU|m0CzQdy{!G??rvC$5W3N zaydEidE#>2Me)vx&wS_gXXRNP?~l!T4gM|rOZH6mRCZkKNFKZBbELl=uw%1L?5Wvh z<$gsNGhtQ2?EB-*{#7&EllA?}_OZQh*X(7747sg2Bs%YxjlEsL3 z{o^+uxM_#>$nM&K-LY%(_w2SZAJ|v+Kv6$?%${A5(syN7!~sUHE8B*&KCt`t(DoJo zy;Se3cY6TX^_a|gRWsk(7moE%n0K}IV2ItbmlU0`w-ozG(PPXz_O{T|5+9z29(y3{ zdn*jybo`Grf5&HG`%pYld&j=k%6Nk3827m%_U%ipyD$I9z7dmrBKAhfLDj%b-t@)_ zM2$XG>;q-{PTCJw7@BH{?&X+O^{d)nb6rt;(5OK&yy`@6IqzgO?xxureiB0AfmYp9 M - - {6E21797B-4D50-4028-9D52-05CDFE6CEAEA} - SynEdit_DXE3.dpk - True - Debug - 1 - Package - None - 14.4 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - true - Cfg_2 - true - true - - - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - 00400000 - true - SynEdit component suite - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;$(DCC_Namespace) - false - false - true - false - 1031 - false - false - - - $(BDS)\bin\delphi_PROJECTICNS.icns - - - SynEdit_RXE3;$(DCC_UsePackage) - SynEdit_DXE_Icon.ico - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - true - 1033 - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - - - SynEdit_RXE3;$(DCC_UsePackage) - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_DXE_Icon.ico - 1033 - true - - - false - false - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - $(BDS)\bin\delphi_PROJECTICNS.icns - - - ..\Dcu\DXE3 - true - 1033 - - - - MainSource - - - - - - - - - - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - Delphi.Personality.12 - Package - - - - SynEdit_DXE3.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - File C:\Users\Public\Documents\RAD Studio\10.0\Bpl\UniSynEdit_DXE3.bpl not found - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - - - - False - True - False - - - 12 - - - - diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE3.res b/Ext/SynEdit/Packaged/SynEdit_DXE3.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE5.dpk b/Ext/SynEdit/Packaged/SynEdit_DXE5.dpk deleted file mode 100644 index 09c58c6..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_DXE5.dpk +++ /dev/null @@ -1,50 +0,0 @@ -package SynEdit_DXE5; - -{$R *.res} -{$R '..\Source\SynEditReg.dcr'} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS ON} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION OFF} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO ON} -{$SAFEDIVIDE OFF} -{$STACKFRAMES ON} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE DEBUG} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite'} -{$DESIGNONLY} -{$IMPLICITBUILD OFF} - -requires - designide, - SynEdit_RXE5; - -contains - SynEditReg in '..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', - SynEditDocumentManager in '..\Source\SynEditDocumentManager.pas', - SynHighlighterAsmMASM in '..\Source\SynHighlighterAsmMASM.pas', - SynHighlighterGo in '..\Source\SynHighlighterGo.pas', - SynHighlighterJSON in '..\Source\SynHighlighterJSON.pas', - SynHighlighterLLVM in '..\Source\SynHighlighterLLVM.pas', - SynHighlighterManager in '..\Source\SynHighlighterManager.pas', - SynHighlighterRexx in '..\Source\SynHighlighterRexx.pas', - SynHighlighterWebIDL in '..\Source\SynHighlighterWebIDL.pas', - SynHighlighterGLSL in '..\Source\SynHighlighterGLSL.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE5.dproj b/Ext/SynEdit/Packaged/SynEdit_DXE5.dproj deleted file mode 100644 index 48b8d8d..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_DXE5.dproj +++ /dev/null @@ -1,158 +0,0 @@ - - - {6E21797B-4D50-4028-9D52-05CDFE6CEAEA} - SynEdit_DXE5.dpk - True - Release - 1 - Package - None - 15.3 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - ..\dcu\DXE5\ - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - 00400000 - true - SynEdit component suite - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;$(DCC_Namespace) - false - false - true - false - 1031 - false - false - - - SynEdit_RXE5;$(DCC_UsePackage) - SynEdit_DXE_Icon.ico - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - true - 1033 - - - SynEdit_RXE5;$(DCC_UsePackage) - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_DXE_Icon.ico - 1033 - true - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - Delphi.Personality.12 - Package - - - - SynEdit_DXE5.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - - - False - True - False - - - 12 - - - - diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE5.res b/Ext/SynEdit/Packaged/SynEdit_DXE5.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE6.dpk b/Ext/SynEdit/Packaged/SynEdit_DXE6.dpk deleted file mode 100644 index 3af27e6..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_DXE6.dpk +++ /dev/null @@ -1,50 +0,0 @@ -package SynEdit_DXE6; - -{$R *.res} -{$R '..\Source\SynEditReg.dcr'} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS ON} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION OFF} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO ON} -{$SAFEDIVIDE OFF} -{$STACKFRAMES ON} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE DEBUG} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite'} -{$DESIGNONLY} -{$IMPLICITBUILD OFF} - -requires - designide, - SynEdit_RXE6; - -contains - SynEditReg in '..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', - SynEditDocumentManager in '..\Source\SynEditDocumentManager.pas', - SynHighlighterAsmMASM in '..\Source\SynHighlighterAsmMASM.pas', - SynHighlighterGo in '..\Source\SynHighlighterGo.pas', - SynHighlighterJSON in '..\Source\SynHighlighterJSON.pas', - SynHighlighterLLVM in '..\Source\SynHighlighterLLVM.pas', - SynHighlighterManager in '..\Source\SynHighlighterManager.pas', - SynHighlighterRexx in '..\Source\SynHighlighterRexx.pas', - SynHighlighterWebIDL in '..\Source\SynHighlighterWebIDL.pas', - SynHighlighterGLSL in '..\Source\SynHighlighterGLSL.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE6.dproj b/Ext/SynEdit/Packaged/SynEdit_DXE6.dproj deleted file mode 100644 index 5552060..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_DXE6.dproj +++ /dev/null @@ -1,173 +0,0 @@ - - - {6E21797B-4D50-4028-9D52-05CDFE6CEAEA} - SynEdit_DXE6.dpk - True - Release - 1 - Package - None - 15.4 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_DXE6 - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - 00400000 - true - SynEdit component suite - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;$(DCC_Namespace) - false - false - true - false - 1031 - false - false - - - Debug - package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=preferExternal;largeHeap=False;theme=TitleBar - - - SynEdit_RXE6;$(DCC_UsePackage) - SynEdit_DXE_Icon.ico - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - true - 1033 - - - SynEdit_RXE6;$(DCC_UsePackage) - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_DXE_Icon.ico - 1033 - true - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - Delphi.Personality.12 - Package - - - - SynEdit_DXE6.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver - Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server - - - - False - False - False - False - True - False - - - 12 - - - - diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE6.res b/Ext/SynEdit/Packaged/SynEdit_DXE6.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE7.dpk b/Ext/SynEdit/Packaged/SynEdit_DXE7.dpk deleted file mode 100644 index b3924fd..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_DXE7.dpk +++ /dev/null @@ -1,50 +0,0 @@ -package SynEdit_DXE7; - -{$R *.res} -{$R '..\Source\SynEditReg.dcr'} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS ON} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION OFF} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO ON} -{$SAFEDIVIDE OFF} -{$STACKFRAMES ON} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE DEBUG} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite'} -{$DESIGNONLY} -{$IMPLICITBUILD OFF} - -requires - designide, - SynEdit_RXE7; - -contains - SynEditReg in '..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', - SynEditDocumentManager in '..\Source\SynEditDocumentManager.pas', - SynHighlighterAsmMASM in '..\Source\SynHighlighterAsmMASM.pas', - SynHighlighterGo in '..\Source\SynHighlighterGo.pas', - SynHighlighterJSON in '..\Source\SynHighlighterJSON.pas', - SynHighlighterLLVM in '..\Source\SynHighlighterLLVM.pas', - SynHighlighterManager in '..\Source\SynHighlighterManager.pas', - SynHighlighterRexx in '..\Source\SynHighlighterRexx.pas', - SynHighlighterWebIDL in '..\Source\SynHighlighterWebIDL.pas', - SynHighlighterGLSL in '..\Source\SynHighlighterGLSL.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE7.dproj b/Ext/SynEdit/Packaged/SynEdit_DXE7.dproj deleted file mode 100644 index 47de6e8..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_DXE7.dproj +++ /dev/null @@ -1,476 +0,0 @@ - - - {6E21797B-4D50-4028-9D52-05CDFE6CEAEA} - SynEdit_DXE7.dpk - True - Debug - 1 - Package - None - 16.0 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_DXE7 - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - 00400000 - true - SynEdit component suite - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;$(DCC_Namespace) - false - false - true - false - 1031 - false - false - - - Debug - package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=preferExternal;largeHeap=False;theme=TitleBar - - - SynEdit_RXE6;SynEdit_RXE7;$(DCC_UsePackage) - SynEdit_DXE_Icon.ico - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - true - 1033 - - - SynEdit_RXE6;SynEdit_RXE7;$(DCC_UsePackage) - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_DXE_Icon.ico - 1033 - true - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - Delphi.Personality.12 - Package - - - - SynEdit_DXE7.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver - Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server - - - - False - False - False - False - True - False - - - - - SynEdit_DXE7.bpl - true - - - - - true - - - true - - - - - 1 - .dylib - - - 0 - .bpl - - - 1 - .dylib - - - 1 - .dylib - - - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - - - 1 - - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - res\drawable-normal - 1 - - - - - library\lib\x86 - 1 - - - - - 1 - - - 1 - - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - - - res\drawable-xlarge - 1 - - - - - res\drawable-xhdpi - 1 - - - - - 1 - - - 1 - - - - - res\drawable-xxhdpi - 1 - - - - - library\lib\mips - 1 - - - - - res\drawable - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 0 - - - - - res\drawable-small - 1 - - - - - - 1 - - - Contents\MacOS - 0 - - - - - classes - 1 - - - - - - 1 - - - 1 - - - - - res\drawable - 1 - - - - - Contents\Resources - 1 - - - - - - 1 - - - 1 - - - - - 1 - - - library\lib\armeabi-v7a - 1 - - - 0 - - - 1 - - - 1 - - - - - library\lib\armeabi - 1 - - - - - res\drawable-large - 1 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 1 - - - 1 - - - - - res\drawable-ldpi - 1 - - - - - res\values - 1 - - - - - 1 - - - 1 - - - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - - - 1 - - - - - - - - - - - 12 - - - - - diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE7.res b/Ext/SynEdit/Packaged/SynEdit_DXE7.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE8.dpk b/Ext/SynEdit/Packaged/SynEdit_DXE8.dpk deleted file mode 100644 index 9bb2e49..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_DXE8.dpk +++ /dev/null @@ -1,50 +0,0 @@ -package SynEdit_DXE8; - -{$R *.res} -{$R '..\Source\SynEditReg.dcr'} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS ON} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION OFF} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO ON} -{$SAFEDIVIDE OFF} -{$STACKFRAMES ON} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE DEBUG} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite'} -{$DESIGNONLY} -{$IMPLICITBUILD OFF} - -requires - designide, - SynEdit_RXE8; - -contains - SynEditReg in '..\Source\SynEditReg.pas', - SynEditPropertyReg in '..\Source\SynEditPropertyReg.pas', - SynEditDocumentManager in '..\Source\SynEditDocumentManager.pas', - SynHighlighterAsmMASM in '..\Source\SynHighlighterAsmMASM.pas', - SynHighlighterGo in '..\Source\SynHighlighterGo.pas', - SynHighlighterJSON in '..\Source\SynHighlighterJSON.pas', - SynHighlighterLLVM in '..\Source\SynHighlighterLLVM.pas', - SynHighlighterManager in '..\Source\SynHighlighterManager.pas', - SynHighlighterRexx in '..\Source\SynHighlighterRexx.pas', - SynHighlighterWebIDL in '..\Source\SynHighlighterWebIDL.pas', - SynHighlighterGLSL in '..\Source\SynHighlighterGLSL.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE8.dproj b/Ext/SynEdit/Packaged/SynEdit_DXE8.dproj deleted file mode 100644 index 06f9e8d..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_DXE8.dproj +++ /dev/null @@ -1,535 +0,0 @@ - - - {6E21797B-4D50-4028-9D52-05CDFE6CEAEA} - SynEdit_DXE8.dpk - True - Debug - 1 - Package - VCL - 17.2 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_DXE8 - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - true - 00400000 - true - SynEdit component suite - System;Xml;Data;Datasnap;Web;Soap;Vcl;Winapi;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) - false - false - true - false - 1031 - false - false - - - android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar - Debug - package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=preferExternal;largeHeap=False;theme=TitleBar - - - SynEdit_RXE6;SynEdit_RXE7;SynEdit_RXE8;$(DCC_UsePackage) - SynEdit_DXE_Icon.ico - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) - true - 1033 - - - SynEdit_RXE6;SynEdit_RXE7;SynEdit_RXE8;$(DCC_UsePackage) - System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_DXE_Icon.ico - 1033 - true - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - - - - - - - - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - - - - Delphi.Personality.12 - Package - - - - SynEdit_DXE8.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - - - - False - False - False - True - False - - - - - SynEdit_DXE8.bpl - true - - - - - true - - - - - true - - - - - true - - - - - true - - - - - 1 - .dylib - - - 0 - .bpl - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - - - 1 - - - 1 - - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - res\drawable-normal - 1 - - - - - library\lib\x86 - 1 - - - - - 1 - - - 1 - - - 1 - - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-xlarge - 1 - - - - - res\drawable-xhdpi - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-xxhdpi - 1 - - - - - library\lib\mips - 1 - - - - - res\drawable - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 0 - - - - - res\drawable-small - 1 - - - - - - 1 - - - Contents\MacOS - 0 - - - - - classes - 1 - - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable - 1 - - - - - Contents\Resources - 1 - - - - - - 1 - - - 1 - - - 1 - - - - - library\lib\armeabi-v7a - 1 - - - 1 - - - 0 - - - 1 - - - 1 - - - 1 - - - - - library\lib\armeabi - 1 - - - - - res\drawable-large - 1 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-ldpi - 1 - - - - - res\values - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - - - 1 - - - - - - - - - - - - 12 - - - - - diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE8.res b/Ext/SynEdit/Packaged/SynEdit_DXE8.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_DXE_Icon.ico b/Ext/SynEdit/Packaged/SynEdit_DXE_Icon.ico deleted file mode 100644 index 379ec80d91cd5bef25a44bb21ae1c40a278cd772..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4286 zcmbW5J#OSi5QW>=U_(1{ItmS4g1!V}9;N3d++blCyaXpU6e=_@dxQ-)FhIZWRTs$_ zQLQs45wEHCWfF(Ina})Ode)6gDYWM$ z`da(ilNf!AOPu5~4YkC0g5>}zsRTQQFwaIk6Ia_!s-hw;D* z4$F-GYV1Yp_u8l7(Q8Bdv$RV$`r$CjE8hJ>d<<-IyyjW$2WzC1C;Lz8$&(dnV^yHs*_M0!evCMzyCP#I}Mi1k$e+_$(mafVo z?u4#EZTzU*p0uu0o@MMw(cCoiE^B0p-_xJteel6RbLgJRqBYqMe8sLZ;a>i}cs=^3 zI=N52OVvKGW&k@m;2Z7@wm8t&T;ijZ*m(1pn|5MqtRF(R*UT{n2m0*4u}5K_;3+@I zpLj3ym%7&uzKprbo=2STfBg|0=HTEnTNOuE2Jls5Ps@r)AFjq9wT88Wd>2N3tY7i0 zcZ7r5v#>F}pSfSI+OPS!BnLQw8Q8>a_*zHZgGn7kn;bWuC;3kA4Z#78V0ix%cWxY1 zpUgR@%TnOrw$2CRzVtLP-{@f$) z6M5EJaM0zw7eDS?pHty74mL5|KEUUF=erX>8C=3tf8xe@jyoXqyEecfA4A)tku}PH zMQh`rcH)OW*6;i)mN5tRHmpcLb9v`DN1BVemlt;Gr}kri^e*@^Fw>Z)&H1~@ecOkq zJMJ$yMl9l?-}|pNdYz|1@wJY5$D9Mp^LjV$M&|N7(00Eb<3~-SyX_tEr9bfv3pjQXKNPop-Pc{`-;TsMZTFw+PknNN!H@fkSm;8#xk)=YOs#n@#5dHIheLeT zLfmWUmmc8|KQu=DppS1L&bi0c=bl|e(Lk8{c67h zwDYcUO^BoGUbtDiVEMjjxLJc>^CXuee8#9n=eyhToq50U9lAq%o?Xrv*eiz`ZE~@H znCD!*#bK@a6BuyW`&(>syxp_3Hx6LkKa62VXCXPUN38KZ(K<9Dy&s2=h=GJV#& zW84!^pK&blUiH`bEul8hNZz;;>BG^rr1AZ?ocF)w-~f6ZS~*Z-)Y^MYYmKRzUbA73t|EE@br_Cxkv_Dyzac9zFJ`keLO4%nrXPuRCo TJ}dUm!Z-=56Xvp9J}v(Ob;cBC diff --git a/Ext/SynEdit/Packaged/SynEdit_R10.dpk b/Ext/SynEdit/Packaged/SynEdit_R10.dpk deleted file mode 100644 index a843f6b..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R10.dpk +++ /dev/null @@ -1,142 +0,0 @@ -package SynEdit_R10; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite runtime'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - SynTextDrawer in '..\Source\SynTextDrawer.pas', - SynAutoCorrect in '..\Source\SynAutoCorrect.pas', - SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, - SynCompletionProposal in '..\Source\SynCompletionProposal.pas', - SynDBEdit in '..\Source\SynDBEdit.pas', - SynEdit in '..\Source\SynEdit.pas', - SynEditAutoComplete in '..\Source\SynEditAutoComplete.pas', - SynEditExport in '..\Source\SynEditExport.pas', - SynEditHighlighter in '..\Source\SynEditHighlighter.pas', - SynEditKbdHandler in '..\Source\SynEditKbdHandler.pas', - SynEditKeyCmdEditor in '..\Source\SynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, - SynEditKeyCmds in '..\Source\SynEditKeyCmds.pas', - SynEditKeyCmdsEditor in '..\Source\SynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, - SynEditKeyConst in '..\Source\SynEditKeyConst.pas', - SynEditMiscClasses in '..\Source\SynEditMiscClasses.pas', - SynEditMiscProcs in '..\Source\SynEditMiscProcs.pas', - SynEditOptionsDialog in '..\Source\SynEditOptionsDialog.pas' {fmEditorOptionsDialog}, - SynEditPlugins in '..\Source\SynEditPlugins.pas', - SynEditWordWrap in '..\Source\SynEditWordWrap.pas', - SynEditPrint in '..\Source\SynEditPrint.pas', - SynEditPrinterInfo in '..\Source\SynEditPrinterInfo.pas', - SynEditPrintHeaderFooter in '..\Source\SynEditPrintHeaderFooter.pas', - SynEditPrintMargins in '..\Source\SynEditPrintMargins.pas', - SynEditPrintMarginsDialog in '..\Source\SynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, - SynEditPrintPreview in '..\Source\SynEditPrintPreview.pas', - SynEditPrintTypes in '..\Source\SynEditPrintTypes.pas', - SynEditPythonBehaviour in '..\Source\SynEditPythonBehaviour.pas', - SynEditRegexSearch in '..\Source\SynEditRegexSearch.pas', - SynEditSearch in '..\Source\SynEditSearch.pas', - SynEditStrConst in '..\Source\SynEditStrConst.pas', - SynEditTextBuffer in '..\Source\SynEditTextBuffer.pas', - SynEditTypes in '..\Source\SynEditTypes.pas', - SynExportHTML in '..\Source\SynExportHTML.pas', - SynExportRTF in '..\Source\SynExportRTF.pas', - SynExportTeX in '..\Source\SynExportTeX.pas', - SynHighlighterADSP21xx in '..\Source\SynHighlighterADSP21xx.pas', - SynHighlighterAsm in '..\Source\SynHighlighterAsm.pas', - SynHighlighterAWK in '..\Source\SynHighlighterAWK.pas', - SynHighlighterBaan in '..\Source\SynHighlighterBaan.pas', - SynHighlighterBat in '..\Source\SynHighlighterBat.pas', - SynHighlighterCAC in '..\Source\SynHighlighterCAC.pas', - SynHighlighterCache in '..\Source\SynHighlighterCache.pas', - SynHighlighterCobol in '..\Source\SynHighlighterCobol.pas', - SynHighlighterCPM in '..\Source\SynHighlighterCPM.pas', - SynHighlighterCpp in '..\Source\SynHighlighterCpp.pas', - SynHighlighterCS in '..\Source\SynHighlighterCS.pas', - SynHighlighterDfm in '..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\Source\SynHighlighterDml.pas', - SynHighlighterFortran in '..\Source\SynHighlighterFortran.pas', - SynHighlighterFoxpro in '..\Source\SynHighlighterFoxpro.pas', - SynHighlighterGalaxy in '..\Source\SynHighlighterGalaxy.pas', - SynHighlighterGeneral in '..\Source\SynHighlighterGeneral.pas', - SynHighlighterGWS in '..\Source\SynHighlighterGWS.pas', - SynHighlighterHashEntries in '..\Source\SynHighlighterHashEntries.pas', - SynHighlighterHaskell in '..\Source\SynHighlighterHaskell.pas', - SynHighlighterHC11 in '..\Source\SynHighlighterHC11.pas', - SynHighlighterHP48 in '..\Source\SynHighlighterHP48.pas', - SynHighlighterHtml in '..\Source\SynHighlighterHtml.pas', - SynHighlighterIDL in '..\Source\SynHighlighterIDL.pas', - SynHighlighterIni in '..\Source\SynHighlighterIni.pas', - SynHighlighterInno in '..\Source\SynHighlighterInno.pas', - SynHighlighterJava in '..\Source\SynHighlighterJava.pas', - SynHighlighterJScript in '..\Source\SynHighlighterJScript.pas', - SynHighlighterKix in '..\Source\SynHighlighterKix.pas', - SynHighlighterM3 in '..\Source\SynHighlighterM3.pas', - SynHighlighterModelica in '..\Source\SynHighlighterModelica.pas', - SynHighlighterMsg in '..\Source\SynHighlighterMsg.pas', - SynHighlighterMulti in '..\Source\SynHighlighterMulti.pas', - SynHighlighterPas in '..\Source\SynHighlighterPas.pas', - SynHighlighterPerl in '..\Source\SynHighlighterPerl.pas', - SynHighlighterPHP in '..\Source\SynHighlighterPHP.pas', - SynHighlighterProgress in '..\Source\SynHighlighterProgress.pas', - SynHighlighterPython in '..\Source\SynHighlighterPython.pas', - SynHighlighterRC in '..\Source\SynHighlighterRC.pas', - SynHighlighterRuby in '..\Source\SynHighlighterRuby.pas', - SynHighlighterSDD in '..\Source\SynHighlighterSDD.pas', - SynHighlighterSml in '..\Source\SynHighlighterSml.pas', - SynHighlighterSQL in '..\Source\SynHighlighterSQL.pas', - SynHighlighterST in '..\Source\SynHighlighterST.pas', - SynHighlighterTclTk in '..\Source\SynHighlighterTclTk.pas', - SynHighlighterTeX in '..\Source\SynHighlighterTeX.pas', - SynHighlighterUNIXShellScript in '..\Source\SynHighlighterUNIXShellScript.pas', - SynHighlighterUnreal in '..\Source\SynHighlighterUnreal.pas', - SynHighlighterVB in '..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\Source\SynHighlighterVBScript.pas', - SynHighlighterXML in '..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\Source\SynMacroRecorder.pas', - SynMemo in '..\Source\SynMemo.pas', - SynRegExpr in '..\Source\SynRegExpr.pas', - SynHighlighterCss in '..\Source\SynHighlighterCss.pas', - SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', - SynHighlighterURI in '..\Source\SynHighlighterURI.pas', - SynURIOpener in '..\Source\SynURIOpener.pas', - SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\Source\SynHighlighterDWS.pas', - SynHighlighterYAML in '..\Source\SynHighlighterYAML.pas', - SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', - SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', - SynUnicode in '..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, - SynUsp10 in '..\Source\SynUsp10.pas' {$ENDIF}, - SynEditHighlighterOptions in '..\Source\SynEditHighlighterOptions.pas', - SynEditCodeFolding in '..\Source\SynEditCodeFolding.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_R10.dproj b/Ext/SynEdit/Packaged/SynEdit_R10.dproj deleted file mode 100644 index e2f35ad..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R10.dproj +++ /dev/null @@ -1,619 +0,0 @@ - - - {AC917C2B-5870-48AD-981D-668AD3E4A533} - SynEdit_R10.dpk - True - Debug - 3 - Package - VCL - 18.1 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_R10 - .\$(Platform)\$(Config) - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 00400000 - true - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - SynEdit component suite runtime - true - false - false - true - false - 1031 - false - false - - - android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar - Debug - package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=preferExternal;largeHeap=False;theme=TitleBar - - - SynEdit_RXE_Icon.ico - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - true - 1033 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_RXE_Icon.ico - 1033 - true - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$IFNDEF CPUX64
-
- -
$ENDIF
-
- - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEdit_R10.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver - Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server - - - - False - False - True - True - - False - - - - - Contents\Resources - 1 - - - - - classes - 1 - - - - - res\drawable-xxhdpi - 1 - - - - - Contents\MacOS - 0 - - - 1 - - - - - library\lib\mips - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 0 - - - 1 - - - 1 - - - 1 - - - library\lib\armeabi-v7a - 1 - - - 1 - - - - - 0 - - - 1 - .framework - - - - - 1 - - - 1 - - - 1 - - - - - library\lib\x86 - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - - library\lib\armeabi - 1 - - - - - 0 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-normal - 1 - - - - - res\drawable-xhdpi - 1 - - - - - res\drawable-large - 1 - - - - - 1 - - - 1 - - - 1 - - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable-hdpi - 1 - - - - - - - 1 - - - 1 - - - 1 - - - - - res\values - 1 - - - - - res\drawable-small - 1 - - - - - res\drawable - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - - - res\drawable - 1 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 0 - .bpl - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - - - res\drawable-mdpi - 1 - - - - - res\drawable-xlarge - 1 - - - - - res\drawable-ldpi - 1 - - - - - 0 - .dll;.bpl - - - 1 - .dylib - - - - - - - - - - - - 12 - - - - -
diff --git a/Ext/SynEdit/Packaged/SynEdit_R10.res b/Ext/SynEdit/Packaged/SynEdit_R10.res deleted file mode 100644 index f896e26c2967387825b0377575653b7b0037a650..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqu^e+khRr>${ diff --git a/Ext/SynEdit/Packaged/SynEdit_R10_1.dpk b/Ext/SynEdit/Packaged/SynEdit_R10_1.dpk deleted file mode 100644 index 21c92d9..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R10_1.dpk +++ /dev/null @@ -1,142 +0,0 @@ -package SynEdit_R10_1; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite runtime'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - SynTextDrawer in '..\Source\SynTextDrawer.pas', - SynAutoCorrect in '..\Source\SynAutoCorrect.pas', - SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, - SynCompletionProposal in '..\Source\SynCompletionProposal.pas', - SynDBEdit in '..\Source\SynDBEdit.pas', - SynEdit in '..\Source\SynEdit.pas', - SynEditAutoComplete in '..\Source\SynEditAutoComplete.pas', - SynEditExport in '..\Source\SynEditExport.pas', - SynEditHighlighter in '..\Source\SynEditHighlighter.pas', - SynEditKbdHandler in '..\Source\SynEditKbdHandler.pas', - SynEditKeyCmdEditor in '..\Source\SynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, - SynEditKeyCmds in '..\Source\SynEditKeyCmds.pas', - SynEditKeyCmdsEditor in '..\Source\SynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, - SynEditKeyConst in '..\Source\SynEditKeyConst.pas', - SynEditMiscClasses in '..\Source\SynEditMiscClasses.pas', - SynEditMiscProcs in '..\Source\SynEditMiscProcs.pas', - SynEditOptionsDialog in '..\Source\SynEditOptionsDialog.pas' {fmEditorOptionsDialog}, - SynEditPlugins in '..\Source\SynEditPlugins.pas', - SynEditWordWrap in '..\Source\SynEditWordWrap.pas', - SynEditPrint in '..\Source\SynEditPrint.pas', - SynEditPrinterInfo in '..\Source\SynEditPrinterInfo.pas', - SynEditPrintHeaderFooter in '..\Source\SynEditPrintHeaderFooter.pas', - SynEditPrintMargins in '..\Source\SynEditPrintMargins.pas', - SynEditPrintMarginsDialog in '..\Source\SynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, - SynEditPrintPreview in '..\Source\SynEditPrintPreview.pas', - SynEditPrintTypes in '..\Source\SynEditPrintTypes.pas', - SynEditPythonBehaviour in '..\Source\SynEditPythonBehaviour.pas', - SynEditRegexSearch in '..\Source\SynEditRegexSearch.pas', - SynEditSearch in '..\Source\SynEditSearch.pas', - SynEditStrConst in '..\Source\SynEditStrConst.pas', - SynEditTextBuffer in '..\Source\SynEditTextBuffer.pas', - SynEditTypes in '..\Source\SynEditTypes.pas', - SynExportHTML in '..\Source\SynExportHTML.pas', - SynExportRTF in '..\Source\SynExportRTF.pas', - SynExportTeX in '..\Source\SynExportTeX.pas', - SynHighlighterADSP21xx in '..\Source\SynHighlighterADSP21xx.pas', - SynHighlighterAsm in '..\Source\SynHighlighterAsm.pas', - SynHighlighterAWK in '..\Source\SynHighlighterAWK.pas', - SynHighlighterBaan in '..\Source\SynHighlighterBaan.pas', - SynHighlighterBat in '..\Source\SynHighlighterBat.pas', - SynHighlighterCAC in '..\Source\SynHighlighterCAC.pas', - SynHighlighterCache in '..\Source\SynHighlighterCache.pas', - SynHighlighterCobol in '..\Source\SynHighlighterCobol.pas', - SynHighlighterCPM in '..\Source\SynHighlighterCPM.pas', - SynHighlighterCpp in '..\Source\SynHighlighterCpp.pas', - SynHighlighterCS in '..\Source\SynHighlighterCS.pas', - SynHighlighterDfm in '..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\Source\SynHighlighterDml.pas', - SynHighlighterFortran in '..\Source\SynHighlighterFortran.pas', - SynHighlighterFoxpro in '..\Source\SynHighlighterFoxpro.pas', - SynHighlighterGalaxy in '..\Source\SynHighlighterGalaxy.pas', - SynHighlighterGeneral in '..\Source\SynHighlighterGeneral.pas', - SynHighlighterGWS in '..\Source\SynHighlighterGWS.pas', - SynHighlighterHashEntries in '..\Source\SynHighlighterHashEntries.pas', - SynHighlighterHaskell in '..\Source\SynHighlighterHaskell.pas', - SynHighlighterHC11 in '..\Source\SynHighlighterHC11.pas', - SynHighlighterHP48 in '..\Source\SynHighlighterHP48.pas', - SynHighlighterHtml in '..\Source\SynHighlighterHtml.pas', - SynHighlighterIDL in '..\Source\SynHighlighterIDL.pas', - SynHighlighterIni in '..\Source\SynHighlighterIni.pas', - SynHighlighterInno in '..\Source\SynHighlighterInno.pas', - SynHighlighterJava in '..\Source\SynHighlighterJava.pas', - SynHighlighterJScript in '..\Source\SynHighlighterJScript.pas', - SynHighlighterKix in '..\Source\SynHighlighterKix.pas', - SynHighlighterM3 in '..\Source\SynHighlighterM3.pas', - SynHighlighterModelica in '..\Source\SynHighlighterModelica.pas', - SynHighlighterMsg in '..\Source\SynHighlighterMsg.pas', - SynHighlighterMulti in '..\Source\SynHighlighterMulti.pas', - SynHighlighterPas in '..\Source\SynHighlighterPas.pas', - SynHighlighterPerl in '..\Source\SynHighlighterPerl.pas', - SynHighlighterPHP in '..\Source\SynHighlighterPHP.pas', - SynHighlighterProgress in '..\Source\SynHighlighterProgress.pas', - SynHighlighterPython in '..\Source\SynHighlighterPython.pas', - SynHighlighterRC in '..\Source\SynHighlighterRC.pas', - SynHighlighterRuby in '..\Source\SynHighlighterRuby.pas', - SynHighlighterSDD in '..\Source\SynHighlighterSDD.pas', - SynHighlighterSml in '..\Source\SynHighlighterSml.pas', - SynHighlighterSQL in '..\Source\SynHighlighterSQL.pas', - SynHighlighterST in '..\Source\SynHighlighterST.pas', - SynHighlighterTclTk in '..\Source\SynHighlighterTclTk.pas', - SynHighlighterTeX in '..\Source\SynHighlighterTeX.pas', - SynHighlighterUNIXShellScript in '..\Source\SynHighlighterUNIXShellScript.pas', - SynHighlighterUnreal in '..\Source\SynHighlighterUnreal.pas', - SynHighlighterVB in '..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\Source\SynHighlighterVBScript.pas', - SynHighlighterXML in '..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\Source\SynMacroRecorder.pas', - SynMemo in '..\Source\SynMemo.pas', - SynRegExpr in '..\Source\SynRegExpr.pas', - SynHighlighterCss in '..\Source\SynHighlighterCss.pas', - SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', - SynHighlighterURI in '..\Source\SynHighlighterURI.pas', - SynURIOpener in '..\Source\SynURIOpener.pas', - SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\Source\SynHighlighterDWS.pas', - SynHighlighterYAML in '..\Source\SynHighlighterYAML.pas', - SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', - SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', - SynUnicode in '..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, - SynUsp10 in '..\Source\SynUsp10.pas' {$ENDIF}, - SynEditHighlighterOptions in '..\Source\SynEditHighlighterOptions.pas', - SynEditCodeFolding in '..\Source\SynEditCodeFolding.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_R10_1.dproj b/Ext/SynEdit/Packaged/SynEdit_R10_1.dproj deleted file mode 100644 index 0b45f51..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R10_1.dproj +++ /dev/null @@ -1,638 +0,0 @@ - - - {AC917C2B-5870-48AD-981D-668AD3E4A533} - SynEdit_R10_1.dpk - True - Release - 1 - Package - VCL - 19.0 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_R10_1 - .\$(Platform)\$(Config) - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 00400000 - true - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - SynEdit component suite runtime - true - false - false - true - false - 1031 - false - false - - - SynEdit_RXE_Icon.ico - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - true - 1033 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_RXE_Icon.ico - 1033 - true - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$IFNDEF CPUX64
-
- -
$ENDIF
-
- - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEdit_R10_1.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - - - True - False - - False - - - - SynEdit_R10_1.bpl - true - - - - - - Contents\Resources - 1 - - - - - classes - 1 - - - - - res\drawable-xxhdpi - 1 - - - - - Contents\MacOS - 0 - - - 1 - - - - - library\lib\mips - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 0 - - - 1 - - - 1 - - - library\lib\armeabi-v7a - 1 - - - 1 - - - - - 0 - - - 1 - .framework - - - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - - library\lib\armeabi - 1 - - - - - 0 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-normal - 1 - - - - - res\drawable-xhdpi - 1 - - - - - res\drawable-large - 1 - - - - - 1 - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable-hdpi - 1 - - - - - - - Assets - 1 - - - Assets - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\values - 1 - - - - - res\drawable-small - 1 - - - - - res\drawable - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - - - res\drawable - 1 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 0 - .bpl - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - - - res\drawable-mdpi - 1 - - - - - res\drawable-xlarge - 1 - - - - - res\drawable-ldpi - 1 - - - - - 0 - .dll;.bpl - - - 1 - .dylib - - - - - - - - - - - - - 12 - - - - -
diff --git a/Ext/SynEdit/Packaged/SynEdit_R10_1.res b/Ext/SynEdit/Packaged/SynEdit_R10_1.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_R10_2.dpk b/Ext/SynEdit/Packaged/SynEdit_R10_2.dpk deleted file mode 100644 index d285318..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R10_2.dpk +++ /dev/null @@ -1,142 +0,0 @@ -package SynEdit_R10_2; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite runtime'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - SynTextDrawer in '..\Source\SynTextDrawer.pas', - SynAutoCorrect in '..\Source\SynAutoCorrect.pas', - SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, - SynCompletionProposal in '..\Source\SynCompletionProposal.pas', - SynDBEdit in '..\Source\SynDBEdit.pas', - SynEdit in '..\Source\SynEdit.pas', - SynEditAutoComplete in '..\Source\SynEditAutoComplete.pas', - SynEditExport in '..\Source\SynEditExport.pas', - SynEditHighlighter in '..\Source\SynEditHighlighter.pas', - SynEditKbdHandler in '..\Source\SynEditKbdHandler.pas', - SynEditKeyCmdEditor in '..\Source\SynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, - SynEditKeyCmds in '..\Source\SynEditKeyCmds.pas', - SynEditKeyCmdsEditor in '..\Source\SynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, - SynEditKeyConst in '..\Source\SynEditKeyConst.pas', - SynEditMiscClasses in '..\Source\SynEditMiscClasses.pas', - SynEditMiscProcs in '..\Source\SynEditMiscProcs.pas', - SynEditOptionsDialog in '..\Source\SynEditOptionsDialog.pas' {fmEditorOptionsDialog}, - SynEditPlugins in '..\Source\SynEditPlugins.pas', - SynEditWordWrap in '..\Source\SynEditWordWrap.pas', - SynEditPrint in '..\Source\SynEditPrint.pas', - SynEditPrinterInfo in '..\Source\SynEditPrinterInfo.pas', - SynEditPrintHeaderFooter in '..\Source\SynEditPrintHeaderFooter.pas', - SynEditPrintMargins in '..\Source\SynEditPrintMargins.pas', - SynEditPrintMarginsDialog in '..\Source\SynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, - SynEditPrintPreview in '..\Source\SynEditPrintPreview.pas', - SynEditPrintTypes in '..\Source\SynEditPrintTypes.pas', - SynEditPythonBehaviour in '..\Source\SynEditPythonBehaviour.pas', - SynEditRegexSearch in '..\Source\SynEditRegexSearch.pas', - SynEditSearch in '..\Source\SynEditSearch.pas', - SynEditStrConst in '..\Source\SynEditStrConst.pas', - SynEditTextBuffer in '..\Source\SynEditTextBuffer.pas', - SynEditTypes in '..\Source\SynEditTypes.pas', - SynExportHTML in '..\Source\SynExportHTML.pas', - SynExportRTF in '..\Source\SynExportRTF.pas', - SynExportTeX in '..\Source\SynExportTeX.pas', - SynHighlighterADSP21xx in '..\Source\SynHighlighterADSP21xx.pas', - SynHighlighterAsm in '..\Source\SynHighlighterAsm.pas', - SynHighlighterAWK in '..\Source\SynHighlighterAWK.pas', - SynHighlighterBaan in '..\Source\SynHighlighterBaan.pas', - SynHighlighterBat in '..\Source\SynHighlighterBat.pas', - SynHighlighterCAC in '..\Source\SynHighlighterCAC.pas', - SynHighlighterCache in '..\Source\SynHighlighterCache.pas', - SynHighlighterCobol in '..\Source\SynHighlighterCobol.pas', - SynHighlighterCPM in '..\Source\SynHighlighterCPM.pas', - SynHighlighterCpp in '..\Source\SynHighlighterCpp.pas', - SynHighlighterCS in '..\Source\SynHighlighterCS.pas', - SynHighlighterDfm in '..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\Source\SynHighlighterDml.pas', - SynHighlighterFortran in '..\Source\SynHighlighterFortran.pas', - SynHighlighterFoxpro in '..\Source\SynHighlighterFoxpro.pas', - SynHighlighterGalaxy in '..\Source\SynHighlighterGalaxy.pas', - SynHighlighterGeneral in '..\Source\SynHighlighterGeneral.pas', - SynHighlighterGWS in '..\Source\SynHighlighterGWS.pas', - SynHighlighterHashEntries in '..\Source\SynHighlighterHashEntries.pas', - SynHighlighterHaskell in '..\Source\SynHighlighterHaskell.pas', - SynHighlighterHC11 in '..\Source\SynHighlighterHC11.pas', - SynHighlighterHP48 in '..\Source\SynHighlighterHP48.pas', - SynHighlighterHtml in '..\Source\SynHighlighterHtml.pas', - SynHighlighterIDL in '..\Source\SynHighlighterIDL.pas', - SynHighlighterIni in '..\Source\SynHighlighterIni.pas', - SynHighlighterInno in '..\Source\SynHighlighterInno.pas', - SynHighlighterJava in '..\Source\SynHighlighterJava.pas', - SynHighlighterJScript in '..\Source\SynHighlighterJScript.pas', - SynHighlighterKix in '..\Source\SynHighlighterKix.pas', - SynHighlighterM3 in '..\Source\SynHighlighterM3.pas', - SynHighlighterModelica in '..\Source\SynHighlighterModelica.pas', - SynHighlighterMsg in '..\Source\SynHighlighterMsg.pas', - SynHighlighterMulti in '..\Source\SynHighlighterMulti.pas', - SynHighlighterPas in '..\Source\SynHighlighterPas.pas', - SynHighlighterPerl in '..\Source\SynHighlighterPerl.pas', - SynHighlighterPHP in '..\Source\SynHighlighterPHP.pas', - SynHighlighterProgress in '..\Source\SynHighlighterProgress.pas', - SynHighlighterPython in '..\Source\SynHighlighterPython.pas', - SynHighlighterRC in '..\Source\SynHighlighterRC.pas', - SynHighlighterRuby in '..\Source\SynHighlighterRuby.pas', - SynHighlighterSDD in '..\Source\SynHighlighterSDD.pas', - SynHighlighterSml in '..\Source\SynHighlighterSml.pas', - SynHighlighterSQL in '..\Source\SynHighlighterSQL.pas', - SynHighlighterST in '..\Source\SynHighlighterST.pas', - SynHighlighterTclTk in '..\Source\SynHighlighterTclTk.pas', - SynHighlighterTeX in '..\Source\SynHighlighterTeX.pas', - SynHighlighterUNIXShellScript in '..\Source\SynHighlighterUNIXShellScript.pas', - SynHighlighterUnreal in '..\Source\SynHighlighterUnreal.pas', - SynHighlighterVB in '..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\Source\SynHighlighterVBScript.pas', - SynHighlighterXML in '..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\Source\SynMacroRecorder.pas', - SynMemo in '..\Source\SynMemo.pas', - SynRegExpr in '..\Source\SynRegExpr.pas', - SynHighlighterCss in '..\Source\SynHighlighterCss.pas', - SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', - SynHighlighterURI in '..\Source\SynHighlighterURI.pas', - SynURIOpener in '..\Source\SynURIOpener.pas', - SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\Source\SynHighlighterDWS.pas', - SynHighlighterYAML in '..\Source\SynHighlighterYAML.pas', - SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', - SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', - SynUnicode in '..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, - SynUsp10 in '..\Source\SynUsp10.pas' {$ENDIF}, - SynEditHighlighterOptions in '..\Source\SynEditHighlighterOptions.pas', - SynEditCodeFolding in '..\Source\SynEditCodeFolding.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_R10_2.dproj b/Ext/SynEdit/Packaged/SynEdit_R10_2.dproj deleted file mode 100644 index 196b5aa..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R10_2.dproj +++ /dev/null @@ -1,628 +0,0 @@ - - - {36E4673B-E304-42FF-A704-C02F2B73EA95} - SynEdit_R10_2.dpk - True - Release - 1 - Package - VCL - 19.0 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_R10_2 - .\$(Platform)\$(Config) - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 00400000 - true - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - SynEdit component suite runtime - true - false - false - true - false - 1031 - false - false - - - SynEdit_RXE_Icon.ico - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - true - 1033 - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$IFNDEF CPUX64
-
- -
$ENDIF
-
- - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEdit_R10_2.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - - - - True - - False - - - - SynEdit_R10_2.bpl - true - - - - - 1 - - - Contents\MacOS - 0 - - - - - classes - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - - - library\lib\mips - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - - - res\values - 1 - - - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - 12 - - - - -
diff --git a/Ext/SynEdit/Packaged/SynEdit_R10_2.res b/Ext/SynEdit/Packaged/SynEdit_R10_2.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_R10_3.dpk b/Ext/SynEdit/Packaged/SynEdit_R10_3.dpk deleted file mode 100644 index 4402753..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R10_3.dpk +++ /dev/null @@ -1,142 +0,0 @@ -package SynEdit_R10_3; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite runtime'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - SynTextDrawer in '..\Source\SynTextDrawer.pas', - SynAutoCorrect in '..\Source\SynAutoCorrect.pas', - SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, - SynCompletionProposal in '..\Source\SynCompletionProposal.pas', - SynDBEdit in '..\Source\SynDBEdit.pas', - SynEdit in '..\Source\SynEdit.pas', - SynEditAutoComplete in '..\Source\SynEditAutoComplete.pas', - SynEditExport in '..\Source\SynEditExport.pas', - SynEditHighlighter in '..\Source\SynEditHighlighter.pas', - SynEditKbdHandler in '..\Source\SynEditKbdHandler.pas', - SynEditKeyCmdEditor in '..\Source\SynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, - SynEditKeyCmds in '..\Source\SynEditKeyCmds.pas', - SynEditKeyCmdsEditor in '..\Source\SynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, - SynEditKeyConst in '..\Source\SynEditKeyConst.pas', - SynEditMiscClasses in '..\Source\SynEditMiscClasses.pas', - SynEditMiscProcs in '..\Source\SynEditMiscProcs.pas', - SynEditOptionsDialog in '..\Source\SynEditOptionsDialog.pas' {fmEditorOptionsDialog}, - SynEditPlugins in '..\Source\SynEditPlugins.pas', - SynEditWordWrap in '..\Source\SynEditWordWrap.pas', - SynEditPrint in '..\Source\SynEditPrint.pas', - SynEditPrinterInfo in '..\Source\SynEditPrinterInfo.pas', - SynEditPrintHeaderFooter in '..\Source\SynEditPrintHeaderFooter.pas', - SynEditPrintMargins in '..\Source\SynEditPrintMargins.pas', - SynEditPrintMarginsDialog in '..\Source\SynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, - SynEditPrintPreview in '..\Source\SynEditPrintPreview.pas', - SynEditPrintTypes in '..\Source\SynEditPrintTypes.pas', - SynEditPythonBehaviour in '..\Source\SynEditPythonBehaviour.pas', - SynEditRegexSearch in '..\Source\SynEditRegexSearch.pas', - SynEditSearch in '..\Source\SynEditSearch.pas', - SynEditStrConst in '..\Source\SynEditStrConst.pas', - SynEditTextBuffer in '..\Source\SynEditTextBuffer.pas', - SynEditTypes in '..\Source\SynEditTypes.pas', - SynExportHTML in '..\Source\SynExportHTML.pas', - SynExportRTF in '..\Source\SynExportRTF.pas', - SynExportTeX in '..\Source\SynExportTeX.pas', - SynHighlighterADSP21xx in '..\Source\SynHighlighterADSP21xx.pas', - SynHighlighterAsm in '..\Source\SynHighlighterAsm.pas', - SynHighlighterAWK in '..\Source\SynHighlighterAWK.pas', - SynHighlighterBaan in '..\Source\SynHighlighterBaan.pas', - SynHighlighterBat in '..\Source\SynHighlighterBat.pas', - SynHighlighterCAC in '..\Source\SynHighlighterCAC.pas', - SynHighlighterCache in '..\Source\SynHighlighterCache.pas', - SynHighlighterCobol in '..\Source\SynHighlighterCobol.pas', - SynHighlighterCPM in '..\Source\SynHighlighterCPM.pas', - SynHighlighterCpp in '..\Source\SynHighlighterCpp.pas', - SynHighlighterCS in '..\Source\SynHighlighterCS.pas', - SynHighlighterDfm in '..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\Source\SynHighlighterDml.pas', - SynHighlighterFortran in '..\Source\SynHighlighterFortran.pas', - SynHighlighterFoxpro in '..\Source\SynHighlighterFoxpro.pas', - SynHighlighterGalaxy in '..\Source\SynHighlighterGalaxy.pas', - SynHighlighterGeneral in '..\Source\SynHighlighterGeneral.pas', - SynHighlighterGWS in '..\Source\SynHighlighterGWS.pas', - SynHighlighterHashEntries in '..\Source\SynHighlighterHashEntries.pas', - SynHighlighterHaskell in '..\Source\SynHighlighterHaskell.pas', - SynHighlighterHC11 in '..\Source\SynHighlighterHC11.pas', - SynHighlighterHP48 in '..\Source\SynHighlighterHP48.pas', - SynHighlighterHtml in '..\Source\SynHighlighterHtml.pas', - SynHighlighterIDL in '..\Source\SynHighlighterIDL.pas', - SynHighlighterIni in '..\Source\SynHighlighterIni.pas', - SynHighlighterInno in '..\Source\SynHighlighterInno.pas', - SynHighlighterJava in '..\Source\SynHighlighterJava.pas', - SynHighlighterJScript in '..\Source\SynHighlighterJScript.pas', - SynHighlighterKix in '..\Source\SynHighlighterKix.pas', - SynHighlighterM3 in '..\Source\SynHighlighterM3.pas', - SynHighlighterModelica in '..\Source\SynHighlighterModelica.pas', - SynHighlighterMsg in '..\Source\SynHighlighterMsg.pas', - SynHighlighterMulti in '..\Source\SynHighlighterMulti.pas', - SynHighlighterPas in '..\Source\SynHighlighterPas.pas', - SynHighlighterPerl in '..\Source\SynHighlighterPerl.pas', - SynHighlighterPHP in '..\Source\SynHighlighterPHP.pas', - SynHighlighterProgress in '..\Source\SynHighlighterProgress.pas', - SynHighlighterPython in '..\Source\SynHighlighterPython.pas', - SynHighlighterRC in '..\Source\SynHighlighterRC.pas', - SynHighlighterRuby in '..\Source\SynHighlighterRuby.pas', - SynHighlighterSDD in '..\Source\SynHighlighterSDD.pas', - SynHighlighterSml in '..\Source\SynHighlighterSml.pas', - SynHighlighterSQL in '..\Source\SynHighlighterSQL.pas', - SynHighlighterST in '..\Source\SynHighlighterST.pas', - SynHighlighterTclTk in '..\Source\SynHighlighterTclTk.pas', - SynHighlighterTeX in '..\Source\SynHighlighterTeX.pas', - SynHighlighterUNIXShellScript in '..\Source\SynHighlighterUNIXShellScript.pas', - SynHighlighterUnreal in '..\Source\SynHighlighterUnreal.pas', - SynHighlighterVB in '..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\Source\SynHighlighterVBScript.pas', - SynHighlighterXML in '..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\Source\SynMacroRecorder.pas', - SynMemo in '..\Source\SynMemo.pas', - SynRegExpr in '..\Source\SynRegExpr.pas', - SynHighlighterCss in '..\Source\SynHighlighterCss.pas', - SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', - SynHighlighterURI in '..\Source\SynHighlighterURI.pas', - SynURIOpener in '..\Source\SynURIOpener.pas', - SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\Source\SynHighlighterDWS.pas', - SynHighlighterYAML in '..\Source\SynHighlighterYAML.pas', - SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', - SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', - SynUnicode in '..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, - SynUsp10 in '..\Source\SynUsp10.pas' {$ENDIF}, - SynEditHighlighterOptions in '..\Source\SynEditHighlighterOptions.pas', - SynEditCodeFolding in '..\Source\SynEditCodeFolding.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_R10_3.dproj b/Ext/SynEdit/Packaged/SynEdit_R10_3.dproj deleted file mode 100644 index f82a92b..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R10_3.dproj +++ /dev/null @@ -1,1022 +0,0 @@ - - - {36E4673B-E304-42FF-A704-C02F2B73EA95} - SynEdit_R10_3.dpk - True - Release - 1 - Package - VCL - 19.0 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_R10_3 - .\$(Platform)\$(Config) - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 00400000 - true - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - SynEdit component suite runtime - true - false - false - true - false - 1031 - false - false - - - SynEdit_RXE_Icon.ico - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - true - 1033 - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$IFNDEF CPUX64
-
- -
$ENDIF
-
- - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEdit_R10_3.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Ethea IconFontsImageList component - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - - - - True - - False - - - - SynEdit_R10_3.bpl - true - - - - - 1 - - - 0 - - - - - classes - 1 - - - classes - 1 - - - - - res\xml - 1 - - - res\xml - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\mips - 1 - - - library\lib\mips - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\values-v21 - 1 - - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-small - 1 - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - - Contents\Resources - 1 - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - - - 12 - - - - -
diff --git a/Ext/SynEdit/Packaged/SynEdit_R10_3.res b/Ext/SynEdit/Packaged/SynEdit_R10_3.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_R10_4.dpk b/Ext/SynEdit/Packaged/SynEdit_R10_4.dpk deleted file mode 100644 index 5990d16..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R10_4.dpk +++ /dev/null @@ -1,142 +0,0 @@ -package SynEdit_R10_4; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite runtime'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - SynTextDrawer in '..\Source\SynTextDrawer.pas', - SynAutoCorrect in '..\Source\SynAutoCorrect.pas', - SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, - SynCompletionProposal in '..\Source\SynCompletionProposal.pas', - SynDBEdit in '..\Source\SynDBEdit.pas', - SynEdit in '..\Source\SynEdit.pas', - SynEditAutoComplete in '..\Source\SynEditAutoComplete.pas', - SynEditExport in '..\Source\SynEditExport.pas', - SynEditHighlighter in '..\Source\SynEditHighlighter.pas', - SynEditKbdHandler in '..\Source\SynEditKbdHandler.pas', - SynEditKeyCmdEditor in '..\Source\SynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, - SynEditKeyCmds in '..\Source\SynEditKeyCmds.pas', - SynEditKeyCmdsEditor in '..\Source\SynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, - SynEditKeyConst in '..\Source\SynEditKeyConst.pas', - SynEditMiscClasses in '..\Source\SynEditMiscClasses.pas', - SynEditMiscProcs in '..\Source\SynEditMiscProcs.pas', - SynEditOptionsDialog in '..\Source\SynEditOptionsDialog.pas' {fmEditorOptionsDialog}, - SynEditPlugins in '..\Source\SynEditPlugins.pas', - SynEditWordWrap in '..\Source\SynEditWordWrap.pas', - SynEditPrint in '..\Source\SynEditPrint.pas', - SynEditPrinterInfo in '..\Source\SynEditPrinterInfo.pas', - SynEditPrintHeaderFooter in '..\Source\SynEditPrintHeaderFooter.pas', - SynEditPrintMargins in '..\Source\SynEditPrintMargins.pas', - SynEditPrintMarginsDialog in '..\Source\SynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, - SynEditPrintPreview in '..\Source\SynEditPrintPreview.pas', - SynEditPrintTypes in '..\Source\SynEditPrintTypes.pas', - SynEditPythonBehaviour in '..\Source\SynEditPythonBehaviour.pas', - SynEditRegexSearch in '..\Source\SynEditRegexSearch.pas', - SynEditSearch in '..\Source\SynEditSearch.pas', - SynEditStrConst in '..\Source\SynEditStrConst.pas', - SynEditTextBuffer in '..\Source\SynEditTextBuffer.pas', - SynEditTypes in '..\Source\SynEditTypes.pas', - SynExportHTML in '..\Source\SynExportHTML.pas', - SynExportRTF in '..\Source\SynExportRTF.pas', - SynExportTeX in '..\Source\SynExportTeX.pas', - SynHighlighterADSP21xx in '..\Source\SynHighlighterADSP21xx.pas', - SynHighlighterAsm in '..\Source\SynHighlighterAsm.pas', - SynHighlighterAWK in '..\Source\SynHighlighterAWK.pas', - SynHighlighterBaan in '..\Source\SynHighlighterBaan.pas', - SynHighlighterBat in '..\Source\SynHighlighterBat.pas', - SynHighlighterCAC in '..\Source\SynHighlighterCAC.pas', - SynHighlighterCache in '..\Source\SynHighlighterCache.pas', - SynHighlighterCobol in '..\Source\SynHighlighterCobol.pas', - SynHighlighterCPM in '..\Source\SynHighlighterCPM.pas', - SynHighlighterCpp in '..\Source\SynHighlighterCpp.pas', - SynHighlighterCS in '..\Source\SynHighlighterCS.pas', - SynHighlighterDfm in '..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\Source\SynHighlighterDml.pas', - SynHighlighterFortran in '..\Source\SynHighlighterFortran.pas', - SynHighlighterFoxpro in '..\Source\SynHighlighterFoxpro.pas', - SynHighlighterGalaxy in '..\Source\SynHighlighterGalaxy.pas', - SynHighlighterGeneral in '..\Source\SynHighlighterGeneral.pas', - SynHighlighterGWS in '..\Source\SynHighlighterGWS.pas', - SynHighlighterHashEntries in '..\Source\SynHighlighterHashEntries.pas', - SynHighlighterHaskell in '..\Source\SynHighlighterHaskell.pas', - SynHighlighterHC11 in '..\Source\SynHighlighterHC11.pas', - SynHighlighterHP48 in '..\Source\SynHighlighterHP48.pas', - SynHighlighterHtml in '..\Source\SynHighlighterHtml.pas', - SynHighlighterIDL in '..\Source\SynHighlighterIDL.pas', - SynHighlighterIni in '..\Source\SynHighlighterIni.pas', - SynHighlighterInno in '..\Source\SynHighlighterInno.pas', - SynHighlighterJava in '..\Source\SynHighlighterJava.pas', - SynHighlighterJScript in '..\Source\SynHighlighterJScript.pas', - SynHighlighterKix in '..\Source\SynHighlighterKix.pas', - SynHighlighterM3 in '..\Source\SynHighlighterM3.pas', - SynHighlighterModelica in '..\Source\SynHighlighterModelica.pas', - SynHighlighterMsg in '..\Source\SynHighlighterMsg.pas', - SynHighlighterMulti in '..\Source\SynHighlighterMulti.pas', - SynHighlighterPas in '..\Source\SynHighlighterPas.pas', - SynHighlighterPerl in '..\Source\SynHighlighterPerl.pas', - SynHighlighterPHP in '..\Source\SynHighlighterPHP.pas', - SynHighlighterProgress in '..\Source\SynHighlighterProgress.pas', - SynHighlighterPython in '..\Source\SynHighlighterPython.pas', - SynHighlighterRC in '..\Source\SynHighlighterRC.pas', - SynHighlighterRuby in '..\Source\SynHighlighterRuby.pas', - SynHighlighterSDD in '..\Source\SynHighlighterSDD.pas', - SynHighlighterSml in '..\Source\SynHighlighterSml.pas', - SynHighlighterSQL in '..\Source\SynHighlighterSQL.pas', - SynHighlighterST in '..\Source\SynHighlighterST.pas', - SynHighlighterTclTk in '..\Source\SynHighlighterTclTk.pas', - SynHighlighterTeX in '..\Source\SynHighlighterTeX.pas', - SynHighlighterUNIXShellScript in '..\Source\SynHighlighterUNIXShellScript.pas', - SynHighlighterUnreal in '..\Source\SynHighlighterUnreal.pas', - SynHighlighterVB in '..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\Source\SynHighlighterVBScript.pas', - SynHighlighterXML in '..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\Source\SynMacroRecorder.pas', - SynMemo in '..\Source\SynMemo.pas', - SynRegExpr in '..\Source\SynRegExpr.pas', - SynHighlighterCss in '..\Source\SynHighlighterCss.pas', - SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', - SynHighlighterURI in '..\Source\SynHighlighterURI.pas', - SynURIOpener in '..\Source\SynURIOpener.pas', - SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\Source\SynHighlighterDWS.pas', - SynHighlighterYAML in '..\Source\SynHighlighterYAML.pas', - SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', - SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', - SynUnicode in '..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, - SynUsp10 in '..\Source\SynUsp10.pas' {$ENDIF}, - SynEditHighlighterOptions in '..\Source\SynEditHighlighterOptions.pas', - SynEditCodeFolding in '..\Source\SynEditCodeFolding.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_R10_4.dproj b/Ext/SynEdit/Packaged/SynEdit_R10_4.dproj deleted file mode 100644 index 38b9b3d..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R10_4.dproj +++ /dev/null @@ -1,1238 +0,0 @@ - - - {4EE3E185-3F29-45AE-A725-60CF3934A9CE} - SynEdit_R10_4.dpk - True - Release - 1 - Package - VCL - 19.2 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_R10_4 - .\$(Platform)\$(Config) - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 00400000 - true - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - SynEdit component suite runtime - true - false - false - true - false - 1031 - false - false - - - SynEdit_RXE_Icon.ico - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - true - 1033 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - Debug - true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - 1033 - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$IFNDEF CPUX64
-
- -
$ENDIF
-
- - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEdit_R10_4.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - - - True - False - - False - - - - SynEdit_R10_4.bpl - true - - - - - 1 - - - 0 - - - - - classes - 1 - - - classes - 1 - - - - - res\xml - 1 - - - res\xml - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\armeabi - 1 - - - library\lib\armeabi - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - library\lib\mips - 1 - - - library\lib\mips - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - - - library\lib\armeabi-v7a - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\values-v21 - 1 - - - res\values-v21 - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - res\drawable - 1 - - - res\drawable - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-ldpi - 1 - - - res\drawable-ldpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-mdpi - 1 - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - res\drawable-hdpi - 1 - - - - - res\drawable-xhdpi - 1 - - - res\drawable-xhdpi - 1 - - - - - res\drawable-xxhdpi - 1 - - - res\drawable-xxhdpi - 1 - - - - - res\drawable-xxxhdpi - 1 - - - res\drawable-xxxhdpi - 1 - - - - - res\drawable-small - 1 - - - res\drawable-small - 1 - - - - - res\drawable-normal - 1 - - - res\drawable-normal - 1 - - - - - res\drawable-large - 1 - - - res\drawable-large - 1 - - - - - res\drawable-xlarge - 1 - - - res\drawable-xlarge - 1 - - - - - res\values - 1 - - - res\values - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 1 - .framework - - - 0 - - - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - 0 - .bpl - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - 1 - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\LaunchScreenImage.imageset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - ..\$(PROJECTNAME).launchscreen\Assets\AppIcon.appiconset - 1 - - - - - 1 - - - 1 - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - - - - - 1 - - - 1 - - - 1 - - - - - - - - Contents\Resources - 1 - - - Contents\Resources - 1 - - - - - library\lib\armeabi-v7a - 1 - - - library\lib\arm64-v8a - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 1 - - - 0 - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - Assets - 1 - - - Assets - 1 - - - - - - - - - - - - - - - 12 - - - - -
diff --git a/Ext/SynEdit/Packaged/SynEdit_R10_4.res b/Ext/SynEdit/Packaged/SynEdit_R10_4.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_R11.dpk b/Ext/SynEdit/Packaged/SynEdit_R11.dpk deleted file mode 100644 index 18d8303..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R11.dpk +++ /dev/null @@ -1,142 +0,0 @@ -package SynEdit_R11; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite runtime'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - SynTextDrawer in '..\Source\SynTextDrawer.pas', - SynAutoCorrect in '..\Source\SynAutoCorrect.pas', - SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, - SynCompletionProposal in '..\Source\SynCompletionProposal.pas', - SynDBEdit in '..\Source\SynDBEdit.pas', - SynEdit in '..\Source\SynEdit.pas', - SynEditAutoComplete in '..\Source\SynEditAutoComplete.pas', - SynEditExport in '..\Source\SynEditExport.pas', - SynEditHighlighter in '..\Source\SynEditHighlighter.pas', - SynEditKbdHandler in '..\Source\SynEditKbdHandler.pas', - SynEditKeyCmdEditor in '..\Source\SynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, - SynEditKeyCmds in '..\Source\SynEditKeyCmds.pas', - SynEditKeyCmdsEditor in '..\Source\SynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, - SynEditKeyConst in '..\Source\SynEditKeyConst.pas', - SynEditMiscClasses in '..\Source\SynEditMiscClasses.pas', - SynEditMiscProcs in '..\Source\SynEditMiscProcs.pas', - SynEditOptionsDialog in '..\Source\SynEditOptionsDialog.pas' {fmEditorOptionsDialog}, - SynEditPlugins in '..\Source\SynEditPlugins.pas', - SynEditWordWrap in '..\Source\SynEditWordWrap.pas', - SynEditPrint in '..\Source\SynEditPrint.pas', - SynEditPrinterInfo in '..\Source\SynEditPrinterInfo.pas', - SynEditPrintHeaderFooter in '..\Source\SynEditPrintHeaderFooter.pas', - SynEditPrintMargins in '..\Source\SynEditPrintMargins.pas', - SynEditPrintMarginsDialog in '..\Source\SynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, - SynEditPrintPreview in '..\Source\SynEditPrintPreview.pas', - SynEditPrintTypes in '..\Source\SynEditPrintTypes.pas', - SynEditPythonBehaviour in '..\Source\SynEditPythonBehaviour.pas', - SynEditRegexSearch in '..\Source\SynEditRegexSearch.pas', - SynEditSearch in '..\Source\SynEditSearch.pas', - SynEditStrConst in '..\Source\SynEditStrConst.pas', - SynEditTextBuffer in '..\Source\SynEditTextBuffer.pas', - SynEditTypes in '..\Source\SynEditTypes.pas', - SynExportHTML in '..\Source\SynExportHTML.pas', - SynExportRTF in '..\Source\SynExportRTF.pas', - SynExportTeX in '..\Source\SynExportTeX.pas', - SynHighlighterADSP21xx in '..\Source\SynHighlighterADSP21xx.pas', - SynHighlighterAsm in '..\Source\SynHighlighterAsm.pas', - SynHighlighterAWK in '..\Source\SynHighlighterAWK.pas', - SynHighlighterBaan in '..\Source\SynHighlighterBaan.pas', - SynHighlighterBat in '..\Source\SynHighlighterBat.pas', - SynHighlighterCAC in '..\Source\SynHighlighterCAC.pas', - SynHighlighterCache in '..\Source\SynHighlighterCache.pas', - SynHighlighterCobol in '..\Source\SynHighlighterCobol.pas', - SynHighlighterCPM in '..\Source\SynHighlighterCPM.pas', - SynHighlighterCpp in '..\Source\SynHighlighterCpp.pas', - SynHighlighterCS in '..\Source\SynHighlighterCS.pas', - SynHighlighterDfm in '..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\Source\SynHighlighterDml.pas', - SynHighlighterFortran in '..\Source\SynHighlighterFortran.pas', - SynHighlighterFoxpro in '..\Source\SynHighlighterFoxpro.pas', - SynHighlighterGalaxy in '..\Source\SynHighlighterGalaxy.pas', - SynHighlighterGeneral in '..\Source\SynHighlighterGeneral.pas', - SynHighlighterGWS in '..\Source\SynHighlighterGWS.pas', - SynHighlighterHashEntries in '..\Source\SynHighlighterHashEntries.pas', - SynHighlighterHaskell in '..\Source\SynHighlighterHaskell.pas', - SynHighlighterHC11 in '..\Source\SynHighlighterHC11.pas', - SynHighlighterHP48 in '..\Source\SynHighlighterHP48.pas', - SynHighlighterHtml in '..\Source\SynHighlighterHtml.pas', - SynHighlighterIDL in '..\Source\SynHighlighterIDL.pas', - SynHighlighterIni in '..\Source\SynHighlighterIni.pas', - SynHighlighterInno in '..\Source\SynHighlighterInno.pas', - SynHighlighterJava in '..\Source\SynHighlighterJava.pas', - SynHighlighterJScript in '..\Source\SynHighlighterJScript.pas', - SynHighlighterKix in '..\Source\SynHighlighterKix.pas', - SynHighlighterM3 in '..\Source\SynHighlighterM3.pas', - SynHighlighterModelica in '..\Source\SynHighlighterModelica.pas', - SynHighlighterMsg in '..\Source\SynHighlighterMsg.pas', - SynHighlighterMulti in '..\Source\SynHighlighterMulti.pas', - SynHighlighterPas in '..\Source\SynHighlighterPas.pas', - SynHighlighterPerl in '..\Source\SynHighlighterPerl.pas', - SynHighlighterPHP in '..\Source\SynHighlighterPHP.pas', - SynHighlighterProgress in '..\Source\SynHighlighterProgress.pas', - SynHighlighterPython in '..\Source\SynHighlighterPython.pas', - SynHighlighterRC in '..\Source\SynHighlighterRC.pas', - SynHighlighterRuby in '..\Source\SynHighlighterRuby.pas', - SynHighlighterSDD in '..\Source\SynHighlighterSDD.pas', - SynHighlighterSml in '..\Source\SynHighlighterSml.pas', - SynHighlighterSQL in '..\Source\SynHighlighterSQL.pas', - SynHighlighterST in '..\Source\SynHighlighterST.pas', - SynHighlighterTclTk in '..\Source\SynHighlighterTclTk.pas', - SynHighlighterTeX in '..\Source\SynHighlighterTeX.pas', - SynHighlighterUNIXShellScript in '..\Source\SynHighlighterUNIXShellScript.pas', - SynHighlighterUnreal in '..\Source\SynHighlighterUnreal.pas', - SynHighlighterVB in '..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\Source\SynHighlighterVBScript.pas', - SynHighlighterXML in '..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\Source\SynMacroRecorder.pas', - SynMemo in '..\Source\SynMemo.pas', - SynRegExpr in '..\Source\SynRegExpr.pas', - SynHighlighterCss in '..\Source\SynHighlighterCss.pas', - SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', - SynHighlighterURI in '..\Source\SynHighlighterURI.pas', - SynURIOpener in '..\Source\SynURIOpener.pas', - SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\Source\SynHighlighterDWS.pas', - SynHighlighterYAML in '..\Source\SynHighlighterYAML.pas', - SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', - SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', - SynUnicode in '..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, - SynUsp10 in '..\Source\SynUsp10.pas' {$ENDIF}, - SynEditHighlighterOptions in '..\Source\SynEditHighlighterOptions.pas', - SynEditCodeFolding in '..\Source\SynEditCodeFolding.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_R11.dproj b/Ext/SynEdit/Packaged/SynEdit_R11.dproj deleted file mode 100644 index f7b0f52..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R11.dproj +++ /dev/null @@ -1,272 +0,0 @@ - - - {64DCC92D-223C-458B-BD29-6F1EA3AA4D85} - SynEdit_R11.dpk - True - Release - 1 - Package - VCL - 19.5 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_R11 - .\$(Platform)\$(Config) - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 00400000 - true - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - SynEdit component suite runtime - true - false - false - true - false - 1031 - false - false - - - SynEdit_RXE_Icon.ico - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - true - 1033 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - Debug - true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - 1033 - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$IFNDEF CPUX64
-
- -
$ENDIF
-
- - - - Base - - - Cfg_1 - Base - - - Cfg_2 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEdit_R11.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - - - True - False - - False - - 12 - - - -
diff --git a/Ext/SynEdit/Packaged/SynEdit_R11.res b/Ext/SynEdit/Packaged/SynEdit_R11.res deleted file mode 100644 index 0a66bd5570535afbd3aba3067c79735129cdb114..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqt^e+kZRrvq_ diff --git a/Ext/SynEdit/Packaged/SynEdit_R12.res b/Ext/SynEdit/Packaged/SynEdit_R12.res deleted file mode 100644 index 4ea92b8ea31127c12db192f8bc54e5ab2798d4a4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJcpyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk)-M5O-* z>8vHoEQQR%y|Z*7w%@PnRCnj*CMGu2t@Ef;-&b|&oZGaS*_Nd5L)5(T?5*Yerfk&F zvtti7(r9mOSItNE&}#jDXa{QT+voO~`uqC*NNt{9H~##`jP>Cob>*{WILw(cWT!s% z(7v~)_Sl}-xAOMbzO%38`H6jF$D04qZFX!|tlp9AiUW*x>}B~&`$t;y)ShYeu~zcD zZEwjY#k2bo8OxYsmlhz=IflkCcN}ws3GB zm)GMbr}*?Zu*aYK9P{9qnwyJ1{`y`q)!2yxYs6(L&b3qSWl!8KxGUlhzk$a-28YP2 z&oy95ijJ6q!@Mc`tXLf{HTkEV{i1C$midpk$x$<46A$CDe+9c%EL9^3zb$dqYNHp* z?M!x+@+@IbOml6=T5KfpKd0Ztdho#@=7_tsUN+eeeEDu9!ae)_%Z)>y< z*wkPr2Xw)`f-Mg8HJA9rif^>@=t}JP)Y!a^xZS3UF*wj?{~dcF>=`_zYv~#5B7SS8 zv4byRu3^u^&x_xF4h~&#@H5-UkHl*5Rb%JLVi4c`SW-ea8SDw zHlp>J`~Fh<)m>O}fD@R3jo*SVJL(=x>LA+WxbU1wS6WvG2Vw-n_djvF!a?=PoaeOf z4G!Mc`CyzJItQ?kS?s@KiaVTW!_{*jEU!gz3r+u~wsNm^;BbZqZ25~lE%7IZYK)(p zoBR?#`Qc0lkCA`!a;^zI@M1{JBTIPvlv) z;1HMZz4&qG`Z*OY<6z^%+bi%{@Ad8*}KcFeoaF0g!FYx8boF3$sP?>DRQqo#?w>>d6Uf8x9Ef*;s1 z-!`RwE0H17!L6nrk{!1rKL?l)p6_>q70wYO%R(acSpwPAnYR>@9leSf6A z9_w-@#UcOOS+k7qecg5b-;o%z@&5DrQ=gn5@ZN_JJgmf5 zEyTS>{EA07_>UN)eu$5EAkMjutIs_()TVf013q^k|5f-(K1!muS-XnEwfL#eOYK+r zAE2Fgjn{-Ydff{*YZolPZwhYKAlN*~WfeYS)S~CR8uOibzoIMRj@a|;a?ZdWI5g2F z7t@D%&ed%khMJ#&0hg)1icOBkdzSXd0j%YRF=W+QNKWh#Hh#}ki8t!_-zzw(hkTDr zo%QZMmIdW{qp*Dz-ym2Sehoje$#;5OczW*f$E1-v=fde&0t=&ar>zJxZ z-X9RS`1`Qy$O*ph@+61b>fstM_zpbI%bA43{jif?azJ}*cgTa=btM;yo4rXt>G!@m z*Q3eDtz6E}eIC19cVE1l?9<;}^-X@3$NMw0UW0#2{*t_qJeQmmIgv*0`<&>r19E1z zjyyMeNxokb#!Oh1F#G;&y?@>K=0fLH`_$g^Z$JC?zJCeQus=JK?;3o~(D#h3E&r;) sSCBQ^kkz}AzJEnuVm^_VL;rqsAdiRY9oWbEx^t*6Oz}*=L#=7(UkY_q`v3p{ diff --git a/Ext/SynEdit/Packaged/SynEdit_R2010.dpk b/Ext/SynEdit/Packaged/SynEdit_R2010.dpk deleted file mode 100644 index 93cc92c..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R2010.dpk +++ /dev/null @@ -1,146 +0,0 @@ -package SynEdit_R2010; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO ON} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS ON} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION OFF} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO ON} -{$SAFEDIVIDE OFF} -{$STACKFRAMES ON} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE DEBUG} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite runtime'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - SynTextDrawer in '..\Source\SynTextDrawer.pas', - SynAutoCorrect in '..\Source\SynAutoCorrect.pas', - SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, - SynCompletionProposal in '..\Source\SynCompletionProposal.pas', - SynDBEdit in '..\Source\SynDBEdit.pas', - SynEdit in '..\Source\SynEdit.pas', - SynEditAutoComplete in '..\Source\SynEditAutoComplete.pas', - SynEditExport in '..\Source\SynEditExport.pas', - SynEditHighlighter in '..\Source\SynEditHighlighter.pas', - SynEditKbdHandler in '..\Source\SynEditKbdHandler.pas', - SynEditKeyCmdEditor in '..\Source\SynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, - SynEditKeyCmds in '..\Source\SynEditKeyCmds.pas', - SynEditKeyCmdsEditor in '..\Source\SynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, - SynEditKeyConst in '..\Source\SynEditKeyConst.pas', - SynEditMiscClasses in '..\Source\SynEditMiscClasses.pas', - SynEditMiscProcs in '..\Source\SynEditMiscProcs.pas', - SynEditOptionsDialog in '..\Source\SynEditOptionsDialog.pas' {fmEditorOptionsDialog}, - SynEditPlugins in '..\Source\SynEditPlugins.pas', - SynEditWordWrap in '..\Source\SynEditWordWrap.pas', - SynEditPrint in '..\Source\SynEditPrint.pas', - SynEditPrinterInfo in '..\Source\SynEditPrinterInfo.pas', - SynEditPrintHeaderFooter in '..\Source\SynEditPrintHeaderFooter.pas', - SynEditPrintMargins in '..\Source\SynEditPrintMargins.pas', - SynEditPrintMarginsDialog in '..\Source\SynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, - SynEditPrintPreview in '..\Source\SynEditPrintPreview.pas', - SynEditPrintTypes in '..\Source\SynEditPrintTypes.pas', - SynEditPythonBehaviour in '..\Source\SynEditPythonBehaviour.pas', - SynEditRegexSearch in '..\Source\SynEditRegexSearch.pas', - SynEditSearch in '..\Source\SynEditSearch.pas', - SynEditStrConst in '..\Source\SynEditStrConst.pas', - SynEditTextBuffer in '..\Source\SynEditTextBuffer.pas', - SynEditTypes in '..\Source\SynEditTypes.pas', - SynExportHTML in '..\Source\SynExportHTML.pas', - SynExportRTF in '..\Source\SynExportRTF.pas', - SynExportTeX in '..\Source\SynExportTeX.pas', - SynHighlighterADSP21xx in '..\Source\SynHighlighterADSP21xx.pas', - SynHighlighterAsm in '..\Source\SynHighlighterAsm.pas', - SynHighlighterAWK in '..\Source\SynHighlighterAWK.pas', - SynHighlighterBaan in '..\Source\SynHighlighterBaan.pas', - SynHighlighterBat in '..\Source\SynHighlighterBat.pas', - SynHighlighterCAC in '..\Source\SynHighlighterCAC.pas', - SynHighlighterCache in '..\Source\SynHighlighterCache.pas', - SynHighlighterCobol in '..\Source\SynHighlighterCobol.pas', - SynHighlighterCPM in '..\Source\SynHighlighterCPM.pas', - SynHighlighterCpp in '..\Source\SynHighlighterCpp.pas', - SynHighlighterCS in '..\Source\SynHighlighterCS.pas', - SynHighlighterDfm in '..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\Source\SynHighlighterDml.pas', - SynHighlighterFortran in '..\Source\SynHighlighterFortran.pas', - SynHighlighterFoxpro in '..\Source\SynHighlighterFoxpro.pas', - SynHighlighterGalaxy in '..\Source\SynHighlighterGalaxy.pas', - SynHighlighterGeneral in '..\Source\SynHighlighterGeneral.pas', - SynHighlighterGWS in '..\Source\SynHighlighterGWS.pas', - SynHighlighterHashEntries in '..\Source\SynHighlighterHashEntries.pas', - SynHighlighterHaskell in '..\Source\SynHighlighterHaskell.pas', - SynHighlighterHC11 in '..\Source\SynHighlighterHC11.pas', - SynHighlighterHP48 in '..\Source\SynHighlighterHP48.pas', - SynHighlighterHtml in '..\Source\SynHighlighterHtml.pas', - SynHighlighterIDL in '..\Source\SynHighlighterIDL.pas', - SynHighlighterIni in '..\Source\SynHighlighterIni.pas', - SynHighlighterInno in '..\Source\SynHighlighterInno.pas', - SynHighlighterJava in '..\Source\SynHighlighterJava.pas', - SynHighlighterJScript in '..\Source\SynHighlighterJScript.pas', - SynHighlighterKix in '..\Source\SynHighlighterKix.pas', - SynHighlighterM3 in '..\Source\SynHighlighterM3.pas', - SynHighlighterModelica in '..\Source\SynHighlighterModelica.pas', - SynHighlighterMsg in '..\Source\SynHighlighterMsg.pas', - SynHighlighterMulti in '..\Source\SynHighlighterMulti.pas', - SynHighlighterPas in '..\Source\SynHighlighterPas.pas', - SynHighlighterPerl in '..\Source\SynHighlighterPerl.pas', - SynHighlighterPHP in '..\Source\SynHighlighterPHP.pas', - SynHighlighterProgress in '..\Source\SynHighlighterProgress.pas', - SynHighlighterPython in '..\Source\SynHighlighterPython.pas', - SynHighlighterRC in '..\Source\SynHighlighterRC.pas', - SynHighlighterRuby in '..\Source\SynHighlighterRuby.pas', - SynHighlighterSDD in '..\Source\SynHighlighterSDD.pas', - SynHighlighterSml in '..\Source\SynHighlighterSml.pas', - SynHighlighterSQL in '..\Source\SynHighlighterSQL.pas', - SynHighlighterST in '..\Source\SynHighlighterST.pas', - SynHighlighterTclTk in '..\Source\SynHighlighterTclTk.pas', - SynHighlighterTeX in '..\Source\SynHighlighterTeX.pas', - SynHighlighterUNIXShellScript in '..\Source\SynHighlighterUNIXShellScript.pas', - SynHighlighterUnreal in '..\Source\SynHighlighterUnreal.pas', - SynHighlighterVB in '..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\Source\SynHighlighterVBScript.pas', - SynHighlighterXML in '..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\Source\SynMacroRecorder.pas', - SynMemo in '..\Source\SynMemo.pas', - SynRegExpr in '..\Source\SynRegExpr.pas', - SynHighlighterCss in '..\Source\SynHighlighterCss.pas', - SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', - SynHighlighterURI in '..\Source\SynHighlighterURI.pas', - SynURIOpener in '..\Source\SynURIOpener.pas', - SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\Source\SynHighlighterDWS.pas', - SynHighlighterYAML in '..\Source\SynHighlighterYAML.pas', - SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', - SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', - SynUnicode in '..\Source\SynUnicode.pas', - SynUsp10 in '..\Source\SynUsp10.pas', - SynEditHighlighterOptions in '..\Source\SynEditHighlighterOptions.pas', - SynEditDocumentManager in '..\Source\SynEditDocumentManager.pas', - SynHighlighterAsmMASM in '..\Source\SynHighlighterAsmMASM.pas', - SynHighlighterGo in '..\Source\SynHighlighterGo.pas', - SynHighlighterGLSL in '..\Source\SynHighlighterGLSL.pas', - SynHighlighterJSON in '..\Source\SynHighlighterJSON.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_R2010.dproj b/Ext/SynEdit/Packaged/SynEdit_R2010.dproj deleted file mode 100644 index 74540b3..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_R2010.dproj +++ /dev/null @@ -1,229 +0,0 @@ - - - {7B7CE941-21D4-45F8-826C-E995DD962826} - SynEdit_R2010.dpk - Debug - DCC32 - 12.0 - - - true - - - true - Base - true - - - true - Base - true - - - ..\Dcu\D2010 - false - SynEdit component suite runtime - C:\Users\Public\Documents\RAD Studio\7.0\Bpl\SynEdit_R2010.bpl - true - true - true - true - true - 00400000 - x86 - - - false - RELEASE;$(DCC_Define) - 0 - false - - - DEBUG;$(DCC_Define) - - - - MainSource - - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Base - - - Cfg_2 - Base - - - Cfg_1 - Base - -
- - - Delphi.Personality.12 - Package - - - - SynEdit_R2010.dpk - - - False - True - False - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - - - - 12 - -
diff --git a/Ext/SynEdit/Packaged/SynEdit_R2010.res b/Ext/SynEdit/Packaged/SynEdit_R2010.res deleted file mode 100644 index 1847268830b40c74a6c7d1d5cc53d7d22c3a88c6..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 5056 zcmbW5zi%8>5XZ-{rBHzjDw?wpLdXR&QY6X+5h6tbf(Vy(WkCoLi4z4=P_6%yOMwvD zg8u-mYvc;0L~;sxQc@t6?`P)C?%w4bY*w0^_ha6Czu$Rp-<{6PY)97jVQMZtKW*py zreZdHZhQOkRtCML#*XYg*@m~&(3=1I%Llk7>S*pvE7;Yj!H^)8wGGa;|&8!P>=GYp<9J^QiRC`{t12%dXkNqpywX{@?Eb_MKs@29XRNI;2D%DxW zo|xv^jnf#kFIDZr^e=W==PW{#^6Ao{deqzuxId;ujOZ~3;otiwSzBXu3^t3 z&$C~D3=Umz@OQRR9+}nP>x`ZB115dAI{rd2#Mbgv81-@e%IA6)a8SDwHm3Di`~Fn> z)jhG~04Fd5o4f^Iah!WFIS0|E#)aohzS6onIG_;>-~Ytz3J0A}=DenTZ*cIo-Ves9 zp>qHmo5lV+rntk2He9_1!t%2yZsF;l)mH7b4jkU$0bBWEPmBKKP>uSjxhXIDsSodT z@EG|gFZa>|hHF!PaN};FzIxxlpPKT;87{i(!eu7T%H?}r^yeP=K2c}If`cyKd-3DW z_4ib`jDt-MZ?C~;z1O=EKN(!YbpFJR_c`u>(C=ph9O_Y*Jz5Z>`Zs7T9Mn$y@ay$^ z{gulxYxXwGq@TIGbG$~Hi*qk8?9|WMkNweF@MU18F;AQKZ>jcWAL86`f59r^Yh;+XfGU10gV*5=*FT)q#qz2B_Ik28(#vUlW{{>1m(1wXK3zHQ3+RoHfz^$cuqg(^Hlp)z6WUMUE^m$ z9R1u2H_t9ue%}<_JcD5KB$svgjBysd-ql#|toxF$&>h1Qc)Vw6j~u{SeHg>my$i{SJtD^MnJV!{AK!ZgN9Q4bN2bs7?m1Qo zsLwc-cxU?4_%7jWppm+9C(?(bpCye?f6Mv)ml~{r9)<=EoH5SYc}%g6sWZv%2MjL$ zd)R%{gxu$OlEaJ6!*jggJMcIu?<5>9hMoM91KzcrqYfU|m0CzQdy{!G??rvC$5W3N zaydEidE#>2Me)vx&wS_gXXRNP?~l!T4gM|rOZH6mRCZkKNFKZBbELl=uw%1L?5Wvh z<$gsNGhtQ2?EB-*{#7&EllA?}_OZQh*X(7747sg2Bs%YxjlEsL3 z{o^+uxM_#>$nM&K-LY%(_w2SZAJ|v+Kv6$?%${A5(syN7!~sUHE8B*&KCt`t(DoJo zy;Se3cY6TX^_a|gRWsk(7moE%n0K}IV2ItbmlU0`w-ozG(PPXz_O{T|5+9z29(y3{ zdn*jybo`Grf5&HG`%pYld&j=k%6Nk3827m%_U%ipyD$I9z7dmrBKAhfLDj%b-t@)_ zM2$XG>;q-{PTCJw7@BH{?&X+O^{d)nb6rt;(5OK&yy`@6IqzgO?xxureiB0AfmYp9 M - - {AC917C2B-5870-48AD-981D-668AD3E4A533} - SynEdit_RXE3.dpk - True - Debug - 3 - Package - VCL - 14.4 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - ..\Dcu\DXE3 - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 00400000 - true - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - SynEdit component suite runtime - true - false - false - true - false - 1031 - false - false - - - SynEdit_RXE_Icon.ico - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - true - 1033 - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_RXE_Icon.ico - 1033 - true - - - false - false - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$IFNDEF CPUX64
-
- -
$ENDIF
-
- - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEdit_RXE3.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - File C:\Users\Public\Documents\RAD Studio\10.0\Bpl\UniSynEdit_DXE3.bpl not found - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - - - - True - True - - - 12 - - - - diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE3.res b/Ext/SynEdit/Packaged/SynEdit_RXE3.res deleted file mode 100644 index f896e26c2967387825b0377575653b7b0037a650..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqu^e+khRr>${ diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE5.dpk b/Ext/SynEdit/Packaged/SynEdit_RXE5.dpk deleted file mode 100644 index 1cec52c..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_RXE5.dpk +++ /dev/null @@ -1,142 +0,0 @@ -package SynEdit_RXE5; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite runtime'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - SynTextDrawer in '..\Source\SynTextDrawer.pas', - SynAutoCorrect in '..\Source\SynAutoCorrect.pas', - SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, - SynCompletionProposal in '..\Source\SynCompletionProposal.pas', - SynDBEdit in '..\Source\SynDBEdit.pas', - SynEdit in '..\Source\SynEdit.pas', - SynEditAutoComplete in '..\Source\SynEditAutoComplete.pas', - SynEditExport in '..\Source\SynEditExport.pas', - SynEditHighlighter in '..\Source\SynEditHighlighter.pas', - SynEditKbdHandler in '..\Source\SynEditKbdHandler.pas', - SynEditKeyCmdEditor in '..\Source\SynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, - SynEditKeyCmds in '..\Source\SynEditKeyCmds.pas', - SynEditKeyCmdsEditor in '..\Source\SynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, - SynEditKeyConst in '..\Source\SynEditKeyConst.pas', - SynEditMiscClasses in '..\Source\SynEditMiscClasses.pas', - SynEditMiscProcs in '..\Source\SynEditMiscProcs.pas', - SynEditOptionsDialog in '..\Source\SynEditOptionsDialog.pas' {fmEditorOptionsDialog}, - SynEditPlugins in '..\Source\SynEditPlugins.pas', - SynEditWordWrap in '..\Source\SynEditWordWrap.pas', - SynEditPrint in '..\Source\SynEditPrint.pas', - SynEditPrinterInfo in '..\Source\SynEditPrinterInfo.pas', - SynEditPrintHeaderFooter in '..\Source\SynEditPrintHeaderFooter.pas', - SynEditPrintMargins in '..\Source\SynEditPrintMargins.pas', - SynEditPrintMarginsDialog in '..\Source\SynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, - SynEditPrintPreview in '..\Source\SynEditPrintPreview.pas', - SynEditPrintTypes in '..\Source\SynEditPrintTypes.pas', - SynEditPythonBehaviour in '..\Source\SynEditPythonBehaviour.pas', - SynEditRegexSearch in '..\Source\SynEditRegexSearch.pas', - SynEditSearch in '..\Source\SynEditSearch.pas', - SynEditStrConst in '..\Source\SynEditStrConst.pas', - SynEditTextBuffer in '..\Source\SynEditTextBuffer.pas', - SynEditTypes in '..\Source\SynEditTypes.pas', - SynExportHTML in '..\Source\SynExportHTML.pas', - SynExportRTF in '..\Source\SynExportRTF.pas', - SynExportTeX in '..\Source\SynExportTeX.pas', - SynHighlighterADSP21xx in '..\Source\SynHighlighterADSP21xx.pas', - SynHighlighterAsm in '..\Source\SynHighlighterAsm.pas', - SynHighlighterAWK in '..\Source\SynHighlighterAWK.pas', - SynHighlighterBaan in '..\Source\SynHighlighterBaan.pas', - SynHighlighterBat in '..\Source\SynHighlighterBat.pas', - SynHighlighterCAC in '..\Source\SynHighlighterCAC.pas', - SynHighlighterCache in '..\Source\SynHighlighterCache.pas', - SynHighlighterCobol in '..\Source\SynHighlighterCobol.pas', - SynHighlighterCPM in '..\Source\SynHighlighterCPM.pas', - SynHighlighterCpp in '..\Source\SynHighlighterCpp.pas', - SynHighlighterCS in '..\Source\SynHighlighterCS.pas', - SynHighlighterDfm in '..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\Source\SynHighlighterDml.pas', - SynHighlighterFortran in '..\Source\SynHighlighterFortran.pas', - SynHighlighterFoxpro in '..\Source\SynHighlighterFoxpro.pas', - SynHighlighterGalaxy in '..\Source\SynHighlighterGalaxy.pas', - SynHighlighterGeneral in '..\Source\SynHighlighterGeneral.pas', - SynHighlighterGWS in '..\Source\SynHighlighterGWS.pas', - SynHighlighterHashEntries in '..\Source\SynHighlighterHashEntries.pas', - SynHighlighterHaskell in '..\Source\SynHighlighterHaskell.pas', - SynHighlighterHC11 in '..\Source\SynHighlighterHC11.pas', - SynHighlighterHP48 in '..\Source\SynHighlighterHP48.pas', - SynHighlighterHtml in '..\Source\SynHighlighterHtml.pas', - SynHighlighterIDL in '..\Source\SynHighlighterIDL.pas', - SynHighlighterIni in '..\Source\SynHighlighterIni.pas', - SynHighlighterInno in '..\Source\SynHighlighterInno.pas', - SynHighlighterJava in '..\Source\SynHighlighterJava.pas', - SynHighlighterJScript in '..\Source\SynHighlighterJScript.pas', - SynHighlighterKix in '..\Source\SynHighlighterKix.pas', - SynHighlighterM3 in '..\Source\SynHighlighterM3.pas', - SynHighlighterModelica in '..\Source\SynHighlighterModelica.pas', - SynHighlighterMsg in '..\Source\SynHighlighterMsg.pas', - SynHighlighterMulti in '..\Source\SynHighlighterMulti.pas', - SynHighlighterPas in '..\Source\SynHighlighterPas.pas', - SynHighlighterPerl in '..\Source\SynHighlighterPerl.pas', - SynHighlighterPHP in '..\Source\SynHighlighterPHP.pas', - SynHighlighterProgress in '..\Source\SynHighlighterProgress.pas', - SynHighlighterPython in '..\Source\SynHighlighterPython.pas', - SynHighlighterRC in '..\Source\SynHighlighterRC.pas', - SynHighlighterRuby in '..\Source\SynHighlighterRuby.pas', - SynHighlighterSDD in '..\Source\SynHighlighterSDD.pas', - SynHighlighterSml in '..\Source\SynHighlighterSml.pas', - SynHighlighterSQL in '..\Source\SynHighlighterSQL.pas', - SynHighlighterST in '..\Source\SynHighlighterST.pas', - SynHighlighterTclTk in '..\Source\SynHighlighterTclTk.pas', - SynHighlighterTeX in '..\Source\SynHighlighterTeX.pas', - SynHighlighterUNIXShellScript in '..\Source\SynHighlighterUNIXShellScript.pas', - SynHighlighterUnreal in '..\Source\SynHighlighterUnreal.pas', - SynHighlighterVB in '..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\Source\SynHighlighterVBScript.pas', - SynHighlighterXML in '..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\Source\SynMacroRecorder.pas', - SynMemo in '..\Source\SynMemo.pas', - SynRegExpr in '..\Source\SynRegExpr.pas', - SynHighlighterCss in '..\Source\SynHighlighterCss.pas', - SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', - SynHighlighterURI in '..\Source\SynHighlighterURI.pas', - SynURIOpener in '..\Source\SynURIOpener.pas', - SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\Source\SynHighlighterDWS.pas', - SynHighlighterYAML in '..\Source\SynHighlighterYAML.pas', - SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', - SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', - SynUnicode in '..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, - SynUsp10 in '..\Source\SynUsp10.pas' {$ENDIF}, - SynEditHighlighterOptions in '..\Source\SynEditHighlighterOptions.pas', - SynEditCodeFolding in '..\Source\SynEditCodeFolding.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE5.dproj b/Ext/SynEdit/Packaged/SynEdit_RXE5.dproj deleted file mode 100644 index 1aeac3f..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_RXE5.dproj +++ /dev/null @@ -1,284 +0,0 @@ - - - {AC917C2B-5870-48AD-981D-668AD3E4A533} - SynEdit_RXE5.dpk - True - Debug - 3 - Package - VCL - 15.3 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - ..\dcu\DXE5\ - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 00400000 - true - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - SynEdit component suite runtime - true - false - false - true - false - 1031 - false - false - - - Debug - package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=preferExternal;largeHeap=False;theme=TitleBar - - - SynEdit_RXE_Icon.ico - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - true - 1033 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_RXE_Icon.ico - 1033 - true - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$IFNDEF CPUX64
-
- -
$ENDIF
-
- - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEdit_RXE5.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - File C:\Users\Public\Documents\RAD Studio\12.0\Bpl\UniSynEdit_DXE5.bpl not found - Microsoft Office 2000 Sample Automation Server Wrapper Components - Microsoft Office XP Sample Automation Server Wrapper Components - - - - False - False - False - True - True - - False - - 12 - - - -
diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE5.res b/Ext/SynEdit/Packaged/SynEdit_RXE5.res deleted file mode 100644 index f896e26c2967387825b0377575653b7b0037a650..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqu^e+khRr>${ diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE6.dpk b/Ext/SynEdit/Packaged/SynEdit_RXE6.dpk deleted file mode 100644 index e40539f..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_RXE6.dpk +++ /dev/null @@ -1,142 +0,0 @@ -package SynEdit_RXE6; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite runtime'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - SynTextDrawer in '..\Source\SynTextDrawer.pas', - SynAutoCorrect in '..\Source\SynAutoCorrect.pas', - SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, - SynCompletionProposal in '..\Source\SynCompletionProposal.pas', - SynDBEdit in '..\Source\SynDBEdit.pas', - SynEdit in '..\Source\SynEdit.pas', - SynEditAutoComplete in '..\Source\SynEditAutoComplete.pas', - SynEditExport in '..\Source\SynEditExport.pas', - SynEditHighlighter in '..\Source\SynEditHighlighter.pas', - SynEditKbdHandler in '..\Source\SynEditKbdHandler.pas', - SynEditKeyCmdEditor in '..\Source\SynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, - SynEditKeyCmds in '..\Source\SynEditKeyCmds.pas', - SynEditKeyCmdsEditor in '..\Source\SynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, - SynEditKeyConst in '..\Source\SynEditKeyConst.pas', - SynEditMiscClasses in '..\Source\SynEditMiscClasses.pas', - SynEditMiscProcs in '..\Source\SynEditMiscProcs.pas', - SynEditOptionsDialog in '..\Source\SynEditOptionsDialog.pas' {fmEditorOptionsDialog}, - SynEditPlugins in '..\Source\SynEditPlugins.pas', - SynEditWordWrap in '..\Source\SynEditWordWrap.pas', - SynEditPrint in '..\Source\SynEditPrint.pas', - SynEditPrinterInfo in '..\Source\SynEditPrinterInfo.pas', - SynEditPrintHeaderFooter in '..\Source\SynEditPrintHeaderFooter.pas', - SynEditPrintMargins in '..\Source\SynEditPrintMargins.pas', - SynEditPrintMarginsDialog in '..\Source\SynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, - SynEditPrintPreview in '..\Source\SynEditPrintPreview.pas', - SynEditPrintTypes in '..\Source\SynEditPrintTypes.pas', - SynEditPythonBehaviour in '..\Source\SynEditPythonBehaviour.pas', - SynEditRegexSearch in '..\Source\SynEditRegexSearch.pas', - SynEditSearch in '..\Source\SynEditSearch.pas', - SynEditStrConst in '..\Source\SynEditStrConst.pas', - SynEditTextBuffer in '..\Source\SynEditTextBuffer.pas', - SynEditTypes in '..\Source\SynEditTypes.pas', - SynExportHTML in '..\Source\SynExportHTML.pas', - SynExportRTF in '..\Source\SynExportRTF.pas', - SynExportTeX in '..\Source\SynExportTeX.pas', - SynHighlighterADSP21xx in '..\Source\SynHighlighterADSP21xx.pas', - SynHighlighterAsm in '..\Source\SynHighlighterAsm.pas', - SynHighlighterAWK in '..\Source\SynHighlighterAWK.pas', - SynHighlighterBaan in '..\Source\SynHighlighterBaan.pas', - SynHighlighterBat in '..\Source\SynHighlighterBat.pas', - SynHighlighterCAC in '..\Source\SynHighlighterCAC.pas', - SynHighlighterCache in '..\Source\SynHighlighterCache.pas', - SynHighlighterCobol in '..\Source\SynHighlighterCobol.pas', - SynHighlighterCPM in '..\Source\SynHighlighterCPM.pas', - SynHighlighterCpp in '..\Source\SynHighlighterCpp.pas', - SynHighlighterCS in '..\Source\SynHighlighterCS.pas', - SynHighlighterDfm in '..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\Source\SynHighlighterDml.pas', - SynHighlighterFortran in '..\Source\SynHighlighterFortran.pas', - SynHighlighterFoxpro in '..\Source\SynHighlighterFoxpro.pas', - SynHighlighterGalaxy in '..\Source\SynHighlighterGalaxy.pas', - SynHighlighterGeneral in '..\Source\SynHighlighterGeneral.pas', - SynHighlighterGWS in '..\Source\SynHighlighterGWS.pas', - SynHighlighterHashEntries in '..\Source\SynHighlighterHashEntries.pas', - SynHighlighterHaskell in '..\Source\SynHighlighterHaskell.pas', - SynHighlighterHC11 in '..\Source\SynHighlighterHC11.pas', - SynHighlighterHP48 in '..\Source\SynHighlighterHP48.pas', - SynHighlighterHtml in '..\Source\SynHighlighterHtml.pas', - SynHighlighterIDL in '..\Source\SynHighlighterIDL.pas', - SynHighlighterIni in '..\Source\SynHighlighterIni.pas', - SynHighlighterInno in '..\Source\SynHighlighterInno.pas', - SynHighlighterJava in '..\Source\SynHighlighterJava.pas', - SynHighlighterJScript in '..\Source\SynHighlighterJScript.pas', - SynHighlighterKix in '..\Source\SynHighlighterKix.pas', - SynHighlighterM3 in '..\Source\SynHighlighterM3.pas', - SynHighlighterModelica in '..\Source\SynHighlighterModelica.pas', - SynHighlighterMsg in '..\Source\SynHighlighterMsg.pas', - SynHighlighterMulti in '..\Source\SynHighlighterMulti.pas', - SynHighlighterPas in '..\Source\SynHighlighterPas.pas', - SynHighlighterPerl in '..\Source\SynHighlighterPerl.pas', - SynHighlighterPHP in '..\Source\SynHighlighterPHP.pas', - SynHighlighterProgress in '..\Source\SynHighlighterProgress.pas', - SynHighlighterPython in '..\Source\SynHighlighterPython.pas', - SynHighlighterRC in '..\Source\SynHighlighterRC.pas', - SynHighlighterRuby in '..\Source\SynHighlighterRuby.pas', - SynHighlighterSDD in '..\Source\SynHighlighterSDD.pas', - SynHighlighterSml in '..\Source\SynHighlighterSml.pas', - SynHighlighterSQL in '..\Source\SynHighlighterSQL.pas', - SynHighlighterST in '..\Source\SynHighlighterST.pas', - SynHighlighterTclTk in '..\Source\SynHighlighterTclTk.pas', - SynHighlighterTeX in '..\Source\SynHighlighterTeX.pas', - SynHighlighterUNIXShellScript in '..\Source\SynHighlighterUNIXShellScript.pas', - SynHighlighterUnreal in '..\Source\SynHighlighterUnreal.pas', - SynHighlighterVB in '..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\Source\SynHighlighterVBScript.pas', - SynHighlighterXML in '..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\Source\SynMacroRecorder.pas', - SynMemo in '..\Source\SynMemo.pas', - SynRegExpr in '..\Source\SynRegExpr.pas', - SynHighlighterCss in '..\Source\SynHighlighterCss.pas', - SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', - SynHighlighterURI in '..\Source\SynHighlighterURI.pas', - SynURIOpener in '..\Source\SynURIOpener.pas', - SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\Source\SynHighlighterDWS.pas', - SynHighlighterYAML in '..\Source\SynHighlighterYAML.pas', - SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', - SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', - SynUnicode in '..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, - SynUsp10 in '..\Source\SynUsp10.pas' {$ENDIF}, - SynEditHighlighterOptions in '..\Source\SynEditHighlighterOptions.pas', - SynEditCodeFolding in '..\Source\SynEditCodeFolding.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE6.dproj b/Ext/SynEdit/Packaged/SynEdit_RXE6.dproj deleted file mode 100644 index 4eb5682..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_RXE6.dproj +++ /dev/null @@ -1,283 +0,0 @@ - - - {AC917C2B-5870-48AD-981D-668AD3E4A533} - SynEdit_RXE6.dpk - True - Debug - 3 - Package - VCL - 15.4 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - .\$(Platform)\$(Config) - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 00400000 - true - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - SynEdit component suite runtime - true - false - false - true - false - 1031 - false - false - - - Debug - package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=preferExternal;largeHeap=False;theme=TitleBar - - - SynEdit_RXE_Icon.ico - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - true - 1033 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_RXE_Icon.ico - 1033 - true - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$IFNDEF CPUX64
-
- -
$ENDIF
-
- - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEdit_RXE6.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver - Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server - - - - False - False - False - True - True - - False - - 12 - - - -
diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE6.res b/Ext/SynEdit/Packaged/SynEdit_RXE6.res deleted file mode 100644 index f896e26c2967387825b0377575653b7b0037a650..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqu^e+khRr>${ diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE7.dpk b/Ext/SynEdit/Packaged/SynEdit_RXE7.dpk deleted file mode 100644 index 3f64d38..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_RXE7.dpk +++ /dev/null @@ -1,142 +0,0 @@ -package SynEdit_RXE7; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite runtime'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - SynTextDrawer in '..\Source\SynTextDrawer.pas', - SynAutoCorrect in '..\Source\SynAutoCorrect.pas', - SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, - SynCompletionProposal in '..\Source\SynCompletionProposal.pas', - SynDBEdit in '..\Source\SynDBEdit.pas', - SynEdit in '..\Source\SynEdit.pas', - SynEditAutoComplete in '..\Source\SynEditAutoComplete.pas', - SynEditExport in '..\Source\SynEditExport.pas', - SynEditHighlighter in '..\Source\SynEditHighlighter.pas', - SynEditKbdHandler in '..\Source\SynEditKbdHandler.pas', - SynEditKeyCmdEditor in '..\Source\SynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, - SynEditKeyCmds in '..\Source\SynEditKeyCmds.pas', - SynEditKeyCmdsEditor in '..\Source\SynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, - SynEditKeyConst in '..\Source\SynEditKeyConst.pas', - SynEditMiscClasses in '..\Source\SynEditMiscClasses.pas', - SynEditMiscProcs in '..\Source\SynEditMiscProcs.pas', - SynEditOptionsDialog in '..\Source\SynEditOptionsDialog.pas' {fmEditorOptionsDialog}, - SynEditPlugins in '..\Source\SynEditPlugins.pas', - SynEditWordWrap in '..\Source\SynEditWordWrap.pas', - SynEditPrint in '..\Source\SynEditPrint.pas', - SynEditPrinterInfo in '..\Source\SynEditPrinterInfo.pas', - SynEditPrintHeaderFooter in '..\Source\SynEditPrintHeaderFooter.pas', - SynEditPrintMargins in '..\Source\SynEditPrintMargins.pas', - SynEditPrintMarginsDialog in '..\Source\SynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, - SynEditPrintPreview in '..\Source\SynEditPrintPreview.pas', - SynEditPrintTypes in '..\Source\SynEditPrintTypes.pas', - SynEditPythonBehaviour in '..\Source\SynEditPythonBehaviour.pas', - SynEditRegexSearch in '..\Source\SynEditRegexSearch.pas', - SynEditSearch in '..\Source\SynEditSearch.pas', - SynEditStrConst in '..\Source\SynEditStrConst.pas', - SynEditTextBuffer in '..\Source\SynEditTextBuffer.pas', - SynEditTypes in '..\Source\SynEditTypes.pas', - SynExportHTML in '..\Source\SynExportHTML.pas', - SynExportRTF in '..\Source\SynExportRTF.pas', - SynExportTeX in '..\Source\SynExportTeX.pas', - SynHighlighterADSP21xx in '..\Source\SynHighlighterADSP21xx.pas', - SynHighlighterAsm in '..\Source\SynHighlighterAsm.pas', - SynHighlighterAWK in '..\Source\SynHighlighterAWK.pas', - SynHighlighterBaan in '..\Source\SynHighlighterBaan.pas', - SynHighlighterBat in '..\Source\SynHighlighterBat.pas', - SynHighlighterCAC in '..\Source\SynHighlighterCAC.pas', - SynHighlighterCache in '..\Source\SynHighlighterCache.pas', - SynHighlighterCobol in '..\Source\SynHighlighterCobol.pas', - SynHighlighterCPM in '..\Source\SynHighlighterCPM.pas', - SynHighlighterCpp in '..\Source\SynHighlighterCpp.pas', - SynHighlighterCS in '..\Source\SynHighlighterCS.pas', - SynHighlighterDfm in '..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\Source\SynHighlighterDml.pas', - SynHighlighterFortran in '..\Source\SynHighlighterFortran.pas', - SynHighlighterFoxpro in '..\Source\SynHighlighterFoxpro.pas', - SynHighlighterGalaxy in '..\Source\SynHighlighterGalaxy.pas', - SynHighlighterGeneral in '..\Source\SynHighlighterGeneral.pas', - SynHighlighterGWS in '..\Source\SynHighlighterGWS.pas', - SynHighlighterHashEntries in '..\Source\SynHighlighterHashEntries.pas', - SynHighlighterHaskell in '..\Source\SynHighlighterHaskell.pas', - SynHighlighterHC11 in '..\Source\SynHighlighterHC11.pas', - SynHighlighterHP48 in '..\Source\SynHighlighterHP48.pas', - SynHighlighterHtml in '..\Source\SynHighlighterHtml.pas', - SynHighlighterIDL in '..\Source\SynHighlighterIDL.pas', - SynHighlighterIni in '..\Source\SynHighlighterIni.pas', - SynHighlighterInno in '..\Source\SynHighlighterInno.pas', - SynHighlighterJava in '..\Source\SynHighlighterJava.pas', - SynHighlighterJScript in '..\Source\SynHighlighterJScript.pas', - SynHighlighterKix in '..\Source\SynHighlighterKix.pas', - SynHighlighterM3 in '..\Source\SynHighlighterM3.pas', - SynHighlighterModelica in '..\Source\SynHighlighterModelica.pas', - SynHighlighterMsg in '..\Source\SynHighlighterMsg.pas', - SynHighlighterMulti in '..\Source\SynHighlighterMulti.pas', - SynHighlighterPas in '..\Source\SynHighlighterPas.pas', - SynHighlighterPerl in '..\Source\SynHighlighterPerl.pas', - SynHighlighterPHP in '..\Source\SynHighlighterPHP.pas', - SynHighlighterProgress in '..\Source\SynHighlighterProgress.pas', - SynHighlighterPython in '..\Source\SynHighlighterPython.pas', - SynHighlighterRC in '..\Source\SynHighlighterRC.pas', - SynHighlighterRuby in '..\Source\SynHighlighterRuby.pas', - SynHighlighterSDD in '..\Source\SynHighlighterSDD.pas', - SynHighlighterSml in '..\Source\SynHighlighterSml.pas', - SynHighlighterSQL in '..\Source\SynHighlighterSQL.pas', - SynHighlighterST in '..\Source\SynHighlighterST.pas', - SynHighlighterTclTk in '..\Source\SynHighlighterTclTk.pas', - SynHighlighterTeX in '..\Source\SynHighlighterTeX.pas', - SynHighlighterUNIXShellScript in '..\Source\SynHighlighterUNIXShellScript.pas', - SynHighlighterUnreal in '..\Source\SynHighlighterUnreal.pas', - SynHighlighterVB in '..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\Source\SynHighlighterVBScript.pas', - SynHighlighterXML in '..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\Source\SynMacroRecorder.pas', - SynMemo in '..\Source\SynMemo.pas', - SynRegExpr in '..\Source\SynRegExpr.pas', - SynHighlighterCss in '..\Source\SynHighlighterCss.pas', - SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', - SynHighlighterURI in '..\Source\SynHighlighterURI.pas', - SynURIOpener in '..\Source\SynURIOpener.pas', - SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\Source\SynHighlighterDWS.pas', - SynHighlighterYAML in '..\Source\SynHighlighterYAML.pas', - SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', - SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', - SynUnicode in '..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, - SynUsp10 in '..\Source\SynUsp10.pas' {$ENDIF}, - SynEditHighlighterOptions in '..\Source\SynEditHighlighterOptions.pas', - SynEditCodeFolding in '..\Source\SynEditCodeFolding.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE7.dproj b/Ext/SynEdit/Packaged/SynEdit_RXE7.dproj deleted file mode 100644 index 71d7e32..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_RXE7.dproj +++ /dev/null @@ -1,287 +0,0 @@ - - - {AC917C2B-5870-48AD-981D-668AD3E4A533} - SynEdit_RXE7.dpk - True - Debug - 3 - Package - VCL - 16.0 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_RXE7 - .\$(Platform)\$(Config) - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 00400000 - true - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - SynEdit component suite runtime - true - false - false - true - false - 1031 - false - false - - - Debug - package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=preferExternal;largeHeap=False;theme=TitleBar - - - SynEdit_RXE_Icon.ico - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - true - 1033 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_RXE_Icon.ico - 1033 - true - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$IFNDEF CPUX64
-
- -
$ENDIF
-
- - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEdit_RXE7.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver - Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server - - - - False - False - False - True - True - - False - - - 12 - - - - -
diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE7.res b/Ext/SynEdit/Packaged/SynEdit_RXE7.res deleted file mode 100644 index f896e26c2967387825b0377575653b7b0037a650..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqu^e+khRr>${ diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE8.dpk b/Ext/SynEdit/Packaged/SynEdit_RXE8.dpk deleted file mode 100644 index 2501ce9..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_RXE8.dpk +++ /dev/null @@ -1,142 +0,0 @@ -package SynEdit_RXE8; - -{$R *.res} -{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} -{$ALIGN 8} -{$ASSERTIONS ON} -{$BOOLEVAL OFF} -{$DEBUGINFO OFF} -{$EXTENDEDSYNTAX ON} -{$IMPORTEDDATA ON} -{$IOCHECKS ON} -{$LOCALSYMBOLS OFF} -{$LONGSTRINGS ON} -{$OPENSTRINGS ON} -{$OPTIMIZATION ON} -{$OVERFLOWCHECKS OFF} -{$RANGECHECKS OFF} -{$REFERENCEINFO OFF} -{$SAFEDIVIDE OFF} -{$STACKFRAMES OFF} -{$TYPEDADDRESS OFF} -{$VARSTRINGCHECKS ON} -{$WRITEABLECONST ON} -{$MINENUMSIZE 1} -{$IMAGEBASE $400000} -{$DEFINE RELEASE} -{$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite runtime'} -{$RUNONLY} -{$IMPLICITBUILD OFF} - -requires - vcl, - vcldb, - vclx, - rtl; - -contains - SynTextDrawer in '..\Source\SynTextDrawer.pas', - SynAutoCorrect in '..\Source\SynAutoCorrect.pas', - SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, - SynCompletionProposal in '..\Source\SynCompletionProposal.pas', - SynDBEdit in '..\Source\SynDBEdit.pas', - SynEdit in '..\Source\SynEdit.pas', - SynEditAutoComplete in '..\Source\SynEditAutoComplete.pas', - SynEditExport in '..\Source\SynEditExport.pas', - SynEditHighlighter in '..\Source\SynEditHighlighter.pas', - SynEditKbdHandler in '..\Source\SynEditKbdHandler.pas', - SynEditKeyCmdEditor in '..\Source\SynEditKeyCmdEditor.pas' {SynEditKeystrokeEditorForm}, - SynEditKeyCmds in '..\Source\SynEditKeyCmds.pas', - SynEditKeyCmdsEditor in '..\Source\SynEditKeyCmdsEditor.pas' {SynEditKeystrokesEditorForm}, - SynEditKeyConst in '..\Source\SynEditKeyConst.pas', - SynEditMiscClasses in '..\Source\SynEditMiscClasses.pas', - SynEditMiscProcs in '..\Source\SynEditMiscProcs.pas', - SynEditOptionsDialog in '..\Source\SynEditOptionsDialog.pas' {fmEditorOptionsDialog}, - SynEditPlugins in '..\Source\SynEditPlugins.pas', - SynEditWordWrap in '..\Source\SynEditWordWrap.pas', - SynEditPrint in '..\Source\SynEditPrint.pas', - SynEditPrinterInfo in '..\Source\SynEditPrinterInfo.pas', - SynEditPrintHeaderFooter in '..\Source\SynEditPrintHeaderFooter.pas', - SynEditPrintMargins in '..\Source\SynEditPrintMargins.pas', - SynEditPrintMarginsDialog in '..\Source\SynEditPrintMarginsDialog.pas' {SynEditPrintMarginsDlg}, - SynEditPrintPreview in '..\Source\SynEditPrintPreview.pas', - SynEditPrintTypes in '..\Source\SynEditPrintTypes.pas', - SynEditPythonBehaviour in '..\Source\SynEditPythonBehaviour.pas', - SynEditRegexSearch in '..\Source\SynEditRegexSearch.pas', - SynEditSearch in '..\Source\SynEditSearch.pas', - SynEditStrConst in '..\Source\SynEditStrConst.pas', - SynEditTextBuffer in '..\Source\SynEditTextBuffer.pas', - SynEditTypes in '..\Source\SynEditTypes.pas', - SynExportHTML in '..\Source\SynExportHTML.pas', - SynExportRTF in '..\Source\SynExportRTF.pas', - SynExportTeX in '..\Source\SynExportTeX.pas', - SynHighlighterADSP21xx in '..\Source\SynHighlighterADSP21xx.pas', - SynHighlighterAsm in '..\Source\SynHighlighterAsm.pas', - SynHighlighterAWK in '..\Source\SynHighlighterAWK.pas', - SynHighlighterBaan in '..\Source\SynHighlighterBaan.pas', - SynHighlighterBat in '..\Source\SynHighlighterBat.pas', - SynHighlighterCAC in '..\Source\SynHighlighterCAC.pas', - SynHighlighterCache in '..\Source\SynHighlighterCache.pas', - SynHighlighterCobol in '..\Source\SynHighlighterCobol.pas', - SynHighlighterCPM in '..\Source\SynHighlighterCPM.pas', - SynHighlighterCpp in '..\Source\SynHighlighterCpp.pas', - SynHighlighterCS in '..\Source\SynHighlighterCS.pas', - SynHighlighterDfm in '..\Source\SynHighlighterDfm.pas', - SynHighlighterDml in '..\Source\SynHighlighterDml.pas', - SynHighlighterFortran in '..\Source\SynHighlighterFortran.pas', - SynHighlighterFoxpro in '..\Source\SynHighlighterFoxpro.pas', - SynHighlighterGalaxy in '..\Source\SynHighlighterGalaxy.pas', - SynHighlighterGeneral in '..\Source\SynHighlighterGeneral.pas', - SynHighlighterGWS in '..\Source\SynHighlighterGWS.pas', - SynHighlighterHashEntries in '..\Source\SynHighlighterHashEntries.pas', - SynHighlighterHaskell in '..\Source\SynHighlighterHaskell.pas', - SynHighlighterHC11 in '..\Source\SynHighlighterHC11.pas', - SynHighlighterHP48 in '..\Source\SynHighlighterHP48.pas', - SynHighlighterHtml in '..\Source\SynHighlighterHtml.pas', - SynHighlighterIDL in '..\Source\SynHighlighterIDL.pas', - SynHighlighterIni in '..\Source\SynHighlighterIni.pas', - SynHighlighterInno in '..\Source\SynHighlighterInno.pas', - SynHighlighterJava in '..\Source\SynHighlighterJava.pas', - SynHighlighterJScript in '..\Source\SynHighlighterJScript.pas', - SynHighlighterKix in '..\Source\SynHighlighterKix.pas', - SynHighlighterM3 in '..\Source\SynHighlighterM3.pas', - SynHighlighterModelica in '..\Source\SynHighlighterModelica.pas', - SynHighlighterMsg in '..\Source\SynHighlighterMsg.pas', - SynHighlighterMulti in '..\Source\SynHighlighterMulti.pas', - SynHighlighterPas in '..\Source\SynHighlighterPas.pas', - SynHighlighterPerl in '..\Source\SynHighlighterPerl.pas', - SynHighlighterPHP in '..\Source\SynHighlighterPHP.pas', - SynHighlighterProgress in '..\Source\SynHighlighterProgress.pas', - SynHighlighterPython in '..\Source\SynHighlighterPython.pas', - SynHighlighterRC in '..\Source\SynHighlighterRC.pas', - SynHighlighterRuby in '..\Source\SynHighlighterRuby.pas', - SynHighlighterSDD in '..\Source\SynHighlighterSDD.pas', - SynHighlighterSml in '..\Source\SynHighlighterSml.pas', - SynHighlighterSQL in '..\Source\SynHighlighterSQL.pas', - SynHighlighterST in '..\Source\SynHighlighterST.pas', - SynHighlighterTclTk in '..\Source\SynHighlighterTclTk.pas', - SynHighlighterTeX in '..\Source\SynHighlighterTeX.pas', - SynHighlighterUNIXShellScript in '..\Source\SynHighlighterUNIXShellScript.pas', - SynHighlighterUnreal in '..\Source\SynHighlighterUnreal.pas', - SynHighlighterVB in '..\Source\SynHighlighterVB.pas', - SynHighlighterVBScript in '..\Source\SynHighlighterVBScript.pas', - SynHighlighterXML in '..\Source\SynHighlighterXML.pas', - SynMacroRecorder in '..\Source\SynMacroRecorder.pas', - SynMemo in '..\Source\SynMemo.pas', - SynRegExpr in '..\Source\SynRegExpr.pas', - SynHighlighterCss in '..\Source\SynHighlighterCss.pas', - SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', - SynHighlighterURI in '..\Source\SynHighlighterURI.pas', - SynURIOpener in '..\Source\SynURIOpener.pas', - SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\Source\SynHighlighterDWS.pas', - SynHighlighterYAML in '..\Source\SynHighlighterYAML.pas', - SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', - SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', - SynUnicode in '..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, - SynUsp10 in '..\Source\SynUsp10.pas' {$ENDIF}, - SynEditHighlighterOptions in '..\Source\SynEditHighlighterOptions.pas', - SynEditCodeFolding in '..\Source\SynEditCodeFolding.pas'; - -end. diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE8.dproj b/Ext/SynEdit/Packaged/SynEdit_RXE8.dproj deleted file mode 100644 index 443c912..0000000 --- a/Ext/SynEdit/Packaged/SynEdit_RXE8.dproj +++ /dev/null @@ -1,620 +0,0 @@ - - - {AC917C2B-5870-48AD-981D-668AD3E4A533} - SynEdit_RXE8.dpk - True - Debug - 3 - Package - VCL - 17.2 - Win32 - - - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Base - true - - - true - Cfg_2 - true - true - - - SynEdit_RXE8 - .\$(Platform)\$(Config) - true - true - CompanyName=;FileDescription=;FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProductName=;ProductVersion=1.0.0.0;Comments= - 00400000 - true - Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;System;Xml;Data;Datasnap;Web;Soap;Winapi;System.Win;Bde;$(DCC_Namespace) - SynEdit component suite runtime - true - false - false - true - false - 1031 - false - false - - - android-support-v4.dex.jar;apk-expansion.dex.jar;cloud-messaging.dex.jar;fmx.dex.jar;google-analytics-v2.dex.jar;google-play-billing.dex.jar;google-play-licensing.dex.jar;google-play-services.dex.jar - Debug - package=com.embarcadero.$(MSBuildProjectName);label=$(MSBuildProjectName);versionCode=1;versionName=1.0.0;persistent=False;restoreAnyVersion=False;installLocation=preferExternal;largeHeap=False;theme=TitleBar - - - SynEdit_RXE_Icon.ico - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - true - 1033 - - - Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - SynEdit_RXE_Icon.ico - 1033 - true - - - false - 0 - 0 - RELEASE;$(DCC_Define) - - - DEBUG;$(DCC_Define) - false - true - - - true - 1033 - - - - MainSource - - - - - - - - -
frmAutoCorrectEditor
-
- - - - - - - - -
SynEditKeystrokeEditorForm
-
- - -
SynEditKeystrokesEditorForm
-
- - - - -
fmEditorOptionsDialog
-
- - - - - - - -
SynEditPrintMarginsDlg
-
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
$IFNDEF CPUX64
-
- -
$ENDIF
-
- - - - Cfg_2 - Base - - - Base - - - Cfg_1 - Base - -
- - Delphi.Personality.12 - Package - - - - SynEdit_RXE8.dpk - - - True - False - 1 - 0 - 0 - 0 - False - False - False - False - False - 1031 - 1252 - - - - - 1.0.0.0 - - - - - - 1.0.0.0 - - - - Microsoft Office 2000 Beispiele für gekapselte Komponenten für Automatisierungsserver - Microsoft Office XP Beispiele für gekapselte Komponenten für Automation Server - - - - False - False - True - True - - False - - - - SynEdit_RXE8.bpl - true - - - - - 1 - .dylib - - - 0 - .bpl - - - 1 - .dylib - - - 1 - .dylib - - - 1 - .dylib - - - - - 1 - .dylib - - - 0 - .dll;.bpl - - - - - 1 - - - 1 - - - 1 - - - - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - ..\$(PROJECTNAME).app.dSYM\Contents\Resources\DWARF - 1 - - - - - res\drawable-normal - 1 - - - - - library\lib\x86 - 1 - - - - - 1 - - - 1 - - - 1 - - - - - - library\lib\armeabi-v7a - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-xlarge - 1 - - - - - res\drawable-xhdpi - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-xxhdpi - 1 - - - - - library\lib\mips - 1 - - - - - res\drawable - 1 - - - - - 1 - - - 1 - - - 0 - - - - - 1 - .framework - - - 0 - - - - - res\drawable-small - 1 - - - - - - 1 - - - Contents\MacOS - 0 - - - - - classes - 1 - - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable - 1 - - - - - Contents\Resources - 1 - - - - - - 1 - - - 1 - - - 1 - - - - - library\lib\armeabi-v7a - 1 - - - 1 - - - 0 - - - 1 - - - 1 - - - 1 - - - - - library\lib\armeabi - 1 - - - - - res\drawable-large - 1 - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-ldpi - 1 - - - - - res\values - 1 - - - - - 1 - - - 1 - - - 1 - - - - - res\drawable-mdpi - 1 - - - - - res\drawable-hdpi - 1 - - - - - 1 - - - - - - - - - - - - 12 - - - - -
diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE8.res b/Ext/SynEdit/Packaged/SynEdit_RXE8.res deleted file mode 100644 index f896e26c2967387825b0377575653b7b0037a650..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4812 zcmbW5%WEZ75XLJepyNWbaDTIKAz4U-Yy_brz6kgtlRMic_+mgNFrz!6^Pk*V3?ltM zNM|isW+`MA?wzFzvHgBkr@A{gH!-oHZkh%sVko~!(q;pA$#g$ z_w5IJY!B^`eJ5`Z?R)!1o*&t_cC7iI+-Api#p+$jt~kJG$6k@Yw11#AkL`(8A8RGg zJNCA0QcP>G|58@R_O<^9trh{m>0` z9~-}Hnr+EX->(n(-P|1W`}pZs|KeGU2F9(WL=?~!uQ$`%gJ zqilu5K;kPBOT5a?~ zxt+9pOmT-3ZMb?4gypp;ZlUR4*H-Se4jj(#fGvNqrzQU6P>u1E zbCX}pkC<_(|XrqWTjz&U4%W5x>_4IOL-)d$hnt`EQ7| za8Nt(L$8kC^DkeHS+lnxrudo5JI8aRxu|<-VQ2i*e(aCdf-eCxg?ZYXze~9<`w(@< z{RPMHg+Jo={a2fKJx{g#%Z_>X*#(x*Yi-_*%;kBY?fqsoe$+H^m%YQk;!k|{UGM`t z=G&&!ulz>-#Z6<0h2|Xror2Hh9QYnA%Kb(R1wZnyzV_CPGn%=Hvo`Dx+$z~=t?!St z*JEAIq&Vb%J8PEly|25@|2q<6Hr{_;f9jJH1b*CK_#!T1cW#QE9A>O}FT^|4n1_}4 zs)e}Mh+pvt2mcXc)DQ9T4#YY4arL>UhT0S_Y{2IZN3VO~X6=II_f5gg8U&jsxvauxj9T=3S7W|2@0WB%+!1@8UCtTU1BWKs zEW7k?ji9XY}GZJy+CQ$1Ya1>b?kSviw%xEprzOAcs{?G|}(yRPIyakDq+C;i@4 z=Xx~xxRJ}*na^XF>+XtooqhVdt-j9B@_2u0)@$%@$zPHelIN1sA}7+wU7r(uc0f+e z){*CCFU$Aq!k7uG5@z3@uJ>;k-(2XtW}n&n{_SVqKJYI=8un*r@?C?k8Ty{FwdG$m t_zJRSFUjgXN#DP!FEO9W%b|ZiI*`Xh^$zS4ecd_K7p8co-=Wqu^e+khRr>${ diff --git a/Ext/SynEdit/Packaged/SynEdit_RXE_Icon.ico b/Ext/SynEdit/Packaged/SynEdit_RXE_Icon.ico deleted file mode 100644 index 379ec80d91cd5bef25a44bb21ae1c40a278cd772..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4286 zcmbW5J#OSi5QW>=U_(1{ItmS4g1!V}9;N3d++blCyaXpU6e=_@dxQ-)FhIZWRTs$_ zQLQs45wEHCWfF(Ina})Ode)6gDYWM$ z`da(ilNf!AOPu5~4YkC0g5>}zsRTQQFwaIk6Ia_!s-hw;D* z4$F-GYV1Yp_u8l7(Q8Bdv$RV$`r$CjE8hJ>d<<-IyyjW$2WzC1C;Lz8$&(dnV^yHs*_M0!evCMzyCP#I}Mi1k$e+_$(mafVo z?u4#EZTzU*p0uu0o@MMw(cCoiE^B0p-_xJteel6RbLgJRqBYqMe8sLZ;a>i}cs=^3 zI=N52OVvKGW&k@m;2Z7@wm8t&T;ijZ*m(1pn|5MqtRF(R*UT{n2m0*4u}5K_;3+@I zpLj3ym%7&uzKprbo=2STfBg|0=HTEnTNOuE2Jls5Ps@r)AFjq9wT88Wd>2N3tY7i0 zcZ7r5v#>F}pSfSI+OPS!BnLQw8Q8>a_*zHZgGn7kn;bWuC;3kA4Z#78V0ix%cWxY1 zpUgR@%TnOrw$2CRzVtLP-{@f$) z6M5EJaM0zw7eDS?pHty74mL5|KEUUF=erX>8C=3tf8xe@jyoXqyEecfA4A)tku}PH zMQh`rcH)OW*6;i)mN5tRHmpcLb9v`DN1BVemlt;Gr}kri^e*@^Fw>Z)&H1~@ecOkq zJMJ$yMl9l?-}|pNdYz|1@wJY5$D9Mp^LjV$M&|N7(00Eb<3~-SyX_tEr9bfv3pjQXKNPop-Pc{`-;TsMZTFw+PknNN!H@fkSm;8#xk)=YOs#n@#5dHIheLeT zLfmWUmmc8|KQu=DppS1L&bi0c=bl|e(Lk8{c67h zwDYcUO^BoGUbtDiVEMjjxLJc>^CXuee8#9n=eyhToq50U9lAq%o?Xrv*eiz`ZE~@H znCD!*#bK@a6BuyW`&(>syxp_3Hx6LkKa62VXCXPUN38KZ(K<9Dy&s2=h=GJV#& zW84!^pK&blUiH`bEul8hNZz;;>BG^rr1AZ?ocF)w-~f6ZS~*Z-)Y^MYYmKRzUbA73t|EE@br_Cxkv_Dyzac9zFJ`keLO4%nrXPuRCo TJ}dUm!Z-=56Xvp9J}v(Ob;cBC diff --git a/Ext/SynEdit/Packaged/Delphi12.groupproj b/Ext/SynEdit/Packages/Delphi12.groupproj similarity index 100% rename from Ext/SynEdit/Packaged/Delphi12.groupproj rename to Ext/SynEdit/Packages/Delphi12.groupproj diff --git a/Ext/SynEdit/Packaged/SynEdit_D2010.dpk b/Ext/SynEdit/Packages/SynEdit_D12.dpk similarity index 74% rename from Ext/SynEdit/Packaged/SynEdit_D2010.dpk rename to Ext/SynEdit/Packages/SynEdit_D12.dpk index b26cab5..4755fd5 100644 --- a/Ext/SynEdit/Packaged/SynEdit_D2010.dpk +++ b/Ext/SynEdit/Packages/SynEdit_D12.dpk @@ -1,21 +1,22 @@ -package SynEdit_D2010; +package SynEdit_D12; {$R *.res} {$R '..\Source\SynEditReg.dcr'} +{$IFDEF IMPLICITBUILDING This IFDEF should not be used by users} {$ALIGN 8} {$ASSERTIONS ON} {$BOOLEVAL OFF} -{$DEBUGINFO ON} +{$DEBUGINFO OFF} {$EXTENDEDSYNTAX ON} {$IMPORTEDDATA ON} {$IOCHECKS ON} -{$LOCALSYMBOLS ON} +{$LOCALSYMBOLS OFF} {$LONGSTRINGS ON} {$OPENSTRINGS ON} {$OPTIMIZATION ON} {$OVERFLOWCHECKS OFF} {$RANGECHECKS OFF} -{$REFERENCEINFO ON} +{$REFERENCEINFO OFF} {$SAFEDIVIDE OFF} {$STACKFRAMES OFF} {$TYPEDADDRESS OFF} @@ -23,13 +24,15 @@ package SynEdit_D2010; {$WRITEABLECONST ON} {$MINENUMSIZE 1} {$IMAGEBASE $400000} +{$DEFINE RELEASE} +{$ENDIF IMPLICITBUILDING} {$DESCRIPTION 'SynEdit component suite'} {$DESIGNONLY} -{$IMPLICITBUILD ON} +{$IMPLICITBUILD OFF} requires designide, - SynEdit_R2010; + SynEdit_R12; contains SynEditReg in '..\Source\SynEditReg.pas', diff --git a/Ext/SynEdit/Packaged/SynEdit_D12.dproj b/Ext/SynEdit/Packages/SynEdit_D12.dproj similarity index 89% rename from Ext/SynEdit/Packaged/SynEdit_D12.dproj rename to Ext/SynEdit/Packages/SynEdit_D12.dproj index 9d3d42d..5fc2da3 100644 --- a/Ext/SynEdit/Packaged/SynEdit_D12.dproj +++ b/Ext/SynEdit/Packages/SynEdit_D12.dproj @@ -7,7 +7,7 @@ 1 Package VCL - 20.1 + 20.2 Win32 SynEdit_D12
@@ -65,7 +65,6 @@
SynEdit_RXE6;SynEdit_RXE7;SynEdit_R10;SynEdit_R12_0;SynEdit_R12;$(DCC_UsePackage) - SynEdit_DXE_Icon.ico System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;Bde;$(DCC_Namespace) true 1033 @@ -73,9 +72,6 @@ System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) Debug - true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - 1033 System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) @@ -108,15 +104,7 @@ - - - - - - - - Base diff --git a/Ext/SynEdit/Packaged/SynEdit_R12.dpk b/Ext/SynEdit/Packages/SynEdit_R12.dpk similarity index 87% rename from Ext/SynEdit/Packaged/SynEdit_R12.dpk rename to Ext/SynEdit/Packages/SynEdit_R12.dpk index 5df9d18..c6d444c 100644 --- a/Ext/SynEdit/Packaged/SynEdit_R12.dpk +++ b/Ext/SynEdit/Packages/SynEdit_R12.dpk @@ -25,7 +25,7 @@ package SynEdit_R12; {$IMAGEBASE $400000} {$DEFINE RELEASE} {$ENDIF IMPLICITBUILDING} -{$DESCRIPTION 'SynEdit component suite runtime'} +{$DESCRIPTION 'TurboPack SynEdit Delphi runtime package'} {$RUNONLY} {$IMPLICITBUILD OFF} @@ -36,13 +36,17 @@ requires rtl; contains - SynTextDrawer in '..\Source\SynTextDrawer.pas', + SynAccessibility in '..\Source\SynAccessibility.pas', SynAutoCorrect in '..\Source\SynAutoCorrect.pas', SynAutoCorrectEditor in '..\Source\SynAutoCorrectEditor.pas' {frmAutoCorrectEditor}, + SynOmniSetupDialog in '..\Source\SynOmniSetupDialog.pas' {SynOmniSynSetup}, SynCompletionProposal in '..\Source\SynCompletionProposal.pas', SynDBEdit in '..\Source\SynDBEdit.pas', + SynDWrite in '..\Source\SynDWrite.pas', SynEdit in '..\Source\SynEdit.pas', - SynEditAutoComplete in '..\Source\SynEditAutoComplete.pas', + SynEditCodeFolding in '..\Source\SynEditCodeFolding.pas', + SynEditDataObject in '..\Source\SynEditDataObject.pas', + SynEditDragDrop in '..\Source\SynEditDragDrop.pas', SynEditExport in '..\Source\SynEditExport.pas', SynEditHighlighter in '..\Source\SynEditHighlighter.pas', SynEditKbdHandler in '..\Source\SynEditKbdHandler.pas', @@ -54,7 +58,6 @@ contains SynEditMiscProcs in '..\Source\SynEditMiscProcs.pas', SynEditOptionsDialog in '..\Source\SynEditOptionsDialog.pas' {fmEditorOptionsDialog}, SynEditPlugins in '..\Source\SynEditPlugins.pas', - SynEditWordWrap in '..\Source\SynEditWordWrap.pas', SynEditPrint in '..\Source\SynEditPrint.pas', SynEditPrinterInfo in '..\Source\SynEditPrinterInfo.pas', SynEditPrintHeaderFooter in '..\Source\SynEditPrintHeaderFooter.pas', @@ -64,10 +67,13 @@ contains SynEditPrintTypes in '..\Source\SynEditPrintTypes.pas', SynEditPythonBehaviour in '..\Source\SynEditPythonBehaviour.pas', SynEditRegexSearch in '..\Source\SynEditRegexSearch.pas', + SynEditScrollBars in '..\Source\SynEditScrollBars.pas', SynEditSearch in '..\Source\SynEditSearch.pas', SynEditStrConst in '..\Source\SynEditStrConst.pas', SynEditTextBuffer in '..\Source\SynEditTextBuffer.pas', SynEditTypes in '..\Source\SynEditTypes.pas', + SynEditUndo in '..\Source\SynEditUndo.pas', + SynEditWordWrap in '..\Source\SynEditWordWrap.pas', SynExportHTML in '..\Source\SynExportHTML.pas', SynExportRTF in '..\Source\SynExportRTF.pas', SynExportTeX in '..\Source\SynExportTeX.pas', @@ -82,14 +88,17 @@ contains SynHighlighterCPM in '..\Source\SynHighlighterCPM.pas', SynHighlighterCpp in '..\Source\SynHighlighterCpp.pas', SynHighlighterCS in '..\Source\SynHighlighterCS.pas', + SynHighlighterCss in '..\Source\SynHighlighterCss.pas', SynHighlighterDfm in '..\Source\SynHighlighterDfm.pas', SynHighlighterDml in '..\Source\SynHighlighterDml.pas', + SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', + SynHighlighterDWS in '..\Source\SynHighlighterDWS.pas', + SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', SynHighlighterFortran in '..\Source\SynHighlighterFortran.pas', SynHighlighterFoxpro in '..\Source\SynHighlighterFoxpro.pas', SynHighlighterGalaxy in '..\Source\SynHighlighterGalaxy.pas', SynHighlighterGeneral in '..\Source\SynHighlighterGeneral.pas', SynHighlighterGWS in '..\Source\SynHighlighterGWS.pas', - SynHighlighterHashEntries in '..\Source\SynHighlighterHashEntries.pas', SynHighlighterHaskell in '..\Source\SynHighlighterHaskell.pas', SynHighlighterHC11 in '..\Source\SynHighlighterHC11.pas', SynHighlighterHP48 in '..\Source\SynHighlighterHP48.pas', @@ -99,17 +108,22 @@ contains SynHighlighterInno in '..\Source\SynHighlighterInno.pas', SynHighlighterJava in '..\Source\SynHighlighterJava.pas', SynHighlighterJScript in '..\Source\SynHighlighterJScript.pas', + SynHighlighterJSON in '..\Source\SynHighlighterJSON.pas', SynHighlighterKix in '..\Source\SynHighlighterKix.pas', + SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', + SynHighlighterLLVM in '..\Source\SynHighlighterLLVM.pas', SynHighlighterM3 in '..\Source\SynHighlighterM3.pas', SynHighlighterModelica in '..\Source\SynHighlighterModelica.pas', SynHighlighterMsg in '..\Source\SynHighlighterMsg.pas', SynHighlighterMulti in '..\Source\SynHighlighterMulti.pas', + SynHighlighterOmni in '..\Source\SynHighlighterOmni.pas', SynHighlighterPas in '..\Source\SynHighlighterPas.pas', SynHighlighterPerl in '..\Source\SynHighlighterPerl.pas', SynHighlighterPHP in '..\Source\SynHighlighterPHP.pas', SynHighlighterProgress in '..\Source\SynHighlighterProgress.pas', SynHighlighterPython in '..\Source\SynHighlighterPython.pas', SynHighlighterRC in '..\Source\SynHighlighterRC.pas', + SynHighlighterRexx in '..\Source\SynHighlighterRexx.pas', SynHighlighterRuby in '..\Source\SynHighlighterRuby.pas', SynHighlighterSDD in '..\Source\SynHighlighterSDD.pas', SynHighlighterSml in '..\Source\SynHighlighterSml.pas', @@ -119,24 +133,17 @@ contains SynHighlighterTeX in '..\Source\SynHighlighterTeX.pas', SynHighlighterUNIXShellScript in '..\Source\SynHighlighterUNIXShellScript.pas', SynHighlighterUnreal in '..\Source\SynHighlighterUnreal.pas', + SynHighlighterURI in '..\Source\SynHighlighterURI.pas', SynHighlighterVB in '..\Source\SynHighlighterVB.pas', SynHighlighterVBScript in '..\Source\SynHighlighterVBScript.pas', + SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', + SynHighlighterWebIDL in '..\Source\SynHighlighterWebIDL.pas', SynHighlighterXML in '..\Source\SynHighlighterXML.pas', + SynHighlighterYAML in '..\Source\SynHighlighterYAML.pas', SynMacroRecorder in '..\Source\SynMacroRecorder.pas', - SynMemo in '..\Source\SynMemo.pas', - SynRegExpr in '..\Source\SynRegExpr.pas', - SynHighlighterCss in '..\Source\SynHighlighterCss.pas', - SynHighlighterLDraw in '..\Source\SynHighlighterLDraw.pas', - SynHighlighterURI in '..\Source\SynHighlighterURI.pas', + SynSpellCheck in '..\Source\SynSpellCheck.pas', + SynUnicode in '..\Source\SynUnicode.pas', SynURIOpener in '..\Source\SynURIOpener.pas', - SynHighlighterDOT in '..\Source\SynHighlighterDOT.pas', - SynHighlighterDWS in '..\Source\SynHighlighterDWS.pas', - SynHighlighterYAML in '..\Source\SynHighlighterYAML.pas', - SynHighlighterVrml97 in '..\Source\SynHighlighterVrml97.pas', - SynHighlighterEiffel in '..\Source\SynHighlighterEiffel.pas', - SynUnicode in '..\Source\SynUnicode.pas' {$IFNDEF CPUX64}, - SynUsp10 in '..\Source\SynUsp10.pas' {$ENDIF}, - SynEditHighlighterOptions in '..\Source\SynEditHighlighterOptions.pas', - SynEditCodeFolding in '..\Source\SynEditCodeFolding.pas'; + SynEditHighlighterOptions in '..\Source\SynEditHighlighterOptions.pas'; //Ethea end. diff --git a/Ext/SynEdit/Packaged/SynEdit_R12.dproj b/Ext/SynEdit/Packages/SynEdit_R12.dproj similarity index 91% rename from Ext/SynEdit/Packaged/SynEdit_R12.dproj rename to Ext/SynEdit/Packages/SynEdit_R12.dproj index 5a211f9..a497819 100644 --- a/Ext/SynEdit/Packaged/SynEdit_R12.dproj +++ b/Ext/SynEdit/Packages/SynEdit_R12.dproj @@ -7,7 +7,7 @@ 1 Package VCL - 20.1 + 20.2 Win32 SynEdit_R12 @@ -65,24 +65,15 @@ false - SynEdit_RXE_Icon.ico Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) - true - 1033 Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) Debug - true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - 1033 Data.Win;Datasnap.Win;Web.Win;Soap.Win;Xml.Win;$(DCC_Namespace) Debug - true - CompanyName=;FileDescription=$(MSBuildProjectName);FileVersion=1.0.0.0;InternalName=;LegalCopyright=;LegalTrademarks=;OriginalFilename=;ProgramID=com.embarcadero.$(MSBuildProjectName);ProductName=$(MSBuildProjectName);ProductVersion=1.0.0.0;Comments= - 1033 false @@ -107,15 +98,21 @@ - +
frmAutoCorrectEditor
+ +
SynOmniSynSetup
+
+ - + + + @@ -133,7 +130,6 @@
fmEditorOptionsDialog
- @@ -145,10 +141,13 @@ + + + @@ -163,14 +162,17 @@ + + + + - @@ -180,17 +182,22 @@ + + + + + @@ -200,29 +207,20 @@ + + + - - - - - - - - - - - + +
$IFNDEF CPUX64
- -
$ENDIF
-
+ - Base diff --git a/Ext/SynEdit/Source/Contributors.txt b/Ext/SynEdit/Source/Contributors.txt deleted file mode 100644 index aa92112..0000000 --- a/Ext/SynEdit/Source/Contributors.txt +++ /dev/null @@ -1,40 +0,0 @@ -Contributors to the SynEdit project: - - Ackbar, Andre Mens, Andy Colson, Anthony Steele, Arentjan Banck, Aaron Chan, - Bruno Mikkelsen, Colin Laplace, Daniel Parnell, David H. Muir, Dean Harmon, - Eden Kirin, Eric Grange, Erik B. Berry, Falko Jens Wagner, Flávio Etrusco, - James D. Richardson, Jan Fiala, Jeff Rafter, Johan Visser, Jordan Russell, - Jorg Jans, Jonathan Halterman, Kirys, Lasse Vagsather Karlsen, Leon Brown, - Lorant Toth, Maël Hörz, Marko Njezic, Martin Pley, Massimo Maria Ghisalberti, - Mattias Gaertner, Michael Beck, Michael Hieke, Mike Gibbard, - Morten J. Skovrup, Murad Kakabayev, Pieter Polak, Primoz Gabrijelcic, - Roman Silin, Ruggero Bandera, Satya, Stefan van As, Steve Sutherland, - Sven Blankenberg, Tony De Buys, Woo Young Bum - - -Most of the files in the SynEdit package are based on mwEdit version 0.92a. -mwEdit was started by Martin Waldenburg in 1998, but is no longer -actively maintained. - -Contributors to the mwEdit project (up to version 0.92a, in the order -of appearance): - - Martin Waldenburg - - Woo Young Bum, Angus Johnson, Michael Trier, James Jacobson, - Thomas Kurz, Primoz Gabrijelcic, Michael Beck, Andy Jeffries, - Edward Kreis, Brad Stowers, Willo van der Merwe, Cyrille de Brebisson, - Carlos Wijders, Kees van Spelde, Bernt Levinsson, Ted Berg, - Igor Shitikov, Michael Hieke, Dragan Grbic, Lucifer, Olivier Deckmyn, - Luiz C. Vaz de Brito, Hideo Koiso, Theodoros Bebekis, Albert Research, - Tony de Buys, Greg Chapman, Jeff Corbets, Heedong Lim, - Kieran McNamara, Martijn van der Kooij, Jan Jacobs, ArentJan Banck, - Alexander Reiter, xueyu, Sebastian J. Gross, Stefan van As, - Vladimir Kuznetsov, David Muir, Nick Hoddinott, Hanai Tohru, - Winfried Schöttler, Hiep Ma, Daniel Rodríguez Herrera, Nur Ismail, - Peter Adam, Wynand Breytenbach, Milan Nikolic, Robert Persson, - John T. Truchon, Igor P. Zenkov, Odilon Nelson, Martijn Tonies, - Eden Kirin, Max Horváth, riceball, Ewart Nijburg, Nils Springob, - Jeff D. Smith, Pavel Krehula, Peter Wolters - -$Id: Contributors.txt,v 1.20.2.2 2004/12/10 15:31:01 maelh Exp $ diff --git a/Ext/SynEdit/Source/DPageSetup.dfm b/Ext/SynEdit/Source/DPageSetup.dfm index 2b13e74..9039852 100644 --- a/Ext/SynEdit/Source/DPageSetup.dfm +++ b/Ext/SynEdit/Source/DPageSetup.dfm @@ -6,7 +6,11 @@ object PageSetupDlg: TPageSetupDlg ClientHeight = 419 ClientWidth = 625 Color = clBtnFace - ParentFont = True + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Tahoma' + Font.Style = [] OldCreateOrder = True Position = poScreenCenter OnCreate = FormCreate @@ -264,10 +268,6 @@ object PageSetupDlg: TPageSetupDlg object HeaderFooter: TTabSheet Caption = 'Header && Footer' ImageIndex = 1 - ExplicitLeft = 0 - ExplicitTop = 0 - ExplicitWidth = 0 - ExplicitHeight = 0 object GroupBox1: TGroupBox Left = 5 Top = 30 @@ -301,7 +301,7 @@ object PageSetupDlg: TPageSetupDlg Top = 30 Width = 191 Height = 56 - Font.Charset = DEFAULT_CHARSET + Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' @@ -310,6 +310,7 @@ object PageSetupDlg: TPageSetupDlg ScrollBars = ssBoth TabOrder = 0 WordWrap = False + Zoom = 100 OnEnter = REHeaderLeftEnter OnSelectionChange = REHeaderLeftSelectionChange end @@ -319,7 +320,7 @@ object PageSetupDlg: TPageSetupDlg Width = 191 Height = 56 Alignment = taCenter - Font.Charset = DEFAULT_CHARSET + Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' @@ -328,6 +329,7 @@ object PageSetupDlg: TPageSetupDlg ScrollBars = ssBoth TabOrder = 1 WordWrap = False + Zoom = 100 OnEnter = REHeaderLeftEnter OnSelectionChange = REHeaderLeftSelectionChange end @@ -337,7 +339,7 @@ object PageSetupDlg: TPageSetupDlg Width = 191 Height = 56 Alignment = taRightJustify - Font.Charset = DEFAULT_CHARSET + Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' @@ -346,6 +348,7 @@ object PageSetupDlg: TPageSetupDlg ScrollBars = ssBoth TabOrder = 2 WordWrap = False + Zoom = 100 OnEnter = REHeaderLeftEnter OnSelectionChange = REHeaderLeftSelectionChange end @@ -458,7 +461,7 @@ object PageSetupDlg: TPageSetupDlg Top = 30 Width = 191 Height = 56 - Font.Charset = DEFAULT_CHARSET + Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' @@ -467,6 +470,7 @@ object PageSetupDlg: TPageSetupDlg ScrollBars = ssBoth TabOrder = 0 WordWrap = False + Zoom = 100 OnEnter = REHeaderLeftEnter OnSelectionChange = REHeaderLeftSelectionChange end @@ -476,7 +480,7 @@ object PageSetupDlg: TPageSetupDlg Width = 191 Height = 56 Alignment = taCenter - Font.Charset = DEFAULT_CHARSET + Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' @@ -485,6 +489,7 @@ object PageSetupDlg: TPageSetupDlg ScrollBars = ssBoth TabOrder = 1 WordWrap = False + Zoom = 100 OnEnter = REHeaderLeftEnter OnSelectionChange = REHeaderLeftSelectionChange end @@ -494,7 +499,7 @@ object PageSetupDlg: TPageSetupDlg Width = 191 Height = 56 Alignment = taRightJustify - Font.Charset = DEFAULT_CHARSET + Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 Font.Name = 'Tahoma' @@ -503,6 +508,7 @@ object PageSetupDlg: TPageSetupDlg ScrollBars = ssBoth TabOrder = 2 WordWrap = False + Zoom = 100 OnEnter = REHeaderLeftEnter OnSelectionChange = REHeaderLeftSelectionChange end @@ -593,7 +599,7 @@ object PageSetupDlg: TPageSetupDlg AutoSize = True Caption = 'ToolBar1' EdgeBorders = [ebBottom] - Images = ImageList1 + Images = SVGIconImageList Indent = 5 TabOrder = 2 object ToolButton1: TToolButton @@ -652,6 +658,7 @@ object PageSetupDlg: TPageSetupDlg Width = 8 Caption = 'ToolButton10' ImageIndex = 8 + ImageName = 'underline' Style = tbsSeparator end object ToolButton7: TToolButton @@ -702,7 +709,7 @@ object PageSetupDlg: TPageSetupDlg Left = 269 Top = 4 Bitmap = { - 494C010109000D00080010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 + 494C010109000D00040010001000FFFFFFFFFF10FFFFFFFFFFFFFFFF424D3600 0000000000003600000028000000400000003000000001002000000000000030 0000000000000000000000000000000000000000000000000000000000000000 0000000000000000000000000000000000000000000000000000000000000000 @@ -1106,61 +1113,70 @@ object PageSetupDlg: TPageSetupDlg 000000000000} end object ActionList1: TActionList - Images = ImageList1 + Images = SVGIconImageList Left = 299 Top = 4 object PageNumCmd: TAction Caption = 'PageNumCmd' Hint = 'Page number' ImageIndex = 0 + ImageName = 'file' OnExecute = PageNumCmdExecute end object PagesCmd: TAction Caption = 'PagesCmd' Hint = 'Num. pages' ImageIndex = 1 + ImageName = 'file -new' OnExecute = PagesCmdExecute end object TimeCmd: TAction Caption = 'TimeCmd' Hint = 'Time' ImageIndex = 2 + ImageName = 'clock' OnExecute = TimeCmdExecute end object DateCmd: TAction Caption = 'DateCmd' Hint = 'Date' ImageIndex = 3 + ImageName = 'calendar' OnExecute = DateCmdExecute end object TitleCmd: TAction Caption = 'TitleCmd' Hint = 'Title' ImageIndex = 4 + ImageName = 'title' OnExecute = TitleCmdExecute end object FontCmd: TAction Caption = 'FontCmd' Hint = 'Font' ImageIndex = 5 + ImageName = 'font' OnExecute = FontCmdExecute end object BoldCmd: TAction Caption = 'BoldCmd' Hint = 'Bold' ImageIndex = 6 + ImageName = 'bold' OnExecute = BoldCmdExecute end object ItalicCmd: TAction Caption = 'ItalicCmd' Hint = 'Italic' ImageIndex = 7 + ImageName = 'italic' OnExecute = ItalicCmdExecute end object UnderlineCmd: TAction Caption = 'UnderlineCmd' Hint = 'Underline' ImageIndex = 8 + ImageName = 'underline' OnExecute = UnderlineCmdExecute end end @@ -1212,4 +1228,164 @@ object PageSetupDlg: TPageSetupDlg Left = 428 Top = 3 end + object SVGIconImageList: TSVGIconImageList + SVGIconItems = < + item + IconName = 'file' + SVGText = + ''#13#10 + + ' '#13#10'' + end + item + IconName = 'file -new' + SVGText = + ''#13#10 + + ' '#13#10'' + end + item + IconName = 'clock' + SVGText = + ''#13#10 + + ' '#13#10'' + end + item + IconName = 'calendar' + SVGText = + ''#13#10' '#13#10' '#13#10'<' + + '/svg>' + end + item + IconName = 'title' + SVGText = + ''#13#10' '#13#10'' + end + item + IconName = 'font' + SVGText = + ''#13#10 + + ' '#13#10'' + end + item + IconName = 'bold' + SVGText = + ''#13#10 + + ' '#13#10'' + end + item + IconName = 'italic' + SVGText = + ''#13#10 + + ' '#13#10'' + end + item + IconName = 'underline' + SVGText = + ''#13#10 + + ' '#13#10'<' + + '/svg>' + end> + Scaled = True + Left = 273 + Top = 78 + end end diff --git a/Ext/SynEdit/Source/FSynHighlightProp.pas b/Ext/SynEdit/Source/FSynHighlightProp.pas index ad9ed3b..1cc8255 100644 --- a/Ext/SynEdit/Source/FSynHighlightProp.pas +++ b/Ext/SynEdit/Source/FSynHighlightProp.pas @@ -2,7 +2,7 @@ { } { FSynHighlightProp } { } -{ Copyright (c) 2005-2024 Ethea S.r.l. } +{ Copyright (c) 2005-2025 Ethea S.r.l. } { ALL RIGHTS RESERVED / TUTTI I DIRITTI RISERVATI } { } {*******************************************************************} diff --git a/Ext/SynEdit/Source/FTestPrintPreview.pas b/Ext/SynEdit/Source/FTestPrintPreview.pas index e7b4c85..554b949 100644 --- a/Ext/SynEdit/Source/FTestPrintPreview.pas +++ b/Ext/SynEdit/Source/FTestPrintPreview.pas @@ -2,7 +2,7 @@ { } { Ethea SynEdit print preview } { } -{ Copyright (c) 2005-2024 Ethea S.r.l. } +{ Copyright (c) 2005-2025 Ethea S.r.l. } { ALL RIGHTS RESERVED / TUTTI I DIRITTI RISERVATI } { } {*******************************************************************} diff --git a/Ext/SynEdit/Source/SynAccessibility.pas b/Ext/SynEdit/Source/SynAccessibility.pas new file mode 100644 index 0000000..4b491e2 --- /dev/null +++ b/Ext/SynEdit/Source/SynAccessibility.pas @@ -0,0 +1,1333 @@ +unit SynAccessibility; +{------------------------------------------------------------------------------- +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. + +Alternatively, the contents of this file may be used under the terms of the +GNU General Public License Version 2 or later (the "GPL"), in which case +the provisions of the GPL are applicable instead of those above. +If you wish to allow use of your version of this file only under the terms +of the GPL and not to allow others to use your version of this file +under the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the GPL. +If you do not delete the provisions above, a recipient may use your version +of this file under either the MPL or the GPL. +interface +-------------------------------------------------------------------------------} +interface + +uses + Winapi.Windows, + Winapi.ActiveX, + System.Classes, + System.Types, + SynEdit; + +{$REGION 'Header Tranlsation of UIAutomationCore.h'} + +// Used in WM_GETOBJECT +const + UiaRootObjectId: NativeInt = -25; + +// Constants for enum ProviderOptions +type + ProviderOptions = TOleEnum; +const + ProviderOptions_ClientSideProvider = $00000001; + ProviderOptions_ServerSideProvider = $00000002; + ProviderOptions_NonClientAreaProvider = $00000004; + ProviderOptions_OverrideProvider = $00000008; + ProviderOptions_ProviderOwnsSetFocus = $00000010; + ProviderOptions_UseComThreading = $00000020; + ProviderOptions_RefuseNonClientSupport = $00000040; + ProviderOptions_HasNativeIAccessible = $00000080; + ProviderOptions_UseClientCoordinates = $00000100; + +// Constants for enum TextPatternRangeEndpoint +type + TextPatternRangeEndpoint = TOleEnum; +const + TextPatternRangeEndpoint_Start = $00000000; + TextPatternRangeEndpoint_End = $00000001; + +// Constants for enum TextUnit +type + TextUnit = TOleEnum; +const + TextUnit_Character = $00000000; + TextUnit_Format = $00000001; + TextUnit_Word = $00000002; + TextUnit_Line = $00000003; + TextUnit_Paragraph = $00000004; + TextUnit_Page = $00000005; + TextUnit_Document = $00000006; + +// Constants for enum SupportedTextSelection +type + SupportedTextSelection = TOleEnum; +const + SupportedTextSelection_None = $00000000; + SupportedTextSelection_Single = $00000001; + SupportedTextSelection_Multiple = $00000002; + +// Constants for enum TextEditChangeType +type + TextEditChangeType = TOleEnum; +const + TextEditChangeType_None = $00000000; + TextEditChangeType_AutoCorrect = $00000001; + TextEditChangeType_Composition = $00000002; + TextEditChangeType_CompositionFinalized = $00000003; + TextEditChangeType_AutoComplete = $00000004; + +// Constants for enum ScrollAmount +type + ScrollAmount = TOleEnum; +const + ScrollAmount_LargeDecrement = $00000000; + ScrollAmount_SmallDecrement = $00000001; + ScrollAmount_NoAmount = $00000002; + ScrollAmount_LargeIncrement = $00000003; + ScrollAmount_SmallIncrement = $00000004; + +// Control Type, Pattern, Property and Event ids +const + UIA_EditControlTypeId = 50004; + UIA_DocumentControlTypeId = 50030; + + UIA_ValuePatternId = 10002; + UIA_RangeValuePatternId = 10003; + UIA_ScrollPatternId = 10004; + UIA_TextPatternId = 10014; + UIA_TextPattern2Id = 10024; + + UIA_AutomationIdPropertyId = 30011; + UIA_BoundingRectanglePropertyId = 30001; + UIA_ClassNamePropertyId = 30012; + UIA_ClickablePointPropertyId = 30014; + UIA_ControlTypePropertyId = 30003; + UIA_HasKeyboardFocusPropertyId = 30008; + UIA_IsContentElementPropertyId = 30017; + UIA_IsControlElementPropertyId = 30016; + UIA_IsEnabledPropertyId = 30010; + UIA_IsKeyboardFocusablePropertyId = 30009; + UIA_IsPasswordPropertyId = 30019; + UIA_LabeledByPropertyId = 30018; + UIA_LocalizedControlTypePropertyId = 30004; + UIA_NamePropertyId = 30005; + UIA_NativeWindowHandlePropertyId = 30020; + UIA_ProviderDescriptionPropertyId = 30107; + + UIA_AutomationFocusChangedEventId = 20005; + UIA_Text_TextSelectionChangedEventId = 20014; + UIA_Text_TextChangedEventId = 20015; + +type + {$ALIGN 8} + UiaPoint = record + x: Double; + y: Double; + end; + +// *********************************************************************// +// Interface: IRawElementProviderSimple +// Flags: (256) OleAutomation +// GUID: {D6DD68D1-86FD-4332-8666-9ABEDEA2D24C} +// *********************************************************************// + IRawElementProviderSimple = interface(IUnknown) + ['{D6DD68D1-86FD-4332-8666-9ABEDEA2D24C}'] + function Get_ProviderOptions(out RetVal: ProviderOptions): HResult; stdcall; + function GetPatternProvider(patternId: SYSINT; out RetVal: IUnknown): HResult; stdcall; + function GetPropertyValue(propertyId: SYSINT; out pRetVal: OleVariant): HResult; stdcall; + function Get_HostRawElementProvider(out RetVal: IRawElementProviderSimple): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: IRangeValueProvider +// Flags: (256) OleAutomation +// GUID: {36DC7AEF-33E6-4691-AFE1-2BE7274B3D33} +// *********************************************************************// + IRangeValueProvider = interface(IUnknown) + ['{36DC7AEF-33E6-4691-AFE1-2BE7274B3D33}'] + function SetValue(val: Double): HResult; stdcall; + function Get_Value(out RetVal: Double): HResult; stdcall; + function Get_IsReadOnly(out RetVal: BOOL): HResult; stdcall; + function Get_Maximum(out RetVal: Double): HResult; stdcall; + function Get_Minimum(out RetVal: Double): HResult; stdcall; + function Get_LargeChange(out RetVal: Double): HResult; stdcall; + function Get_SmallChange(out RetVal: Double): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: IValueProvider +// Flags: (256) OleAutomation +// GUID: {C7935180-6FB3-4201-B174-7DF73ADBF64A} +// *********************************************************************// + IValueProvider = interface(IUnknown) + ['{C7935180-6FB3-4201-B174-7DF73ADBF64A}'] + function SetValue(val: PWideChar): HResult; stdcall; + function Get_Value(out RetVal: WideString): HResult; stdcall; + function Get_IsReadOnly(out RetVal: BOOL): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: ITextRangeProvider +// Flags: (256) OleAutomation +// GUID: {5347AD7B-C355-46F8-AFF5-909033582F63} +// *********************************************************************// + ITextRangeProvider = interface(IUnknown) + ['{5347AD7B-C355-46F8-AFF5-909033582F63}'] + function Clone(out RetVal: ITextRangeProvider): HResult; stdcall; + function Compare(const range: ITextRangeProvider; out RetVal: BOOL): HResult; stdcall; + function CompareEndpoints(endpoint: TextPatternRangeEndpoint; + const targetRange: ITextRangeProvider; + targetEndpoint: TextPatternRangeEndpoint; out RetVal: SYSINT): HResult; stdcall; + function ExpandToEnclosingUnit(AUnit: TextUnit): HResult; stdcall; + function FindAttribute(attributeId: SYSINT; val: OleVariant; backward: Integer; + out RetVal: ITextRangeProvider): HResult; stdcall; + function FindText(const text: WideString; backward: BOOL; ignoreCase: BOOL; + out RetVal: ITextRangeProvider): HResult; stdcall; + function GetAttributeValue(attributeId: SYSINT; out RetVal: OleVariant): HResult; stdcall; + function GetBoundingRectangles(out RetVal: PSafeArray): HResult; stdcall; + function GetEnclosingElement(out RetVal: IRawElementProviderSimple): HResult; stdcall; + function GetText(maxLength: SYSINT; out RetVal: WideString): HResult; stdcall; + function Move(AUunit: TextUnit; count: SYSINT; out RetVal: SYSINT): HResult; stdcall; + function MoveEndpointByUnit(endpoint: TextPatternRangeEndpoint; Aunit: TextUnit; count: SYSINT; + out RetVal: SYSINT): HResult; stdcall; + function MoveEndpointByRange(endpoint: TextPatternRangeEndpoint; + const targetRange: ITextRangeProvider; + targetEndpoint: TextPatternRangeEndpoint): HResult; stdcall; + function Select: HResult; stdcall; + function AddToSelection: HResult; stdcall; + function RemoveFromSelection: HResult; stdcall; + function ScrollIntoView(alignToTop: BOOL): HResult; stdcall; + function GetChildren(out RetVal: PSafeArray): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: ITextProvider +// Flags: (256) OleAutomation +// GUID: {3589C92C-63F3-4367-99BB-ADA653B77CF2} +// *********************************************************************// + ITextProvider = interface(IUnknown) + ['{3589C92C-63F3-4367-99BB-ADA653B77CF2}'] + function GetSelection(out RetVal: PSafeArray): HResult; stdcall; + function GetVisibleRanges(out RetVal: PSafeArray): HResult; stdcall; + function RangeFromChild(const childElement: IRawElementProviderSimple; + out RetVal: ITextRangeProvider): HResult; stdcall; + function RangeFromPoint(point: UiaPoint; out RetVal: ITextRangeProvider): HResult; stdcall; + function Get_DocumentRange(out RetVal: ITextRangeProvider): HResult; stdcall; + function Get_SupportedTextSelection(out RetVal: SupportedTextSelection): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: ITextProvider2 +// Flags: (256) OleAutomation +// GUID: {0DC5E6ED-3E16-4BF1-8F9A-A979878BC195} +// *********************************************************************// + ITextProvider2 = interface(ITextProvider) + ['{0DC5E6ED-3E16-4BF1-8F9A-A979878BC195}'] + function RangeFromAnnotation(const annotationElement: IRawElementProviderSimple; + out pRetVal: ITextRangeProvider): HResult; stdcall; + function GetCaretRange(out isActive: BOOL; out RetVal: ITextRangeProvider): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: ITextEditProvider +// Flags: (256) OleAutomation +// GUID: {EA3605B4-3A05-400E-B5F9-4E91B40F6176} +// *********************************************************************// + ITextEditProvider = interface(ITextProvider) + ['{EA3605B4-3A05-400E-B5F9-4E91B40F6176}'] + function GetActiveComposition(out pRetVal: ITextRangeProvider): HResult; stdcall; + function GetConversionTarget(out pRetVal: ITextRangeProvider): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: ITextRangeProvider2 +// Flags: (256) OleAutomation +// GUID: {9BBCE42C-1921-4F18-89CA-DBA1910A0386} +// *********************************************************************// + ITextRangeProvider2 = interface(ITextRangeProvider) + ['{9BBCE42C-1921-4F18-89CA-DBA1910A0386}'] + function ShowContextMenu: HResult; stdcall; + end; + +// *********************************************************************// +// Interface: IScrollProvider +// Flags: (256) OleAutomation +// GUID: {B38B8077-1FC3-42A5-8CAE-D40C2215055A} +// *********************************************************************// + IScrollProvider = interface(IUnknown) + ['{B38B8077-1FC3-42A5-8CAE-D40C2215055A}'] + function Scroll(horizontalAmount: ScrollAmount; verticalAmount: ScrollAmount): HResult; stdcall; + function SetScrollPercent(horizontalPercent: Double; verticalPercent: Double): HResult; stdcall; + function Get_HorizontalScrollPercent(out pRetVal: Double): HResult; stdcall; + function Get_VerticalScrollPercent(out pRetVal: Double): HResult; stdcall; + function Get_HorizontalViewSize(out pRetVal: Double): HResult; stdcall; + function Get_VerticalViewSize(out pRetVal: Double): HResult; stdcall; + function Get_HorizontallyScrollable(out pRetVal: Integer): HResult; stdcall; + function Get_VerticallyScrollable(out pRetVal: Integer): HResult; stdcall; + end; + +// imported functions +const + UIAutomationLib = 'UIAutomationCore.dll'; +{$WARN SYMBOL_PLATFORM OFF} +function UiaClientsAreListening(): BOOL; stdcall; external UIAutomationLib name 'UiaClientsAreListening' delayed; +function UiaGetReservedNotSupportedValue(out unkNotSupportedValue: IUnknown): HRESULT; stdcall; external UIAutomationLib name 'UiaGetReservedNotSupportedValue' delayed; +function UiaHostProviderFromHwnd(hwnd: HWND; out Provider: IRawElementProviderSimple): HRESULT; stdcall; external UIAutomationLib name 'UiaHostProviderFromHwnd' delayed; +function UiaReturnRawElementProvider(hwnd: HWND; wParam: WPARAM; lParam: LPARAM; element: IRawElementProviderSimple): LRESULT; stdcall; external UIAutomationLib name 'UiaReturnRawElementProvider' delayed; +function UiaDisconnectProvider(Provider: IRawElementProviderSimple): HRESULT; stdcall; external UIAutomationLib name 'UiaDisconnectProvider' delayed; +function UiaRaiseAutomationPropertyChangedEvent(Provider: IRawElementProviderSimple; id: SYSINT; oldValue, newValue: OleVariant): HRESULT; stdcall; external UIAutomationLib name 'UiaRaiseAutomationPropertyChangedEvent' delayed; +function UiaRaiseAutomationEvent(Provider: IRawElementProviderSimple; id: SYSINT): HRESULT; stdcall; external UIAutomationLib name 'UiaRaiseAutomationEvent' delayed; +function UiaRaiseTextEditTextChangedEvent(Provider: IRawElementProviderSimple; textEditChangeType: TextEditChangeType; ChangedData: PSafeArray): HRESULT; stdcall; external UIAutomationLib name 'UiaRaiseTextEditTextChangedEvent' delayed; +{$WARN SYMBOL_PLATFORM ON} + +{$ENDREGION 'Header Tranlsation of UIAutomationCore.h'} + +type + TSynTextRangeProvider = class(TInterfacedObject, IUnknown, ITextRangeProvider) + private + FSynEdit: TCustomSynEdit; + BB, BE: TBufferCoord; + private + function Clone(out RetVal: ITextRangeProvider): HResult; stdcall; + function Compare(const range: ITextRangeProvider; out RetVal: BOOL): HResult; stdcall; + function CompareEndpoints(endpoint: TextPatternRangeEndpoint; const + targetRange: ITextRangeProvider; targetEndpoint: TextPatternRangeEndpoint; + out RetVal: SYSINT): HResult; stdcall; + function ExpandToEnclosingUnit(AUnit: TextUnit): HResult; stdcall; + function FindAttribute(attributeId: SYSINT; val: OleVariant; backward: Integer; + out RetVal: ITextRangeProvider): HResult; stdcall; + function FindText(const text: WideString; backward: BOOL; ignoreCase: BOOL; + out RetVal: ITextRangeProvider): HResult; stdcall; + function GetAttributeValue(attributeId: SYSINT; out RetVal: OleVariant): HResult; stdcall; + function GetBoundingRectangles(out RetVal: PSafeArray): HResult; stdcall; + function GetEnclosingElement(out RetVal: IRawElementProviderSimple): HResult; stdcall; + function GetText(maxLength: SYSINT; out RetVal: WideString): HResult; stdcall; + function Move(AUnit: TextUnit; count: SYSINT; out RetVal: SYSINT): HResult; stdcall; + function MoveEndpointByUnit(endpoint: TextPatternRangeEndpoint; AUnit: + TextUnit; count: SYSINT; out RetVal: SYSINT): HResult; stdcall; + function MoveEndpointByRange(endpoint: TextPatternRangeEndpoint; + const targetRange: ITextRangeProvider; + targetEndpoint: TextPatternRangeEndpoint): HResult; stdcall; + function Select: HResult; stdcall; + function AddToSelection: HResult; stdcall; + function RemoveFromSelection: HResult; stdcall; + function ScrollIntoView(alignToTop: BOOL): HResult; stdcall; + function GetChildren(out RetVal: PSafeArray): HResult; stdcall; + public + constructor Create(ASynEdit: TCustomSynEdit; ABB, ABE: TBufferCoord); + end; + + + TSynUIAutomationProvider = class(TInterfacedObject, //IUnknown, + IRawElementProviderSimple, IValueProvider, ITextProvider, ITextProvider2) + private + FSynEdit: TCustomSynEdit; + OldBoundingRectangle: OleVariant; + function BoundingRectangle: OleVariant; + function ClickablePoint: OleVariant; + function NameProperty: OleVariant; + // IRawElementProviderSimple implementation + function Get_ProviderOptions(out RetVal: ProviderOptions): HResult; stdcall; + function GetPatternProvider(patternId: SYSINT; out RetVal: IUnknown): HResult; stdcall; + function GetPropertyValue(propertyId: SYSINT; out RetVal: OleVariant): HResult; stdcall; + function Get_HostRawElementProvider(out RetVal: IRawElementProviderSimple): HResult; stdcall; + // IValueProvider + function SetValue(val: PWideChar): HResult; stdcall; + function Get_Value(out RetVal: WideString): HResult; stdcall; + function Get_IsReadOnly(out RetVal: BOOL): HResult; stdcall; + // ITextProvider + function GetSelection(out RetVal: PSafeArray): HResult; stdcall; + function GetVisibleRanges(out RetVal: PSafeArray): HResult; stdcall; + function RangeFromChild(const childElement: IRawElementProviderSimple; + out RetVal: ITextRangeProvider): HResult; stdcall; + function RangeFromPoint(point: UiaPoint; out RetVal: ITextRangeProvider): HResult; stdcall; + function Get_DocumentRange(out RetVal: ITextRangeProvider): HResult; stdcall; + function Get_SupportedTextSelection(out RetVal: SupportedTextSelection): HResult; stdcall; + // ITextProvider2 + function RangeFromAnnotation(const annotationElement: IRawElementProviderSimple; + out pRetVal: ITextRangeProvider): HResult; stdcall; + function GetCaretRange(out isActive: BOOL; out RetVal: ITextRangeProvider): HResult; stdcall; + public + constructor Create(ASynEdit: TCustomSynEdit); + procedure NotifyBoundingRectangleChange; + procedure RaiseTextSelectionChangedEvent; + procedure EditorDestroyed; + end; + +implementation + +uses + System.SysUtils, + System.Math, + System.Variants, + Vcl.Controls, + SynEditTypes, + SynUnicode; + +resourcestring + rsLocalizedControlType = 'editor'; + +{$REGION 'TSynUIAutomationProvider'} + +constructor TSynUIAutomationProvider.Create(ASynEdit: TCustomSynEdit); +begin + inherited Create; + FSynEdit := ASynEdit; +end; + +procedure TSynUIAutomationProvider.EditorDestroyed; +begin + UiaDisconnectProvider(IRawElementProviderSimple(Self)); + FSynEdit := nil; +end; + +function TSynUIAutomationProvider.BoundingRectangle: OleVariant; +var + P: TPoint; +begin + P := FSynEdit.ClientToScreen(FSynEdit.ClientRect.TopLeft); + Result := VarArrayCreate([0, 3], varDouble); + Result[0] := P.X; + Result[1] := P.Y; + Result[2] := FSynEdit.Width; + Result[3] := FSynEdit.Height; +end; + +function TSynUIAutomationProvider.ClickablePoint: OleVariant; +var + P: TPoint; +begin + P := FSynEdit.ClientToScreen(FSynEdit.ClientRect.TopLeft); + Result := VarArrayCreate([0, 1], varDouble); + Result[0] := P.X + FSynEdit.Width div 2; + Result[1] := P.Y + FSynEdit.Height div 2; +end; + +function TSynUIAutomationProvider.NameProperty: OleVariant; +begin + if FSynEdit.AccessibleName <> '' then + Result := FSynEdit.AccessibleName + else if FSynEdit.Name <> '' then + Result := FSynEdit.Name + else + Result := FSynEdit.ClassName; +end; + +procedure TSynUIAutomationProvider.NotifyBoundingRectangleChange; +begin + if UiaClientsAreListening then + TThread.ForceQueue(nil, procedure + begin + if FSynEdit = nil then Exit; + + UiaRaiseAutomationPropertyChangedEvent(IRawElementProviderSimple(Self), + UIA_BoundingRectanglePropertyId, OldBoundingRectangle, BoundingRectangle); + end); +end; + +function TSynUIAutomationProvider.GetCaretRange(out isActive: BOOL; + out RetVal: ITextRangeProvider): HResult; +begin + IsActive := FSynEdit.Focused; + RetVal := TSynTextRangeProvider.Create(FSynEdit, FSynEdit.CaretXY, FSynEdit.CaretXY); + Result := S_OK; +end; + +function TSynUIAutomationProvider.GetPatternProvider(patternId: SYSINT; out + RetVal: IUnknown): HResult; +begin + Retval := nil; + + if not Assigned(FSynEdit) then + Exit(S_FALSE) + else + Result := S_OK; + + case patternID of + UIA_ValuePatternID: RetVal := Self as IValueProvider; + UIA_TextPatternId: RetVal := Self as ITextProvider; + UIA_TextPattern2Id: RetVal := Self as ITextProvider2; + end +end; + +function TSynUIAutomationProvider.GetPropertyValue(propertyId: SYSINT; out + RetVal: OleVariant): HResult; +begin + RetVal := Unassigned; + + if not Assigned(FSynEdit) then + Exit(S_FALSE) + else + Result := S_OK; + + case propertyId of + UIA_AutomationIdPropertyId: RetVal := FSynEdit.Name; + UIA_BoundingRectanglePropertyId: + begin + OldBoundingRectangle := BoundingRectangle; + RetVal := OldBoundingRectangle; + end; + UIA_ClickablePointPropertyId: RetVal := ClickablePoint; + UIA_ClassNamePropertyId: RetVal := FSynEdit.ClassName; + UIA_ControlTypePropertyId: RetVal := UIA_DocumentControlTypeId; + UIA_HasKeyboardFocusPropertyId: RetVal := FSynEdit.CanFocus; // Focused may return False! + UIA_IsContentElementPropertyId: RetVal := True; + UIA_IsControlElementPropertyId: RetVal := True; + UIA_IsEnabledPropertyId: RetVal := FSynEdit.Enabled; + UIA_IsKeyboardFocusablePropertyId: RetVal := FSynEdit.CanFocus; + UIA_IsPasswordPropertyId: RetVal := False; + UIA_LocalizedControlTypePropertyId: RetVal := rsLocalizedControlType; + UIA_NamePropertyId: RetVal := NameProperty; + UIA_NativeWindowHandlePropertyId: RetVal := FSynEdit.Handle; + UIA_ProviderDescriptionPropertyId: RetVal := GetLongHint(FSynEdit.Hint); + end; +end; + +function TSynUIAutomationProvider.GetSelection(out RetVal: PSafeArray): HResult; +var + TextRange: IUnknown; + Index: Integer; +begin + if FSynEdit = nil then + begin + RetVal := nil; + Exit(E_UNEXPECTED); + end; + + RetVal := SafeArrayCreateVector(VT_UNKNOWN, 0, 1); + if RetVal = nil then + Exit(E_UNEXPECTED); + + TextRange := TSynTextRangeProvider.Create(FSynEdit, FSynEdit.BlockBegin, + FSynEdit.BlockEnd) as IUnknown; + Index := 0; + Result := SafeArrayPutElement(RetVal, Index, Pointer(TextRange)^); + if Result <> S_OK then + SafeArrayDestroy(RetVal); +end; + +function TSynUIAutomationProvider.GetVisibleRanges( + out RetVal: PSafeArray): HResult; +var + TextRange: IUnknown; + Index: Integer; + DC1, DC2: TDisplayCoord; +begin + if FSynEdit = nil then + begin + RetVal := nil; + Exit(E_UNEXPECTED); + end; + + RetVal := SafeArrayCreateVector(VT_UNKNOWN, 0, 1); + if RetVal = nil then + Exit(E_UNEXPECTED); + + DC1 := DisplayCoord(1, FSynEdit.TopLine); + DC2 := DisplayCoord(1, Min(DC1.Row + FSynEdit.LinesInWindow, FSynEdit.DisplayRowCount)); + + TextRange := TSynTextRangeProvider.Create(FSynEdit, + FSynEdit.DisplayToBufferPos(DC1), + FSynEdit.DisplayToBufferPos(DC2)) as IUnknown; + + Index := 0; + Result := SafeArrayPutElement(RetVal, Index, Pointer(TextRange)^); + if Result <> S_OK then + SafeArrayDestroy(RetVal); +end; + +function TSynUIAutomationProvider.Get_DocumentRange( + out RetVal: ITextRangeProvider): HResult; +var + BC: TBufferCoord; +begin + if FSynEdit = nil then + Exit(E_UNEXPECTED); + + TThread.Synchronize(nil, procedure + begin + if (FSynEdit = nil) or (FSynEdit.Lines.Count = 0) then + BC := BufferCoord(1, 1) + else + BC := BufferCoord(FSynEdit.Lines[FSynEdit.Lines.Count -1].Length + 1, + FSynEdit.Lines.Count); + end); + + RetVal := TSynTextRangeProvider.Create(FSynEdit, BufferCoord(1, 1), BC); + Result := S_OK; +end; + +function TSynUIAutomationProvider.Get_HostRawElementProvider(out RetVal: + IRawElementProviderSimple): HResult; +begin + if Assigned(FSynEdit) and FSynEdit.HandleAllocated then + Result := UiaHostProviderFromHwnd(FSynEdit.Handle, RetVal) + else + Result := S_FALSE; +end; + +function TSynUIAutomationProvider.Get_IsReadOnly(out RetVal: BOOL): HResult; +begin + if not Assigned(FSynEdit) then + Exit(E_UNEXPECTED) + else + Result := S_OK; + + RetVal := FSynEdit.ReadOnly; +end; + +function TSynUIAutomationProvider.Get_ProviderOptions( + out RetVal: ProviderOptions): HResult; +begin + RetVal:= ProviderOptions_ServerSideProvider; + Result := S_OK; +end; + +function TSynUIAutomationProvider.Get_SupportedTextSelection( + out RetVal: SupportedTextSelection): HResult; +begin + RetVal := SupportedTextSelection_Single; + Result := S_OK; +end; + +function TSynUIAutomationProvider.Get_Value(out RetVal: WideString): HResult; +begin + if not Assigned(FSynEdit) then + Exit(S_FALSE) + else + Result := S_OK; + + RetVal := FSynEdit.Text; +end; + +procedure TSynUIAutomationProvider.RaiseTextSelectionChangedEvent; +begin + if UiaClientsAreListening then + TThread.ForceQueue(nil, procedure + begin + if Assigned(FSynEdit) then + UiaRaiseAutomationEvent(IRawElementProviderSimple(Self), + UIA_Text_TextSelectionChangedEventId); + end); +end; + +function TSynUIAutomationProvider.RangeFromAnnotation( + const annotationElement: IRawElementProviderSimple; + out pRetVal: ITextRangeProvider): HResult; +begin + pRetVal := nil; + Result := S_FALSE; +end; + +function TSynUIAutomationProvider.RangeFromChild( + const childElement: IRawElementProviderSimple; + out RetVal: ITextRangeProvider): HResult; +begin + RetVal := nil; + Result := E_INVALIDARG; +end; + +function TSynUIAutomationProvider.RangeFromPoint(point: UiaPoint; + out RetVal: ITextRangeProvider): HResult; +var + P: TPoint; + BC: TBufferCoord; +begin + if FSynEdit = nil then + begin + RetVal := nil; + Exit(E_UNEXPECTED); + end; + + TThread.Synchronize(nil, procedure + begin + if (FSynEdit = nil) or (FSynEdit.Lines.Count = 0) then + BC := BufferCoord(1, 1) + else + begin + P := TPoint.Create(Round(point.x), Round(point.y)); + P := FSynEdit.ScreenToClient(P); + BC := FSynEdit.DisplayToBufferPos(FSynEdit.PixelsToNearestRowColumn(P.X, P.Y)); + end; + end); + + RetVal := TSynTextRangeProvider.Create(FSynEdit, BC, BC); + Result := S_OK; +end; + +function TSynUIAutomationProvider.SetValue(val: PWideChar): HResult; +begin + if not Assigned(FSynEdit) or FSynEdit.ReadOnly then + Exit(S_FALSE) + else + Result := S_OK; + + TThread.Synchronize(nil, procedure + begin + if Assigned(FSynEdit) then + FSynEdit.Text := val; + end); +end; + +{$ENDREGION 'TSynUIAutomationProvider'} + +{$REGION 'TSynTextRangeProvider'} + +function TSynTextRangeProvider.AddToSelection: HResult; +begin + // Multi-selection not supported + Result := S_FALSE; +end; + +function TSynTextRangeProvider.Clone(out RetVal: ITextRangeProvider): HResult; +begin + RetVal := TSynTextRangeProvider.Create(FSynEdit, BB, BE); + Result := S_OK; +end; + +function TSynTextRangeProvider.Compare(const range: ITextRangeProvider; out + RetVal: BOOL): HResult; +var + SynRange: TSynTextRangeProvider; +begin + SynRange := range as TSynTextRangeProvider; + RetVal := Assigned(SynRange) and (SynRange.FSynEdit = FSynEdit) and + (SynRange.BB = BB) and (SynRange.BE = BE); + Result := S_OK; +end; + +function TSynTextRangeProvider.CompareEndpoints( + endpoint: TextPatternRangeEndpoint; const targetRange: ITextRangeProvider; + targetEndpoint: TextPatternRangeEndpoint; out RetVal: SYSINT): HResult; +var + BC1, BC2: TBufferCoord; +begin + if endpoint = TextPatternRangeEndpoint_Start then + BC1 := BB + else + BC1 := BE; + if targetEndpoint = TextPatternRangeEndpoint_Start then + BC2 := (targetRange as TSynTextRangeProvider).BB + else + BC2 := (targetRange as TSynTextRangeProvider).BE; + + if BC1 > BC2 then + RetVal := 1 + else if BC1 = BC2 then + RetVal := 0 + else + RetVal := -1; + + Result := S_OK; +end; + +constructor TSynTextRangeProvider.Create(ASynEdit: TCustomSynEdit; ABB, + ABE: TBufferCoord); +begin + inherited Create; + FSynEdit := ASynEdit; + BB := ABB; + BE := ABE; +end; + +function TSynTextRangeProvider.ExpandToEnclosingUnit(AUnit: TextUnit): HResult; +begin + if FSynEdit = nil then + Exit(E_UNEXPECTED); + + Result := S_OK; + + TThread.Synchronize(nil, procedure + begin + if FSynEdit = nil then Exit; + + if FSynEdit.Lines.Count = 0 then + begin + BB := BufferCoord(1, 1); + BE := BB; + Exit; + end; + + if AUnit = TextUnit_Format then + AUnit := TextUnit_Word + else if AUnit = TextUnit_Paragraph then + AUnit := TextUnit_Page; + + BB.Line := EnsureRange(BB.Line, 1, FSynEdit.Lines.Count); + BB.Char := EnsureRange(BB.Char, 1, FSynEdit.Lines[BB.Line - 1].Length + 1); + + case AUnit of + TextUnit_Character: + begin + BE := BB; + BE.Char := Min(BB.Char + 1, FSynEdit.Lines[BB.Line - 1].Length + 1); + end; + TextUnit_Word: + // Words include whitespace at the end. + // https://learn.microsoft.com/en-us/windows/win32/winauto/uiauto-uiautomationtextunits#word + begin + if BB.Char <= FSynEdit.Lines[BB.Line -1].Length then + begin + if FSynEdit.IsIdentChar(FSynEdit.Lines[BB.Line - 1][BB.Char]) then + // if BB is inside a word expand to the left + BB := FSynEdit.WordStartEx(BB) + else if (BB.Char > 1) and FSynEdit.IsWhiteChar(FSynEdit.Lines[BB.Line - 1][BB.Char])then + BB := FSynEdit.PrevWordPosEx(BB); + BE := FSynEdit.NextWordPosEx(BB); + end + else + BE := BB; + + if BB >= BE then + begin + BE := BB; + ExpandToEnclosingUnit(TextUnit_Character); + end; + end; + TextUnit_Line: + begin + BB.Char := 1; + BE.Line := BB.Line; + BE.Char := FSynEdit.Lines[BE.Line - 1].Length + 1; + end; + TextUnit_Page: + begin + BB.Char := 1; + BE.Line := BB.Line + FSynEdit.LinesInWindow; + BE.Line := EnsureRange(BE.Line, 1, FSynEdit.Lines.Count); + BE.Char := FSynEdit.Lines[BE.Line - 1].Length + 1; + end; + TextUnit_Document: + begin + BB := BufferCoord(1, 1); + BE.Line := FSynEdit.Lines.Count; + BE.Char := FSynEdit.Lines[BB.Line - 1].Length + 1; + end; + end; + end); +end; + +function TSynTextRangeProvider.FindAttribute(attributeId: SYSINT; val: + OleVariant; backward: Integer; out RetVal: ITextRangeProvider): HResult; +begin + RetVal := nil; + Result := S_OK; +end; + +function TSynTextRangeProvider.FindText(const text: WideString; backward: + BOOL; ignoreCase: BOOL; out RetVal: ITextRangeProvider): HResult; +var + TextRange: ITextRangeProvider; +begin + RetVal := nil; + if FSynEdit = nil then + Exit(E_UNEXPECTED) + else if FSynEdit.Lines.Count = 0 then + Exit(S_OK); + + Result := S_OK; + if BB = BE then + Exit; + + TThread.Synchronize(nil, procedure + var + SearchS: string; + Line: string; + I: Integer; + Index, StartIndex: Integer; + begin + if FSynEdit = nil then + begin + TextRange := nil; + Exit; + end; + + BB.Line := EnsureRange(BB.Line, 1, FSynEdit.Lines.Count); + BB.Char := EnsureRange(BB.Char, 1, FSynEdit.Lines[BB.Line -1].Length + 1); + BE.Line := EnsureRange(BE.Line, BB.Line, FSynEdit.Lines.Count); + BE.Char := EnsureRange(BE.Char, 1, FSynEdit.Lines[BB.Line -1].Length + 1); + + if IgnoreCase then + SearchS := AnsiLowerCase(text) + else + SearchS := text; + + if BackWard then + begin + for I := BE.Line downto BB.Line do + begin + Line := FSynEdit.Lines[I - 1]; + if I = BE.Line then + Line := Copy(Line, 1, BE.Char - 1); + if I = BB.Line then + StartIndex := BB.Char + else + StartIndex := 1; + + Index := Line.LastIndexOf(SearchS, Line.Length - 1, Line.Length - StartIndex + 1); + // Index is zero-based + if Index >= 0 then + begin + TextRange := TSynTextRangeProvider.Create(FSynEdit, + BufferCoord(Index + 1, I), BufferCoord(Index + SearchS.Length + 1, I)); + Exit; + end; + end; + end + else + begin + for I := BB.Line to BE.Line do + begin + Line := FSynEdit.Lines[I - 1]; + if I = BE.Line then + Line := Copy(Line, 1, BE.Char - 1); + if I = BB.Line then + StartIndex := BB.Char + else + StartIndex := 1; + + Index := Pos(SearchS, Line, StartIndex); + if Index > 0 then + begin + TextRange := TSynTextRangeProvider.Create(FSynEdit, + BufferCoord(Index, I), BufferCoord(Index + SearchS.Length, I)); + Exit; + end; + end; + end; + end); + RetVal := TextRange; +end; + +function TSynTextRangeProvider.GetAttributeValue(attributeId: SYSINT; out + RetVal: OleVariant): HResult; +var + unkNotSupportedValue: IUnknown; +begin + Result := UiaGetReservedNotSupportedValue(unkNotSupportedValue); + if Result = S_OK then + RetVal := unkNotSupportedValue; +end; + +function TSynTextRangeProvider.GetBoundingRectangles(out RetVal: PSafeArray): HResult; +var + I, Index: Integer; + R: TRect; + BC: TBufferCoord; + P: TPoint; + DVal: Double; +begin + RetVal := nil; + if FSynEdit = nil then + Exit(E_UNEXPECTED); + + Result := S_OK; + + if FSynEdit.Lines.Count = 0 then + R := Rect(FSynEdit.GutterWidth + FSynEdit.TextMargin, 0, FSynEdit.CharWidth, + FSynEdit.LineHeight) + else + begin + BB.Line := EnsureRange(BB.Line, 1, FSynEdit.Lines.Count); + BB.Char := EnsureRange(BB.Char, 1, FSynEdit.Lines[BB.Line - 1].Length + 1); + BE.Line := EnsureRange(BE.Line, BB.Line, FSynEdit.Lines.Count); + BE.Char := EnsureRange(BE.Char, 1, FSynEdit.Lines[BE.Line - 1].Length + 1); + + if (BB.Char = FSynEdit.Lines[BB.Line - 1].Length + 1) and + (BE = BufferCoord(1, BB.Line + 1)) then + begin + // Special case for the line breaks + P := FSynEdit.RowColumnToPixels(FSynEdit.BufferToDisplayPos(BB)); + R := Rect(P.X, P.Y, P.X + 0, P.Y + FSynEdit.LineHeight); + end + else + begin + R := Rect(MaxInt, 0, 0, 0); + + for I := BB.Line to BE.Line do + begin + if I = BB.Line then + BC := BB + else + BC := BufferCoord(1, I); + P := FSynEdit.RowColumnToPixels(FSynEdit.BufferToDisplayPos(BC)); + + if I = BB.Line then + R.Top := P.Y; + + R.Left := Min(P.X, R.Left); + + if I = BE.Line then + BC := BE + else + BC := BufferCoord(FSynEdit.Lines[I - 1].Length + 1, I); + P := FSynEdit.RowColumnToPixels(FSynEdit.BufferToDisplayPos(BC)); + + R.Right := Max(R.Right, P.X); + if I = BE.Line then + R.Bottom := P.Y + FSynEdit.LineHeight; + end; + end; + end; + + R.Left := Max(R.Left, FSynEdit.GutterWidth + FSynEdit.TextMargin); + R.Right := Max(R.Right, R.Left + FSynEdit.CharWidth); + R := TRect.Intersect(R, FSynEdit.ClientRect); + + R := FSynEdit.ClientToScreen(R); + + RetVal := SafeArrayCreateVector(VT_R8, 0, 4); + if RetVal = nil then + Exit(E_UNEXPECTED); + Index := 0; DVal := R.Left; SafeArrayPutElement(RetVal, Index, DVal); + Index := 1; DVal := R.Top; SafeArrayPutElement(RetVal, Index, DVal); + Index := 2; DVal := R.Width; SafeArrayPutElement(RetVal, Index, DVal); + Index := 3; DVal := R.Height; SafeArrayPutElement(RetVal, Index, DVal); +end; + +function TSynTextRangeProvider.GetChildren(out RetVal: PSafeArray): HResult; +begin + RetVal := SafeArrayCreateVector(VT_UNKNOWN, 0, 0); + if RetVal = nil then + Result := S_OK + else + Result := S_FALSE; +end; + +function TSynTextRangeProvider.GetEnclosingElement( + out RetVal: IRawElementProviderSimple): HResult; +begin + Result := S_FALSE; + if Assigned(FSynEdit) and FSynEdit.HandleAllocated then + Result := UiaHostProviderFromHwnd(FSynEdit.Handle, RetVal); +end; + +function TSynTextRangeProvider.GetText(maxLength: SYSINT; out RetVal: + WideString): HResult; +var + S: string; +begin + RetVal := ''; + if not Assigned(FSynEdit) then + Exit(S_FALSE); + + Result := S_OK; + + TThread.Synchronize(nil, procedure + var + I: Integer; + begin + if FSynEdit = nil then + begin + S := ''; + Exit; + end; + + if FSynEdit.Lines.Count = 0 then + Exit; + + BB.Line := EnsureRange(BB.Line, 1, FSynEdit.Lines.Count); + BB.Char := EnsureRange(BB.Char, 1, FSynEdit.Lines[BB.Line - 1].Length + 1); + BE.Line := EnsureRange(BE.Line, BB.Line, FSynEdit.Lines.Count); + BE.Char := EnsureRange(BE.Char, 1, FSynEdit.Lines[BE.Line - 1].Length + 1); + + if BB = BE then + begin + if BB.Char = FSynEdit.Lines[BB.Line - 1].Length + 1 then + S := WideLineFeed; // SLineBreak confused NVDA + end + else if BB.Line = BE.Line then + S := Copy(FSynEdit.Lines[BB.Line - 1], BB.Char, BE.Char - BB.Char) + else + begin + S := Copy(FSynEdit.Lines[BB.Line - 1], BB.Char); // first line + for I := BB.Line + 1 to BE.Line - 1 do + begin + S := S + SLineBreak + FSynEdit.Lines[I - 1]; + if (maxLength >= 0) and (S.Length >= maxLength) then + Break; + end; + S := S + SLineBreak + Copy(FSynEdit.Lines[BE.Line - 1], 1, BE.Char - 1); // last line + end; + end); + + if maxLength < 0 then + RetVal := S + else + RetVal := Copy(S, 1, maxLength); +end; + +function TSynTextRangeProvider.Move(AUnit: TextUnit; count: SYSINT; out RetVal: + SYSINT): HResult; +var + NMoves: SYSINT; +begin + if FSynEdit = nil then + Exit(E_UNEXPECTED); + + Result := S_OK; + RetVal := 0; + + if Count = 0 then + Exit + else if FSynEdit.Lines.Count = 0 then + begin + BB := BufferCoord(1, 1); + BE := BB; + Exit; + end; + + if AUnit = TextUnit_Format then + AUnit := TextUnit_Word + else if AUnit = TextUnit_Paragraph then + AUnit := TextUnit_Page; + + TThread.Synchronize(nil, procedure + var + I: Integer; + IsDegenerate: Boolean; + begin + IsDegenerate := BB = BE; + NMoves := 0; + if FSynEdit = nil then Exit; + + case AUnit of + TextUnit_Character: + begin + while Abs(NMoves) < Abs(Count) do + begin + if (Count < 0) and (BB.Char = 1) then + begin + if BB.Line = 1 then + Break + else + begin + Dec(BB.Line); + BB.Char := FSynEdit.Lines[BB.Line - 1].Length + 1; + Dec(NMoves); + end; + end + else if (Count > 0) and (BB.Char = FSynEdit.Lines[BB.Line - 1].Length + 1) then + begin + if BB.Line = FSynEdit.Lines.Count then + Break + else + begin + Inc(BB.Line); + BB.Char := 1; + Inc(NMoves); + end; + end + else + begin + BE := BB; + Inc(BB.Char, Count - NMoves); + BB.Char := EnsureRange(BB.Char, 1, FSynEdit.Lines[BB.Line - 1].Length + 1); + Inc(NMoves, BB.Char - BE.Char); + end; + end; + BE := BB; + if not IsDegenerate then + ExpandToEnclosingUnit(TextUnit_Character); + end; + TextUnit_Word: + begin + if Count > 0 then + begin + for I := 1 to Count do + begin + BB := BE; + BE := FSynEdit.NextWordPosEx(BE); + if BB = BE then + Break; + BB := BE; + if not IsDegenerate then + ExpandToEnclosingUnit(TextUnit_Word); + Inc(NMoves); + end; + end + else + begin + for I := 1 to -Count do + begin + BE := BB; + // move to the start of the word if BB is inside a word + BB := FSynEdit.WordStartEx(BB); + + BB := FSynEdit.PrevWordPosEx(BB); + if BB = BE then + Break; + BE := BB; + if not IsDegenerate then + ExpandToEnclosingUnit(TextUnit_Word); + Dec(NMoves) + end; + end; + end; + TextUnit_Line: + begin + BE := BB; + Inc(BB.Line, Count); + BB.Line := EnsureRange(BB.Line, 1, FSynEdit.Lines.Count); + BB.Char := 1; + NMoves := BB.Line - BE.Line; + BE := BB; + if not IsDegenerate then + BE.Char := FSynEdit.Lines[BE.Line - 1].Length + 1; + end; + TextUnit_Page: + begin + BE := BB; + Inc(BB.Line, Count * FSynEdit.LinesInWindow); + BB.Line := EnsureRange(BB.Line, 1, FSynEdit.Lines.Count); + BB.Char := 1; + NMoves := Ceil((BB.Line - BE.Line) / FSynEdit.LinesInWindow); + if IsDegenerate then + BE := BB + else + begin + BE.Line := Min(BB.Line + FSynEdit.LinesInWindow - 1, FSynEdit.Lines.Count); + BE.Char := FSynEdit.Lines[BE.Line - 1].Length + 1; + end; + end; + TextUnit_Document: + if Count > 0 then + begin + BB.Line := FSynEdit.Lines.Count; + BB.Char := FSynEdit.Lines[BB.Line - 1].Length + 1; + BE := BB; + NMoves := 1; + end + else + begin + BB.Line := 1; + BB.Char := 1; + BE := BB; + NMoves := -1; + end + end; + end); + RetVal := NMoves; +end; + +function TSynTextRangeProvider.MoveEndpointByRange( + endpoint: TextPatternRangeEndpoint; const targetRange: ITextRangeProvider; + targetEndpoint: TextPatternRangeEndpoint): HResult; +var + BC: TBufferCoord; +begin + if FSynEdit = nil then + Exit(E_UNEXPECTED); + + Result := S_OK; + + if targetEndpoint = TextPatternRangeEndpoint_Start then + BC := (targetRange as TSynTextRangeProvider).BB + else if targetEndpoint = TextPatternRangeEndpoint_End then + BC := (targetRange as TSynTextRangeProvider).BE; + + if endpoint = TextPatternRangeEndpoint_Start then + begin + BB := BC; + if BB > BE then + BE := BB; + end + else if endpoint = TextPatternRangeEndpoint_End then + begin + BE := BC; + if BB > BE then + BB := BE; + end; +end; + +function TSynTextRangeProvider.MoveEndpointByUnit(endpoint: + TextPatternRangeEndpoint; AUnit: TextUnit; count: SYSINT; out RetVal: + SYSINT): HResult; +var + BC: TBufferCoord; +begin + if FSynEdit = nil then + Exit(E_UNEXPECTED); + + Result := S_OK; + + if endpoint = TextPatternRangeEndpoint_Start then + begin + BC := BE; // store + BE := BB; + Move(AUnit, Count, RetVal); + BE := BC; // restore + + if BB > BE then + BE := BB; + end + else if endpoint = TextPatternRangeEndpoint_End then + begin + BC := BB; // store + BB := BE; + Move(AUnit, Count, RetVal); + // restore + BE := BB; + BB := BC; + + if BB > BE then + BB := BE; + end +end; + +function TSynTextRangeProvider.RemoveFromSelection: HResult; +begin + // Multi-selection not supported + Result := S_FALSE; +end; + +function TSynTextRangeProvider.ScrollIntoView(alignToTop: BOOL): HResult; +var + DC: TDisplayCoord; +begin + if Assigned(FSynEdit) and FSynEdit.HandleAllocated then + Result := S_OK + else + Exit(S_FALSE); + + TThread.Synchronize(nil, procedure + begin + if FSynEdit = nil then Exit; + + if alignToTop then + begin + DC := FSynEdit.BufferToDisplayPos(BB); + FSynEdit.TopLine := DC.Row; + end + else + begin + DC := FSynEdit.BufferToDisplayPos(BE); + FSynEdit.TopLine := DC.Row - FSynEdit.LinesInWindow + 1; + end; + end); +end; + +function TSynTextRangeProvider.Select: HResult; +begin + Result := S_FALSE; + if Assigned(FSynEdit) and FSynEdit.HandleAllocated then + begin + FSynEdit.SetCaretAndSelection(BB, BB, BE); + Result := S_OK; + end; +end; + +{$ENDREGION 'TSynTextRangeProvider'} + + +end. diff --git a/Ext/SynEdit/Source/SynAutoCorrect.pas b/Ext/SynEdit/Source/SynAutoCorrect.pas index c342fa7..33020f6 100644 --- a/Ext/SynEdit/Source/SynAutoCorrect.pas +++ b/Ext/SynEdit/Source/SynAutoCorrect.pas @@ -1,4 +1,4 @@ -{------------------------------------------------------------------------------- +{------------------------------------------------------------------------------- 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 @@ -10,7 +10,7 @@ The Original Code is: SynAutoCorrect.pas, released 2001-10-05. Author of this file is Aaron Chan. -Unicode translation by Maël Hörz. +Unicode translation by Maël Hörz. All Rights Reserved. Contributors to the SynEdit and mwEdit projects are listed in the @@ -25,12 +25,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynAutoCorrect.pas,v 1.13.2.7 2008/09/14 16:24:57 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -------------------------------------------------------------------------------} {*******************************************************} @@ -91,20 +85,14 @@ * New demo. } -{$IFNDEF QSYNAUTOCORRECT} unit SynAutoCorrect; -{$ENDIF} {$I SynEdit.inc} interface uses -{$IFDEF MSWINDOWS} //Borland translation of Qt doesn't include Char handling Windows, -{$ELSE} - Libc, -{$ENDIF} Registry, Messages, Graphics, @@ -128,7 +116,7 @@ interface TAutoCorrectAction = (aaCorrect, aaAbort); TAutoCorrectEvent = procedure(Sender: TObject; - const AOriginal, ACorrection: UnicodeString; Line, Column: Integer; + const AOriginal, ACorrection: string; Line, Column: Integer; var Action: TAutoCorrectAction) of object; TCustomSynAutoCorrect = class(TComponent) @@ -138,7 +126,7 @@ TCustomSynAutoCorrect = class(TComponent) { Published properties and events } FEditor: TCustomSynEdit; FEnabled: Boolean; - FItems: TUnicodeStrings; + FItems: TStrings; FItemSepChar: WideChar; FOptions: TAsSynAutoCorrectOptions; @@ -148,16 +136,17 @@ TCustomSynAutoCorrect = class(TComponent) { Private variables and methods } FPrevLine: Integer; - function CorrectItemStart(EditLine, SearchString: UnicodeString; StartPos: LongInt; - MatchCase, WholeWord: Boolean): LongInt; - function FindAndCorrect(var EditLine: UnicodeString; Original, Correction: UnicodeString; + function CorrectItemStart(EditLine, SearchString: string; StartPos: Integer; + MatchCase, WholeWord: Boolean): Integer; + function FindAndCorrect(var EditLine: string; Original, Correction: string; var CurrentX: Integer): Boolean; - function PreviousToken: UnicodeString; + function PreviousToken: string; { Accessor methods } - function GetItems: TUnicodeStrings; - procedure SetItems(const Value: TUnicodeStrings); + function GetItems: TStrings; + procedure SetItems(const Value: TStrings); protected + { Protected declarations } procedure DefineProperties(Filer: TFiler); override; procedure KeyboardHandler(Sender: TObject; AfterProcessing: Boolean; var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; @@ -168,13 +157,14 @@ TCustomSynAutoCorrect = class(TComponent) Operation: TOperation); override; procedure SetEditor(Value: TCustomSynEdit); public + { Public declarations } constructor Create(AOwner: TComponent); override; destructor Destroy; override; - procedure Add(AOriginal, ACorrection: UnicodeString); + procedure Add(AOriginal, ACorrection: string); function AutoCorrectAll: Boolean; procedure Delete(AIndex: Integer); - procedure Edit(AIndex: Integer; ANewOriginal, ANewCorrection: UnicodeString); + procedure Edit(AIndex: Integer; ANewOriginal, ANewCorrection: string); procedure LoadFromINI(AFileName, ASection: string); procedure SaveToINI(AFileName, ASection: string); @@ -186,11 +176,12 @@ TCustomSynAutoCorrect = class(TComponent) procedure SaveToList(AFileName: string); { Utility functions } - function HalfString(Str: UnicodeString; GetFirstHalf: Boolean): UnicodeString; + function HalfString(Str: string; GetFirstHalf: Boolean): string; public + { Published declarations } property Enabled: Boolean read FEnabled write FEnabled default True; property Editor: TCustomSynEdit read FEditor write SetEditor; - property Items: TUnicodeStrings read GetItems write SetItems; + property Items: TStrings read GetItems write SetItems; property ItemSepChar: WideChar read FItemSepChar write FItemSepChar default #9; property Options: TAsSynAutoCorrectOptions read FOptions write FOptions default [ascoIgnoreCase, ascoMaintainCase]; @@ -202,6 +193,7 @@ TCustomSynAutoCorrect = class(TComponent) TSynAutoCorrect = class(TCustomSynAutoCorrect) published + { Published declarations } property Enabled; property Editor; property Items; @@ -222,7 +214,7 @@ constructor TCustomSynAutoCorrect.Create(AOwner: TComponent); inherited Create(AOwner); FEnabled := True; - FItems := TUnicodeStringList.Create; + FItems := TStringList.Create; FItemSepChar := #9; FOptions := [ascoIgnoreCase, ascoMaintainCase]; FPrevLine := -1; @@ -239,8 +231,8 @@ destructor TCustomSynAutoCorrect.Destroy; { Utility functions } -function TCustomSynAutoCorrect.HalfString(Str: UnicodeString; - GetFirstHalf: Boolean): UnicodeString; +function TCustomSynAutoCorrect.HalfString(Str: string; + GetFirstHalf: Boolean): string; var i: Integer; begin @@ -256,10 +248,10 @@ function TCustomSynAutoCorrect.HalfString(Str: UnicodeString; procedure TCustomSynAutoCorrect.LoadFromIni(AFileName, ASection: string); var i: Integer; - Original, Correction: UnicodeString; - Reg: TIniFile; + Original, Correction: string; + Reg: TMemIniFile; begin - Reg := TIniFile.Create(AFileName); + Reg := TMemIniFile.Create(AFileName); try FItems.Clear; with Reg do @@ -278,9 +270,9 @@ procedure TCustomSynAutoCorrect.LoadFromIni(AFileName, ASection: string); procedure TCustomSynAutoCorrect.SaveToIni(AFileName, ASection: string); var i: Integer; - Reg: TIniFile; + Reg: TMemIniFile; begin - Reg := TIniFile.Create(AFileName); + Reg := TMemIniFile.Create(AFileName); try with Reg do begin @@ -294,6 +286,7 @@ procedure TCustomSynAutoCorrect.SaveToIni(AFileName, ASection: string); end; end; finally + Reg.UpdateFile; Reg.Free; end; end; @@ -316,7 +309,7 @@ procedure TCustomSynAutoCorrect.SaveToList(AFileName: string); procedure TCustomSynAutoCorrect.LoadFromRegistry(ARoot: DWORD; AKey: string); var i: Integer; - Original, Correction: UnicodeString; + Original, Correction: string; Reg: TRegIniFile; begin Reg := TRegIniFile.Create(''); @@ -324,7 +317,7 @@ procedure TCustomSynAutoCorrect.LoadFromRegistry(ARoot: DWORD; AKey: string); with Reg do begin RootKey := ARoot; - TBetterRegistry(Reg).OpenKeyReadOnly(AKey); + TRegistry(Reg).OpenKeyReadOnly(AKey); FItems.Clear; for i := 0 to Pred(ReadInteger('', 'Count', 0)) do begin @@ -363,7 +356,7 @@ procedure TCustomSynAutoCorrect.SaveToRegistry(ARoot: DWORD; AKey: string); end; end; -procedure TCustomSynAutoCorrect.Add(AOriginal, ACorrection: UnicodeString); +procedure TCustomSynAutoCorrect.Add(AOriginal, ACorrection: string); begin FItems.Add(AOriginal + FItemSepChar + ACorrection); end; @@ -371,7 +364,7 @@ procedure TCustomSynAutoCorrect.Add(AOriginal, ACorrection: UnicodeString); function TCustomSynAutoCorrect.AutoCorrectAll: Boolean; var i, cx: Integer; - s, Original, Correction, CurrText: UnicodeString; + s, Original, Correction, CurrText: string; begin Result := False; if Assigned(Editor) then @@ -390,8 +383,8 @@ function TCustomSynAutoCorrect.AutoCorrectAll: Boolean; end; end; -function TCustomSynAutoCorrect.CorrectItemStart(EditLine, SearchString: UnicodeString; - StartPos: LongInt; MatchCase, WholeWord: Boolean): LongInt; +function TCustomSynAutoCorrect.CorrectItemStart(EditLine, SearchString: string; + StartPos: Integer; MatchCase, WholeWord: Boolean): Integer; var SearchCount, I: Integer; CurBuf, Buf: PWideChar; @@ -461,8 +454,8 @@ function TCustomSynAutoCorrect.CorrectItemStart(EditLine, SearchString: UnicodeS if not MatchCase then begin - EditLine := SynWideUpperCase(EditLine); - SearchString := SynWideUpperCase(SearchString); + EditLine := SysUtils.AnsiUpperCase(EditLine); + SearchString := SysUtils.AnsiUpperCase(SearchString); end; BufLen := Length(EditLine); @@ -492,9 +485,6 @@ function TCustomSynAutoCorrect.CorrectItemStart(EditLine, SearchString: UnicodeS procedure TCustomSynAutoCorrect.DefineProperties(Filer: TFiler); begin inherited; -{$IFNDEF UNICODE} - UnicodeDefineProperties(Filer, Self); -{$ENDIF} end; procedure TCustomSynAutoCorrect.Delete(AIndex: Integer); @@ -503,7 +493,7 @@ procedure TCustomSynAutoCorrect.Delete(AIndex: Integer); end; procedure TCustomSynAutoCorrect.Edit(AIndex: Integer; - ANewOriginal, ANewCorrection: UnicodeString); + ANewOriginal, ANewCorrection: string); begin if AIndex > -1 then FItems[AIndex] := ANewOriginal + FItemSepChar + ANewCorrection; @@ -515,7 +505,7 @@ procedure TCustomSynAutoCorrect.KeyboardHandler(Sender: TObject; AfterProcessing var b: Boolean; i, cx: Integer; - s, Original, Correction, CurrText: UnicodeString; + s, Original, Correction, CurrText: string; begin if Enabled and not AfterProcessing and not Handled then begin @@ -552,7 +542,7 @@ procedure TCustomSynAutoCorrect.MouseDownHandler(Sender: TObject; Action: TAutoCorrectAction; b: Boolean; i, cx: Integer; - s, Original, Correction, CurrText: UnicodeString; + s, Original, Correction, CurrText: string; begin if ascoCorrectOnMouseDown in FOptions then begin @@ -588,21 +578,21 @@ procedure TCustomSynAutoCorrect.MouseDownHandler(Sender: TObject; end; end; -function TCustomSynAutoCorrect.FindAndCorrect(var EditLine: UnicodeString; - Original, Correction: UnicodeString; var CurrentX: Integer): Boolean; +function TCustomSynAutoCorrect.FindAndCorrect(var EditLine: string; + Original, Correction: string; var CurrentX: Integer): Boolean; var - StartPos: LongInt; + StartPos: Integer; EndPos: Integer; - FoundText, ReplaceDefText: UnicodeString; + FoundText, ReplaceDefText: string; p: TBufferCoord; Action: TAutoCorrectAction; - function FirstCapCase(s: UnicodeString): UnicodeString; + function FirstCapCase(s: string): string; begin if s <> '' then begin - s := SynWideLowerCase(s); - s[1] := SynWideUpperCase(s[1])[1]; + s := SysUtils.AnsiLowerCase(s); + s[1] := SysUtils.AnsiUpperCase(s[1])[1]; end; Result := s; @@ -626,12 +616,12 @@ function TCustomSynAutoCorrect.FindAndCorrect(var EditLine: UnicodeString; Correction := ReplaceDefText; FoundText := Copy(EditLine,StartPos+1,EndPos); - if FoundText = SynWideUpperCase(FoundText) then - Correction := SynWideUpperCase(Correction) + if FoundText = SysUtils.AnsiUpperCase(FoundText) then + Correction := SysUtils.AnsiUpperCase(Correction) else begin - if FoundText = SynWideLowerCase(FoundText) then - Correction := SynWideLowerCase(Correction) + if FoundText = SysUtils.AnsiLowerCase(FoundText) then + Correction := SysUtils.AnsiLowerCase(Correction) else begin if FoundText = FirstCapCase(FoundText) then @@ -682,7 +672,7 @@ function TCustomSynAutoCorrect.FindAndCorrect(var EditLine: UnicodeString; end; end; -function TCustomSynAutoCorrect.GetItems: TUnicodeStrings; +function TCustomSynAutoCorrect.GetItems: TStrings; begin Result := FItems; end; @@ -697,7 +687,7 @@ procedure TCustomSynAutoCorrect.Notification(AComponent: TComponent; end; end; -function TCustomSynAutoCorrect.PreviousToken: UnicodeString; +function TCustomSynAutoCorrect.PreviousToken: string; var i, cx: Integer; begin @@ -723,9 +713,7 @@ procedure TCustomSynAutoCorrect.SetEditor(Value: TCustomSynEdit); begin Editor.RemoveMouseDownHandler(MouseDownHandler); Editor.UnregisterCommandHandler(KeyboardHandler); -{$IFDEF SYN_COMPILER_5_UP} Editor.RemoveFreeNotification(Self); -{$ENDIF} end; FEditor := Value; @@ -739,7 +727,7 @@ procedure TCustomSynAutoCorrect.SetEditor(Value: TCustomSynEdit); end; end; -procedure TCustomSynAutoCorrect.SetItems(const Value: TUnicodeStrings); +procedure TCustomSynAutoCorrect.SetItems(const Value: TStrings); begin FItems.Assign(Value); end; diff --git a/Ext/SynEdit/Source/SynAutoCorrectEditor.dfm b/Ext/SynEdit/Source/SynAutoCorrectEditor.dfm index 0918547..bcad426 100644 --- a/Ext/SynEdit/Source/SynAutoCorrectEditor.dfm +++ b/Ext/SynEdit/Source/SynAutoCorrectEditor.dfm @@ -11,13 +11,11 @@ object frmAutoCorrectEditor: TfrmAutoCorrectEditor Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] - OldCreateOrder = True Position = poScreenCenter ShowHint = True OnCreate = FormCreate OnPaint = FormPaint OnShow = FormShow - PixelsPerInch = 96 TextHeight = 13 object lblLabel1: TLabel Left = 16 diff --git a/Ext/SynEdit/Source/SynAutoCorrectEditor.pas b/Ext/SynEdit/Source/SynAutoCorrectEditor.pas index cf4389b..221a5e0 100644 --- a/Ext/SynEdit/Source/SynAutoCorrectEditor.pas +++ b/Ext/SynEdit/Source/SynAutoCorrectEditor.pas @@ -25,35 +25,18 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynAutoCorrectEditor.pas,v 1.9.2.3 2008/09/14 16:24:57 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} -// TODO: use TntUnicode to enable unicode input -{$IFNDEF QSYNAUTOCORRECTEDITOR} unit SynAutoCorrectEditor; -{$ENDIF} interface {$I SynEdit.inc} uses - {$IFDEF SYN_COMPILER_17_UP} - Types, - {$ENDIF} Windows, Messages, Graphics, Controls, Forms, Dialogs, ExtCtrls, StdCtrls, - Buttons, Registry, - SynAutoCorrect, - SynUnicode, - SysUtils, - Classes; + Buttons, Registry, SynAutoCorrect, SynUnicode, SysUtils, Classes; type TfrmAutoCorrectEditor = class(TForm) @@ -76,6 +59,8 @@ TfrmAutoCorrectEditor = class(TForm) procedure FormCreate(Sender: TObject); procedure FormPaint(Sender: TObject); private + procedure lbxItemsDrawItemCLX(Sender: TObject; Index: Integer; + Rect: TRect; State: TOwnerDrawState; var Handled: Boolean); procedure lbxItemsDrawItem(Control: TWinControl; Index: Integer; Rect: TRect; State: TOwnerDrawState); public @@ -96,28 +81,40 @@ implementation {$R *.dfm} +uses + Types; + procedure TfrmAutoCorrectEditor.FormShow(Sender: TObject); begin lbxItems.Items.Assign(SynAutoCorrect.Items); Invalidate; end; -procedure TfrmAutoCorrectEditor.lbxItemsDrawItem(Control: TWinControl; - Index: Integer; Rect: TRect; State: TOwnerDrawState); +procedure TfrmAutoCorrectEditor.lbxItemsDrawItemCLX(Sender: TObject; + Index: Integer; Rect: TRect; State: TOwnerDrawState; var Handled: Boolean); var - s: UnicodeString; + s: string; begin with lbxItems do begin s := Items[Index]; Canvas.FillRect(Rect); - TextOut(Canvas, Rect.Left + 2, Rect.Top, SynAutoCorrect.HalfString(s, True)); - TextOut(Canvas, Rect.Left + (lbxItems.ClientWidth div 2) + 2, Rect.Top, + Canvas.TextOut(Rect.Left + 2, Rect.Top, SynAutoCorrect.HalfString(s, True)); + Canvas.TextOut(Rect.Left + (lbxItems.ClientWidth div 2) + 2, Rect.Top, SynAutoCorrect.HalfString(s, False)); FormPaint(nil); end; end; +procedure TfrmAutoCorrectEditor.lbxItemsDrawItem(Control: TWinControl; + Index: Integer; Rect: TRect; State: TOwnerDrawState); +var + Dummy: Boolean; +begin + Dummy := True; + lbxItemsDrawItemCLX(Control, Index, Rect, State, Dummy); +end; + procedure TfrmAutoCorrectEditor.btnAddClick(Sender: TObject); var Original, Correction: string; @@ -145,7 +142,6 @@ procedure TfrmAutoCorrectEditor.btnDeleteClick(Sender: TObject); if lbxItems.ItemIndex < 0 then begin MessageBox(0, PChar(SPleaseSelectItem), PChar(SError), MB_ICONERROR or MB_OK); - Exit; end; @@ -158,7 +154,7 @@ procedure TfrmAutoCorrectEditor.btnDeleteClick(Sender: TObject); procedure TfrmAutoCorrectEditor.btnEditClick(Sender: TObject); var - Original, Correction, CurrText: string; // TODO: unicode adapt + Original, Correction, CurrText: string; begin if lbxItems.ItemIndex < 0 then begin diff --git a/Ext/SynEdit/Source/SynCompletionProposal.pas b/Ext/SynEdit/Source/SynCompletionProposal.pas index f09b4bf..0fda7d4 100644 --- a/Ext/SynEdit/Source/SynCompletionProposal.pas +++ b/Ext/SynEdit/Source/SynCompletionProposal.pas @@ -28,54 +28,34 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynCompletionProposal.pas,v 1.80.1.1 2013/06/25 10:31:19 codehunterworks Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Last Changes: - 1.80.1.1 - Removed TProposalColumn.BiggestWord and - added TProposalColumn.ColumnWidth (Static Column Width in Pixels) - -Known Issues: -------------------------------------------------------------------------------} -{$IFNDEF QSYNCOMPLETIONPROPOSAL} unit SynCompletionProposal; -{$ENDIF} {$I SynEdit.inc} interface uses - {$IFDEF SYN_COMPILER_17_UP} - Types, UITypes, - {$ENDIF} - Windows, - Messages, - Graphics, - Forms, - Controls, - StdCtrls, - ExtCtrls, - Menus, - Dialogs, + Winapi.Windows, + Winapi.Messages, + System.SysUtils, + System.Classes, + Vcl.Graphics, + Vcl.Forms, + Vcl.Controls, + Vcl.StdCtrls, + Vcl.ExtCtrls, + Vcl.Menus, + Vcl.ImgList, SynEditTypes, SynEditKeyCmds, - SynEditHighlighter, - SynEditKbdHandler, SynEdit, - SynUnicode, - SysUtils, - Classes; + SynUnicode; type SynCompletionType = (ctCode, ctHint, ctParams); - TSynForm = {$IFDEF SYN_COMPILER_3_UP}TCustomForm{$ELSE}TForm{$ENDIF}; - TSynBaseCompletionProposalPaintItem = procedure(Sender: TObject; Index: Integer; TargetCanvas: TCanvas; ItemRect: TRect; var CustomDraw: Boolean) of object; @@ -83,36 +63,33 @@ interface TSynBaseCompletionProposalMeasureItem = procedure(Sender: TObject; Index: Integer; TargetCanvas: TCanvas; var ItemWidth: Integer) of object; - TCodeCompletionEvent = procedure(Sender: TObject; var Value: UnicodeString; + TCodeCompletionEvent = procedure(Sender: TObject; var Value: string; Shift: TShiftState; Index: Integer; EndToken: WideChar) of object; - TAfterCodeCompletionEvent = procedure(Sender: TObject; const Value: UnicodeString; + TAfterCodeCompletionEvent = procedure(Sender: TObject; const Value: string; Shift: TShiftState; Index: Integer; EndToken: WideChar) of object; TValidateEvent = procedure(Sender: TObject; Shift: TShiftState; - EndToken: WideChar) of object; + EndToken: WideChar) of object; - TCompletionParameter = procedure(Sender: TObject; CurrentIndex: Integer; - var Level, IndexToDisplay: Integer; var Key: WideChar; - var DisplayString: UnicodeString) of object; + TCompletionParameter = procedure(Sender: TObject; Key: WideChar; + var CurrentIndex, Level: Integer) of object; TCompletionExecute = procedure(Kind: SynCompletionType; Sender: TObject; - var CurrentInput: UnicodeString; var x, y: Integer; var CanExecute: Boolean) of object; + var CurrentInput: string; var x, y: Integer; var CanExecute: Boolean) of object; TCompletionChange = procedure(Sender: TObject; AIndex: Integer) of object; - TSynCompletionOption = (scoCaseSensitive, //Use case sensitivity to do matches - scoLimitToMatchedText, //Limit the matched text to only what they have typed in - scoTitleIsCentered, //Center the title in the box if you choose to use titles - scoUseInsertList, //Use the InsertList to insert text instead of the ItemList (which will be displayed) - scoUsePrettyText, //Use the PrettyText function to output the words - scoUseBuiltInTimer, //Use the built in timer and the trigger keys to execute the proposal as well as the shortcut - scoEndCharCompletion, //When an end char is pressed, it triggers completion to occur (like the Delphi IDE) - scoConsiderWordBreakChars, //Use word break characters as additional end characters - scoCompleteWithTab, //Use the tab character for completion - scoCompleteWithEnter, //Use the Enter character for completion - scoLimitToMatchedTextAnywhere //Filter the list to typed value matched anywhere in text - ); + TSynCompletionOption = (scoCaseSensitive, //Use case sensitivity to do matches + scoLimitToMatchedText, //Limit the matched text to only what they have typed in + scoTitleIsCentered, //Center the title in the box if you choose to use titles + scoUseInsertList, //Use the InsertList to insert text instead of the ItemList (which will be displayed) + scoUsePrettyText, //Use the PrettyText function to output the words + scoUseBuiltInTimer, //Use the built in timer and the trigger keys to execute the proposal as well as the shortcut + scoEndCharCompletion, //When an end char is pressed, it triggers completion to occur (like the Delphi IDE) + scoConsiderWordBreakChars,//Use word break characters as additional end characters + scoCompleteWithTab, //Use the tab character for completion + scoCompleteWithEnter); //Use the Enter character for completion TSynCompletionOptions = set of TSynCompletionOption; @@ -124,44 +101,40 @@ interface type TProposalColumns = class; - TSynBaseCompletionProposalForm = class(TSynForm) + TSynBaseCompletionProposalForm = class(TCustomForm) private - FCurrentString: UnicodeString; - FOnKeyPress: TKeyPressWEvent; + FCurrentString: string; FOnPaintItem: TSynBaseCompletionProposalPaintItem; FOnMeasureItem: TSynBaseCompletionProposalMeasureItem; FOnChangePosition: TCompletionChange; - FItemList: TUnicodeStrings; - FInsertList: TUnicodeStrings; - FAssignedList: TUnicodeStrings; + FItemList: TStrings; + FInsertList: TStrings; + FAssignedList: TStrings; FPosition: Integer; FLinesInWindow: Integer; - FTitleFontHeight: Integer; FFontHeight: Integer; FScrollbar: TScrollBar; FOnValidate: TValidateEvent; FOnCancel: TNotifyEvent; FClSelect: TColor; - FClSelectText: TColor; + fClSelectText: TColor; FClTitleBackground: TColor; - FClBackGround: TColor; - FClBackgroundBorder: TColor; - FBitmap: TBitmap; // used for drawing + fClBackGround: TColor; + FPaintBitmap: TBitmap; // used for drawing FTitleBitmap: TBitmap; // used for title-drawing FCurrentEditor: TCustomSynEdit; - FTitle: UnicodeString; + FTitle: string; FTitleFont: TFont; FFont: TFont; FResizeable: Boolean; FItemHeight: Integer; FMargin: Integer; FEffectiveItemHeight: Integer; - FImages: TImageList; + FImages: TCustomImageList; - // These are the reflections of the Options property of the CompletionProposal + //These are the reflections of the Options property of the CompletionProposal FCase: Boolean; FMatchText: Boolean; - FMatchTextAnywhere: Boolean; FFormattedText: Boolean; FCenterTitle: Boolean; FUseInsertList: Boolean; @@ -170,62 +143,68 @@ TSynBaseCompletionProposalForm = class(TSynForm) FMouseWheelAccumulator: Integer; FDisplayKind: SynCompletionType; - FParameterToken: TCompletionParameter; + FOnParameterToken: TCompletionParameter; FCurrentIndex: Integer; FCurrentLevel: Integer; FDefaultKind: SynCompletionType; - FEndOfTokenChr: UnicodeString; - FTriggerChars: UnicodeString; - FOldShowCaret: Boolean; - FHeightBuffer: Integer; + FEndOfTokenChr: string; + FTriggerChars: string; + OldShowCaret: Boolean; + FTitleHeight: Integer; FColumns: TProposalColumns; - procedure SetCurrentString(const Value: UnicodeString); - procedure MoveLine(cnt: Integer; const WrapAround: Boolean = False); + FGripperHeight: Integer; + FGripperText: string; + FGripperFont: TFont; + + FScaledMargin: Integer; + procedure SetCurrentString(const Value: string); + procedure MoveLine(cnt: Integer); procedure ScrollbarOnChange(Sender: TObject); procedure ScrollbarOnScroll(Sender: TObject; ScrollCode: TScrollCode; var ScrollPos: Integer); procedure ScrollbarOnEnter(Sender: TObject); - procedure SetItemList(const Value: TUnicodeStrings); - procedure SetInsertList(const Value: TUnicodeStrings); + procedure SetItemList(const Value: TStrings); + procedure SetInsertList(const Value: TStrings); procedure SetPosition(const Value: Integer); procedure SetResizeable(const Value: Boolean); procedure SetItemHeight(const Value: Integer); - procedure SetImages(const Value: TImageList); + procedure SetImages(const Value: TCustomImageList); procedure StringListChange(Sender: TObject); - procedure DoDoubleClick(Sender : TObject); + procedure DoDoubleClick(Sender: TObject); procedure DoFormShow(Sender: TObject); procedure DoFormHide(Sender: TObject); procedure AdjustScrollBarPosition; procedure AdjustMetrics; - procedure SetTitle(const Value: UnicodeString); + procedure SetTitle(const Value: string); procedure SetFont(const Value: TFont); procedure SetTitleFont(const Value: TFont); procedure SetColumns(Value: TProposalColumns); - procedure TitleFontChange(Sender: TObject); - procedure FontChange(Sender: TObject); procedure RecalcItemHeight; function IsWordBreakChar(AChar: WideChar): Boolean; + procedure WMNCHitTest(var Message: TWMNCHitTest); message WM_NCHITTEST; + procedure ResetCanvas(const Canvas: TCanvas); + procedure SetGripperText(const Value: string); + procedure SetGripperFont(const Value: TFont); protected - procedure DoKeyPressW(Key: WideChar); + const cGripperBarHeight = 16; procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyPress(var Key: Char); override; - procedure KeyPressW(var Key: WideChar); virtual; procedure Paint; override; + procedure PaintTitle; + procedure PaintCodeItems; + procedure PaintHint; + procedure PaintGripper; + procedure PaintParams; procedure Activate; override; procedure Deactivate; override; procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; procedure Resize; override; procedure Notification(AComponent: TComponent; Operation: TOperation); override; - procedure WMChar(var Msg: TWMChar); message WM_CHAR; procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL; procedure WMActivate (var Message: TWMActivate); message WM_ACTIVATE; - procedure WMEraseBackgrnd(var Message: TMessage); message WM_ERASEBKGND; procedure WMGetDlgCode(var Message: TWMGetDlgCode); message WM_GETDLGCODE; procedure CreateParams(var Params: TCreateParams); override; - procedure CreateWnd; override; - {$IFDEF SYN_DELPHI_4_UP} - function CanResize(var NewWidth, NewHeight: Integer): Boolean; override; - {$ENDIF} + function GetCurrentPPI: Integer;{$IF CompilerVersion >= 32}override;{$ENDIF} public constructor Create(AOwner: Tcomponent); override; destructor Destroy; override; @@ -235,45 +214,45 @@ TSynBaseCompletionProposalForm = class(TSynForm) property DisplayType: SynCompletionType read FDisplayKind write FDisplayKind; property DefaultType: SynCompletionType read FDefaultKind write FDefaultKind default ctCode; - property CurrentString: UnicodeString read FCurrentString write SetCurrentString; + property CurrentString: string read FCurrentString write SetCurrentString; property CurrentIndex: Integer read FCurrentIndex write FCurrentIndex; property CurrentLevel: Integer read FCurrentLevel write FCurrentLevel; - property OnParameterToken: TCompletionParameter read FParameterToken write FParameterToken; - property OnKeyPress: TKeyPressWEvent read FOnKeyPress write FOnKeyPress; + property OnParameterToken: TCompletionParameter read FOnParameterToken write FOnParameterToken; + property OnKeyPress; property OnPaintItem: TSynBaseCompletionProposalPaintItem read FOnPaintItem write FOnPaintItem; property OnMeasureItem: TSynBaseCompletionProposalMeasureItem read FOnMeasureItem write FOnMeasureItem; property OnValidate: TValidateEvent read FOnValidate write FOnValidate; property OnCancel: TNotifyEvent read FOnCancel write FOnCancel; - property ItemList: TUnicodeStrings read FItemList write SetItemList; - property InsertList: TUnicodeStrings read FInsertList write SetInsertList; - property AssignedList: TUnicodeStrings read FAssignedList write FAssignedList; + property ItemList: TStrings read FItemList write SetItemList; + property InsertList: TStrings read FInsertList write SetInsertList; + property AssignedList: TStrings read FAssignedList write FAssignedList; property Position: Integer read FPosition write SetPosition; - property Title: UnicodeString read FTitle write SetTitle; + property Title: string read fTitle write SetTitle; + property GripperText: string read FGripperText write SetGripperText; property ClSelect: TColor read FClSelect write FClSelect default clHighlight; property ClSelectedText: TColor read FClSelectText write FClSelectText default clHighlightText; property ClBackground: TColor read FClBackGround write FClBackGround default clWindow; - property ClBackgroundBorder: TColor read FClBackgroundBorder write FClBackgroundBorder default clBtnFace; property ClTitleBackground: TColor read FClTitleBackground write FClTitleBackground default clBtnFace; property ItemHeight: Integer read FItemHeight write SetItemHeight default 0; property Margin: Integer read FMargin write FMargin default 2; property UsePrettyText: Boolean read FFormattedText write FFormattedText default False; property UseInsertList: Boolean read FUseInsertList write FUseInsertList default False; - property CenterTitle: Boolean read FCenterTitle write FCenterTitle default True; - property CaseSensitive: Boolean read FCase write FCase default False; - property CurrentEditor: TCustomSynEdit read FCurrentEditor write FCurrentEditor; - property MatchText: Boolean read FMatchText write FMatchText; - property MatchTextAnywhere: Boolean read FMatchTextAnywhere write FMatchTextAnywhere; - property EndOfTokenChr: UnicodeString read FEndOfTokenChr write FEndOfTokenChr; - property TriggerChars: UnicodeString read FTriggerChars write FTriggerChars; + property CenterTitle: Boolean read FCenterTitle write FCenterTitle default True; + property CaseSensitive: Boolean read fCase write fCase default False; + property CurrentEditor: TCustomSynEdit read fCurrentEditor write fCurrentEditor; + property MatchText: Boolean read fMatchText write fMatchText; + property EndOfTokenChr: string read FEndOfTokenChr write FEndOfTokenChr; + property TriggerChars: string read FTriggerChars write FTriggerChars; property CompleteWithTab: Boolean read FCompleteWithTab write FCompleteWithTab; property CompleteWithEnter: Boolean read FCompleteWithEnter write FCompleteWithEnter; - property TitleFont: TFont read FTitleFont write SetTitleFont; - property Font: TFont read FFont write SetFont; + property TitleFont: TFont read fTitleFont write SetTitleFont; + property Font: TFont read fFont write SetFont; // hides inherited property - not auto scaled + property GripperFont: TFont read FGripperFont write SetGripperFont; property Columns: TProposalColumns read FColumns write SetColumns; - property Resizeable: Boolean read FResizeable write SetResizeable default True; - property Images: TImageList read FImages write SetImages; + property Resizeable: Boolean read FResizeable write SetResizeable; + property Images: TCustomImageList read FImages write SetImages; end; TSynBaseCompletionProposal = class(TComponent) @@ -283,58 +262,61 @@ TSynBaseCompletionProposal = class(TComponent) FOnClose: TNotifyEvent; FOnShow: TNotifyEvent; FWidth: Integer; - FPreviousToken: UnicodeString; + FPreviousToken: string; FDotOffset: Integer; FOptions: TSynCompletionOptions; FNbLinesInWindow: Integer; + FPaintFormShadow: Boolean; + FShowGripper: Boolean; FCanExecute: Boolean; function GetClSelect: TColor; procedure SetClSelect(const Value: TColor); - function GetCurrentString: UnicodeString; - function GetItemList: TUnicodeStrings; - function GetInsertList: TUnicodeStrings; + function GetCurrentString: string; + function GetItemList: TStrings; + function GetInsertList: TStrings; function GetOnCancel: TNotifyEvent; - function GetOnKeyPress: TKeyPressWEvent; + function GetOnKeyPress: TKeyPressEvent; function GetOnPaintItem: TSynBaseCompletionProposalPaintItem; function GetOnMeasureItem: TSynBaseCompletionProposalMeasureItem; function GetOnValidate: TValidateEvent; function GetPosition: Integer; - procedure SetCurrentString(const Value: UnicodeString); - procedure SetItemList(const Value: TUnicodeStrings); - procedure SetInsertList(const Value: TUnicodeStrings); + procedure SetCurrentString(const Value: string); + procedure SetItemList(const Value: TStrings); + procedure SetInsertList(const Value: TStrings); procedure SetNbLinesInWindow(const Value: Integer); procedure SetOnCancel(const Value: TNotifyEvent); - procedure SetOnKeyPress(const Value: TKeyPressWEvent); + procedure SetOnKeyPress(const Value: TKeyPressEvent); procedure SetOnPaintItem(const Value: TSynBaseCompletionProposalPaintItem); procedure SetOnMeasureItem(const Value: TSynBaseCompletionProposalMeasureItem); procedure SetPosition(const Value: Integer); procedure SetOnValidate(const Value: TValidateEvent); procedure SetWidth(Value: Integer); - procedure SetImages(const Value: TImageList); + procedure SetImages(const Value: TCustomImageList); function GetDisplayKind: SynCompletionType; procedure SetDisplayKind(const Value: SynCompletionType); function GetParameterToken: TCompletionParameter; procedure SetParameterToken(const Value: TCompletionParameter); function GetDefaultKind: SynCompletionType; procedure SetDefaultKind(const Value: SynCompletionType); - function GetClBack(AIndex: Integer): TColor; - procedure SetClBack(AIndex: Integer; const Value: TColor); + function GetClBack: TColor; + procedure SetClBack(const Value: TColor); function GetClSelectedText: TColor; procedure SetClSelectedText(const Value: TColor); - function GetEndOfTokenChar: UnicodeString; - procedure SetEndOfTokenChar(const Value: UnicodeString); + function GetEndOfTokenChar: string; + procedure SetEndOfTokenChar(const Value: string); function GetClTitleBackground: TColor; procedure SetClTitleBackground(const Value: TColor); - procedure SetTitle(const Value: UnicodeString); - function GetTitle: UnicodeString; + procedure SetTitle(const Value: string); + function GetTitle: string; function GetFont: TFont; function GetTitleFont: TFont; procedure SetFont(const Value: TFont); procedure SetTitleFont(const Value: TFont); + procedure SetGripperFont(const Value: TFont); function GetOptions: TSynCompletionOptions; - function GetTriggerChars: UnicodeString; - procedure SetTriggerChars(const Value: UnicodeString); + function GetTriggerChars: string; + procedure SetTriggerChars(const Value: string); function GetOnChange: TCompletionChange; procedure SetOnChange(const Value: TCompletionChange); procedure SetColumns(const Value: TProposalColumns); @@ -345,62 +327,68 @@ TSynBaseCompletionProposal = class(TComponent) procedure SetItemHeight(const Value: Integer); function GetMargin: Integer; procedure SetMargin(const Value: Integer); - function GetImages: TImageList; + function GetImages: TCustomImageList; function IsWordBreakChar(AChar: WideChar): Boolean; + procedure SetPaintFormShadow(const Value: Boolean); + procedure SetGripperText(const Value: string); + function GetGripperFont: TFont; + function GetGripperText: string; protected procedure DefineProperties(Filer: TFiler); override; procedure SetOptions(const Value: TSynCompletionOptions); virtual; - procedure EditorCancelMode(Sender: TObject); virtual; + procedure EditorCancelMode(Sender: TObject); virtual; procedure HookedEditorCommand(Sender: TObject; AfterProcessing: Boolean; var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer; HandlerData: Pointer); virtual; public - constructor Create(Aowner: TComponent); override; - procedure Execute(s: UnicodeString; x, y: Integer); - procedure ExecuteEx(s: UnicodeString; x, y: Integer; Kind: SynCompletionType - {$IFDEF SYN_COMPILER_4_UP} = ctCode {$ENDIF}); virtual; + constructor Create(AOwner: TComponent); override; + procedure Execute(CurrentInput: string; x, y: Integer); + procedure ExecuteEx(CurrentInput: string; x, y: Integer; Kind: SynCompletionType = ctCode); virtual; procedure Activate; procedure Deactivate; procedure ClearList; - function DisplayItem(AIndex: Integer): UnicodeString; - function InsertItem(AIndex: Integer): UnicodeString; - procedure AddItemAt(Where: Integer; ADisplayText, AInsertText: UnicodeString); - procedure AddItem(ADisplayText, AInsertText: UnicodeString); + function DisplayItem(AIndex: Integer): string; + function InsertItem(AIndex: Integer): string; + procedure AddItemAt(Where: Integer; ADisplayText, AInsertText: string); + procedure AddItem(ADisplayText, AInsertText: string); procedure ResetAssignedList; - property OnKeyPress: TKeyPressWEvent read GetOnKeyPress write SetOnKeyPress; + property OnKeyPress: TKeyPressEvent read GetOnKeyPress write SetOnKeyPress; property OnValidate: TValidateEvent read GetOnValidate write SetOnValidate; property OnCancel: TNotifyEvent read GetOnCancel write SetOnCancel; - property CurrentString: UnicodeString read GetCurrentString write SetCurrentString; + property CurrentString: string read GetCurrentString write SetCurrentString; property DotOffset: Integer read FDotOffset write FDotOffset; property DisplayType: SynCompletionType read GetDisplayKind write SetDisplayKind; property Form: TSynBaseCompletionProposalForm read FForm; - property PreviousToken: UnicodeString read FPreviousToken; + property PreviousToken: string read FPreviousToken; property Position: Integer read GetPosition write SetPosition; published property DefaultType: SynCompletionType read GetDefaultKind write SetDefaultKind default ctCode; property Options: TSynCompletionOptions read GetOptions write SetOptions default DefaultProposalOptions; - property ItemList: TUnicodeStrings read GetItemList write SetItemList; - property InsertList: TUnicodeStrings read GetInsertList write SetInsertList; + property ItemList: TStrings read GetItemList write SetItemList; + property InsertList: TStrings read GetInsertList write SetInsertList; property NbLinesInWindow: Integer read FNbLinesInWindow write SetNbLinesInWindow default 8; property ClSelect: TColor read GetClSelect write SetClSelect default clHighlight; property ClSelectedText: TColor read GetClSelectedText write SetClSelectedText default clHighlightText; - property ClBackground: TColor index 1 read GetClBack write SetClBack default clWindow; - property ClBackgroundBorder: TColor index 2 read GetClBack write SetClBack default clBtnFace; + property ClBackground: TColor read GetClBack write SetClBack default clWindow; property ClTitleBackground: TColor read GetClTitleBackground write SetClTitleBackground default clBtnFace; property Width: Integer read FWidth write SetWidth default 260; - property EndOfTokenChr: UnicodeString read GetEndOfTokenChar write SetEndOfTokenChar; - property TriggerChars: UnicodeString read GetTriggerChars write SetTriggerChars; - property Title: UnicodeString read GetTitle write SetTitle; + property EndOfTokenChr: string read GetEndOfTokenChar write SetEndOfTokenChar; + property TriggerChars: string read GetTriggerChars write SetTriggerChars; + property Title: string read GetTitle write SetTitle; property Font: TFont read GetFont write SetFont; property TitleFont: TFont read GetTitleFont write SetTitleFont; + property GripperFont: TFont read GetGripperFont write SetGripperFont; property Columns: TProposalColumns read GetColumns write SetColumns; - property Resizeable: Boolean read GetResizeable write SetResizeable default True; + property Resizeable: Boolean read GetResizeable write SetResizeable default False; property ItemHeight: Integer read GetItemHeight write SetItemHeight default 0; - property Images: TImageList read GetImages write SetImages default nil; + property Images: TCustomImageList read GetImages write SetImages default nil; property Margin: Integer read GetMargin write SetMargin default 2; + property PaintFormShadow: Boolean read FPaintFormShadow write SetPaintFormShadow default True; + property ShowGripper: Boolean read FShowGripper write FShowGripper default False; + property GripperText: string read GetGripperText write SetGripperText; property OnChange: TCompletionChange read GetOnChange write SetOnChange; property OnClose: TNotifyEvent read FOnClose write FOnClose; @@ -413,7 +401,7 @@ TSynBaseCompletionProposal = class(TComponent) TSynCompletionProposal = class(TSynBaseCompletionProposal) private - FEditors: TList; + fEditors: TList; FShortCut: TShortCut; FNoNextKey: Boolean; FCompletionStart: Integer; @@ -432,12 +420,12 @@ TSynCompletionProposal = class(TSynBaseCompletionProposal) procedure EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); procedure EditorKeyPress(Sender: TObject; var Key: WideChar); procedure TimerExecute(Sender: TObject); - function GetPreviousToken(AEditor: TCustomSynEdit): UnicodeString; - function GetCurrentInput(AEditor: TCustomSynEdit): UnicodeString; + function GetPreviousToken(AEditor: TCustomSynEdit): string; + function GetCurrentInput(AEditor: TCustomSynEdit): string; function GetTimerInterval: Integer; procedure SetTimerInterval(const Value: Integer); function GetEditor(i: Integer): TCustomSynEdit; - procedure InternalCancelCompletion; + procedure InternalCancelCompletion; protected procedure DoExecute(AEditor: TCustomSynEdit); virtual; procedure Notification(AComponent: TComponent; Operation: TOperation); override; @@ -453,14 +441,13 @@ TSynCompletionProposal = class(TSynBaseCompletionProposal) procedure AddEditor(AEditor: TCustomSynEdit); function RemoveEditor(AEditor: TCustomSynEdit): Boolean; function EditorsCount: Integer; - procedure ExecuteEx(s: UnicodeString; x, y: Integer; Kind : SynCompletionType - {$IFDEF SYN_COMPILER_4_UP} = ctCode {$ENDIF}); override; + procedure ExecuteEx(s: string; x, y: Integer; Kind: SynCompletionType = ctCode); override; procedure ActivateCompletion; procedure CancelCompletion; procedure ActivateTimer(ACurrentEditor: TCustomSynEdit); procedure DeactivateTimer; property Editors[i: Integer]: TCustomSynEdit read GetEditor; - property CompletionStart: Integer read FCompletionStart write FCompletionStart; + property CompletionStart: Integer read FCompletionStart write FCompletionStart; // ET 04/02/2003 published property ShortCut: TShortCut read FShortCut write SetShortCut; property Editor: TCustomSynEdit read FEditor write SetEditor; @@ -474,23 +461,23 @@ TSynCompletionProposal = class(TSynBaseCompletionProposal) TSynAutoComplete = class(TComponent) private FShortCut: TShortCut; - FEditor: TCustomSynEdit; - fAutoCompleteList: TUnicodeStrings; - FNoNextKey : Boolean; - FEndOfTokenChr: UnicodeString; + fEditor: TCustomSynEdit; + fAutoCompleteList: TStrings; + fNoNextKey: Boolean; + FEndOfTokenChr: string; FOnBeforeExecute: TNotifyEvent; FOnAfterExecute: TNotifyEvent; FInternalCompletion: TSynCompletionProposal; FDoLookup: Boolean; FOptions: TSynCompletionOptions; - procedure SetAutoCompleteList(List: TUnicodeStrings); + procedure SetAutoCompleteList(List: TStrings); procedure SetEditor(const Value: TCustomSynEdit); procedure SetDoLookup(const Value: Boolean); procedure CreateInternalCompletion; function GetOptions: TSynCompletionOptions; procedure SetOptions(const Value: TSynCompletionOptions); procedure DoInternalAutoCompletion(Sender: TObject; - const Value: UnicodeString; Shift: TShiftState; Index: Integer; + const Value: string; Shift: TShiftState; Index: Integer; EndToken: WideChar); function GetExecuting: Boolean; protected @@ -500,25 +487,26 @@ TSynAutoComplete = class(TComponent) procedure EditorKeyDown(Sender: TObject; var Key: Word; Shift: TShiftState); virtual; procedure EditorKeyPress(Sender: TObject; var Key: WideChar); virtual; - function GetPreviousToken(Editor: TCustomSynEdit): UnicodeString; + function GetPreviousToken(Editor: TCustomSynEdit): string; public + function GetCompletionProposal: TSynCompletionProposal; constructor Create(AOwner: TComponent); override; destructor Destroy; override; - procedure Execute(Token: UnicodeString; Editor: TCustomSynEdit); - procedure ExecuteEx(Token: UnicodeString; Editor: TCustomSynEdit; LookupIfNotExact: Boolean); - function GetTokenList: UnicodeString; - function GetTokenValue(Token: UnicodeString): UnicodeString; + procedure Execute(Token: string; Editor: TCustomSynEdit); + procedure ExecuteEx(Token: string; Editor: TCustomSynEdit; LookupIfNotExact: Boolean); + function GetTokenList: string; + function GetTokenValue(Token: string): string; procedure CancelCompletion; property Executing: Boolean read GetExecuting; published - property AutoCompleteList: TUnicodeStrings read fAutoCompleteList + property AutoCompleteList: TStrings read fAutoCompleteList write SetAutoCompleteList; - property EndOfTokenChr: UnicodeString read FEndOfTokenChr write FEndOfTokenChr; - property Editor: TCustomSynEdit read FEditor write SetEditor; + property EndOfTokenChr: string read FEndOfTokenChr write FEndOfTokenChr; + property Editor: TCustomSynEdit read fEditor write SetEditor; property ShortCut: TShortCut read FShortCut write SetShortCut; property OnBeforeExecute: TNotifyEvent read FOnBeforeExecute write FOnBeforeExecute; property OnAfterExecute: TNotifyEvent read FOnAfterExecute write FOnAfterExecute; - property DoLookupWhenNotExact: Boolean read FDoLookup write SetDoLookup default True; + property DoLookupWhenNotExact: Boolean read FDoLookup write SetDoLookup default true; property Options: TSynCompletionOptions read GetOptions write SetOptions default DefaultProposalOptions; end; @@ -544,33 +532,30 @@ TProposalColumns = class(TCollection) function GetItem(Index: Integer): TProposalColumn; procedure SetItem(Index: Integer; Value: TProposalColumn); protected - function GetOwner: TPersistent; {$IFDEF SYN_COMPILER_3_UP} override; {$ENDIF} + function GetOwner: TPersistent; override; public constructor Create(AOwner: TPersistent; ItemClass: TCollectionItemClass); function Add: TProposalColumn; - {$IFDEF SYN_COMPILER_3_UP} function FindItemID(ID: Integer): TProposalColumn; - {$ENDIF} - {$IFDEF SYN_COMPILER_4_UP} function Insert(Index: Integer): TProposalColumn; - {$ENDIF} property Items[Index: Integer]: TProposalColumn read GetItem write SetItem; default; end; -procedure FormattedTextOut(TargetCanvas: TCanvas; const Rect: TRect; - const Text: UnicodeString; Selected: Boolean; Columns: TProposalColumns; Images: TImageList); -function FormattedTextWidth(TargetCanvas: TCanvas; const Text: UnicodeString; - Columns: TProposalColumns; Images: TImageList): Integer; -function PrettyTextToFormattedString(const APrettyText: UnicodeString; - AlternateBoldStyle: Boolean {$IFDEF SYN_COMPILER_4_UP} = False {$ENDIF}): UnicodeString; +procedure FormattedTextOut(TargetCanvas: TCanvas; const Rect: TRect; PPI: Integer; + const Text: string; Selected: Boolean; Columns: TProposalColumns; Images: TCustomImageList); +function FormattedTextWidth(TargetCanvas: TCanvas; const Text: string; PPI: Integer; + Columns: TProposalColumns; Images: TCustomImageList): Integer; +function PrettyTextToFormattedString(const APrettyText: string; + AlternateBoldStyle: Boolean = False): string; implementation uses -{$IFDEF SYN_COMPILER_4_UP} - Math, -{$ENDIF} + System.Math, + Vcl.Themes, + System.Types, + System.UITypes, SynEditTextBuffer, SynEditMiscProcs, SynEditKeyConst; @@ -586,7 +571,7 @@ implementation PFormatChunk = ^TFormatChunk; TFormatChunk = record - Str: UnicodeString; + Str: string; Command: TFormatCommand; Data: Pointer; end; @@ -667,12 +652,12 @@ procedure TFormatChunkList.Add(AChunk: PFormatChunk); end; -function ParseFormatChunks(const FormattedString: UnicodeString; ChunkList: TFormatChunkList; +function ParseFormatChunks(const FormattedString: string; ChunkList: TFormatChunkList; const StripCommands: TFormatCommands): Boolean; var CurChar: WideChar; CurPos: Integer; - CurrentChunk: UnicodeString; + CurrentChunk: string; PossibleErrorPos: Integer; ErrorFound: Boolean; @@ -715,8 +700,8 @@ function ParseFormatChunks(const FormattedString: UnicodeString; ChunkList: TFor procedure ParseEscapeSequence; var - Command: UnicodeString; - Parameter: UnicodeString; + Command: string; + Parameter: string; CommandType: TFormatCommand; Data: Pointer; begin @@ -752,7 +737,7 @@ function ParseFormatChunks(const FormattedString: UnicodeString; ChunkList: TFor if CurChar = '}' then begin - Command := SynWideUpperCase(Command); + Command := System.SysUtils.AnsiUpperCase(Command); Data := nil; CommandType := fcNoCommand; @@ -800,14 +785,14 @@ function ParseFormatChunks(const FormattedString: UnicodeString; ChunkList: TFor begin if (Length(Parameter) = 2) and CharInSet(Parameter[1], ['+', '-', '~']) - and CharInSet(SynWideUpperCase(Parameter[2])[1], + and CharInSet(System.SysUtils.AnsiUpperCase(Parameter[2])[1], ['B', 'I', 'U', 'S']) then begin CommandType := fcStyle; if not (fcStyle in StripCommands) then begin Data := New(PFormatStyleData); - PFormatStyleData(Data)^.Style := SynWideUpperCase(Parameter[2])[1]; + PFormatStyleData(Data)^.Style := System.SysUtils.AnsiUpperCase(Parameter[2])[1]; case Parameter[1] of '+': PFormatStyleData(Data)^.Action := 1; '-': PFormatStyleData(Data)^.Action := -1; @@ -865,7 +850,7 @@ function ParseFormatChunks(const FormattedString: UnicodeString; ChunkList: TFor end; -function StripFormatCommands(const FormattedString: UnicodeString): UnicodeString; +function StripFormatCommands(const FormattedString: string): string; var Chunks: TFormatChunkList; i: Integer; @@ -884,8 +869,8 @@ function StripFormatCommands(const FormattedString: UnicodeString): UnicodeStrin end; -function PaintChunks(TargetCanvas: TCanvas; const Rect: TRect; - ChunkList: TFormatChunkList; Columns: TProposalColumns; Images: TImageList; +function PaintChunks(TargetCanvas: TCanvas; const Rect: TRect; PPI: Integer; + ChunkList: TFormatChunkList; Columns: TProposalColumns; Images: TCustomImageList; Invisible: Boolean): Integer; var i: Integer; @@ -925,15 +910,15 @@ function PaintChunks(TargetCanvas: TCanvas; const Rect: TRect; fcNoCommand: begin if not Invisible then - TextOut(TargetCanvas, X, Rect.Top, C^.Str); + TargetCanvas.TextOut(X, Rect.Top, C^.Str); - Inc(X, TextWidth(TargetCanvas, C^.Str)); + Inc(X, TargetCanvas.TextWidth(C^.Str)); if X > Rect.Right then Break; end; fcColor: if not Invisible then - TargetCanvas.Font.Color := TColor(C^.Data); + TargetCanvas.Font.Color := StyleServices.GetSystemColor(TColor(C^.Data)); fcStyle: begin case PFormatStyleData(C^.Data)^.Style of @@ -960,7 +945,7 @@ function PaintChunks(TargetCanvas: TCanvas; const Rect: TRect; begin if CurrentColumnIndex <= Columns.Count -1 then begin - Inc(LastColumnStart, CurrentColumn.FColumnWidth); + Inc(LastColumnStart, MulDiv(CurrentColumn.FColumnWidth, PPI, 96)); X := LastColumnStart; Inc(CurrentColumnIndex); @@ -974,7 +959,7 @@ function PaintChunks(TargetCanvas: TCanvas; const Rect: TRect; end; fcHSpace: begin - Inc(X, Integer(C^.Data)); + Inc(X, MulDiv(Integer(C^.Data), PPI, 96)); if X > Rect.Right then Break; end; @@ -999,8 +984,8 @@ function PaintChunks(TargetCanvas: TCanvas; const Rect: TRect; end; end; -procedure FormattedTextOut(TargetCanvas: TCanvas; const Rect: TRect; - const Text: UnicodeString; Selected: Boolean; Columns: TProposalColumns; Images: TImageList); +procedure FormattedTextOut(TargetCanvas: TCanvas; const Rect: TRect; PPI: Integer; + const Text: string; Selected: Boolean; Columns: TProposalColumns; Images: TCustomImageList); var Chunks: TFormatChunkList; StripCommands: TFormatCommands; @@ -1013,14 +998,14 @@ procedure FormattedTextOut(TargetCanvas: TCanvas; const Rect: TRect; StripCommands := []; ParseFormatChunks(Text, Chunks, StripCommands); - PaintChunks(TargetCanvas, Rect, Chunks, Columns, Images, False); + PaintChunks(TargetCanvas, Rect, PPI, Chunks, Columns, Images, False); finally Chunks.Free; end; end; -function FormattedTextWidth(TargetCanvas: TCanvas; const Text: UnicodeString; - Columns: TProposalColumns; Images: TImageList): Integer; +function FormattedTextWidth(TargetCanvas: TCanvas; const Text: string; PPI: Integer; + Columns: TProposalColumns; Images: TCustomImageList): Integer; var Chunks: TFormatChunkList; TmpRect: TRect; @@ -1030,18 +1015,18 @@ function FormattedTextWidth(TargetCanvas: TCanvas; const Text: UnicodeString; TmpRect := Rect(0, 0, MaxInt, MaxInt); ParseFormatChunks(Text, Chunks, [fcColor]); - Result := PaintChunks(TargetCanvas, TmpRect, Chunks, Columns, Images, True); + Result := PaintChunks(TargetCanvas, TmpRect, PPI, Chunks, Columns, Images, True); finally Chunks.Free; end; end; -function PrettyTextToFormattedString(const APrettyText: UnicodeString; - AlternateBoldStyle: Boolean {$IFDEF SYN_COMPILER_4_UP} = False {$ENDIF}): UnicodeString; +function PrettyTextToFormattedString(const APrettyText: string; + AlternateBoldStyle: Boolean = False): string; var i: Integer; Color: TColor; -Begin +begin Result := ''; i := 1; while i <= Length(APrettyText) do @@ -1058,7 +1043,7 @@ function PrettyTextToFormattedString(const APrettyText: UnicodeString; end; #3: begin - if CharInSet(SynWideUpperCase(APrettyText[i + 1])[1], ['B', 'I', 'U']) then + if CharInSet(System.SysUtils.AnsiUpperCase(APrettyText[i + 1])[1], ['B', 'I', 'U']) then begin Result := Result + '\style{'; @@ -1119,9 +1104,6 @@ procedure TProposalColumn.Assign(Source: TPersistent); procedure TProposalColumn.DefineProperties(Filer: TFiler); begin inherited; -{$IFNDEF UNICODE} - UnicodeDefineProperties(Filer, Self); -{$ENDIF} end; constructor TProposalColumns.Create(AOwner: TPersistent; ItemClass: TCollectionItemClass); @@ -1150,34 +1132,28 @@ function TProposalColumns.Add: TProposalColumn; Result := inherited Add as TProposalColumn; end; - -{$IFDEF SYN_COMPILER_3_UP} function TProposalColumns.FindItemID(ID: Integer): TProposalColumn; begin Result := inherited FindItemID(ID) as TProposalColumn; end; -{$ENDIF} -{$IFDEF SYN_COMPILER_4_UP} function TProposalColumns.Insert(Index: Integer): TProposalColumn; begin Result := inherited Insert(Index) as TProposalColumn; end; -{$ENDIF} //============================================================================ -//Moved from completion component -function FormatParamList(const S: UnicodeString; CurrentIndex: Integer): UnicodeString; +function FormatParamList(const S: string; CurrentIndex: Integer): string; var i: Integer; - List: TUnicodeStrings; + List: TStrings; begin Result := ''; - List := TUnicodeStringList.Create; + List := TStringList.Create; try List.CommaText := S; for i := 0 to List.Count - 1 do @@ -1195,53 +1171,62 @@ function FormatParamList(const S: UnicodeString; CurrentIndex: Integer): Unicode List.Free; end; end; -// End GBN 10/11/2001 { TSynBaseCompletionProposalForm } constructor TSynBaseCompletionProposalForm.Create(AOwner: TComponent); begin - FResizeable := True; -{$IFDEF SYN_CPPB_1} - CreateNew(AOwner, 0); -{$ELSE} CreateNew(AOwner); -{$ENDIF} - FBitmap := TBitmap.Create; + ControlStyle := ControlStyle + [csOpaque]; + BorderStyle := bsSingle; + BorderWidth := 1; + + FPaintBitmap := TBitmap.Create; FTitleBitmap := TBitmap.Create; - FItemList := TUnicodeStringList.Create; - FInsertList := TUnicodeStringList.Create; - FAssignedList := TUnicodeStringList.Create; + FItemList := TStringList.Create; + FInsertList := TStringList.Create; + FAssignedList := TStringList.Create; FMatchText := False; - FMatchTextAnywhere:= False; - BorderStyle := bsNone; + FScrollbar := TScrollBar.Create(Self); FScrollbar.Kind := sbVertical; FScrollbar.ParentCtl3D := False; FScrollbar.OnChange := ScrollbarOnChange; FScrollbar.OnScroll := ScrollbarOnScroll; FScrollbar.OnEnter := ScrollbarOnEnter; + FScrollbar.TabStop := False; FScrollbar.Parent := Self; - Visible := False; FTitleFont := TFont.Create; - FTitleFont.Name := 'MS Sans Serif'; - FTitleFont.Size := 8; FTitleFont.Style := [fsBold]; FTitleFont.Color := clBtnText; + FTitleFont.PixelsPerInch := Screen.DefaultPixelsPerInch; + FTitleFont.Size := Application.DefaultFont.Size; + {$IF CompilerVersion >= 36} + FTitleFont.IsScreenFont := True; + {$IFEND CompilerVersion >= 36} FFont := TFont.Create; - FFont.Name := 'MS Sans Serif'; - FFont.Size := 8; + FFont.PixelsPerInch := Screen.DefaultPixelsPerInch; + FFont.Size := Application.DefaultFont.Size; + {$IF CompilerVersion >= 36} + FFont.IsScreenFont := True; + {$IFEND CompilerVersion >= 36} + + FGripperFont := TFont.Create; + FGripperFont.Color := clBtnText; + FGripperFont.PixelsPerInch := Screen.DefaultPixelsPerInch; + FGripperFont.Size := Application.DefaultFont.Size; + {$IF CompilerVersion >= 36} + FGripperFont.IsScreenFont := True; + {$IFEND CompilerVersion >= 36} ClSelect := clHighlight; ClSelectedText := clHighlightText; ClBackground := clWindow; - ClBackgroundBorder := clBtnFace; ClTitleBackground := clBtnFace; - - (FItemList as TUnicodeStringList).OnChange := StringListChange; // Really necessary? It seems to work + (FItemList as TStringList).OnChange := StringListChange; // Really necessary? It seems to work FTitle := ''; // fine without it FUseInsertList := False; FFormattedText := False; @@ -1250,107 +1235,97 @@ constructor TSynBaseCompletionProposalForm.Create(AOwner: TComponent); FColumns := TProposalColumns.Create(AOwner, TProposalColumn); + FGripperHeight := 0; FItemHeight := 0; FMargin := 2; FEffectiveItemHeight := 0; - RecalcItemHeight; - - Canvas.Font.Assign(FTitleFont); - FTitleFontHeight := TextHeight(Canvas, TextHeightString); - FHeightBuffer := 0; - - FTitleFont.OnChange := TitleFontChange; - FFont.OnChange := FontChange; OnDblClick := DoDoubleClick; OnShow := DoFormShow; OnHide := DoFormHide; + + StyleElements := [seClient]; + Resizeable := False; + Visible := False; end; procedure TSynBaseCompletionProposalForm.CreateParams(var Params: TCreateParams); -const - CS_DROPSHADOW = $20000; -{$IFNDEF SYN_COMPILER_3_UP} -var - VersionInfo: TOSVersionInfo; -{$ENDIF} begin inherited; with Params do begin - Style := WS_POPUP; + { + WS_THICKFRAME causes Windows 10 to display a 6 pixel title bar + Also with VCL Styles and WS_BORDER the window is not resizable + So we use WS_BORDER and make the window sizeable by handling WM_NCHITTEST + } + Style := WS_POPUP or WS_BORDER or WS_CLIPCHILDREN; ExStyle := WS_EX_TOOLWINDOW; - {$IFDEF SYN_COMPILER_3_UP} - if ((Win32Platform and VER_PLATFORM_WIN32_NT) <> 0) - and (Win32MajorVersion > 4) - and (Win32MinorVersion > 0) {Windows XP} then - {$ELSE} - VersionInfo.dwOSVersionInfoSize := sizeof(TOSVersionInfo); - if GetVersionEx(VersionInfo) - and ((VersionInfo.dwPlatformId and VER_PLATFORM_WIN32_NT) <> 0) - and (VersionInfo.dwMajorVersion > 4) - and (VersionInfo.dwMinorVersion > 0) {Windows XP} then - {$ENDIF} - Params.WindowClass.style := Params.WindowClass.style or CS_DROPSHADOW; - - if DisplayType = ctCode then - if FResizeable then - Style := Style or WS_THICKFRAME - else - Style := Style or WS_DLGFRAME; - end; -end; - -procedure TSynBaseCompletionProposalForm.CreateWnd; -begin - inherited; - - if not (csDesigning in ComponentState) then - begin - // "redefine" window-procedure to get Unicode messages - if Win32Platform = VER_PLATFORM_WIN32_NT then - SetWindowLongW(Handle, GWL_WNDPROC, Integer(GetWindowLongA(Handle, GWL_WNDPROC))); + // Only affects the first time you create the handle + // https://stackoverflow.com/questions/44521877/window-class-style-cs-noclose-does-not-work-after-calling-to-recreatewnd + if (Owner as TSynBaseCompletionProposal).PaintFormShadow then + WindowClass.style := WindowClass.style or CS_DROPSHADOW; end; end; procedure TSynBaseCompletionProposalForm.Activate; begin Visible := True; - if DisplayType = ctCode then + if (DisplayType = ctCode) and Assigned(CurrentEditor) then (CurrentEditor as TCustomSynEdit).AddFocusControl(Self); end; procedure TSynBaseCompletionProposalForm.Deactivate; begin - if (DisplayType = ctCode) then + if (DisplayType = ctCode) and Assigned(CurrentEditor) then begin (CurrentEditor as TCustomSynEdit).RemoveFocusControl(Self); - Visible := False; + Visible := False; + end; end; destructor TSynBaseCompletionProposalForm.Destroy; begin inherited Destroy; FColumns.Free; - FBitmap.Free; + FPaintBitmap.Free; FTitleBitmap.Free; FItemList.Free; FInsertList.Free; FAssignedList.Free; FTitleFont.Free; FFont.Free; + FGripperFont.Free; end; procedure TSynBaseCompletionProposalForm.KeyDown(var Key: Word; Shift: TShiftState); var C: WideChar; -begin + Cmd: TSynEditorCommand; + i: Integer; + + procedure ExecuteCmdAndCancel; + begin + if Cmd <> ecNone then begin + if Assigned(CurrentEditor) then + (CurrentEditor as TCustomSynEdit).CommandProcessor(Cmd, #0, nil); + + if Assigned(OnCancel) then + OnCancel(Self); + end; + end; +begin if DisplayType = ctCode then begin + i := (CurrentEditor as TCustomSynEdit).Keystrokes.FindKeycode(Key, Shift); + if i >= 0 then + Cmd := TCustomSynEdit(CurrentEditor).Keystrokes[i].Command + else + Cmd := ecNone; case Key of SYNEDIT_RETURN: if (FCompleteWithEnter) and Assigned(OnValidate) then - OnValidate(Self, Shift, #0); + OnValidate(Self, Shift, #0); SYNEDIT_TAB: if (FCompleteWithTab) and Assigned(OnValidate) then OnValidate(Self, Shift, #0); @@ -1360,6 +1335,7 @@ procedure TSynBaseCompletionProposalForm.KeyDown(var Key: Word; Shift: TShiftSta OnCancel(Self); end; SYNEDIT_LEFT: + if (Shift = []) then begin if Length(FCurrentString) > 0 then begin @@ -1377,8 +1353,10 @@ procedure TSynBaseCompletionProposalForm.KeyDown(var Key: Word; Shift: TShiftSta if Assigned(OnCancel) then OnCancel(Self); end; - end; + end else + ExecuteCmdAndCancel; SYNEDIT_RIGHT: + if (Shift = []) then begin if Assigned(CurrentEditor) then with CurrentEditor as TCustomSynEdit do @@ -1397,7 +1375,8 @@ procedure TSynBaseCompletionProposalForm.KeyDown(var Key: Word; Shift: TShiftSta CommandProcessor(ecRight, #0, nil); end; - end; + end else + ExecuteCmdAndCancel; SYNEDIT_PRIOR: MoveLine(-FLinesInWindow); SYNEDIT_NEXT: @@ -1410,12 +1389,12 @@ procedure TSynBaseCompletionProposalForm.KeyDown(var Key: Word; Shift: TShiftSta if ssCtrl in Shift then Position := 0 else - MoveLine(-1, True); + MoveLine(-1); SYNEDIT_DOWN: if ssCtrl in Shift then Position := FAssignedList.Count - 1 else - MoveLine(1, True); + MoveLine(1); SYNEDIT_BACK: if (Shift = []) then begin @@ -1436,26 +1415,21 @@ procedure TSynBaseCompletionProposalForm.KeyDown(var Key: Word; Shift: TShiftSta if Assigned(OnCancel) then OnCancel(Self); end; - end; - SYNEDIT_DELETE: if Assigned(CurrentEditor) then - (CurrentEditor as TCustomSynEdit).CommandProcessor(ecDeleteChar, #0, nil); + end else + ExecuteCmdAndCancel; + SYNEDIT_DELETE: + if Assigned(CurrentEditor) then + (CurrentEditor as TCustomSynEdit).CommandProcessor(ecDeleteChar, #0, nil); + else + ExecuteCmdAndCancel; end; end; - Invalidate; end; procedure TSynBaseCompletionProposalForm.KeyPress(var Key: Char); begin -end; - -procedure TSynBaseCompletionProposalForm.DoKeyPressW(Key: WideChar); -begin - if Key <> #0 then - KeyPressW(Key); -end; + if Key = #0 then Exit; -procedure TSynBaseCompletionProposalForm.KeyPressW(var Key: WideChar); -begin if DisplayType = ctCode then begin case Key of @@ -1464,9 +1438,9 @@ procedure TSynBaseCompletionProposalForm.KeyPressW(var Key: WideChar); begin if IsWordBreakChar(Key) and Assigned(OnValidate) then begin - if Key = #32 then - OnValidate(Self, [], #0) - else + //if Key = #32 then + // OnValidate(Self, [], #0) + //else OnValidate(Self, [], Key); end; @@ -1486,204 +1460,235 @@ procedure TSynBaseCompletionProposalForm.KeyPressW(var Key: WideChar); OnCancel(Self); end; end; - Invalidate; + Invalidate; end; procedure TSynBaseCompletionProposalForm.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin - y := (y - FHeightBuffer) div FEffectiveItemHeight; + y := (y - FTitleHeight) div FEffectiveItemHeight; Position := FScrollbar.Position + y; // (CurrentEditor as TCustomSynEdit).UpdateCaret; end; -{$IFDEF SYN_DELPHI_4_UP} -function TSynBaseCompletionProposalForm.CanResize(var NewWidth, NewHeight: Integer): Boolean; -var - NewLinesInWindow: Integer; - BorderWidth: Integer; - tmpHeight : Integer; -begin - Result := True; - case FDisplayKind of - ctCode: - begin - BorderWidth := 2 * GetSystemMetrics(SM_CYSIZEFRAME); - - if FEffectiveItemHeight <> 0 then - begin - tmpHeight := NewHeight - BorderWidth; - NewLinesInWindow := (tmpHeight - FHeightBuffer) div FEffectiveItemHeight; - - if NewLinesInWindow < 1 then - NewLinesInWindow := 1; - end - else - NewLinesInWindow := 0; - - FLinesInWindow := NewLinesInWindow; - - NewHeight := FEffectiveItemHeight * FLinesInWindow + FHeightBuffer + BorderWidth; - - if (NewWidth-BorderWidth) < FScrollbar.Width then - NewWidth := FScrollbar.Width + BorderWidth; - end; - ctHint:; - ctParams:; - end; -end; -{$ENDIF} - procedure TSynBaseCompletionProposalForm.Resize; begin inherited; + if Owner.ComponentState * [csDesigning, csLoading] <> [] then + Exit; + + AdjustMetrics; + if FEffectiveItemHeight <> 0 then - FLinesInWindow := (Height - FHeightBuffer) div FEffectiveItemHeight; + FLinesInWindow := (ClientHeight - FTitleHeight - FGripperHeight) div FEffectiveItemHeight; - if not(csCreating in ControlState) then - AdjustMetrics; + if Visible then + AdjustScrollBarPosition; - AdjustScrollBarPosition; Invalidate; end; +procedure TSynBaseCompletionProposalForm.ResetCanvas(const Canvas: TCanvas); +begin + with Canvas do + begin + Pen.Color := StyleServices.GetSystemColor(FClBackGround); + Brush.Color := Pen.Color; + Brush.Style := bsSolid; + Canvas.Font.PixelsPerInch := GetCurrentPPI; + Font.Assign(FFont); + Font.Color := StyleServices.GetSystemColor(FFont.Color); + end; +end; procedure TSynBaseCompletionProposalForm.Paint; - - procedure ResetCanvas; - begin - with FBitmap.Canvas do +begin + case FDisplayKind of + ctCode: begin - Pen.Color := FClBackGround; - Brush.Color := FClBackGround; - Font.Assign(FFont); + Canvas.Font.PixelsPerInch := GetCurrentPPI; + PaintTitle; + PaintCodeItems; + PaintGripper; end; + ctHint: PaintHint; + ctParams: PaintParams; end; +end; -const - TitleMargin = 2; +procedure TSynBaseCompletionProposalForm.PaintCodeItems; var - TmpRect: TRect; - TmpX: Integer; AlreadyDrawn: Boolean; - TmpString: UnicodeString; i: Integer; begin - if FDisplayKind = ctCode then + with FPaintBitmap do begin - with FBitmap do + ResetCanvas(FPaintBitmap.Canvas); + Canvas.FillRect(Rect(0, 0, FPaintBitmap.Width, FPaintBitmap.Height)); + for i := 0 to Min(FLinesInWindow - 1, FAssignedList.Count - 1) do begin - ResetCanvas; - Canvas.Pen.Color := FClBackgroundBorder; - Canvas.Rectangle(0, 0, ClientWidth - FScrollbar.Width, ClientHeight); - for i := 0 to Min(FLinesInWindow - 1, FAssignedList.Count - 1) do + if i + FScrollbar.Position = Position then begin - if i + FScrollbar.Position = Position then - begin - Canvas.Brush.Color := FClSelect; - Canvas.Pen.Color := FClSelect; - Canvas.Rectangle(0, FEffectiveItemHeight * i, ClientWidth - FScrollbar.Width, - FEffectiveItemHeight * (i + 1)); - Canvas.Pen.Color := FClSelectText; - Canvas.Font.Assign(FFont); - Canvas.Font.Color := FClSelectText; - end; + Canvas.Brush.Color := StyleServices.GetSystemColor(FClSelect); + Canvas.Pen.Color := StyleServices.GetSystemColor(FClSelect); + Canvas.Rectangle(0, (FEffectiveItemHeight * i), ClientWidth - FScrollbar.Width, (FEffectiveItemHeight * (i + 1))); + Canvas.Font.Assign(FFont); + Canvas.Font.Color := StyleServices.GetSystemColor(fClSelectText); + end; - AlreadyDrawn := False; + AlreadyDrawn := False; - if Assigned(OnPaintItem) then - OnPaintItem(Self, LogicalToPhysicalIndex(FScrollbar.Position + i), - Canvas, Rect(0, FEffectiveItemHeight * i, ClientWidth - FScrollbar.Width, - FEffectiveItemHeight * (i + 1)), AlreadyDrawn); + if Assigned(OnPaintItem) then + OnPaintItem(Self, LogicalToPhysicalIndex(FScrollBar.Position + i), + Canvas, Rect(0, (FEffectiveItemHeight * i), ClientWidth - FScrollbar.Width, (FEffectiveItemHeight * (i + 1))), AlreadyDrawn); - if AlreadyDrawn then - ResetCanvas + if AlreadyDrawn then + ResetCanvas(FPaintBitmap.Canvas) + else + begin + if FFormattedText then + begin + FormattedTextOut(Canvas, + Rect(FScaledMargin, (FEffectiveItemHeight * i) + ((FEffectiveItemHeight - FFontHeight) div 2), FPaintBitmap.Width, FEffectiveItemHeight * (i + 1)), + GetCurrentPPI, FAssignedList[FScrollbar.Position + i], + (i + FScrollbar.Position = Position), FColumns, FImages); + end else begin - if FFormattedText then - begin - FormattedTextOut(Canvas, Rect(FMargin, - FEffectiveItemHeight * i + ((FEffectiveItemHeight - FFontHeight) div 2), - FBitmap.Width, FEffectiveItemHeight * (i + 1)), - FAssignedList[FScrollbar.Position + i], - (i + FScrollbar.Position = Position), FColumns, FImages); - end - else - begin - TextOut(Canvas, FMargin, FEffectiveItemHeight * i, - FAssignedList[FScrollbar.Position + i]); - end; - - if i + FScrollbar.Position = Position then - ResetCanvas; + Canvas.TextOut(FScaledMargin, FEffectiveItemHeight * i, FAssignedList[FScrollbar.Position + i]); end; + + if i + FScrollbar.Position = Position then + ResetCanvas(FPaintBitmap.Canvas); end; end; - Canvas.Draw(0, FHeightBuffer, FBitmap); + end; + Canvas.Draw(0, FTitleHeight, FPaintBitmap); +end; - if FTitle <> '' then +procedure TSynBaseCompletionProposalForm.PaintGripper; +var + Details: TThemedElementDetails; + LStyle: TCustomStyleServices; + GripperRect: TRect; + GripperBarRect: TRect; + ScaledGripSize: Integer; + TextRect: TRect; +begin + if FGripperHeight > 0 then + begin + GripperBarRect := TRect.Create(0, ClientHeight - FGripperHeight, ClientWidth, ClientHeight); + ScaledGripSize := MulDiv(cGripperBarHeight, GetCurrentPPI, 96); + GripperRect := TRect.Create(ClientWidth - ScaledGripSize, ClientHeight - ScaledGripSize, ClientWidth, ClientHeight); + + Canvas.Brush.Color := StyleServices.GetSystemColor(FClTitleBackground); + Canvas.FillRect(GripperBarRect); + Canvas.Pen.Color := StyleServices.GetSystemColor(clBtnShadow); + Canvas.PenPos := GripperBarRect.TopLeft; + Canvas.LineTo(GripperBarRect.Right,GripperBarRect.Top); + LStyle := StyleServices; + + //Draw gripper. + if StyleServices.Available then begin - with FTitleBitmap do + details := StyleServices(Self).GetElementDetails(tsGripper); + LStyle.DrawElement(Canvas.Handle, Details, GripperRect, nil, GetCurrentPPI); + end; + + if FGripperText <> '' then + begin + textRect := TRect.Create(0, ClientHeight - ScaledGripSize, ClientWidth - ScaledGripSize, ClientHeight); + textRect.Inflate(-FScaledMargin, 0); + Canvas.Font.Assign(FGripperFont); + Canvas.Brush.Style := bsClear; + Canvas.TextRect(textRect, FGripperText, [tfSingleLine, tfVerticalCenter]); + Canvas.Brush.Style := bsSolid; + end; + end; +end; + +procedure TSynBaseCompletionProposalForm.PaintHint; +begin + PaintParams; //does the same right now so this is just to make it easier if they diverge. +end; + +procedure TSynBaseCompletionProposalForm.PaintParams; +var + TmpRect: TRect; + AlreadyDrawn: Boolean; + TmpString: string; + i: Integer; +begin + ResetCanvas(FPaintBitmap.Canvas); + with FPaintBitmap do + begin + TmpRect := Rect(0, 0, ClientWidth, ClientHeight); + Canvas.FillRect(TmpRect); + + for i := 0 to FAssignedList.Count - 1 do + begin + AlreadyDrawn := False; + if Assigned(OnPaintItem) then + OnPaintItem(Self, i, Canvas, Rect(0, FEffectiveItemHeight * i + FScaledMargin, + ClientWidth, FEffectiveItemHeight * (i + 1) + FScaledMargin), AlreadyDrawn); + + if AlreadyDrawn then + ResetCanvas(FPaintBitmap.Canvas) + else begin - Canvas.Brush.Color := FClTitleBackground; - TmpRect := Rect(0, 0, ClientWidth + 1, FHeightBuffer); - Canvas.FillRect(TmpRect); - Canvas.Pen.Color := clBtnShadow; - Dec(TmpRect.Bottom, 1); - Canvas.PenPos := TmpRect.BottomRight; - Canvas.LineTo(TmpRect.Left - 1,TmpRect.Bottom); - Canvas.Pen.Color := clBtnFace; - - Canvas.Font.Assign(FTitleFont); - - if CenterTitle then - begin - TmpX := (Width - TextWidth(Canvas, Title)) div 2; - if TmpX < TitleMargin then - TmpX := TitleMargin; //We still want to be able to read it, even if it does go over the edge - end else - begin - TmpX := TitleMargin; - end; - TextRect(Canvas, TmpRect, TmpX, TitleMargin - 1, FTitle); // -1 because TmpRect.Top is already 1 + if (FDisplayKind = ctParams) then + TmpString := FormatParamList(FAssignedList[i], CurrentIndex) + else + TmpString := FAssignedList[i]; + + FormattedTextOut(Canvas, Rect(FScaledMargin + 1, + FEffectiveItemHeight * i + ((FEffectiveItemHeight-FFontHeight) div 2) + FScaledMargin, + FPaintBitmap.Width - 1, FEffectiveItemHeight * (i + 1) + FScaledMargin), GetCurrentPPI, TmpString, + False, nil, FImages); end; - Canvas.Draw(0, 0, FTitleBitmap); end; - end else - if (FDisplayKind = ctHint) or (FDisplayKind = ctParams) then + end; + Canvas.Draw(0, 0, FPaintBitmap); +end; + +procedure TSynBaseCompletionProposalForm.PaintTitle; +var + TmpRect: TRect; + TmpX: Integer; + TitleRect: TRect; +begin + if FTitle <> '' then begin - with FBitmap do + TitleRect := TRect.Create(0,0,ClientWidth, FTitleHeight); + ResetCanvas(FTitleBitmap.Canvas); + with FTitleBitmap do begin - ResetCanvas; - tmpRect := Rect(0, 0, ClientWidth, ClientHeight); - Canvas.FillRect(tmpRect); - Frame3D(Canvas, tmpRect, cl3DLight, cl3DDkShadow, 1); + Canvas.Brush.Color := StyleServices.GetSystemColor(FClTitleBackground); + Canvas.FillRect(TitleRect); + Canvas.Font.Assign(FTitleFont); + Canvas.Font.Color := StyleServices.GetSystemColor(FTitleFont.Color); - for i := 0 to FAssignedList.Count - 1 do + if CenterTitle then + begin + TmpX := (Width - Canvas.TextWidth(Title)) div 2; + if TmpX < FScaledMargin then + TmpX := FScaledMargin; //We still want to be able to read it, even if it does go over the edge + end else begin - AlreadyDrawn := False; - if Assigned(OnPaintItem) then - OnPaintItem(Self, i, Canvas, Rect(0, FEffectiveItemHeight * i + FMargin, - ClientWidth, FEffectiveItemHeight * (i + 1) + FMargin), AlreadyDrawn); + TmpX := FScaledMargin; + end; + Canvas.TextRect(TitleRect, TmpX, FScaledMargin - 1, FTitle); // -1 because TmpRect.Top is already 1 - if AlreadyDrawn then - ResetCanvas - else - begin - if FDisplayKind = ctParams then - TmpString := FormatParamList(FAssignedList[i], CurrentIndex) - else - TmpString := FAssignedList[i]; - FormattedTextOut(Canvas, Rect(FMargin + 1, - FEffectiveItemHeight * i + ((FEffectiveItemHeight-FFontHeight) div 2) + FMargin, - FBitmap.Width - 1, FEffectiveItemHeight * (i + 1) + FMargin), TmpString, - False, nil, FImages); - end; - end; + TmpRect := TitleRect; + Dec(TmpRect.Bottom, 1); + Canvas.Pen.Color := StyleServices.GetSystemColor(clBtnShadow); + Canvas.PenPos := TPoint.Create(TmpRect.Left, TmpRect.Bottom); + Canvas.LineTo(TmpRect.Right,TmpRect.Bottom); + end; - Canvas.Draw(0, 0, FBitmap); + Canvas.Draw(0, 0, FTitleBitmap); end; end; @@ -1695,12 +1700,12 @@ procedure TSynBaseCompletionProposalForm.ScrollbarOnChange(Sender: TObject); if Position > FScrollbar.Position + FLinesInWindow - 1 then Position := FScrollbar.Position + FLinesInWindow - 1 else - Repaint; + Invalidate; end; procedure TSynBaseCompletionProposalForm.ScrollbarOnScroll(Sender: TObject; ScrollCode: TScrollCode; var ScrollPos: Integer); -begin +begin with CurrentEditor as TCustomSynEdit do begin SetFocus; @@ -1716,27 +1721,13 @@ procedure TSynBaseCompletionProposalForm.ScrollbarOnEnter(Sender: TObject); ActiveControl := nil; end; -procedure TSynBaseCompletionProposalForm.MoveLine(cnt: Integer; const WrapAround: Boolean = False); +procedure TSynBaseCompletionProposalForm.MoveLine(cnt: Integer); var - NewPosition: Integer; + NewPos: Integer; begin - NewPosition := Position + cnt; - if (NewPosition < 0) then - begin - if WrapAround then - NewPosition := FAssignedList.Count + NewPosition - else - NewPosition := 0; - end - else if (NewPosition >= FAssignedList.Count) then - begin - if WrapAround then - NewPosition := NewPosition - FAssignedList.Count - else - NewPosition := FAssignedList.Count - 1; - end; - - Position := NewPosition + NewPos := EnsureRange(Position + cnt, 0, FAssignedList.Count - 1); + if NewPos <> Position then + Position := NewPos; end; function TSynBaseCompletionProposalForm.LogicalToPhysicalIndex(Index: Integer): Integer; @@ -1744,11 +1735,11 @@ function TSynBaseCompletionProposalForm.LogicalToPhysicalIndex(Index: Integer): if FMatchText and (Index >= 0) and (Index < FAssignedList.Count) then Result := Integer(FAssignedList.Objects[Index]) else - Result := Index; + Result := -1; end; function TSynBaseCompletionProposalForm.PhysicalToLogicalIndex(Index: Integer): Integer; -var i : Integer; +var i: Integer; begin if FMatchText then begin @@ -1763,66 +1754,23 @@ function TSynBaseCompletionProposalForm.PhysicalToLogicalIndex(Index: Integer): Result := Index; end; -procedure TSynBaseCompletionProposalForm.SetCurrentString(const Value: UnicodeString); -var - MinPosition, ValuePosition, MinIndex: Integer; +procedure TSynBaseCompletionProposalForm.SetCurrentString(const Value: string); - function MatchItem(AIndex: Integer; UseItemList: Boolean): Boolean; + function MatchItem(AIndex: Integer): Boolean; var - CompareString: UnicodeString; + CompareString: string; begin -{ if UseInsertList then + if UseInsertList then CompareString := FInsertList[AIndex] else begin CompareString := FItemList[AIndex]; - if UsePrettyText then - CompareString := StripFormatCommands(CompareString); - end;} - - if UseInsertList then - CompareString := FInsertList[aIndex] - else - begin - if (FMatchText) and (not UseItemList) then - CompareString := FAssignedList[aIndex] - else - CompareString := FItemList[aIndex]; - if UsePrettyText then CompareString := StripFormatCommands(CompareString); end; - if FMatchTextAnywhere then - begin - if Value <> '' then - begin - if FCase then - begin - ValuePosition := Pos(Value, CompareString); - Result := ValuePosition > 0 - end else - begin - ValuePosition := Pos(AnsiUpperCase(Value), AnsiUpperCase(CompareString)); - Result := ValuePosition > 0; - end; - if (ValuePosition > 0) and (ValuePosition < MinPosition) then - begin - MinPosition := ValuePosition; - MinIndex := FAssignedList.Count; - end; - end else - Result := True; - end else - begin - CompareString := Copy(CompareString, 1, Length(Value)); - - if FCase then - Result := WideCompareStr(CompareString, Value) = 0 - else - Result := WideCompareText(CompareString, Value) = 0; - end; + Result := CompareString.StartsWith(Value, not FCase); end; procedure RecalcList; @@ -1830,16 +1778,11 @@ procedure TSynBaseCompletionProposalForm.SetCurrentString(const Value: UnicodeSt i: Integer; begin FAssignedList.Clear; - MinPosition := MaxInt; - MinIndex := -1; - for i := 0 to FItemList.Count - 1 do + for i := 0 to FItemList.Count -1 do begin - if MatchItem(i, True) then + if MatchItem(i) then FAssignedList.AddObject(FItemList[i], TObject(i)); - end; - if MinIndex <> -1 then - Position := MinIndex; end; var @@ -1848,25 +1791,30 @@ procedure TSynBaseCompletionProposalForm.SetCurrentString(const Value: UnicodeSt FCurrentString := Value; if DisplayType <> ctCode then Exit; + + if not Visible then + begin + if FMatchText then + RecalcList; + Exit; + end; + if FMatchText then begin - if FMatchTextAnywhere then - Position := 0; RecalcList; AdjustScrollBarPosition; - if not FMatchTextAnywhere then - Position := 0; - - if Visible and Assigned(FOnChangePosition) and (DisplayType = ctCode) then + Position := 0; + + if Assigned(FOnChangePosition) and (DisplayType = ctCode) then FOnChangePosition(Owner as TSynBaseCompletionProposal, LogicalToPhysicalIndex(FPosition)); - - Repaint; + + Invalidate; end else begin i := 0; - while (i < ItemList.Count) and (not MatchItem(i, True)) do + while (i < ItemList.Count) and (not MatchItem(i)) do Inc(i); if i < ItemList.Count then @@ -1876,23 +1824,23 @@ procedure TSynBaseCompletionProposalForm.SetCurrentString(const Value: UnicodeSt end; end; -procedure TSynBaseCompletionProposalForm.SetItemList(const Value: TUnicodeStrings); +procedure TSynBaseCompletionProposalForm.SetItemList(const Value: TStrings); begin FItemList.Assign(Value); FAssignedList.Assign(Value); CurrentString := CurrentString; end; -procedure TSynBaseCompletionProposalForm.SetInsertList(const Value: TUnicodeStrings); +procedure TSynBaseCompletionProposalForm.SetInsertList(const Value: TStrings); begin FInsertList.Assign(Value); end; procedure TSynBaseCompletionProposalForm.DoDoubleClick(Sender: TObject); begin - // we need to do the same as the enter key; +//we need to do the same as the enter key; if DisplayType = ctCode then - if Assigned(OnValidate) then OnValidate(Self, [], #0); + if Assigned(OnValidate) then OnValidate(Self, [], #0); //GBN 15/11/2001 end; procedure TSynBaseCompletionProposalForm.SetPosition(const Value: Integer); @@ -1912,7 +1860,7 @@ procedure TSynBaseCompletionProposalForm.SetPosition(const Value: Integer); FOnChangePosition(Owner as TSynBaseCompletionProposal, LogicalToPhysicalIndex(FPosition)); - Repaint; + Invalidate; end; end; @@ -1925,20 +1873,15 @@ procedure TSynBaseCompletionProposalForm.SetResizeable(const Value: Boolean); procedure TSynBaseCompletionProposalForm.SetItemHeight(const Value: Integer); begin if Value <> FItemHeight then - begin FItemHeight := Value; - RecalcItemHeight; - end; end; -procedure TSynBaseCompletionProposalForm.SetImages(const Value: TImageList); +procedure TSynBaseCompletionProposalForm.SetImages(const Value: TCustomImageList); begin if FImages <> Value then begin - {$IFDEF SYN_COMPILER_5_UP} if Assigned(FImages) then FImages.RemoveFreeNotification(Self); - {$ENDIF SYN_COMPILER_5_UP} FImages := Value; if Assigned(FImages) then @@ -1946,13 +1889,14 @@ procedure TSynBaseCompletionProposalForm.SetImages(const Value: TImageList); end; end; - procedure TSynBaseCompletionProposalForm.RecalcItemHeight; begin + HandleNeeded; + Canvas.Font.PixelsPerInch := GetCurrentPPI; Canvas.Font.Assign(FFont); - FFontHeight := TextHeight(Canvas, TextHeightString); + FFontHeight := Canvas.TextHeight(TextHeightString); if FItemHeight > 0 then - FEffectiveItemHeight := FItemHeight + FEffectiveItemHeight := MulDiv(FItemHeight, GetCurrentPPI, 96) else begin FEffectiveItemHeight := FFontHeight; @@ -1973,29 +1917,15 @@ procedure TSynBaseCompletionProposalForm.WMMouseWheel(var Msg: TMessage); var nDelta: Integer; nWheelClicks: Integer; -{$IFNDEF SYN_COMPILER_4_UP} -const - LinesToScroll = 3; - WHEEL_DELTA = 120; - WHEEL_PAGESCROLL = MAXDWORD; - {$IFNDEF SYN_COMPILER_3_UP} - SPI_GETWHEELSCROLLLINES = 104; - {$ENDIF} -{$ENDIF} begin if csDesigning in ComponentState then Exit; -{$IFDEF SYN_COMPILER_4_UP} if GetKeyState(VK_CONTROL) >= 0 then nDelta := Mouse.WheelScrollLines -{$ELSE} - if GetKeyState(VK_CONTROL) >= 0 then - SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, @nDelta, 0) -{$ENDIF} else nDelta := FLinesInWindow; - Inc(FMouseWheelAccumulator, SmallInt(Msg.wParamHi)); - nWheelClicks := FMouseWheelAccumulator div WHEEL_DELTA; - FMouseWheelAccumulator := FMouseWheelAccumulator mod WHEEL_DELTA; + Inc(fMouseWheelAccumulator, SmallInt(Msg.wParamHi)); + nWheelClicks := fMouseWheelAccumulator div WHEEL_DELTA; + fMouseWheelAccumulator := fMouseWheelAccumulator mod WHEEL_DELTA; if (nDelta = Integer(WHEEL_PAGESCROLL)) or (nDelta > FLinesInWindow) then nDelta := FLinesInWindow; @@ -2003,7 +1933,53 @@ procedure TSynBaseCompletionProposalForm.WMMouseWheel(var Msg: TMessage); // (CurrentEditor as TCustomSynEdit).UpdateCaret; end; -function GetMDIParent (const Form: TSynForm): TSynForm; +procedure TSynBaseCompletionProposalForm.WMNCHitTest(var Message: TWMNCHitTest); +// Makes the form resizable +var + D: Integer; + P: TPoint; +begin + if not (FResizeable and (DisplayType = ctCode)) then + begin + inherited; + Exit; + end; + + D := GetSystemMetrics(SM_CXSIZEFRAME); + + P := Self.ScreenToClient(Message.Pos); + + if P.Y < D then + begin + if P.X < D then + Message.Result := HTTOPLEFT + else if P.X > ClientWidth - D then + Message.Result := HTTOPRIGHT + else + Message.Result := HTTOP; + end + else if P.Y > ClientHeight - D then + begin + if P.X < D then + Message.Result := HTBOTTOMLEFT + else if P.X > ClientWidth - D then + Message.Result := HTBOTTOMRIGHT + else + Message.Result := HTBOTTOM; + end + else + begin + if P.X < D then + Message.Result := HTLEFT + else if P.X > ClientWidth - D then + Message.Result := HTRIGHT + end; + + if Message.Result = 0 then + inherited; +end; + +function GetMDIParent(const Form: TCustomForm): TCustomForm; { Returns the parent of the specified MDI child form. But, if Form isn't a MDI child, it simply returns Form. } var @@ -2012,7 +1988,7 @@ function GetMDIParent (const Form: TSynForm): TSynForm; Result := Form; if Form = nil then Exit; - if (Form is TSynForm) and + if (Form is TCustomForm) and ((Form as TForm).FormStyle = fsMDIChild) then for I := 0 to Screen.FormCount-1 do with Screen.Forms[I] do @@ -2029,15 +2005,19 @@ function GetMDIParent (const Form: TSynForm): TSynForm; procedure TSynBaseCompletionProposalForm.WMActivate(var Message: TWMActivate); var - ParentForm: TSynForm; + ParentForm: TCustomForm; begin if csDesigning in ComponentState then begin inherited; Exit; end; - {Owner of the component that created me} - if Owner.Owner is TSynForm then - ParentForm := GetMDIParent(Owner.Owner as TSynForm) + + if Assigned(CurrentEditor) then + begin + ParentForm := GetParentForm(CurrentEditor); + if Assigned(ParentForm) then + ParentForm := GetMDIParent(ParentForm); + end else ParentForm := nil; @@ -2045,23 +2025,15 @@ procedure TSynBaseCompletionProposalForm.WMActivate(var Message: TWMActivate); SendMessage(ParentForm.Handle, WM_NCACTIVATE, Ord(Message.Active <> WA_INACTIVE), 0); end; -procedure TSynBaseCompletionProposalForm.WMChar(var Msg: TWMChar); -begin - if Win32PlatformIsUnicode then - DoKeyPressW(WideChar(Msg.CharCode)) - else - DoKeyPressW(KeyUnicode(AnsiChar(Msg.CharCode))); -end; - procedure TSynBaseCompletionProposalForm.DoFormHide(Sender: TObject); begin if CurrentEditor <> nil then begin - (CurrentEditor as TCustomSynEdit).AlwaysShowCaret := FOldShowCaret; -// (CurrentEditor as TCustomSynEdit).UpdateCaret; + (CurrentEditor as TCustomSynEdit).AlwaysShowCaret := OldShowCaret; if DisplayType = ctCode then begin - (Owner as TSynBaseCompletionProposal).FWidth := Width; + // Save after removing the PPI scaling + (Owner as TSynBaseCompletionProposal).FWidth := MulDiv(ClientWidth, 96, GetCurrentPPI); (Owner as TSynBaseCompletionProposal).FNbLinesInWindow := FLinesInWindow; end; end; @@ -2075,7 +2047,7 @@ procedure TSynBaseCompletionProposalForm.DoFormShow(Sender: TObject); begin with CurrentEditor as TCustomSynEdit do begin - FOldShowCaret := AlwaysShowCaret; + OldShowCaret := AlwaysShowCaret; AlwaysShowCaret := Focused; // UpdateCaret; end; @@ -2084,12 +2056,6 @@ procedure TSynBaseCompletionProposalForm.DoFormShow(Sender: TObject); (Owner as TSynBaseCompletionProposal).OnShow(Self); end; -procedure TSynBaseCompletionProposalForm.WMEraseBackgrnd( - var Message: TMessage); -begin - Message.Result:=1; -end; - procedure TSynBaseCompletionProposalForm.WMGetDlgCode(var Message: TWMGetDlgCode); begin inherited; @@ -2097,65 +2063,63 @@ procedure TSynBaseCompletionProposalForm.WMGetDlgCode(var Message: TWMGetDlgCode end; procedure TSynBaseCompletionProposalForm.AdjustMetrics; +var + TitleFontHeight: Integer; begin + FScaledMargin := MulDiv(FMargin, GetCurrentPPI, 96); + if DisplayType = ctCode then begin + Canvas.Font.PixelsPerInch := GetCurrentPPI; + Canvas.Font.Assign(FTitleFont); + TitleFontHeight := Canvas.TextHeight(TextHeightString); + if FTitle <> '' then - FHeightBuffer := FTitleFontHeight + 4 {Margin} + FTitleHeight := TitleFontHeight + 2 * FScaledMargin else - FHeightBuffer := 0; + FTitleHeight := 0; - if (ClientWidth >= FScrollbar.Width) and (ClientHeight >= FHeightBuffer) then - begin - FBitmap.Width := ClientWidth - FScrollbar.Width; - FBitmap.Height := ClientHeight - FHeightBuffer; - end; + if FResizeable and TSynBaseCompletionProposal(Owner).ShowGripper then + FGripperHeight := MulDiv(cGripperBarHeight, GetCurrentPPI, 96) + else + FGripperHeight := 0; + + if (ClientWidth >= FScrollbar.Width) and (ClientHeight >= FTitleHeight) then + FPaintBitmap.SetSize(ClientWidth - FScrollbar.Width, ClientHeight - FTitleHeight - FGripperHeight); + + if (ClientWidth > 0) and (FTitleHeight > 0) then + FTitleBitmap.SetSize(ClientWidth, FTitleHeight); - if (ClientWidth > 0) and (FHeightBuffer > 0) then - begin - FTitleBitmap.Width := ClientWidth; - FTitleBitmap.Height := FHeightBuffer; - end; end else begin if (ClientWidth > 0) and (ClientHeight > 0) then - begin - FBitmap.Width := ClientWidth; - FBitmap.Height := ClientHeight; - end; + FPaintBitmap.SetSize(ClientWidth, ClientHeight); end; end; - procedure TSynBaseCompletionProposalForm.AdjustScrollBarPosition; begin if FDisplayKind = ctCode then begin if Assigned(FScrollbar) then begin - FScrollbar.Top := FHeightBuffer; - FScrollbar.Height := ClientHeight - FHeightBuffer; + FScrollbar.Top := FTitleHeight; + FScrollbar.Height := ClientHeight - FTitleHeight - FGripperHeight; FScrollbar.Left := ClientWidth - FScrollbar.Width; if FAssignedList.Count - FLinesInWindow < 0 then begin - {$IFDEF SYN_DELPHI_4_UP} FScrollbar.PageSize := 0; - {$ENDIF} FScrollbar.Max := 0; FScrollbar.Enabled := False; end else begin - {$IFDEF SYN_DELPHI_4_UP} FScrollbar.PageSize := 0; - {$ENDIF} FScrollbar.Max := FAssignedList.Count - FLinesInWindow; if FScrollbar.Max <> 0 then begin FScrollbar.LargeChange := FLinesInWindow; - {$IFDEF SYN_DELPHI_4_UP} FScrollbar.PageSize := 1; - {$ENDIF} FScrollbar.Enabled := True; end else FScrollbar.Enabled := False; @@ -2164,24 +2128,29 @@ procedure TSynBaseCompletionProposalForm.AdjustScrollBarPosition; end; end; -procedure TSynBaseCompletionProposalForm.SetTitle(const Value: UnicodeString); +procedure TSynBaseCompletionProposalForm.SetTitle(const Value: string); begin FTitle := Value; - AdjustMetrics; end; procedure TSynBaseCompletionProposalForm.SetFont(const Value: TFont); begin FFont.Assign(Value); - RecalcItemHeight; - AdjustMetrics; +end; + +procedure TSynBaseCompletionProposalForm.SetGripperFont(const Value: TFont); +begin + FGripperFont.Assign(Value); +end; + +procedure TSynBaseCompletionProposalForm.SetGripperText(const Value: string); +begin + FGripperText := value; end; procedure TSynBaseCompletionProposalForm.SetTitleFont(const Value: TFont); begin FTitleFont.Assign(Value); - FTitleFontHeight := TextHeight(Canvas, TextHeightString); - AdjustMetrics; end; procedure TSynBaseCompletionProposalForm.SetColumns(Value: TProposalColumns); @@ -2190,17 +2159,12 @@ procedure TSynBaseCompletionProposalForm.SetColumns(Value: TProposalColumns); end; -procedure TSynBaseCompletionProposalForm.TitleFontChange(Sender: TObject); -begin - Canvas.Font.Assign(FTitleFont); - FTitleFontHeight := TextHeight(Canvas, TextHeightString); - AdjustMetrics; -end; - -procedure TSynBaseCompletionProposalForm.FontChange(Sender: TObject); +function TSynBaseCompletionProposalForm.GetCurrentPPI: Integer; begin - RecalcItemHeight; - AdjustMetrics; + if Assigned(FCurrentEditor) then + Result := FCurrentEditor.CurrentPPI + else + Result := Screen.PixelsPerInch; end; procedure TSynBaseCompletionProposalForm.Notification(AComponent: TComponent; @@ -2218,7 +2182,7 @@ procedure TSynBaseCompletionProposalForm.Notification(AComponent: TComponent; { TSynBaseCompletionProposal } -constructor TSynBaseCompletionProposal.Create(Aowner: TComponent); +constructor TSynBaseCompletionProposal.Create(AOwner: TComponent); begin FWidth := 260; FNbLinesInWindow := 8; @@ -2227,40 +2191,26 @@ constructor TSynBaseCompletionProposal.Create(Aowner: TComponent); EndOfTokenChr := DefaultEndOfTokenChr; FDotOffset := 0; DefaultType := ctCode; + FPaintFormShadow := True; end; -procedure TSynBaseCompletionProposal.Execute(s: UnicodeString; x, y: Integer); +procedure TSynBaseCompletionProposal.Execute(CurrentInput: string; x, y: Integer); begin - ExecuteEx(s, x, y, DefaultType); + ExecuteEx(CurrentInput, x, y, DefaultType); end; -procedure TSynBaseCompletionProposal.ExecuteEx(s: UnicodeString; x, y: Integer; Kind : SynCompletionType); - - function GetWorkAreaWidth: Integer; - begin - {$IFDEF SYN_COMPILER_5_UP} - Result := Screen.DesktopWidth; - {$ELSE} - Result := Screen.Width; - {$ENDIF} - end; - - function GetWorkAreaHeight: Integer; - begin - {$IFDEF SYN_COMPILER_5_UP} - Result := Screen.DesktopHeight; - {$ELSE} - Result := Screen.Height; - {$ENDIF} - end; +procedure TSynBaseCompletionProposal.ExecuteEx(CurrentInput: string; x, y: Integer; Kind: SynCompletionType); +var + WorkArea: TRect; + Monitor: TMonitor; - function GetParamWidth(const S: UnicodeString): Integer; + function GetParamWidth(const S: string): Integer; var i: Integer; - List: TUnicodeStringList; + List: TStringList; NewWidth: Integer; begin - List := TUnicodeStringList.Create; + List := TStringList.Create; try List.CommaText := S; @@ -2268,7 +2218,7 @@ procedure TSynBaseCompletionProposal.ExecuteEx(s: UnicodeString; x, y: Integer; for i := -1 to List.Count -1 do begin NewWidth := FormattedTextWidth(Form.Canvas, - FormatParamList(S, i), Columns, FForm.Images); + FormatParamList(S, i), Form.GetCurrentPPI, Columns, FForm.Images); if NewWidth > Result then Result := NewWidth; @@ -2285,45 +2235,55 @@ procedure TSynBaseCompletionProposal.ExecuteEx(s: UnicodeString; x, y: Integer; tmpHeight: Integer; tmpX: Integer; tmpY: Integer; - tmpStr: UnicodeString; - BorderWidth: Integer; + tmpStr: string; NewWidth: Integer; + ActivePPI: Integer; begin + ActivePPI := FForm.GetCurrentPPI; + // ScaleForPPI will scale Width and Height + // Scaling at this point prevents further scaling when the Form is shown + {$IF CompilerVersion >= 32}FForm.ScaleForPPI(ActivePPI);{$ENDIF} + + // Scrollbar needs to be properly scaled in case primary monitor is High-DPI + // Check for Windows Anniversary Edition + if (TOSVersion.Major >= 10) and (TOSVersion.Build >= 14393) then + FForm.FScrollbar.Width := GetSystemMetricsForDPI(SM_CXVSCROLL, ActivePPI) + else + FForm.FScrollbar.Width := GetSystemMetrics(SM_CXVSCROLL); + + // Now we can do the measurements + FForm.RecalcItemHeight; + FForm.AdjustMetrics; tmpX := x; - tmpY := y; + tmpY := Y + FForm.FScaledMargin; tmpWidth := 0; tmpHeight := 0; case Kind of ctCode: begin - BorderWidth := 2 * GetSystemMetrics(SM_CYSIZEFRAME); - - tmpWidth := FWidth; - tmpHeight := Form.FHeightBuffer + Form.FEffectiveItemHeight * FNbLinesInWindow + BorderWidth; + tmpWidth := MulDiv(FWidth, ActivePPI, 96); + tmpHeight := Form.FTitleHeight + Form.FGripperHeight + Form.FEffectiveItemHeight * FNbLinesInWindow; end; ctHint: begin - BorderWidth := 2; - tmpHeight := Form.FEffectiveItemHeight * ItemList.Count + BorderWidth - + 2 * Form.Margin; + tmpHeight := Form.FEffectiveItemHeight * ItemList.Count + 2 * FForm.FScaledMargin; Form.Canvas.Font.Assign(Font); for i := 0 to ItemList.Count -1 do begin tmpStr := ItemList[i]; - NewWidth := FormattedTextWidth(Form.Canvas, tmpStr, nil, FForm.Images); + NewWidth := FormattedTextWidth(Form.Canvas, tmpStr, + ActivePPI, nil, FForm.Images); if NewWidth > tmpWidth then tmpWidth := NewWidth; end; - Inc(tmpWidth, 2 * FForm.Margin +BorderWidth); + Inc(tmpWidth, 2 * FForm.FScaledMargin); end; ctParams: begin - BorderWidth := 2; - tmpHeight := Form.FEffectiveItemHeight * ItemList.Count + BorderWidth - + 2 * Form.Margin; + tmpHeight := Form.FEffectiveItemHeight * ItemList.Count + 2 * FForm.FScaledMargin; Form.Canvas.Font.Assign(Font); for i := 0 to ItemList.Count -1 do @@ -2337,42 +2297,45 @@ procedure TSynBaseCompletionProposal.ExecuteEx(s: UnicodeString; x, y: Integer; tmpWidth := NewWidth; end; - Inc(tmpWidth, 2 * FForm.Margin +BorderWidth); + Inc(tmpWidth, 2 * FForm.FScaledMargin); end; end; + // Maximum size 3/4 of monitor width and 1/2 of monitor height + tmpWidth := Min(tmpWidth, MulDiv(WorkArea.Width, 3, 4)); + tmpHeight := Min(tmpHeight, WorkArea.Height div 2); - if tmpX + tmpWidth > GetWorkAreaWidth then + if tmpX + tmpWidth > WorkArea.Right then begin - tmpX := GetWorkAreaWidth - tmpWidth - 5; //small space buffer + tmpX := WorkArea.Right - tmpWidth - 2 * Form.FScaledMargin; if tmpX < 0 then tmpX := 0; end; - if tmpY + tmpHeight > GetWorkAreaHeight then + if tmpY + tmpHeight > WorkArea.Bottom then begin - tmpY := tmpY - tmpHeight - (Form.CurrentEditor as TCustomSynEdit).LineHeight -2; + tmpY := tmpY - tmpHeight - (Form.CurrentEditor as TCustomSynEdit).LineHeight - + 2 * FForm.FScaledMargin; if tmpY < 0 then tmpY := 0; end; - Form.Width := tmpWidth; - Form.Height := tmpHeight; - Form.Top := tmpY; - Form.Left := tmpX; + Form.ClientWidth := tmpWidth; + Form.ClientHeight := tmpHeight; + Form.SetBounds(tmpX, tmpY, Form.Width, Form.Height) end; var TmpOffset: Integer; - {$IFDEF SYN_DELPHI_XE_UP} - ParentForm: TCustomForm; - {$ENDIF} begin + Monitor := Screen.MonitorFromPoint(Point(x, y)); + WorkArea := Monitor.WorkareaRect; + DisplayType := Kind; FCanExecute := True; if Assigned(OnExecute) then - OnExecute(Kind, Self, s, x, y, FCanExecute); + OnExecute(Kind, Self, CurrentInput, x, y, FCanExecute); if (not FCanExecute) or (ItemList.Count = 0) then begin @@ -2381,33 +2344,34 @@ procedure TSynBaseCompletionProposal.ExecuteEx(s: UnicodeString; x, y: Integer; Exit; end; -{$IFDEF SYN_DELPHI_XE_UP} - ParentForm := GetParentForm(Form.CurrentEditor); - if Assigned(ParentForm) then + // Set PopupMode, PopupParent, FormStyle and Constraints + Form.PopupMode := pmExplicit; + if (Kind = ctCode) then begin - Form.PopupMode := pmExplicit; - Form.PopupParent := ParentForm; - end + Form.FormStyle := fsStayOnTop; + //if the form is sized too small the metrics calcs fall over. + Form.Constraints.MinHeight := 100; + Form.Constraints.MinWidth := 100; end else begin - Form.PopupMode := pmNone; - Form.FormStyle := fsStayOnTop; + Form.FormStyle := fsNormal; + Form.Constraints.MinHeight := 0; + Form.Constraints.MinWidth := 0; end; -{$ELSE} - Form.FormStyle := fsStayOnTop; -{$ENDIF} if Assigned(Form.CurrentEditor) then begin - TmpOffset := TextWidth((Form.CurrentEditor as TCustomSynEdit).Canvas, Copy(s, 1, DotOffset)); + TmpOffset := (Form.CurrentEditor as TCustomSynEdit).Canvas.TextWidth(Copy(CurrentInput, 1, DotOffset)); if DotOffset > 1 then - TmpOffset := TmpOffset + (3 * (DotOffset -1)) + TmpOffset := TmpOffset + (3 * (DotOffset -1)); + Form.PopupParent := GetParentForm(Form.CurrentEditor); end else TmpOffset := 0; x := x - tmpOffset; ResetAssignedList; + RecalcFormPlacement; case Kind of ctCode: if Form.AssignedList.Count > 0 then @@ -2419,35 +2383,36 @@ procedure TSynBaseCompletionProposal.ExecuteEx(s: UnicodeString; x, y: Integer; Form.FScrollbar.Position := Form.Position; Form.FScrollbar.Visible := True; - RecalcFormPlacement; Form.Show; - CurrentString := s; // bug id 1496148 + CurrentString := CurrentInput; end; ctParams, ctHint: begin Form.FScrollbar.Visible := False; - RecalcFormPlacement; - - ShowWindow(Form.Handle, SW_SHOWNA); - Form.Visible := True; - Form.Repaint; + if not Form.Visible then + begin + //ShowWindow(Form.Handle, SW_SHOWNOACTIVATE); + ShowWindow(Form.Handle, SW_SHOWNA); + Form.Visible := True; + end; + Form.Invalidate; end; end; end; -function TSynBaseCompletionProposal.GetCurrentString: UnicodeString; +function TSynBaseCompletionProposal.GetCurrentString: string; begin Result := Form.CurrentString; end; -function TSynBaseCompletionProposal.GetItemList: TUnicodeStrings; +function TSynBaseCompletionProposal.GetItemList: TStrings; begin Result := Form.ItemList; end; -function TSynBaseCompletionProposal.GetInsertList: TUnicodeStrings; +function TSynBaseCompletionProposal.GetInsertList: TStrings; begin Result := Form.InsertList; end; @@ -2457,7 +2422,7 @@ function TSynBaseCompletionProposal.GetOnCancel: TNotifyEvent; Result := Form.OnCancel; end; -function TSynBaseCompletionProposal.GetOnKeyPress: TKeyPressWEvent; +function TSynBaseCompletionProposal.GetOnKeyPress: TKeyPressEvent; begin Result := Form.OnKeyPress; end; @@ -2482,17 +2447,17 @@ function TSynBaseCompletionProposal.GetPosition: Integer; Result := Form.Position; end; -procedure TSynBaseCompletionProposal.SetCurrentString(const Value: UnicodeString); +procedure TSynBaseCompletionProposal.SetCurrentString(const Value: string); begin Form.CurrentString := Value; end; -procedure TSynBaseCompletionProposal.SetItemList(const Value: TUnicodeStrings); +procedure TSynBaseCompletionProposal.SetItemList(const Value: TStrings); begin Form.ItemList := Value; end; -procedure TSynBaseCompletionProposal.SetInsertList(const Value: TUnicodeStrings); +procedure TSynBaseCompletionProposal.SetInsertList(const Value: TStrings); begin Form.InsertList := Value; end; @@ -2507,7 +2472,7 @@ procedure TSynBaseCompletionProposal.SetOnCancel(const Value: TNotifyEvent); Form.OnCancel := Value; end; -procedure TSynBaseCompletionProposal.SetOnKeyPress(const Value: TKeyPressWEvent); +procedure TSynBaseCompletionProposal.SetOnKeyPress(const Value: TKeyPressEvent); begin Form.OnKeyPress := Value; end; @@ -2565,27 +2530,16 @@ procedure TSynBaseCompletionProposal.Deactivate; procedure TSynBaseCompletionProposal.DefineProperties(Filer: TFiler); begin inherited; -{$IFNDEF UNICODE} - UnicodeDefineProperties(Filer, Self); -{$ENDIF} end; -function TSynBaseCompletionProposal.GetClBack(AIndex: Integer): TColor; +function TSynBaseCompletionProposal.GetClBack: TColor; begin - case AIndex of - 1: Result := Form.ClBackground; - 2: Result := Form.ClBackgroundBorder; - else - Result := clNone; - end; + Result := Form.ClBackground; end; -procedure TSynBaseCompletionProposal.SetClBack(AIndex: Integer; const Value: TColor); +procedure TSynBaseCompletionProposal.SetClBack(const Value: TColor); begin - case AIndex of - 1: Form.ClBackground := Value; - 2: Form.ClBackgroundBorder := Value; - end; + Form.ClBackground := Value end; function TSynBaseCompletionProposal.GetClSelectedText: TColor; @@ -2598,17 +2552,17 @@ procedure TSynBaseCompletionProposal.SetClSelectedText(const Value: TColor); Form.ClSelectedText := Value; end; -procedure TSynBaseCompletionProposal.AddItem(ADisplayText, AInsertText: UnicodeString); +procedure TSynBaseCompletionProposal.AddItem(ADisplayText, AInsertText: string); begin GetInsertList.Add(AInsertText); GetItemList.Add(ADisplayText); end; -procedure TSynBaseCompletionProposal.AddItemAt(Where: Integer; ADisplayText, AInsertText: UnicodeString); +procedure TSynBaseCompletionProposal.AddItemAt(Where: Integer; ADisplayText, AInsertText: string); begin try GetInsertList.Insert(Where, AInsertText); - GetItemList.Insert(Where, ADisplayText); + GetItemList.Insert(Where, ADisplayText); except raise Exception.Create('Cannot insert item at position ' + IntToStr(Where) + '.'); end; @@ -2620,12 +2574,12 @@ procedure TSynBaseCompletionProposal.ClearList; GetItemList.Clear; end; -function TSynBaseCompletionProposal.DisplayItem(AIndex : Integer): UnicodeString; +function TSynBaseCompletionProposal.DisplayItem(AIndex: Integer): string; begin Result := GetItemList[AIndex]; end; -function TSynBaseCompletionProposal.InsertItem(AIndex : Integer): UnicodeString; +function TSynBaseCompletionProposal.InsertItem(AIndex: Integer): string; begin Result := GetInsertList[AIndex]; end; @@ -2655,6 +2609,15 @@ function TSynBaseCompletionProposal.GetParameterToken: TCompletionParameter; Result := Form.OnParameterToken; end; +procedure TSynBaseCompletionProposal.SetPaintFormShadow(const Value: Boolean); +begin + if FPaintFormShadow <> Value then + begin + FPaintFormShadow := Value; + FForm.RecreateWnd; + end; +end; + procedure TSynBaseCompletionProposal.SetParameterToken( const Value: TCompletionParameter); begin @@ -2693,12 +2656,12 @@ procedure TSynBaseCompletionProposal.SetItemHeight(const Value: Integer); FForm.ItemHeight := Value; end; -procedure TSynBaseCompletionProposal.SetImages(const Value: TImageList); +procedure TSynBaseCompletionProposal.SetImages(const Value: TCustomImageList); begin FForm.Images := Value; end; -function TSynBaseCompletionProposal.GetImages: TImageList; +function TSynBaseCompletionProposal.GetImages: TCustomImageList; begin Result := FForm.Images; end; @@ -2727,7 +2690,7 @@ procedure TSynBaseCompletionProposal.SetDefaultKind(const Value: SynCompletionTy end; procedure TSynBaseCompletionProposal.SetEndOfTokenChar( - const Value: UnicodeString); + const Value: string); begin if Form.FEndOfTokenChr <> Value then begin @@ -2746,12 +2709,12 @@ procedure TSynBaseCompletionProposal.SetClTitleBackground( Form.ClTitleBackground := Value; end; -function TSynBaseCompletionProposal.GetTitle: UnicodeString; +function TSynBaseCompletionProposal.GetTitle: string; begin Result := Form.Title; end; -procedure TSynBaseCompletionProposal.SetTitle(const Value: UnicodeString); +procedure TSynBaseCompletionProposal.SetTitle(const Value: string); begin Form.Title := Value; end; @@ -2761,6 +2724,16 @@ function TSynBaseCompletionProposal.GetFont: TFont; Result := Form.Font; end; +function TSynBaseCompletionProposal.GetGripperFont: TFont; +begin + Result := Form.GripperFont; +end; + +function TSynBaseCompletionProposal.GetGripperText: string; +begin + Result := Form.GripperText; +end; + function TSynBaseCompletionProposal.GetTitleFont: TFont; begin Result := Form.TitleFont; @@ -2771,44 +2744,53 @@ procedure TSynBaseCompletionProposal.SetFont(const Value: TFont); Form.Font := Value; end; +procedure TSynBaseCompletionProposal.SetGripperFont(const Value: TFont); +begin + Form.GripperFont := Value; +end; + +procedure TSynBaseCompletionProposal.SetGripperText(const Value: string); +begin + Form.GripperText := Value; +end; + procedure TSynBaseCompletionProposal.SetTitleFont(const Value: TFont); begin Form.TitleFont := Value; end; -function TSynBaseCompletionProposal.GetEndOfTokenChar: UnicodeString; +function TSynBaseCompletionProposal.GetEndOfTokenChar: string; begin Result := Form.EndOfTokenChr; end; function TSynBaseCompletionProposal.GetOptions: TSynCompletionOptions; begin - Result := FOptions; + Result := fOptions; end; procedure TSynBaseCompletionProposal.SetOptions( const Value: TSynCompletionOptions); begin - if FOptions <> Value then + if fOptions <> Value then begin - FOptions := Value; + fOptions := Value; Form.CenterTitle := scoTitleIsCentered in Value; Form.CaseSensitive := scoCaseSensitive in Value; Form.UsePrettyText := scoUsePrettyText in Value; Form.UseInsertList := scoUseInsertList in Value; Form.MatchText := scoLimitToMatchedText in Value; - Form.MatchTextAnywhere := scoLimitToMatchedTextAnywhere in Value; Form.CompleteWithTab := scoCompleteWithTab in Value; Form.CompleteWithEnter := scoCompleteWithEnter in Value; end; end; -function TSynBaseCompletionProposal.GetTriggerChars: UnicodeString; +function TSynBaseCompletionProposal.GetTriggerChars: string; begin Result := Form.TriggerChars; end; -procedure TSynBaseCompletionProposal.SetTriggerChars(const Value: UnicodeString); +procedure TSynBaseCompletionProposal.SetTriggerChars(const Value: string); begin Form.TriggerChars := Value; end; @@ -2846,23 +2828,26 @@ procedure TSynBaseCompletionProposal.ResetAssignedList; procedure TSynCompletionProposal.HandleOnCancel(Sender: TObject); var F: TSynBaseCompletionProposalForm; + CurrentEditor: TCustomSynedit; begin F := Sender as TSynBaseCompletionProposalForm; FNoNextKey := False; - if F.CurrentEditor <> nil then + CurrentEditor := F.CurrentEditor; + if CurrentEditor <> nil then begin if Assigned(FTimer) then FTimer.Enabled := False; F.Hide; - if ((F.CurrentEditor as TCustomSynEdit).Owner is TWinControl) and - (((F.CurrentEditor as TCustomSynEdit).Owner as TWinControl).Visible) then + if ((CurrentEditor as TCustomSynEdit).Owner is TWinControl) and + (((CurrentEditor as TCustomSynEdit).Owner as TWinControl).Visible) then begin - ((F.CurrentEditor as TCustomSynEdit).Owner as TWinControl).SetFocus; + ((CurrentEditor as TCustomSynEdit).Owner as TWinControl).SetFocus; end; - (F.CurrentEditor as TCustomSynEdit).SetFocus; + if (CurrentEditor as TCustomSynEdit).CanFocus then + (CurrentEditor as TCustomSynEdit).SetFocus; if Assigned(OnCancelled) then OnCancelled(Self); @@ -2873,7 +2858,7 @@ procedure TSynCompletionProposal.HandleOnValidate(Sender: TObject; Shift: TShiftState; EndToken: WideChar); var F: TSynBaseCompletionProposalForm; - Value: UnicodeString; + Value: string; Index: Integer; begin F := Sender as TSynBaseCompletionProposalForm; @@ -2899,7 +2884,7 @@ procedure TSynCompletionProposal.HandleOnValidate(Sender: TObject; if (Form.FAssignedList.Count > Position) then // Added check to make sure item is only used when no EndChar if (InsertList.Count > Integer(Form.FAssignedList.Objects[position])) and - ((scoEndCharCompletion in FOptions) or (EndToken = #0)) then + ((scoEndCharCompletion in fOptions) or (EndToken = #0)) then Value := InsertList[Integer(Form.FAssignedList.Objects[position])] else Value := SelText @@ -2923,11 +2908,11 @@ procedure TSynCompletionProposal.HandleOnValidate(Sender: TObject; else Value := SelText; end; - Index := Position; // need to assign position to temp var since it changes later + Index := Position; // Need to assign position to temp var since it changes later if Assigned(FOnCodeCompletion) then FOnCodeCompletion(Self, Value, Shift, - F.LogicalToPhysicalIndex(Index), EndToken); + F.LogicalToPhysicalIndex(Index), EndToken); //GBN 15/11/2001 if SelText <> Value then SelText := Value; @@ -2938,7 +2923,8 @@ procedure TSynCompletionProposal.HandleOnValidate(Sender: TObject; //sending a WM_MOUSEDOWN message. The problem with the mouse down is //that the editor would bounce back to the left margin, very irritating InternalCancelCompletion; - SetFocus; + if CanFocus then + SetFocus; EnsureCursorPosVisible; CaretXY := BlockEnd; BlockBegin := CaretXY; @@ -3011,12 +2997,12 @@ constructor TSynCompletionProposal.Create(AOwner: TComponent); Form.OnDblClick := HandleDblClick; EndOfTokenChr := DefaultEndOfTokenChr; TriggerChars := '.'; - FTimerInterval:= 1000; - FNoNextKey := False; + fTimerInterval:= 1000; + fNoNextKey := False; - FShortCut := Menus.ShortCut(Ord(' '), [ssCtrl]); + fShortCut := Vcl.Menus.ShortCut(Ord(' '), [ssCtrl]); Options := DefaultProposalOptions; - FEditors := TList.Create; + fEditors := TList.Create; end; procedure TSynCompletionProposal.SetShortCut(Value: TShortCut); @@ -3029,22 +3015,22 @@ procedure TSynCompletionProposal.EditorKeyDown(Sender: TObject; var ShortCutKey: Word; ShortCutShift: TShiftState; + Editor: TCustomSynedit; begin - ShortCutToKey (FShortCut,ShortCutKey,ShortCutShift); - with Sender as TCustomSynEdit do - begin - if ((DefaultType <> ctCode) or not(ReadOnly)) and (Shift = ShortCutShift) and (Key = ShortCutKey) then + Editor := Sender as TCustomSynEdit; + ShortCutToKey (fShortCut,ShortCutKey,ShortCutShift); + if ((DefaultType <> ctCode) or not Editor.ReadOnly) and + (Shift = ShortCutShift) and (Key = ShortCutKey) then begin - Form.CurrentEditor := Sender as TCustomSynEdit; + Form.CurrentEditor := Editor; Key := 0; - DoExecute(Sender as TCustomSynEdit); + DoExecute(Editor); end; - end; end; -function TSynCompletionProposal.GetCurrentInput(AEditor: TCustomSynEdit): UnicodeString; +function TSynCompletionProposal.GetCurrentInput(AEditor: TCustomSynEdit): string; var - s: UnicodeString; + s: string; i: Integer; begin Result := ''; @@ -3053,7 +3039,7 @@ function TSynCompletionProposal.GetCurrentInput(AEditor: TCustomSynEdit): Unicod s := AEditor.LineText; i := AEditor.CaretX - 1; if i <= Length(s) then - begin + begin FAdjustCompletionStart := False; while (i > 0) and (s[i] > #32) and not Self.IsWordBreakChar(s[i]) do Dec(i); @@ -3065,12 +3051,12 @@ function TSynCompletionProposal.GetCurrentInput(AEditor: TCustomSynEdit): Unicod FAdjustCompletionStart := True; FCompletionStart := i + 1; - end; + end; end; -function TSynCompletionProposal.GetPreviousToken(AEditor: TCustomSynEdit): UnicodeString; +function TSynCompletionProposal.GetPreviousToken(AEditor: TCustomSynEdit): string; var - Line: UnicodeString; + Line: string; X: Integer; begin Result := ''; @@ -3094,7 +3080,7 @@ function TSynCompletionProposal.GetPreviousToken(AEditor: TCustomSynEdit): Unico procedure TSynCompletionProposal.EditorKeyPress(Sender: TObject; var Key: WideChar); begin - if FNoNextKey then + if fNoNextKey then begin FNoNextKey := False; Key := #0; @@ -3102,10 +3088,10 @@ procedure TSynCompletionProposal.EditorKeyPress(Sender: TObject; var Key: WideCh else if Assigned(FTimer) then begin + DeactivateTimer; if Pos(Key, TriggerChars) <> 0 then - ActivateTimer(Sender as TCustomSynEdit) - else - DeactivateTimer; + ActivateTimer(Sender as TCustomSynEdit); + end; end; @@ -3137,12 +3123,12 @@ destructor TSynCompletionProposal.Destroy; if Form.Visible then CancelCompletion; Editor := nil; - while FEditors.Count <> 0 do + while fEditors.Count <> 0 do RemoveEditor(TCustomSynEdit(FEditors.Last)); inherited; - FEditors.Free; + fEditors.Free; end; procedure TSynCompletionProposal.TimerExecute(Sender: TObject); @@ -3153,7 +3139,10 @@ procedure TSynCompletionProposal.TimerExecute(Sender: TObject); begin DoExecute(Form.CurrentEditor as TCustomSynEdit); FNoNextKey := False; - end else if Form.Visible then Form.Hide; + end else if Form.Visible then begin + Form.Hide; + Form.PopupParent := nil; + end; end; function TSynCompletionProposal.GetTimerInterval: Integer; @@ -3190,7 +3179,7 @@ procedure TSynCompletionProposal.SetOptions(const Value: TSynCompletionOptions); end; -procedure TSynCompletionProposal.ExecuteEx(s: UnicodeString; x, y: Integer; +procedure TSynCompletionProposal.ExecuteEx(s: string; x, y: Integer; Kind: SynCompletionType); begin inherited; @@ -3200,12 +3189,12 @@ procedure TSynCompletionProposal.ExecuteEx(s: UnicodeString; x, y: Integer; procedure TSynCompletionProposal.AddEditor(AEditor: TCustomSynEdit); var - i : Integer; + i: Integer; begin - i := FEditors.IndexOf(AEditor); + i := fEditors.IndexOf(AEditor); if i = -1 then begin AEditor.FreeNotification(Self); - FEditors.Add(AEditor); + fEditors.Add(AEditor); AEditor.AddKeyDownHandler(EditorKeyDown); AEditor.AddKeyPressHandler(EditorKeyPress); AEditor.RegisterCommandHandler(HookedEditorCommand, Self); @@ -3214,7 +3203,7 @@ procedure TSynCompletionProposal.AddEditor(AEditor: TCustomSynEdit); function TSynCompletionProposal.EditorsCount: Integer; begin - Result := FEditors.count; + Result := fEditors.count; end; function TSynCompletionProposal.GetEditor(i: Integer): TCustomSynEdit; @@ -3222,14 +3211,14 @@ function TSynCompletionProposal.GetEditor(i: Integer): TCustomSynEdit; if (i < 0) or (i >= EditorsCount) then Result := nil else - Result := FEditors[i]; + Result := fEditors[i]; end; function TSynCompletionProposal.RemoveEditor(AEditor: TCustomSynEdit): Boolean; var i: Integer; begin - i := FEditors.Remove(AEditor); + i := fEditors.Remove(AEditor); Result := i <> -1; if Result then begin if Form.CurrentEditor = AEditor then @@ -3241,11 +3230,9 @@ function TSynCompletionProposal.RemoveEditor(AEditor: TCustomSynEdit): Boolean; AEditor.RemoveKeyDownHandler(EditorKeyDown); AEditor.RemoveKeyPressHandler(EditorKeyPress); AEditor.UnregisterCommandHandler(HookedEditorCommand); - {$IFDEF SYN_COMPILER_5_UP} RemoveFreeNotification( AEditor ); - {$ENDIF} - if FEditor = AEditor then - FEditor := nil; + if fEditor = AEditor then + fEditor := nil; end; end; @@ -3274,7 +3261,7 @@ procedure TSynCompletionProposal.DoExecute(AEditor: TCustomSynEdit); ExecuteEx(GetCurrentInput(AEditor), p.x, p.y, DefaultType); FNoNextKey := (DefaultType = ctCode) and FCanExecute and Form.Visible; end; - end; + end; end; procedure TSynCompletionProposal.InternalCancelCompletion; @@ -3285,13 +3272,14 @@ procedure TSynCompletionProposal.InternalCancelCompletion; begin Deactivate; Form.Hide; + Form.PopupParent := nil; end; end; procedure TSynCompletionProposal.CancelCompletion; begin InternalCancelCompletion; - if Assigned(OnCancelled) then OnCancelled(Self); + if Assigned(OnCancelled) then OnCancelled(Self); end; procedure TSynCompletionProposal.EditorCancelMode(Sender: TObject); @@ -3313,45 +3301,33 @@ procedure TSynCompletionProposal.HookedEditorCommand(Sender: TObject; end; ctHint: - CancelCompletion; - ctParams: begin - case Command of - ecGotFocus, ecLostFocus: + CancelCompletion + end; + ctParams: + case Command of + // So that param completion is not hidden when you display code completion + //ecGotFocus, ecLostFocus: + // CancelCompletion; + ecCancelSelections: CancelCompletion; ecLineBreak: DoExecute(Sender as TCustomSynEdit); ecChar: + if AChar = #27 then + CancelCompletion + else begin - case AChar of - #27: - CancelCompletion; - #32..'z': - with Form do - begin -{ if Pos(AChar, FTriggerChars) > 0 then - begin - if Assigned(FParameterToken) then - begin - TmpIndex := CurrentIndex; - TmpLevel := CurrentLevel; - TmpStr := CurrentString; - OnParameterToken(Self, CurrentIndex, TmpLevel, TmpIndex, AChar, TmpStr); - CurrentIndex := TmpIndex; - CurrentLevel := TmpLevel; - CurrentString := TmpStr; - end; - end;} - DoExecute(Sender as TCustomSynEdit); - end; - else DoExecute(Sender as TCustomSynEdit); - end; + if Assigned(OnParameterToken) then + OnParameterToken(Self, AChar, FForm.FCurrentIndex, FForm.FCurrentLevel); + DoExecute(Sender as TCustomSynEdit); end; - else DoExecute(Sender as TCustomSynEdit); - end; + else + DoExecute(Sender as TCustomSynEdit); end; end; - end else + end + else if (not Form.Visible) and Assigned(FTimer) then begin if (Command = ecChar) then @@ -3367,6 +3343,7 @@ procedure TSynCompletionProposal.HookedEditorCommand(Sender: TObject; procedure TSynCompletionProposal.ActivateCompletion; begin DoExecute(Editor); + fNoNextKey := False; // Synedit bug report 1496151 end; @@ -3379,9 +3356,9 @@ constructor TSynAutoComplete.Create(AOwner: TComponent); FDoLookup := True; CreateInternalCompletion; FEndOfTokenChr := DefaultEndOfTokenChr; - fAutoCompleteList := TUnicodeStringList.Create; - FNoNextKey := False; - FShortCut := Menus.ShortCut(Ord(' '), [ssShift]); + fAutoCompleteList := TStringList.Create; + fNoNextKey := False; + fShortCut := Vcl.Menus.ShortCut(Ord(' '), [ssShift]); end; procedure TSynAutoComplete.SetShortCut(Value: TShortCut); @@ -3407,158 +3384,162 @@ procedure TSynAutoComplete.EditorKeyDown(Sender: TObject; var Key: Word; ShortCutKey: Word; ShortCutShift: TShiftState; begin - ShortCutToKey (FShortCut,ShortCutKey,ShortCutShift); + ShortCutToKey (fShortCut,ShortCutKey,ShortCutShift); if not (Sender as TCustomSynEdit).ReadOnly and (Shift = ShortCutShift) and (Key = ShortCutKey) then begin Execute(GetPreviousToken(Sender as TCustomSynEdit), Sender as TCustomSynEdit); - FNoNextKey := True; + fNoNextKey := True; Key := 0; end; end; procedure TSynAutoComplete.EditorKeyPress(Sender: TObject; var Key: WideChar); begin - if FNoNextKey then + if fNoNextKey then begin - FNoNextKey := False; + fNoNextKey := False; Key := #0; end; end; -procedure TSynAutoComplete.Execute(Token: UnicodeString; Editor: TCustomSynEdit); +procedure TSynAutoComplete.Execute(Token: string; Editor: TCustomSynEdit); begin ExecuteEx(Token, Editor, FDoLookup); end; -procedure TSynAutoComplete.ExecuteEx(Token: UnicodeString; Editor: TCustomSynEdit; +procedure TSynAutoComplete.ExecuteEx(Token: string; Editor: TCustomSynEdit; LookupIfNotExact: Boolean); var - Temp: UnicodeString; - i, j: Integer; + Temp: string; + I, J: Integer; StartOfBlock: TBufferCoord; ChangedIndent: Boolean; ChangedTrailing: Boolean; TmpOptions: TSynEditorOptions; OrigOptions: TSynEditorOptions; - BeginningSpaceCount : Integer; - Spacing: UnicodeString; + BeginningSpaceCount: Integer; + Spacing: string; begin if Assigned(OnBeforeExecute) then OnBeforeExecute(Self); try - i := AutoCompleteList.IndexOf(Token); - if (i <> -1) then + I := AutoCompleteList.IndexOf(Token); + if (Length(Token) > 0) and (I <> -1) then begin - TmpOptions := Editor.Options; - OrigOptions := Editor.Options; - ChangedIndent := eoAutoIndent in TmpOptions; - ChangedTrailing := eoTrimTrailingSpaces in TmpOptions; - - if ChangedIndent then Exclude(TmpOptions, eoAutoIndent); - if ChangedTrailing then Exclude(TmpOptions, eoTrimTrailingSpaces); - - if ChangedIndent or ChangedTrailing then - Editor.Options := TmpOptions; - - Editor.UndoList.AddChange(crAutoCompleteBegin, StartOfBlock, StartOfBlock, '', - smNormal); - - FNoNextKey := True; - for j := 1 to Length(Token) do - Editor.CommandProcessor(ecDeleteLastChar, ' ', nil); - BeginningSpaceCount := Editor.DisplayX - 1; - if not(eoTabsToSpaces in Editor.Options) and - (BeginningSpaceCount >= Editor.TabWidth) - then - Spacing := UnicodeStringOfChar(#9, BeginningSpaceCount div Editor.TabWidth) - + UnicodeStringOfChar(' ', BeginningSpaceCount mod Editor.TabWidth) - else - Spacing := UnicodeStringOfChar(' ', BeginningSpaceCount); - - Inc(i); - if (i < AutoCompleteList.Count) and - (Length(AutoCompleteList[i]) > 0) and - (AutoCompleteList[i][1] = '|') then - begin - Inc(i); - end; - StartOfBlock.Char := -1; - StartOfBlock.Line := -1; - while (i < AutoCompleteList.Count) and - (length(AutoCompleteList[i]) > 0) and - (AutoCompleteList[i][1] = '=') do - begin - { for j := 0 to PrevSpace - 1 do - Editor.CommandProcessor(ecDeleteLastChar, ' ', nil);} - Temp := AutoCompleteList[i]; - for j := 2 to Length(Temp) do begin - if (Temp[j] = #9) then - Editor.CommandProcessor(ecTab, Temp[j], nil) + Editor.Lines.BeginUpdate; + try + TmpOptions := Editor.Options; + OrigOptions := Editor.Options; + ChangedIndent := eoAutoIndent in TmpOptions; + ChangedTrailing := eoTrimTrailingSpaces in TmpOptions; + + if ChangedIndent then Exclude(TmpOptions, eoAutoIndent); + if ChangedTrailing then Exclude(TmpOptions, eoTrimTrailingSpaces); + + if ChangedIndent or ChangedTrailing then + Editor.Options := TmpOptions; + + Editor.BeginUndoBlock; + try + fNoNextKey := True; + for J := 1 to Length(Token) do + Editor.CommandProcessor(ecDeleteLastChar, ' ', nil); + BeginningSpaceCount := Editor.DisplayX - 1; + if not(eoTabsToSpaces in Editor.Options) and + (BeginningSpaceCount >= Editor.TabWidth) + then + Spacing := StringofChar(#9, BeginningSpaceCount div Editor.TabWidth) + + StringofChar(' ', BeginningSpaceCount mod Editor.TabWidth) else - Editor.CommandProcessor(ecChar, Temp[j], nil); - if (Temp[j] = '|') then - StartOfBlock := Editor.CaretXY - end; - Inc(i); - if (i < AutoCompleteList.Count) and - (length(AutoCompleteList[i]) > 0) and - (AutoCompleteList[i][1] = '=') then - begin - Editor.CommandProcessor (ecLineBreak,' ',nil); - for j := 1 to length(Spacing) do - if (Spacing[j] = #9) then - Editor.CommandProcessor(ecTab, #9, nil) - else - Editor.CommandProcessor (ecChar, ' ', nil); - end; - end; - if (StartOfBlock.Char <> -1) and (StartOfBlock.Line <> -1) then begin - Editor.CaretXY := StartOfBlock; - Editor.CommandProcessor(ecDeleteLastChar, ' ', nil); - end; + Spacing := StringofChar(' ', BeginningSpaceCount); - if ChangedIndent or ChangedTrailing then Editor.Options := OrigOptions; + Inc(I); + if (I < AutoCompleteList.Count) and + (Length(AutoCompleteList[I]) > 0) and + (AutoCompleteList[I][1] = '|') then + begin + Inc(I); + end; + StartOfBlock.Char := -1; + StartOfBlock.Line := -1; + while (I < AutoCompleteList.Count) and + (length(AutoCompleteList[I]) > 0) and + (AutoCompleteList[I][1] = '=') do + begin + { for J := 0 to PrevSpace - 1 do + Editor.CommandProcessor(ecDeleteLastChar, ' ', nil);} + Temp := AutoCompleteList[I]; + for J := 2 to Length(Temp) do begin + if (Temp[J] = #9) then + Editor.CommandProcessor(ecTab, Temp[J], nil) + else + Editor.CommandProcessor(ecChar, Temp[J], nil); + if (Temp[J] = '|') then + StartOfBlock := Editor.CaretXY + end; + Inc(I); + if (I < AutoCompleteList.Count) and + (length(AutoCompleteList[I]) > 0) and + (AutoCompleteList[I][1] = '=') then + begin + Editor.CommandProcessor (ecLineBreak,' ',nil); + for J := 1 to length(Spacing) do + if (Spacing[J] = #9) then + Editor.CommandProcessor(ecTab, #9, nil) + else + Editor.CommandProcessor (ecChar, ' ', nil); + end; + end; + if (StartOfBlock.Char <> -1) and (StartOfBlock.Line <> -1) then begin + Editor.CaretXY := StartOfBlock; + Editor.CommandProcessor(ecDeleteLastChar, ' ', nil); + end; - Editor.UndoList.AddChange(crAutoCompleteEnd, StartOfBlock, StartOfBlock, - '', smNormal); - FNoNextKey := False; + if ChangedIndent or ChangedTrailing then Editor.Options := OrigOptions; + finally + Editor.EndUndoBlock; + end; + fNoNextKey := False; + finally + Editor.Lines.EndUpdate; + end; end else if LookupIfNotExact and Assigned(FInternalCompletion) then begin FInternalCompletion.AddEditor(Editor); FInternalCompletion.ClearList; - for i := 0 to AutoCompleteList.Count - 1 do - if (Length(AutoCompleteList[i]) > 0) and (AutoCompleteList[i][1] <> '=') and (AutoCompleteList[i][1] <> '|') then + for I := 0 to AutoCompleteList.Count - 1 do + if (Length(AutoCompleteList[I]) > 0) and (AutoCompleteList[I][1] <> '=') and (AutoCompleteList[I][1] <> '|') then begin - if (i + 1 < AutoCompleteList.Count) and (length(AutoCompleteList[i + 1]) > 0) and - (AutoCompleteList[i + 1][1] = '|') then + if (I + 1 < AutoCompleteList.Count) and (length(AutoCompleteList[I + 1]) > 0) and + (AutoCompleteList[I + 1][1] = '|') then begin - Temp := AutoCompleteList[i + 1]; + Temp := AutoCompleteList[I + 1]; Delete(Temp, 1, 1); end else - Temp := AutoCompleteList[i]; - Temp := '\style{+B}' + AutoCompleteList[i] + '\style{-B}\column{}' + Temp; + Temp := AutoCompleteList[I]; + Temp := '\style{+B}' + AutoCompleteList[I] + '\style{-B}\column{}' + Temp; FInternalCompletion.ItemList.Add(Temp); - FInternalCompletion.InsertList.Add(AutoCompleteList[i]); + FInternalCompletion.InsertList.Add(AutoCompleteList[I]); end; FInternalCompletion.DoExecute(Editor); end; finally if Assigned(OnAfterExecute) then OnAfterExecute(Self); - end; + end; end; procedure TSynAutoComplete.DoInternalAutoCompletion(Sender: TObject; - const Value: UnicodeString; Shift: TShiftState; Index: Integer; EndToken: WideChar); + const Value: string; Shift: TShiftState; Index: Integer; EndToken: WideChar); begin ExecuteEx(GetPreviousToken(Editor), Editor, False); FInternalCompletion.Editor := nil; end; -function TSynAutoComplete.GetPreviousToken(Editor: TCustomSynEdit): UnicodeString; +function TSynAutoComplete.GetPreviousToken(Editor: TCustomSynEdit): string; var - s: UnicodeString; + s: string; i: Integer; begin Result := ''; @@ -3582,7 +3563,7 @@ procedure TSynAutoComplete.Notification(AComponent: TComponent; Operation: TOper inherited Notification(AComponent, Operation); end; -procedure TSynAutoComplete.SetAutoCompleteList(List: TUnicodeStrings); +procedure TSynAutoComplete.SetAutoCompleteList(List: TStrings); begin fAutoCompleteList.Assign(List); end; @@ -3595,11 +3576,9 @@ procedure TSynAutoComplete.SetEditor(const Value: TCustomSynEdit); begin Editor.RemoveKeyDownHandler( EditorKeyDown ); Editor.RemoveKeyPressHandler( EditorKeyPress ); - {$IFDEF SYN_COMPILER_5_UP} RemoveFreeNotification( Editor ); - {$ENDIF} end; - FEditor := Value; + fEditor := Value; if Editor <> nil then begin Editor.AddKeyDownHandler( EditorKeyDown ); @@ -3609,34 +3588,34 @@ procedure TSynAutoComplete.SetEditor(const Value: TCustomSynEdit); end; end; -function TSynAutoComplete.GetTokenList: UnicodeString; +function TSynAutoComplete.GetTokenList: string; var - List: TUnicodeStringList; + List: TStringList; i: Integer; begin Result := ''; if AutoCompleteList.Count < 1 then Exit; - List := TUnicodeStringList.Create; + List := TStringList.Create; i := 0; while (i < AutoCompleteList.Count) do begin if (length(AutoCompleteList[i]) > 0) and (AutoCompleteList[i][1] <> '=') then - List.Add(WideTrim(AutoCompleteList[i])); + List.Add(Trim(AutoCompleteList[i])); Inc(i); end; Result := List.Text; List.Free; end; -function TSynAutoComplete.GetTokenValue(Token: UnicodeString): UnicodeString; +function TSynAutoComplete.GetTokenValue(Token: string): string; var i: Integer; - List: TUnicodeStringList; + List: TStringList; begin Result := ''; i := AutoCompleteList.IndexOf(Token); if i <> -1 then begin - List := TUnicodeStringList.Create; + List := TStringList.Create; Inc(i); while (i < AutoCompleteList.Count) and (length(AutoCompleteList[i]) > 0) and @@ -3655,9 +3634,9 @@ function TSynAutoComplete.GetTokenValue(Token: UnicodeString): UnicodeString; procedure TSynAutoComplete.SetDoLookup(const Value: Boolean); begin FDoLookup := Value; - if FDoLookup and not(Assigned(FInternalCompletion)) then + if FDoLookup and not Assigned(FInternalCompletion) then CreateInternalCompletion - else begin + else if not FDoLookup and Assigned(FInternalCompletion) then begin FInternalCompletion.Free; FInternalCompletion := nil; end; @@ -3670,9 +3649,8 @@ procedure TSynAutoComplete.CreateInternalCompletion; FInternalCompletion.EndOfTokenChr := FEndOfTokenChr; FInternalCompletion.ShortCut := 0; FInternalCompletion.OnAfterCodeCompletion := DoInternalAutoCompletion; -// with FInternalCompletion.Columns.Add do -// //this is the trigger column -// BiggestWord := 'XXXXXXXX'; + FInternalCompletion.Columns.Add; + FInternalCompletion.Width := 350; end; function TSynAutoComplete.GetOptions: TSynCompletionOptions; @@ -3693,6 +3671,11 @@ procedure TSynAutoComplete.CancelCompletion; FInternalCompletion.CancelCompletion; end; +function TSynAutoComplete.GetCompletionProposal: TSynCompletionProposal; +begin + Result := FInternalCompletion; +end; + function TSynAutoComplete.GetExecuting: Boolean; begin if Assigned(FInternalCompletion) then diff --git a/Ext/SynEdit/Source/SynDBEdit.pas b/Ext/SynEdit/Source/SynDBEdit.pas index e77fcef..39b8770 100644 --- a/Ext/SynEdit/Source/SynDBEdit.pas +++ b/Ext/SynEdit/Source/SynDBEdit.pas @@ -1,4 +1,4 @@ -{------------------------------------------------------------------------------- +{------------------------------------------------------------------------------- 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 @@ -12,7 +12,7 @@ The Original Code is based on DBmwEdit.pas by Vladimir Kuznetsov, part of the mwEdit component suite. Portions created by Vladimir Kuznetsov are Copyright (C) 1999 Vladimir Kuznetsov. -Unicode translation by Maël Hörz. +Unicode translation by Maël Hörz. All Rights Reserved. Contributors to the SynEdit and mwEdit projects are listed in the @@ -27,32 +27,21 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynDBEdit.pas,v 1.11.2.2 2009/06/14 13:33:38 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} -{$IFNDEF QSYNDBEDIT} unit SynDBEdit; -{$ENDIF} {$I SynEdit.inc} interface uses -{$IFNDEF SYN_COMPILER_3_UP} - DbTables, -{$ENDIF} Windows, Messages, Controls, DbCtrls, SynEdit, + SynEditTypes, SynEditKeyCmds, SysUtils, Classes, @@ -62,7 +51,7 @@ interface TCustomDBSynEdit = class(TCustomSynEdit) private FDataLink: TFieldDataLink; - FEditing: Boolean; + fEditing: Boolean; FBeginEdit: Boolean; FLoadData: TNotifyEvent; procedure DataChange(Sender: TObject); @@ -88,7 +77,7 @@ TCustomDBSynEdit = class(TCustomSynEdit) destructor Destroy; override; procedure DragDrop(Source: TObject; X, Y: Integer); override; procedure ExecuteCommand(Command: TSynEditorCommand; AChar: WideChar; - Data: Pointer); override; + Data: pointer); override; procedure LoadMemo; procedure Notification(AComponent: TComponent; Operation: TOperation); override; @@ -96,7 +85,7 @@ TCustomDBSynEdit = class(TCustomSynEdit) property DataField: string read GetDataField write SetDataField; property DataSource: TDataSource read GetDataSource write SetDataSource; property Field: TField read GetField; - property OnLoadData: TNotifyEvent read FLoadData write FLoadData; + property OnLoadData: TNotifyEvent read fLoadData write fLoadData; end; TDBSynEdit = class(TCustomDBSynEdit) @@ -108,11 +97,10 @@ TDBSynEdit = class(TCustomDBSynEdit) // TCustomDBSynEdit events property OnLoadData; // inherited properties + property ActiveLineColor; property Align; - {$IFDEF SYN_COMPILER_4_UP} property Anchors; property Constraints; - {$ENDIF} property Color; property Ctl3D; property Enabled; @@ -135,9 +123,7 @@ TDBSynEdit = class(TCustomDBSynEdit) property OnDblClick; property OnDragDrop; property OnDragOver; - {$IFDEF SYN_COMPILER_4_UP} property OnEndDock; - {$ENDIF} property OnEndDrag; property OnEnter; property OnExit; @@ -147,9 +133,7 @@ TDBSynEdit = class(TCustomDBSynEdit) property OnMouseDown; property OnMouseMove; property OnMouseUp; - {$IFDEF SYN_COMPILER_4_UP} property OnStartDock; - {$ENDIF} property OnStartDrag; // TCustomSynEdit properties property BookMarkOptions; @@ -163,7 +147,6 @@ TDBSynEdit = class(TCustomDBSynEdit) property InsertCaret; property InsertMode; property Keystrokes; - property MaxScrollWidth; property MaxUndo; property Options; property OverwriteCaret; @@ -173,7 +156,6 @@ TDBSynEdit = class(TCustomDBSynEdit) property ScrollBars; property SearchEngine; property SelectedColor; - property SelectionMode; property TabWidth; property WantTabs; // TCustomSynEdit events @@ -182,7 +164,6 @@ TDBSynEdit = class(TCustomDBSynEdit) property OnDropFiles; property OnGutterClick; property OnGutterGetText; - property OnGutterPaint; property OnPaint; property OnPlaceBookmark; property OnProcessCommand; @@ -232,7 +213,7 @@ procedure TCustomDBSynEdit.CMExit(var Msg: TCMExit); procedure TCustomDBSynEdit.CMGetDataLink(var Msg: TMessage); begin - Msg.Result := LRESULT(FDataLink); + Msg.Result := Integer(FDataLink); end; procedure TCustomDBSynEdit.DataChange(Sender: TObject); @@ -244,11 +225,9 @@ procedure TCustomDBSynEdit.DataChange(Sender: TObject); FBeginEdit := False; Exit; end; -{$IFDEF SYN_COMPILER_3_UP} if FDataLink.Field.IsBlob then LoadMemo else -{$ENDIF} Text := FDataLink.Field.Text; if Assigned(FLoadData) then FLoadData(Self); @@ -280,7 +259,7 @@ procedure TCustomDBSynEdit.EditingChange(Sender: TObject); end; procedure TCustomDBSynEdit.ExecuteCommand(Command: TSynEditorCommand; - AChar: WideChar; Data: Pointer); + AChar: WideChar; Data: pointer); begin // cancel on [ESC] if (Command = ecChar) and (AChar = #27) then @@ -320,51 +299,31 @@ procedure TCustomDBSynEdit.Loaded; end; procedure TCustomDBSynEdit.LoadMemo; -{$IFDEF UNICODE} -const - BlobFieldWideText = [ftWideMemo,ftWideString]; -{$ENDIF} -{$IFDEF SYN_COMPILER_3_UP} var BlobStream: TStream; -{$ELSE} -var - BlobStream: TBlobStream; - BlobField: TBlobField; -{$ENDIF} begin try -{$IFDEF SYN_COMPILER_3_UP} BlobStream := FDataLink.DataSet.CreateBlobStream(FDataLink.Field, bmRead); -{$ELSE} - BlobField := FDataLink.Field as TBlobField; - BlobStream := TBlobStream.Create(BlobField, bmRead); -{$ENDIF} Lines.BeginUpdate; -{$IFDEF UNICODE} -//03.12.2019 fix for unicode -//Tested on UTF8 TEXT Sqlite3 & Zeos Unicode (UTF16) v7.2.6 -//For UTF8 use: System.SysUtils.TEncoding.UTF8 if ((FDataLink.Field is TBlobField) and - (TBlobField(FDataLink.Field).BlobType in BlobFieldWideText)) then + (TBlobField(FDataLink.Field).BlobType in [ftWideMemo,ftWideString])) + then Lines.LoadFromStream(BlobStream, TEncoding.Unicode) - else Lines.LoadFromStream(BlobStream, TEncoding.Default); -{$ELSE} //Non Unicode - Lines.LoadFromStream(BlobStream); -{$ENDIF} + else + //For UTF8 use: System.SysUtils.TEncoding.UTF8 + Lines.LoadFromStream(BlobStream, TEncoding.Default); Lines.EndUpdate; BlobStream.Free; Modified := False; ClearUndo; except - // Memo too large + // Memo too large on E: EInvalidOperation do Lines.Text := Format('(%s)', [E.Message]); end; EditingChange(Self); end; - procedure TCustomDBSynEdit.DoChange; begin FDataLink.Modified; @@ -395,12 +354,10 @@ procedure TCustomDBSynEdit.SetDataSource(Value: TDataSource); procedure TCustomDBSynEdit.SetEditing(Value: Boolean); begin - if FEditing <> Value then + if fEditing <> Value then begin - FEditing := Value; -{$IFDEF SYN_COMPILER_3_UP} + fEditing := Value; if not Assigned(FDataLink.Field) or not FDataLink.Field.IsBlob then -{$ENDIF} FDataLink.Reset; end; end; @@ -411,20 +368,17 @@ procedure TCustomDBSynEdit.SetReadOnly(Value: Boolean); end; procedure TCustomDBSynEdit.UpdateData(Sender: TObject); -{$IFDEF SYN_COMPILER_3_UP} var BlobStream: TStream; -{$ENDIF} begin -{$IFDEF SYN_COMPILER_3_UP} if FDataLink.Field.IsBlob then begin BlobStream := FDataLink.DataSet.CreateBlobStream(FDataLink.Field, bmWrite); Lines.SaveToStream(BlobStream); BlobStream.Free; end else -{$ENDIF} FDataLink.Field.AsString := Text; end; end. + diff --git a/Ext/SynEdit/Source/SynDWrite.pas b/Ext/SynEdit/Source/SynDWrite.pas new file mode 100644 index 0000000..9f6890d --- /dev/null +++ b/Ext/SynEdit/Source/SynDWrite.pas @@ -0,0 +1,2226 @@ +unit SynDWrite; +{------------------------------------------------------------------------------- +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. + +Alternatively, the contents of this file may be used under the terms of the +GNU General Public License Version 2 or later (the "GPL"), in which case +the provisions of the GPL are applicable instead of those above. +If you wish to allow use of your version of this file only under the terms +of the GPL and not to allow others to use your version of this file +under the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the GPL. +If you do not delete the provisions above, a recipient may use your version +of this file under either the MPL or the GPL. + +The Initial Author of this unit is pyscripter. +-------------------------------------------------------------------------------} +interface +Uses + Winapi.Windows, + Winapi.Messages, + Winapi.Wincodec, + Winapi.ActiveX, + Winapi.D2D1, + WinApi.DXGI, + Winapi.DxgiFormat, + System.Types, + System.UITypes, + System.SysUtils, + System.Classes, + System.Generics.Collections, + Vcl.Graphics, + Vcl.ImgList; + +{$IF CompilerVersion <= 33} +// some constants missing from old Delphi D2D1 unit +const + DWRITE_WORD_WRAPPING_EMERGENCY_BREAK = 2; + D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT = $00000004; + WICBitmapInterpolationModeHighQualityCubic = $00000004; +{$ENDIF} + +type +{$REGION 'IDWriteFactory Redeclaration'} + // Redeclaring the inteface to fix the declaration of CreateGdiCompatibleTextLayout + // https://quality.embarcadero.com/browse/RSP-36642 + // The root factory interface for all DWrite objects. + IDWriteFactory = interface(IUnknown) + [SID_IDWriteFactory] + function GetSystemFontCollection(out fontCollection: IDWriteFontCollection; + checkForUpdates: BOOL = FALSE): HResult; stdcall; + + function CreateCustomFontCollection( + const collectionLoader: IDWriteFontCollectionLoader; collectionKey: Pointer; + collectionKeySize: Cardinal; + out fontCollection: IDWriteFontCollection): HResult; stdcall; + + function RegisterFontCollectionLoader( + const fontCollectionLoader: IDWriteFontCollectionLoader): HResult; stdcall; + + function UnregisterFontCollectionLoader( + const fontCollectionLoader: IDWriteFontCollectionLoader): HResult; stdcall; + + function CreateFontFileReference(const filePath: PWCHAR; + lpLastWriteTime: PFILETIME; + out fontFile: IDWriteFontFile): HResult; stdcall; + + function CreateCustomFontFileReference(fontFileReferenceKey: Pointer; + fontFileReferenceKeySize: Cardinal; const fontFileLoader: IDWriteFontFileLoader; + out fontFile: IDWriteFontFile): HResult; stdcall; + + function CreateFontFace(fontFaceType: DWRITE_FONT_FACE_TYPE; + numberOfFiles: Cardinal; fontFiles: PIDWriteFontFile; + faceIndex: Cardinal; fontFaceSimulationFlags: DWRITE_FONT_SIMULATIONS; + out fontFace: IDWriteFontFace): HResult; stdcall; + + function CreateRenderingParams( + out renderingParams: IDWriteRenderingParams): HResult; stdcall; + + function CreateMonitorRenderingParams(monitor: HMONITOR; + out renderingParams: IDWriteRenderingParams): HResult; stdcall; + + function CreateCustomRenderingParams(gamma: Single; enhancedContrast: Single; + clearTypeLevel: Single; pixelGeometry: DWRITE_PIXEL_GEOMETRY; + renderingMode: DWRITE_RENDERING_MODE; + out renderingParams: IDWriteRenderingParams): HResult; stdcall; + + function RegisterFontFileLoader( + const fontFileLoader: IDWriteFontFileLoader): HResult; stdcall; + + function UnregisterFontFileLoader( + const fontFileLoader: IDWriteFontFileLoader): HResult; stdcall; + + function CreateTextFormat(const fontFamilyName: PWideChar; + fontCollection: IDWriteFontCollection; fontWeight: DWRITE_FONT_WEIGHT; + fontStyle: DWRITE_FONT_STYLE; fontStretch: DWRITE_FONT_STRETCH; + fontSize: Single; const localeName: PWideChar; + out textFormat: IDWriteTextFormat): HResult; stdcall; + + function CreateTypography( + out typography: IDWriteTypography): HResult; stdcall; + + function GetGdiInterop(out gdiInterop: IDWriteGdiInterop): HResult; stdcall; + + function CreateTextLayout(_string: PWCHAR; stringLength: Cardinal; + const textFormat: IDWriteTextFormat; maxWidth: Single; maxHeight: Single; + out textLayout: IDWriteTextLayout): HResult; stdcall; + + function CreateGdiCompatibleTextLayout(_string: PWCHAR; stringLength: Cardinal; + const textFormat: IDWriteTextFormat; layoutWidth: Single; layoutHeight: Single; + pixelsPerDip: Single; transform: PDwriteMatrix; useGdiNatural: BOOL; + out textLayout: IDWriteTextLayout): HResult; stdcall; + + function CreateEllipsisTrimmingSign(textFormat: IDWriteTextFormat; + out trimmingSign: IDWriteInlineObject): HResult; stdcall; + + function CreateTextAnalyzer( + out textAnalyzer: IDWriteTextAnalyzer): HResult; stdcall; + + function CreateNumberSubstitution( + substitutionMethod: DWRITE_NUMBER_SUBSTITUTION_METHOD; + var localeName: WideString; ignoreUserOverride: BOOL; + out numberSubstitution: IDWriteNumberSubstitution): HResult; stdcall; + + function CreateGlyphRunAnalysis(var glyphRun: TDwriteGlyphRun; + pixelsPerDip: Single; var transform: TDwriteMatrix; + renderingMode: TDWriteRenderingMode; measuringMode: TDWriteMeasuringMode; + baselineOriginX: Single; baselineOriginY: Single; + out glyphRunAnalysis: IDWriteGlyphRunAnalysis): HResult; stdcall; + end; + {$EXTERNALSYM IDWriteFactory} +{$ENDREGION} + +{$REGION 'IDWriteFontFace Redeclaration'} + // Redeclaring the inteface to fix the declaration of GetGDICompatibleGlyphMetrics + // https://quality.embarcadero.com/browse/RSP-36687 + IDWriteFontFace = interface(IUnknown) + [SID_IDWriteFontFace] + function GetType: DWRITE_FONT_FACE_TYPE; stdcall; + + function GetFiles(var numberOfFiles: Cardinal; + out fontFiles: IDWriteFontFile): HResult; stdcall; + + function GetIndex: UINT32; stdcall; + + function GetSimulations: DWRITE_FONT_SIMULATIONS; stdcall; + + function IsSymbolFont: BOOL; stdcall; + + procedure GetMetrics(var fontFaceMetrics: TDwriteFontMetrics); stdcall; + + function GetGlyphCount: UINT16; stdcall; + + function GetDesignGlyphMetrics(glyphIndices: PWord; glyphCount: Cardinal; + glyphMetrics: PDwriteGlyphMetrics; isSideways: BOOL = False): HResult; stdcall; + + function GetGlyphIndices(var codePoints: Cardinal; codePointCount: Cardinal; + var glyphIndices: Word): HResult; stdcall; + + function TryGetFontTable(openTypeTableTag: Cardinal; var tableData: Pointer; + var tableSize: Cardinal; var tableContext: Pointer; + var exists: BOOL): HResult; stdcall; + + procedure ReleaseFontTable(tableContext: Pointer); stdcall; + + function GetGlyphRunOutline(emSize: Single; const glyphIndices: PWord; + const glyphAdvances: PSingle; const glyphOffsets: PDwriteGlyphOffset; + glyphCount: Cardinal; isSideways: BOOL; isRightToLeft: BOOL; + geometrySink: IDWriteGeometrySink): HResult; stdcall; + + function GetRecommendedRenderingMode(emSize: Single; pixelsPerDip: Single; + measuringMode: TDWriteMeasuringMode; + const renderingParams: IDWriteRenderingParams; + var renderingMode: TDWriteRenderingMode): HResult; stdcall; + + function GetGdiCompatibleMetrics(emSize: Single; pixelsPerDip: Single; + transform: PDwriteMatrix; var fontFaceMetrics: DWRITE_FONT_METRICS): HResult; stdcall; + + function GetGdiCompatibleGlyphMetrics(emSize: single; pixelsPerDip: single; + transform: PDwriteMatrix; useGdiNatural: BOOL; glyphIndices: PWord; + glyphCount: Cardinal; fontFaceMetrics: PDwriteGlyphMetrics; + isSideways: BOOL = False): HResult; stdcall; end; +{$EXTERNALSYM IDWriteFontFace} +{$ENDREGION} + +{$REGION 'ID2D1GdiInteropRenderTarget Redeclaration'} + ID2D1GdiInteropRenderTarget = interface(IUnknown) + [SID_ID2D1GdiInteropRenderTarget] + function GetDC(mode: D2D1_DC_INITIALIZE_MODE; out hdc: HDC): HResult; stdcall; + + function ReleaseDC(update: PRect): HResult; stdcall; + end; +{$EXTERNALSYM ID2D1GdiInteropRenderTarget} +{$ENDREGION} + +{$REGION 'DWrite_1.h DWrite_2.h DWrite_3.h'} + IDWriteFont1 = interface(IDWriteFont) + ['{acd16696-8c14-4f5d-877e-fe3fc1d32738}'] + procedure GetMetrics(fontMetrics: Pointer); stdcall; //DWRITE_FONT_METRICS1 not translated + procedure GetPanose(panose: Pointer); stdcall; // panose structure not translated + function GetUnicodeRanges(maxRangeCount: UINT32; unicodeRanges: Pointer; // DWRITE_UNICODE_RANGE not tranlsated + out actualRangeCount: UINT32): HResult; stdcall; + function IsMonospacedFont(): longbool; stdcall; + end; + {$EXTERNALSYM IDWriteFont1} + + IDWriteTextLayout1 = interface(IDWriteTextLayout) + ['{9064D822-80A7-465C-A986-DF65F78B8FEB}'] + function SetPairKerning(isPairKerningEnabled: longbool; textRange: TDwriteTextRange): HResult; stdcall; + function GetPairKerning(currentPosition: UINT32; out isPairKerningEnabled: longbool; + out textRange: TDwriteTextRange): HResult; stdcall; + function SetCharacterSpacing(leadingSpacing: single; trailingSpacing: single; minimumAdvanceWidth: single; + textRange: TDwriteTextRange): HResult; stdcall; + function GetCharacterSpacing(currentPosition: UINT32; out leadingSpacing: single; out trailingSpacing: single; + out minimumAdvanceWidth: single; out textRange: TDwriteTextRange): HResult; stdcall; + end; + {$EXTERNALSYM IDWriteTextLayout1} +{$ENDREGION} + + +{$REGION 'Missing d2d1_1.h declarations'} +type + // Represents a 4-by-4 matrix. + PD2D_MATRIX_4X4_F = ^D2D_MATRIX_4X4_F; + D2D_MATRIX_4X4_F = record + _11: Single; + _12: Single; + _13: Single; + _14: Single; + + _21: Single; + _22: Single; + _23: Single; + _24: Single; + + _31: Single; + _32: Single; + _33: Single; + _34: Single; + + _41: Single; + _42: Single; + _43: Single; + _44: Single; + end; + {$EXTERNALSYM D2D_MATRIX_4X4_F} + PD2D1_MATRIX_4X4_F = ^D2D_MATRIX_4X4_F; + D2D1_MATRIX_4X4_F = D2D_MATRIX_4X4_F; + {$EXTERNALSYM D2D1_MATRIX_4X4_F} + +type + // A blend mode that applies to all primitives drawn on the context. + PD2D1_PRIMITIVE_BLEND = ^D2D1_PRIMITIVE_BLEND; + D2D1_PRIMITIVE_BLEND = DWord; + {$EXTERNALSYM D2D1_PRIMITIVE_BLEND} +const + D2D1_PRIMITIVE_BLEND_SOURCE_OVER = D2D1_PRIMITIVE_BLEND(0); + D2D1_PRIMITIVE_BLEND_COPY = D2D1_PRIMITIVE_BLEND(1); + D2D1_PRIMITIVE_BLEND_MIN = D2D1_PRIMITIVE_BLEND(2); + D2D1_PRIMITIVE_BLEND_ADD = D2D1_PRIMITIVE_BLEND(3); + D2D1_PRIMITIVE_BLEND_MAX = D2D1_PRIMITIVE_BLEND(4); + //D2D1_PRIMITIVE_BLEND_FORCE_DWORD = FORCEDWORD; + +type + // This is used to specify the quality of image scaling with + // ID2D1DeviceContext.DrawImage and with the 2D Affine Transform Effect. + PD2D1_INTERPOLATION_MODE = ^D2D1_INTERPOLATION_MODE; + D2D1_INTERPOLATION_MODE = DWord; + {$EXTERNALSYM D2D1_INTERPOLATION_MODE} +const + D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR = 0; + {$EXTERNALSYM D2D1_INTERPOLATION_MODE_NEAREST_NEIGHBOR} + D2D1_INTERPOLATION_MODE_LINEAR = 1; + {$EXTERNALSYM D2D1_INTERPOLATION_MODE_LINEAR} + D2D1_INTERPOLATION_MODE_CUBIC = 2; + {$EXTERNALSYM D2D1_INTERPOLATION_MODE_CUBIC} + D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR =3; + {$EXTERNALSYM D2D1_INTERPOLATION_MODE_MULTI_SAMPLE_LINEAR} + D2D1_INTERPOLATION_MODE_ANISOTROPIC = 4; + {$EXTERNALSYM D2D1_INTERPOLATION_MODE_ANISOTROPIC} + D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC = 5; + {$EXTERNALSYM D2D1_INTERPOLATION_MODE_HIGH_QUALITY_CUBIC} + D2D1_INTERPOLATION_MODE_DEFINITION_FANT = 6; + {$EXTERNALSYM D2D1_INTERPOLATION_MODE_DEFINITION_FANT} + D2D1_INTERPOLATION_MODE_DEFINITION_MIPMAP_LINEAR = 7; + {$EXTERNALSYM D2D1_INTERPOLATION_MODE_DEFINITION_MIPMAP_LINEAR} + //D2D1_INTERPOLATION_MODE_FORCE_DWORD = FORCEDWORD; + +type + // This specifies what units should be accepted by the D2D API. + PD2D1_UNIT_MODE = ^D2D1_UNIT_MODE; + D2D1_UNIT_MODE = DWord; + {$EXTERNALSYM D2D1_UNIT_MODE} +const + D2D1_UNIT_MODE_DIPS = D2D1_UNIT_MODE(0); + {$EXTERNALSYM D2D1_UNIT_MODE_DIPS} + D2D1_UNIT_MODE_PIXELS = D2D1_UNIT_MODE(1); + {$EXTERNALSYM D2D1_UNIT_MODE_PIXELS} + //D2D1_UNIT_MODE_FORCE_DWORD = FORCEDWORD; + +type + // Defines a color space. + PD2D1_COLOR_SPACE = ^D2D1_COLOR_SPACE; + D2D1_COLOR_SPACE = DWord; + {$EXTERNALSYM D2D1_COLOR_SPACE} + + // Specifies which way a color profile is defined. + PD2D1_COLOR_CONTEXT_TYPE = ^D2D1_COLOR_CONTEXT_TYPE; + D2D1_COLOR_CONTEXT_TYPE = DWord; + {$EXTERNALSYM D2D1_COLOR_CONTEXT_TYPE} + +type + // Specifies the pixel snapping policy when rendering color bitmap glyphs. + PD2D1_COLOR_BITMAP_GLYPH_SNAP_OPTION = ^D2D1_COLOR_BITMAP_GLYPH_SNAP_OPTION; + D2D1_COLOR_BITMAP_GLYPH_SNAP_OPTION = DWord; + {$EXTERNALSYM D2D1_COLOR_BITMAP_GLYPH_SNAP_OPTION} +const + // Color bitmap glyph positions are snapped to the nearest pixel if the bitmap + // resolution matches that of the device context. + D2D1_COLOR_BITMAP_GLYPH_SNAP_OPTION_DEFAULT = D2D1_COLOR_BITMAP_GLYPH_SNAP_OPTION(0); + {$EXTERNALSYM D2D1_COLOR_BITMAP_GLYPH_SNAP_OPTION_DEFAULT} + // Color bitmap glyph positions are not snapped. + D2D1_COLOR_BITMAP_GLYPH_SNAP_OPTION_DISABLE = D2D1_COLOR_BITMAP_GLYPH_SNAP_OPTION(1); + {$EXTERNALSYM D2D1_COLOR_BITMAP_GLYPH_SNAP_OPTION_DISABLE} + //D2D1_COLOR_BITMAP_GLYPH_SNAP_OPTION_FORCE_DWORD = FORCEDWORD; + +type + // This determines what gamma is used for interpolation/blending. + PD2D1_GAMMA1 = ^D2D1_GAMMA1; + D2D1_GAMMA1 = DWord; + {$EXTERNALSYM D2D1_GAMMA1} + +const + // Colors are manipulated in 2.2 gamma color space. + D2D1_GAMMA1_G22 = D2D1_GAMMA_2_2; + // Colors are manipulated in 1.0 gamma color space. + D2D1_GAMMA1_G10 = D2D1_GAMMA_1_0; + // Colors are manipulated in ST.2084 PQ gamma color space. + D2D1_GAMMA1_G2084 = D2D1_GAMMA1(2); + //D2D1_GAMMA1_FORCE_DWORD = FORCEDWORD; + + D2D1_COLOR_CONTEXT_TYPE_ICC = D2D1_COLOR_CONTEXT_TYPE(0); + {$EXTERNALSYM D2D1_COLOR_CONTEXT_TYPE_ICC} + D2D1_COLOR_CONTEXT_TYPE_SIMPLE = D2D1_COLOR_CONTEXT_TYPE(1); + {$EXTERNALSYM D2D1_COLOR_CONTEXT_TYPE_SIMPLE} + D2D1_COLOR_CONTEXT_TYPE_DXGI = D2D1_COLOR_CONTEXT_TYPE(2); + {$EXTERNALSYM D2D1_COLOR_CONTEXT_TYPE_DXGI} + //D2D1_COLOR_CONTEXT_TYPE_FORCE_DWORD = FORCEDWORD; + +type + // Specifies the composite mode that will be applied. + PD2D1_COMPOSITE_MODE = ^D2D1_COMPOSITE_MODE; + D2D1_COMPOSITE_MODE = DWord; + {$EXTERNALSYM D2D1_COMPOSITE_MODE} +const + D2D1_COMPOSITE_MODE_SOURCE_OVER = D2D1_COMPOSITE_MODE(0); + {$EXTERNALSYM D2D1_COMPOSITE_MODE_SOURCE_OVER} + D2D1_COMPOSITE_MODE_DESTINATION_OVER = D2D1_COMPOSITE_MODE(1); + {$EXTERNALSYM D2D1_COMPOSITE_MODE_DESTINATION_OVER} + D2D1_COMPOSITE_MODE_SOURCE_IN = D2D1_COMPOSITE_MODE(2); + {$EXTERNALSYM D2D1_COMPOSITE_MODE_SOURCE_IN} + D2D1_COMPOSITE_MODE_DESTINATION_IN = D2D1_COMPOSITE_MODE(3); + {$EXTERNALSYM D2D1_COMPOSITE_MODE_DESTINATION_IN} + D2D1_COMPOSITE_MODE_SOURCE_OUT = D2D1_COMPOSITE_MODE(4); + {$EXTERNALSYM D2D1_COMPOSITE_MODE_SOURCE_OUT} + D2D1_COMPOSITE_MODE_DESTINATION_OUT = D2D1_COMPOSITE_MODE(5); + {$EXTERNALSYM D2D1_COMPOSITE_MODE_DESTINATION_OUT} + D2D1_COMPOSITE_MODE_SOURCE_ATOP = D2D1_COMPOSITE_MODE(6); + {$EXTERNALSYM D2D1_COMPOSITE_MODE_SOURCE_ATOP} + D2D1_COMPOSITE_MODE_DESTINATION_ATOP = D2D1_COMPOSITE_MODE(7); + {$EXTERNALSYM D2D1_COMPOSITE_MODE_DESTINATION_ATOP} + D2D1_COMPOSITE_MODE_XOR = D2D1_COMPOSITE_MODE(8); + {$EXTERNALSYM D2D1_COMPOSITE_MODE_XOR} + D2D1_COMPOSITE_MODE_PLUS = D2D1_COMPOSITE_MODE(9); + {$EXTERNALSYM D2D1_COMPOSITE_MODE_PLUS} + D2D1_COMPOSITE_MODE_SOURCE_COPY = D2D1_COMPOSITE_MODE(10); + {$EXTERNALSYM D2D1_COMPOSITE_MODE_SOURCE_COPY} + D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY = D2D1_COMPOSITE_MODE(11); + {$EXTERNALSYM D2D1_COMPOSITE_MODE_BOUNDED_SOURCE_COPY} + D2D1_COMPOSITE_MODE_MASK_INVERT = D2D1_COMPOSITE_MODE(12); + {$EXTERNALSYM D2D1_COMPOSITE_MODE_MASK_INVERT} + //D2D1_COMPOSITE_MODE_FORCE_DWORD = FORCEDWORD; + +// D2D1_LAYER_OPTIONS1 +type + // Specifies how the layer contents should be prepared. + PD2D1_LAYER_OPTIONS1 = ^D2D1_LAYER_OPTIONS1; + D2D1_LAYER_OPTIONS1 = Dword; + {$EXTERNALSYM D2D1_LAYER_OPTIONS1} +const + D2D1_LAYER_OPTIONS1_NONE = D2D1_LAYER_OPTIONS1(0); + D2D1_LAYER_OPTIONS1_INITIALIZE_FROM_BACKGROUND = D2D1_LAYER_OPTIONS1(1); + D2D1_LAYER_OPTIONS1_IGNORE_ALPHA = D2D1_LAYER_OPTIONS1(2); + //D2D1_LAYER_OPTIONS1_FORCE_DWORD = FORCEDWORD; + +type + // This specifies the precision that should be used in buffers allocated by D2D. + PD2D1_BUFFER_PRECISION = ^D2D1_BUFFER_PRECISION; + D2D1_BUFFER_PRECISION = DWord; + {$EXTERNALSYM D2D1_BUFFER_PRECISION} +const + D2D1_BUFFER_PRECISION_UNKNOWN = D2D1_BUFFER_PRECISION(0); + {$EXTERNALSYM D2D1_BUFFER_PRECISION_UNKNOWN} + D2D1_BUFFER_PRECISION_8BPC_UNORM = D2D1_BUFFER_PRECISION(1); + {$EXTERNALSYM D2D1_BUFFER_PRECISION_8BPC_UNORM} + D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB = D2D1_BUFFER_PRECISION(2); + {$EXTERNALSYM D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB} + D2D1_BUFFER_PRECISION_16BPC_UNORM = D2D1_BUFFER_PRECISION(3); + {$EXTERNALSYM D2D1_BUFFER_PRECISION_16BPC_UNORM} + D2D1_BUFFER_PRECISION_16BPC_FLOAT = D2D1_BUFFER_PRECISION(4); + {$EXTERNALSYM D2D1_BUFFER_PRECISION_16BPC_FLOAT} + D2D1_BUFFER_PRECISION_32BPC_FLOAT = D2D1_BUFFER_PRECISION(5); + {$EXTERNALSYM D2D1_BUFFER_PRECISION_32BPC_FLOAT} + //D2D1_BUFFER_PRECISION_FORCE_DWORD = FORCEDWORD; + +type + // Specifies how the bitmap can be used. + PD2D1_BITMAP_OPTIONS = ^D2D1_BITMAP_OPTIONS; + D2D1_BITMAP_OPTIONS = DWord; + {$EXTERNALSYM D2D1_BITMAP_OPTIONS} +const + // The bitmap is created with default properties. + D2D1_BITMAP_OPTIONS_NONE = D2D1_BITMAP_OPTIONS($00000000); + // The bitmap can be specified as a target in ID2D1DeviceContext.SetTarget + D2D1_BITMAP_OPTIONS_TARGET = D2D1_BITMAP_OPTIONS($00000001); + // The bitmap cannot be used as an input to DrawBitmap, DrawImage, in a bitmap + // brush or as an input to an effect. + D2D1_BITMAP_OPTIONS_CANNOT_DRAW = D2D1_BITMAP_OPTIONS($00000002); + // The bitmap can be read from the CPU. + D2D1_BITMAP_OPTIONS_CPU_READ = D2D1_BITMAP_OPTIONS($00000004); + // The bitmap works with the ID2D1GdiInteropRenderTarget.GetDC API. + D2D1_BITMAP_OPTIONS_GDI_COMPATIBLE = D2D1_BITMAP_OPTIONS($00000008); + // D2D1_BITMAP_OPTIONS_FORCE_DWORD = FORCEDWORD; + +type + // This describes how the individual mapping operation should be performed. + PD2D1_MAP_OPTIONS = ^D2D1_MAP_OPTIONS; + D2D1_MAP_OPTIONS = DWord; + {$EXTERNALSYM D2D1_MAP_OPTIONS} +const + // The mapped pointer has undefined behavior. + D2D1_MAP_OPTIONS_NONE = D2D1_MAP_OPTIONS(0); + {$EXTERNALSYM D2D1_MAP_OPTIONS_NONE} + + // The mapped pointer can be read from. + D2D1_MAP_OPTIONS_READ = D2D1_MAP_OPTIONS(1); + {$EXTERNALSYM D2D1_MAP_OPTIONS_READ} + + // The mapped pointer can be written to. + D2D1_MAP_OPTIONS_WRITE = D2D1_MAP_OPTIONS(2); + {$EXTERNALSYM D2D1_MAP_OPTIONS_WRITE} + + // The previous contents of the bitmap are discarded when it is mapped. + D2D1_MAP_OPTIONS_DISCARD = D2D1_MAP_OPTIONS(4); + {$EXTERNALSYM D2D1_MAP_OPTIONS_DISCARD} + //D2D1_MAP_OPTIONS_FORCE_DWORD = FORCEDWORD; + + +type + // This enum defines the valid property types that can be used in an effect property + // interface. + PD2D1_PROPERTY_TYPE = ^D2D1_PROPERTY_TYPE; + D2D1_PROPERTY_TYPE = DWord; + {$EXTERNALSYM D2D1_PROPERTY_TYPE} +const + D2D1_PROPERTY_TYPE_UNKNOWN = D2D1_PROPERTY_TYPE(0); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_UNKNOWN} + D2D1_PROPERTY_TYPE_STRING = D2D1_PROPERTY_TYPE(1); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_STRING} + D2D1_PROPERTY_TYPE_BOOL = D2D1_PROPERTY_TYPE(2); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_BOOL} + D2D1_PROPERTY_TYPE_UINT32 = D2D1_PROPERTY_TYPE(3); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_UINT32} + D2D1_PROPERTY_TYPE_INT32 = D2D1_PROPERTY_TYPE(4); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_INT32} + D2D1_PROPERTY_TYPE_FLOAT = D2D1_PROPERTY_TYPE(5); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_FLOAT} + D2D1_PROPERTY_TYPE_VECTOR2 = D2D1_PROPERTY_TYPE(6); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_VECTOR2} + D2D1_PROPERTY_TYPE_VECTOR3 = D2D1_PROPERTY_TYPE(7); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_VECTOR3} + D2D1_PROPERTY_TYPE_VECTOR4 = D2D1_PROPERTY_TYPE(8); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_VECTOR4} + D2D1_PROPERTY_TYPE_BLOB = D2D1_PROPERTY_TYPE(9); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_BLOB} + D2D1_PROPERTY_TYPE_IUNKNOWN = D2D1_PROPERTY_TYPE(10); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_IUNKNOWN} + D2D1_PROPERTY_TYPE_ENUM = D2D1_PROPERTY_TYPE(11); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_ENUM} + D2D1_PROPERTY_TYPE_ARRAY = D2D1_PROPERTY_TYPE(12); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_ARRAY} + D2D1_PROPERTY_TYPE_CLSID = D2D1_PROPERTY_TYPE(13); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_CLSID} + D2D1_PROPERTY_TYPE_MATRIX_3X2 = D2D1_PROPERTY_TYPE(14); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_MATRIX_3X2} + D2D1_PROPERTY_TYPE_MATRIX_4X3 = D2D1_PROPERTY_TYPE(15); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_MATRIX_4X3} + D2D1_PROPERTY_TYPE_MATRIX_4X4 = D2D1_PROPERTY_TYPE(16); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_MATRIX_4X4} + D2D1_PROPERTY_TYPE_MATRIX_5X4 = D2D1_PROPERTY_TYPE(17); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_MATRIX_5X4} + D2D1_PROPERTY_TYPE_COLOR_CONTEXT = D2D1_PROPERTY_TYPE(18); + {$EXTERNALSYM D2D1_PROPERTY_TYPE_COLOR_CONTEXT} +// D2D1_PROPERTY_TYPE_FORCE_DWORD = FORCEDWORD; + +type + // This specifies how colors are interpolated. + PD2D1_COLOR_INTERPOLATION_MODE = ^D2D1_COLOR_INTERPOLATION_MODE; + D2D1_COLOR_INTERPOLATION_MODE = DWord; + {$EXTERNALSYM D2D1_COLOR_INTERPOLATION_MODE} +const + // Colors will be interpolated in straight alpha space. + D2D1_COLOR_INTERPOLATION_MODE_STRAIGHT = D2D1_COLOR_INTERPOLATION_MODE(0); + {$EXTERNALSYM D2D1_COLOR_INTERPOLATION_MODE_STRAIGHT} + // Colors will be interpolated in premultiplied alpha space. + D2D1_COLOR_INTERPOLATION_MODE_PREMULTIPLIED = D2D1_COLOR_INTERPOLATION_MODE(1); + {$EXTERNALSYM D2D1_COLOR_INTERPOLATION_MODE_PREMULTIPLIED} + //D2D1_COLOR_INTERPOLATION_MODE_FORCE_DWORD = FORCEDWORD; + +type + // This specifies options that apply to the device context for its lifetime. + PD2D1_DEVICE_CONTEXT_OPTIONS = ^D2D1_DEVICE_CONTEXT_OPTIONS; + D2D1_DEVICE_CONTEXT_OPTIONS = DWord; + {$EXTERNALSYM D2D1_DEVICE_CONTEXT_OPTIONS} +const + D2D1_DEVICE_CONTEXT_OPTIONS_NONE = D2D1_DEVICE_CONTEXT_OPTIONS(0); + // Geometry rendering will be performed on many threads in parallel); a single + // thread is the default. + D2D1_DEVICE_CONTEXT_OPTIONS_ENABLE_MULTITHREADED_OPTIMIZATIONS = D2D1_DEVICE_CONTEXT_OPTIONS(1); + //D2D1_DEVICE_CONTEXT_OPTIONS_FORCE_DWORD = FORCEDWORD; + +type + // Defines when font resources should be subset during printing. + PD2D1_PRINT_FONT_SUBSET_MODE = ^D2D1_PRINT_FONT_SUBSET_MODE; + D2D1_PRINT_FONT_SUBSET_MODE = DWord; + {$EXTERNALSYM D2D1_PRINT_FONT_SUBSET_MODE} +const + // Subset for used glyphs, send and discard font resource after every five pages + D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT = D2D1_PRINT_FONT_SUBSET_MODE(0); + {$EXTERNALSYM D2D1_PRINT_FONT_SUBSET_MODE_DEFAULT} + // Subset for used glyphs, send and discard font resource after each page + D2D1_PRINT_FONT_SUBSET_MODE_EACHPAGE = D2D1_PRINT_FONT_SUBSET_MODE(1); + {$EXTERNALSYM D2D1_PRINT_FONT_SUBSET_MODE_EACHPAGE} + // Do not subset, reuse font for all pages, send it after first page + D2D1_PRINT_FONT_SUBSET_MODE_NONE = D2D1_PRINT_FONT_SUBSET_MODE(2); + {$EXTERNALSYM D2D1_PRINT_FONT_SUBSET_MODE_NONE} + //D2D1_PRINT_FONT_SUBSET_MODE_FORCE_DWORD = FORCEDWORD; + +type + // Describes mapped memory from the ID2D1Bitmap1.Map API. + PD2D1_MAPPED_RECT = ^D2D1_MAPPED_RECT; + D2D1_MAPPED_RECT = record + pitch: UINT32; + bits: PByte; + end; + {$EXTERNALSYM D2D1_MAPPED_RECT} + + // All parameters related to pushing a layer. + PD2D1_LAYER_PARAMETERS1 = ^D2D1_LAYER_PARAMETERS1; + D2D1_LAYER_PARAMETERS1 = record + contentBounds: D2D1_RECT_F; + geometricMask: ID2D1Geometry; + maskAntialiasMode: D2D1_ANTIALIAS_MODE; + maskTransform: D2D1_MATRIX_3X2_F; + opacity: Single; + opacityBrush: ID2D1Brush; + layerOptions: D2D1_LAYER_OPTIONS1; + end; + {$EXTERNALSYM D2D1_LAYER_PARAMETERS1} + + // Contains the position and color of a gradient stop. + PD2D1_GRADIENT_STOP = ^D2D1_GRADIENT_STOP; + D2D1_GRADIENT_STOP = record + position: Single; + color: D2D1_COLOR_F; + end; + {$EXTERNALSYM D2D1_GRADIENT_STOP} + + // Creation properties for an image brush. + PD2D1_IMAGE_BRUSH_PROPERTIES = ^D2D1_IMAGE_BRUSH_PROPERTIES; + D2D1_IMAGE_BRUSH_PROPERTIES = record + sourceRectangle: D2D1_RECT_F; + extendModeX: D2D1_EXTEND_MODE; + extendModeY: D2D1_EXTEND_MODE; + interpolationMode: D2D1_INTERPOLATION_MODE; + end; + {$EXTERNALSYM D2D1_IMAGE_BRUSH_PROPERTIES} + + + // Describes the extend modes and the interpolation mode of an ID2D1BitmapBrush. + PD2D1_BITMAP_BRUSH_PROPERTIES1 = ^D2D1_BITMAP_BRUSH_PROPERTIES1; + D2D1_BITMAP_BRUSH_PROPERTIES1 = record + extendModeX: D2D1_EXTEND_MODE; + extendModeY: D2D1_EXTEND_MODE; + interpolationMode: D2D1_INTERPOLATION_MODE; + end; + {$EXTERNALSYM D2D1_BITMAP_BRUSH_PROPERTIES1} + + // This controls advanced settings of the Direct2D imaging pipeline. + PD2D1_RENDERING_CONTROLS = ^D2D1_RENDERING_CONTROLS; + D2D1_RENDERING_CONTROLS = record + // The default buffer precision, used if the precision isn't otherwise specified. + bufferPrecision: D2D1_BUFFER_PRECISION; + // The size of allocated tiles used to render imaging effects. + tileSize: D2D1_SIZE_U; + end; + {$EXTERNALSYM D2D1_RENDERING_CONTROLS} + + + // The creation properties for a ID2D1PrintControl object. + PD2D1_PRINT_CONTROL_PROPERTIES = ^D2D1_PRINT_CONTROL_PROPERTIES; + D2D1_PRINT_CONTROL_PROPERTIES = record + fontSubset: D2D1_PRINT_FONT_SUBSET_MODE; + // DPI for rasterization of all unsupported D2D commands or options, defaults to + // 150.0 + rasterDPI: Single; + // Color space for vector graphics in XPS package + colorSpace: D2D1_COLOR_SPACE; + end; + {$EXTERNALSYM D2D1_PRINT_CONTROL_PROPERTIES} + + // Interface ID2D1ColorContext + // =========================== + // Represents a color context that can be used with an ID2D1Bitmap1 object. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1ColorContext);'} + {$EXTERNALSYM ID2D1ColorContext} + ID2D1ColorContext = interface(ID2D1Resource) + ['{1c4820bb-5771-4518-a581-2fe4dd0ec657}'] + + // Retrieves the color space of the color context. + function GetColorSpace(): D2D1_COLOR_SPACE; stdcall; + + // Retrieves the size of the color profile, in bytes. + function GetProfileSize(): UINT32; stdcall; + + // Retrieves the color profile bytes. + function GetProfile(out profile: PByte; + profileSize: UINT32): HResult; stdcall; + + end; + IID_ID2D1ColorContext = ID2D1ColorContext; + {$EXTERNALSYM IID_ID2D1ColorContext} + + + // Interface ID2D1GradientStopCollection1 + // ====================================== + // Represents an collection of gradient stops that can then be the source resource + // for either a linear or radial gradient brush. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1GradientStopCollection1);'} + {$EXTERNALSYM ID2D1GradientStopCollection1} + ID2D1GradientStopCollection1 = interface(ID2D1GradientStopCollection) + ['{ae1572f4-5dd0-4777-998b-9279472ae63b}'] + + // Copies the gradient stops from the collection into the caller's memory. If this + // object was created using ID2D1DeviceContext.CreateGradientStopCollection, this + // method returns the same values as were specified in the creation method. If this + // object was created using ID2D1RenderTarget.CreateGradientStopCollection, the + // stops returned here will first be transformed into the gamma space specified by + // the colorInterpolationGamma parameter. + procedure GetGradientStops1(out gradientStops: PD2D1_GRADIENT_STOP; + gradientStopsCount: UINT32); stdcall; + + // Returns the color space in which interpolation occurs. If this object was + // created using ID2D1RenderTarget.CreateGradientStopCollection, this method + // returns the color space related to the color interpolation gamma. + function GetPreInterpolationSpace(): D2D1_COLOR_SPACE; stdcall; + + // Returns the color space colors will be converted to after interpolation occurs. + // If this object was created using + // ID2D1RenderTarget.CreateGradientStopCollection, this method returns + // D2D1_COLOR_SPACE_SRGB. + function GetPostInterpolationSpace(): D2D1_COLOR_SPACE; stdcall; + + // Returns the buffer precision of this gradient. If this object was created using + // ID2D1RenderTarget.CreateGradientStopCollection, this method returns + // D2D1_BUFFER_PRECISION_8BPC_UNORM. + function GetBufferPrecision(): D2D1_BUFFER_PRECISION; stdcall; + + // Returns the interpolation mode used to interpolate colors in the gradient. + function GetColorInterpolationMode(): D2D1_COLOR_INTERPOLATION_MODE; stdcall; + + end; + IID_ID2D1GradientStopCollection1 = ID2D1GradientStopCollection1; + {$EXTERNALSYM IID_ID2D1GradientStopCollection1} + + + // Extended bitmap properties. + PD2D1_BITMAP_PROPERTIES1 = ^D2D1_BITMAP_PROPERTIES1; + D2D1_BITMAP_PROPERTIES1 = record + _pixelFormat: D2D1_PIXEL_FORMAT; + dpiX: Single; + dpiY: Single; + // Specifies how the bitmap can be used. + bitmapOptions: D2D1_BITMAP_OPTIONS; + colorContext: ID2D1ColorContext; + end; + {$EXTERNALSYM D2D1_BITMAP_PROPERTIES1} + + // Interface ID2D1Image + // ==================== + // Represents a producer of pixels that can fill an arbitrary 2D plane. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1Image);'} + {$EXTERNALSYM ID2D1Image} + ID2D1Image = interface(ID2D1Resource) + ['{65019f75-8da2-497c-b32c-dfa34e48ede6}'] + + end; + IID_ID2D1Image = ID2D1Image; + {$EXTERNALSYM IID_ID2D1Image} + + // Interface ID2D1GdiMetafileSink + // ============================== + // User-implementable interface for introspecting on a metafile. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1GdiMetafileSink);'} + {$EXTERNALSYM ID2D1GdiMetafileSink} + ID2D1GdiMetafileSink = interface(IUnknown) + ['{82237326-8111-4f7c-bcf4-b5c1175564fe}'] + + // Callback for examining a metafile record. + function ProcessRecord(recordType: DWORD; + recordData: Pointer; + recordDataSize: DWORD): HResult; stdcall; + + end; + IID_ID2D1GdiMetafileSink = ID2D1GdiMetafileSink; + {$EXTERNALSYM IID_ID2D1GdiMetafileSink} + + + // Interface ID2D1GdiMetafile + // ========================== + // Interface encapsulating a GDI/GDI+ metafile. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1GdiMetafile);'} + {$EXTERNALSYM ID2D1GdiMetafile} + ID2D1GdiMetafile = interface(ID2D1Resource) + ['{2f543dc3-cfc1-4211-864f-cfd91c6f3395}'] + + // Play the metafile into a caller-supplied sink interface. + function Stream(sink: ID2D1GdiMetafileSink): HResult; stdcall; + + + // Gets the bounds of the metafile. + function GetBounds(out bounds: D2D1_RECT_F): HResult; stdcall; + + end; + IID_ID2D1GdiMetafile = ID2D1GdiMetafile; + {$EXTERNALSYM IID_ID2D1GdiMetafile} + + // Interface ID2D1Bitmap1 + // ====================== + // Represents a bitmap that can be used as a surface for an ID2D1DeviceContext or + // mapped into system memory, and can contain additional color context information. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1Bitmap1);'} + {$EXTERNALSYM ID2D1Bitmap1} + ID2D1Bitmap1 = interface(ID2D1Bitmap) + ['{a898a84c-3873-4588-b08b-ebbf978df041}'] + + // Retrieves the color context information associated with the bitmap. + procedure GetColorContext(out colorContext: ID2D1ColorContext); stdcall; + + // Retrieves the bitmap options used when creating the API. + function GetOptions(): D2D1_BITMAP_OPTIONS; stdcall; + + // Retrieves the DXGI surface from the corresponding bitmap, if the bitmap was + // created from a device derived from a D3D device. + function GetSurface(out dxgiSurface: IDXGISurface): HResult; stdcall; + + // Maps the given bitmap into memory. The bitmap must have been created with the + // D2D1_BITMAP_OPTIONS_CPU_READ flag. + function Map(options: D2D1_MAP_OPTIONS; + out mappedRect: D2D1_MAPPED_RECT): HResult; stdcall; + + // Unmaps the given bitmap from memory. + function Unmap(): HResult; stdcall; + + end; + IID_ID2D1Bitmap1 = ID2D1Bitmap1; + {$EXTERNALSYM IID_ID2D1Bitmap1} + + // Interface ID2D1CommandSink + // ========================== + // Caller-supplied implementation of an interface to receive the recorded command + // list. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1CommandSink);'} + {$EXTERNALSYM ID2D1CommandSink} + ID2D1CommandSink = interface(IUnknown) + ['{54d7898a-a061-40a7-bec7-e465bcba2c4f}'] + + function BeginDraw(): HResult; stdcall; + + function EndDraw(): HResult; stdcall; + + function SetAntialiasMode(antialiasMode: D2D1_ANTIALIAS_MODE): HResult; stdcall; + + function SetTags(tag1: D2D1_TAG; + tag2: D2D1_TAG): HResult; stdcall; + + function SetTextAntialiasMode(textAntialiasMode: D2D1_TEXT_ANTIALIAS_MODE): HResult; stdcall; + // The text rendering options to be applied to all subsequent text and glyph + // drawing operations; IUnknown(Nil) to clear current text rendering options. + function SetTextRenderingParams(textRenderingParams: IDWriteRenderingParams): HResult; stdcall; + + function SetTransform(transform: D2D1_MATRIX_3X2_F): HResult; stdcall; + + function SetPrimitiveBlend(primitiveBlend: D2D1_PRIMITIVE_BLEND): HResult; stdcall; + + function SetUnitMode(unitMode: D2D1_UNIT_MODE): HResult; stdcall; + + function Clear(color: D2D1_COLOR_F): HResult; stdcall; + + function DrawGlyphRun(baselineOrigin: D2D1_POINT_2F; + glyphRun: DWRITE_GLYPH_RUN; + glyphRunDescription: DWRITE_GLYPH_RUN_DESCRIPTION; + foregroundBrush: ID2D1Brush; + measuringMode: DWRITE_MEASURING_MODE): HResult; stdcall; + + function DrawLine(point0: D2D1_POINT_2F; + point1: D2D1_POINT_2F; + brush: ID2D1Brush; + strokeWidth: Single; + strokeStyle: ID2D1StrokeStyle): HResult; stdcall; + + function DrawGeometry(geometry: ID2D1Geometry; + brush: ID2D1Brush; + strokeWidth: Single; + strokeStyle: ID2D1StrokeStyle): HResult; stdcall; + + function DrawRectangle(rect: D2D1_RECT_F; + brush: ID2D1Brush; + strokeWidth: Single; + strokeStyle: ID2D1StrokeStyle): HResult; stdcall; + + function DrawBitmap(bitmap: ID2D1Bitmap; + destinationRectangle: D2D1_RECT_F; + opacity: Single; + interpolationMode: D2D1_INTERPOLATION_MODE; + sourceRectangle: D2D1_RECT_F; + perspectiveTransform: D2D1_MATRIX_4X4_F): HResult; stdcall; + + function DrawImage(image: ID2D1Image; + targetOffset: D2D1_POINT_2F; + imageRectangle: D2D1_RECT_F; + interpolationMode: D2D1_INTERPOLATION_MODE; + compositeMode: D2D1_COMPOSITE_MODE): HResult; stdcall; + + function DrawGdiMetafile(gdiMetafile: ID2D1GdiMetafile; + targetOffset: D2D1_POINT_2F): HResult; stdcall; + + function FillMesh(mesh: ID2D1Mesh; + brush: ID2D1Brush): HResult; stdcall; + + function FillOpacityMask(opacityMask: ID2D1Bitmap; + brush: ID2D1Brush; + destinationRectangle: D2D1_RECT_F; + sourceRectangle: D2D1_RECT_F): HResult; stdcall; + + function FillGeometry(geometry: ID2D1Geometry; + brush: ID2D1Brush; + opacityBrush: ID2D1Brush): HResult; stdcall; + + function FillRectangle(rect: D2D1_RECT_F; + brush: ID2D1Brush): HResult; stdcall; + + function PushAxisAlignedClip(clipRect: D2D1_RECT_F; + antialiasMode: D2D1_ANTIALIAS_MODE): HResult; stdcall; + + function PushLayer(layerParameters1: D2D1_LAYER_PARAMETERS1; + layer: ID2D1Layer): HResult; stdcall; + + function PopAxisAlignedClip(): HResult; stdcall; + + function PopLayer(): HResult; stdcall; + + end; + IID_ID2D1CommandSink = ID2D1CommandSink; + {$EXTERNALSYM IID_ID2D1CommandSink} + + // Interface ID2D1CommandList + // ========================== + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1CommandList);'} + {$EXTERNALSYM ID2D1CommandList} + ID2D1CommandList = interface(ID2D1Image) + ['{b4f34a19-2383-4d76-94f6-ec343657c3dc}'] + + // Play the command list into a caller-supplied sink interface. + function Stream(sink: ID2D1CommandSink): HResult; stdcall; + + // Marks the command list as ready for use. + function Close(): HResult; stdcall; + + end; + IID_ID2D1CommandList = ID2D1CommandList; + {$EXTERNALSYM IID_ID2D1CommandList} + +type + // Interface ID2D1ImageBrush + // ========================= + // Provides a brush that can take any effect, command list or bitmap and use it to + // fill a 2D shape. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1ImageBrush);'} + {$EXTERNALSYM ID2D1ImageBrush} + ID2D1ImageBrush = interface(ID2D1Brush) + ['{fe9e984d-3f95-407c-b5db-cb94d4e8f87c}'] + + procedure SetImage(image: ID2D1Image); stdcall; + + procedure SetExtendModeX(extendModeX: D2D1_EXTEND_MODE); stdcall; + + procedure SetExtendModeY(extendModeY: D2D1_EXTEND_MODE); stdcall; + + procedure SetInterpolationMode(interpolationMode: D2D1_INTERPOLATION_MODE); stdcall; + + procedure SetSourceRectangle(sourceRectangle: D2D1_RECT_F); stdcall; + + procedure GetImage(out image: ID2D1Image); stdcall; + + function GetExtendModeX(): D2D1_EXTEND_MODE; stdcall; + + function GetExtendModeY(): D2D1_EXTEND_MODE; stdcall; + + function GetInterpolationMode(): D2D1_INTERPOLATION_MODE; stdcall; + + procedure GetSourceRectangle(out sourceRectangle: D2D1_RECT_F); stdcall; + + end; + IID_ID2D1ImageBrush = ID2D1ImageBrush; + {$EXTERNALSYM IID_ID2D1ImageBrush} + + + // Interface ID2D1BitmapBrush1 + // =========================== + // A bitmap brush allows a bitmap to be used to fill a geometry. Interpolation + // mode is specified with D2D1_INTERPOLATION_MODE + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1BitmapBrush1);'} + {$EXTERNALSYM ID2D1BitmapBrush1} + ID2D1BitmapBrush1 = interface(ID2D1BitmapBrush) + ['{41343a53-e41a-49a2-91cd-21793bbb62e5}'] + + // Sets the interpolation mode used when this brush is used. + procedure SetInterpolationMode1(interpolationMode: D2D1_INTERPOLATION_MODE); stdcall; + + function GetInterpolationMode1(): D2D1_INTERPOLATION_MODE; stdcall; + + end; + IID_ID2D1BitmapBrush1 = ID2D1BitmapBrush1; + {$EXTERNALSYM IID_ID2D1BitmapBrush1} + + // Interface ID2D1Properties + // ========================= + // Represents a set of run-time bindable and discoverable properties that allow a + // data-driven application to modify the state of a Direct2D effect. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1Properties);'} + {$EXTERNALSYM ID2D1Properties} + ID2D1Properties = interface(IUnknown) + ['{483473d7-cd46-4f9d-9d3a-3112aa80159d}'] + + // Returns the total number of custom properties in this interface. + function GetPropertyCount(): UINT32; stdcall; + + // Retrieves the property name from the given property index. + function GetPropertyName(index: UINT32; + out name: LPWSTR; + nameCount: UINT32): HResult; stdcall; + + // Returns the length of the property name from the given index. + function GetPropertyNameLength(index: UINT32): UINT32; stdcall; + + // Retrieves the type of the given property. + function GetType(index: UINT32): D2D1_PROPERTY_TYPE; stdcall; + + // Retrieves the property index for the given property name. + function GetPropertyIndex(name: LPWSTR): UINT32; stdcall; + + + // Sets the value of the given property using its name. + function SetValueByName(name: LPWSTR; + _type: D2D1_PROPERTY_TYPE; + data: PByte; + dataSize: UINT32): HResult; stdcall; + + // Sets the given value using the property index. + function SetValue(index: UINT32; + _type: D2D1_PROPERTY_TYPE; + data: PByte; + dataSize: UINT32): HResult; stdcall; + + // Retrieves the given property or sub-property by name. '.' is the delimiter for + // sub-properties. + function GetValueByName(name: LPWSTR; + _type: D2D1_PROPERTY_TYPE; + data: PByte; + dataSize: UINT32): HResult; stdcall; + + + // Retrieves the given value by index. + function GetValue(index: UINT32; + _type: D2D1_PROPERTY_TYPE; + data: PByte; + dataSize: UINT32): HResult; stdcall; + + + // Returns the value size for the given property index. + function GetValueSize(index: UINT32): UINT32; stdcall; + + + // Retrieves the sub-properties of the given property by index. + function GetSubProperties(index: UINT32; + out subProperties: ID2D1Properties): HResult; stdcall; + + end; + IID_ID2D1Properties = ID2D1Properties; + {$EXTERNALSYM IID_ID2D1Properties} + + + // Interface ID2D1Effect + // ===================== + // The effect interface. Properties control how the effect is rendered. The effect + // is Drawn with the DrawImage call. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1Effect);'} + {$EXTERNALSYM ID2D1Effect} + ID2D1Effect = interface(ID2D1Properties) + ['{28211a43-7d89-476f-8181-2d6159b220ad}'] + + // Sets the input to the given effect. The input can be a concrete bitmap or the + // output of another effect. + procedure SetInput(index: UINT32; + input: ID2D1Image = Nil; + invalidate: BOOL = TRUE); stdcall; + + // If the effect supports a variable number of inputs, this sets the number of + // input that are currently active on the effect. + function SetInputCount(inputCount: UINT32): HResult; stdcall; + + // Returns the input image to the effect. The input could be another effect or a + // bitmap. + procedure GetInput(index: UINT32; + out input: ID2D1Image); stdcall; + + // This returns the number of input that are bound into this effect. + function GetInputCount(): UINT32; stdcall; + + + // Returns the output image of the given effect. This can be set as the input to + // another effect or can be drawn with DrawImage. + procedure GetOutput(out outputImage: ID2D1Image); stdcall; + + end; + IID_ID2D1Effect = ID2D1Effect; + {$EXTERNALSYM IID_ID2D1Effect} + + // This identifies a certain input connection of a certain effect. + PD2D1_EFFECT_INPUT_DESCRIPTION = ^D2D1_EFFECT_INPUT_DESCRIPTION; + D2D1_EFFECT_INPUT_DESCRIPTION = record + // The effect whose input connection is being specified. + effect: ID2D1Effect; + // The index of the input connection into the specified effect. + inputIndex: UINT32; + // The rectangle which would be available on the specified input connection during + // render operations. + inputRectangle: D2D1_RECT_F; + end; + {$EXTERNALSYM D2D1_EFFECT_INPUT_DESCRIPTION} + + // Interface IPrintDocumentPackageTarget + // ===================================== + // Document Target IPrintDocumentPackageTarget interface: + // Allows user to enumerate supported package target types and create one with type ID. + // It also supports tracking package printing progess and cancelling. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IPrintDocumentPackageTarget);'} + {$EXTERNALSYM IPrintDocumentPackageTarget} + IPrintDocumentPackageTarget = interface(IUnknown) + ['{1b8efec4-3019-4c27-964e-367202156906}'] + + // This method is called for enumerating supported target types. + // The first GUID is preferred type by target. + function GetPackageTargetTypes(out targetCount: UINT32; + out targetTypes: PGUID): HResult; stdcall; + + // This method is called for createing a target instance.")] + function GetPackageTarget({in} const guidTargetType: TGUID; + {in} const riid: TGUID; + out ppvTarget: Pointer): HResult; stdcall; + + function Cancel(): HResult; stdcall; + end; + IID_IPrintDocumentPackageTarget = IPrintDocumentPackageTarget; + {$EXTERNALSYM IID_IPrintDocumentPackageTarget} + + PPrintDocumentPackageCompletion = ^PrintDocumentPackageCompletion; + PrintDocumentPackageCompletion = ( + PrintDocumentPackageCompletion_InProgress = 0, + PrintDocumentPackageCompletion_Completed = ( PrintDocumentPackageCompletion_InProgress + 1), + PrintDocumentPackageCompletion_Canceled = ( PrintDocumentPackageCompletion_Completed + 1), + PrintDocumentPackageCompletion_Failed = ( PrintDocumentPackageCompletion_Canceled + 1) + ); + {$EXTERNALSYM PrintDocumentPackageCompletion} + + + PPrintDocumentPackageStatus = ^PrintDocumentPackageStatus; + PrintDocumentPackageStatus = record + JobId: UINT32; + CurrentDocument: INT32; + CurrentPage: INT32; + CurrentPageTotal: INT32; + Completion: PrintDocumentPackageCompletion; + PackageStatus: HResult; + end; + {$EXTERNALSYM PrintDocumentPackageStatus} + + + // Interface ID2D1PrintControl + // =========================== + // Converts Direct2D primitives stored in an ID2D1CommandList into a fixed page + // representation. The print sub-system then consumes the primitives. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1PrintControl);'} + {$EXTERNALSYM ID2D1PrintControl} + ID2D1PrintControl = interface(IUnknown) + ['{2c1d867d-c290-41c8-ae7e-34a98702e9a5}'] + + function AddPage(commandList: ID2D1CommandList; + pageSize: D2D_SIZE_F; + pagePrintTicketStream: IStream; + {out_opt} tag1: PD2D1TAG = Nil; + {out_opt} tag2: PD2D1TAG = Nil): HResult; stdcall; + + function Close(): HResult; stdcall; + + end; + IID_ID2D1PrintControl = ID2D1PrintControl; + {$EXTERNALSYM IID_ID2D1PrintControl} + + + PID2D1Device = ^ID2D1Device; + ID2D1Device = interface; + + // Interface ID2D1DeviceContext + // ============================ + // The device context represents a set of state and a command buffer that is used + // to render to a target bitmap. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1DeviceContext);'} + {$EXTERNALSYM ID2D1DeviceContext} + ID2D1DeviceContext = interface(ID2D1RenderTarget) + ['{e8f7fe7a-191c-466d-ad95-975678bda998}'] + + // Creates a bitmap with extended bitmap properties, potentially from a block of + // memory. + function CreateBitmap(size: D2D1_SIZE_U; + sourceData: Pointer; + pitch: UINT32; + bitmapProperties: PD2D1_BITMAP_PROPERTIES1; + out bitmap: ID2D1Bitmap1): HResult; stdcall; + + // Create a D2D bitmap by copying a WIC bitmap. + function CreateBitmapFromWicBitmap(wicBitmapSource: IWICBitmapSource; + bitmapProperties: PD2D1_BITMAP_PROPERTIES1; + out bitmap: ID2D1Bitmap1): HResult; stdcall; + + // Creates a color context from a color space. If the space is Custom, the context + // is initialized from the profile/profileSize arguments. Otherwise the context is + // initialized with the profile bytes associated with the space and + // profile/profileSize are ignored. + function CreateColorContext(space: D2D1_COLOR_SPACE; + profile: PByte; + profileSize: UINT32; + out colorContext: ID2D1ColorContext): HResult; stdcall; + + function CreateColorContextFromFilename(filename: LPWSTR; + out colorContext: ID2D1ColorContext): HResult; stdcall; + + function CreateColorContextFromWicColorContext(wicColorContext: IWICColorContext; + out colorContext: ID2D1ColorContext): HResult; stdcall; + + // Creates a bitmap from a DXGI surface with a set of extended properties. + function CreateBitmapFromDxgiSurface(surface: IDXGISurface; + {opt} bitmapProperties: PD2D1_BITMAP_PROPERTIES1; + out bitmap: ID2D1Bitmap1): HResult; stdcall; + + // Create a new effect, the effect must either be built in or previously registered + // through ID2D1Factory1.RegisterEffectFromStream or + // ID2D1Factory1.RegisterEffectFromString. + function CreateEffect(const effectId: TGUID; + out effect: ID2D1Effect): HResult; stdcall; + + // A gradient stop collection represents a set of stops in an ideal unit length. + // This is the source resource for a linear gradient and radial gradient brush. + + // Specifies both the input color space and the + // space in which the color interpolation occurs. + // Specifies the color space colors will be + // converted to after interpolation occurs. + // Specifies the precision in which the gradient + // buffer will be held. + // Specifies how the gradient will be extended outside of + // the unit length. + // Determines if colors will be interpolated + // in straight alpha or premultiplied alpha space. + function CreateGradientStopCollection(straightAlphaGradientStops: D2D1_GRADIENT_STOP; + straightAlphaGradientStopsCount: UINT32; + preInterpolationSpace: D2D1_COLOR_SPACE; + postInterpolationSpace: D2D1_COLOR_SPACE; + bufferPrecision: D2D1_BUFFER_PRECISION; + extendMode: D2D1_EXTEND_MODE; + colorInterpolationMode: D2D1_COLOR_INTERPOLATION_MODE; + out gradientStopCollection1: ID2D1GradientStopCollection1): HResult; stdcall; + + // Creates an image brush, the input image can be any type of image, including a + // bitmap, effect and a command list. + function CreateImageBrush(image: ID2D1Image; + imageBrushProperties: D2D1_IMAGE_BRUSH_PROPERTIES; + brushProperties: D2D1_BRUSH_PROPERTIES; + out imageBrush: ID2D1ImageBrush): HResult; stdcall; + + function CreateBitmapBrush(bitmap: ID2D1Bitmap; + bitmapBrushProperties: PD2D1_BITMAP_BRUSH_PROPERTIES1; + brushProperties: D2D1_BRUSH_PROPERTIES; + out bitmapBrush: ID2D1BitmapBrush1): HResult; stdcall; + + // Creates a new command list. + function CreateCommandList(out commandList: ID2D1CommandList): HResult; stdcall; + + // Indicates whether the format is supported by D2D. + function IsDxgiFormatSupported(format: DXGI_FORMAT): BOOL; stdcall; + + // Indicates whether the buffer precision is supported by D2D. + function IsBufferPrecisionSupported(bufferPrecision: D2D1_BUFFER_PRECISION): BOOL; stdcall; + + // This retrieves the local-space bounds in DIPs of the current image using the + // device context DPI. + function GetImageLocalBounds(image: ID2D1Image; + out localBounds: D2D1_RECT_F): HResult; stdcall; + + // This retrieves the world-space bounds in DIPs of the current image using the + // device context DPI. + function GetImageWorldBounds(image: ID2D1Image; + out worldBounds: D2D1_RECT_F): HResult; stdcall; + + // Retrieves the world-space bounds in DIPs of the glyph run using the device + // context DPI. + function GetGlyphRunWorldBounds(baselineOrigin: D2D1_POINT_2F; + glyphRun: DWRITE_GLYPH_RUN; + measuringMode: DWRITE_MEASURING_MODE; + out bounds: D2D1_RECT_F): HResult; stdcall; + + // Retrieves the device associated with this device context. + procedure GetDevice(out device: ID2D1Device); stdcall; + + // Sets the target for this device context to point to the given image. The image + // can be a command list or a bitmap created with the D2D1_BITMAP_OPTIONS_TARGET + // flag. + procedure SetTarget(image: ID2D1Image); stdcall; + + // Gets the target that this device context is currently pointing to. + procedure GetTarget(out image: ID2D1Image); stdcall; + + // Sets tuning parameters for internal rendering inside the device context. + procedure SetRenderingControls(renderingControls: D2D1_RENDERING_CONTROLS); stdcall; + + // This retrieves the rendering controls currently selected into the device + // context. + procedure GetRenderingControls(out renderingControls: D2D1_RENDERING_CONTROLS); stdcall; + + // Changes the primitive blending mode for all of the rendering operations. + procedure SetPrimitiveBlend(primitiveBlend: D2D1_PRIMITIVE_BLEND); stdcall; + + // Returns the primitive blend currently selected into the device context. + function GetPrimitiveBlend(): D2D1_PRIMITIVE_BLEND; stdcall; + + // Changes the units used for all of the rendering operations. + procedure SetUnitMode(unitMode: D2D1_UNIT_MODE); stdcall; + + // Returns the unit mode currently set on the device context. + function GetUnitMode(): D2D1_UNIT_MODE; stdcall; + + // Draws the glyph run with an extended description to describe the glyphs. + procedure DrawGlyphRun(baselineOrigin: D2D1_POINT_2F; + glyphRun: DWRITE_GLYPH_RUN; + glyphRunDescription: DWRITE_GLYPH_RUN_DESCRIPTION; + foregroundBrush: ID2D1Brush; + measuringMode: DWRITE_MEASURING_MODE = DWRITE_MEASURING_MODE_NATURAL); stdcall; + + // Draw an image to the device context. The image represents either a concrete + // bitmap or the output of an effect graph. + procedure DrawImage(image: ID2D1Image; + targetOffset: PD2D1POINT2F = Nil; + imageRectangle: PD2D1RECTF = Nil; + interpolationMode: D2D1_INTERPOLATION_MODE = D2D1_INTERPOLATION_MODE_LINEAR; + compositeMode: D2D1_COMPOSITE_MODE = D2D1_COMPOSITE_MODE_SOURCE_OVER); stdcall; + + // Draw a metafile to the device context. + procedure DrawGdiMetafile(gdiMetafile: ID2D1GdiMetafile; + targetOffset: PD2D1POINT2F = Nil); stdcall; + + procedure DrawBitmap(bitmap: ID2D1Bitmap; + destinationRectangle: D2D1_RECT_F; + opacity: Single; + interpolationMode: D2D1_INTERPOLATION_MODE; + sourceRectangle: PD2D1RECTF = Nil; + perspectiveTransform: PD2D1_MATRIX_4X4_F = Nil); stdcall; + + // Push a layer on the device context. + procedure PushLayer(layerParameters: D2D1_LAYER_PARAMETERS1; + layer: ID2D1Layer); stdcall; + + // This indicates that a portion of an effect's input is invalid. This method can + // be called many times. + function InvalidateEffectInputRectangle(effect: ID2D1Effect; + input: UINT32; + inputRectangle: D2D1_RECT_F): HResult; stdcall; + + // Gets the number of invalid ouptut rectangles that have accumulated at the + // effect. + function GetEffectInvalidRectangleCount(effect: ID2D1Effect; + out rectangleCount: UINT32): HResult; stdcall; + + // Gets the invalid rectangles that are at the output of the effect. + function GetEffectInvalidRectangles(effect: ID2D1Effect; + out rectangles: PD2D1RECTF; // pointer to array of D2D1_RECT_F + rectanglesCount: UINT32): HResult; stdcall; + + // Gets the maximum region of each specified input which would be used during a + // subsequent rendering operation + function GetEffectRequiredInputRectangles(renderEffect: ID2D1Effect; + renderImageRectangle: D2D1_RECT_F; + inputDescriptions: PD2D1_EFFECT_INPUT_DESCRIPTION; + out requiredInputRects: D2D1_RECT_F; // pointer to array of D2D1_RECT_F + inputCount: UINT32): HResult; stdcall; + + // Fill using the alpha channel of the supplied opacity mask bitmap. The brush + // opacity will be modulated by the mask. The render target antialiasing mode must + // be set to aliased. + procedure FillOpacityMask(opacityMask: ID2D1Bitmap; + brush: ID2D1Brush; + destinationRectangle: PD2D1RECTF = Nil; + sourceRectangle: PD2D1RECTF = Nil); stdcall; + + end; + IID_ID2D1DeviceContext = ID2D1DeviceContext; + {$EXTERNALSYM IID_ID2D1DeviceContext} + + // Interface ID2D1Device + // ===================== + // The device defines a resource domain whose objects and device contexts can be + // used together. + // + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(ID2D1Device);'} + {$EXTERNALSYM ID2D1Device} + ID2D1Device = interface(ID2D1Resource) + ['{47dd575d-ac05-4cdd-8049-9b02cd16f44c}'] + + // Creates a new device context with no initially assigned target. + function CreateDeviceContext(options: D2D1_DEVICE_CONTEXT_OPTIONS; + out deviceContext: ID2D1DeviceContext): HResult; stdcall; + + // Creates a D2D print control. + function CreatePrintControl(const wicFactory: IWICImagingFactory; + const documentTarget: IPrintDocumentPackageTarget; + printControlProperties: PD2D1_PRINT_CONTROL_PROPERTIES; + out printControl: ID2D1PrintControl): HResult; stdcall; + + // Sets the maximum amount of texture memory to maintain before evicting caches. + procedure SetMaximumTextureMemory(maximumInBytes: UINT64); stdcall; + + // Gets the maximum amount of texture memory to maintain before evicting caches. + function GetMaximumTextureMemory(): UINT64; stdcall; + + // Clears all resources that are cached but not held in use by the application + // through an interface reference. + procedure ClearResources(millisecondsSinceUse: UINT32 = 0); stdcall; + + end; + IID_ID2D1Device = ID2D1Device; + {$EXTERNALSYM IID_ID2D1Device} +{$ENDREGION 'Missing d2d1_1.h declarations} + +{$REGION 'Missing documenttarget.h declarations'} + {$HPPEMIT 'DECLARE_DINTERFACE_TYPE(IPrintDocumentPackageTargetFactory);'} + {$EXTERNALSYM IPrintDocumentPackageTargetFactory} + IPrintDocumentPackageTargetFactory = interface(IUnknown) + ['{D2959BF7-B31B-4A3D-9600-712EB1335BA4}'] + function CreateDocumentPackageTargetForPrintJob(printerName: PWideChar; jobName: PWideChar; + const jobOutputStream: IStream; + const jobPrintTicketStream: IStream; + out docPackageTarget: IPrintDocumentPackageTarget): HResult; stdcall; + end; + IID_IPrintDocumentPackageTargetFactory = IPrintDocumentPackageTargetFactory; + {$EXTERNALSYM IID_IPrintDocumentPackageTargetFactory} + +{$ENDREGION 'Missing documenttarget.h declarations'} + +type + TSynDWrite = class + private + class var SingletonD2DFactory: ID2D1Factory; + class var SingletonRenderTarget: ID2D1DCRenderTarget; + class var SingletonDWriteFactory: IDWriteFactory; + class var SingletonGDIInterop: IDWriteGdiInterop; + class var SingletonDottedStrokeStyle: ID2D1StrokeStyle; + class var SingletonImagingFactory: IWICImagingFactory; + class var SingletonPrintDocumentPackageTargetFactory: IPrintDocumentPackageTargetFactory; + class var FSolidBrushes: TDictionary; + class var FGradientGutterBrush: ID2D1LinearGradientBrush; + class var FGradientBrushStartColor, FGradientBrushEndColor: TColor; + public + class function D2DFactory(factoryType: TD2D1FactoryType=D2D1_FACTORY_TYPE_SINGLE_THREADED; + factoryOptions: PD2D1FactoryOptions=nil): ID2D1Factory; static; + class function RenderTarget: ID2D1DCRenderTarget; static; + class function DWriteFactory: IDWriteFactory; static; + class function GDIInterop: IDWriteGdiInterop; static; + class function ImagingFactory: IWICImagingFactory; static; + class function PrintDocumentPackageTargetFactory: IPrintDocumentPackageTargetFactory; static; + class function SolidBrush(Color: TColor): ID2D1SolidColorBrush; overload; static; + class function SolidBrush(Color: TD2D1ColorF): ID2D1SolidColorBrush; overload; static; + class function DottedStrokeStyle: ID2D1StrokeStyle; static; + class function GradientGutterBrush(StartColor, EndColor: TColor): ID2D1LinearGradientBrush; + class procedure ResetRenderTarget; static; + // if SynEdit inside a DLL call Finalize before unloading the DLL (https://github.com/TurboPack/SynEdit/issues/249) + class procedure Finalize; + end; + + TSynTextFormat = record + private + FIDW: IDWriteTextFormat; + FCharExtra: Cardinal; + FUseGDINatural: Boolean; + FCharWidth: Cardinal; + FLineHeight: Cardinal; + public + constructor Create(AFont: TFont; TabWidth: Cardinal = 2; + CharExtra: Cardinal = 0; LineSpacingExtra: Cardinal = 0); + property IDW: IDWriteTextFormat read FIDW; + property CharWidth: Cardinal read FCharWidth; + property LineHeight: Cardinal read FLineHeight; + property CharExtra: Cardinal read FCharExtra; + property UseGDINatural: Boolean read FUseGDINatural; + end; + + TSynTypography = (typEmpty, typDefault, typNoLigatures); + + TSynTextLayout = record + private + FIDW: IDWriteTextLayout; + FCount: Integer; + public + TextOptions: D2D1_DRAW_TEXT_OPTIONS; + property IDW: IDWriteTextLayout read FIDW; + constructor Create(TextFormat: TSynTextFormat; Text: PChar; const Count: Cardinal; + const LayoutWidth: Cardinal = MaxInt; const layoutHeight: Cardinal = MaxInt; + WordWrap: Boolean = False; PixelsPerDip: Single = 1); + procedure SetFontStyle(FontStyles: System.UITypes.TFontStyles; const Start, + Count: Integer); + procedure SetFontColor(Color: TD2D1ColorF; const Start, Count: Integer); overload; + procedure SetFontColor(Color: TColor; const Start, Count: Integer); overload; + procedure SetTypography(Typography: TSynTypography; const Start, Count: Integer); + procedure SetTextAlignment(TextAlignment: DWRITE_TEXT_ALIGNMENT); + procedure SetParagraphAlignment(ParagraphAlignment: DWRITE_PARAGRAPH_ALIGNMENT); + procedure Draw(RT: ID2D1RenderTarget; X, Y: Integer; FontColor: TColor; Alpha: Single = 1); + procedure DrawClipped(RT: ID2D1RenderTarget; X, Y: Integer; ClipRect: TRect; + FontColor: TColor; Alpha: Single = 1); + function TextMetrics: TDwriteTextMetrics; + end; + + ISynWicRenderTarget = interface + ['{1142A46F-9BF4-449C-9C4A-A22B19716202}'] + function GetIDW: ID2D1RenderTarget; + property IDW: ID2D1RenderTarget read GetIDW; + end; + + TSynWicRenderTarget = class(TInterfacedObject, ISynWicRenderTarget) + private + FWicBitmap: IWICBitmap; + FIDW: ID2D1RenderTarget; + function GetIDW: ID2D1RenderTarget; + public + constructor Create(const Width, Height: Integer); + end; + + function SynWicRenderTarget(const Width, Height: Integer): ISynWicRenderTarget; + +type + TGraphemeEnumerator = record + private + FTextLayout: IDWriteTextLayout; + FStart: Integer; + FString: string; + FCurrent: string; + public + constructor Create(const AValue: string); + function MoveNext: Boolean; + function GetCurrent: string; inline; + property Current: string read GetCurrent; + end; + + TGraphemeEnumeratorHelper = record + private + FString: string; + public + constructor Create(const AValue: string); + function GetEnumerator: TGraphemeEnumerator; + end; + +function Graphemes(const AValue: string): TGraphemeEnumeratorHelper; + +// Support functions +function D2D1ColorF(const AColor: TColor; Opacity: Single = 1.0): TD2D1ColorF; overload; +function DWTextRange(startPosition: Cardinal; length: Cardinal): TDwriteTextRange; +function DWFontFeature(nameTag: DWRITE_FONT_FEATURE_TAG; parameter: Cardinal): TDwriteFontFeature; +function DWGetTypography(Features: array of Integer): IDWriteTypography; +function WicBitmapFromBitmap(Bitmap: TBitmap): IWICBitmap; +function ScaledWicBitmap(Source: IWICBitmap; + const ScaledWidth, ScaledHeight: Integer): IWICBitmap; +procedure ImageListDraw(RT: ID2D1RenderTarget; IL: TCustomImageList; X, Y, + Index: Integer); +function IsFontMonospacedAndValid(Font: TFont): Boolean; +function FontFamilyName(Font: IDWriteFont): string; +/// +/// Converts a Delphi bitmap to a ID2D1Bitmap. +/// Similar to the one in Vcl.Direct2D +/// +function D2D1BitmapFromBitmap(Bitmap: TBitmap; RT: ID2D1RenderTarget): ID2D1Bitmap; + +var + clNoneF: TD2D1ColorF; + +implementation + +Uses + Winapi.CommCtrl, + System.Math, + System.Win.ComObj, + Vcl.Forms, + SynUnicode, + SynEditTypes, + SynEditMiscProcs; + +resourcestring + SYNS_FontFamilyNotFound = 'Font family name not found'; + +{$REGION 'Support functions'} + +function D2D1ColorF(const AColor: TColor; Opacity: Single): TD2D1ColorF; +var + RGB: Cardinal; +const + CScale = 1 / 255; +begin + RGB := ColorToRGB(AColor); + Result.r := TColors(RGB).R * CScale; + Result.g := TColors(RGB).G * CScale; + Result.b := TColors(RGB).B * CScale; + Result.a := Opacity; +end; + +function DWTextRange(startPosition: Cardinal; length: Cardinal): TDwriteTextRange; +begin + // startPosition is zero-based + Result.startPosition := startPosition - 1; + Result.Length := length; +end; + +function DWFontFeature(nameTag: DWRITE_FONT_FEATURE_TAG; parameter: Cardinal): TDwriteFontFeature; +begin + Result.nameTag := nameTag; + Result.parameter := parameter; +end; + +function DWGetTypography(Features: array of Integer): IDWriteTypography; +var + Feature: Integer; +begin + CheckOSError(TSynDWrite.DWriteFactory.CreateTypography(Result)); + for Feature in Features do + CheckOSError(Result.AddFontFeature(DWFontFeature(Feature, 1))); +end; + +function WicBitmapFromBitmap(Bitmap: TBitmap): IWICBitmap; +begin + Assert(Bitmap.PixelFormat = pf32bit); + Bitmap.AlphaFormat := afDefined; + CheckOSError(TSynDWrite.ImagingFactory.CreateBitmapFromHBITMAP(Bitmap.Handle, + 0, WICBitmapUsePremultipliedAlpha, Result)); +end; + +function ScaledWicBitmap(Source: IWICBitmap; + const ScaledWidth, ScaledHeight: Integer): IWICBitmap; +var + Scaler: IWICBitmapScaler; +begin + TSynDWrite.ImagingFactory.CreateBitmapScaler(Scaler); + Scaler.Initialize(Source, ScaledWidth, ScaledHeight, + WICBitmapInterpolationModeHighQualityCubic); + Result := IWICBitmap(Scaler); +end; + +procedure ImageListDraw(RT: ID2D1RenderTarget; IL: TCustomImageList; + X, Y, Index: Integer); +var + Bitmap: ID2D1Bitmap; + BitmapInfo: TBitmapInfo; + Buf: array of Byte; + BitmapProperties: TD2D1BitmapProperties; + Icon: HIcon; + IconInfo: TIconInfo; + R: TRectF; + DC: HDC; +begin + Icon := ImageList_GetIcon(IL.Handle, Index, ILD_NORMAL); + try + if not GetIconInfo(Icon, IconInfo) then + Exit; + try + DC := CreateCompatibleDC(0); + try + FillChar(BitmapInfo, SizeOf(BitmapInfo), 0); + BitmapInfo.bmiHeader.biSize := Sizeof(BitmapInfo.bmiHeader); + // call with nil to get the Bitmap Info filled. + if (GetDIBits(DC, IconInfo.hbmColor, 0, IL.Height, nil, BitmapInfo, DIB_RGB_COLORS) = 0) or + (BitmapInfo.bmiHeader.biBitCount <> 32) + then + Exit; // Exit if it fails or if biBitCount <> 32 + BitmapInfo.bmiHeader.biCompression := BI_RGB; // set to uncompressed + SetLength(Buf, IL.Height * IL.Width * 4); + if GetDIBits(DC, IconInfo.hbmColor, 0, IL.Height, @Buf[0], BitmapInfo, DIB_RGB_COLORS) = 0 then + Exit; + finally + DeleteDC(DC); + end; + finally + DeleteObject(IconInfo.hbmColor); + DeleteObject(IconInfo.hbmMask); + end; + finally + DestroyIcon(Icon); + end; + + BitmapProperties := D2D1BitmapProperties(D2D1PixelFormat( + DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED), 0, 0); + + CheckOSError(RT.CreateBitmap(D2D1SizeU(IL.Width, IL.Height), @Buf[0], + 4 * IL.Width, BitmapProperties, Bitmap)); + + R := Rect(X, Y, X + IL.Width, Y + IL.Height); + RT.DrawBitmap(Bitmap, @R, 1); +end; + +function IsFontMonospacedAndValid(Font: TFont): Boolean; +var + LogFont: TLogFont; + DWFont: IDWriteFont; +begin + if GetObject(Font.Handle, SizeOf(TLogFont), @LogFont) = 0 then + Exit(False); + try + CheckOSError(TSynDWrite.GDIInterop.CreateFontFromLOGFONT(LogFont, DWFont)); + Result := (DWFont as IDWriteFont1).IsMonospacedFont; + if (FontFamilyName(DWFont) <> Font.Name) and (fsBold in Font.Style) then + Font.Style := Font.Style - [fsBold]; + except + Exit(False); + end; +end; + +function FontFamilyName(Font: IDWriteFont): string; +var + FontFamily: IDWriteFontFamily; + Names: IDWriteLocalizedStrings; + Index: Cardinal; + Exists: BOOL; + NameLength: Cardinal; +begin + Result := ''; + + CheckOSError(Font.GetFontFamily(FontFamily)); + CheckOSError(FontFamily.GetFamilyNames(Names)); + if Names.GetCount > 0 then + begin + CheckOSError(Names.FindLocaleName(UserLocaleName, Index, Exists)); + if not Exists then + begin + CheckOSError(Names.FindLocaleName('en-us', Index, Exists)); + if not Exists then + Index := 0; + end; + CheckOSError(Names.GetStringLength(Index, NameLength)); + SetLength(Result, NameLength); + CheckOSError(Names.GetString(Index, PChar(Result), NameLength + 1)); + end + else + raise ESynError.CreateRes(@SYNS_FontFamilyNotFound); +end; + +function D2D1BitmapFromBitmap(Bitmap: TBitmap; RT: ID2D1RenderTarget): ID2D1Bitmap; +var + BitmapInfo: TBitmapInfo; + buf: array of Byte; + BitmapProperties: TD2D1BitmapProperties; + Hbmp: HBitmap; +begin + FillChar(BitmapInfo, SizeOf(BitmapInfo), 0); + BitmapInfo.bmiHeader.biSize := Sizeof(BitmapInfo.bmiHeader); + BitmapInfo.bmiHeader.biHeight := -Bitmap.Height; + BitmapInfo.bmiHeader.biWidth := Bitmap.Width; + BitmapInfo.bmiHeader.biPlanes := 1; + BitmapInfo.bmiHeader.biBitCount := 32; + + SetLength(buf, Bitmap.Height * Bitmap.Width * 4); + // Forces evaluation of Bitmap.Handle before Bitmap.Canvas.Handle + Hbmp := Bitmap.Handle; + GetDIBits(Bitmap.Canvas.Handle, Hbmp, 0, Bitmap.Height, @buf[0], BitmapInfo, DIB_RGB_COLORS); + + BitmapProperties.dpiX := 0; + BitmapProperties.dpiY := 0; + BitmapProperties.pixelFormat.format := DXGI_FORMAT_B8G8R8A8_UNORM; + if (Bitmap.PixelFormat <> pf32bit) or (Bitmap.AlphaFormat = afIgnored) then + BitmapProperties.pixelFormat.alphaMode := D2D1_ALPHA_MODE_IGNORE + else + BitmapProperties.pixelFormat.alphaMode := D2D1_ALPHA_MODE_PREMULTIPLIED; + + + RT.CreateBitmap(D2D1SizeU(Bitmap.Width, Bitmap.Height), @buf[0], 4*Bitmap.Width, BitmapProperties, Result) +end; +{$ENDREGION} + +{$REGION 'TSynDWrite'} + +class function TSynDWrite.D2DFactory(factoryType: TD2D1FactoryType; + factoryOptions: PD2D1FactoryOptions): ID2D1Factory; +var + LD2DFactory: ID2D1Factory; +begin + if SingletonD2DFactory = nil then + begin + if not Succeeded(D2D1CreateFactory(factoryType, IID_ID2D1Factory, + factoryOptions, LD2DFactory)) + then + RaiseLastOSError; + if InterlockedCompareExchangePointer(Pointer(SingletonD2DFactory), Pointer(LD2DFactory), nil) = nil then + LD2DFactory._AddRef; + end; + Result := SingletonD2DFactory; +end; + +class function TSynDWrite.DottedStrokeStyle: ID2D1StrokeStyle; +var + LocalStrokeStyle: ID2D1StrokeStyle; +begin + if SingletonDottedStrokeStyle = nil then + begin + CheckOSError(D2DFactory.CreateStrokeStyle( + D2D1StrokeStyleProperties(D2D1_CAP_STYLE_ROUND, D2D1_CAP_STYLE_ROUND, + D2D1_CAP_STYLE_ROUND, D2D1_LINE_JOIN_MITER, 10, D2D1_DASH_STYLE_DOT, -0.5), + nil, 0, LocalStrokeStyle)); + if InterlockedCompareExchangePointer(Pointer(SingletonDottedStrokeStyle), + Pointer(LocalStrokeStyle), nil) = nil + then + SingletonDottedStrokeStyle._AddRef; + end; + Result := SingletonDottedStrokeStyle; +end; + +class function TSynDWrite.DWriteFactory: IDWriteFactory; +var + LocalDWriteFactory: IUnknown; +begin + if SingletonDWriteFactory = nil then + begin + CheckOSError(DWriteCreateFactory(DWRITE_FACTORY_TYPE_SHARED, IID_IDWriteFactory, + LocalDWriteFactory)); + if InterlockedCompareExchangePointer(Pointer(SingletonDWriteFactory), + Pointer(LocalDWriteFactory), nil) = nil + then + SingletonDWriteFactory._AddRef; + end; + Result := SingletonDWriteFactory; +end; + +class procedure TSynDWrite.Finalize; +begin + FreeAndNil(TSynDWrite.FSolidBrushes); + TSynDWrite.SingletonDottedStrokeStyle := nil; + TSynDWrite.SingletonRenderTarget := nil; + TSynDWrite.SingletonGDIInterop := nil; + TSynDWrite.SingletonImagingFactory := nil; + TSynDWrite.SingletonPrintDocumentPackageTargetFactory := nil; + TSynDWrite.SingletonD2DFactory := nil; +end; + +class function TSynDWrite.GDIInterop: IDWriteGdiInterop; +var + LocalGDIInterop: IDWriteGdiInterop; +begin + if SingletonGDIInterop = nil then + begin + CheckOSError(DWriteFactory.GetGdiInterop(LocalGDIInterop)); + if InterlockedCompareExchangePointer(Pointer(SingletonGDIInterop), + Pointer(LocalGDIInterop), nil) = nil + then + SingletonGDIInterop._AddRef; + end; + Result := SingletonGDIInterop; +end; + +class function TSynDWrite.GradientGutterBrush(StartColor, EndColor: TColor): + ID2D1LinearGradientBrush; +var + BrushProperties: TD2D1BrushProperties; + Stops: array [0..1] of TD2D1GradientStop; + GradientStopCollection: ID2D1GradientStopCollection; +begin + if (FGradientGutterBrush = nil) or (StartColor <> FGradientBrushStartColor) or + (EndColor <> FGradientBrushEndColor) then + begin + // store colors + FGradientBrushStartColor := StartColor; + FGradientBrushEndColor := EndColor; + + BrushProperties.opacity := 1; + BrushProperties.transform := TD2DMatrix3X2F.Identity; + + Stops[0].position := 0; + Stops[1].position := 1; + Stops[0].color := D2D1ColorF(StartColor); + Stops[1].color := D2D1ColorF(EndColor); + CheckOSError(RenderTarget.CreateGradientStopCollection( + @Stops[0], 2, D2D1_GAMMA_2_2, D2D1_EXTEND_MODE_CLAMP, + GradientStopCollection)); + + CheckOSError(RenderTarget.CreateLinearGradientBrush( + D2D1LinearGradientBrushProperties(Point(0, 0), Point(1, 0)), + @BrushProperties, GradientStopCollection, + FGradientGutterBrush)); + end; + Result := FGradientGutterBrush; +end; + +class function TSynDWrite.ImagingFactory: IWICImagingFactory; +var + ImgFactory: IWICImagingFactory; +begin + if SingletonImagingFactory = nil then + begin + CheckOSError(CoCreateInstance(CLSID_WICImagingFactory, nil, + CLSCTX_INPROC_SERVER or CLSCTX_LOCAL_SERVER, IUnknown, ImgFactory)); + if InterlockedCompareExchangePointer(Pointer(SingletonImagingFactory), + Pointer(ImgFactory), nil) = nil + then + SingletonImagingFactory._AddRef; + end; + Result := SingletonImagingFactory; +end; + +class function TSynDWrite.PrintDocumentPackageTargetFactory: IPrintDocumentPackageTargetFactory; +const + CLASS_PrintDocumentPackageTargetFactory: TGUID = '{348EF17D-6C81-4982-92B4-EE188A43867A}'; +var + PDPTFactory: IPrintDocumentPackageTargetFactory; +begin + if SingletonPrintDocumentPackageTargetFactory = nil then + begin + PDPTFactory := CreateComObject(CLASS_PrintDocumentPackageTargetFactory) as IPrintDocumentPackageTargetFactory; + Assert(PDPTFactory <> nil); + if InterlockedCompareExchangePointer(Pointer(SingletonPrintDocumentPackageTargetFactory), + Pointer(PDPTFactory), nil) = nil + then + SingletonPrintDocumentPackageTargetFactory._AddRef; + end; + Result := SingletonPrintDocumentPackageTargetFactory; +end; + +class function TSynDWrite.RenderTarget: ID2D1DCRenderTarget; +var + RT: ID2D1DCRenderTarget; +begin + if SingletonRenderTarget = nil then + begin + CheckOSError(D2DFactory.CreateDCRenderTarget( + D2D1RenderTargetProperties( + {$IFNDEF DisableGPUSupport} + D2D1_RENDER_TARGET_TYPE_DEFAULT, + {$ELSE} + D2D1_RENDER_TARGET_TYPE_SOFTWARE, // much faster in my desktop with a slow GPU + {$ENDIF} + D2D1PixelFormat(DXGI_FORMAT_B8G8R8A8_UNORM, D2D1_ALPHA_MODE_PREMULTIPLIED), + 0, 0, D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE), + RT)); + if InterlockedCompareExchangePointer(Pointer(SingletonRenderTarget), + Pointer(RT), nil) = nil + then + begin + SingletonRenderTarget._AddRef; + SingletonRenderTarget.SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); + SingletonRenderTarget.SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE); + end; + end; + Result := SingletonRenderTarget; +end; + +class procedure TSynDWrite.ResetRenderTarget; +begin + FSolidBrushes.Clear; + FGradientGutterBrush := nil; + SingletonRenderTarget := nil; +end; + +class function TSynDWrite.SolidBrush(Color: TD2D1ColorF): ID2D1SolidColorBrush; +begin + if FSolidBrushes = nil then + FSolidBrushes := TDictionary.Create; + if FSolidBrushes.ContainsKey(Color) then + Exit(FSolidBrushes[Color]); + + CheckOSError(RenderTarget.CreateSolidColorBrush(Color, nil, Result)); + FSolidBrushes.Add(Color, Result); +end; + +class function TSynDWrite.SolidBrush(Color: TColor): ID2D1SolidColorBrush; +begin + Result := SolidBrush(D2D1ColorF(Color)); +end; +{$ENDREGION} + +{$REGION 'Text Element Enumberator'} +{ TGraphemeEnumerator } + +constructor TGraphemeEnumerator.Create(const AValue: string); +var + TextFormat: IDWriteTextFormat; +begin + FString:= AValue; + FStart := 0; + CheckOSError(TSynDWrite.DWriteFactory.CreateTextFormat('Segoe UI', nil, + DWRITE_FONT_WEIGHT_NORMAL, DWRITE_FONT_STYLE_NORMAL, DWRITE_FONT_STRETCH_NORMAL, + MulDiv(9, 96, 72), UserLocaleName, TextFormat)); + CheckOSError(TSynDWrite.DWriteFactory.CreateTextLayout(PChar(FString), FString.Length, + TextFormat, MaxInt, MaxInt, FTextLayout)); +end; + +function TGraphemeEnumerator.GetCurrent: string; +begin + Result := FCurrent; +end; + +function TGraphemeEnumerator.MoveNext: Boolean; +var + X, Y: Single; + HTM: TDwriteHitTestMetrics; +begin + if FStart >= FString.Length then Exit(False); + FTextLayout.HitTestTextPosition(FStart, True, X, Y, HTM); + FCurrent := Copy(FString, FStart + 1, HTM.Length); + Inc(FStart, HTM.Length); + Result := True; +end; + +{ TGraphemeEnumeratorHelper } + +constructor TGraphemeEnumeratorHelper.Create(const AValue: string); +begin + FString := AValue; +end; + +function TGraphemeEnumeratorHelper.GetEnumerator: TGraphemeEnumerator; +begin + Result.Create(FString); +end; + +function Graphemes(const AValue: string): TGraphemeEnumeratorHelper; +begin + Result.Create(AValue); +end; +{$ENDREGION} + +{ TSynTextFormat } + +constructor TSynTextFormat.Create(AFont: TFont; TabWidth: Cardinal = 2; + CharExtra: Cardinal = 0; LineSpacingExtra: Cardinal = 0); +var + DWFontStyle: DWRITE_FONT_STYLE; + DWFont: IDWriteFont; + LogFont: TLogFont; + FontMetrics: TDwriteFontMetrics; + FontFace: WinApi.D2D1.IDWriteFontFace; + CodePoint: Cardinal; + FontIndex: Word; + GlyphMetrics: TDwriteGlyphMetrics; + //Trimming: TDwriteTrimming; + Baseline: Single; +begin + FUseGDINatural := AFont.Quality = TFontQuality.fqClearTypeNatural; + GetObject(AFont.Handle, SizeOf(TLogFont), @LogFont); + LogFont.lfWeight := GetCorrectFontWeight(AFont); + + CheckOSError(TSynDWrite.GDIInterop.CreateFontFromLOGFONT(LogFont, DWFont)); + CheckOSError(DWFont.CreateFontFace(FontFace)); + FontFace.GetGdiCompatibleMetrics(-AFont.Height, 1, PDwriteMatrix(nil)^, FontMetrics); + CodePoint := Ord('W'); + FontFace.GetGlyphIndices(CodePoint, 1, FontIndex); + IDWriteFontFace(FontFace).GetGdiCompatibleGlyphMetrics( + -AFont.Height, 1, nil, UseGDINatural, + @FontIndex, 1, @GlyphMetrics); + + // Split LineSpacingExtra between top and bottom + FLineHeight := Round( + (FontMetrics.ascent + FontMetrics.descent + FontMetrics.lineGap) * + (-AFont.Height) / FontMetrics.designUnitsPerEm) + + (LineSpacingExtra div 2) * 2; + FCharWidth := Round(-GlyphMetrics.advanceWidth * + AFont.Height / FontMetrics.designUnitsPerEm) + (CharExtra div 2) * 2; + Baseline := Round(FontMetrics.ascent * (-AFont.Height) / + FontMetrics.designUnitsPerEm) + (LineSpacingExtra div 2); + + if TFontStyle.fsItalic in AFont.Style then + DWFontStyle := DWRITE_FONT_STYLE_ITALIC + else + DWFontStyle := DWRITE_FONT_STYLE_NORMAL; + + CheckOSError(TSynDWrite.DWriteFactory.CreateTextFormat( + PChar(FontFamilyName(DWFont)), nil, + DWFont.GetWeight, DWFontStyle, DWRITE_FONT_STRETCH_NORMAL, + -AFont.Height, UserLocaleName, FIDW)); + FIDW.SetIncrementalTabStop(TabWidth * FCharWidth); + +// Trimming.granularity := DWRITE_TRIMMING_GRANULARITY_CHARACTER; +// Trimming.delimiter := 0; +// Trimming.delimiterCount := 0; +// CheckOSError(FIDW.SetTrimming(Trimming, nil)); + FIDW.SetLineSpacing(DWRITE_LINE_SPACING_METHOD_UNIFORM, LineHeight, Baseline); +end; + +{ TSynTextLayout } + +constructor TSynTextLayout.Create(TextFormat: TSynTextFormat; Text: PChar; + const Count: Cardinal; const LayoutWidth: Cardinal = MaxInt; const + layoutHeight: Cardinal = MaxInt; WordWrap: Boolean = False; PixelsPerDip: + Single = 1); +var + TextLayout1: IDWriteTextLayout1; +begin + FCount := Count; + CheckOSError(TSynDWrite.DWriteFactory.CreateGdiCompatibleTextLayout(Text, + Count, TextFormat.FIDW, LayoutWidth, LayoutHeight, + PixelsPerDip, nil, TextFormat.UseGDINatural, FIDW)); + if (TextFormat.CharExtra > 0) and + Supports(FIDW, IDWriteTextLayout1, TextLayout1) + then + CheckOSError(TextLayout1.SetCharacterSpacing(TextFormat.CharExtra / 2, + TextFormat.CharExtra / 2, 0, DWTextRange(1, Count))); + if not WordWrap then + FIDW.SetWordWrapping(DWRITE_WORD_WRAPPING_NO_WRAP) + else if TOSVersion.Check(6, 3) then // 8.1 or higher + FIDW.SetWordWrapping(DWRITE_WORD_WRAPPING_EMERGENCY_BREAK) + else + FIDW.SetWordWrapping(DWRITE_WORD_WRAPPING_WRAP); + + TextOptions := D2D1_DRAW_TEXT_OPTIONS_CLIP; + if TOSVersion.Check(6, 3) then + TextOptions := TextOptions + D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT; +end; + +procedure TSynTextLayout.Draw(RT: ID2D1RenderTarget; X, Y: Integer; FontColor: + TColor; Alpha: Single = 1); +begin + RT.DrawTextLayout(D2D1PointF(X, Y), FIDW, + TSynDWrite.SolidBrush(D2D1ColorF(FontColor, Alpha)), TextOptions); +end; + +procedure TSynTextLayout.DrawClipped(RT: ID2D1RenderTarget; X, Y: Integer; + ClipRect: TRect; FontColor: TColor; Alpha: Single = 1); +begin + RT.PushAxisAlignedClip(ClipRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); + Draw(RT, X, Y, FontColor, Alpha); + RT.PopAxisAlignedClip; +end; + +function TSynTextLayout.TextMetrics: TDwriteTextMetrics; +begin + CheckOSError(FIDW.GetMetrics(Result)); +end; + +procedure TSynTextLayout.SetFontColor(Color: TD2D1ColorF; const Start, + Count: Integer); +var + Range: TDwriteTextRange; + FirstChar, LastChar: Cardinal; +begin + LastChar := Min(FCount, Start + Count - 1); + FirstChar := Max(Start, 1); + if FirstChar > LastChar then Exit; + Range := DWTextRange(FirstChar, LastChar - FirstChar + 1); + + FIDW.SetDrawingEffect(TSynDWrite.SolidBrush(Color), Range); +end; + +procedure TSynTextLayout.SetFontColor(Color: TColor; const Start, Count: + Integer); +begin + SetFontColor(D2D1ColorF(Color), Start, Count); +end; + +procedure TSynTextLayout.SetFontStyle(FontStyles: System.UITypes.TFontStyles; + const Start, Count: Integer); +var + Range: TDwriteTextRange; + FirstChar, LastChar: Cardinal; +begin + LastChar := Min(FCount, Start + Count - 1); + FirstChar := Max(Start, 1); + if FirstChar > LastChar then Exit; + Range := DWTextRange(FirstChar, LastChar - FirstChar + 1); + + if fsBold in FontStyles then + FIDW.SetFontWeight(DWRITE_FONT_WEIGHT_BOLD, Range); + if fsItalic in FontStyles then + FIDW.SetFontStyle(DWRITE_FONT_STYLE_ITALIC, Range); + if fsUnderline in FontStyles then + FIDW.SetUnderline(True, Range); + if fsStrikeOut in FontStyles then + FIDW.SetStrikethrough(True, Range); +end; + +procedure TSynTextLayout.SetParagraphAlignment( + ParagraphAlignment: DWRITE_PARAGRAPH_ALIGNMENT); +begin + FIDW.SetParagraphAlignment(ParagraphAlignment); +end; + +procedure TSynTextLayout.SetTextAlignment(TextAlignment: DWRITE_TEXT_ALIGNMENT); +begin + FIDW.SetTextAlignment(TextAlignment); +end; + +procedure TSynTextLayout.SetTypography(Typography: TSynTypography; const Start, + Count: Integer); +const + DefaultTypoFeatures: array[0..7] of Integer = + (DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_LIGATURES, // clig + DWRITE_FONT_FEATURE_TAG_CONTEXTUAL_ALTERNATES, // calt + DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION, // ccmp + DWRITE_FONT_FEATURE_TAG_DISCRETIONARY_LIGATURES, // dlig + DWRITE_FONT_FEATURE_TAG_STANDARD_LIGATURES, // liga + DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING, // mark + DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING, // mkmk + DWRITE_FONT_FEATURE_TAG_REQUIRED_LIGATURES); // rlig + TypoFeaturesNoLigatures: array[0..2] of Integer = + (DWRITE_FONT_FEATURE_TAG_GLYPH_COMPOSITION_DECOMPOSITION, // ccmp + DWRITE_FONT_FEATURE_TAG_MARK_POSITIONING, // mark + DWRITE_FONT_FEATURE_TAG_MARK_TO_MARK_POSITIONING); // salt + +var + DWTypography: IDWriteTypography; + Range: TDwriteTextRange; + FirstChar, LastChar: Cardinal; +begin + LastChar := Min(FCount, Start + Count - 1); + FirstChar := Max(Start, 1); + if FirstChar > LastChar then Exit; + Range := DWTextRange(FirstChar, LastChar - FirstChar + 1); + + case Typography of + typEmpty: DWTypography := DWGetTypography([]); + typDefault: DWTypography := DWGetTypography(DefaultTypoFeatures); + typNoLigatures: DWTypography := DWGetTypography(TypoFeaturesNoLigatures); + end; + FIDW.SetTypography(DWTypography, Range); +end; + +{ TSynWICRenderTarget } + +constructor TSynWICRenderTarget.Create(const Width, Height: Integer); +var + RenderTargetProp: TD2D1RenderTargetProperties; +begin + inherited Create; + CheckOSError(TSynDWrite.ImagingFactory.CreateBitmap(Width, Height, + @GUID_WICPixelFormat32bppPBGRA, WICBitmapCacheOnDemand, FWicBitmap)); + + RenderTargetProp := + D2D1RenderTargetProperties( + {$IFNDEF DisableGPUSupport} + D2D1_RENDER_TARGET_TYPE_DEFAULT, + {$ELSE} + D2D1_RENDER_TARGET_TYPE_SOFTWARE, // much faster in my desktop with a slow GPU + {$ENDIF} + D2D1PixelFormat(DXGI_FORMAT_UNKNOWN, D2D1_ALPHA_MODE_UNKNOWN), // use image format + 0, 0, D2D1_RENDER_TARGET_USAGE_GDI_COMPATIBLE); + + CheckOSError(TSynDWrite.D2DFactory.CreateWicBitmapRenderTarget(FWicBitmap, + RenderTargetProp,FIDW)); +end; + +function TSynWicRenderTarget.GetIDW: ID2D1RenderTarget; +begin + Result := FIDW; +end; + +function SynWicRenderTarget(const Width, Height: Integer): ISynWicRenderTarget; +begin + Result := TSynWicRenderTarget.Create(Width, Height); +end; + + +initialization + clNoneF := D2D1ColorF(0, 0, 0, 0); +finalization + // Delphi 10.1 does not support class destructors + TSynDWrite.Finalize; +end. diff --git a/Ext/SynEdit/Source/SynEdit.inc b/Ext/SynEdit/Source/SynEdit.inc index 6e6923a..12b9677 100644 --- a/Ext/SynEdit/Source/SynEdit.inc +++ b/Ext/SynEdit/Source/SynEdit.inc @@ -1,151 +1,3 @@ -(******************************************************************************) -(* SynEdit Include File. This file was adapted from Brad Stowers' DFS.INC *) -(* file and used with permission. This will help reduce headaches when new *) -(* versions of Delphi and C++Builder are released, among other things. *) -(******************************************************************************) -(* Brad Stowers: bstowers@pobox.com *) -(* Delphi Free Stuff: http://delphifreestuff.com/ *) -(* February 24, 1999 *) -(******************************************************************************) -(* *) -(* Complete Boolean Evaluation compiler directive is turned off by including *) -(* this file. *) -(* The $ObjExportAll directive is turned on if compiling with C++Builder 3 or *) -(* higher. This is required for Delphi components built in Builder with *) -(* run-time packages. *) -(* *) -(* Here is a brief explanation of what each of the defines mean: *) -(* SYN_WIN32 : Compilation target is 32-bit Windows *) -(* SYN_COMPILER_2 : Delphi 2 or C++Builder 1 is the compiler. *) -(* SYN_COMPILER_2_UP : Delphi 2 or higher, or C++Builder 1 or higher is *) -(* the compiler. *) -(* SYN_COMPILER_3 : Delphi 3 or C++Builder 3 is the compiler. *) -(* SYN_COMPILER_3_UP : Delphi 3 or higher, or C++Builder 3 or higher is *) -(* the compiler. *) -(* SYN_COMPILER_4 : Delphi 4 or C++Builder 4 is the compiler. *) -(* SYN_COMPILER_4_UP : Delphi 4 or higher, or C++Builder 4 or higher is *) -(* the compiler. *) -(* SYN_COMPILER_5 : Delphi 5 or C++Builder 5 is the compiler. *) -(* SYN_COMPILER_5_UP : Delphi 5 or higher, or C++Builder 5 or higher is *) -(* the compiler. *) -(* SYN_COMPILER_6 : Delphi 6, C++Builder 6, Kylix 1 or Kylix 2 is *) -(* the compiler. *) -(* SYN_COMPILER_6_UP : Delphi 6, C++Builder 6, Kylix 1, Kylix 2 or higher *) -(* is the compiler. *) -(* SYN_COMPILER_7 : Delphi 7 or Kylix 3 is the compiler. *) -(* SYN_COMPILER_7_UP : Delphi 7, Kylix 3 or higher is the compiler. *) -(* SYN_COMPILER_9 : Delphi 2005 is the compiler. *) -(* SYN_COMPILER_9_UP : Delphi 2005 or higher is the compiler. *) -(* SYN_COMPILER_10 : Delphi 2006 is the compiler. *) -(* SYN_COMPILER_10_UP : Delphi 2006 or higher is the compiler. *) -(* SYN_COMPILER_11 : Delphi 2007 is the compiler. *) -(* SYN_COMPILER_11_UP : Delphi 2007 or higher is the compiler. *) -(* SYN_COMPILER_12 : Delphi 2009 is the compiler. *) -(* SYN_COMPILER_12_UP : Delphi 2009 or higher is the compiler. *) -(* SYN_COMPILER_14 : Delphi 2010 is the compiler. *) -(* SYN_COMPILER_14_UP : Delphi 2010 or higher is the compiler. *) -(* SYN_COMPILER_15 : Delphi XE is the compiler. *) -(* SYN_COMPILER_15_UP : Delphi XE or higher is the compiler. *) -(* SYN_COMPILER_16 : Delphi XE2 is the compiler. *) -(* SYN_COMPILER_16_UP : Delphi XE2 or higher is the compiler. *) -(* SYN_COMPILER_17 : Delphi XE3 is the compiler. *) -(* SYN_COMPILER_17_UP : Delphi XE3 or higher is the compiler. *) -(* SYN_COMPILER_18 : Delphi XE4 is the compiler. *) -(* SYN_COMPILER_18_UP : Delphi XE4 or higher is the compiler. *) -(* SYN_COMPILER_19 : Delphi XE5 is the compiler. *) -(* SYN_COMPILER_19_UP : Delphi XE5 or higher is the compiler. *) -(* SYN_COMPILER_20 : Delphi XE6 is the compiler. *) -(* SYN_COMPILER_20_UP : Delphi XE6 or higher is the compiler. *) -(* SYN_COMPILER_21 : Delphi XE7 is the compiler. *) -(* SYN_COMPILER_21_UP : Delphi XE7 or higher is the compiler. *) -(* SYN_COMPILER_22 : Delphi XE8 is the compiler. *) -(* SYN_COMPILER_22_UP : Delphi XE8 or higher is the compiler. *) -(* SYN_COMPILER_23 : Delphi 10 is the compiler. *) -(* SYN_COMPILER_23_UP : Delphi 10 or higher is the compiler. *) -(* SYN_COMPILER_24 : Delphi 10.1 is the compiler. *) -(* SYN_COMPILER_24_UP : Delphi 10.1 or higher is the compiler. *) -(* SYN_COMPILER_25 : Delphi 10.2 is the compiler. *) -(* SYN_COMPILER_25_UP : Delphi 10.2 or higher is the compiler. *) -(* SYN_COMPILER_26 : Delphi 10.3 is the compiler. *) -(* SYN_COMPILER_26_UP : Delphi 10.3 or higher is the compiler. *) -(* SYN_COMPILER_27 : Delphi 10.4 is the compiler. *) -(* SYN_COMPILER_27_UP : Delphi 10.4 or higher is the compiler. *) -(* SYN_COMPILER_28 : Delphi 11 is the compiler. *) -(* SYN_COMPILER_28_UP : Delphi 11 or higher is the compiler. *) -(* SYN_COMPILER_29 : Delphi 12 is the compiler. *) -(* SYN_COMPILER_29_UP : Delphi 12 or higher is the compiler. *) -(* SYN_CPPB : Any version of C++Builder is being used. *) -(* SYN_CPPB_1 : C++B v1.0x is being used. *) -(* SYN_CPPB_3 : C++B v3.0x is being used. *) -(* SYN_CPPB_3_UP : C++B v3.0x or higher is being used. *) -(* SYN_CPPB_4 : C++B v4.0x is being used. *) -(* SYN_CPPB_4_UP : C++B v4.0x or higher is being used. *) -(* SYN_CPPB_5 : C++B v5.0x is being used. *) -(* SYN_CPPB_5_UP : C++B v5.0x or higher is being used. *) -(* SYN_CPPB_6 : C++B v6.0x is being used. *) -(* SYN_CPPB_6_UP : C++B v6.0x or higher is being used. *) -(* SYN_DELPHI : Any version of Delphi is being used. *) -(* SYN_DELPHI_PE : The personal edition of Delphi is being used. *) -(* SYN_DELPHI_2 : Delphi 2 is being used. *) -(* SYN_DELPHI_2_UP : Delphi 2 or higher is being used. *) -(* SYN_DELPHI_3 : Delphi 3 is being used. *) -(* SYN_DELPHI_3_UP : Delphi 3 or higher is being used. *) -(* SYN_DELPHI_4 : Delphi 4 is being used. *) -(* SYN_DELPHI_4_UP : Delphi 4 or higher is being used. *) -(* SYN_DELPHI_5 : Delphi 5 is being used. *) -(* SYN_DELPHI_5_UP : Delphi 5 or higher is being used. *) -(* SYN_DELPHI_6 : Delphi 6 is being used. *) -(* SYN_DELPHI_6_UP : Delphi 6 or higher is being used. *) -(* SYN_DELPHI_7 : Delphi 7 is being used. *) -(* SYN_DELPHI_7_UP : Delphi 7 or higher is being used. *) -(* SYN_DELPHI_8 : Delphi 8 is being used. *) -(* SYN_DELPHI_8_UP : Delphi 8 or higher is being used. *) -(* SYN_DELPHI_2005 : Delphi 2005 is being used. *) -(* SYN_DELPHI_2005_UP : Delphi 2005 or higher is being used. *) -(* SYN_DELPHI_2006 : Delphi 2006 is being used. *) -(* SYN_DELPHI_2006_UP : Delphi 2006 or higher is being used. *) -(* SYN_DELPHI_2007 : Delphi 2007 is being used. *) -(* SYN_DELPHI_2007_UP : Delphi 2007 or higher is being used. *) -(* SYN_DELPHI_2009 : Delphi 2009 is being used. *) -(* SYN_DELPHI_2009_UP : Delphi 2009 or higher is being used. *) -(* SYN_DELPHI_2010 : Delphi 2010 is being used. *) -(* SYN_DELPHI_2010_UP : Delphi 2010 or higher is being used. *) -(* SYN_DELPHI_XE : Delphi XE is being used. *) -(* SYN_DELPHI_XE_UP : Delphi XE or higher is being used. *) -(* SYN_DELPHI_XE2 : Delphi XE2 is being used. *) -(* SYN_DELPHI_XE2_UP : Delphi XE2 or higher is being used. *) -(* SYN_DELPHI_XE3 : Delphi XE3 is being used. *) -(* SYN_DELPHI_XE3_UP : Delphi XE3 or higher is being used. *) -(* SYN_DELPHI_XE4 : Delphi XE4 is being used. *) -(* SYN_DELPHI_XE4_UP : Delphi XE4 or higher is being used. *) -(* SYN_DELPHI_XE5 : Delphi XE5 is being used. *) -(* SYN_DELPHI_XE5_UP : Delphi XE5 or higher is being used. *) -(* SYN_DELPHI_XE6 : Delphi XE6 is being used. *) -(* SYN_DELPHI_XE6_UP : Delphi XE6 or higher is being used. *) -(* SYN_DELPHI_XE7 : Delphi XE7 is being used. *) -(* SYN_DELPHI_XE7_UP : Delphi XE7 or higher is being used. *) -(* SYN_DELPHI_XE8 : Delphi XE8 is being used. *) -(* SYN_DELPHI_XE8_UP : Delphi XE8 or higher is being used. *) -(* SYN_DELPHI_10 : Delphi 10 is being used. *) -(* SYN_DELPHI_10_UP : Delphi 10 or higher is being used. *) -(* SYN_DELPHI_10_1 : Delphi 10.1 is being used. *) -(* SYN_DELPHI_10_1_UP : Delphi 10.1 or higher is being used. *) -(* SYN_DELPHI_10_2 : Delphi 10.2 is being used. *) -(* SYN_DELPHI_10_2_UP : Delphi 10.2 or higher is being used. *) -(* SYN_DELPHI_10_3 : Delphi 10.3 is being used. *) -(* SYN_DELPHI_10_3_UP : Delphi 10.3 or higher is being used. *) -(* SYN_DELPHI_10_4 : Delphi 10.4 is being used. *) -(* SYN_DELPHI_10_4_UP : Delphi 10.4 or higher is being used. *) -(* SYN_DELPHI_11 : Delphi 11 is being used. *) -(* SYN_DELPHI_11_UP : Delphi 11 or higher is being used. *) -(* SYN_DELPHI_12 : Delphi 12 is being used. *) -(* SYN_DELPHI_12_UP : Delphi 12 or higher is being used. *) -(* SYN_KYLIX : Kylix 1.0 is being using. *) -(* SYN_CLX : A CLX application is being created. *) -(******************************************************************************) - -{$DEFINE SYNEDIT_INCLUDE} - {------------------------------------------------------------------------------} { Common compiler defines } { (remove the dot in front of a define to enable it) } @@ -166,1192 +18,6 @@ {$I SynEditJedi.inc} -{------------------------------------------------------------------------------} -{ SYN_WIN32, SYN_LINUX and SYN_KYLIX defines } -{------------------------------------------------------------------------------} - -{$IFDEF WIN32} - {$DEFINE SYN_WIN32} -{$ENDIF} - -{$IFDEF LINUX} - {$DEFINE SYN_LINUX} - {$DEFINE SYN_KYLIX} - {$DEFINE SYN_COMPILER_6} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_6} -{$ENDIF} - -{------------------------------------------------------------------------------} -{ VERXXX to SYN_COMPILERX, SYN_DELPHIX and SYN_CPPBX mappings } -{------------------------------------------------------------------------------} - -{$IFDEF VER360} - {$DEFINE SYN_COMPILER_29} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_12} -{$ENDIF} - -{$IFDEF VER350} - {$DEFINE SYN_COMPILER_28} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_11} -{$ENDIF} - -{$IFDEF VER340} - {$DEFINE SYN_COMPILER_27} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_10_4} -{$ENDIF} - -{$IFDEF VER330} - {$DEFINE SYN_COMPILER_26} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_10_3} -{$ENDIF} - -{$IFDEF VER320} - {$DEFINE SYN_COMPILER_25} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_10_2} -{$ENDIF} - -{$IFDEF VER310} - {$DEFINE SYN_COMPILER_24} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_10_1} -{$ENDIF} - -{$IFDEF VER300} - {$DEFINE SYN_COMPILER_23} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_10} -{$ENDIF} - -{$IFDEF VER290} - {$DEFINE SYN_COMPILER_22} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_XE8} -{$ENDIF} - -{$IFDEF VER280} - {$DEFINE SYN_COMPILER_21} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_XE7} -{$ENDIF} - -{$IFDEF VER270} - {$DEFINE SYN_COMPILER_20} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_XE6} -{$ENDIF} - -{$IFDEF VER260} - {$DEFINE SYN_COMPILER_19} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_XE5} -{$ENDIF} - -{$IFDEF VER250} - {$DEFINE SYN_COMPILER_18} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_XE4} -{$ENDIF} - -{$IFDEF VER240} - {$DEFINE SYN_COMPILER_17} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_XE3} -{$ENDIF} - -{$IFDEF VER230} - {$DEFINE SYN_COMPILER_16} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_XE2} -{$ENDIF} - -{$IFDEF VER220} - {$DEFINE SYN_COMPILER_15} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_XE} -{$ENDIF} - -{$IFDEF VER210} - {$DEFINE SYN_COMPILER_14} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_2010} -{$ENDIF} - -{$IFDEF VER200} - {$DEFINE SYN_COMPILER_12} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_2009} -{$ENDIF} - -{$IFDEF VER190} - {$DEFINE SYN_COMPILER_11} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_2007} -{$ENDIF} - -{$IFDEF VER180} - {$DEFINE SYN_COMPILER_10} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_2006} -{$ENDIF} - -{$IFDEF VER170} - {$DEFINE SYN_COMPILER_9} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_2005} -{$ENDIF} - -{$IFDEF VER160} - {$DEFINE SYN_COMPILER_8} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_8} -{$ENDIF} - -{$IFDEF VER150} - {$DEFINE SYN_COMPILER_7} - {$IFNDEF BCB} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_7} - {$ELSE} - {.$DEFINE SYN_CPPB} - {.$DEFINE SYN_CPPB_7} - {$ENDIF} -{$ENDIF} - -{$IFDEF VER140} - {$DEFINE SYN_COMPILER_6} - {$IFNDEF BCB} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_6} - {$ELSE} - {$DEFINE SYN_CPPB} - {$DEFINE SYN_CPPB_6} - {$ENDIF} -{$ENDIF} - -{$IFDEF VER130} - {$DEFINE SYN_COMPILER_5} - {$IFNDEF BCB} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_5} - {$ELSE} - {$DEFINE SYN_CPPB} - {$DEFINE SYN_CPPB_5} - {$ENDIF} -{$ENDIF} - -{$IFDEF VER125} - {$DEFINE SYN_COMPILER_4} - {$DEFINE SYN_CPPB} - {$DEFINE SYN_CPPB_4} -{$ENDIF} - -{$IFDEF VER120} - {$DEFINE SYN_COMPILER_4} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_4} -{$ENDIF} - -{$IFDEF VER110} - {$DEFINE SYN_COMPILER_3} - {$DEFINE SYN_CPPB} - {$DEFINE SYN_CPPB_3} -{$ENDIF} - -{$IFDEF VER100} - {$DEFINE SYN_COMPILER_3} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_3} -{$ENDIF} - -{$IFDEF VER93} - {$DEFINE SYN_COMPILER_2} { C++B v1 compiler is really v2 } - {$DEFINE SYN_CPPB} - {$DEFINE SYN_CPPB_1} -{$ENDIF} - -{$IFDEF VER90} - {$DEFINE SYN_COMPILER_2} - {$DEFINE SYN_DELPHI} - {$DEFINE SYN_DELPHI_2} -{$ENDIF} - -{$IFDEF SYN_COMPILER_2} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_3} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_4} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_5} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_6} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_7} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_8} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_9} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_10} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_11} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_12} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_14} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_15} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_16} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_17} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} - {$DEFINE SYN_COMPILER_17_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_18} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} - {$DEFINE SYN_COMPILER_17_UP} - {$DEFINE SYN_COMPILER_18_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_19} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} - {$DEFINE SYN_COMPILER_17_UP} - {$DEFINE SYN_COMPILER_18_UP} - {$DEFINE SYN_COMPILER_19_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_20} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} - {$DEFINE SYN_COMPILER_17_UP} - {$DEFINE SYN_COMPILER_18_UP} - {$DEFINE SYN_COMPILER_19_UP} - {$DEFINE SYN_COMPILER_20_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_21} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} - {$DEFINE SYN_COMPILER_17_UP} - {$DEFINE SYN_COMPILER_18_UP} - {$DEFINE SYN_COMPILER_19_UP} - {$DEFINE SYN_COMPILER_20_UP} - {$DEFINE SYN_COMPILER_21_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_22} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} - {$DEFINE SYN_COMPILER_17_UP} - {$DEFINE SYN_COMPILER_18_UP} - {$DEFINE SYN_COMPILER_19_UP} - {$DEFINE SYN_COMPILER_20_UP} - {$DEFINE SYN_COMPILER_21_UP} - {$DEFINE SYN_COMPILER_22_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_23} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} - {$DEFINE SYN_COMPILER_17_UP} - {$DEFINE SYN_COMPILER_18_UP} - {$DEFINE SYN_COMPILER_19_UP} - {$DEFINE SYN_COMPILER_20_UP} - {$DEFINE SYN_COMPILER_21_UP} - {$DEFINE SYN_COMPILER_22_UP} - {$DEFINE SYN_COMPILER_23_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_24} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} - {$DEFINE SYN_COMPILER_17_UP} - {$DEFINE SYN_COMPILER_18_UP} - {$DEFINE SYN_COMPILER_19_UP} - {$DEFINE SYN_COMPILER_20_UP} - {$DEFINE SYN_COMPILER_21_UP} - {$DEFINE SYN_COMPILER_22_UP} - {$DEFINE SYN_COMPILER_23_UP} - {$DEFINE SYN_COMPILER_24_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_25} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} - {$DEFINE SYN_COMPILER_17_UP} - {$DEFINE SYN_COMPILER_18_UP} - {$DEFINE SYN_COMPILER_19_UP} - {$DEFINE SYN_COMPILER_20_UP} - {$DEFINE SYN_COMPILER_21_UP} - {$DEFINE SYN_COMPILER_22_UP} - {$DEFINE SYN_COMPILER_23_UP} - {$DEFINE SYN_COMPILER_24_UP} - {$DEFINE SYN_COMPILER_25_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_26} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} - {$DEFINE SYN_COMPILER_17_UP} - {$DEFINE SYN_COMPILER_18_UP} - {$DEFINE SYN_COMPILER_19_UP} - {$DEFINE SYN_COMPILER_20_UP} - {$DEFINE SYN_COMPILER_21_UP} - {$DEFINE SYN_COMPILER_22_UP} - {$DEFINE SYN_COMPILER_23_UP} - {$DEFINE SYN_COMPILER_24_UP} - {$DEFINE SYN_COMPILER_25_UP} - {$DEFINE SYN_COMPILER_26_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_27} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} - {$DEFINE SYN_COMPILER_17_UP} - {$DEFINE SYN_COMPILER_18_UP} - {$DEFINE SYN_COMPILER_19_UP} - {$DEFINE SYN_COMPILER_20_UP} - {$DEFINE SYN_COMPILER_21_UP} - {$DEFINE SYN_COMPILER_22_UP} - {$DEFINE SYN_COMPILER_23_UP} - {$DEFINE SYN_COMPILER_24_UP} - {$DEFINE SYN_COMPILER_25_UP} - {$DEFINE SYN_COMPILER_26_UP} - {$DEFINE SYN_COMPILER_27_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_28} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} - {$DEFINE SYN_COMPILER_17_UP} - {$DEFINE SYN_COMPILER_18_UP} - {$DEFINE SYN_COMPILER_19_UP} - {$DEFINE SYN_COMPILER_20_UP} - {$DEFINE SYN_COMPILER_21_UP} - {$DEFINE SYN_COMPILER_22_UP} - {$DEFINE SYN_COMPILER_23_UP} - {$DEFINE SYN_COMPILER_24_UP} - {$DEFINE SYN_COMPILER_25_UP} - {$DEFINE SYN_COMPILER_26_UP} - {$DEFINE SYN_COMPILER_27_UP} - {$DEFINE SYN_COMPILER_28_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_29} - {$DEFINE SYN_COMPILER_1_UP} - {$DEFINE SYN_COMPILER_2_UP} - {$DEFINE SYN_COMPILER_3_UP} - {$DEFINE SYN_COMPILER_4_UP} - {$DEFINE SYN_COMPILER_5_UP} - {$DEFINE SYN_COMPILER_6_UP} - {$DEFINE SYN_COMPILER_7_UP} - {$DEFINE SYN_COMPILER_8_UP} - {$DEFINE SYN_COMPILER_9_UP} - {$DEFINE SYN_COMPILER_10_UP} - {$DEFINE SYN_COMPILER_11_UP} - {$DEFINE SYN_COMPILER_12_UP} - {$DEFINE SYN_COMPILER_14_UP} - {$DEFINE SYN_COMPILER_15_UP} - {$DEFINE SYN_COMPILER_16_UP} - {$DEFINE SYN_COMPILER_17_UP} - {$DEFINE SYN_COMPILER_18_UP} - {$DEFINE SYN_COMPILER_19_UP} - {$DEFINE SYN_COMPILER_20_UP} - {$DEFINE SYN_COMPILER_21_UP} - {$DEFINE SYN_COMPILER_22_UP} - {$DEFINE SYN_COMPILER_23_UP} - {$DEFINE SYN_COMPILER_24_UP} - {$DEFINE SYN_COMPILER_25_UP} - {$DEFINE SYN_COMPILER_26_UP} - {$DEFINE SYN_COMPILER_27_UP} - {$DEFINE SYN_COMPILER_28_UP} - {$DEFINE SYN_COMPILER_29_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_2} - {$DEFINE SYN_DELPHI_2_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_3} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_4} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_5} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_6} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_7} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_8} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_2005} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_2006} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_2007} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_2009} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_2010} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_XE} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_XE2} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_XE3} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} - {$DEFINE SYN_DELPHI_XE3_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_XE4} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} - {$DEFINE SYN_DELPHI_XE3_UP} - {$DEFINE SYN_DELPHI_XE4_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_XE5} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} - {$DEFINE SYN_DELPHI_XE3_UP} - {$DEFINE SYN_DELPHI_XE4_UP} - {$DEFINE SYN_DELPHI_XE5_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_XE6} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} - {$DEFINE SYN_DELPHI_XE3_UP} - {$DEFINE SYN_DELPHI_XE4_UP} - {$DEFINE SYN_DELPHI_XE5_UP} - {$DEFINE SYN_DELPHI_XE6_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_XE7} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} - {$DEFINE SYN_DELPHI_XE3_UP} - {$DEFINE SYN_DELPHI_XE4_UP} - {$DEFINE SYN_DELPHI_XE5_UP} - {$DEFINE SYN_DELPHI_XE6_UP} - {$DEFINE SYN_DELPHI_XE7_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_XE8} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} - {$DEFINE SYN_DELPHI_XE3_UP} - {$DEFINE SYN_DELPHI_XE4_UP} - {$DEFINE SYN_DELPHI_XE5_UP} - {$DEFINE SYN_DELPHI_XE6_UP} - {$DEFINE SYN_DELPHI_XE7_UP} - {$DEFINE SYN_DELPHI_XE8_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_10} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} - {$DEFINE SYN_DELPHI_XE3_UP} - {$DEFINE SYN_DELPHI_XE4_UP} - {$DEFINE SYN_DELPHI_XE5_UP} - {$DEFINE SYN_DELPHI_XE6_UP} - {$DEFINE SYN_DELPHI_XE7_UP} - {$DEFINE SYN_DELPHI_XE8_UP} - {$DEFINE SYN_DELPHI_10_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_10_1} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} - {$DEFINE SYN_DELPHI_XE3_UP} - {$DEFINE SYN_DELPHI_XE4_UP} - {$DEFINE SYN_DELPHI_XE5_UP} - {$DEFINE SYN_DELPHI_XE6_UP} - {$DEFINE SYN_DELPHI_XE7_UP} - {$DEFINE SYN_DELPHI_XE8_UP} - {$DEFINE SYN_DELPHI_10_UP} - {$DEFINE SYN_DELPHI_10_1_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_10_2} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} - {$DEFINE SYN_DELPHI_XE3_UP} - {$DEFINE SYN_DELPHI_XE4_UP} - {$DEFINE SYN_DELPHI_XE5_UP} - {$DEFINE SYN_DELPHI_XE6_UP} - {$DEFINE SYN_DELPHI_XE7_UP} - {$DEFINE SYN_DELPHI_XE8_UP} - {$DEFINE SYN_DELPHI_10_UP} - {$DEFINE SYN_DELPHI_10_1_UP} - {$DEFINE SYN_DELPHI_10_2_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_10_3} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} - {$DEFINE SYN_DELPHI_XE3_UP} - {$DEFINE SYN_DELPHI_XE4_UP} - {$DEFINE SYN_DELPHI_XE5_UP} - {$DEFINE SYN_DELPHI_XE6_UP} - {$DEFINE SYN_DELPHI_XE7_UP} - {$DEFINE SYN_DELPHI_XE8_UP} - {$DEFINE SYN_DELPHI_10_UP} - {$DEFINE SYN_DELPHI_10_1_UP} - {$DEFINE SYN_DELPHI_10_2_UP} - {$DEFINE SYN_DELPHI_10_3_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_10_4} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} - {$DEFINE SYN_DELPHI_XE3_UP} - {$DEFINE SYN_DELPHI_XE4_UP} - {$DEFINE SYN_DELPHI_XE5_UP} - {$DEFINE SYN_DELPHI_XE6_UP} - {$DEFINE SYN_DELPHI_XE7_UP} - {$DEFINE SYN_DELPHI_XE8_UP} - {$DEFINE SYN_DELPHI_10_UP} - {$DEFINE SYN_DELPHI_10_1_UP} - {$DEFINE SYN_DELPHI_10_2_UP} - {$DEFINE SYN_DELPHI_10_3_UP} - {$DEFINE SYN_DELPHI_10_4_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_11} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} - {$DEFINE SYN_DELPHI_XE3_UP} - {$DEFINE SYN_DELPHI_XE4_UP} - {$DEFINE SYN_DELPHI_XE5_UP} - {$DEFINE SYN_DELPHI_XE6_UP} - {$DEFINE SYN_DELPHI_XE7_UP} - {$DEFINE SYN_DELPHI_XE8_UP} - {$DEFINE SYN_DELPHI_10_UP} - {$DEFINE SYN_DELPHI_10_1_UP} - {$DEFINE SYN_DELPHI_10_2_UP} - {$DEFINE SYN_DELPHI_10_3_UP} - {$DEFINE SYN_DELPHI_10_4_UP} - {$DEFINE SYN_DELPHI_11_UP} -{$ENDIF} - -{$IFDEF SYN_DELPHI_12} - {$DEFINE SYN_DELPHI_2_UP} - {$DEFINE SYN_DELPHI_3_UP} - {$DEFINE SYN_DELPHI_4_UP} - {$DEFINE SYN_DELPHI_5_UP} - {$DEFINE SYN_DELPHI_6_UP} - {$DEFINE SYN_DELPHI_7_UP} - {$DEFINE SYN_DELPHI_8_UP} - {$DEFINE SYN_DELPHI_2005_UP} - {$DEFINE SYN_DELPHI_2006_UP} - {$DEFINE SYN_DELPHI_2007_UP} - {$DEFINE SYN_DELPHI_2009_UP} - {$DEFINE SYN_DELPHI_2010_UP} - {$DEFINE SYN_DELPHI_XE_UP} - {$DEFINE SYN_DELPHI_XE2_UP} - {$DEFINE SYN_DELPHI_XE3_UP} - {$DEFINE SYN_DELPHI_XE4_UP} - {$DEFINE SYN_DELPHI_XE5_UP} - {$DEFINE SYN_DELPHI_XE6_UP} - {$DEFINE SYN_DELPHI_XE7_UP} - {$DEFINE SYN_DELPHI_XE8_UP} - {$DEFINE SYN_DELPHI_10_UP} - {$DEFINE SYN_DELPHI_10_1_UP} - {$DEFINE SYN_DELPHI_10_2_UP} - {$DEFINE SYN_DELPHI_10_3_UP} - {$DEFINE SYN_DELPHI_10_4_UP} - {$DEFINE SYN_DELPHI_11_UP} - {$DEFINE SYN_DELPHI_12_UP} -{$ENDIF} - -{$IFDEF SYN_CPPB_6} - {$DEFINE SYN_CPPB_3_UP} - {$DEFINE SYN_CPPB_4_UP} - {$DEFINE SYN_CPPB_5_UP} - {$DEFINE SYN_CPPB_6_UP} -{$ENDIF} - -{$IFDEF SYN_CPPB_3} - {$DEFINE SYN_CPPB_3_UP} -{$ENDIF} - -{$IFDEF SYN_COMPILER_3_UP} - {$DEFINE SYN_NO_COM_CLEANUP} -{$ENDIF} - -{$IFDEF SYN_CPPB_3_UP} - // C++Builder requires this if you use Delphi components in run-time packages. - {$ObjExportAll On} -{$ENDIF} - -{$IFDEF SYN_KYLIX} - Kylix is no longer supported. Please refer to the branch 'Kylix' -{$ELSE} - {$DEFINE SYN_WIN32} -{$ENDIF} - {------------------------------------------------------------------------------} { Please change this to suit your needs (to activate an option remove the dot } { in front of a DEFINE) } @@ -1364,20 +30,4 @@ // properly store Range State information {.$DEFINE SYN_HEREDOC} -// Define OWN_UnicodeString_MEMMGR to speed up WideStrings-handling -{$IFDEF SYN_WIN32} - {$IFNDEF UNICODE} - {$DEFINE OWN_UnicodeString_MEMMGR} - {$ENDIF} -{$ENDIF} - -// Turn this off if you don't need complex script support, since it is slower -{-$DEFINE SYN_UNISCRIBE} - -// Code Folding -{$IFDEF SYN_DELPHI_XE_UP} - {$DEFINE SYN_CodeFolding} -{$ENDIF} - - diff --git a/Ext/SynEdit/Source/SynEdit.pas b/Ext/SynEdit/Source/SynEdit.pas index b4c7bc6..bb42205 100644 --- a/Ext/SynEdit/Source/SynEdit.pas +++ b/Ext/SynEdit/Source/SynEdit.pas @@ -1,4 +1,4 @@ -{------------------------------------------------------------------------------- +{------------------------------------------------------------------------------- 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 @@ -8,11 +8,10 @@ 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: SynEdit.pas, released 2000-04-07. The Original Code is based on mwCustomEdit.pas by Martin Waldenburg, part of the mwEdit component suite. Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. -Unicode translation by Maël Hörz. +Unicode translation by Maël Hörz. All Rights Reserved. Contributors to the SynEdit and mwEdit projects are listed in the @@ -27,23 +26,9 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEdit.pas,v 1.32.1 2012/19/09 10:50:00 CodehunterWorks Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -- Undo is buggy when dealing with Hard Tabs (when inserting text after EOL and - when trimming). - -------------------------------------------------------------------------------} -//todo: remove SynEdit Clipboard Format? -//todo: in WordWrap mode, parse lines only once in PaintLines() //todo: Remove checks for WordWrap. Must abstract the behaviour with the plugins instead. //todo: Move WordWrap glyph to the WordWrap plugin. -//todo: remove FShowSpecChar variable -//todo: remove the several Undo block types? unit SynEdit; @@ -52,82 +37,43 @@ interface uses - Controls, - Contnrs, - Graphics, - Forms, - StdCtrls, - ExtCtrls, - Windows, - Messages, - {$IFDEF SYN_COMPILER_4_UP} - StdActns, - Dialogs, - {$ENDIF} - {$IFDEF SYN_COMPILER_7} - Themes, - {$ENDIF} - {$IFDEF SYN_COMPILER_17_UP} - Types, UITypes, - {$ENDIF} - Imm, + System.Math, + System.SysUtils, + System.Classes, + System.Contnrs, + System.Generics.Collections, + System.Diagnostics, + Winapi.Windows, + Winapi.Messages, + Winapi.ActiveX, + Winapi.D2D1, + Winapi.Imm, + Vcl.Controls, + Vcl.Graphics, + Vcl.Forms, + Vcl.StdCtrls, + Vcl.ExtCtrls, + Vcl.StdActns, + Vcl.Dialogs, + Vcl.Themes, + System.UITypes, SynUnicode, - SynTextDrawer, SynEditTypes, SynEditKeyConst, SynEditMiscProcs, SynEditMiscClasses, SynEditTextBuffer, + SynDWrite, SynEditKeyCmds, SynEditHighlighter, SynEditKbdHandler, -{$IFDEF SYN_CodeFolding} - SynEditCodeFolding, -{$ENDIF} -{$IFDEF UNICODE} - WideStrUtils, -{$ENDIF} - Math, - SysUtils, - Classes; + SynEditCodeFolding; const -{$IFNDEF SYN_COMPILER_3_UP} - // not defined in all Delphi versions - WM_MOUSEWHEEL = $020A; -{$ENDIF} -{$IFNDEF SYN_COMPILER_7_UP} - // not defined in all Delphi versions - WS_EX_COMPOSITED = $02000000; -{$ENDIF} - - // maximum scroll range - MAX_SCROLL = 32767; - // Max number of book/gutter marks returned from GetEditMarksForLine - that // really should be enough. MAX_MARKS = 16; - SYNEDIT_CLIPBOARD_FORMAT = 'SynEdit Control Block Type'; - - // Reconversion string. - IMR_COMPOSITIONWINDOW = $0001; - IMR_CANDIDATEWINDOW = $0002; - IMR_COMPOSITIONFONT = $0003; - IMR_RECONVERTSTRING = $0004; - IMR_CONFIRMRECONVERTSTRING = $0005; - IMR_QUERYCHARPOSITION = $0006; - IMR_DOCUMENTFEED = $0007; - - SCS_SETSTR = GCS_COMPREADSTR or GCS_COMPSTR; - SCS_CHANGEATTR = GCS_COMPREADATTR or GCS_COMPATTR; - SCS_CHANGECLAUSE = GCS_COMPREADCLAUSE or GCS_COMPCLAUSE; - SCS_SETRECONVERTSTRING = $00010000; - SCS_QUERYRECONVERTSTRING = $00020000; - -var - SynEditClipboardFormat: UINT; - type TBufferCoord = SynEditTypes.TBufferCoord; TDisplayCoord = SynEditTypes.TDisplayCoord; @@ -138,25 +84,19 @@ interface ESynEditError = class(ESynError); - TDropFilesEvent = procedure(Sender: TObject; X, Y: Integer; AFiles: TUnicodeStrings) + TDropFilesEvent = procedure(Sender: TObject; X, Y: Integer; AFiles: TStrings) of object; - THookedCommandEvent = procedure(Sender: TObject; AfterProcessing: Boolean; - var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; - Data, HandlerData: Pointer) of object; - TPaintEvent = procedure(Sender: TObject; ACanvas: TCanvas) of object; TProcessCommandEvent = procedure(Sender: TObject; var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer) of object; TReplaceTextEvent = procedure(Sender: TObject; const ASearch, AReplace: - UnicodeString; Line, Column: Integer; var Action: TSynReplaceAction) of object; + string; Line, Column: Integer; var Action: TSynReplaceAction) of object; TSpecialLineColorsEvent = procedure(Sender: TObject; Line: Integer; var Special: Boolean; var FG, BG: TColor) of object; - TSpecialTokenAttributesEvent = procedure(Sender: TObject; ALine, APos: Integer; const AToken: string; - var ASpecial: Boolean; var FG, BG: TColor; var AStyle: TFontStyles) of object; TTransientType = (ttBefore, ttAfter); TPaintTransient = procedure(Sender: TObject; Canvas: TCanvas; @@ -165,78 +105,76 @@ ESynEditError = class(ESynError); TScrollEvent = procedure(Sender: TObject; ScrollBar: TScrollBarKind) of object; TGutterGetTextEvent = procedure(Sender: TObject; aLine: Integer; - var aText: UnicodeString) of object; + var aText: string) of object; - TGutterPaintEvent = procedure(Sender: TObject; aLine: Integer; - X, Y: Integer) of object; + TGetLineIndicatorsEvent = procedure(Sender: TObject; const Line: Integer; + var LineIndicators: TArray) of Object; - TSynEditCaretType = (ctVerticalLine, ctHorizontalLine, ctHalfBlock, ctBlock, ctVerticalLine2); + TZoomEvent = procedure(Sender: TObject; const NewFontSize, + OrigFontSize: Integer) of object; + + TSynEditCaretType = (ctVerticalLine, ctHorizontalLine, ctHalfBlock, ctBlock); TSynStateFlag = (sfCaretChanged, sfScrollbarChanged, sfLinesChanging, - sfIgnoreNextChar, sfCaretVisible, sfDblClicked, sfPossibleGutterClick, - sfWaitForDragging, sfInsideRedo, sfGutterDragging, sfMouseCaptured); + sfIgnoreNextChar, sfPossibleGutterClick, + sfOleDragSource, sfGutterDragging); TSynStateFlags = set of TSynStateFlag; TScrollHintFormat = (shfTopLineOnly, shfTopToBottom); - TSynHintMode = (shmDefault, shmToken); - - TGetTokenHintEvent = procedure(Sender: TObject; Coords: TBufferCoord; const Token: string; - TokenType: Integer; Attri: TSynHighlighterAttributes; var HintText: string) of object; - TSynEditorOption = ( - eoAltSetsColumnMode, //Holding down the Alt Key will put the selection mode into columnar format eoAutoIndent, //Will indent the caret on new lines with the same amount of leading white space as the preceding line - eoAutoSizeMaxScrollWidth, //Automatically resizes the MaxScrollWidth property when inserting text - eoDisableScrollArrows, //Disables the scroll bar arrow buttons when you can't scroll in that direction any more eoDragDropEditing, //Allows you to select a block of text and drag it within the document to another location eoDropFiles, //Allows the editor accept OLE file drops eoEnhanceHomeKey, //enhances home key positioning, similar to visual studio eoEnhanceEndKey, //enhances End key positioning, similar to JDeveloper eoGroupUndo, //When undoing/redoing actions, handle all continous changes of the same kind in one call instead undoing/redoing each command separately - eoHalfPageScroll, //When scrolling with page-up and page-down commands, only scroll a half page at a time - eoHideShowScrollbars, //if enabled, then the scrollbars will only show when necessary. If you have ScrollPastEOL, then it the horizontal bar will always be there (it uses MaxLength instead) eoKeepCaretX, //When moving through lines w/o Cursor Past EOL, keeps the X position of the cursor eoNoCaret, //Makes it so the caret is never visible eoNoSelection, //Disables selecting text eoRightMouseMovesCursor, //When clicking with the right mouse for a popup menu, move the cursor to that location - eoScrollByOneLess, //Forces scrolling to be one less - eoScrollHintFollows, //The scroll hint follows the mouse when scrolling vertically - eoScrollPastEof, //Allows the cursor to go past the end of file marker - eoScrollPastEol, //Allows the cursor to go past the last character into the white space at the end of a line - eoShowScrollHint, //Shows a hint of the visible line numbers when scrolling vertically - eoShowSpecialChars, //Shows the special Characters eoSmartTabDelete, //similar to Smart Tabs, but when you delete characters eoSmartTabs, //When tabbing, the cursor will go to the next non-white space character of the previous line eoSpecialLineDefaultFg, //disables the foreground text color override when using the OnSpecialLineColor event eoTabIndent, //When active and act as block indent, unindent when text is selected eoTabsToSpaces, //Converts a tab character to a specified number of space characters - eoTrimTrailingSpaces //Spaces at the end of lines will be trimmed and not saved + eoTrimTrailingSpaces, //Spaces at the end of lines will be trimmed and not saved + eoShowLigatures, //Shows font ligatures, by default it is disabled + eoCopyPlainText, //Do not include additional clipboard formats when you copy to Clipboard or drag text + eoNoHTMLBackground, //Ignore SynEdit background color when copying in HTML format + eoWrapWithRightEdge, //WordWrap with RightEdge position instead of the whole text area + eoBracketsHighlight, //Enable bracket highlighting + eoAccessibility, //Enable accessibility support + eoCompleteBrackets, //When an opening bracket is entered complete the matching one + eoCompleteQuotes //When an quote char (" ') is entered add a second one ); - TSynEditorOptions = set of TSynEditorOption; - TSynFontSmoothMethod = (fsmNone, fsmAntiAlias, fsmClearType); + TSynEditorScrollOption = ( + eoDisableScrollArrows, //Disables the scroll bar arrow buttons when you can't scroll in that direction any more + eoHalfPageScroll, //When scrolling with page-up and page-down commands, only scroll a half page at a time + eoHideShowScrollbars, //if enabled, then the scrollbars will only show when necessary. + eoScrollByOneLess, //Forces scrolling to be one less + eoScrollHintFollows, //The scroll hint follows the mouse when scrolling vertically + eoScrollPastEof, //Allows the cursor to go past the end of file marker + eoScrollPastEol, //Allows the cursor to go past the last character into the white space at the end of a line + eoShowScrollHint //Shows a hint of the visible line numbers when scrolling vertically + ); + TSynEditorScrollOptions = set of TSynEditorScrollOption; -const - SYNEDIT_DEFAULT_OPTIONS = [eoAutoIndent, eoDragDropEditing, eoEnhanceEndKey, - eoScrollPastEol, eoShowScrollHint, eoSmartTabs, eoTabsToSpaces, - eoSmartTabDelete, eoGroupUndo]; + TSynSpecialChars = (scWhitespace, scControlChars, scEOL); + TSynVisibleSpecialChars = set of TSynSpecialChars; + TSynFontSmoothMethod = (fsmNone, fsmAntiAlias, fsmClearType); //Ethea: backward compatibility -type - TCreateParamsW = record - Caption: PWideChar; - Style: DWORD; - ExStyle: DWORD; - X, Y: Integer; - Width, Height: Integer; - WndParent: HWnd; - Param: Pointer; - WindowClass: TWndClassW; - WinClassName: array[0..63] of WideChar; - InternalCaption: UnicodeString; - end; +const + SYNEDIT_DEFAULT_OPTIONS = [ + eoAutoIndent, eoDragDropEditing, eoKeepCaretX, + eoEnhanceHomeKey, eoEnhanceEndKey, eoTabIndent, eoTabsToSpaces, + eoSmartTabDelete, eoGroupUndo, eoDropFiles, eoShowLigatures, + eoBracketsHighlight, eoAccessibility, eoCompleteBrackets, eoCompleteQuotes]; + SYNEDIT_DEFAULT_SCROLLOPTIONS = + [eoHideShowScrollbars, eoDisableScrollArrows, eoShowScrollHint]; type // use scAll to update a statusbar when another TCustomSynEdit got the focus @@ -244,7 +182,7 @@ TCreateParamsW = record scInsertMode, scModified, scSelection, scReadOnly); TSynStatusChanges = set of TSynStatusChange; - TContextHelpEvent = procedure(Sender: TObject; Word: UnicodeString) + TContextHelpEvent = procedure(Sender: TObject; word: string) of object; TStatusChangeEvent = procedure(Sender: TObject; Changes: TSynStatusChanges) @@ -253,21 +191,20 @@ TCreateParamsW = record TMouseCursorEvent = procedure(Sender: TObject; const aLineCharPos: TBufferCoord; var aCursor: TCursor) of object; -{$IFDEF SYN_CodeFolding} + // CodeFolding TScanForFoldRangesEvent = procedure(Sender: TObject; FoldRanges: TSynFoldRanges; LinesToScan: TStrings; - FromLine : Integer; ToLine : Integer) of object; -{$ENDIF} + FromLine: Integer; ToLine: Integer) of object; TCustomSynEdit = class; TSynEditMark = class protected - FLine, FChar, FImage: Integer; - FEdit: TCustomSynEdit; - FVisible: Boolean; - FInternalImage: Boolean; - FBookmarkNum: Integer; + fLine, fChar, fImage: Integer; + fEdit: TCustomSynEdit; + fVisible: Boolean; + fInternalImage: Boolean; + fBookmarkNum: Integer; function GetEdit: TCustomSynEdit; virtual; procedure SetChar(const Value: Integer); virtual; procedure SetImage(const Value: Integer); virtual; @@ -277,13 +214,13 @@ TSynEditMark = class function GetIsBookmark: Boolean; public constructor Create(AOwner: TCustomSynEdit); - property Line: Integer read FLine write SetLine; - property Char: Integer read FChar write SetChar; - property Edit: TCustomSynEdit read FEdit; - property ImageIndex: Integer read FImage write SetImage; - property BookmarkNumber: Integer read FBookmarkNum write FBookmarkNum; - property Visible: Boolean read FVisible write SetVisible; - property InternalImage: Boolean read FInternalImage write SetInternalImage; + property Line: Integer read fLine write SetLine; + property Char: Integer read fChar write SetChar; + property Edit: TCustomSynEdit read fEdit; + property ImageIndex: Integer read fImage write SetImage; + property BookmarkNumber: Integer read fBookmarkNum write fBookmarkNum; + property Visible: Boolean read fVisible write SetVisible; + property InternalImage: Boolean read fInternalImage write SetInternalImage; property IsBookmark: Boolean read GetIsBookmark; end; @@ -293,90 +230,55 @@ TSynEditMark = class TSynEditMarks = array[1..MAX_MARKS] of TSynEditMark; { A list of mark objects. Each object cause a litle picture to be drawn in the gutter. } - TSynEditMarkList = class(TObjectList) // It makes more sence to derive from TObjectList, - protected // as it automatically frees its members - FEdit: TCustomSynEdit; - FOnChange: TNotifyEvent; - procedure Notify(Ptr: Pointer; Action: TListNotification); override; - function GetItem(Index: TListSize): TSynEditMark; - procedure SetItem(Index: TListSize; Item: TSynEditMark); - property OwnsObjects; // This is to hide the inherited property, - public // because TSynEditMarkList always owns the marks + TSynEditMarkList = class(TObjectList) + protected + fEdit: TCustomSynEdit; + public constructor Create(AOwner: TCustomSynEdit); - function First: TSynEditMark; - function Last: TSynEditMark; - function Extract(Item: TSynEditMark): TSynEditMark; procedure ClearLine(line: Integer); procedure GetMarksForLine(line: Integer; var Marks: TSynEditMarks); - procedure Place(mark: TSynEditMark); + procedure Place(Mark: TSynEditMark); public - property Items[Index: TListSize]: TSynEditMark read GetItem write SetItem; default; - property Edit: TCustomSynEdit read FEdit; - property OnChange: TNotifyEvent read FOnChange write FOnChange; + property Edit: TCustomSynEdit read fEdit; end; TGutterClickEvent = procedure(Sender: TObject; Button: TMouseButton; X, Y, Line: Integer; Mark: TSynEditMark) of object; - // aIndex parameters of Line notifications are 0-based. - // aRow parameter of GetRowLength() is 1-based. - ISynEditBufferPlugin = interface - // conversion methods - function BufferToDisplayPos(const aPos: TBufferCoord): TDisplayCoord; - function DisplayToBufferPos(const aPos: TDisplayCoord): TBufferCoord; - function RowCount: Integer; - function GetRowLength(aRow: Integer): Integer; - // plugin notifications - function LinesInserted(aIndex: Integer; aCount: Integer): Integer; - function LinesDeleted(aIndex: Integer; aCount: Integer): Integer; - function LinesPutted(aIndex: Integer; aCount: Integer): Integer; - // font or size change - procedure DisplayChanged; - // pretty clear, heh? - procedure Reset; - end; + TPluginHandler = (phLinesInserted, phLinesBeforeDeleted, phLinesDeleted, + phLinePut, phLinesChanged, phPaintTransient, phAfterPaint); + TPlugInHandlers = set of TPluginHandler; TSynEditPlugin = class(TObject) private FOwner: TCustomSynEdit; protected + FHandlers: TPlugInHandlers; procedure AfterPaint(ACanvas: TCanvas; const AClip: TRect; FirstLine, LastLine: Integer); virtual; procedure PaintTransient(ACanvas: TCanvas; ATransientType: TTransientType); virtual; procedure LinesInserted(FirstLine, Count: Integer); virtual; + procedure LinesBeforeDeleted(FirstLine, Count: Integer); virtual; procedure LinesDeleted(FirstLine, Count: Integer); virtual; + procedure LinePut(aIndex: Integer; const OldLine: string); virtual; + procedure LinesChanged; virtual; protected property Editor: TCustomSynEdit read FOwner; public - constructor Create(AOwner: TCustomSynEdit); + constructor Create(AOwner: TCustomSynEdit); overload; + constructor Create(AOwner: TCustomSynEdit; AHandlers: TPlugInHandlers); overload; destructor Destroy; override; + property Handlers: TPlugInHandlers read FHandlers; end; -{$IFDEF SYN_COMPILER_6_UP} TCustomSynEditSearchNotFoundEvent = procedure(Sender: TObject; - FindText: UnicodeString) of object; -{$ENDIF} - - // Reconversion string. - PReconvertString = ^TReconvertString; - TReconvertString = record - dwSize: DWord; - dwVersion: DWord; - dwStrLen: DWord; - dwStrOffset: DWord; - dwCompStrLen: DWord; - dwCompStrOffset: DWord; - dwTargetStrLen: DWord; - dwTargetStrOffset: DWord; - end; - + FindText: string) of object; TCustomSynEdit = class(TCustomControl) private - procedure CMHintShow(var Msg: TMessage); message CM_HINTSHOW; + procedure CMHintShow(var Message: TCMHintShow); message CM_HINTSHOW; procedure WMCancelMode(var Message: TMessage); message WM_CANCELMODE; procedure WMCaptureChanged(var Msg: TMessage); message WM_CAPTURECHANGED; - procedure WMChar(var Msg: TWMChar); message WM_CHAR; procedure WMClear(var Msg: TMessage); message WM_CLEAR; procedure WMCopy(var Message: TMessage); message WM_COPY; procedure WMCut(var Message: TMessage); message WM_CUT; @@ -387,6 +289,7 @@ TCustomSynEdit = class(TCustomControl) procedure WMGetText(var Msg: TWMGetText); message WM_GETTEXT; procedure WMGetTextLength(var Msg: TWMGetTextLength); message WM_GETTEXTLENGTH; procedure WMHScroll(var Msg: TWMScroll); message WM_HSCROLL; + procedure WMMouseHWheel(var Message: TWMMouseWheel); message WM_MOUSEHWHEEL; procedure WMPaste(var Message: TMessage); message WM_PASTE; procedure WMSetText(var Msg: TWMSetText); message WM_SETTEXT; procedure WMImeChar(var Msg: TMessage); message WM_IME_CHAR; @@ -394,198 +297,196 @@ TCustomSynEdit = class(TCustomControl) procedure WMImeNotify(var Msg: TMessage); message WM_IME_NOTIFY; procedure WMImeRequest(var Message: TMessage); message WM_IME_REQUEST; procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS; + procedure WMPaint(var Message: TWMPaint); message WM_PAINT; procedure WMSetCursor(var Msg: TWMSetCursor); message WM_SETCURSOR; procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS; procedure WMSize(var Msg: TWMSize); message WM_SIZE; procedure WMUndo(var Msg: TMessage); message WM_UNDO; procedure WMVScroll(var Msg: TWMScroll); message WM_VSCROLL; -{$IFNDEF SYN_COMPILER_6_UP} - procedure WMMouseWheel(var Msg: TMessage); message WM_MOUSEWHEEL; -{$ENDIF} + procedure WMGetObject(var Message: TMessage); message WM_GETOBJECT; private -{$IFDEF SYN_CodeFolding} - fUseCodeFolding : Boolean; + // CodeFolding private fields + fUseCodeFolding: Boolean; fCodeFolding: TSynCodeFolding; fAllFoldRanges: TSynFoldRanges; -{$ENDIF} - FAlwaysShowCaret: Boolean; - FBlockBegin: TBufferCoord; - FBlockEnd: TBufferCoord; - FCaretX: Integer; - FLastCaretX: Integer; - FCaretY: Integer; - FCharsInWindow: Integer; - FCharWidth: Integer; - FFontDummy: TFont; - FFontSmoothing: TSynFontSmoothMethod; - FHintMode: TSynHintMode; - FInserting: Boolean; - FLines: TUnicodeStrings; - FOrigLines: TUnicodeStrings; - FOrigUndoList: TSynEditUndoList; - FOrigRedoList: TSynEditUndoList; - FLinesInWindow: Integer; - FLeftChar: Integer; - FMaxScrollWidth: Integer; - FPaintLock: Integer; - FReadOnly: Boolean; - FRightEdge: Integer; - FRightEdgeColor: TColor; - FScrollHintColor: TColor; - FScrollHintFormat: TScrollHintFormat; + // End of CodeFolding private fields + fAlwaysShowCaret: Boolean; + FAutoCompleteChar: Char; // used in auto-complete of brackets and quotes + FCarets: TSynCarets; + FCaseSensitive: Boolean; + FBrackets: string; + FSelection: TSynSelection; + FSelections: TSynSelections; + fCharWidth: Integer; + fFontQuality: TFontQuality; + FFontSmoothing: TSynFontSmoothMethod; //Ethea: backward compatibility + fInserting: Boolean; + fLines: TStrings; + fOrigLines: TStrings; + fOrigUndoRedo: ISynEditUndo; + fLinesInWindow: Integer; + fLeftChar: Integer; + fPaintLock: Integer; + fReadOnly: Boolean; + fRightEdge: Integer; + fRightEdgeColor: TColor; + fScrollHintColor: TColor; + fScrollHintFormat: TScrollHintFormat; FScrollBars: TScrollStyle; - FTextHeight: Integer; - FTextOffset: Integer; - FTopLine: Integer; - FHighlighter: TSynCustomHighlighter; - FSelectedColor: TSynSelectedColor; - FActiveLineColor: TColor; - FUndoList: TSynEditUndoList; - FRedoList: TSynEditUndoList; - FBookMarks: array[0..9] of TSynEditMark; // these are just references, FMarkList is the owner - FMouseDownX: Integer; - FMouseDownY: Integer; - FBookMarkOpt: TSynBookMarkOpt; - FBorderStyle: TSynBorderStyle; - FHideSelection: Boolean; - FMouseWheelAccumulator: Integer; - FOverwriteCaret: TSynEditCaretType; - FInsertCaret: TSynEditCaretType; - FCaretOffset: TPoint; - FKeyStrokes: TSynEditKeyStrokes; - FModified: Boolean; - FMarkList: TSynEditMarkList; - FExtraLineSpacing: Integer; - FSelectionMode: TSynSelectionMode; - FActiveSelectionMode: TSynSelectionMode; //mode of the active selection - FWantReturns: Boolean; - FWantTabs: Boolean; - FWordWrapPlugin: ISynEditBufferPlugin; - FWordWrapGlyph: TSynGlyph; - FCaretAtEOL: Boolean; // used by wordwrap - - FGutter: TSynGutter; - FTabWidth: Integer; - FTextDrawer: TSynTextDrawer; - FInvalidateRect: TRect; - FStateFlags: TSynStateFlags; - FOptions: TSynEditorOptions; - FStatusChanges: TSynStatusChanges; - FLastKey: Word; - FLastShiftState: TShiftState; - FSearchEngine: TSynEditSearchCustom; - FHookedCommandHandlers: TObjectList; - FKbdHandler: TSynEditKbdHandler; - FFocusList: TList; - FPlugins: TObjectList; - FScrollTimer: TTimer; - FScrollDeltaX, fScrollDeltaY: Integer; - // event handlers - FOnChange: TNotifyEvent; - FOnClearMark: TPlaceMarkEvent; - FOnCommandProcessed: TProcessCommandEvent; - FOnDropFiles: TDropFilesEvent; - FOnGutterClick: TGutterClickEvent; - FOnKeyPressW: TKeyPressWEvent; - FOnMouseCursor: TMouseCursorEvent; - FOnPaint: TPaintEvent; - FOnPlaceMark: TPlaceMarkEvent; - FOnProcessCommand: TProcessCommandEvent; - FOnProcessUserCommand: TProcessCommandEvent; - FOnReplaceText: TReplaceTextEvent; - FOnSpecialLineColors: TSpecialLineColorsEvent; - FOnSpecialTokenAttributes: TSpecialTokenAttributesEvent; - FOnContextHelp: TContextHelpEvent; - FOnPaintTransient: TPaintTransient; - FOnScroll: TScrollEvent; - FOnTokenHint: TGetTokenHintEvent; - FOnGutterGetText: TGutterGetTextEvent; - FOnGutterPaint: TGutterPaintEvent; - FOnStatusChange: TStatusChangeEvent; -{$IFDEF SYN_CodeFolding} - fOnScanForFoldRanges : TScanForFoldRangesEvent; -{$ENDIF} - - FShowSpecChar: Boolean; + FSynEditScrollBars: ISynEditScrollBars; + FTextAreaWidth: Integer; + FTextHint: string; + fTextHeight: Integer; + fTextMargin: Integer; + fTextOffset: Integer; + fTopLine: Integer; + fHighlighter: TSynCustomHighlighter; + fSelectedColor: TSynSelectedColor; + FIndentGuides: TSynIndentGuides; + fActiveLineColor: TColor; + fUndoRedo: ISynEditUndo; + fBookMarks: array[0..9] of TSynEditMark; // these are just references, fMarkList is the owner + FMouseDown: TPoint; + fBookMarkOpt: TSynBookMarkOpt; + fBorderStyle: TSynBorderStyle; + fHideSelection: Boolean; + fOverwriteCaret: TSynEditCaretType; + fInsertCaret: TSynEditCaretType; + fKeyStrokes: TSynEditKeyStrokes; + fMarkList: TSynEditMarkList; + fExtraLineSpacing: Integer; + fWantReturns: Boolean; + fWantTabs: Boolean; + fWordWrapPlugin: ISynEditBufferPlugin; + fWordWrapGlyph: TSynGlyph; + + fGutter: TSynGutter; + fTabWidth: Integer; + fStateFlags: TSynStateFlags; + fOptions: TSynEditorOptions; + fScrollOptions: TSynEditorScrollOptions; + FVisibleSpecialChars: TSynVisibleSpecialChars; + fStatusChanges: TSynStatusChanges; + fLastKey: word; + fLastShiftState: TShiftState; + fSearchEngine: TSynEditSearchCustom; + FHookedCommandHandlers: TDictionary; + fKbdHandler: TSynEditKbdHandler; + fFocusList: TList; + FPlugins: TObjectList; + fScrollTimer: TTimer; + fScrollDeltaX, fScrollDeltaY: Integer; + fClickCountTimer: TStopWatch; + fClickCount: Integer; + FIndicators: TSynIndicators; FPaintTransientLock: Integer; - FIsScrolling: Boolean; - - FChainListCleared: TNotifyEvent; - FChainListDeleted: TStringListChangeEvent; - FChainListInserted: TStringListChangeEvent; - FChainListPutted: TStringListChangeEvent; - FChainLinesChanging: TNotifyEvent; - FChainLinesChanged: TNotifyEvent; - FChainedEditor: TCustomSynEdit; - FChainUndoAdded: TNotifyEvent; - FChainRedoAdded: TNotifyEvent; - FAdditionalWordBreakChars: TSysCharSet; FAdditionalIdentChars: TSysCharSet; + FTextFormat: TSynTextFormat; + FSelStorage: TSynSelStorage; + FBracketsHighlight: TSynBracketsHighlight; + FScrollbarAnnotations: TSynScrollbarAnnotations; + FPasteArray: TArray; + FPaintTransientPlugins: Boolean; + FOrigFontSize: Integer; + FOrigGutterFontSize: Integer; + FDisplayFlowControl: TSynDisplayFlowControl; + + // Accessibility + FUIAutomationProvider: IInterface; // IRawElementProviderSimple + FAccessibleName: string; // For screen readers. -{$IFDEF SYN_COMPILER_6_UP} - FSearchNotFound: TCustomSynEditSearchNotFoundEvent; - FOnFindBeforeSearch: TNotifyEvent; - FOnReplaceBeforeSearch: TNotifyEvent; - FOnCloseBeforeSearch: TNotifyEvent; - FSelStartBeforeSearch: Integer; - FSelLengthBeforeSearch: Integer; -{$ENDIF} - - FWindowProducedMessage: Boolean; - -{$IFDEF SYN_LINUX} - FDeadKeysFixed: Boolean; -{$ENDIF} - -{$IFDEF SYN_CodeFolding} - procedure ReScanForFoldRanges(FromLine : Integer; ToLine : Integer); + // event handlers + fOnChange: TNotifyEvent; + fOnClearMark: TPlaceMarkEvent; + fOnCommandProcessed: TProcessCommandEvent; + fOnDropFiles: TDropFilesEvent; + fOnGutterClick: TGutterClickEvent; + fOnMouseCursor: TMouseCursorEvent; + fOnPaint: TPaintEvent; + fOnPlaceMark: TPlaceMarkEvent; + fOnProcessCommand: TProcessCommandEvent; + fOnProcessUserCommand: TProcessCommandEvent; + fOnReplaceText: TReplaceTextEvent; + fOnSpecialLineColors: TSpecialLineColorsEvent; + fOnContextHelp: TContextHelpEvent; + fOnPaintTransient: TPaintTransient; + fOnScroll: TScrollEvent; + fOnShowHint: TShowHintEvent; + fOnGutterGetText: TGutterGetTextEvent; + FOnGetLineIndicators: TGetLineIndicatorsEvent; + fOnStatusChange: TStatusChangeEvent; + fOnTripleClick: TNotifyEvent; + fOnQudrupleClick: TNotifyEvent; + FOnZoom: TZoomEvent; + + fChainListCleared: TNotifyEvent; + fChainListDeleted: TStringListChangeEvent; + fChainListInserted: TStringListChangeEvent; + fChainListPut: TStringListPutEvent; + fChainLinesChanging: TNotifyEvent; + fChainLinesChanged: TNotifyEvent; + fChainedEditor: TCustomSynEdit; + fChainModifiedChanged: TNotifyEvent; + fSearchNotFound: TCustomSynEditSearchNotFoundEvent; + OnFindBeforeSearch: TNotifyEvent; + OnReplaceBeforeSearch: TNotifyEvent; + OnCloseBeforeSearch: TNotifyEvent; + // CodeFolding events and private procedures + fOnScanForFoldRanges: TScanForFoldRangesEvent; + procedure OnCodeFoldingChange(Sender: TObject); + procedure ReScanForFoldRanges(FromLine: Integer; ToLine: Integer); procedure FullFoldScan; procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine : Integer; ToLine : Integer); -{$ENDIF} + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); + procedure SetUseCodeFolding(const Value: Boolean); + function GetCollapseMarkRect(Row: Integer; Line: Integer = -1): TRect; + // End of CodeFolding events and private procedures procedure BookMarkOptionsChanged(Sender: TObject); + function ColumnSelectionStart: TBufferCoord; procedure ComputeCaret(X, Y: Integer); procedure ComputeScroll(X, Y: Integer); - procedure DoHomeKey(Selection: Boolean); + procedure DoHomeKey(Selection:Boolean); procedure DoEndKey(Selection: Boolean); + procedure DoLinesChanged; + procedure DoLinesBeforeDeleted(FirstLine, Count: Integer); procedure DoLinesDeleted(FirstLine, Count: Integer); procedure DoLinesInserted(FirstLine, Count: Integer); + procedure DoLinePut(Index: Integer; const OldLine: string); procedure DoShiftTabKey; procedure DoTabKey; - procedure DoCaseChange(const Cmd : TSynEditorCommand); - function FindHookedCmdEvent(AHandlerProc: THookedCommandEvent): Integer; procedure SynFontChanged(Sender: TObject); + procedure ForceCaretX(aCaretX: Integer); function GetBlockBegin: TBufferCoord; function GetBlockEnd: TBufferCoord; + function GetBrackets: string; function GetCanPaste: Boolean; function GetCanRedo: Boolean; function GetCanUndo: Boolean; - function GetCaretXY: TBufferCoord; function GetDisplayX: Integer; function GetDisplayY: Integer; function GetDisplayXY: TDisplayCoord; - function GetDisplayLineCount: Integer; - function GetFont: TFont; - function GetHookedCommandHandlersCount: Integer; - function GetLineText: UnicodeString; + function GetDisplayRowCount: Integer; + function GetLineText: string; function GetMaxUndo: Integer; - function GetOptions: TSynEditorOptions; + function GetModified: Boolean; + function GetRow(RowIndex: Integer): string; + function GetRowLength(RowIndex: Integer): Integer; function GetSelAvail: Boolean; - function GetSelTabBlock: Boolean; - function GetSelTabLine: Boolean; - function GetSelText: UnicodeString; - function SynGetText: UnicodeString; - function GetWordAtCursor: UnicodeString; - function GetWordAtMouse: UnicodeString; + function GetSelText: string; + function SynGetText: string; + function GetWordAtCursor: string; + function GetWordAtMouse: string; function GetWordWrap: Boolean; procedure GutterChanged(Sender: TObject); - function LeftSpaces(const Line: UnicodeString): Integer; - function LeftSpacesEx(const Line: UnicodeString; WantTabs: Boolean; CalcAlways : Boolean = False): Integer; - function GetLeftSpacing(CharCount: Integer; WantTabs: Boolean): UnicodeString; + procedure IndentGuidesChanged(Sender: TObject); + procedure InternalSetCaretX(Value: Integer); + procedure InternalSetCaretY(Value: Integer); + procedure InsertCharAtCursor(const AChar: string); + function GetLeftSpacing(CharCount: Integer; WantTabs: Boolean): string; procedure LinesChanging(Sender: TObject); - procedure MoveCaretAndSelection(const ptBefore, ptAfter: TBufferCoord; - SelectionCommand: Boolean); + procedure MoveCaretAndSelection(const NewPos: TBufferCoord; SelectionCmd: + Boolean); procedure MoveCaretHorz(DX: Integer; SelectionCommand: Boolean); procedure MoveCaretVert(DY: Integer; SelectionCommand: Boolean); procedure PluginsAfterPaint(ACanvas: TCanvas; const AClip: TRect; @@ -594,92 +495,98 @@ TCustomSynEdit = class(TCustomControl) procedure ReadRemovedKeystrokes(Reader: TReader); function ScanFrom(Index: Integer): Integer; procedure ScrollTimerHandler(Sender: TObject); - procedure SelectedColorsChanged(Sender: TObject); - procedure SetAdditionalIdentChars(const Value: TSysCharSet); - procedure SetAdditionalWordBreakChars(const Value: TSysCharSet); + procedure SelectedColorChanged(Sender: TObject); procedure SetBlockBegin(Value: TBufferCoord); procedure SetBlockEnd(Value: TBufferCoord); procedure SetBorderStyle(Value: TSynBorderStyle); procedure SetCaretX(Value: Integer); procedure SetCaretY(Value: Integer); - procedure InternalSetCaretX(Value: Integer); - procedure InternalSetCaretY(Value: Integer); - procedure SetInternalDisplayXY(const aPos: TDisplayCoord); + procedure SetCaretInRow(Value:TBufferCoord; Row: Integer); + procedure SetDisplayXY(const aPos: TDisplayCoord); procedure SetActiveLineColor(Value: TColor); procedure SetExtraLineSpacing(const Value: Integer); - procedure SetFont(const Value: TFont); procedure SetGutter(const Value: TSynGutter); procedure SetGutterWidth(Value: Integer); procedure SetHideSelection(const Value: Boolean); procedure SetHighlighter(const Value: TSynCustomHighlighter); + procedure SetIndentGuides(const Value: TSynIndentGuides); procedure SetInsertCaret(const Value: TSynEditCaretType); procedure SetInsertMode(const Value: Boolean); procedure SetKeystrokes(const Value: TSynEditKeyStrokes); procedure SetLeftChar(Value: Integer); - procedure SetLines(Value: TUnicodeStrings); - procedure SetLineText(Value: UnicodeString); - procedure SetMaxScrollWidth(Value: Integer); + procedure SetLines(Value: TStrings); + procedure SetLineText(Value: string); procedure SetMaxUndo(const Value: Integer); procedure SetModified(Value: Boolean); procedure SetOptions(Value: TSynEditorOptions); + procedure SetScrollOptions(Value: TSynEditorScrollOptions); + procedure SetVisibleSpecialChars(Value: TSynVisibleSpecialChars); procedure SetOverwriteCaret(const Value: TSynEditCaretType); procedure SetRightEdge(Value: Integer); procedure SetRightEdgeColor(Value: TColor); + procedure SetScrollBarAnnotations(const Value: TSynScrollbarAnnotations); procedure SetScrollBars(const Value: TScrollStyle); procedure SetSearchEngine(Value: TSynEditSearchCustom); - procedure SetSelectionMode(const Value: TSynSelectionMode); - procedure SetActiveSelectionMode(const Value: TSynSelectionMode); - procedure SetSelTextExternal(const Value: UnicodeString); + procedure SetSelectedColor(const Value: TSynSelectedColor); procedure SetTabWidth(Value: Integer); - procedure SynSetText(const Value: UnicodeString); + procedure SynSetText(const Value: string); procedure SetTopLine(Value: Integer); procedure SetWordWrap(const Value: Boolean); procedure SetWordWrapGlyph(const Value: TSynGlyph); procedure WordWrapGlyphChange(Sender: TObject); procedure SizeOrFontChanged(bFont: Boolean); - procedure ProperSetLine(ALine: Integer; const ALineText: UnicodeString); - procedure UpdateModifiedStatus; - procedure UndoRedoAdded(Sender: TObject); - procedure UpdateLastCaretX; + procedure ModifiedChanged(Sender: TObject); + procedure UpdateLastPosX; procedure UpdateScrollBars; procedure WriteAddedKeystrokes(Writer: TWriter); procedure WriteRemovedKeystrokes(Writer: TWriter); + procedure SetAdditionalIdentChars(const Value: TSysCharSet); + procedure SetAdditionalWordBreakChars(const Value: TSysCharSet); + function ValidBC(const Value: TBufferCoord): TBufferCoord; -{$IFDEF SYN_COMPILER_6_UP} procedure DoSearchFindFirstExecute(Action: TSearchFindFirst); procedure DoSearchFindExecute(Action: TSearchFind); procedure DoSearchReplaceExecute(Action: TSearchReplace); procedure DoSearchFindNextExecute(Action: TSearchFindNext); procedure FindDialogFindFirst(Sender: TObject); procedure FindDialogFind(Sender: TObject); - function SearchByFindDialog(FindDialog: TFindDialog) : bool; + function SearchByFindDialog(FindDialog: TFindDialog): Boolean; procedure FindDialogClose(Sender: TObject); -{$ENDIF} -{$IFDEF SYN_CodeFolding} - procedure SetUseCodeFolding(const Value: Boolean); - procedure OnCodeFoldingChange(Sender: TObject); - function GetCollapseMarkRect(Row: Integer; Line: Integer = -1): TRect; - function GetFoldShapeRect(Row: Integer): TRect; -{$ENDIF} + procedure DoMouseSelectLineRange(NewPos: TBufferCoord); + procedure DoMouseSelectWordRange(NewPos: TBufferCoord); + procedure InternalCommandHook(Sender: TObject; AfterProcessing: Boolean; + var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; + Data: Pointer; HandlerData: Pointer); + function GetWrapAreaWidth: Integer; + function GetIsScrolling: Boolean; + function GetCaseSensitive: Boolean; protected FIgnoreNextChar: Boolean; FCharCodeString: string; -{$IFDEF SYN_COMPILER_6_UP} + FStateRead: Boolean; function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override; -{$ENDIF} procedure CreateParams(var Params: TCreateParams); override; procedure CreateWnd; override; - procedure DestroyWnd; override; procedure InvalidateRect(const aRect: TRect; aErase: Boolean); virtual; procedure DblClick; override; + procedure TripleClick; virtual; + procedure QuadrupleClick; virtual; procedure DecPaintLock; procedure DefineProperties(Filer: TFiler); override; procedure DoChange; virtual; - procedure DoKeyPressW(var Message: TWMKey); - procedure DragCanceled; override; - procedure DragOver(Source: TObject; X, Y: Integer; - State: TDragState; var Accept: Boolean); override; + procedure HighlightBrackets; virtual; + //++ Ole Drag & Drop + procedure OleDragEnter(Sender: TObject; DataObject: IDataObject; + State: TShiftState; MousePt: TPoint; var Effect: LongInt; + var Result: HResult); virtual; + procedure OleDragOver(Sender: TObject; State: TShiftState; + MousePt: TPoint; var Effect: LongInt; var Result: HResult); virtual; + procedure OleDrop(Sender: TObject; DataObject: IDataObject; + State: TShiftState; MousePt: TPoint; var Effect: LongInt; + var Result: HResult); virtual; + procedure OleDragLeave(Sender: TObject; var Result: HResult); virtual; + //-- Ole Drag & Drop function GetReadOnly: Boolean; virtual; procedure HighlighterAttrChanged(Sender: TObject); procedure IncPaintLock; @@ -687,23 +594,24 @@ TCustomSynEdit = class(TCustomControl) procedure KeyUp(var Key: Word; Shift: TShiftState); override; procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyPress(var Key: Char); override; - procedure KeyPressW(var Key: WideChar); virtual; procedure LinesChanged(Sender: TObject); virtual; procedure ListCleared(Sender: TObject); + procedure ListBeforeDeleted(Sender: TObject; aIndex: Integer; aCount: Integer); procedure ListDeleted(Sender: TObject; aIndex: Integer; aCount: Integer); procedure ListInserted(Sender: TObject; Index: Integer; aCount: Integer); - procedure ListPutted(Sender: TObject; Index: Integer; aCount: Integer); + procedure ListPut(Sender: TObject; Index: Integer; const OldLine: string); //helper procs to chain list commands procedure ChainListCleared(Sender: TObject); procedure ChainListDeleted(Sender: TObject; aIndex: Integer; aCount: Integer); procedure ChainListInserted(Sender: TObject; aIndex: Integer; aCount: Integer); - procedure ChainListPutted(Sender: TObject; aIndex: Integer; aCount: Integer); + procedure ChainListPut(Sender: TObject; aIndex: Integer; const OldLine: string); procedure ChainLinesChanging(Sender: TObject); procedure ChainLinesChanged(Sender: TObject); - procedure ChainUndoRedoAdded(Sender: TObject); + procedure ChainModifiedChanged(Sender: TObject); procedure ScanRanges; procedure Loaded; override; - procedure MarkListChange(Sender: TObject); + procedure MarkListNotify(Sender: TObject; const Mark: TSynEditMark; + Action: TCollectionNotification); procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; procedure MouseMove(Shift: TShiftState; X, Y: Integer); override; @@ -712,72 +620,73 @@ TCustomSynEdit = class(TCustomControl) procedure NotifyHookedCommandHandlers(AfterProcessing: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer); virtual; procedure Paint; override; - procedure PaintGutter(const AClip: TRect; const aFirstRow, - aLastRow: Integer); virtual; - procedure PaintTextLines(AClip: TRect; const aFirstRow, aLastRow, - FirstCol, LastCol: Integer); virtual; - procedure RecalcCharExtent; - procedure RedoItem; + procedure PaintGutter(RT: ID2D1RenderTarget; const AClip: TRect; const + aFirstRow, aLastRow: Integer); virtual; + procedure PaintTextLines(RT: ID2D1RenderTarget; AClip: TRect; const aFirstRow, + aLastRow: Integer); virtual; + procedure ReadState(Reader: TReader); override; procedure InternalSetCaretXY(const Value: TBufferCoord); virtual; procedure SetCaretXY(const Value: TBufferCoord); virtual; - procedure SetCaretXYEx(CallEnsureCursorPos: Boolean; Value: TBufferCoord); virtual; - procedure SetFontSmoothing(AValue: TSynFontSmoothMethod); + procedure SetCaretXYEx(EnsureVisible: Boolean; Value: TBufferCoord); virtual; + procedure SetFontQuality(AValue: TFontQuality); procedure SetName(const Value: TComponentName); override; procedure SetReadOnly(Value: Boolean); virtual; procedure SetWantReturns(Value: Boolean); - procedure SetSelTextPrimitive(const Value: UnicodeString); - procedure SetSelTextPrimitiveEx(PasteMode: TSynSelectionMode; Value: PWideChar; - AddToUndoList: Boolean); + procedure SetSelText(const Value: string); + procedure SetSelTextPrimitiveEx(const Value: string; + AddToUndoList: Boolean = True; SelectValue: Boolean = False); + procedure SetTextHint(const Value: string); procedure SetWantTabs(Value: Boolean); procedure StatusChanged(AChanges: TSynStatusChanges); // If the translations requires Data, memory will be allocated for it via a // GetMem call. The client must call FreeMem on Data if it is not NIL. - function TranslateKeyCode(Code: Word; Shift: TShiftState; + function TranslateKeyCode(Code: word; Shift: TShiftState; var Data: Pointer): TSynEditorCommand; - procedure UndoItem; procedure UpdateMouseCursor; virtual; + property FLastPosX: Integer read FSelection.LastPosX write FSelection.LastPosX; + property CaretAtEOL: Boolean read FSelection.CaretAtEOL write FSelection.CaretAtEOL; protected - FGutterWidth: Integer; - FInternalImage: TSynInternalImage; - procedure HideCaret; - procedure ShowCaret; + fGutterWidth: Integer; + procedure CalcTextAreaWidth; + procedure DoBlockIndent; + procedure DoBlockUnindent; + procedure DoContextPopup(MousePos: TPoint; var Handled: Boolean); override; procedure DoOnClearBookmark(var Mark: TSynEditMark); virtual; procedure DoOnCommandProcessed(Command: TSynEditorCommand; AChar: WideChar; Data: Pointer); virtual; - // no method DoOnDropFiles, intercept the WM_DROPFILES instead procedure DoOnGutterClick(Button: TMouseButton; X, Y: Integer); virtual; + procedure DoOnMouserCursor(const aLineCharPos: TBufferCoord; + var aCursor: TCursor); virtual; procedure DoOnPaint; virtual; - procedure DoOnPaintTransientEx(TransientType: TTransientType; Lock: Boolean); virtual; procedure DoOnPaintTransient(TransientType: TTransientType); virtual; - procedure DoOnPlaceMark(var Mark: TSynEditMark); virtual; procedure DoOnProcessCommand(var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer); virtual; - function DoOnReplaceText(const ASearch, AReplace: UnicodeString; + function DoOnReplaceText(const ASearch, AReplace: string; Line, Column: Integer): TSynReplaceAction; virtual; function DoOnSpecialLineColors(Line: Integer; var Foreground, Background: TColor): Boolean; virtual; - procedure DoOnSpecialTokenAttributes(ALine, APos: Integer; const AToken: string; var FG, BG: TColor; - var AStyle: TFontStyles); procedure DoOnStatusChange(Changes: TSynStatusChanges); virtual; function GetSelEnd: Integer; function GetSelStart: Integer; function GetSelLength: Integer; + procedure Notification(AComponent: TComponent; + Operation: TOperation); override; procedure SetSelEnd(const Value: Integer); procedure SetSelStart(const Value: Integer); procedure SetSelLength(const Value: Integer); procedure SetAlwaysShowCaret(const Value: Boolean); - function ShrinkAtWideGlyphs(const S: UnicodeString; First: Integer; - var CharCount: Integer): UnicodeString; procedure LinesHookChanged; - procedure FontSmoothingChanged; + // Command implementations + procedure ExecCmdDeleteLine; + procedure ExecCmdCopyOrMoveLine(const Command: TSynEditorCommand); + procedure ExecCmdCaseChange(const Cmd: TSynEditorCommand); + property InternalCaretX: Integer write InternalSetCaretX; property InternalCaretY: Integer write InternalSetCaretY; property InternalCaretXY: TBufferCoord write InternalSetCaretXY; - property FontSmoothing: TSynFontSmoothMethod read FFontSmoothing write SetFontSmoothing; -//++ DPI-Aware - procedure ChangeScale(M, D: Integer{$if CompilerVersion >= 31}; isDpiChange: Boolean{$ifend}); override; -//-- DPI-Aware + property FontSmoothing: TSynFontSmoothMethod read FFontSmoothing write FFontSmoothing; //Ethea: backward compatibility + procedure ChangeScale(M, D: Integer; isDpiChange: Boolean); override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -785,82 +694,90 @@ TCustomSynEdit = class(TCustomControl) property SelStart: Integer read GetSelStart write SetSelStart; property SelEnd: Integer read GetSelEnd write SetSelEnd; property AlwaysShowCaret: Boolean read FAlwaysShowCaret - write SetAlwaysShowCaret; - procedure UpdateCaret; -{$IFDEF SYN_COMPILER_4_UP} - procedure AddKey(Command: TSynEditorCommand; Key1: Word; SS1: TShiftState; - Key2: Word = 0; SS2: TShiftState = []); -{$ELSE} - procedure AddKey(Command: TSynEditorCommand; Key1: Word; SS1: TShiftState; - Key2: Word; SS2: TShiftState); -{$ENDIF} + write SetAlwaysShowCaret; + procedure UpdateCarets; + procedure UpdateIME; + procedure AddKey(Command: TSynEditorCommand; Key1: word; SS1: TShiftState; + Key2: word = 0; SS2: TShiftState = []); procedure BeginUndoBlock; procedure BeginUpdate; function CaretInView: Boolean; - function CharIndexToRowCol(Index: Integer): TBufferCoord; + procedure CaretsAtLineEnds; + function CharIndexToRowCol(Index: Integer; LineBreak: string = SLineBreak): TBufferCoord; procedure Clear; procedure ClearAll; procedure ClearBookMark(BookMark: Integer); - procedure ClearSelection; + procedure DeleteSelections; procedure CommandProcessor(Command: TSynEditorCommand; AChar: WideChar; Data: Pointer); virtual; procedure ClearUndo; + procedure ClearTrackChanges; + procedure MarkSaved; procedure CopyToClipboard; procedure CutToClipboard; - procedure DoCopyToClipboard(const SText: UnicodeString); - procedure DragDrop(Source: TObject; X, Y: Integer); override; procedure EndUndoBlock; procedure EndUpdate; + procedure EnsureCaretInView; procedure EnsureCursorPosVisible; procedure EnsureCursorPosVisibleEx(ForceToMiddle: Boolean; EvenIfVisible: Boolean = False); procedure FindMatchingBracket; virtual; function GetMatchingBracket: TBufferCoord; virtual; - function GetMatchingBracketEx(const APoint: TBufferCoord): TBufferCoord; virtual; -{$IFDEF SYN_COMPILER_4_UP} + function GetMatchingBracketEx(const APoint: TBufferCoord; + Brackets: string = '()[]{}<>'): TBufferCoord; virtual; + function GetMatchingBracketEnhanced(var BracketPos: TBufferCoord; Brackets: + string = '()[]{}<>'; AdjustMatchingPos: Boolean = True): TBufferCoord; + virtual; function ExecuteAction(Action: TBasicAction): Boolean; override; -{$ENDIF} procedure ExecuteCommand(Command: TSynEditorCommand; AChar: WideChar; Data: Pointer); virtual; - function ExpandAtWideGlyphs(const S: UnicodeString): UnicodeString; + procedure ExecuteMultiCaretCommand(Command: TSynEditorCommand; AChar: WideChar; + Data: Pointer; CommandInfo: TSynCommandInfo); virtual; function GetBookMark(BookMark: Integer; var X, Y: Integer): Boolean; - function GetHighlighterAttriAtRowCol(const XY: TBufferCoord; var Token: UnicodeString; + function GetHighlighterAttriAtRowCol(const XY: TBufferCoord; var Token: string; var Attri: TSynHighlighterAttributes): Boolean; - function GetHighlighterAttriAtRowColEx(const XY: TBufferCoord; var Token: UnicodeString; + function GetHighlighterAttriAtRowColEx(const XY: TBufferCoord; var Token: string; var TokenType, Start: Integer; var Attri: TSynHighlighterAttributes): Boolean; function GetPositionOfMouse(out aPos: TBufferCoord): Boolean; - function GetWordAtRowCol(XY: TBufferCoord): UnicodeString; + function GetWordAtRowCol(XY: TBufferCoord): string; + procedure GetWordBoundaries(XY: TBufferCoord; var BB, BE: TBufferCoord); + procedure GotoPrevChange; + procedure GotoNextChange; procedure GotoBookMark(BookMark: Integer); virtual; procedure GotoLineAndCenter(ALine: Integer); virtual; function IsIdentChar(AChar: WideChar): Boolean; virtual; function IsWhiteChar(AChar: WideChar): Boolean; virtual; function IsWordBreakChar(AChar: WideChar): Boolean; virtual; - - procedure InsertBlock(const BB, BE: TBufferCoord; ChangeStr: PWideChar; AddToUndoList: Boolean); - procedure InsertLine(const BB, BE: TBufferCoord; ChangeStr: PWideChar; AddToUndoList: Boolean); - function UnifiedSelection: TBufferBlock; - procedure DoBlockIndent; - procedure DoBlockUnindent; - + // support procedure for ecDeletexxx commands + function IsNonWhiteChar(AChar: WideChar): Boolean; virtual; procedure InvalidateGutter; procedure InvalidateGutterLine(aLine: Integer); procedure InvalidateGutterLines(FirstLine, LastLine: Integer); + procedure InvalidateGutterBand(Kind: TSynGutterBandKind); procedure InvalidateLine(Line: Integer); procedure InvalidateLines(FirstLine, LastLine: Integer); - procedure InvalidateSelection; - procedure MarkModifiedLinesAsSaved; - procedure ResetModificationIndicator; + procedure InvalidateRange(const BB, BE: TBufferCoord); + procedure InvalidateSelection; overload; + procedure InvalidateSelection(const Sel: TSynSelection); overload; function IsBookmark(BookMark: Integer): Boolean; + function IsLineMOdified(ALine: Integer): Boolean; function IsPointInSelection(const Value: TBufferCoord): Boolean; procedure LockUndo; - function BufferToDisplayPos(const p: TBufferCoord): TDisplayCoord; - function DisplayToBufferPos(const p: TDisplayCoord): TBufferCoord; + procedure MoveDisplayPosAndSelection(const NewPos: TDisplayCoord; + SelectionCmd: Boolean); + function BufferToDisplayPos(const BC: TBufferCoord): TDisplayCoord; + function DisplayToBufferPos(const DC: TDisplayCoord): TBufferCoord; function LineToRow(aLine: Integer): Integer; function RowToLine(aRow: Integer): Integer; - procedure Notification(AComponent: TComponent; - Operation: TOperation); override; + function SelectionToDisplayCoord(var Sel: TSynSelection): TDisplayCoord; procedure PasteFromClipboard; + function TextWidth(const S: string): Integer; overload; + function TextWidth(P: PChar; Len: Integer): Integer; overload; + + // for use in PaintTransient + procedure PaintText(S: string; P: TPoint; ClipR: TRect; FontStyle: TFontStyles; + FontColor: TColor; BkgColor: TColor = clNone); function NextWordPos: TBufferCoord; virtual; function NextWordPosEx(const XY: TBufferCoord): TBufferCoord; virtual; @@ -871,35 +788,51 @@ TCustomSynEdit = class(TCustomControl) function PrevWordPos: TBufferCoord; virtual; function PrevWordPosEx(const XY: TBufferCoord): TBufferCoord; virtual; + function PixelsToColumn(P: PChar; Len: Integer; aX: Integer; CharBefore: + Boolean = False): Integer; function PixelsToRowColumn(aX, aY: Integer): TDisplayCoord; function PixelsToNearestRowColumn(aX, aY: Integer): TDisplayCoord; procedure Redo; procedure RegisterCommandHandler(const AHandlerProc: THookedCommandEvent; AHandlerData: Pointer); + function RowColumnInView(RowCol: TDisplayCoord): Boolean; + function ColumnToPixels(const S: string; Col: Integer): Integer; function RowColumnToPixels(const RowCol: TDisplayCoord): TPoint; - function RowColToCharIndex(RowCol: TBufferCoord): Integer; - function SearchReplace(const ASearch, AReplace: UnicodeString; - AOptions: TSynSearchOptions): Integer; + function RowColToCharIndex(RowCol: TBufferCoord; LineBreak: string = SLineBreak): Integer; + function SearchReplace(const ASearch, AReplace: string; + AOptions: TSynSearchOptions): Integer; overload; + function SearchReplace(const ASearch, AReplace: string; + AOptions: TSynSearchOptions; const Start, Stop: TBufferCoord): Integer; overload; procedure SelectAll; + function SelectionText(Sel: TSynSelection): string; + procedure SelectAllMatchingText; + function SelectMatchingText(BackwardSearch: Boolean = False; + AddSelection: Boolean = False): Boolean; procedure SetBookMark(BookMark: Integer; X: Integer; Y: Integer); - procedure SetCaretAndSelection(const ptCaret, ptBefore, ptAfter: TBufferCoord); + procedure SetCaretAndSelection(const ptCaret, ptBefore, + ptAfter: TBufferCoord; EnsureVisible: Boolean= True; + ForceToMiddle: Boolean = False); overload; + procedure SetCaretAndSelection(const Sel: TSynSelection; + EnsureVisible: Boolean= True; ForceToMiddle: Boolean = False); overload; procedure SetDefaultKeystrokes; virtual; procedure SetSelWord; procedure SetWordBlock(Value: TBufferCoord); + procedure SurroundSelection(const Before: string; After: string = ''); procedure Undo; procedure UnlockUndo; procedure UnregisterCommandHandler(AHandlerProc: THookedCommandEvent); -{$IFDEF SYN_COMPILER_4_UP} function UpdateAction(Action: TBasicAction): Boolean; override; -{$ENDIF} + function ValidTextPos(const S: string; Index: Integer; Trailing: Boolean): + Integer; overload; + function ValidTextPos(BC: TBufferCoord; Trailing: Boolean): TBufferCoord; overload; procedure SetFocus; override; procedure AddKeyUpHandler(aHandler: TKeyEvent); procedure RemoveKeyUpHandler(aHandler: TKeyEvent); procedure AddKeyDownHandler(aHandler: TKeyEvent); procedure RemoveKeyDownHandler(aHandler: TKeyEvent); - procedure AddKeyPressHandler(aHandler: TKeyPressWEvent); - procedure RemoveKeyPressHandler(aHandler: TKeyPressWEvent); + procedure AddKeyPressHandler(aHandler: TKeyPressEvent); + procedure RemoveKeyPressHandler(aHandler: TKeyPressEvent); procedure AddFocusControl(aControl: TWinControl); procedure RemoveFocusControl(aControl: TWinControl); procedure AddMouseDownHandler(aHandler: TMouseEvent); @@ -912,10 +845,14 @@ TCustomSynEdit = class(TCustomControl) procedure WndProc(var Msg: TMessage); override; procedure SetLinesPointer(ASynEdit: TCustomSynEdit); procedure RemoveLinesPointer; - procedure HookTextBuffer(aBuffer: TSynEditStringList; - aUndo, aRedo: TSynEditUndoList); + function IsChained: Boolean; + procedure HookTextBuffer(aBuffer: TSynEditStringList; aUndoRedo: ISynEditUndo); procedure UnHookTextBuffer; -{$IFDEF SYN_CodeFolding} + + procedure Zoom(ExtraFontSize: Integer); + procedure ZoomReset; + + // CodeFolding procedures procedure CollapseAll; procedure UncollapseAll; procedure Collapse(FoldRangeIndex: Integer; Invalidate:Boolean = True); @@ -923,172 +860,186 @@ TCustomSynEdit = class(TCustomControl) procedure UncollapseAroundLine(Line: Integer); procedure CollapseNearest; procedure UncollapseNearest; - procedure CollapseLevel(Level : integer); - procedure UnCollapseLevel(Level : integer); - procedure CollapseFoldType(FoldType : Integer); - procedure UnCollapseFoldType(FoldType : Integer); -{$ENDIF} + procedure CollapseLevel(Level: Integer); + procedure UnCollapseLevel(Level: Integer); + procedure CollapseFoldType(FoldType: Integer); + procedure UnCollapseFoldType(FoldType: Integer); + procedure SurfaceCaretFromHiddenFolds; public property AdditionalIdentChars: TSysCharSet read FAdditionalIdentChars write SetAdditionalIdentChars; property AdditionalWordBreakChars: TSysCharSet read FAdditionalWordBreakChars write SetAdditionalWordBreakChars; property BlockBegin: TBufferCoord read GetBlockBegin write SetBlockBegin; property BlockEnd: TBufferCoord read GetBlockEnd write SetBlockEnd; + property Brackets: string read GetBrackets write FBrackets; property CanPaste: Boolean read GetCanPaste; property CanRedo: Boolean read GetCanRedo; property CanUndo: Boolean read GetCanUndo; - property CaretX: Integer read FCaretX write SetCaretX; - property CaretY: Integer read FCaretY write SetCaretY; - property CaretXY: TBufferCoord read GetCaretXY write SetCaretXY; - property ActiveLineColor: TColor read FActiveLineColor + property CaretX: Integer read FSelection.Caret.Char write SetCaretX; + property CaretY: Integer read FSelection.Caret.Line write SetCaretY; + property CaretXY: TBufferCoord read FSelection.Caret write SetCaretXY; + property CaseSensitive: Boolean read GetCaseSensitive write FCaseSensitive; + property ActiveLineColor: TColor read fActiveLineColor write SetActiveLineColor default clNone; property DisplayX: Integer read GetDisplayX; property DisplayY: Integer read GetDisplayY; - property DisplayXY: TDisplayCoord read GetDisplayXY; - property DisplayLineCount: Integer read GetDisplayLineCount; - property CharsInWindow: Integer read FCharsInWindow; - property CharWidth: Integer read FCharWidth; + property DisplayXY: TDisplayCoord read GetDisplayXY write SetDisplayXY; + property DisplayRowCount: Integer read GetDisplayRowCount; + property CharWidth: Integer read fCharWidth; property Color; - property Font: TFont read GetFont write SetFont; - property Highlighter: TSynCustomHighlighter - read FHighlighter write SetHighlighter; - property HintMode: TSynHintMode read FHintMode write FHintMode default shmDefault; - property LeftChar: Integer read FLeftChar write SetLeftChar; - property LineHeight: Integer read FTextHeight; - property LinesInWindow: Integer read FLinesInWindow; - property LineText: UnicodeString read GetLineText write SetLineText; - property Lines: TUnicodeStrings read FLines write SetLines; - property Marks: TSynEditMarkList read FMarkList; - property MaxScrollWidth: Integer read FMaxScrollWidth write SetMaxScrollWidth - default 1024; - property Modified: Boolean read FModified write SetModified; - property PaintLock: Integer read FPaintLock; + property Cursor default crIBeam; + property Font; + property Indicators: TSynIndicators read FIndicators; + property BracketsHighlight: TSynBracketsHighlight read FBracketsHighlight; + property ScrollbarAnnotations: TSynScrollbarAnnotations + read FScrollbarAnnotations write SetScrollBarAnnotations; + property Highlighter: TSynCustomHighlighter read fHighlighter + write SetHighlighter; + property LeftChar: Integer read fLeftChar write SetLeftChar; + property LineHeight: Integer read fTextHeight; + property LinesInWindow: Integer read fLinesInWindow; + property LineText: string read GetLineText write SetLineText; + property Lines: TStrings read fLines write SetLines; + property Rows[RowIndex: Integer]: string read GetRow; + property RowLength[RowIndex: Integer]: Integer read GetRowLength; + property Marks: TSynEditMarkList read fMarkList; + property Modified: Boolean read GetModified write SetModified; + property PaintLock: Integer read fPaintLock; property ReadOnly: Boolean read GetReadOnly write SetReadOnly default False; - property SearchEngine: TSynEditSearchCustom read FSearchEngine write SetSearchEngine; + property SearchEngine: TSynEditSearchCustom read fSearchEngine write SetSearchEngine; property SelAvail: Boolean read GetSelAvail; property SelLength: Integer read GetSelLength write SetSelLength; - property SelTabBlock: Boolean read GetSelTabBlock; - property SelTabLine: Boolean read GetSelTabLine; - property SelText: UnicodeString read GetSelText write SetSelTextExternal; - property StateFlags: TSynStateFlags read FStateFlags; - property Text: UnicodeString read SynGetText write SynSetText; - property TopLine: Integer read FTopLine write SetTopLine; - property WordAtCursor: UnicodeString read GetWordAtCursor; - property WordAtMouse: UnicodeString read GetWordAtMouse; - property UndoList: TSynEditUndoList read FUndoList; - property RedoList: TSynEditUndoList read FRedoList; - public - property OnProcessCommand: TProcessCommandEvent - read FOnProcessCommand write FOnProcessCommand; - -{$IFDEF SYN_CodeFolding} + property SelText: string read GetSelText write SetSelText; + property Selection: TSynSelection read FSelection; + property Selections: TSynSelections read FSelections; + property StateFlags: TSynStateFlags read fStateFlags write fStateFlags; + property Text: string read SynGetText write SynSetText; + property TextHint: string read FTextHint write SetTextHint; + property TopLine: Integer read fTopLine write SetTopLine; + property TextAreaWidth: Integer read FTextAreaWidth; + property WrapAreaWidth: Integer read GetWrapAreaWidth; + property WordAtCursor: string read GetWordAtCursor; + property WordAtMouse: string read GetWordAtMouse; + property GutterWidth: Integer read FGutterWidth; + property TextMargin: Integer read FTextMargin; + property UndoRedo: ISynEditUndo read fUndoRedo; + property TextFormat: TSynTextFormat read FTextFormat; + property FontQuality: TFontQuality read fFontQuality write SetFontQuality; + // CodeFolding properties property CodeFolding: TSynCodeFolding read fCodeFolding write fCodeFolding; property UseCodeFolding: Boolean read fUseCodeFolding write SetUseCodeFolding; property AllFoldRanges: TSynFoldRanges read fAllFoldRanges; -{$ENDIF} + // End of CodeFolding property BookMarkOptions: TSynBookMarkOpt - read FBookMarkOpt write FBookMarkOpt; + read fBookMarkOpt write fBookMarkOpt; property BorderStyle: TSynBorderStyle read FBorderStyle write SetBorderStyle default bsSingle; property ExtraLineSpacing: Integer - read FExtraLineSpacing write SetExtraLineSpacing default 0; - property Gutter: TSynGutter read FGutter write SetGutter; - property HideSelection: Boolean read FHideSelection write SetHideSelection + read fExtraLineSpacing write SetExtraLineSpacing default 2; + property Gutter: TSynGutter read fGutter write SetGutter; + property HideSelection: Boolean read fHideSelection write SetHideSelection default False; + property IndentGuides: TSynIndentGuides + read FIndentGuides write SetIndentGuides; property InsertCaret: TSynEditCaretType read FInsertCaret write SetInsertCaret default ctVerticalLine; - property InsertMode: Boolean read FInserting write SetInsertMode - default true; - property IsScrolling : Boolean read FIsScrolling; + property InsertMode: Boolean read fInserting write SetInsertMode + default True; + property IsScrolling: Boolean read GetIsScrolling; property Keystrokes: TSynEditKeyStrokes - read FKeyStrokes write SetKeystrokes stored False; - property MaxUndo: Integer read GetMaxUndo write SetMaxUndo default 1024; - property Options: TSynEditorOptions read GetOptions write SetOptions + read FKeystrokes write SetKeystrokes stored False; + property MaxUndo: Integer read GetMaxUndo write SetMaxUndo default 0; + property Options: TSynEditorOptions read fOptions write SetOptions default SYNEDIT_DEFAULT_OPTIONS; + property ScrollOptions: TSynEditorScrollOptions read fScrollOptions write SetScrollOptions + default SYNEDIT_DEFAULT_SCROLLOPTIONS; + property VisibleSpecialChars: TSynVisibleSpecialChars + read FVisibleSpecialChars write SetVisibleSpecialChars default []; property OverwriteCaret: TSynEditCaretType read FOverwriteCaret write SetOverwriteCaret default ctBlock; - property RightEdge: Integer read FRightEdge write SetRightEdge default 80; + property RightEdge: Integer read fRightEdge write SetRightEdge default 80; property RightEdgeColor: TColor - read FRightEdgeColor write SetRightEdgeColor default clSilver; - property ScrollHintColor: TColor read FScrollHintColor - write FScrollHintColor default clInfoBk; - property ScrollHintFormat: TScrollHintFormat read FScrollHintFormat - write FScrollHintFormat default shfTopLineOnly; + read fRightEdgeColor write SetRightEdgeColor default clSilver; + property ScrollHintColor: TColor read fScrollHintColor + write fScrollHintColor default clInfoBk; + property ScrollHintFormat: TScrollHintFormat read fScrollHintFormat + write fScrollHintFormat default shfTopLineOnly; property ScrollBars: TScrollStyle read FScrollBars write SetScrollBars default ssBoth; property SelectedColor: TSynSelectedColor - read FSelectedColor write FSelectedColor; - property SelectionMode: TSynSelectionMode - read FSelectionMode write SetSelectionMode default smNormal; - property ActiveSelectionMode: TSynSelectionMode read FActiveSelectionMode - write SetActiveSelectionMode stored False; - property TabWidth: Integer read FTabWidth write SetTabWidth default 8; - property WantReturns: Boolean read FWantReturns write SetWantReturns default True; - property WantTabs: Boolean read FWantTabs write SetWantTabs default False; + read FSelectedColor write SetSelectedColor; + property TabWidth: Integer read fTabWidth write SetTabWidth default 8; + property WantReturns: Boolean read fWantReturns write SetWantReturns default True; + property WantTabs: Boolean read fWantTabs write SetWantTabs default False; property WordWrap: Boolean read GetWordWrap write SetWordWrap default False; - property WordWrapGlyph: TSynGlyph read FWordWrapGlyph write SetWordWrapGlyph; + property WordWrapGlyph: TSynGlyph read fWordWrapGlyph write SetWordWrapGlyph; + property AccessibleName: string read FAccessibleName write FAccessibleName; + property DisplayFlowControl: TSynDisplayFlowControl read FDisplayFlowControl + write FDisplayFlowControl; + property OnChange: TNotifyEvent read FOnChange write FOnChange; - property OnClearBookmark: TPlaceMarkEvent read FOnClearMark - write FOnClearMark; + property OnClearBookmark: TPlaceMarkEvent read fOnClearMark + write fOnClearMark; property OnCommandProcessed: TProcessCommandEvent - read FOnCommandProcessed write FOnCommandProcessed; + read fOnCommandProcessed write fOnCommandProcessed; property OnContextHelp: TContextHelpEvent - read FOnContextHelp write FOnContextHelp; - property OnDropFiles: TDropFilesEvent read FOnDropFiles write FOnDropFiles; + read fOnContextHelp write fOnContextHelp; + property OnDropFiles: TDropFilesEvent read fOnDropFiles write fOnDropFiles; property OnGutterClick: TGutterClickEvent - read FOnGutterClick write FOnGutterClick; - property OnGutterGetText: TGutterGetTextEvent read FOnGutterGetText - write FOnGutterGetText; - property OnGutterPaint: TGutterPaintEvent read FOnGutterPaint - write FOnGutterPaint; - property OnMouseCursor: TMouseCursorEvent read FOnMouseCursor - write FOnMouseCursor; - property OnKeyPress: TKeyPressWEvent read FOnKeyPressW write FOnKeyPressW; - property OnPaint: TPaintEvent read FOnPaint write FOnPaint; + read fOnGutterClick write fOnGutterClick; + property OnGutterGetText: TGutterGetTextEvent read fOnGutterGetText + write fOnGutterGetText; + property OnGetLineIndicators: TGetLineIndicatorsEvent + read FOnGetLineIndicators write FOnGetLineIndicators; + property OnMouseCursor: TMouseCursorEvent read fOnMouseCursor + write fOnMouseCursor; + property OnPaint: TPaintEvent read fOnPaint write fOnPaint; property OnPlaceBookmark: TPlaceMarkEvent read FOnPlaceMark write FOnPlaceMark; property OnProcessUserCommand: TProcessCommandEvent read FOnProcessUserCommand write FOnProcessUserCommand; - property OnReplaceText: TReplaceTextEvent read FOnReplaceText - write FOnReplaceText; + property OnReplaceText: TReplaceTextEvent read fOnReplaceText + write fOnReplaceText; property OnSpecialLineColors: TSpecialLineColorsEvent - read FOnSpecialLineColors write FOnSpecialLineColors; - property OnSpecialTokenAttributes: TSpecialTokenAttributesEvent - read FOnSpecialTokenAttributes write FOnSpecialTokenAttributes; + read fOnSpecialLineColors write fOnSpecialLineColors; property OnStatusChange: TStatusChangeEvent - read FOnStatusChange write FOnStatusChange; + read fOnStatusChange write fOnStatusChange; property OnPaintTransient: TPaintTransient - read FOnPaintTransient write FOnPaintTransient; - property OnScroll: TScrollEvent - read FOnScroll write FOnScroll; - property OnTokenHint: TGetTokenHintEvent read FOnTokenHint write FOnTokenHint; -{$IFDEF SYN_CodeFolding} + read fOnPaintTransient write fOnPaintTransient; + property OnProcessCommand: TProcessCommandEvent + read FOnProcessCommand write FOnProcessCommand; + property OnShowHint: TShowHintEvent read fOnShowHint write fOnShowHint; + property OnScroll: TScrollEvent read fOnScroll write fOnScroll; + property OnTripleClick: TNotifyEvent + read fOnTripleClick write fOnTripleClick; + property OnQuadrupleClick: TNotifyEvent + read fOnQudrupleClick write fOnQudrupleClick; + property OnZoom: TZoomEvent read FOnZoom write FOnZoom; + // Event handler used for CodeFolding property OnScanForFoldRanges: TScanForFoldRangesEvent read fOnScanForFoldRanges write fOnScanForFoldRanges; -{$ENDIF} - published - property Cursor default crIBeam; -{$IFDEF SYN_COMPILER_6_UP} property OnSearchNotFound: TCustomSynEditSearchNotFoundEvent - read FSearchNotFound write FSearchNotFound; -{$ENDIF} + read fSearchNotFound write fSearchNotFound; end; TSynEdit = class(TCustomSynEdit) published // inherited properties + property AccessibleName; property Align; -{$IFDEF SYN_COMPILER_4_UP} property Anchors; + property DoubleBuffered; + property CaseSensitive default False; property Constraints; -{$ENDIF} property Color; property ActiveLineColor; property Ctl3D; + property Cursor; property ParentCtl3D; property Enabled; property Font; property Height; property Name; + property ParentDoubleBuffered; property ParentColor default False; property ParentFont default False; property ParentShowHint; @@ -1096,6 +1047,7 @@ TSynEdit = class(TCustomSynEdit) property ShowHint; property TabOrder; property TabStop default True; + property TextHint; property Visible; property Width; // inherited events @@ -1103,10 +1055,8 @@ TSynEdit = class(TCustomSynEdit) property OnDblClick; property OnDragDrop; property OnDragOver; -{$IFDEF SYN_COMPILER_4_UP} property OnEndDock; property OnStartDock; -{$ENDIF} property OnEndDrag; property OnEnter; property OnExit; @@ -1121,26 +1071,26 @@ TSynEdit = class(TCustomSynEdit) property OnMouseWheelUp; property OnStartDrag; // TCustomSynEdit properties -{$IFDEF SYN_CodeFolding} property CodeFolding; property UseCodeFolding; -{$ENDIF} property BookMarkOptions; property BorderStyle; property ExtraLineSpacing; + property DisplayFlowControl; + property FontQuality default fqClearTypeNatural; property Gutter; property HideSelection; property Highlighter; - property HintMode; + property IndentGuides; property ImeMode; property ImeName; property InsertCaret; property InsertMode; property Keystrokes; property Lines; - property MaxScrollWidth; property MaxUndo; property Options; + property ScrollOptions; property OverwriteCaret; property ReadOnly; property RightEdge; @@ -1148,10 +1098,11 @@ TSynEdit = class(TCustomSynEdit) property ScrollHintColor; property ScrollHintFormat; property ScrollBars; + property ScrollbarAnnotations; property SearchEngine; property SelectedColor; - property SelectionMode; property TabWidth; + property VisibleSpecialChars; property WantReturns; property WantTabs; property WordWrap; @@ -1161,26 +1112,27 @@ TSynEdit = class(TCustomSynEdit) property OnClearBookmark; property OnCommandProcessed; property OnContextHelp; + property OnContextPopup; property OnDropFiles; property OnGutterClick; property OnGutterGetText; - property OnGutterPaint; property OnMouseCursor; property OnPaint; property OnPlaceBookmark; property OnProcessCommand; property OnProcessUserCommand; property OnReplaceText; + property OnShowHint; property OnScroll; property OnSpecialLineColors; property OnStatusChange; - property OnTokenHint; property OnPaintTransient; -{$IFDEF SYN_CodeFolding} + property OnTripleClick; + property OnQuadrupleClick; + property OnSearchNotFound; + property OnZoom; property OnScanForFoldRanges; -{$ENDIF} - - property FontSmoothing; + property FontSmoothing; //Ethea: backward compatibility end; implementation @@ -1188,207 +1140,322 @@ implementation {$R SynEdit.res} uses -{$IFDEF SYN_COMPILER_6_UP} - Consts, -{$ENDIF} -{$IFDEF SYN_COMPILER_18_UP} - AnsiStrings, -{$ENDIF} - Clipbrd, - ShellAPI, + System.Types, + System.Character, + Winapi.ShellAPI, + Vcl.Consts, + Vcl.Clipbrd, + Vcl.IMouse, + SynAccessibility, + SynEditScrollBars, + SynEditUndo, SynEditWordWrap, - SynEditStrConst; + SynEditStrConst, + SynEditDataObject, + SynEditDragDrop, + SynEditSearch; + +{ TCustomSynEdit } -function CeilOfIntDiv(Dividend: Cardinal; Divisor: Word): Word; -Var - Remainder: Word; +function TCustomSynEdit.PixelsToNearestRowColumn(aX, aY: Integer): TDisplayCoord; +// Same as PixelsToRowColumn but don't return a partially visible last line begin - DivMod(Dividend, Divisor, Result, Remainder); - if Remainder > 0 then - Inc(Result); + aY := MinMax(aY, 0, fLinesInWindow * fTextHeight - 1); + Result := PixelsToRowColumn(aX, aY); end; -function TrimTrailingSpaces(const S: UnicodeString): UnicodeString; +function TCustomSynEdit.PixelsToColumn(P: PChar; Len: Integer; aX: Integer; + CharBefore: Boolean = False): Integer; +{ Returns the character index at given pixel position aX when the text is + rendered with the SynEdit TextFormat. + If CharBefore is True you always get the character at or before the pixel + position, othwerwise you get the nearest character} var - I: Integer; + Layout: TSynTextLayout; + HTM: TDwriteHitTestMetrics; + IsTrailing, IsInside: LongBool; + P2, PStart, PEnd: PChar; + W: Integer; + CopyS: string; begin - I := Length(S); - while (I > 0) and ((S[I] = #32) or (S[I] = #9)) do - Dec(I); - Result := Copy(S, 1, I); -end; + if (Len = 0) or (aX <= 0) then + Result := Max((ax div fCharWidth) + 1, 1) + else + begin + if scControlChars in FVisibleSpecialChars then + begin + SetString(CopyS, P, Len); + SubstituteControlChars(CopyS); + P := PChar(CopyS); + end; -{ THookedCommandHandlerEntry } + PStart := P; + PEnd := P + Len; + W := 0; -type - THookedCommandHandlerEntry = class(TObject) - private - FEvent: THookedCommandEvent; - FData: Pointer; - constructor Create(AEvent: THookedCommandEvent; AData: Pointer); - function Equals(AEvent: THookedCommandEvent): Boolean; {$IFDEF UNICODE} reintroduce; {$ENDIF} + while (P < PEnd) and (W < aX) do + begin + while (P < PEnd) and (W < aX) do + begin + case P^ of + #9: Inc(W, fTabWidth * fCharWidth - W mod (fTabWidth * fCharWidth)); + #32..#126, #$00A0: Inc(W, FCharWidth); + else + Break; + end; + Inc(P); + end; + if not CharBefore and ((P = PEnd) or (W >= aX)) and (W <= aX + fCharWidth div 2) then + Inc(P); + + if (P >= PEnd) or (W >= aX) then Break; + + // Just in case P is followed by combining characters + if (P > PStart) and not (Word((P-1)^) in [9, 32]) then + begin + Dec(P); + Dec(W, FCharWidth); + end; + + // Measure non-ascii text code points + P2 := P; + while P2 < PEnd do + begin + Inc(P2); + if Word(P2^) in [9, 65..90, 97..122] then Break; + end; + + Layout.Create(FTextFormat, P, P2-P, MaxInt, fTextHeight); + CheckOSError(Layout.IDW.HitTestPoint(aX - W, + fTextHeight div 2, IsTrailing, IsInside, HTM)); + + Inc(W, Round(HTM.left + HTM.width)); + if IsInside then + begin + Inc(P, Integer(HTM.textPosition) + + IfThen(not CharBefore and IsTrailing, HTM.length + 1, 1)); + Break; + end + else + P := P2; + end; + Result := P - PStart; + if (P >= PEnd) and (ax > W) then + Inc(Result, Round((ax - W) / fCharWidth)) end; +end; -constructor THookedCommandHandlerEntry.Create(AEvent: THookedCommandEvent; - AData: Pointer); +function TCustomSynEdit.PixelsToRowColumn(aX, aY: Integer): TDisplayCoord; +var + S: string; begin - inherited Create; - FEvent := AEvent; - FData := AData; + Result.Row := MinMax(TopLine + (aY div fTextHeight), 1, DisplayRowCount); + S := Rows[Result.Row]; + Result.Column := PixelsToColumn(PChar(S), S.Length, ax - fTextOffset); end; -function THookedCommandHandlerEntry.Equals(AEvent: THookedCommandEvent): Boolean; +function TCustomSynEdit.ColumnSelectionStart: TBufferCoord; + // With eoScrollPastEol in an empty selection (Selection.Start = Selection.Stop) + // Selection.Caret may be different to both, if it is past eol. + // In that case prefer the Caret. begin - with TMethod(FEvent) do - Result := (Code = TMethod(AEvent).Code) and (Data = TMethod(AEvent).Data); + if Selections.BaseSelection.IsEmpty then + Result := Selections.BaseSelection.Caret + else + Result := Selections.BaseSelection.Start; end; -{ TCustomSynEdit } - -function TCustomSynEdit.PixelsToNearestRowColumn(aX, aY: Integer): TDisplayCoord; -// Result is in display coordinates +function TCustomSynEdit.ColumnToPixels(const S: string; Col: Integer): Integer; var - f: Single; + Layout: TSynTextLayout; + HTM: TDwriteHitTestMetrics; + P, P2, PStart, PEnd, PCol: PChar; + X, Y: Single; + CopyS: string; begin - f := (aX - FGutterWidth - 2) / FCharWidth; - // don't return a partially visible last line - if aY >= FLinesInWindow * FTextHeight then + if scControlChars in FVisibleSpecialChars then + begin + CopyS := S; + SubstituteControlChars(CopyS); + P := PChar(CopyS); + PEnd := P + CopyS.Length; + end + else + begin + P := PChar(S); + PEnd := P + S.Length; + end; + + + PStart := P; + PCol := P + Col - 1; + Result := 0; + + while P < PCol do begin - aY := FLinesInWindow * FTextHeight - 1; - if aY < 0 then - aY := 0; + while P < PCol do + begin + case P^ of + #9: Inc(Result, fTabWidth * fCharWidth - Result mod (fTabWidth * fCharWidth)); + #32..#126, #$00A0: Inc(Result, FCharWidth); + else + Break; + end; + Inc(P); + end; + + if P >= PCol then Break; + + // Just in case P is followed by combining characters + if (P > PStart) and not (Word((P-1)^) in [9, 32]) then + begin + Dec(P); + Dec(Result, FCharWidth); + end; + // Measure non-ascii text code points + P2 := P; + while P2 < PEnd do + begin + Inc(P2); + if Word(P2^) in [9, 65..90, 97..122] then Break; + end; + Layout.Create(FTextFormat, P, P2-P, MaxInt, fTextHeight); + if P2 < PCol then + begin + P := P2; + Inc(Result, Round(Layout.TextMetrics.widthIncludingTrailingWhitespace)); + end + else + begin + CheckOSError(Layout.IDW.HitTestTextPosition(PCol - P, False, X, Y, HTM)); + Inc(Result, Round(X)); + Break; + end; end; - Result.Column := Max(1, LeftChar + Round(f)); - Result.Row := Max(1, TopLine + (aY div FTextHeight)); end; -function TCustomSynEdit.PixelsToRowColumn(aX, aY: Integer): TDisplayCoord; +function TCustomSynEdit.RowColumnToPixels(const RowCol: TDisplayCoord): TPoint; +var + S: string; begin - Result.Column := Max(1, LeftChar + ((aX - FGutterWidth - 2) div FCharWidth)); - Result.Row := Max(1, TopLine + (aY div FTextHeight)); + Result.Y := (RowCol.Row - fTopLine) * fTextHeight; + + S := Rows[RowCol.Row]; + if RowCol.Column = 1 then + Result.X := 0 + else if S = '' then + Result.X := (RowCol.Column - 1) * fCharWidth + else if RowCol.Column > S.Length then + Result.X := TextWidth(S) + (RowCol.Column - S.Length - 1) * fCharWidth + else + Result.X := ColumnToPixels(S, RowCol.Column); + Inc(Result.X, fTextOffset); end; -function TCustomSynEdit.RowColumnToPixels(const RowCol: TDisplayCoord): TPoint; +function TCustomSynEdit.ValidTextPos(const S: string; Index: Integer; + Trailing: Boolean): Integer; +var + Layout: TSynTextLayout; + X, Y: single; + P, PStart, PEnd: PChar; + HTM: TDwriteHitTestMetrics; +begin + if not InRange(Index, 2, S.Length) or (Word(S[Index]) in [9, 32..126]) then + Exit(Index); + + PStart := PChar(S); + PEnd := PStart + S.Length - 1; + P := PStart + Index - 1; + + // Include at least one more character before + Dec(P); + while (P > PStart) and not (Word(P^) in [9, 32..126]) do + Dec(P); + PStart := P; + P := PChar(S) + Index - 1; + // Add characters after + while (P < PEnd) and not (Word((P + 1)^) in [9, 32..126]) do + Inc(P); + + Layout.Create(FTextFormat, PStart, P - PStart + 1, MaxInt, fTextHeight); + CheckOSError(Layout.IDW.HitTestTextPosition(PChar(S) + Index - PStart - 1, + False, X, Y, HTM)); + + if Index + PChar(S) - PStart = Integer(HTM.textPosition) + 1 then + Result := Index + else + Result := PStart - PChar(S) + IfThen(Trailing and (HTM.length > 1), + HTM.textPosition + HTM.length + 1, HTM.textPosition + 1); +end; + +function TCustomSynEdit.ValidTextPos(BC: TBufferCoord; + Trailing: Boolean): TBufferCoord; +{ Accounts for surrogate pairs and combining diacritics } begin - Result.X := (RowCol.Column-1) * FCharWidth + FTextOffset; - Result.Y := (RowCol.Row - FTopLine) * FTextHeight; + Result := BC; + if not InRange(BC.Line, 1, Lines.Count) then Exit; + Result.Char := ValidTextPos(Lines[BC.Line - 1], BC.Char, Trailing); end; procedure TCustomSynEdit.ComputeCaret(X, Y: Integer); -//X,Y are pixel coordinates +{ X,Y are pixel coordinates } var - vCaretNearestPos : TDisplayCoord; + CaretNearestPos: TDisplayCoord; begin - vCaretNearestPos := PixelsToNearestRowColumn(X, Y); - vCaretNearestPos.Row := MinMax(vCaretNearestPos.Row, 1, DisplayLineCount); - SetInternalDisplayXY(vCaretNearestPos); + CaretNearestPos := PixelsToNearestRowColumn(X, Y); + DisplayXY := CaretNearestPos; end; procedure TCustomSynEdit.ComputeScroll(X, Y: Integer); -//X,Y are pixel coordinates +{ X,Y are pixel coordinates } var - iScrollBounds: TRect; { relative to the client area } + iScrollBounds: TRect; // relative to the client area + ScrollAreaSize: Integer; +const + ScrollAreaDefaultSize = 4; begin - { don't scroll if dragging text from other control } - if (not MouseCapture) and (not Dragging) then - begin - FScrollTimer.Enabled := False; - Exit; - end; + fScrollDeltaX := 0; + fScrollDeltaY := 0; + + iScrollBounds := Bounds(fGutterWidth, 0, FTextAreaWidth, + fLinesInWindow * fTextHeight); - iScrollBounds := Bounds(FGutterWidth, 0, FCharsInWindow * FCharWidth, - FLinesInWindow * FTextHeight); + ScrollAreaSize := 0; + if sfOleDragSource in fStateFlags then + Inc(ScrollAreaSize, ScrollAreaDefaultSize); if BorderStyle = bsNone then - InflateRect(iScrollBounds, -2, -2); + Inc(ScrollAreaSize, 2); - if X < iScrollBounds.Left then - FScrollDeltaX := (X - iScrollBounds.Left) div FCharWidth - 1 + InflateRect(iScrollBounds, + -MulDiv(ScrollAreaSize, FCurrentPPI, 96), + -MulDiv(ScrollAreaSize, FCurrentPPI, 96)); + + if (X < iScrollBounds.Left) and (LeftChar > 1) then + fScrollDeltaX := (X - iScrollBounds.Left) div fCharWidth - 1 else if X >= iScrollBounds.Right then - FScrollDeltaX := (X - iScrollBounds.Right) div FCharWidth + 1 - else - FScrollDeltaX := 0; + fScrollDeltaX := (X - iScrollBounds.Right) div fCharWidth + 1; - if Y < iScrollBounds.Top then - fScrollDeltaY := (Y - iScrollBounds.Top) div FTextHeight - 1 + if (Y < iScrollBounds.Top) and (TopLine > 1) then + fScrollDeltaY := (Y - iScrollBounds.Top) div fTextHeight - 1 else if Y >= iScrollBounds.Bottom then - fScrollDeltaY := (Y - iScrollBounds.Bottom) div FTextHeight + 1 - else - fScrollDeltaY := 0; - - FScrollTimer.Enabled := (FScrollDeltaX <> 0) or (fScrollDeltaY <> 0); -end; + fScrollDeltaY := (Y - iScrollBounds.Bottom) div fTextHeight + 1; -procedure TCustomSynEdit.DoCopyToClipboard(const SText: UnicodeString); -var - Mem: HGLOBAL; - P: PByte; - SLen: Integer; -begin - if SText = '' then Exit; - SetClipboardText(SText); - SLen := Length(SText); - // Open and Close are the only TClipboard methods we use because TClipboard - // is very hard (impossible) to work with if you want to put more than one - // format on it at a time. - Clipboard.Open; - try - // Copy it in our custom format so we know what kind of block it is. - // That effects how it is pasted in. - // This format is kept as ANSI to be compatible with programs using the - // ANSI version of Synedit. - Mem := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE, - sizeof(TSynSelectionMode) + SLen + 1); - if Mem <> 0 then - begin - P := GlobalLock(Mem); - try - if P <> nil then - begin - // Our format: TSynSelectionMode value followed by Ansi-text. - PSynSelectionMode(P)^ := FActiveSelectionMode; - Inc(P, SizeOf(TSynSelectionMode)); - Move(PAnsiChar(AnsiString(SText))^, P^, SLen + 1); - SetClipboardData(SynEditClipboardFormat, Mem); - end; - finally - GlobalUnlock(Mem); - end; - end; - // Don't free Mem! It belongs to the clipboard now, and it will free it - // when it is done with it. - finally - Clipboard.Close; - end; + fScrollTimer.Enabled := (fScrollDeltaX <> 0) or (fScrollDeltaY <> 0); end; procedure TCustomSynEdit.CopyToClipboard; -var - SText: UnicodeString; - ChangeTrim: Boolean; begin - if SelAvail then - begin - ChangeTrim := (FActiveSelectionMode = smColumn) and (eoTrimTrailingSpaces in Options); - try - if ChangeTrim then - Exclude(FOptions, eoTrimTrailingSpaces); - SText := SelText; - finally - if ChangeTrim then - Include(FOptions, eoTrimTrailingSpaces); - end; - DoCopyToClipboard(SText); - end; + OleSetClipboard(TSynEditDataObject.Create(Self)); end; procedure TCustomSynEdit.CutToClipboard; begin - if not ReadOnly and SelAvail then + if not ReadOnly then begin BeginUndoBlock; try - DoCopyToClipboard(SelText); - SelText := ''; + CopyToClipboard; + DeleteSelections; finally EndUndoBlock; end; @@ -1396,106 +1463,121 @@ procedure TCustomSynEdit.CutToClipboard; end; constructor TCustomSynEdit.Create(AOwner: TComponent); +var + fFontDummy: TFont; begin inherited Create(AOwner); - FLines := TSynEditStringList.Create(ExpandAtWideGlyphs); - FOrigLines := FLines; - with TSynEditStringList(FLines) do + fLines := TSynEditStringList.Create(TextWidth); + fOrigLines := fLines; + with TSynEditStringList(fLines) do begin OnChange := LinesChanged; OnChanging := LinesChanging; OnCleared := ListCleared; + OnBeforeDeleted := ListBeforeDeleted; OnDeleted := ListDeleted; OnInserted := ListInserted; - OnPutted := ListPutted; + OnPut := ListPut; end; - FFontDummy := TFont.Create; - FUndoList := TSynEditUndoList.Create; - FUndoList.OnAddedUndo := UndoRedoAdded; - FOrigUndoList := FUndoList; - FRedoList := TSynEditUndoList.Create; - FRedoList.OnAddedUndo := UndoRedoAdded; - FOrigRedoList := FRedoList; + fUndoRedo := CreateSynEditUndo(Self); + fUndoRedo.OnModifiedChanged := ModifiedChanged; + fOrigUndoRedo := fUndoRedo; -{$IFDEF SYN_COMPILER_4_UP} DoubleBuffered := False; -{$ENDIF} - FActiveLineColor := clNone; - FSelectedColor := TSynSelectedColor.Create; - FSelectedColor.OnChange := SelectedColorsChanged; - FBookMarkOpt := TSynBookMarkOpt.Create(Self); - FBookMarkOpt.OnChange := BookMarkOptionsChanged; -// FRightEdge has to be set before FontChanged is called for the first time - FRightEdge := 80; - FGutter := TSynGutter.Create; - FGutter.OnChange := GutterChanged; - FGutterWidth := FGutter.Width; - FWordWrapGlyph := TSynGlyph.Create(HINSTANCE, 'SynEditWrapped', clLime); - FWordWrapGlyph.OnChange := WordWrapGlyphChange; - FTextOffset := FGutterWidth + 2; - ControlStyle := ControlStyle + [csOpaque, csSetCaption]; -{$IFDEF SYN_COMPILER_7_UP} - ControlStyle := ControlStyle + [csNeedsBorderPaint]; -{$ENDIF} + fActiveLineColor := clNone; + fSelectedColor := TSynSelectedColor.Create; + fSelectedColor.OnChange := SelectedColorChanged; + FIndentGuides := TSynIndentGuides.Create(Self); + FIndentGuides.OnChange := IndentGuidesChanged; + fBookMarkOpt := TSynBookMarkOpt.Create(Self); + fBookMarkOpt.OnChange := BookMarkOptionsChanged; + fTextMargin := 3; + // fRightEdge has to be set before FontChanged is called for the first time + fRightEdge := 80; + fGutter := TSynGutter.Create(Self); + fGutter.OnChange := GutterChanged; + fWordWrapGlyph := TSynGlyph.Create(HINSTANCE, 'SynEditWrapped'); + fWordWrapGlyph.OnChange := WordWrapGlyphChange; + FIndicators := TSynIndicators.Create(Self); + // Brackets Highlight + FBracketsHighlight := TSynBracketsHighlight.Create(Self); + // Scrollbar Annotations + FScrollbarAnnotations := TSynScrollbarAnnotations.Create(Self, TSynScrollbarAnnItem); + FScrollbarAnnotations.SetDefaultAnnotations; + + ControlStyle := ControlStyle + [csOpaque, csSetCaption, csNeedsBorderPaint, csPannable]; Height := 150; Width := 200; Cursor := crIBeam; Color := clWindow; -{$IFDEF MSWINDOWS} - FFontDummy.Name := 'Courier New'; - FFontDummy.Size := 10; -{$ENDIF} -{$IFDEF SYN_COMPILER_3_UP} - FFontDummy.CharSet := DEFAULT_CHARSET; -{$ENDIF} - FTextDrawer := TSynTextDrawer.Create([fsBold], FFontDummy); - Font.Assign(FFontDummy); + fExtraLineSpacing := 2; + fFontQuality := fqClearTypeNatural; + fFontDummy := TFont.Create; + try + fFontDummy.Name := DefaultFontName; + fFontDummy.Size := 10; + fFontDummy.CharSet := DEFAULT_CHARSET; + fFontDummy.Quality := fFontQuality; + Font.Assign(fFontDummy); + Font.PixelsPerInch := Screen.DefaultPixelsPerInch; + Font.Size := fFontDummy.Size; + finally + fFontDummy.Free; + end; + {$if CompilerVersion >= 36} + Font.IsDPIRelated := True; + {$ifend CompilerVersion >= 36} Font.OnChange := SynFontChanged; ParentFont := False; ParentColor := False; TabStop := True; - FInserting := True; - FMaxScrollWidth := 1024; - FScrollBars := ssBoth; - FBorderStyle := bsSingle; - FHintMode := shmDefault; - FInsertCaret := ctVerticalLine; - FOverwriteCaret := ctBlock; - FSelectionMode := smNormal; - FActiveSelectionMode := smNormal; - FFocusList := TList.Create; - FKbdHandler := TSynEditKbdHandler.Create; - FKeyStrokes := TSynEditKeyStrokes.Create(Self); - FMarkList := TSynEditMarkList.Create(self); - FMarkList.OnChange := MarkListChange; + fInserting := True; + fScrollBars := ssBoth; + fBorderStyle := bsSingle; + fInsertCaret := ctVerticalLine; + fOverwriteCaret := ctBlock; + fFocusList := TList.Create; + fKbdHandler := TSynEditKbdHandler.Create; + fKeystrokes := TSynEditKeyStrokes.Create(Self); + fMarkList := TSynEditMarkList.Create(Self); + fMarkList.OnNotify := MarkListNotify; SetDefaultKeystrokes; - FRightEdgeColor := clSilver; - FWantReturns := True; - FWantTabs := False; - FTabWidth := 8; - FLeftChar := 1; - FTopLine := 1; - FCaretX := 1; - FLastCaretX := 1; - FCaretY := 1; - FBlockBegin.Char := 1; - FBlockBegin.Line := 1; - FBlockEnd := FBlockBegin; - FOptions := SYNEDIT_DEFAULT_OPTIONS; - FScrollTimer := TTimer.Create(Self); - FScrollTimer.Enabled := False; - FScrollTimer.Interval := 100; - FScrollTimer.OnTimer := ScrollTimerHandler; - - FScrollHintColor := clInfoBk; - FScrollHintFormat := shfTopLineOnly; -{$IFDEF SYN_CodeFolding} - FCodeFolding := TSynCodeFolding.Create; - FCodeFolding.OnChange := OnCodeFoldingChange; - FAllFoldRanges := TSynFoldRanges.Create; -{$ENDIF} - + fRightEdgeColor := clSilver; + fWantReturns := True; + fWantTabs := False; + fTabWidth := 8; + fLeftChar := 1; + fTopLine := 1; + FLastPosX := 0; + FCarets := TSynCarets.Create(Canvas); + var BC := BufferCoord(1, 1); + FSelection := TSynSelection.Create(BC, BC, BC); + FSelections := TSynSelections.Create(Self); + FSelections.AddCaret(BC, True); + + fOptions := SYNEDIT_DEFAULT_OPTIONS; + fScrollOptions := SYNEDIT_DEFAULT_SCROLLOPTIONS; + + fScrollTimer := TTimer.Create(Self); + fScrollTimer.Enabled := False; + fScrollTimer.Interval := 100; + fScrollTimer.OnTimer := ScrollTimerHandler; + + fScrollHintColor := clInfoBk; + fScrollHintFormat := shfTopLineOnly; + + FSynEditScrollBars := CreateSynEditScrollBars(Self); + + FDisplayFlowControl := TSynDisplayFlowControl.Create; + +//++ CodeFolding + fCodeFolding := TSynCodeFolding.Create; + fCodeFolding.OnChange := OnCodeFoldingChange; + fAllFoldRanges := TSynFoldRanges.Create; +//-- CodeFolding SynFontChanged(nil); + GutterChanged(nil); // to caclulate fGutterWidth also updates fTextOffset + RegisterCommandHandler(InternalCommandHook, nil); end; procedure TCustomSynEdit.CreateParams(var Params: TCreateParams); @@ -1511,81 +1593,47 @@ procedure TCustomSynEdit.CreateParams(var Params: TCreateParams); with Params do begin WindowClass.Style := WindowClass.Style and not ClassStylesOff; - Style := Style or BorderStyles[FBorderStyle] or WS_CLIPCHILDREN; + Style := Style or BorderStyles[fBorderStyle] or WS_CLIPCHILDREN; - if NewStyleControls and Ctl3D and (FBorderStyle = bsSingle) then + if NewStyleControls and Ctl3D and (fBorderStyle = bsSingle) then begin Style := Style and not WS_BORDER; ExStyle := ExStyle or WS_EX_CLIENTEDGE; - // avoid flicker while scrolling or resizing - if not (csDesigning in ComponentState) and CheckWin32Version(5, 1) then - ExStyle := ExStyle or WS_EX_COMPOSITED; end; -{$IFNDEF UNICODE} - if not (csDesigning in ComponentState) then - begin - // Necessary for unicode support, especially IME won't work else - if Win32PlatformIsUnicode then - WindowClass.lpfnWndProc := @DefWindowProcW; - end; -{$ENDIF} end; end; procedure TCustomSynEdit.DecPaintLock; -var - vAuxPos: TDisplayCoord; begin - Assert(FPaintLock > 0); - Dec(FPaintLock); - if (FPaintLock = 0) and HandleAllocated then + Assert(fPaintLock > 0); + Dec(fPaintLock); + if (fPaintLock = 0) and HandleAllocated then begin - if sfScrollbarChanged in FStateFlags then + if (fStatusChanges * [scCaretX, scCaretY, scSelection] <> []) or + (sfCaretChanged in fStateFlags) + then + FSelections.ActiveSelection := FSelection; + if sfScrollbarChanged in fStateFlags then UpdateScrollbars; - // Locks the caret inside the visible area - if WordWrap and ([scCaretX,scCaretY] * FStatusChanges <> []) then - begin - vAuxPos := DisplayXY; - // This may happen in the last row of a line or in rows which length is - // greater than CharsInWindow (Tabs and Spaces are allowed beyond - // CharsInWindow while wrapping the lines) - if (vAuxPos.Column > CharsInWindow +1) and (CharsInWindow > 0) then - begin - if FCaretAtEOL then - FCaretAtEOL := False - else - begin - if scCaretY in FStatusChanges then - begin - vAuxPos.Column := CharsInWindow + 1; - FCaretX := DisplayToBufferPos(vAuxPos).Char; - Include(FStatusChanges,scCaretX); - UpdateLastCaretX; - end; - end; - Include(FStateFlags, sfCaretChanged); - end; - end; - if sfCaretChanged in FStateFlags then - UpdateCaret; - if FStatusChanges <> [] then - DoOnStatusChange(FStatusChanges); + if sfCaretChanged in fStateFlags then + UpdateCarets; + if fStatusChanges <> [] then + DoOnStatusChange(fStatusChanges); end; end; destructor TCustomSynEdit.Destroy; begin Highlighter := nil; - if (FChainedEditor <> nil) or (FLines <> FOrigLines) then + if (fChainedEditor <> nil) or (fLines <> fOrigLines) then RemoveLinesPointer; + UnregisterCommandHandler(InternalCommandHook); inherited Destroy; - // free listeners while other fields are still valid - // do not use FreeAndNil, it first nils and then freey causing problems with - // code accessing FHookedCommandHandlers while destruction + // code accessing fHookedCommandHandlers while destruction FHookedCommandHandlers.Free; FHookedCommandHandlers := nil; // do not use FreeAndNil, it first nils and then frees causing problems with @@ -1593,60 +1641,71 @@ destructor TCustomSynEdit.Destroy; FPlugins.Free; FPlugins := nil; - FMarkList.Free; - FBookMarkOpt.Free; - FKeyStrokes.Free; - FKbdHandler.Free; - FFocusList.Free; - FSelectedColor.Free; - FOrigUndoList.Free; - FOrigRedoList.Free; - FGutter.Free; - FWordWrapGlyph.Free; - FTextDrawer.Free; - FInternalImage.Free; - FFontDummy.Free; - FOrigLines.Free; -{$IFDEF SYN_CodeFolding} + fMarkList.Free; + fBookMarkOpt.Free; + fKeyStrokes.Free; + fKbdHandler.Free; + fFocusList.Free; + fSelectedColor.Free; + FIndentGuides.Free; + fUndoRedo := nil; + fOrigUndoRedo := nil; + fGutter.Free; + fWordWrapGlyph.Free; + FScrollbarAnnotations.Free; + FBracketsHighlight.Free; + FIndicators.Free; + fOrigLines.Free; fCodeFolding.Free; fAllFoldRanges.Free; -{$ENDIF} + FSelections.Free; + FCarets.Free; + FDisplayFlowControl.Free; + Mouse.PanningWindow := nil; end; function TCustomSynEdit.GetBlockBegin: TBufferCoord; +{ Normalizes BlockBegin/End } begin - if (FBlockEnd.Line < FBlockBegin.Line) - or ((FBlockEnd.Line = FBlockBegin.Line) and (FBlockEnd.Char < FBlockBegin.Char)) - then - Result := FBlockEnd - else - Result := FBlockBegin; + Result := FSelection.Normalized.Start; end; function TCustomSynEdit.GetBlockEnd: TBufferCoord; +{ Normalizes BlockBegin/End } begin - if (FBlockEnd.Line < FBlockBegin.Line) - or ((FBlockEnd.Line = FBlockBegin.Line) and (FBlockEnd.Char < FBlockBegin.Char)) - then - Result := FBlockBegin - else - Result := FBlockEnd; + Result := FSelection.Normalized.Stop; end; procedure TCustomSynEdit.SynFontChanged(Sender: TObject); begin - RecalcCharExtent; + Font.OnChange := nil; // avoid recursion + Font.Quality := FontQuality; + + // revert to default font if not monospaced or invalid + if not IsFontMonospacedAndValid(Font) then + Font.Name := DefaultFontName; + Font.OnChange := SynFontChanged; + + // Create DirectWrite text format + FTextFormat.Create(Font, fTabWidth, 0, fExtraLineSpacing); + fTextHeight := FTextFormat.LineHeight; + fCharWidth := FTextFormat.CharWidth; + + // We need to recalculate line widths + TSynEditStringList(fLines).ResetMaxWidth; + if fGutter.ShowLineNumbers and not fGutter.UseFontStyle then + GutterChanged(Self); + + // Invalidate and handle the changes SizeOrFontChanged(True); -end; -function TCustomSynEdit.GetFont: TFont; -begin - Result := inherited Font; + // Used in Zoom + FOrigFontSize := Font.Size; end; -function TCustomSynEdit.GetLineText: UnicodeString; +function TCustomSynEdit.GetLineText: string; begin - if (CaretY >= 1) and (CaretY <= Lines.Count) then + if InRange(CaretY, 1, Lines.Count) then Result := Lines[CaretY - 1] else Result := ''; @@ -1654,44 +1713,19 @@ function TCustomSynEdit.GetLineText: UnicodeString; function TCustomSynEdit.GetSelAvail: Boolean; begin - Result := (FBlockBegin.Char <> FBlockEnd.Char) or - ((FBlockBegin.Line <> FBlockEnd.Line) and (FActiveSelectionMode <> smColumn)); -end; - -function TCustomSynEdit.GetSelTabBlock: Boolean; -begin - Result := (FBlockBegin.Line <> FBlockEnd.Line) and (FActiveSelectionMode <> smColumn); + Result := not FSelection.IsEmpty; end; -function TCustomSynEdit.GetSelTabLine: Boolean; +function TCustomSynEdit.GetSelText: string; begin - Result := (BlockBegin.Char <= 1) and (BlockEnd.Char > length(Lines[CaretY - 1])) and SelAvail; + Result := ''; + if not FSelection.IsEmpty then + Result := SelectionText(FSelection); end; -function TCustomSynEdit.GetSelText: UnicodeString; - - function CopyPadded(const S: UnicodeString; Index, Count: Integer): UnicodeString; - var - SrcLen: Integer; - DstLen: Integer; - i: Integer; - P: PWideChar; - begin - SrcLen := Length(S); - DstLen := Index + Count; - if SrcLen >= DstLen then - Result := Copy(S, Index, Count) - else begin - SetLength(Result, DstLen); - P := PWideChar(Result); - WStrCopy(P, PWideChar(Copy(S, Index, Count))); - Inc(P, Length(S)); - for i := 0 to DstLen - Srclen - 1 do - P[i] := #32; - end; - end; +function TCustomSynEdit.SelectionText(Sel: TSynSelection): string; - procedure CopyAndForward(const S: UnicodeString; Index, Count: Integer; var P: + procedure CopyAndForward(const S: string; Index, Count: Integer; var P: PWideChar); var pSrc: PWideChar; @@ -1710,156 +1744,81 @@ function TCustomSynEdit.GetSelText: UnicodeString; end; end; - function CopyPaddedAndForward(const S: UnicodeString; Index, Count: Integer; - var P: PWideChar): Integer; - var - OldP: PWideChar; - Len, i: Integer; - begin - Result := 0; - OldP := P; - CopyAndForward(S, Index, Count, P); - Len := Count - (P - OldP); - if not (eoTrimTrailingSpaces in Options) then - begin - for i := 0 to Len - 1 do - P[i] := #32; - Inc(P, Len); - end - else - Result := Len; - end; - var First, Last, TotalLen: Integer; ColFrom, ColTo: Integer; I: Integer; - l, r: Integer; - s: UnicodeString; P: PWideChar; - cRow: Integer; - vAuxLineChar: TBufferCoord; - vAuxRowCol: TDisplayCoord; - vTrimCount: Integer; begin - if not SelAvail then + if Sel.IsEmpty then Result := '' else begin - ColFrom := BlockBegin.Char; - First := BlockBegin.Line - 1; + Sel.Normalize; + ColFrom := Sel.Start.Char; + First := Sel.Start.Line - 1; // - ColTo := BlockEnd.Char; - Last := BlockEnd.Line - 1; - // - TotalLen := 0; - case FActiveSelectionMode of - smNormal: - if (First = Last) then - Result := Copy(Lines[First], ColFrom, ColTo - ColFrom) - else begin - // step1: calculate total length of result string - TotalLen := Max(0, Length(Lines[First]) - ColFrom + 1); - for i := First + 1 to Last - 1 do - Inc(TotalLen, Length(Lines[i])); - Inc(TotalLen, ColTo - 1); - Inc(TotalLen, Length(SLineBreak) * (Last - First)); - // step2: build up result string - SetLength(Result, TotalLen); - P := PWideChar(Result); - CopyAndForward(Lines[First], ColFrom, MaxInt, P); - - CopyAndForward(SLineBreak, 1, MaxInt, P); - - for i := First + 1 to Last - 1 do - begin - CopyAndForward(Lines[i], 1, MaxInt, P); - CopyAndForward(SLineBreak, 1, MaxInt, P); - end; - CopyAndForward(Lines[Last], 1, ColTo - 1, P); - end; - smColumn: - begin - with BufferToDisplayPos(BlockBegin) do - begin - First := Row; - ColFrom := Column; - end; - with BufferToDisplayPos(BlockEnd) do - begin - Last := Row; - ColTo := Column; - end; - if ColFrom > ColTo then - SwapInt(ColFrom, ColTo); - // step1: pre-allocate string large enough for worst case - TotalLen := ((ColTo - ColFrom) + Length(sLineBreak)) * - (Last - First +1); - SetLength(Result, TotalLen); - P := PWideChar(Result); - - // step2: copy chunks to the pre-allocated string - TotalLen := 0; - for cRow := First to Last do - begin - vAuxRowCol.Row := cRow; - vAuxRowCol.Column := ColFrom; - vAuxLineChar := DisplayToBufferPos(vAuxRowCol); - l := vAuxLineChar.Char; - s := Lines[vAuxLineChar.Line - 1]; - vAuxRowCol.Column := ColTo; - r := DisplayToBufferPos(vAuxRowCol).Char; - - vTrimCount := CopyPaddedAndForward(s, l, r - l, P); - TotalLen := TotalLen + (r - l) - vTrimCount + Length(sLineBreak); - CopyAndForward(sLineBreak, 1, MaxInt, P); - end; - SetLength(Result, TotalLen - Length(sLineBreak)); - end; - smLine: - begin - // If block selection includes LastLine, - // line break code(s) of the last line will not be added. - // step1: calculate total length of result string - for i := First to Last do - Inc(TotalLen, Length(Lines[i]) + Length(SLineBreak)); - if Last = Lines.Count then - Dec(TotalLen, Length(SLineBreak)); - // step2: build up result string - SetLength(Result, TotalLen); - P := PWideChar(Result); - for i := First to Last - 1 do - begin - CopyAndForward(Lines[i], 1, MaxInt, P); - CopyAndForward(SLineBreak, 1, MaxInt, P); - end; - CopyAndForward(Lines[Last], 1, MaxInt, P); - if (Last + 1) < Lines.Count then - CopyAndForward(SLineBreak, 1, MaxInt, P); - end; + ColTo := Sel.Stop.Char; + Last := Sel.Stop.Line - 1; + + if (First = Last) then + Result := Copy(Lines[First], ColFrom, ColTo - ColFrom) + else begin + // step1: calculate total length of result string + TotalLen := Max(0, Length(Lines[First]) - ColFrom + 1); + for i := First + 1 to Last - 1 do + Inc(TotalLen, Length(Lines[i])); + Inc(TotalLen, ColTo - 1); + Inc(TotalLen, Length(SLineBreak) * (Last - First)); + // step2: build up result string + SetLength(Result, TotalLen); + P := PWideChar(Result); + CopyAndForward(Lines[First], ColFrom, MaxInt, P); + + CopyAndForward(SLineBreak, 1, MaxInt, P); + + for i := First + 1 to Last - 1 do + begin + CopyAndForward(Lines[i], 1, MaxInt, P); + CopyAndForward(SLineBreak, 1, MaxInt, P); + end; + CopyAndForward(Lines[Last], 1, ColTo - 1, P); end; end; end; -function TCustomSynEdit.SynGetText: UnicodeString; +function TCustomSynEdit.SynGetText: string; begin Result := Lines.Text; end; -function TCustomSynEdit.GetWordAtCursor: UnicodeString; +procedure TCustomSynEdit.ForceCaretX(aCaretX: Integer); +{ Can place CaretX beyond the end of line } +var + vRestoreScroll: Boolean; +begin + vRestoreScroll := not (eoScrollPastEol in fScrollOptions); + Include(fScrollOptions, eoScrollPastEol); + try + InternalCaretX := aCaretX; + finally + if vRestoreScroll then + Exclude(fScrollOptions, eoScrollPastEol); + end; +end; + +function TCustomSynEdit.GetWordAtCursor: string; begin - Result := GetWordAtRowCol(CaretXY); + Result:=GetWordAtRowCol(CaretXY); end; -procedure TCustomSynEdit.HideCaret; +procedure TCustomSynEdit.IndentGuidesChanged(Sender: TObject); begin - if sfCaretVisible in FStateFlags then - if Windows.HideCaret(Handle) then - Exclude(FStateFlags, sfCaretVisible); + InvalidateLines(-1, -1); end; procedure TCustomSynEdit.IncPaintLock; begin - Inc(FPaintLock); + Inc(fPaintLock); end; procedure TCustomSynEdit.InvalidateGutter; @@ -1867,6 +1826,19 @@ procedure TCustomSynEdit.InvalidateGutter; InvalidateGutterLines(-1, -1); end; +procedure TCustomSynEdit.InvalidateGutterBand(Kind: TSynGutterBandKind); +var + Band: TSynGutterBand; + Left: Integer; +begin + if not Gutter.Visible then Exit; + Band := Gutter.Band[Kind]; + if not Assigned(Band) or not Band.Visible then Exit; + + Left := Band.LeftX; + InvalidateRect(Rect(Left, 0, Left + Band.RealWidth, ClientHeight) ,False) +end; + procedure TCustomSynEdit.InvalidateGutterLine(aLine: Integer); begin if (aLine < 1) or (aLine > Lines.Count) then @@ -1883,21 +1855,14 @@ procedure TCustomSynEdit.InvalidateGutterLines(FirstLine, LastLine: Integer); if Visible and HandleAllocated then if (FirstLine = -1) and (LastLine = -1) then begin - rcInval := Rect(0, 0, FGutterWidth, ClientHeight); - if sfLinesChanging in FStateFlags then - UnionRect(fInvalidateRect, rcInval, fInvalidateRect) - else - InvalidateRect(rcInval, False); + rcInval := Rect(0, 0, fGutterWidth, ClientHeight); + InvalidateRect(rcInval, False); end else begin { find the visible lines first } if (LastLine < FirstLine) then SwapInt(LastLine, FirstLine); -{$IFDEF SYN_CodeFolding} if UseCodeFolding or WordWrap then -{$ELSE} - if WordWrap then -{$ENDIF} begin FirstLine := LineToRow(FirstLine); if LastLine <= Lines.Count then @@ -1910,12 +1875,9 @@ procedure TCustomSynEdit.InvalidateGutterLines(FirstLine, LastLine: Integer); { any line visible? } if (LastLine >= FirstLine) then begin - rcInval := Rect(0, FTextHeight * (FirstLine - TopLine), - FGutterWidth, FTextHeight * (LastLine - TopLine + 1)); - if sfLinesChanging in FStateFlags then - UnionRect(fInvalidateRect, rcInval, fInvalidateRect) - else - InvalidateRect(rcInval, False); + rcInval := Rect(0, fTextHeight * (FirstLine - TopLine), + fGutterWidth, fTextHeight * (LastLine - TopLine + 1)); + InvalidateRect(rcInval, False); end; end; end; @@ -1929,47 +1891,29 @@ procedure TCustomSynEdit.InvalidateLines(FirstLine, LastLine: Integer); if (FirstLine = -1) and (LastLine = -1) then begin rcInval := ClientRect; - Inc(rcInval.Left, FGutterWidth); - if sfLinesChanging in FStateFlags then -//++ Flicker Reduction - UnionRect(fInvalidateRect, rcInval, fInvalidateRect) -//-- Flicker Reduction - else - InvalidateRect(rcInval, False); + Inc(rcInval.Left, fGutterWidth); + InvalidateRect(rcInval, False); end else begin - FirstLine := Max(FirstLine,1); - LastLine := Max(LastLine,1); + FirstLine := Max(FirstLine, 1); + LastLine := Max(LastLine, 1); { find the visible lines first } if (LastLine < FirstLine) then SwapInt(LastLine, FirstLine); - if LastLine >= Lines.Count then + if LastLine > Lines.Count then LastLine := MaxInt; // paint empty space beyond last line -{$IFDEF SYN_CodeFolding} if UseCodeFolding or WordWrap then begin FirstLine := LineToRow(FirstLine); - // Could avoid this conversion if (First = Last) and - // (Length < CharsInWindow) but the dependency isn't worth IMO. - if LastLine < Lines.Count then begin + if LastLine <= Lines.Count then begin if UseCodeFolding then LastLine := LineToRow(LastLine) else LastLine := LineToRow(LastLine + 1) - 1; end; end; -{$ELSE} - if WordWrap then - begin - FirstLine := LineToRow(FirstLine); - // Could avoid this conversion if (First = Last) and - // (Length < CharsInWindow) but the dependency isn't worth IMO. - if LastLine < Lines.Count then - LastLine := LineToRow(LastLine + 1) - 1; - end; -{$ENDIF} // TopLine is in display coordinates, so FirstLine and LastLine must be // converted previously. @@ -1979,50 +1923,34 @@ procedure TCustomSynEdit.InvalidateLines(FirstLine, LastLine: Integer); { any line visible? } if (LastLine >= FirstLine) then begin - rcInval := Rect(FGutterWidth, FTextHeight * (FirstLine - TopLine), - ClientWidth, FTextHeight * (LastLine - TopLine + 1)); - if sfLinesChanging in FStateFlags then - UnionRect(fInvalidateRect, rcInval, fInvalidateRect) - else - InvalidateRect(rcInval, False); + rcInval := Rect(fGutterWidth, fTextHeight * (FirstLine - TopLine), + ClientWidth, fTextHeight * (LastLine - TopLine + 1)); + InvalidateRect(rcInval, False); end; end; end; procedure TCustomSynEdit.InvalidateSelection; begin - InvalidateLines(BlockBegin.Line, BlockEnd.Line); + InvalidateRange(BlockBegin, BlockEnd); end; -{$IFDEF SYN_COMPILER_5} -function TryStrToInt(const S: string; out Value: Integer): Boolean; -var - E: Integer; +procedure TCustomSynEdit.InvalidateSelection(const Sel: TSynSelection); begin - Val(S, Value, E); - Result := E = 0; + if Sel.IsEmpty then + InvalidateLine(Sel.Caret.Line) + else + InvalidateRange(Sel.Start, Sel.Stop); end; -{$ENDIF} procedure TCustomSynEdit.KeyUp(var Key: Word; Shift: TShiftState); -{$IFDEF SYN_LINUX} -var - Code: Byte; -{$ENDIF} var CharCode: Integer; - KeyMsg: TWMKey; begin - {$IFDEF SYN_LINUX} - // uniform Keycode: key has the same value wether Shift is pressed or not - if Key <= 255 then - begin - Code := XKeysymToKeycode(Xlib.PDisplay(QtDisplay), Key); - Key := XKeycodeToKeysym(Xlib.PDisplay(QtDisplay), Code, 0); - if AnsiChar(Key) in ['a'..'z'] then Key := Ord(UpCase(AnsiChar(Key))); - end; - {$ENDIF} - + { The following allows the entering of Unicode character codes using the + Alt + Numpad numbers combination. When the charcode is less than 256 + this is handled by Windows. + } if (ssAlt in Shift) and (Key >= VK_NUMPAD0) and (Key <= VK_NUMPAD9) then FCharCodeString := FCharCodeString + IntToStr(Key - VK_NUMPAD0); @@ -2031,18 +1959,14 @@ procedure TCustomSynEdit.KeyUp(var Key: Word; Shift: TShiftState); if (FCharCodeString <> '') and TryStrToInt(FCharCodeString, CharCode) and (CharCode >= 256) and (CharCode <= 65535) then begin - KeyMsg.Msg := WM_CHAR; - KeyMsg.CharCode := CharCode; - KeyMsg.Unused := 0; - KeyMsg.KeyData := 0; - DoKeyPressW(KeyMsg); + SendMessage(Handle, WM_CHAR, CharCode, 0); FIgnoreNextChar := True; end; FCharCodeString := ''; end; inherited; - FKbdHandler.ExecuteKeyUp(Self, Key, Shift); + fKbdHandler.ExecuteKeyUp(Self, Key, Shift); end; procedure TCustomSynEdit.KeyDown(var Key: Word; Shift: TShiftState); @@ -2050,21 +1974,9 @@ procedure TCustomSynEdit.KeyDown(var Key: Word; Shift: TShiftState); Data: Pointer; C: WideChar; Cmd: TSynEditorCommand; - {$IFDEF SYN_LINUX} - Code: Byte; - {$ENDIF} begin - {$IFDEF SYN_LINUX} - // uniform Keycode: key has the same value wether Shift is pressed or not - if Key <= 255 then - begin - Code := XKeysymToKeycode(Xlib.PDisplay(QtDisplay), Key); - Key := XKeycodeToKeysym(Xlib.PDisplay(QtDisplay), Code, 0); - if AnsiChar(Key) in ['a'..'z'] then Key := Ord(UpCase(AnsiChar(Key))); - end; - {$ENDIF} inherited; - FKbdHandler.ExecuteKeyDown(Self, Key, Shift); + fKbdHandler.ExecuteKeyDown(Self, Key, Shift); Data := nil; C := #0; @@ -2072,11 +1984,11 @@ procedure TCustomSynEdit.KeyDown(var Key: Word; Shift: TShiftState); Cmd := TranslateKeyCode(Key, Shift, Data); if Cmd <> ecNone then begin Key := 0; // eat it. - Include(FStateFlags, sfIgnoreNextChar); + Include(fStateFlags, sfIgnoreNextChar); CommandProcessor(Cmd, C, Data); end else - Exclude(FStateFlags, sfIgnoreNextChar); + Exclude(fStateFlags, sfIgnoreNextChar); finally if Data <> nil then FreeMem(Data); @@ -2084,24 +1996,21 @@ procedure TCustomSynEdit.KeyDown(var Key: Word; Shift: TShiftState); end; procedure TCustomSynEdit.Loaded; +var + OldUseCodeFolding: Boolean; begin inherited Loaded; + + // See SetUseCodeFolding + OldUseCodeFolding := fUseCodeFolding; + UseCodeFolding := False; + UseCodeFolding := OldUseCodeFolding; + GutterChanged(Self); UpdateScrollBars; end; procedure TCustomSynEdit.KeyPress(var Key: Char); -begin -end; - -type - TAccessWinControl = class(TWinControl); - -{.$MESSAGE 'Check what must be adapted in DoKeyPressW and related methods'} -procedure TCustomSynEdit.DoKeyPressW(var Message: TWMKey); -var - Form: TCustomForm; - Key: WideChar; begin if FIgnoreNextChar then begin @@ -2109,328 +2018,322 @@ procedure TCustomSynEdit.DoKeyPressW(var Message: TWMKey); Exit; end; - Key := WideChar(Message.CharCode); - - Form := GetParentForm(Self); - if (Form <> nil) and (Form <> TWinControl(Self)) and Form.KeyPreview and - (Key <= High(AnsiChar)) and TAccessWinControl(Form).DoKeyPress(Message) - then - Exit; - Key := WideChar(Message.CharCode); - - if (csNoStdEvents in ControlStyle) then Exit; - - if Assigned(FOnKeyPressW) then - FOnKeyPressW(Self, Key); + inherited; // Calls the OnKeyPress event handler if present + if Key = #0 then Exit; - if WideChar(Key) <> #0 then - KeyPressW(Key); -end; - -procedure TCustomSynEdit.KeyPressW(var Key: WideChar); -begin // don't fire the event if key is to be ignored - if not (sfIgnoreNextChar in FStateFlags) then + if not (sfIgnoreNextChar in fStateFlags) then begin - FKbdHandler.ExecuteKeyPress(Self, Key); + fKbdHandler.ExecuteKeyPress(Self, Key); CommandProcessor(ecChar, Key, nil); end else // don't ignore further keys - Exclude(FStateFlags, sfIgnoreNextChar); -end; - -function TCustomSynEdit.LeftSpaces(const Line: UnicodeString): Integer; -begin - Result := LeftSpacesEx(Line, False); -end; - -function TCustomSynEdit.LeftSpacesEx(const Line: UnicodeString; WantTabs: Boolean; CalcAlways : Boolean = False): Integer; -var - p: PWideChar; -begin - p := PWideChar(UnicodeString(Line)); - if Assigned(p) and ((eoAutoIndent in fOptions) or CalcAlways) then - begin - Result := 0; - while (p^ >= #1) and (p^ <= #32) do - begin - if (p^ = #9) and WantTabs then - Inc(Result, TabWidth) - else - Inc(Result); - Inc(p); - end; - end - else - Result := 0; + Exclude(fStateFlags, sfIgnoreNextChar); end; -function TCustomSynEdit.GetLeftSpacing(CharCount: Integer; WantTabs: Boolean): UnicodeString; +function TCustomSynEdit.GetLeftSpacing(CharCount: Integer; WantTabs: Boolean): string; begin if WantTabs and not(eoTabsToSpaces in Options) and (CharCount >= TabWidth) then - Result := UnicodeStringOfChar(#9, CharCount div TabWidth) + - UnicodeStringOfChar(#32, CharCount mod TabWidth) + Result := StringofChar(#9, CharCount div TabWidth) + + StringofChar(#32, CharCount mod TabWidth) else - Result := UnicodeStringOfChar(#32, CharCount); + Result := StringofChar(#32, CharCount); end; procedure TCustomSynEdit.LinesChanging(Sender: TObject); begin - Include(FStateFlags, sfLinesChanging); + Include(fStateFlags, sfLinesChanging); end; procedure TCustomSynEdit.LinesChanged(Sender: TObject); -var - vOldMode: TSynSelectionMode; begin -{$IFDEF SYN_CodeFolding} - if (sfLinesChanging in fStateFlags) and fAllFoldRanges.StopScanning(fLines) then + DoLinesChanged; + + if (sfLinesChanging in fStateFlags) and UseCodeFolding and + fAllFoldRanges.StopScanning(fLines) + then begin - if Assigned(fHighlighter) and (fHighlighter is TSynCustomCodeFoldingHighlighter) then - TSynCustomCodeFoldingHighlighter(fHighlighter).AdjustFoldRanges(AllFoldRanges, - fLines); - InvalidateGutter; - Include(fStateFlags, sfScrollbarChanged); + if FIndentGuides.Visible and FIndentGuides.StructureHighlight and + Assigned(fHighlighter) and (hcStructureHighlight in fHighlighter.Capabilities) + then + InvalidateLines(-1, -1); + InvalidateGutterBand(gbkFold); + UpdateScrollbars; end; -{$ENDIF} - Exclude(FStateFlags, sfLinesChanging); + + Exclude(fStateFlags, sfLinesChanging); if HandleAllocated then begin //++ Flicker Reduction // UpdateScrollBars; //-- Flicker Reduction - vOldMode := FActiveSelectionMode; - SetBlockBegin(CaretXY); - FActiveSelectionMode := vOldMode; - InvalidateRect(FInvalidateRect, False); - FillChar(FInvalidateRect, SizeOf(TRect), 0); - if FGutter.ShowLineNumbers and FGutter.AutoSize then - FGutter.AutoSizeDigitCount(Lines.Count); - if not (eoScrollPastEof in Options) then + //SetBlockBegin(CaretXY); + if not (eoScrollPastEof in ScrollOptions) then TopLine := TopLine; end; + HighlightBrackets; + DoChange; + + if Assigned(FUIAutomationProvider) and UiaClientsAreListening + then + TThread.ForceQueue(nil, procedure + begin + UiaRaiseAutomationEvent(IRawElementProviderSimple(FUIAutomationProvider), + UIA_Text_TextChangedEventId); + end); end; procedure TCustomSynEdit.MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); var bWasSel: Boolean; - bStartDrag: Boolean; - TmpBegin, TmpEnd: TBufferCoord; + P: TPoint; + // Ole drag drop + DragSource: IDropSource; + DataObject: IDataObject; + dwEffect: Integer; begin - TmpBegin := FBlockBegin; - TmpEnd := FBlockEnd; - - bWasSel := False; - bStartDrag := False; - if Button = mbLeft then - begin - if SelAvail then - begin - //remember selection state, as it will be cleared later - bWasSel := True; - FMouseDownX := X; - FMouseDownY := Y; - end; - end; - + // If Button = mbLeft MouseCapture is set by TControl.WMLButtonDown inherited MouseDown(Button, Shift, X, Y); - if (Button = mbLeft) and (ssDouble in Shift) then Exit; - - FKbdHandler.ExecuteMouseDown(Self, Button, Shift, X, Y); + //remember selection state, as it will be cleared later + bWasSel := SelAvail; - if (Button in [mbLeft, mbRight]) then + if (Button = mbLeft) {and ((Shift + [ssDouble]) = [ssLeft, ssDouble])} then begin - if Button = mbRight then - begin - if (eoRightMouseMovesCursor in Options) and - (SelAvail and not IsPointInSelection(DisplayToBufferPos(PixelsToRowColumn(X, Y))) - or not SelAvail) then - begin - InvalidateSelection; - FBlockEnd := FBlockBegin; - ComputeCaret(X, Y); - end - else - Exit; - end + if (FClickCount > 0) + and (Abs(FMouseDown.X - X) < GetSystemMetrics(SM_CXDRAG)) + and (Abs(FMouseDown.Y - Y) < GetSystemMetrics(SM_CYDRAG)) + and (fClickCountTimer.ElapsedMilliseconds < GetDoubleClickTime ) + then + Inc(fClickCount) else - ComputeCaret(X, Y); - end; + fClickCount:= 1; + FMouseDown := Point(X, Y); + if fClickCount = 3 then TripleClick; + if fClickCount = 4 then QuadrupleClick; + fClickCountTimer := TStopWatch.StartNew; + end else + fClickCount := 0; - if Button = mbLeft then + if (Button = mbLeft) and (fClickCount > 1) then begin - //I couldn't track down why, but sometimes (and definately not all the time) - //the block positioning is lost. This makes sure that the block is - //maintained in case they started a drag operation on the block - FBlockBegin := TmpBegin; - FBlockEnd := TmpEnd; - - MouseCapture := True; - //For some reason SynEdit could get to a state where MouseCapture was True - //while just scrolling the window. That resulted in contents being painted - //while vertical scrollbar was moved. To make sure that we paint only when - //a MouseDown has happened inside the SynEdit Window, an extra flag is used. - Include(FStateFlags, sfMouseCaptured); - //if mousedown occurred in selected block begin drag operation - Exclude(FStateFlags, sfWaitForDragging); - if bWasSel and (eoDragDropEditing in FOptions) and (X >= FGutterWidth + 2) - and (SelectionMode = smNormal) and IsPointInSelection(DisplayToBufferPos(PixelsToRowColumn(X, Y))) then - begin - bStartDrag := True - end; + // Deal with overlapping selections + Selections.MouseSelection(FSelection); + Exit; end; - if (Button = mbLeft) and bStartDrag then - Include(FStateFlags, sfWaitForDragging) - else + fKbdHandler.ExecuteMouseDown(Self, Button, Shift, X, Y); + + // Check for drag and drop + if (Button = mbLeft) and (FSelections.Count = 1) then begin - if not (sfDblClicked in FStateFlags) then - begin - if ssShift in Shift then - //BlockBegin and BlockEnd are restored to their original position in the - //code from above and SetBlockEnd will take care of proper invalidation - SetBlockEnd(CaretXY) - else - begin - if (eoAltSetsColumnMode in Options) and (FActiveSelectionMode <> smLine) then + //if mousedown occurred in selected block begin drag operation + if bWasSel and (eoDragDropEditing in fOptions) + and (X >= fGutterWidth + fTextMargin) + and ([ssAlt, ssLeft] * Shift = [ssLeft]) + and IsPointInSelection(DisplayToBufferPos(PixelsToRowColumn(X, Y))) then + begin + if DragDetect(Handle, Point(X,Y)) then begin + DataObject := TSynEditDataObject.Create(Self); + DragSource := TSynDragSource.Create; + try + Include(fStateFlags, sfOleDragSource); + DoDragDrop(DataObject, DragSource, DROPEFFECT_COPY or DROPEFFECT_MOVE, dwEffect); + DataObject := nil; + finally + Exclude(fStateFlags, sfOleDragSource); + if dwEffect = DROPEFFECT_MOVE then + SelText := ''; + end; + Exit; + end else begin + if csLButtonDown in ControlState then begin - if ssAlt in Shift then - SelectionMode := smColumn - else - SelectionMode := smNormal; + GetCursorPos(P); + PostMessage(Handle, WM_LBUTTONUP, 0, PointToLParam(ScreenToClient(P))); end; - //Selection mode must be set before calling SetBlockBegin - SetBlockBegin(CaretXY); end; end; end; - if (X < FGutterWidth) then - Include(FStateFlags, sfPossibleGutterClick); - if (sfPossibleGutterClick in FStateFlags) and (Button = mbRight) then + if (ssDouble in Shift) or (Button = mbMiddle) or ((Button = mbRight) + and (not (eoRightMouseMovesCursor in Options) or (SelAvail and + IsPointInSelection(DisplayToBufferPos(PixelsToRowColumn(X, Y)))))) + then + Exit; + + IncPaintLock; + try + MoveDisplayPosAndSelection(PixelsToNearestRowColumn(X,Y), + [ssAlt, ssShift] * Shift = [ssShift]); + + if [ssAlt, ssShift] * Shift = [ssAlt, ssShift] then + begin + InvalidateSelection(FSelection); + FSelections.ColumnSelection(ColumnSelectionStart, CaretXY, FLastPosX) + end + else if ssAlt in Shift then + FSelections.AddCaret(FSelection.Caret) + else + begin + FSelections.ActiveSelection := FSelection; + FSelections.Clear(ksKeepActive); + end; + finally + DecPaintLock; + end; + + if (X < fGutterWidth) then + Include(fStateFlags, sfPossibleGutterClick); + if (sfPossibleGutterClick in fStateFlags) and (Button = mbRight) then begin DoOnGutterClick(Button, X, Y) end; SetFocus; - Windows.SetFocus(Handle); + Winapi.Windows.SetFocus(Handle); end; procedure TCustomSynEdit.MouseMove(Shift: TShiftState; X, Y: Integer); var - P: TDisplayCoord; + DC: TDisplayCoord; + BC: TBufferCoord; begin inherited MouseMove(Shift, x, y); - if MouseCapture and (sfWaitForDragging in FStateFlags) then - begin - if (Abs(FMouseDownX - X) >= GetSystemMetrics(SM_CXDRAG)) - or (Abs(FMouseDownY - Y) >= GetSystemMetrics(SM_CYDRAG)) then - begin - Exclude(FStateFlags, sfWaitForDragging); - BeginDrag(False); - end; - end - else if (ssLeft in Shift) and MouseCapture and (sfMouseCaptured in FStateFlags) then + if (ssLeft in Shift) and MouseCapture and not IsScrolling then begin // should we begin scrolling? ComputeScroll(X, Y); { compute new caret } - P := PixelsToNearestRowColumn(X, Y); - P.Row := MinMax(P.Row, 1, DisplayLineCount); - if FScrollDeltaX <> 0 then - P.Column := DisplayX; + DC := PixelsToNearestRowColumn(X, Y); + DC.Row := MinMax(DC.Row, 1, DisplayRowCount); + if not (eoScrollPastEol in fScrollOptions) then + DC.Column := MinMax(DC.Column, 1, RowLength[DC.Row] + 1); + if fScrollDeltaX <> 0 then + DC.Column := DisplayX; if fScrollDeltaY <> 0 then - P.Row := DisplayY; - InternalCaretXY := DisplayToBufferPos(P); - BlockEnd := CaretXY; - if (sfPossibleGutterClick in FStateFlags) and (FBlockBegin.Line <> CaretXY.Line) then - Include(FStateFlags, sfGutterDragging); + DC.Row := DisplayY; + BC := DisplayToBufferPos(DC); + + if BC = CaretXY then Exit; // no movement + + if [ssAlt, ssShift] * Shift = [ssAlt, ssShift] then + begin + // Column selection + IncPaintLock; + try + MoveDisplayPosAndSelection(DC, True); + InvalidateSelection(FSelection); + FSelections.ColumnSelection(ColumnSelectionStart, CaretXY, FLastPosX); + finally + DecPaintLock; + end; + end + else + begin + if fClickCount = 2 then + DoMouseSelectWordRange(BC) + else if fClickCount = 3 then + DoMouseSelectLineRange(BC) + else + MoveDisplayPosAndSelection(DC, True); + // Deal with overlapping selections + Selections.MouseSelection(FSelection); + end; + + if (sfPossibleGutterClick in fStateFlags) and (FSelection.Start.Line <> CaretXY.Line) then + Include(fStateFlags, sfGutterDragging); end; end; procedure TCustomSynEdit.ScrollTimerHandler(Sender: TObject); var iMousePos: TPoint; - C: TDisplayCoord; + DC: TDisplayCoord; + BC: TBufferCoord; X, Y: Integer; - vCaret: TBufferCoord; begin GetCursorPos( iMousePos ); iMousePos := ScreenToClient( iMousePos ); - C := PixelsToRowColumn( iMousePos.X, iMousePos.Y ); - C.Row := MinMax(C.Row, 1, DisplayLineCount); - if FScrollDeltaX <> 0 then - begin - LeftChar := LeftChar + FScrollDeltaX; - X := LeftChar; - if FScrollDeltaX > 0 then // scrolling right? - Inc(X, CharsInWindow); - C.Column := X; - end; - if fScrollDeltaY <> 0 then - begin - if GetKeyState(SYNEDIT_SHIFT) < 0 then - TopLine := TopLine + fScrollDeltaY * LinesInWindow - else - TopLine := TopLine + fScrollDeltaY; - Y := TopLine; - if fScrollDeltaY > 0 then // scrolling down? - Inc(Y, LinesInWindow - 1); - C.Row := MinMax(Y, 1, DisplayLineCount); - end; - vCaret := DisplayToBufferPos(C); - if (CaretX <> vCaret.Char) or (CaretY <> vCaret.Line) then - begin - // changes to line / column in one go - IncPaintLock; - try - InternalCaretXY := vCaret; - // if MouseCapture is True we're changing selection. otherwise we're dragging - if MouseCapture and (sfMouseCaptured in FStateFlags) then - SetBlockEnd(CaretXY); - finally - DecPaintLock; + DC := PixelsToRowColumn( iMousePos.X, iMousePos.Y ); + DC.Row := MinMax(DC.Row, 1, DisplayRowCount); + if not (eoScrollPastEol in fScrollOptions) then + DC.Column := MinMax(DC.Column, 1, RowLength[DC.Row] + 1); + + IncPaintLock; + try + if fScrollDeltaX <> 0 then + begin + LeftChar := LeftChar + fScrollDeltaX; + X := LeftChar; + if fScrollDeltaX > 0 then // scrolling right? + Inc(X, FTextAreaWidth div FCharWidth); + DC.Column := X; + end; + if fScrollDeltaY <> 0 then + begin + if GetKeyState(SYNEDIT_SHIFT) < 0 then + Y := TopLine + fScrollDeltaY * LinesInWindow + else + Y := TopLine + fScrollDeltaY; + if fScrollDeltaY > 0 then // scrolling down? + Inc(Y, LinesInWindow - 1); + DC.Row := MinMax(Y, 1, DisplayRowCount); + end; + + BC := DisplayToBufferPos(DC); + if CaretXY <> BC then + begin + if MouseCapture and (fClickCount = 2) then + // Word selection + DoMouseSelectWordRange(BC) + else if MouseCapture and (fClickCount = 3) then + // Line selection + DoMouseSelectLineRange(BC) + else if MouseCapture then + // if MouseCapture is True we are selecting with the mouse + MoveDisplayPosAndSelection(DC, True) + else + // Ole dragging + InternalCaretXY := BC; + + // Deal with overlapping selections + Selections.MouseSelection(FSelection); end; + finally + DecPaintLock; end; + ComputeScroll(iMousePos.x, iMousePos.y); end; procedure TCustomSynEdit.MouseUp(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); -{$IFDEF SYN_CodeFolding} -Var +var + // CodeFolding ptLineCol: TBufferCoord; ptRowCol: TDisplayCoord; Index: Integer; Rect: TRect; -{$ENDIF} begin + // If Button = mbLeft MouseCapture is stopped by TControl.WMLButtonUp inherited MouseUp(Button, Shift, X, Y); - FKbdHandler.ExecuteMouseUp(Self, Button, Shift, X, Y); + fKbdHandler.ExecuteMouseUp(Self, Button, Shift, X, Y); - FScrollTimer.Enabled := False; + fScrollTimer.Enabled := False; if (Button = mbRight) and (Shift = [ssRight]) and Assigned(PopupMenu) then Exit; MouseCapture := False; - Exclude(FStateFlags, sfMouseCaptured); - if (sfPossibleGutterClick in FStateFlags) and (X < FGutterWidth) and (Button <> mbRight) then + if (fStateFlags * [sfPossibleGutterClick, sfGutterDragging] = [sfPossibleGutterClick]) + and (X < fGutterWidth) and (Button <> mbRight) then + begin DoOnGutterClick(Button, X, Y) - else - if FStateFlags * [sfDblClicked, sfWaitForDragging] = [sfWaitForDragging] then - begin - ComputeCaret(X, Y); - if not(ssShift in Shift) then - SetBlockBegin(CaretXY); - SetBlockEnd(CaretXY); - Exclude(FStateFlags, sfWaitForDragging); - end; - Exclude(FStateFlags, sfDblClicked); - Exclude(FStateFlags, sfPossibleGutterClick); - Exclude(FStateFlags, sfGutterDragging); -{$IFDEF SYN_CodeFolding} + end; + Exclude(fStateFlags, sfPossibleGutterClick); + Exclude(fStateFlags, sfGutterDragging); + // CodeFolding ptRowCol := PixelsToRowColumn(X, Y); ptLineCol := DisplayToBufferPos(ptRowCol); @@ -2440,1583 +2343,1105 @@ procedure TCustomSynEdit.MouseUp(Button: TMouseButton; Shift: TShiftState; Rect := GetCollapseMarkRect(ptRowCol.Row, ptLineCol.Line); if PtInRect(Rect, Point(X,Y)) then Uncollapse(Index); - end; -{$ENDIF} + end; end; procedure TCustomSynEdit.DoOnGutterClick(Button: TMouseButton; X, Y: Integer); var - i : Integer; - offs : Integer; - line : Integer; - allmrk: TSynEditMarks; - mark : TSynEditMark; -{$IFDEF SYN_CodeFolding} - Index : integer; + I: Integer; + Offs: Integer; + Line: Integer; + Allmrk: TSynEditMarks; + Mark: TSynEditMark; RowColumn: TDisplayCoord; + Band: TSynGutterBand; begin RowColumn := PixelsToRowColumn(X, Y); Line := RowToLine(RowColumn.Row); - // Check if we clicked on a folding thing - if UseCodeFolding then begin - if AllFoldRanges.FoldStartAtLine(Line, Index) then - begin - // See if we actually clicked on the rectangle... - if PtInRect(GetFoldShapeRect(RowColumn.Row), Point(X, Y)) then begin - if AllFoldRanges.Ranges[Index].Collapsed then - Uncollapse(Index) - else - Collapse(Index); - Exit; - end; - end; - end; -{$ELSE} -begin -{$ENDIF} - if Assigned(FOnGutterClick) then + if Line <= Lines.Count then begin - line := DisplayToBufferPos(PixelsToRowColumn(X,Y)).Line; - if line <= Lines.Count then + Band := FGutter.BandAtX(X); + if Assigned(Band) then + Band.DoClick(Self, Button, X, Y, RowColumn.Row, Line); + if Assigned(fOnGutterClick) then begin - Marks.GetMarksForLine(line, allmrk); - offs := 0; - mark := nil; - for i := 1 to MAX_MARKS do + // Check gutter marks + Marks.GetMarksForLine(Line, Allmrk); + Offs := 0; + Mark := nil; + for I := 1 to MAX_MARKS do begin - if assigned(allmrk[i]) then + if assigned(Allmrk[I]) then begin - Inc(offs, BookMarkOptions.XOffset); - if X < offs then + Inc(Offs, BookMarkOptions.XOffset); + if X < Offs then begin - mark := allmrk[i]; + Mark := Allmrk[I]; Break; end; end; end; //for - FOnGutterClick(Self, Button, X, Y, line, mark); + fOnGutterClick(Self, Button, X, Y, Line, Mark); end; end; end; +procedure TCustomSynEdit.DoOnMouserCursor(const aLineCharPos: TBufferCoord; + var aCursor: TCursor); +begin + if Assigned(fOnMouseCursor) then + fOnMouseCursor(Self, aLineCharPos, aCursor); +end; + procedure TCustomSynEdit.Paint; var rcClip, rcDraw: TRect; - nL1, nL2, nC1, nC2: Integer; + nL1, nL2: Integer; + RT: ID2D1DCRenderTarget; begin // Get the invalidated rect. Compute the invalid area in lines / columns. rcClip := Canvas.ClipRect; - // columns - nC1 := LeftChar; - if (rcClip.Left > FGutterWidth + 2) then - Inc(nC1, (rcClip.Left - FGutterWidth - 2) div CharWidth); - nC2 := LeftChar + - (rcClip.Right - FGutterWidth - 2 + CharWidth - 1) div CharWidth; + if rcClip.IsEmpty then Exit; + // lines - nL1 := Max(TopLine + rcClip.Top div FTextHeight, TopLine); - nL2 := MinMax(TopLine + (rcClip.Bottom + FTextHeight - 1) div FTextHeight, - 1, DisplayLineCount); + nL1 := Max(TopLine + rcClip.Top div fTextHeight, TopLine); + nL2 := MinMax(TopLine + (rcClip.Bottom + fTextHeight - 1) div fTextHeight, + 1, DisplayRowCount); - // Now paint everything while the caret is hidden. - HideCaret; - try - // First paint the gutter area if it was (partly) invalidated. - if (rcClip.Left < FGutterWidth) then - begin - rcDraw := rcClip; - rcDraw.Right := FGutterWidth; - PaintGutter(rcDraw, nL1, nL2); - end; - // Then paint the text area if it was (partly) invalidated. - if (rcClip.Right > FGutterWidth) then - begin - rcDraw := rcClip; - rcDraw.Left := Max(rcDraw.Left, FGutterWidth); - PaintTextLines(rcDraw, nL1, nL2, nC1, nC2); - end; + //Create the RenderTarget + RT := TSynDWrite.RenderTarget; + RT.BindDC(Canvas.Handle, rcClip); + RT.BeginDraw; + RT.SetTransform(TD2DMatrix3X2F.Translation(-rcClip.Left, -rcClip.Top)); - // consider paint lock (inserted by CWBudde, 30th of July 2015) - if PaintLock = 0 then - PluginsAfterPaint(Canvas, rcClip, nL1, nL2); - // If there is a custom paint handler call it. - if PaintLock = 0 then - DoOnPaint; - if PaintLock = 0 then - DoOnPaintTransient(ttAfter); - finally - UpdateCaret; + // First paint the gutter area if it was (partly) invalidated. + if (rcClip.Left < fGutterWidth) then + begin + rcDraw := rcClip; + rcDraw.Right := fGutterWidth; + PaintGutter(RT, rcDraw, nL1, nL2); + end; + + // Then paint the text area if it was (partly) invalidated. + if (rcClip.Right > fGutterWidth) then + begin + rcDraw := rcClip; + rcDraw.Left := Max(rcDraw.Left, fGutterWidth); + PaintTextLines(RT, rcDraw, nL1, nL2); end; + + // If there was a problem rectreate the RenderTarget + if RT.EndDraw <> S_OK then TSynDWrite.ResetRenderTarget; + + PluginsAfterPaint(Canvas, rcClip, nL1, nL2); + + // If there is a custom paint handler call it. + DoOnPaint; end; -procedure TCustomSynEdit.PaintGutter(const AClip: TRect; +procedure TCustomSynEdit.PaintGutter(RT: ID2D1RenderTarget; const AClip: TRect; const aFirstRow, aLastRow: Integer); +var + I, L, W: Integer; + rcBackGround: TRect; + Band: TSynGutterBand; + rcBand: TRect; + EdBkgrColor: TColor; + Attri: TSynHighlighterAttributes; + Brush: ID2D1Brush; + GradientBrush: ID2D1LinearGradientBrush; +begin + // First paint gutter background + W := 0; + for I := 0 to FGutter.Bands.Count - 1 do + begin + Band := FGutter.Bands[I]; + if not Band.Visible then Continue; + if Band.Background = gbbGutter then + Inc(W, FGutter.Bands[I].RealWidth) + else + Break; + end; + rcBackGround := Rect(AClip.Left, AClip.Top, W, AClip.Bottom); - procedure DrawMark(aMark: TSynEditMark; var aGutterOff: Integer; - aMarkRow: Integer); + if fGutter.Gradient then begin - if (not aMark.InternalImage) and Assigned(FBookMarkOpt.BookmarkImages) then - begin - if aMark.ImageIndex <= FBookMarkOpt.BookmarkImages.Count then - begin - if aMark.IsBookmark = BookMarkOptions.DrawBookmarksFirst then - aGutterOff := 0 - else if aGutterOff = 0 then - aGutterOff := FBookMarkOpt.XOffset; - with FBookMarkOpt do - BookmarkImages.Draw(Canvas, LeftMargin + aGutterOff, - (aMarkRow - TopLine) * FTextHeight, aMark.ImageIndex); - Inc(aGutterOff, FBookMarkOpt.XOffset); - end; - end - else begin - if aMark.ImageIndex in [0..9] then - begin - if not Assigned(FInternalImage) then - begin - FInternalImage := TSynInternalImage.Create(HINSTANCE, - 'SynEditInternalImages', 10); -//++ DPI-Aware - if Screen.PixelsPerInch >= 120 then - fInternalImage.ChangeScale(Screen.PixelsPerInch, 96); -//-- DPI-Aware - end; - if aGutterOff = 0 then - begin - FInternalImage.Draw(Canvas, aMark.ImageIndex, - FBookMarkOpt.LeftMargin + aGutterOff, - (aMarkRow - TopLine) * FTextHeight, FTextHeight); - end; - Inc(aGutterOff, FBookMarkOpt.XOffset); - end; - end; + GradientBrush := TSynDWrite.GradientGutterBrush(fGutter.GradientStartColor, + fGutter.GradientEndColor); + GradientBrush.SetEndPoint(Point(W, 0)); + Brush := GradientBrush; + end + else + Brush := TSynDWrite.SolidBrush(fGutter.Color); + RT.FillRectangle(rcBackGround, Brush); + + // Set Brush to Editor Background + EdBkgrColor := Color; + if Highlighter <> nil then + begin + Highlighter.ResetRange; + Highlighter.SetLine('', 1); // Workaround for SynHighlighterWeb + Attri := Highlighter.WhitespaceAttribute; + if (Attri <> nil) and (Attri.Background <> clNone) then + EdBkgrColor := Attri.Background; end; + Brush := TSynDWrite.SolidBrush(EdBkgrColor); - procedure DrawModification(Color: TColor; Top, Bottom: Integer); - var - OldColor: TColor; - OldStyle: TBrushStyle; + L := 0; + for I := 0 to FGutter.Bands.Count - 1 do begin - FTextDrawer.SetBackColor(Color); + Band := FGutter.Bands[I]; + if not Band.Visible then Continue; + W := Band.RealWidth; + if (L > AClip.Right) or (L + W < AClip.Left) then Continue; - OldStyle := Canvas.Brush.Style; - OldColor := Canvas.Brush.Color; + rcBand := Rect(L, AClip.Top, L + W, AClip.Bottom); + if rcBand.IsEmpty then Continue; - Canvas.Brush.Style := bsSolid; - Canvas.Brush.Color := Color; + // Paint Bands with Editor Background + if Band.Background = gbbEditor then + RT.FillRectangle(rcBand, Brush); - Canvas.FillRect(Rect(FGutterWidth - FGutter.RightOffset - FGutter.ModificationBarWidth, Top, - FGutterWidth - FGutter.RightOffset, Bottom)); - - Canvas.Brush.Style := OldStyle; - Canvas.Brush.Color := OldColor; - - FTextDrawer.SetBackColor(FGutter.Color); - end; - -var - cLine: Integer; - cMark: Integer; - rcLine: TRect; - aGutterOffs: PIntArray; - bHasOtherMarks: Boolean; - s: UnicodeString; - vFirstLine: Integer; - vLastLine: Integer; - vMarkRow: Integer; - vGutterRow: Integer; - vLineTop: Integer; - vTextOffset: Integer; - dc: HDC; - TextSize: TSize; -{$IFDEF SYN_CodeFolding} - vLine: Integer; - cRow : Integer; - rcFold: TRect; - x: Integer; - FoldRange: TSynFoldRange; - Index : Integer; -{$ENDIF} -begin - vFirstLine := RowToLine(aFirstRow); - vLastLine := RowToLine(aLastRow); - //todo: Does the following comment still apply? - // Changed to use FTextDrawer.BeginDrawing and FTextDrawer.EndDrawing only - // when absolutely necessary. Note: Never change brush / pen / font of the - // canvas inside of this block (only through methods of FTextDrawer)! - // If we have to draw the line numbers then we don't want to erase - // the background first. Do it line by line with TextRect instead - // and fill only the area after the last visible line. - dc := Canvas.Handle; - - if FGutter.Gradient then - SynDrawGradient(Canvas, FGutter.GradientStartColor, FGutter.GradientEndColor, - FGutter.GradientSteps, Rect(0, 0, FGutterWidth, ClientHeight), True); - - Canvas.Brush.Color := FGutter.Color; - - if FGutter.ShowLineNumbers then - begin - if FGutter.UseFontStyle then - FTextDrawer.SetBaseFont(FGutter.Font) - else - FTextDrawer.Style := []; - FTextDrawer.BeginDrawing(dc); - try - if FGutter.UseFontStyle then - FTextDrawer.SetForeColor(FGutter.Font.Color) - else - FTextDrawer.SetForeColor(Self.Font.Color); - FTextDrawer.SetBackColor(FGutter.Color); + //And now paint the bands + RT.PushAxisAlignedClip(rcBand, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); + Band.PaintLines(RT, rcBand, aFirstRow, aLastRow); + RT.PopAxisAlignedClip; + Inc(L, W); + end; +end; - // prepare the rect initially - rcLine := AClip; - rcLine.Right := Max(rcLine.Right, FGutterWidth - 2); - rcLine.Bottom := rcLine.Top; +procedure TCustomSynEdit.PaintTextLines(RT: ID2D1RenderTarget; AClip: TRect; + const aFirstRow, aLastRow: Integer); +var + LinesRect: TRect; + XRowOffset: Integer; - for cLine := vFirstLine to vLastLine do - begin -{$IFDEF SYN_CodeFolding} - if UseCodeFolding and AllFoldRanges.FoldHidesLine(cLine, Index) then - continue; -{$ENDIF} - vLineTop := (LineToRow(cLine) - TopLine) * FTextHeight; - if WordWrap and not FGutter.Gradient then - begin - // erase space between wrapped lines (from previous line to current one) - rcLine.Top := rcLine.Bottom; - rcLine.Bottom := vLineTop; - with rcLine do - FTextDrawer.ExtTextOut(Left, Top, [tooOpaque], rcLine, '', 0); - end; - // next line rect - rcLine.Top := vLineTop; - rcLine.Bottom := rcLine.Top + FTextHeight; - - s := FGutter.FormatLineNumber(cLine); - if Assigned(OnGutterGetText) then - OnGutterGetText(Self, cLine, s); - TextSize := GetTextSize(DC, PWideChar(s), Length(s)); - vTextOffset := (FGutterWidth - FGutter.RightOffset - FGutter.RightMargin) - TextSize.cx; - if FGutter.ShowModification then - vTextOffset := vTextOffset - FGutter.ModificationBarWidth; - - if FGutter.Gradient then - begin - SetBkMode(DC, TRANSPARENT); - Windows.ExtTextOutW(DC, vTextOffset, - rcLine.Top + ((FTextHeight - Integer(TextSize.cy)) div 2), 0, - @rcLine, PWideChar(s), Length(s), nil); - SetBkMode(DC, OPAQUE); - end - else - Windows.ExtTextOutW(DC, vTextOffset, - rcLine.Top + ((FTextHeight - Integer(TextSize.cy)) div 2), ETO_OPAQUE, - @rcLine, PWideChar(s), Length(s), nil); - - // eventually draw modifications - if FGutter.ShowModification then - case TSynEditStringList(FLines).Modification[cLine - 1] of - smModified: - DrawModification(FGutter.ModificationColorModified, rcLine.Top, rcLine.Bottom); - smSaved: - DrawModification(FGutter.ModificationColorSaved, rcLine.Top, rcLine.Bottom); - end; - end; - // now erase the remaining area if any - if (AClip.Bottom > rcLine.Bottom) and not FGutter.Gradient then + function WhitespaceColor(Bkground: Boolean = True; + ResetHighlighter: Boolean = False): TColor; + var + Attr: TSynHighlighterAttributes; + begin + if Bkground then + Result := Color + else + Result := Font.Color; + if fHighlighter <> nil then + begin + if ResetHighlighter then begin - rcLine.Top := rcLine.Bottom; - rcLine.Bottom := AClip.Bottom; - with rcLine do - FTextDrawer.ExtTextOut(Left, Top, [tooOpaque], rcLine, '', 0); + fHighlighter.ResetRange; + fHighlighter.SetLine('', 1); // workaround for SynHighlighterWeb end; - finally - FTextDrawer.EndDrawing; - if FGutter.UseFontStyle then - FTextDrawer.SetBaseFont(Self.Font); + Attr := Highlighter.WhitespaceAttribute; + if Attr <> nil then + if Bkground and (Attr.Background <> clNone) then + Result := Attr.Background + else if not Bkground and (Attr.Foreground <> clNone) then + Result := Attr.Foreground; end; - end - else + end; + + function IsRowFullySelected(Row: Integer; const RowStart: TBufferCoord): Boolean; + var + RowStop: TBufferCoord; + Index: Integer; + Sel: TSynSelection; begin - if not FGutter.Gradient then - Canvas.FillRect(AClip); + if (eoNoSelection in FOptions) or (not Focused and FHideSelection) then + Exit(False); - if FGutter.ShowModification then - for cLine := vFirstLine to vLastLine do - begin - vLineTop := (LineToRow(cLine) - TopLine) * FTextHeight; - case TSynEditStringList(FLines).Modification[cLine - 1] of - smModified: - DrawModification(FGutter.ModificationColorModified, vLineTop, vLineTop + fTextHeight); - smSaved: - DrawModification(FGutter.ModificationColorSaved, vLineTop, vLineTop + fTextHeight); - end; - end; - end; + if not FSelections.FindSelection(RowStart, Index) then + Exit(False); -{$IFDEF MSWINDOWS} - // draw Word wrap glyphs transparently over gradient - if FGutter.Gradient then - Canvas.Brush.Style := bsClear; -{$ENDIF} - // paint wrapped line glyphs - if WordWrap and FWordWrapGlyph.Visible then - for cLine := aFirstRow to aLastRow do - if LineToRow(RowToLine(cLine)) <> cLine then - FWordWrapGlyph.Draw(Canvas, - (FGutterWidth - FGutter.RightOffset - 2) - FWordWrapGlyph.Width, - (cLine - TopLine) * FTextHeight, FTextHeight); -{$IFDEF MSWINDOWS} - // restore brush - if FGutter.Gradient then - Canvas.Brush.Style := bsSolid; -{$ENDIF} - -{$IFDEF SYN_CodeFolding} - // Draw the folding lines and squares - if UseCodeFolding then begin - for cRow := aFirstRow to aLastRow do begin - vLine := RowToLine(cRow); - if (vLine > Lines.Count) and not (Lines.Count = 0) then - break; - - rcFold := GetFoldShapeRect(cRow); - - Canvas.Pen.Color := fCodeFolding.FolderBarLinesColor; - - // Any fold ranges beginning on this line? - if AllFoldRanges.FoldStartAtLine(vLine, Index) then begin - FoldRange := AllFoldRanges.Ranges[Index]; - Canvas.Brush.Color := fCodeFolding.FolderBarLinesColor; - Canvas.FrameRect(rcFold); - - // Paint minus sign - Canvas.Pen.Color := fCodeFolding.FolderBarLinesColor; - Canvas.MoveTo(rcFold.Left + 2, rcFold.Top + ((rcFold.Bottom - rcFold.Top) div 2)); - Canvas.LineTo(rcFold.Right - 2, rcFold.Top + ((rcFold.Bottom - rcFold.Top) div 2)); - - // Paint vertical line of plus sign - if FoldRange.Collapsed then begin - x := rcFold.Left + ((rcFold.Right - rcFold.Left) div 2); - Canvas.MoveTo(x, rcFold.Top + 2); - Canvas.LineTo(x, rcFold.Bottom - 2); - end - else - // Draw the bottom part of a line - begin - x := rcFold.Left + ((rcFold.Right - rcFold.Left) div 2); - Canvas.MoveTo(x, rcFold.Bottom); - Canvas.LineTo(x, (cRow - fTopLine + 1) * LineHeight); - end; - end - else begin - // Need to paint a line end? - if AllFoldRanges.FoldEndAtLine(vLine, Index) then begin - x := rcFold.Left + ((rcFold.Right - rcFold.Left) div 2); - Canvas.MoveTo(x, (cRow - fTopLine) * LineHeight); - Canvas.LineTo(x, rcFold.Top + ((rcFold.Bottom - rcFold.Top) div 2)); - Canvas.LineTo(rcFold.Right, rcFold.Top + ((rcFold.Bottom - rcFold.Top) div 2)); - end; - // Need to paint a line? - if AllFoldRanges.FoldAroundLine(vLine, Index) then begin - x := rcFold.Left + ((rcFold.Right - rcFold.Left) div 2); - Canvas.MoveTo(x, (cRow - fTopLine) * LineHeight); - Canvas.LineTo(x, (cRow - fTopLine + 1) * LineHeight); - end; - end; - end; + RowStop := DisplayToBufferPos(DisplayCoord(1, Row + 1)); + Sel := FSelections[Index].Normalized; + Result := Sel.Stop >= RowStop; + if Result and WordWrap and (Sel.Stop = RowStop) and Sel.CaretAtEOL then + Result := False; end; -{$ENDIF} - // the gutter separator if visible - if (FGutter.BorderStyle <> gbsNone) and (AClip.Right >= FGutterWidth - 2) then - with Canvas do + procedure FullRowColors(const RowStart: TBufferCoord; Row, Line: Integer; + var FullRowBG, FullRowFG: TColor; var BGAlpha: TD2D1ColorF); + { Return clNone to do normal processing of text foreground/background color } + var + IsLineSpecial: Boolean; + IsFullySelected: Boolean; + SpecialFG, SpecialBG: TColor; + begin + IsLineSpecial := DoOnSpecialLineColors(Line, SpecialFG, SpecialBG); + IsFullySelected := IsRowFullySelected(Row, RowStart); + + BGAlpha := clNoneF; + if IsFullySelected then begin - Pen.Color := FGutter.BorderColor; - Pen.Width := 1; - with AClip do + if not fSelectedColor.FillWholeLines then + IsFullySelected := False + else if fSelectedColor.Opacity <> 255 then begin - if FGutter.BorderStyle = gbsMiddle then - begin - MoveTo(FGutterWidth - 2, Top); - LineTo(FGutterWidth - 2, Bottom); - Pen.Color := FGutter.Color; - end; - MoveTo(FGutterWidth - 1, Top); - LineTo(FGutterWidth - 1, Bottom); - end; + BGAlpha := D2D1ColorF(fSelectedColor.Background, fSelectedColor.Opacity / 255); + IsFullySelected := False; + end end; - // now the gutter marks - if BookMarkOptions.GlyphsVisible and (Marks.Count > 0) - and (vLastLine >= vFirstLine) then - begin - aGutterOffs := AllocMem((aLastRow - aFirstRow + 1) * SizeOf(Integer)); - try - // Instead of making a two pass loop we look while drawing the bookmarks - // whether there is any other mark to be drawn - bHasOtherMarks := False; - for cMark := 0 to Marks.Count - 1 do with Marks[cMark] do -{$IFDEF SYN_CodeFolding} - if Visible and (Line >= vFirstLine) and (Line <= vLastLine) and (Line <= FLines.Count) - and not (UseCodeFolding and AllFoldRanges.FoldHidesLine(Line, Index)) - then -{$ELSE} - if Visible and (Line >= vFirstLine) and (Line <= vLastLine) then -{$ENDIF} - begin - if IsBookmark <> BookMarkOptions.DrawBookmarksFirst then - bHasOtherMarks := True - else begin - vMarkRow := LineToRow(Line); - if vMarkRow >= aFirstRow then - DrawMark(Marks[cMark], aGutterOffs[vMarkRow - aFirstRow], vMarkRow); - end - end; - if bHasOtherMarks then - for cMark := 0 to Marks.Count - 1 do with Marks[cMark] do - begin - if Visible and (IsBookmark <> BookMarkOptions.DrawBookmarksFirst) -{$IFDEF SYN_CodeFolding} - and (Line >= vFirstLine) and (Line <= vLastLine) and (Line <= FLines.Count) - and not (UseCodeFolding and AllFoldRanges.FoldHidesLine(Line, Index)) then -{$ELSE} - and (Line >= vFirstLine) and (Line <= vLastLine) then -{$ENDIF} - begin - vMarkRow := LineToRow(Line); - if vMarkRow >= aFirstRow then - DrawMark(Marks[cMark], aGutterOffs[vMarkRow - aFirstRow], vMarkRow); - end; - end; - if Assigned(OnGutterPaint) then - for cLine := vFirstLine to vLastLine do - begin - vGutterRow := LineToRow(cLine); - OnGutterPaint(Self, cLine, aGutterOffs[vGutterRow - aFirstRow], - (vGutterRow - TopLine) * LineHeight); - end; - finally - FreeMem(aGutterOffs); - end; - end - else if Assigned(OnGutterPaint) then - begin - for cLine := vFirstLine to vLastLine do + if IsFullySelected and IsLineSpecial then + begin + // Invert the colors as in Delphi + FullRowFG := SpecialBG; + FullRowBG := SpecialFG; + end + else if IsLineSpecial then + begin + FullRowBG := SpecialBG; + if eoSpecialLineDefaultFg in FOptions then + FullRowFG := clNone + else + FullRowFG := SpecialFG; + end + else if IsFullySelected then + begin + FullRowFG := fSelectedColor.Foreground; + FullRowBG := fSelectedColor.Background; + end + else if (ActiveLineColor <> clNone) and FSelections.RowHasCaret(Row, Line) + and FSelections.IsEmpty + then + begin + FullRowFG := clNone; + FullRowBG := ActiveLineColor; + end + else begin - vGutterRow := LineToRow(cLine); - OnGutterPaint(Self, cLine, 0, (vGutterRow - TopLine) * LineHeight); + FullRowFG := clNone; + FullRowBG := clNone; end; end; -end; -// Inserts filling chars into a string containing chars that display as glyphs -// wider than an average glyph. (This is often the case with Asian glyphs, which -// are usually wider than latin glpyhs) -// This is only to simplify paint-operations and has nothing to do with -// multi-byte chars. -function TCustomSynEdit.ExpandAtWideGlyphs(const S: UnicodeString): UnicodeString; -var - i, j, CountOfAvgGlyphs: Integer; -begin - Result := S; - j := 0; - SetLength(Result, Length(S) * 2); // speed improvement - - for i := 1 to Length(S) do + function YRowOffset(const Row: Integer): Integer; begin - Inc(j); - CountOfAvgGlyphs := CeilOfIntDiv(FTextDrawer.TextWidth(S[i]), FCharWidth); - - if j + CountOfAvgGlyphs > Length(Result) then - SetLength(Result, Length(Result) + 128); - - // insert CountOfAvgGlyphs filling chars - while CountOfAvgGlyphs > 1 do - begin - Result[j] := FillerChar; - Inc(j); - Dec(CountOfAvgGlyphs); - end; - - Result[j] := S[i]; + Result := (Row - fTopLine) * fTextHeight; end; - SetLength(Result, j); -end; - -// does the opposite of ExpandAtWideGlyphs -function TCustomSynEdit.ShrinkAtWideGlyphs(const S: UnicodeString; First: Integer; - var CharCount: Integer): UnicodeString; -var - i, j: Integer; -begin - SetLength(Result, Length(S)); + function GetTokenRect(Layout: TSynTextLayout; + const Row , Start, Len: Integer): TRect; + var + X1, Y1, X2, Y2: Single; + HitMetrics: TDwriteHitTestMetrics; + begin + Layout.IDW.HitTestTextPosition(Max(Start - 1, 0), False, X1, Y1, HitMetrics); + Layout.IDW.HitTestTextPosition(Start + Len - 2, True, X2, Y2, HitMetrics); + Result := Rect(fTextOffset + XRowOffset + Round(X1), YRowOffset(Row), + fTextOffset + XRowOffset + Round(X2) + 1, YRowOffset(Row + 1)); + end; - i := First; - j := 0; - while i < First + CharCount do + procedure PaintTokenBackground(Layout: TSynTextLayout; + const Row , Start, Len: Integer; AColor: TD2D1ColorF); begin - Inc(j); - while S[i] = FillerChar do - Inc(i); - Result[j] := S[i]; - Inc(i); - end; - - SetLength(Result, j); - CharCount := j; -end; - -procedure TCustomSynEdit.PaintTextLines(AClip: TRect; const aFirstRow, aLastRow, - FirstCol, LastCol: Integer); -var - bDoRightEdge: Boolean; // right edge - nRightEdge: Integer; - // selection info - bAnySelection: Boolean; // any selection visible? - vSelStart: TDisplayCoord; // start of selected area - vSelEnd: TDisplayCoord; // end of selected area - // info about normal and selected text and background colors - bSpecialLine, bLineSelected, bCurrentLine: Boolean; - colFG, colBG: TColor; - colSelFG, colSelBG: TColor; - // info about selection of the current line - nLineSelStart, nLineSelEnd: Integer; - bComplexLine: Boolean; - // painting the background and the text - rcLine, rcToken: TRect; - TokenAccu: record - // Note: s is not managed as a string, it will only grow!!! - // Never use AppendStr or "+", use Len and MaxLen instead and - // copy the string chars directly. This is for efficiency. - Len, MaxLen, CharsBefore: Integer; - s: UnicodeString; - TabString: UnicodeString; - FG, BG: TColor; - Style: TFontStyles; - end; - dc: HDC; - SynTabGlyphString: UnicodeString; - - vFirstLine: Integer; - vLastLine: Integer; - -{ local procedures } - - function colEditorBG: TColor; + RT.FillRectangle(GetTokenRect(Layout, Row, Start, Len), + TSynDWrite.SolidBrush(AColor)); + end; + + procedure DrawWhitespace(Layout: TSynTextLayout; const Row, Pos: Integer; + Ch: Char; SpecialCharsColor: TColor); var - iAttri: TSynHighlighterAttributes; - begin - if (ActiveLineColor <> clNone) and (bCurrentLine) then - Result := ActiveLineColor - else begin - Result := Color; - if Highlighter <> nil then - begin - iAttri := Highlighter.WhitespaceAttribute; - if (iAttri <> nil) and (iAttri.Background <> clNone) then - Result := iAttri.Background; + WSLayout: TSynTextLayout; + X1, Y1, X2, Y2: Single; + HitMetrics: TDwriteHitTestMetrics; + PrintGlyph: Char; + Alignment: DWRITE_TEXT_ALIGNMENT; + begin + if (Ch = #9) then // Tab + PrintGlyph := SynTabGlyph + else if not Ch.IsControl then + PrintGlyph := SynSpaceGlyph + else + Exit; + Layout.IDW.HitTestTextPosition(Pos-1, False, X1, Y1, HitMetrics); + Layout.IDW.HitTestTextPosition(Pos-1, True, X2, Y2, HitMetrics); + WSLayout.Create(FTextFormat, @PrintGlyph, 1, Abs(Round(X2 - X1)), fTextHeight); + + Alignment := DWRITE_TEXT_ALIGNMENT_CENTER; + if Ch = #9 then + begin + case SynTabAlignment of + taLeftJustify: Alignment := DWRITE_TEXT_ALIGNMENT_LEADING; + taRightJustify: Alignment := DWRITE_TEXT_ALIGNMENT_TRAILING; end; - end; + end + else if Ch <> #32 then + WSLayout.SetFontStyle([TFontStyle.fsUnderline], 1, 1); + + WSLayout.IDW.SetTextAlignment(Alignment); + WSLayout.SetFontColor(SpecialCharsColor, 1, 1); + WSLayout.Draw(RT, FTextOffset + XRowOffset + Round(Min(X1, X2)), YRowOffset(Row), SpecialCharsColor); end; - procedure ComputeSelectionInfo; + procedure DrawStructureHighlight; var - vStart: TBufferCoord; - vEnd: TBufferCoord; - begin - bAnySelection := False; - // Only if selection is visible anyway. - if not HideSelection or Self.Focused then + Row, Line: Integer; + XPos: Integer; + LColor: TColor; + Range: TSynFoldRange; + RangeArr: TArray; + Start, Stop: TPoint; + StrokeStyle: ID2D1StrokeStyle; + Brush: ID2D1SolidColorBrush; + StartRow, EndRow: Integer; + begin + if not Assigned(fHighlighter) then Exit; + if not (fHighlighter.Capabilities >= [hcCodeFolding, hcStructureHighlight]) then Exit; + if not UseCodeFolding or not Assigned(fAllFoldRanges) then Exit; + + if FIndentGuides.Style = igsDotted then + StrokeStyle := TSynDWrite.DottedStrokeStyle + else + StrokeStyle := nil; + + RangeArr := fAllFoldRanges.FoldRangesForTextRange(RowToLine(aFirstRow), RowToLine(aLastRow)); + + RT.SetAntialiasMode(D2D1_ANTIALIAS_MODE_ALIASED); + for Range in RangeArr do begin - bAnySelection := True; - // Get the *real* start of the selected area. - if FBlockBegin.Line < FBlockEnd.Line then - begin - vStart := FBlockBegin; - vEnd := FBlockEnd; - end - else if FBlockBegin.Line > FBlockEnd.Line then - begin - vEnd := FBlockBegin; - vStart := FBlockEnd; - end - else if FBlockBegin.Char <> FBlockEnd.Char then + if Range.Indent <= 0 then Continue; + + XPos := Range.Indent * CharWidth + fTextOffset; + if XPos <= 0 then Continue; + + // Choose LColor and brush + if FIndentGuides.UseStructureColors and + (FIndentGuides.StructureColors.Count > 0) + then + LColor := FIndentGuides.StructureColors[(Range.Indent div fTabWidth) + mod FIndentGuides.StructureColors.Count].Color + else + LColor := FIndentGuides.Color; + Brush := TSynDWrite.SolidBrush(LColor); + + StartRow := Max(aFirstRow, LineToRow(Range.FromLine)); + EndRow := Min(aLastRow, LineToRow(Range.ToLine)); + for Row := StartRow to EndRow do begin - // No selection at all, or it is only on this line. - vStart.Line := FBlockBegin.Line; - vEnd.Line := vStart.Line; - if FBlockBegin.Char < FBlockEnd.Char then + Line := RowToLine(Row); + + Start := TPoint.Create(Xpos, YRowOffset(Row)); + Stop := Start; + Stop.Offset(0, fTextHeight); + + // Paint vertical part + if InRange(Line, Range.FromLine, Range.ToLine) then + //RT.DrawLine(Start, Stop, Brush, FCurrentPPI / 96.0, StrokeStyle); + RT.DrawLine(Start, Stop, Brush, Round(FCurrentPPI / 96), StrokeStyle); + + if Range.FromLine = Line then begin - vStart.Char := FBlockBegin.Char; - vEnd.Char := FBlockEnd.Char; + // Paint top + Start.Offset(0, 1); + Stop := Start; + Stop.Offset(fCharWidth, 0); + RT.DrawLine(Start, Stop, Brush, Round(FCurrentPPI / 96), StrokeStyle); end - else + else if Range.ToLine = Line then begin - vStart.Char := FBlockEnd.Char; - vEnd.Char := FBlockBegin.Char; - end; - end - else - bAnySelection := False; - // If there is any visible selection so far, then test if there is an - // intersection with the area to be painted. - if bAnySelection then - begin - // Don't care if the selection is not visible. - bAnySelection := (vEnd.Line >= vFirstLine) and (vStart.Line <= vLastLine); - if bAnySelection then - begin - // Transform the selection from text space into screen space - vSelStart := BufferToDisplayPos(vStart); - vSelEnd := BufferToDisplayPos(vEnd); - // In the column selection mode sort the begin and end of the selection, - // this makes the painting code simpler. - if (FActiveSelectionMode = smColumn) and (vSelStart.Column > vSelEnd.Column) then - SwapInt(vSelStart.Column, vSelEnd.Column); + // paint bottom + Start.Offset(0, fTextHeight); + Stop := Start; + Stop.Offset(fCharWidth, 0); + RT.DrawLine(Start, Stop, Brush, Round(FCurrentPPI / 96), StrokeStyle); end; end; end; + RT.SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); end; - procedure SetDrawingColors(Selected: Boolean); - begin - with FTextDrawer do - if Selected then - begin - SetBackColor(colSelBG); - SetForeColor(colSelFG); - Canvas.Brush.Color := colSelBG; - end - else begin - SetBackColor(colBG); - SetForeColor(colFG); - Canvas.Brush.Color := colBG; - end; - end; + procedure DrawIndentGuides; + { Only used when WordWrap is False, so rows correspond to full lines } - function ColumnToXValue(Col: Integer): Integer; + function StrIsBlank(S: string): Boolean; + var + I: Integer; + begin + for I := 1 to S.Length do + if not (Word(S[I]) in [9, 32]) then Exit(False); + Result := True; + end; + + var + TabSteps, LineIndent, NonBlankLine, X, Y, Row, Line: Integer; + BMWidth: Integer; + BitmapRT: ID2D1BitmapRenderTarget; + BM: ID2D1Bitmap; + RectF: TRectF; + StrokeStyle: ID2D1StrokeStyle; + BMSize: TD2D1SizeF; begin - Result := FTextOffset + Pred(Col) * FCharWidth; - end; + if UseCodeFolding and + FIndentGuides.StructureHighlight and Assigned(fHighlighter) and + (fHighlighter.Capabilities >= [hcCodeFolding, hcStructureHighlight]) then + begin + DrawStructureHighlight; + Exit; + end; - //todo: Review SpecialChars and HardTabs painting. Token parameter of PaintToken procedure could very probably be passed by reference. + BMWidth := Round(FCurrentPPI / 96) + 2; + BMSize := D2D1SizeF(BMWidth, FTextHeight); - // Note: The PaintToken procedure will take care of invalid parameters - // like empty token rect or invalid indices into TokenLen. - // CharsBefore tells if Token starts at column one or not - procedure PaintToken(Token: UnicodeString; - TokenLen, CharsBefore, First, Last: Integer); - var - Text: UnicodeString; - Counter, nX, nCharsToPaint: Integer; - sTabbedToken: UnicodeString; - DoTabPainting: Boolean; - i, TabStart, TabLen, CountOfAvgGlyphs, VisibleGlyphPart, FillerCount, - NonFillerPos: Integer; - rcTab: TRect; - const - ETOOptions = [tooOpaque, tooClipped]; - begin - sTabbedToken := Token; - DoTabPainting := False; - - Counter := Last - CharsBefore; - while Counter > First - CharsBefore - 1 do - begin - if Length(Token) >= Counter then + if FIndentGuides.Style = igsDotted then + StrokeStyle := TSynDWrite.DottedStrokeStyle + else + StrokeStyle := nil; + + CheckOSError(RT.CreateCompatibleRenderTarget(@BMSize, nil, nil, + D2D1_COMPATIBLE_RENDER_TARGET_OPTIONS_GDI_COMPATIBLE, + BitmapRT)); + BitmapRT.SetAntialiasMode(D2D1_ANTIALIAS_MODE_ALIASED); + BitmapRT.BeginDraw; + BitmapRT.DrawLine(Point(1, 0), Point(1, fTextHeight), + TSynDWrite.SolidBrush(FIndentGuides.Color), + Round(FCurrentPPI / 96), StrokeStyle); + BitmapRT.EndDraw; + CheckOSError(BitmapRT.GetBitmap(BM)); + + + for Row := aFirstRow to aLastRow do begin + Line := RowToLine(Row); + if (Line > Lines.Count) then Break; + // If line is blank get next nonblank line + NonBlankLine := Line; + while (NonBlankLine <= fLines.Count) and + StrIsBlank(fLines[NonBlankLine - 1]) + do + Inc(NonBlankLine); + LineIndent := LeftSpaces(fLines[NonBlankLine - 1], True, FTabWidth); + // Step horizontally + Y := YRowOffset(Row); + TabSteps := TabWidth; + while TabSteps < LineIndent do begin - if FShowSpecChar and (Token[Counter] = #32) then - Token[Counter] := SynSpaceGlyph - else if Token[Counter] = #9 then + X := TabSteps * CharWidth + fTextOffset; + if X >= 0 then begin - Token[Counter] := #32; //Tabs painted differently if necessary - DoTabPainting := FShowSpecChar; + RectF := Rect(X - 1, Y, X + BMWidth - 1, Y + fTextHeight); + // avoid having two consequtive dots + if (FIndentGuides.Style = igsDotted) and Odd(fTextHeight) and + not Odd(Row) + then + RectF.Offset(0, 1); + RT.DrawBitmap(BM, @RectF); end; + Inc(TabSteps, TabWidth); end; - Dec(Counter); end; + end; - if (Last >= First) and (rcToken.Right > rcToken.Left) then - begin - nX := ColumnToXValue(First); - - Dec(First, CharsBefore); - Dec(Last, CharsBefore); + procedure PaintFoldMarks; + var + Row, Line, Y: Integer; + HintRect: TRect; + Layout: TSynTextLayout; + begin + if not fCodeFolding.ShowCollapsedLine and not fCodeFolding.ShowHintMark then + Exit; - if (First > TokenLen) then + for Row := aFirstRow to aLastRow do begin + Line := RowToLine(Row); + if fAllFoldRanges.CollapsedFoldStartAtLine(Line) then begin - nCharsToPaint := 0; - Text := ''; - end - else - begin - FillerCount := 0; - NonFillerPos := First; - while Token[NonFillerPos] = FillerChar do + if fCodeFolding.ShowCollapsedLine then begin - Inc(FillerCount); - Inc(NonFillerPos); + // Get starting and end points + Y := YRowOffset(Row + 1) - 1; + RT.DrawLine(Point(FGutterWidth + TextMargin, Y), + Point(ClientWidth, Y), + TSynDWrite.SolidBrush(fCodeFolding.CollapsedLineColor), + MulDiv(1, FCurrentPPI, 96)); end; - - CountOfAvgGlyphs := CeilOfIntDiv(FTextDrawer.TextWidth(Token[NonFillerPos]) , FCharWidth); - - // first visible part of the glyph (1-based) - // (the glyph is visually sectioned in parts of size FCharWidth) - VisibleGlyphPart := CountOfAvgGlyphs - FillerCount; - - // clip off invisible parts - nX := nX - FCharWidth * (VisibleGlyphPart - 1); - - nCharsToPaint := Min(Last - First + 1, TokenLen - First + 1); - - // clip off partially visible glyphs at line end - if WordWrap then - while nX + FCharWidth * nCharsToPaint > ClientWidth do + end; + if fCodeFolding.ShowHintMark then + begin + HintRect := GetCollapseMarkRect(Row, Line); + if HintRect.IntersectsWith(LinesRect) then begin - Dec(nCharsToPaint); - while (nCharsToPaint > 0) and (Token[First + nCharsToPaint - 1] = FillerChar) do - Dec(nCharsToPaint); + RT.DrawRectangle(HintRect, + TSynDWrite.SolidBrush(fCodeFolding.CollapsedLineColor), + FCurrentPPI/96); + Layout.Create(FTextFormat, PChar(StringOfChar(SynSpaceGlyph, 3)), 3, + HintRect.Width, HintRect.Height); + Layout.IDW.SetTextAlignment(DWRITE_TEXT_ALIGNMENT_CENTER); + Layout.Draw(RT, HintRect.Left, HintRect.Top, + fCodeFolding.CollapsedLineColor); end; + end; + end; + end; - // same as copy(Token, First, nCharsToPaint) and remove filler chars - Text := ShrinkAtWideGlyphs(Token, First, nCharsToPaint); - end; + procedure TextRangeToDisplay(const S: string; out FirstChar, LastChar: Integer); + { + When LeftChar > 1, we try to rended only the text that is visible. This + is particularly important when the edited text contains super long lines. + FirstChar is the first char that should be displayed, which could be + partially visible. The presence of tabs prevents the use of this + optimization. - FTextDrawer.ExtTextOut(nX, rcToken.Top, ETOOptions, rcToken, - PWideChar(Text), nCharsToPaint); + This routine also adjust XRowOffset. - if DoTabPainting then - begin - // fix everything before the FirstChar - for i := 1 to First - 1 do // wipe the text out so we don't - if sTabbedToken[i] = #9 then // count it out of the range - sTabbedToken[i] := #32; // we're looking for - - TabStart := pos(#9, sTabbedToken); - rcTab.Top := rcToken.Top; - rcTab.Bottom := rcToken.Bottom; - while (TabStart > 0) and (TabStart >= First) and (TabStart <= Last) do - begin - TabLen := 1; - while (TabStart + CharsBefore + TabLen - 1) mod FTabWidth <> 0 do Inc(TabLen); - Text := SynTabGlyphString; + Text is painted at fTextOffset + XRowOffset + fTextOffset := fGutterWidth + fTextMargin - (LeftChar - 1) * fCharWidth; + fTextOffset can be negative. + } - nX := ColumnToXValue(CharsBefore + TabStart + (TabLen div 2) - 1); - if TabLen mod 2 = 0 then - nX := nX + (FCharWidth div 2) - else nX := nX + FCharWidth; + var + HasTabs: Boolean; + I: Integer; + begin + if S = '' then + begin + FirstChar := 1; + LastChar := IfThen(FLeftChar = 1, 0, -1); // To display CR; + XRowOffset := 0; + Exit; + end; + FirstChar := PixelsToColumn(PChar(S), S.Length, + (FLeftChar - 1) * FCharWidth + 1, True); + if FirstChar > S.Length then + begin + // nothing to display + FirstChar := 1; + LastChar := -1; + Exit; + end; - rcTab.Left := nX; - rcTab.Right := nX + FTextDrawer.GetCharWidth; + while (FirstChar > 1) and not (Word(S[FirstChar - 1]) in [9, 32..126]) do + Dec(FirstChar); - FTextDrawer.ExtTextOut(nX, rcTab.Top, ETOOptions, rcTab, - PWideChar(Text), 1); + XRowOffset := ColumnToPixels(S, FirstChar); - for i := 0 to TabLen - 1 do //wipe the text out so we don't - sTabbedToken[TabStart + i] := #32; //count it again + LastChar := Min(FirstChar + PixelsToColumn(PChar(S) + FirstChar - 1, + S.Length - FirstChar + 1, ClientWidth - fTextOffset - XRowOffset), + S.Length); + while (LastChar < S.Length) and not (Word(S[LastChar + 1]) in [9, 32..126]) do + Inc(LastChar); - TabStart := pos(#9, sTabbedToken); - end; + // If there are tabs *inside* the displayed range we need to make sure + // they are rendered at the correct place + HasTabs := False; + for I := FirstChar to LastChar do + if S[I] = #9 then + begin + HasTabs := True; + Break; end; - rcToken.Left := rcToken.Right; + if HasTabs and (XRowOffset mod (fTabWidth * fCharWidth) <> 0) then + begin + // Unfortunately this case cannot be readily optimized + FirstChar := 1; + XRowOffset := 0; + end + else begin + // Check for RTL characters which are not safe to optimize + for I := FirstChar to LastChar do + if (S[I] >= #$0590) and (S[I] <= #$08FF) then + begin + FirstChar := 1; + XRowOffset := 0; + Exit; + end; end; end; - procedure AdjustEndRect; - // trick to avoid clipping the last pixels of text in italic, - // see also AdjustLastCharWidth() in TSynTextDrawer.ExtTextOut() - var - LastChar: Cardinal; - NormalCharWidth, RealCharWidth: Integer; - CharInfo: TABC; - tm: TTextMetricA; + function SelEndX(Left, Width: Single; SelLast, I, RangeCount: Integer): Integer; + // Helper that returns the position of the end of partial selection begin - LastChar := Ord(TokenAccu.s[TokenAccu.Len]); - NormalCharWidth := FTextDrawer.TextWidth(WideChar(LastChar)); - RealCharWidth := NormalCharWidth; - if Win32PlatformIsUnicode then + if (SelLast = MaxInt) and (I + 1 = Integer(RangeCount)) then begin - if GetCharABCWidthsW(Canvas.Handle, LastChar, LastChar, CharInfo) then - begin - RealCharWidth := CharInfo.abcA + Integer(CharInfo.abcB); - if CharInfo.abcC >= 0 then - Inc(RealCharWidth, CharInfo.abcC); - end - else if LastChar < Ord(High(AnsiChar)) then - begin - GetTextMetricsA(Canvas.Handle, tm); - RealCharWidth := tm.tmAveCharWidth + tm.tmOverhang; - end; + if fSelectedColor.FillWholeLines then + Result := LinesRect.Right + else if scEOL in FVisibleSpecialChars then + Result := Round(Left + Width) + else + Result := Round(Left + Width) + fCharWidth; end - else if WideChar(LastChar) <= High(AnsiChar) then - begin - if GetCharABCWidths(Canvas.Handle, LastChar, LastChar, CharInfo) then - begin - RealCharWidth := CharInfo.abcA + Integer(CharInfo.abcB); - if CharInfo.abcC >= 0 then - Inc(RealCharWidth, CharInfo.abcC); - end - else if LastChar < Ord(High(AnsiChar)) then - begin - GetTextMetricsA(Canvas.Handle, tm); - RealCharWidth := tm.tmAveCharWidth + tm.tmOverhang; - end; + else + Result := Round(Left + Width); + end; + + type + TPartialSelection = record + First, Last: Integer; + SelBG, SelFG: TColor; end; - if RealCharWidth > NormalCharWidth then - Inc(rcToken.Left, RealCharWidth - NormalCharWidth); - end; + TPartSelArray = TArray; - procedure PaintHighlightToken(bFillToEOL: Boolean); + function PartialSelections(Row, Line: Integer; const RowStart: TBufferCoord): TPartSelArray; var - bComplexToken: Boolean; - nC1, nC2, nC1Sel, nC2Sel: Integer; - bU1, bSel, bU2: Boolean; - nX1, nX2: Integer; - begin - // Compute some helper variables. - nC1 := Max(FirstCol, TokenAccu.CharsBefore + 1); - nC2 := Min(LastCol, TokenAccu.CharsBefore + TokenAccu.Len + 1); - if bComplexLine then - begin - bU1 := (nC1 < nLineSelStart); - bSel := (nC1 < nLineSelEnd) and (nC2 >= nLineSelStart); - bU2 := (nC2 >= nLineSelEnd); - bComplexToken := bSel and (bU1 or bU2); - end - else - begin - bU1 := False; // to shut up Compiler warning Delphi 2 - bSel := bLineSelected; - bU2 := False; // to shut up Compiler warning Delphi 2 - bComplexToken := False; - end; - // Any token chars accumulated? - if (TokenAccu.Len > 0) then + Len: Integer; + + function HavePartialSelection(const Sel: TSynSelection; var PartSel: TPartialSelection): Boolean; + var + BB, BE: TBufferCoord; + FG, BG: TColor; begin - // Initialize the colors and the font style. - if not bSpecialLine then + with Sel.Normalized do begin - colBG := TokenAccu.BG; - colFG := TokenAccu.FG; + BB := Start; + BE := Stop; end; + PartSel.First := 0; + PartSel.Last := 0; + + if BB = BE then Exit(False); - if bSpecialLine and (eoSpecialLineDefaultFg in FOptions) then - colFG := TokenAccu.FG; + Result := + ((Line = BB.Line) and + ((InRange(BB.Char, RowStart.Char, RowStart.Char + Len)) and + not (WordWrap and (BB.Char = RowStart.Char + Len) and + (RowtoLine(Row + 1) = Line) and not Sel.CaretAtEOL))) or + ((Line = BE.Line) and InRange(BE.Char, RowStart.Char + 1, RowStart.Char + Len)); + if not Result then Exit; - FTextDrawer.SetStyle(TokenAccu.Style); - // Paint the chars - if bComplexToken then + if BB >= RowStart then begin - // first unselected part of the token - if bU1 then - begin - SetDrawingColors(False); - rcToken.Right := ColumnToXValue(nLineSelStart); - with TokenAccu do - PaintToken(s, Len, CharsBefore, nC1, nLineSelStart); - end; - // selected part of the token - SetDrawingColors(True); - nC1Sel := Max(nLineSelStart, nC1); - nC2Sel := Min(nLineSelEnd, nC2); - rcToken.Right := ColumnToXValue(nC2Sel); - with TokenAccu do - PaintToken(s, Len, CharsBefore, nC1Sel, nC2Sel); - // second unselected part of the token - if bU2 then - begin - SetDrawingColors(False); - rcToken.Right := ColumnToXValue(nC2); - with TokenAccu do - PaintToken(s, Len, CharsBefore, nLineSelEnd, nC2); - end; + PartSel.First := BB.Char - RowStart.Char + 1; + PartSel.Last := IfThen((BE > BufferCoord(RowStart.Char + Len, RowStart.Line)) or + (WordWrap and (BE = BufferCoord(RowStart.Char + Len, RowStart.Line)) and + (RowtoLine(Row + 1) = Line) and not Sel.CaretAtEOL), MaxInt, BE.Char - RowStart.Char); end else begin - SetDrawingColors(bSel); - rcToken.Right := ColumnToXValue(nC2); - with TokenAccu do - PaintToken(s, Len, CharsBefore, nC1, nC2); + PartSel.First := 1; + PartSel.Last := BE.Char - RowStart.Char; end; - end; - // Fill the background to the end of this line if necessary. - if bFillToEOL and (rcToken.Left < rcLine.Right) then - begin - if not bSpecialLine then colBG := colEditorBG; - if bComplexLine then + if DoOnSpecialLineColors(Line, FG, BG) and (fSelectedColor.Opacity = 255) + then begin - nX1 := ColumnToXValue(nLineSelStart); - nX2 := ColumnToXValue(nLineSelEnd); - if (rcToken.Left < nX1) then - begin - SetDrawingColors(False); - rcToken.Right := nX1; - if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) then - AdjustEndRect; - Canvas.FillRect(rcToken); - rcToken.Left := nX1; - end; - if (rcToken.Left < nX2) then - begin - SetDrawingColors(True); - rcToken.Right := nX2; - if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) then - AdjustEndRect; - Canvas.FillRect(rcToken); - rcToken.Left := nX2; - end; - if (rcToken.Left < rcLine.Right) then - begin - SetDrawingColors(False); - rcToken.Right := rcLine.Right; - if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) then - AdjustEndRect; - Canvas.FillRect(rcToken); - end; + // Invert special colors as in Delphi + PartSel.SelBG := FG; + PartSel.SelFG := BG; end else begin - SetDrawingColors(bLineSelected); - rcToken.Right := rcLine.Right; - if (TokenAccu.Len > 0) and (TokenAccu.Style <> []) then - AdjustEndRect; - Canvas.FillRect(rcToken); - end; + PartSel.SelBG := fSelectedColor.Background; + PartSel.SelFG := fSelectedColor.Foreground; + end end; - end; - // Store the token chars with the attributes in the TokenAccu - // record. This will paint any chars already stored if there is - // a (visible) change in the attributes. - procedure AddHighlightToken(const Token: UnicodeString; - CharsBefore, TokenLen: Integer; - Foreground, Background: TColor; - Style: TFontStyles); var - bCanAppend: Boolean; - bSpacesTest, bIsSpaces: Boolean; - i: Integer; + IsFullySelected: Boolean; + PartSel: TPartialSelection; + SelArray: TSynSelectionArray; + Sel: TSynSelection; + begin + Result := []; + if (eoNoSelection in FOptions) or (not Focused and FHideSelection) then + Exit; - function TokenIsSpaces: Boolean; - var - pTok: PWideChar; + IsFullySelected := IsRowFullySelected(Row, RowStart); + if IsFullySelected then begin - if not bSpacesTest then + if not fSelectedColor.FillWholeLines then begin - bSpacesTest := True; - pTok := PWideChar(Token); - while pTok^ <> #0 do - begin - if pTok^ <> #32 then - Break; - Inc(pTok); - end; - bIsSpaces := pTok^ = #0; - end; - Result := bIsSpaces; + PartSel.First := 1; + PartSel.Last := MaxInt; + PartSel.SelBG := fSelectedColor.Background; + PartSel.SelFG := fSelectedColor.Foreground; + Result := [PartSel]; + end + else + Result := []; + Exit; end; + if WordWrap then + Len := fWordWrapPlugin.RowLength[Row] + else + Len := Lines[Line-1].Length; + + SelArray := FSelections.PartSelectionsForRow(RowStart, + BufferCoord(RowStart.Char + Len, RowStart.Line)); + + for Sel in SelArray do + if HavePartialSelection(Sel, PartSel) then + Result := Result + [PartSel]; + end; + + procedure PaintPartialSelections(const Layout: TSynTextLayout; + ARow, Aline: Integer; const RowStart: TBufferCoord; + FirstChar, LastChar: Integer); + { Paint selection if ARow is partially selected - deals with bidi text + The foreground needs to be set before we render the layout + The background needs to be painted before we render the layout if we + are not blending the selection otherwise after} + var + PartSel: TPartialSelection; + AlphaBlended: Boolean; + BGColor: TD2D1ColorF; + RangeCount: Cardinal; + HMArr: array of TDwriteHitTestMetrics; + Index, I: Integer; + PartSelArr: TPartSelArray; begin - if (Background = clNone) or - ((ActiveLineColor <> clNone) and (bCurrentLine)) then - begin - Background := colEditorBG; - end; - if Foreground = clNone then Foreground := Font.Color; - // Do we have to paint the old chars first, or can we just append? - bCanAppend := False; - bSpacesTest := False; - if (TokenAccu.Len > 0) then + PartSelArr := PartialSelections(ARow, ALine, RowStart); + if Length(PartSelArr) = 0 then Exit; + + for Index := 0 to High(PartSelArr) do begin - // font style must be the same or token is only spaces - if (TokenAccu.Style = Style) - or (not (fsUnderline in Style) and not (fsUnderline in TokenAccu.Style) - and TokenIsSpaces) then + PartSel := PartSelArr[Index]; + if (PartSel.Last < MaxInt) and (PartSel.First > LastChar) then Continue; + + AlphaBlended := fSelectedColor.Opacity <> 255; + if AlphaBlended then + BGColor := D2D1ColorF(fSelectedColor.Background, fSelectedColor.Opacity / 255) + else + BGColor := D2D1ColorF(PartSel.SelBG); + + if (LastChar <= 0) and (PartSel.Last = MaxInt) then + begin + // empty line special case + if fSelectedColor.FillWholeLines then + RT.FillRectangle(Rect(LinesRect.Left, YRowOffset(ARow), + LinesRect.Right, + YRowOffset(ARow + 1)), TSynDWrite.SolidBrush(BGColor)) + else if LeftChar = 1 then + RT.FillRectangle(Rect(LinesRect.Left, YRowOffset(ARow), + LinesRect.Left + fCharWidth, + YRowOffset(ARow + 1)), TSynDWrite.SolidBrush(BGColor)) + end + else if LastChar > 0 then begin - // either special colors or same colors - if (bSpecialLine and not (eoSpecialLineDefaultFg in FOptions)) or bLineSelected or - // background color must be the same and - ((TokenAccu.BG = Background) and - // foreground color must be the same or token is only spaces - ((TokenAccu.FG = Foreground) or TokenIsSpaces)) then + // Adjust for First/LastChar + PartSel.First := Max(PartSel.First - FirstChar + 1, 1); + if PartSel.Last <> MaxInt then + PartSel.Last := PartSel.Last - FirstChar + 1; + // Skip if selection is not visible + if PartSel.Last < 1 then Continue; + + Layout.IDW.HitTestTextRange(PartSel.First - 1, PartSel.Last - PartSel.First + 1, + FTextOffset, YRowOffset(ARow), PDwriteHitTestMetrics(nil)^, 0, RangeCount); + + SetLength(HMArr, RangeCount); + Layout.IDW.HitTestTextRange(PartSel.First - 1, PartSel.Last - PartSel.First + 1, + FTextOffset + XRowOffset, YRowOffset(ARow), HMArr[0], RangeCount, RangeCount); + for I := 0 to RangeCount -1 do begin - bCanAppend := True; + if not AlphaBlended then + Layout.SetFontColor(PartSel.SelFG, HMArr[I].textPosition + 1, HMArr[I].length); + RT.FillRectangle(Rect(Round(HMArr[I].left), YRowOffset(ARow), + SelEndX(HMArr[I].Left, HMArr[I].Width, PartSel.Last, I, RangeCount), + YRowOffset(ARow + 1)), TSynDWrite.SolidBrush(BGColor)); end; end; - // If we can't append it, then we have to paint the old token chars first. - if not bCanAppend then - PaintHighlightToken(False); end; - // Don't use AppendStr because it's more expensive. - if bCanAppend then - begin - if (TokenAccu.Len + TokenLen > TokenAccu.MaxLen) then - begin - TokenAccu.MaxLen := TokenAccu.Len + TokenLen + 32; - SetLength(TokenAccu.s, TokenAccu.MaxLen); - end; - for i := 1 to TokenLen do - TokenAccu.s[TokenAccu.Len + i] := Token[i]; - Inc(TokenAccu.Len, TokenLen); - end - else - begin - TokenAccu.Len := TokenLen; - if (TokenAccu.Len > TokenAccu.MaxLen) then - begin - TokenAccu.MaxLen := TokenAccu.Len + 32; - SetLength(TokenAccu.s, TokenAccu.MaxLen); - end; - for i := 1 to TokenLen do - TokenAccu.s[i] := Token[i]; - TokenAccu.CharsBefore := CharsBefore; - TokenAccu.FG := Foreground; - TokenAccu.BG := Background; - TokenAccu.Style := Style; + end; + +var + Line, Row, CharOffset, I: Integer; + RowStart: TBufferCoord; + LayoutWidth: Integer; + SLine, SRow: string; + FirstChar, LastChar: Integer; + DoWhitespacePainting: Boolean; + Layout: TSynTextLayout; + BGColor, FGColor, SpecialCharsColor: TColor; + TokenPos, TokenLen: Integer; + Attr: TSynHighlighterAttributes; + LineIndicators: TArray; + Indicator: TSynIndicator; + IndicatorSpec: TSynIndicatorSpec; + AColor: TColor; + REdgePos: Integer; + FullRowFG, FullRowBG: TColor; + HintColor: TColor; + BGAlpha: TD2D1ColorF; + FlowControl: TSynFlowControl; +begin + // Paint background + LinesRect := Rect(FGutterWidth, AClip.Top, AClip.Right, AClip.Bottom); + if LinesRect.IsEmpty then Exit; + BGColor := WhitespaceColor(True, True); // Resets highlighter + RT.FillRectangle(LinesRect, TSynDWrite.SolidBrush(BGColor)); + + if (Lines.Count = 0) or ((Lines.Count = 1) and (Lines[0] = '')) then + begin + // TextHint + if FTextHint <> '' then + begin + Layout.Create(FTextFormat, PChar(FTextHint), FTextHint.Length, + ClientWidth - fGutterWidth - fTextMargin, fTextHeight); + + if Assigned(fHighlighter) and + Assigned(fHighlighter.WhitespaceAttribute) and + (fHighlighter.WhitespaceAttribute.Foreground <> clNone) + then + HintColor := fHighlighter.WhitespaceAttribute.Foreground + else + HintColor := clGray; + Layout.Draw(RT, fGutterWidth + fTextMargin, 0, HintColor); end; + // Nothig else to do + Exit end; -{$IFDEF SYN_CodeFolding} - procedure PaintFoldAttributes; - var - i, TabSteps, LineIndent, LastNonBlank, X, Y, cRow, vLine: Integer; - DottedPen, OldPen: HPEN; - DottedPenDesc: LOGBRUSH; - CollapsedTo : integer; - HintRect : TRect; - begin - // Paint indent guides. Use folds to determine indent value of these - // Use a separate loop so we can use a custom pen - if not UseCodeFolding then - Exit; + Inc(LinesRect.Left, FTextMargin); - // Paint indent guides using custom pen - if fCodeFolding.IndentGuides then begin - DottedPenDesc.lbStyle := BS_SOLID; - DottedPenDesc.lbColor := fCodeFolding.IndentGuidesColor; - DottedPen := ExtCreatePen(PS_COSMETIC or PS_ALTERNATE, 1, DottedPenDesc, 0, nil); - try - OldPen := SelectObject(Canvas.Handle, DottedPen); - - // Now loop through all the lines. The indices are valid for Lines. - for cRow := aFirstRow to aLastRow do begin - vLine := RowToLine(cRow); - if (vLine > Lines.Count) and not (Lines.Count = 0) then - break; - - // Set vertical coord - Y := (LineToRow(vLine) - TopLine) * fTextHeight; // limit inside clip rect - if (fTextHeight mod 2 = 1) and (vLine mod 2 = 0) then // even - Inc(Y); - - // Get next nonblank line - LastNonBlank := cRow; - while (RowToLine(LastNonBlank) <= fLines.Count) - and (TrimLeft(fLines[RowToLine(LastNonBlank)-1]) = '') do - Inc(LastNonBlank); - LineIndent := LeftSpacesEx(fLines[RowToLine(LastNonBlank)-1], True, True); - - // Step horizontal coord - TabSteps := TabWidth; - while TabSteps < LineIndent do begin - X := TabSteps * CharWidth + fTextOffset - 2; - if TabSteps >= fLeftChar then begin - // Move to top of vertical line - Canvas.MoveTo(X, Y); - Inc(Y, fTextHeight); - - // Draw down and move back up - Canvas.LineTo(X, Y); - Dec(Y, fTextHeight); - end; - Inc(TabSteps, TabWidth); - end; - end; + RT.PushAxisAlignedClip(LinesRect, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); - // Reset pen - SelectObject(Canvas.Handle, OldPen); - finally - DeleteObject(DottedPen); - end; + for Row:= aFirstRow to aLastRow do + begin + RowStart := DisplayToBufferPos(DisplayCoord(1, Row)); + Line := RowStart.Line; + SLine := Lines[Line - 1]; + + CharOffset := RowStart.Char; + if WordWrap then + SRow := Copy(SLine, CharOffset, fWordWrapPlugin.RowLength[Row]) + else + SRow := SLine; + + // Flow control symbols + FlowControl := fcNone; + if FDisplayFlowControl.Enabled and Assigned(fHighlighter) and + not WordWrap and not (scEOL in FVisibleSpecialChars) + then + begin + FlowControl := fHighlighter.FlowControlAtLine(Lines, Line); + if FlowControl <> fcNone then + SRow := SRow + FlowControlChars[FlowControl]; end; - // Paint collapsed lines using changed pen - if fCodeFolding.ShowCollapsedLine or fCodeFolding.ShowHintMark then begin - Canvas.Pen.Color := fCodeFolding.CollapsedLineColor; + // Restrict the text to what can/should be displayed + TextRangeToDisplay(SRow, FirstChar, LastChar); - CollapsedTo := 0; - for i := 0 to fAllFoldRanges.Count - 1 do begin - with fAllFoldRanges.Ranges[i] do begin - if FromLine > vLastLine then - break; - if Collapsed and (FromLine > CollapsedTo) and (FromLine >= vFirstLine) then - begin - if fCodeFolding.ShowCollapsedLine then - begin - // Get starting and end points - Y := (LineToRow(FromLine) - TopLine + 1) * fTextHeight - 1; - Canvas.MoveTo(AClip.Left, Y); - Canvas.LineTo(AClip.Right, Y); - end; - if fCodeFolding.ShowHintMark then - begin - HintRect := GetCollapseMarkRect(LineToRow(FromLine), FromLine); - if InRange(HintRect.Left, 1, ClientWidth-1) then - begin - fTextDrawer.BeginDrawing(Canvas.Handle); - SetBkMode(Canvas.Handle, TRANSPARENT); - fTextDrawer.SetForeColor(fCodeFolding.CollapsedLineColor); - with HintRect do - ftextDrawer.ExtTextOut(Left + 2 * CharWidth div 7, - Top - LineHeight div 5, [], HintRect, '...', 3); - SetBkMode(Canvas.Handle, OPAQUE); - Canvas.Pen.Width := IfThen(LineHeight > 30, 2, 1); - Canvas.Brush.Style := bsClear; - Inc(HintRect.Top, LineHeight div 7); - Canvas.Rectangle(HintRect); - Canvas.Brush.Style := bsSolid; - Canvas.Pen.Width := 1; - fTextDrawer.EndDrawing; - end; - end; - end; - if Collapsed then - CollapsedTo := Max(CollapsedTo, ToLine); + // Deal with Special Chars + if scControlChars in FVisibleSpecialChars then + // Show Control graphics instead of control chars. + SubstituteControlChars(SRow); + + DoWhitespacePainting := False; + if (scWhitespace in FVisibleSpecialChars) and (LastChar >= 0) then + for I := FirstChar to LastChar do + if IsWhiteChar(SRow[I]) then + begin + DoWhitespacePainting := True; + Break; end; - end; + + if (scEOL in FVisibleSpecialChars) and (LastChar >= 0) and + (CharOffset + LastChar = SLine.Length + 1) and (Line < Lines.Count) then + begin + SRow := SRow + SynLineBreakGlyph; + Inc(LastChar); end; - end; -{$ENDIF} - procedure PaintLines; - var - nLine: Integer; // line index for the loop - cRow: Integer; - sLine: UnicodeString; // the current line (tab expanded) - sLineExpandedAtWideGlyphs: UnicodeString; - sToken: UnicodeString; // highlighter token info - nTokenPos, nTokenLen: Integer; - attr: TSynHighlighterAttributes; - vAuxPos: TDisplayCoord; - vFirstChar: Integer; - vLastChar: Integer; - vStartRow: Integer; - vEndRow: Integer; - TokenFG, TokenBG: TColor; - TokenStyle: TFontStyles; - begin - // Initialize rcLine for drawing. Note that Top and Bottom are updated - // inside the loop. Get only the starting point for this. - rcLine := AClip; - rcLine.Left := FGutterWidth + 2; - rcLine.Bottom := (aFirstRow - TopLine) * FTextHeight; - // Make sure the token accumulator string doesn't get reassigned to often. - if Assigned(FHighlighter) then - begin - TokenAccu.MaxLen := Max(128, FCharsInWindow); - SetLength(TokenAccu.s, TokenAccu.MaxLen); - end; - // Now loop through all the lines. The indices are valid for Lines. - for nLine := vFirstLine to vLastLine do - begin -{$IFDEF SYN_CodeFolding} - if UseCodeFolding and AllFoldRanges.FoldHidesLine(nLine) then - continue; -{$ENDIF} - sLine := TSynEditStringList(Lines).ExpandedStrings[nLine - 1]; - sLineExpandedAtWideGlyphs := ExpandAtWideGlyphs(sLine); - // determine whether will be painted with ActiveLineColor - bCurrentLine := CaretY = nLine; - // Initialize the text and background colors, maybe the line should - // use special values for them. - colFG := Font.Color; - colBG := colEditorBG; - bSpecialLine := DoOnSpecialLineColors(nLine, colFG, colBG); - if bSpecialLine then - begin - // The selection colors are just swapped, like seen in Delphi. - colSelFG := colBG; - colSelBG := colFG; - end - else + // Create the text layout + if LastChar > 0 then + begin + LayoutWidth := ClientWidth - FTextOffset - XRowOffset; + Layout.Create(FTextFormat, PChar(SRow) + FirstChar - 1, + LastChar - FirstChar + 1, LayoutWidth, fTextHeight); + if not (eoShowLigatures in FOptions) or (Line = CaretY) then + // No ligatures for current line + Layout.SetTypography(typNoLigatures, 1, SRow.Length); + end; + + // Special colors, full line selection and ActiveLineColor + FullRowColors(RowStart, Row, Line, FullRowBG, FullRowFG, BGAlpha); + if FullRowBG <> clNone then + RT.FillRectangle(Rect(LinesRect.Left, YRowOffset(Row), LinesRect.Right, + YRowOffset(Row + 1)), TSynDWrite.SolidBrush(FullRowBG)); + + // Highlighted tokens + if fHighlighter <> nil then + begin + // Optimization. In WordWrap mode we carry on where the previous row ended, + // if they are parts of the same line. So, each line is scanned once. + if not WordWrap or (Row = aFirstRow) or (CharOffset = 1) then begin - colSelFG := FSelectedColor.Foreground; - colSelBG := FSelectedColor.Background; + if Line > 1 then + fHighlighter.SetRange(TSynEditStringList(Lines).Ranges[Line - 2]) + else + fHighlighter.ResetRange; + FHighlighter.SetLine(SLine, Line); end; - vStartRow := Max(LineToRow(nLine), aFirstRow); - vEndRow := Min(LineToRow(nLine + 1) - 1, aLastRow); -{$IFDEF SYN_CodeFolding} - vEndRow := Max(vEndRow, vStartRow); -{$ENDIF} - for cRow := vStartRow to vEndRow do + // Whitespace color (returned by GetDefaultAttribute) may differ per line + // Done here so that the highlighter range is set correctly + if (FullRowBG = clNone) then begin + AColor := WhitespaceColor(True); + if (AColor <> clNone) and (AColor <> BGColor) then + RT.FillRectangle(Rect(LinesRect.Left, YRowOffset(Row), LinesRect.Right, + YRowOffset(Row + 1)), TSynDWrite.SolidBrush(AColor)); + end; + + // When you scroll to the right the whole row may be hidden + if (LastChar > 0) then begin - if WordWrap then - begin - vAuxPos.Row := cRow; - if Assigned(FHighlighter) then - vAuxPos.Column := FirstCol - else - // When no highlighter is assigned, we must always start from the - // first char in a row and PaintToken will do the actual clipping - vAuxPos.Column := 1; - vFirstChar := FWordWrapPlugin.DisplayToBufferPos(vAuxPos).Char; - vAuxPos.Column := LastCol; - vLastChar := FWordWrapPlugin.DisplayToBufferPos(vAuxPos).Char; - end - else - begin - vFirstChar := FirstCol; - vLastChar := LastCol; - end; - // Get the information about the line selection. Three different parts - // are possible (unselected before, selected, unselected after), only - // unselected or only selected means bComplexLine will be False. Start - // with no selection, compute based on the visible columns. - bComplexLine := False; - nLineSelStart := 0; - nLineSelEnd := 0; - // Does the selection intersect the visible area? - if bAnySelection and (cRow >= vSelStart.Row) and (cRow <= vSelEnd.Row) then + while not FHighLighter.GetEol do begin - // Default to a fully selected line. This is correct for the smLine - // selection mode and a good start for the smNormal mode. - nLineSelStart := FirstCol; - nLineSelEnd := LastCol + 1; - if (FActiveSelectionMode = smColumn) or - ((FActiveSelectionMode = smNormal) and (cRow = vSelStart.Row)) then - begin - if (vSelStart.Column > LastCol) then - begin - nLineSelStart := 0; - nLineSelEnd := 0; - end - else if (vSelStart.Column > FirstCol) then - begin - nLineSelStart := vSelStart.Column; - bComplexLine := True; - end; - end; - if (FActiveSelectionMode = smColumn) or - ((FActiveSelectionMode = smNormal) and (cRow = vSelEnd.Row)) then + // CharOffset adjusts for wrapped lines and FirstChar for LeftChar > 1 + TokenPos := FHighLighter.GetTokenPos; //TokenPos is zero based + + // Check whether the start of the token is beyond the end of the row + // CharOffset points to the start of the row and LastChar is a row offset + if TokenPos - CharOffset + 2 > LastChar then Break; + + TokenLen := FHighLighter.GetTokenLength; + + // Skip if the whole token is on the left of FirstChar + if TokenPos + TokenLen - CharOffset + 2 <= FirstChar then begin - if (vSelEnd.Column < FirstCol) then - begin - nLineSelStart := 0; - nLineSelEnd := 0; - end - else if (vSelEnd.Column < LastCol) then - begin - nLineSelEnd := vSelEnd.Column; - bComplexLine := True; - end; + fHighlighter.Next; + Continue; end; - end; //endif bAnySelection - // Update the rcLine rect to this line. - rcLine.Top := rcLine.Bottom; - Inc(rcLine.Bottom, FTextHeight); + // We need to display at least part of the token + // Adjust for CharOffset and FirstChar + Dec(TokenLen, Max(0, FirstChar - (TokenPos - CharOffset + 2))); + TokenPos := TokenPos - CharOffset - FirstChar + 3 + + Max(0, FirstChar - (TokenPos - CharOffset + 2)); - bLineSelected := not bComplexLine and (nLineSelStart > 0); - rcToken := rcLine; + Attr := FHighLighter.GetTokenAttribute; - if not Assigned(FHighlighter) or not FHighlighter.Enabled then - begin - // Remove text already displayed (in previous rows) - if (vFirstChar <> FirstCol) or (vLastChar <> LastCol) then - sToken := Copy(sLineExpandedAtWideGlyphs, vFirstChar, vLastChar - vFirstChar) - else - sToken := Copy(sLineExpandedAtWideGlyphs, 1, vLastChar); - if FShowSpecChar and (Length(sLineExpandedAtWideGlyphs) < vLastChar) then - sToken := sToken + SynLineBreakGlyph; - nTokenLen := Length(sToken); - if bComplexLine then + if (TokenLen > 0) and Assigned(Attr) then begin - SetDrawingColors(False); - rcToken.Left := Max(rcLine.Left, ColumnToXValue(FirstCol)); - rcToken.Right := Min(rcLine.Right, ColumnToXValue(nLineSelStart)); - PaintToken(sToken, nTokenLen, 0, FirstCol, nLineSelStart); - rcToken.Left := Max(rcLine.Left, ColumnToXValue(nLineSelEnd)); - rcToken.Right := Min(rcLine.Right, ColumnToXValue(LastCol)); - PaintToken(sToken, nTokenLen, 0, nLineSelEnd, LastCol); - SetDrawingColors(True); - rcToken.Left := Max(rcLine.Left, ColumnToXValue(nLineSelStart)); - rcToken.Right := Min(rcLine.Right, ColumnToXValue(nLineSelEnd)); - PaintToken(sToken, nTokenLen, 0, nLineSelStart, nLineSelEnd - 1); - end - else - begin - SetDrawingColors(bLineSelected); - PaintToken(sToken, nTokenLen, 0, FirstCol, LastCol); + Layout.SetFontStyle(Attr.Style, TokenPos, TokenLen); + AColor := Attr.Foreground; + if (FullRowFG = clNone) and (AColor <> clNone) then + Layout.SetFontColor(AColor, TokenPos, TokenLen); + AColor := Attr.Background; + if (FullRowBG = clNone) and (AColor <> clNone) then + PaintTokenBackground(Layout, Row, TokenPos, TokenLen, D2D1ColorF(AColor)); end; - end - else - begin - // Initialize highlighter with line text and range info. It is - // necessary because we probably did not scan to the end of the last - // line - the internal highlighter range might be wrong. - if nLine = 1 then - FHighlighter.ResetRange + // check whether the whole row has been painted + if TokenPos + TokenLen - 1 > LastChar - FirstChar + 1 then + Break else - FHighlighter.SetRange(TSynEditStringList(Lines).Ranges[nLine - 2]); - FHighlighter.SetLineExpandedAtWideGlyphs(sLine, sLineExpandedAtWideGlyphs, - nLine - 1); - // Try to concatenate as many tokens as possible to minimize the count - // of ExtTextOutW calls necessary. This depends on the selection state - // or the line having special colors. For spaces the foreground color - // is ignored as well. - TokenAccu.Len := 0; - nTokenPos := 0; - nTokenLen := 0; - attr := nil; - // Test first whether anything of this token is visible. - while not FHighlighter.GetEol do - begin - nTokenPos := FHighlighter.GetExpandedTokenPos; - sToken := FHighlighter.GetExpandedToken; - nTokenLen := Length(sToken); - if nTokenPos + nTokenLen >= vFirstChar then - begin - if nTokenPos + nTokenLen > vLastChar then - begin - if nTokenPos > vLastChar then - Break; - if WordWrap then - nTokenLen := vLastChar - nTokenPos - 1 - else - nTokenLen := vLastChar - nTokenPos; - end; - // Remove offset generated by tokens already displayed (in previous rows) - Dec(nTokenPos, vFirstChar - FirstCol); - // It's at least partially visible. Get the token attributes now. - attr := FHighlighter.GetTokenAttribute; - if Assigned(attr) then - begin - TokenFG := attr.Foreground; - TokenBG := attr.Background; - TokenStyle := attr.Style; - end - else - begin - TokenFG := colFG; - TokenBG := colBG; - TokenStyle := Font.Style; - end; - DoOnSpecialTokenAttributes(nLine, nTokenPos, sToken, TokenFG, TokenBG, TokenStyle); - AddHighlightToken(sToken, nTokenPos, nTokenLen, TokenFG, TokenBG, TokenStyle); - end; - // Let the highlighter scan the next token. - FHighlighter.Next; - end; - // Draw anything that's left in the TokenAccu record. Fill to the end - // of the invalid area with the correct colors. - if FShowSpecChar and FHighlighter.GetEol then - begin - if (attr = nil) or (attr <> FHighlighter.CommentAttribute) then - attr := FHighlighter.WhitespaceAttribute; - AddHighlightToken(SynLineBreakGlyph, nTokenPos + nTokenLen, 1, - attr.Foreground, attr.Background, []); - end; - PaintHighlightToken(True); + FHighLighter.Next; end; - // Now paint the right edge if necessary. We do it line by line to reduce - // the flicker. Should not cost very much anyway, compared to the many - // calls to ExtTextOutW. - if bDoRightEdge then - begin - Canvas.MoveTo(nRightEdge, rcLine.Top); - Canvas.LineTo(nRightEdge, rcLine.Bottom + 1); - end; - end; //endfor cRow - bCurrentLine := False; - end; //endfor cLine - end; - -{ end local procedures } - -begin - vFirstLine := RowToLine(aFirstRow); - vLastLine := RowToLine(aLastRow); - - bCurrentLine := False; - // If the right edge is visible and in the invalid area, prepare to paint it. - // Do this first to realize the pen when getting the dc variable. - SynTabGlyphString := SynTabGlyph; - bDoRightEdge := False; - if (FRightEdge > 0) then - begin // column value - nRightEdge := FTextOffset + FRightEdge * FCharWidth; // pixel value - if (nRightEdge >= AClip.Left) and (nRightEdge <= AClip.Right) then - begin - bDoRightEdge := True; - Canvas.Pen.Color := FRightEdgeColor; - Canvas.Pen.Width := 1; - end; - end; - // Do everything else with API calls. This (maybe) realizes the new pen color. - dc := Canvas.Handle; - - // If anything of the two pixel space before the text area is visible, then - // fill it with the component background color. - if (AClip.Left < FGutterWidth + 2) then - begin - rcToken := AClip; - rcToken.Left := Max(AClip.Left, FGutterWidth); - rcToken.Right := FGutterWidth + 2; - // Paint whole left edge of the text with same color. - // (value of WhiteAttribute can vary in e.g. MultiSyn) - if Highlighter <> nil then - Highlighter.ResetRange; - Canvas.Brush.Color := colEditorBG; - Canvas.FillRect(rcToken); - // Adjust the invalid area to not include this area. - AClip.Left := rcToken.Right; - end; - // Paint the visible text lines. To make this easier, compute first the - // necessary information about the selected area: is there any visible - // selected area, and what are its lines / columns? - if (vLastLine >= vFirstLine) then - begin - ComputeSelectionInfo; - FTextDrawer.Style := Font.Style; - FTextDrawer.BeginDrawing(dc); - try - PaintLines; - finally - FTextDrawer.EndDrawing; - end; - end; - // If there is anything visible below the last line, then fill this as well. - rcToken := AClip; - rcToken.Top := (aLastRow - TopLine + 1) * FTextHeight; - if (rcToken.Top < rcToken.Bottom) then - begin - if Highlighter <> nil then - Highlighter.ResetRange; - Canvas.Brush.Color := colEditorBG; - Canvas.FillRect(rcToken); - // Draw the right edge if necessary. - if bDoRightEdge then - begin - Canvas.MoveTo(nRightEdge, rcToken.Top); - Canvas.LineTo(nRightEdge, rcToken.Bottom + 1); + if (scEOL in FVisibleSpecialChars) and (FullRowFG = clNone) and + (CharOffset + LastChar = SLine.Length + 2) and + Assigned(fHighlighter.WhitespaceAttribute) and + (fHighlighter.WhitespaceAttribute.Foreground <> clNone) + then + Layout.SetFontColor(fHighlighter.WhitespaceAttribute.Foreground, LastChar - FirstChar + 1, 1); + + if (FlowControl <> fcNone) and (FullRowFG = clNone) and + (CharOffset + LastChar = SLine.Length + 2) + then + Layout.SetFontColor(FDisplayFlowControl.Color, LastChar - FirstChar + 1, 1); + end; end; - end; - {$IFDEF SYN_CodeFolding} - // This messes with pen colors, so draw after right margin has been drawn - PaintFoldAttributes; -{$ENDIF} -end; + // Paint partial selection if not alpha blending the selection color + if fSelectedColor.Opacity = 255 then + PaintPartialSelections(Layout, Row, Line, RowStart, FirstChar, LastChar); -procedure TCustomSynEdit.PasteFromClipboard; -var - AddPasteEndMarker: Boolean; - vStartOfBlock: TBufferCoord; - vEndOfBlock: TBufferCoord; - StoredPaintLock: Integer; - PasteMode: TSynSelectionMode; - Mem: HGLOBAL; - P: PByte; -begin - if not CanPaste then - Exit; - DoOnPaintTransient(ttBefore); - BeginUndoBlock; - AddPasteEndMarker := False; - PasteMode := SelectionMode; - try - // Check for our special format and read PasteMode. - // The text is ignored as it is ANSI-only to stay compatible with programs - // using the ANSI version of SynEdit. - // - // Instead we take the text stored in CF_UNICODETEXT or CF_TEXT. - if Clipboard.HasFormat(SynEditClipboardFormat) then + // Indicators + LineIndicators := FIndicators.LineIndicators(Line); + if Assigned(FOnGetLineIndicators) then + FOnGetLineIndicators(Self, Line, LineIndicators); + + for Indicator in LineIndicators do begin - Clipboard.Open; - try - Mem := Clipboard.GetAsHandle(SynEditClipboardFormat); - P := GlobalLock(Mem); - try - if P <> nil then - PasteMode := PSynSelectionMode(P)^; - finally - GlobalUnlock(Mem); - end - finally - Clipboard.Close; + TokenPos := Indicator.CharStart - CharOffset - FirstChar + 2; + TokenLen := Indicator.CharEnd - Indicator.CharStart; + if (TokenPos > LastChar - FirstChar + 1) or (TokenPos + TokenLen <= 1) + then + Continue; + + IndicatorSpec := Indicators.GetSpec(Indicator.Id); + if (IndicatorSpec.Style = sisTextDecoration) then + begin + Layout.SetFontStyle(IndicatorSpec.FontStyle, TokenPos, TokenLen); + if TAlphaColorF(IndicatorSpec.Foreground) <> TAlphaColorF(clNoneF) then + Layout.SetFontColor(IndicatorSpec.Foreground, TokenPos, TokenLen); + + // Paint Indicator background before Layout if it is not alpha blended + if SameValue(IndicatorSpec.Background.a, 1) then + PaintTokenBackground(Layout, Row, TokenPos, TokenLen, + IndicatorSpec.Background); end; end; - FUndoList.AddChange(crPasteBegin, BlockBegin, BlockEnd, '', smNormal); - AddPasteEndMarker := True; - if SelAvail then + // Paint the layout + if LastChar > 0 then begin - FUndoList.AddChange(crDelete, FBlockBegin, FBlockEnd, SelText, - FActiveSelectionMode); - end - else - ActiveSelectionMode := SelectionMode; + if FullRowFG = clNone then + FGColor := Font.Color + else + FGColor := FullRowFG; + Layout.Draw(RT, FTextOffset + XRowOffset, YRowOffset(Row), FGColor); + end; - if SelAvail then + // Paint special characters (whitespace) + if DoWhitespacePainting then begin - vStartOfBlock := BlockBegin; - vEndOfBlock := BlockEnd; - FBlockBegin := vStartOfBlock; - FBlockEnd := vEndOfBlock; + if FullRowFG <> clNone then + SpecialCharsColor := FullRowFG + else + SpecialCharsColor := WhitespaceColor(False); - // Pasting always occurs at column 0 when current selection is - // smLine type - if FActiveSelectionMode = smLine then - vStartOfBlock.Char := 1; - end - else - vStartOfBlock := CaretXY; + for I := FirstChar to LastChar do + if IsWhiteChar(SRow[I]) then + begin + if IsPointInSelection(DisplayToBufferPos(DisplayCoord(I, Row))) and + (fSelectedColor.Opacity = 255) + then + DrawWhitespace(Layout, Row, I - FirstChar + 1, SRow[I], fSelectedColor.Foreground) + else + DrawWhitespace(Layout, Row, I - FirstChar + 1, SRow[I], SpecialCharsColor); + end; + end; - Inc(FPaintTransientLock); - SetSelTextPrimitiveEx(PasteMode, PWideChar(GetClipboardText), True); - Dec(FPaintTransientLock); - vEndOfBlock := BlockEnd; - if PasteMode = smNormal then - FUndoList.AddChange(crPaste, vStartOfBlock, vEndOfBlock, SelText, - PasteMode) - else if PasteMode = smColumn then - // Do nothing. Moved to InsertColumn - else if PasteMode = smLine then - if CaretX = 1 then - FUndoList.AddChange(crPaste, BufferCoord(1, vStartOfBlock.Line), - BufferCoord(CharsInWindow, vEndOfBlock.Line - 1), SelText, smLine) - else - FUndoList.AddChange(crPaste, BufferCoord(1, vStartOfBlock.Line), - vEndOfBlock, SelText, smNormal); - finally - if AddPasteEndMarker then - FUndoList.AddChange(crPasteEnd, BlockBegin, BlockEnd, '', smNormal); - EndUndoBlock; - end; + //Draw indentation guides and code folding marks (PaintFoldAttributes) + if FIndentGuides.Visible and not WordWrap then + DrawIndentGuides; + if UseCodeFolding then + PaintFoldMarks; - // ClientRect can be changed by UpdateScrollBars if eoHideShowScrollBars - // is enabled - if eoHideShowScrollBars in Options then - begin - StoredPaintLock := FPaintLock; - try - FPaintLock := 0; - UpdateScrollBars; - finally - FPaintLock := StoredPaintLock; + // Indicators + for Indicator in LineIndicators do + begin + TokenPos := Indicator.CharStart - CharOffset - FirstChar + 2; + TokenLen := Indicator.CharEnd - Indicator.CharStart; + if (TokenPos > LastChar - FirstChar + 1) or (TokenPos + TokenLen <= 1) + then + Continue; + + IndicatorSpec := Indicators.GetSpec(Indicator.Id); + Indicators.Paint(RT, IndicatorSpec, + GetTokenRect(Layout, Row, TokenPos, TokenLen), + IfThen(TokenPos < 1, + TextWidth(Copy(SLine, Indicator.CharStart, 1 - TokenPos)), 0)); + end; + + // Alpha blend - full row selection, or Active line color or Special line + if TAlphaColorF(BGAlpha) <> TAlphaColorF(clNoneF) then + // Full Row + RT.FillRectangle(Rect(LinesRect.Left, YRowOffset(Row), LinesRect.Right, + YRowOffset(Row + 1)), TSynDWrite.SolidBrush(BGAlpha)); + + // Paint partial selection if not alpha blending the selection color + if fSelectedColor.Opacity <> 255 then + PaintPartialSelections(Layout, Row, Line, RowStart, FirstChar, LastChar); + + // Draw right edge + if (fRightEdge > 0) then + begin + REdgePos := fRightEdge * fCharWidth; // pixel value + if InRange(REdgePos + fTextOffset, AClip.Left, AClip.Right) then + RT.DrawLine(Point(FTextOffset + REdgePos, AClip.Top), + Point(FTextOffset + REdgePos, AClip.Bottom), + TSynDWrite.SolidBrush(fRightEdgeColor)); end; end; - EnsureCursorPosVisible; - // Selection should have changed... - StatusChanged([scSelection]); - DoOnPaintTransient(ttAfter); + RT.PopAxisAlignedClip; +end; + +procedure TCustomSynEdit.PasteFromClipboard; +begin + CommandProcessor(ecPaste, ' ', nil); end; procedure TCustomSynEdit.SelectAll; @@ -4030,135 +3455,153 @@ procedure TCustomSynEdit.SelectAll; else LastPt.Line := 1; SetCaretAndSelection(LastPt, BufferCoord(1, 1), LastPt); - // Selection should have changed... - StatusChanged([scSelection]); +end; + +procedure TCustomSynEdit.SelectAllMatchingText; +var + Engine: TSynEditSearchCustom; + SearchOptions: TSynSearchOptions; + Line: Integer; + ResNo: Integer; + SelList: TList; + Sel: TSynSelection; + SelStorage: TSynSelStorage; + LineText: string; + CaretAtStart: Boolean; +begin + if FSelection.IsEmpty then + SetSelWord; + + if (FSelection.IsEmpty) or (FSelection.Start.Line <> FSelection.Stop.Line) then + Exit; // Only match single line text + + Engine := TSynEditSearch.Create(Self); + SelList := TList.Create; + try + SelStorage.BaseIndex := 0; // to avoid compiler warnings + SelStorage.ActiveIndex := 0; + + Engine.Pattern := SelectionText(FSelection); + SearchOptions := []; + if CaseSensitive then + Include(SearchOptions, ssoMatchCase); + if Engine.Pattern = WordAtCursor then + Include(SearchOptions, ssoWholeWord); + CaretAtStart := FSelection.Start > FSelection.Stop; + + Engine.Options := SearchOptions; + + for Line := 0 to Lines.Count - 1 do + begin + LineText := Lines[Line]; + if LineText.Length < Engine.Pattern.Length then Continue; + + Engine.FindAll(LineText); + for ResNo := 0 to Engine.ResultCount - 1 do + begin + if CaretAtStart then + begin + Sel.Stop := BufferCoord(Engine.Results[ResNo], Line + 1); + Sel.Start := BufferCoord(Sel.Stop.Char + Engine.Lengths[ResNo], Line + 1) + end + else + begin + Sel.Start := BufferCoord(Engine.Results[ResNo], Line + 1); + Sel.Stop := BufferCoord(Sel.Start.Char + Engine.Lengths[ResNo], Line + 1) + end; + Sel := TSynSelection.Create(Sel.Stop, Sel.Start, Sel.Stop); + + SelList.Add(Sel); + + if Sel = FSelection then + begin + SelStorage.BaseIndex := SelList.Count - 1; + SelStorage.ActiveIndex := SelList.Count - 1; + end; + end; + end; + + Assert(SelList.Count > 0); + + SelStorage.Selections := SelList.ToArray; + FSelections.Restore(SelStorage); + UpdateScrollbars; + finally + SelList.Free; + Engine.Free; + end; +end; + +function TCustomSynEdit.ValidBC(const Value: TBufferCoord): TBufferCoord; +begin + Result := Value; + Result.Char := Max(Result.Char, 1); + Result.Line := MinMax(Result.Line, 1, Lines.Count); + if Lines.Count > 0 then + Result.Char := Min(Result.Char, Lines[Result.Line - 1].Length + 1) + else + Result.Char := 1; end; procedure TCustomSynEdit.SetBlockBegin(Value: TBufferCoord); +{ Also sets FSelection.Stop to Value! } var - nInval1, nInval2: Integer; SelChanged: Boolean; begin - ActiveSelectionMode := SelectionMode; - if (eoScrollPastEol in Options) and not WordWrap then - Value.Char := MinMax(Value.Char, 1, FMaxScrollWidth + 1) - else - Value.Char := Max(Value.Char, 1); - Value.Line := MinMax(Value.Line, 1, Lines.Count); - if (FActiveSelectionMode = smNormal) then - if (Value.Line >= 1) and (Value.Line <= Lines.Count) then - Value.Char := Min(Value.Char, Length(Lines[Value.Line - 1]) + 1) - else - Value.Char := 1; + Value := ValidBC(Value); + if SelAvail then begin - if FBlockBegin.Line < FBlockEnd.Line then - begin - nInval1 := Min(Value.Line, FBlockBegin.Line); - nInval2 := Max(Value.Line, FBlockEnd.Line); - end - else - begin - nInval1 := Min(Value.Line, FBlockEnd.Line); - nInval2 := Max(Value.Line, FBlockBegin.Line); - end; - FBlockBegin := Value; - FBlockEnd := Value; - InvalidateLines(nInval1, nInval2); + InvalidateSelection; SelChanged := True; end else - begin - SelChanged := - (FBlockBegin.Char <> Value.Char) or (FBlockBegin.Line <> Value.Line) or - (FBlockEnd.Char <> Value.Char) or (FBlockEnd.Line <> Value.Line); - FBlockBegin := Value; - FBlockEnd := Value; - end; + SelChanged := Value <> FSelection.Start; //FSelection.Stop = FSelection.Start + + FSelection.Start := Value; + FSelection.Stop := Value; if SelChanged then StatusChanged([scSelection]); end; procedure TCustomSynEdit.SetBlockEnd(Value: TBufferCoord); -var - nLine: Integer; begin - ActiveSelectionMode := SelectionMode; if not (eoNoSelection in Options) then begin - if (eoScrollPastEol in Options) and not WordWrap then - Value.Char := MinMax(Value.Char, 1, FMaxScrollWidth + 1) - else - Value.Char := Max(Value.Char, 1); - Value.Line := MinMax(Value.Line, 1, Lines.Count); - if (FActiveSelectionMode = smNormal) then - if (Value.Line >= 1) and (Value.Line <= Lines.Count) then - Value.Char := Min(Value.Char, Length(Lines[Value.Line - 1]) + 1) - else - Value.Char := 1; - if (Value.Char <> FBlockEnd.Char) or (Value.Line <> FBlockEnd.Line) then + Value := ValidBC(Value); + + if Value <> FSelection.Stop then begin - if (Value.Char <> FBlockEnd.Char) or (Value.Line <> FBlockEnd.Line) then - begin - if (FActiveSelectionMode = smColumn) and (Value.Char <> FBlockEnd.Char) then - begin - InvalidateLines( - Min(FBlockBegin.Line, Min(FBlockEnd.Line, Value.Line)), - Max(FBlockBegin.Line, Max(FBlockEnd.Line, Value.Line))); - FBlockEnd := Value; - end - else begin - nLine := FBlockEnd.Line; - FBlockEnd := Value; - if (FActiveSelectionMode <> smColumn) or (FBlockBegin.Char <> FBlockEnd.Char) then - InvalidateLines(nLine, FBlockEnd.Line); - end; + IncPaintLock; + try + InvalidateRange(Value, FSelection.Stop); + FSelection.Stop := Value; StatusChanged([scSelection]); + finally + DecPaintLock; end; end; end; end; procedure TCustomSynEdit.SetCaretX(Value: Integer); -var - vNewCaret: TBufferCoord; begin - vNewCaret.Char := Value; - vNewCaret.Line := CaretY; - SetCaretXY(vNewCaret); + SetCaretXY(BufferCoord(Value, CaretY)); end; procedure TCustomSynEdit.SetCaretY(Value: Integer); -var - vNewCaret: TBufferCoord; begin - vNewCaret.Line := Value; - vNewCaret.Char := CaretX; - SetCaretXY(vNewCaret); + SetCaretXY(BufferCoord(CaretX, Value)); end; procedure TCustomSynEdit.InternalSetCaretX(Value: Integer); -var - vNewCaret: TBufferCoord; begin - vNewCaret.Char := Value; - vNewCaret.Line := CaretY; - InternalSetCaretXY(vNewCaret); + InternalSetCaretXY(BufferCoord(Value, CaretY)); end; procedure TCustomSynEdit.InternalSetCaretY(Value: Integer); -var - vNewCaret: TBufferCoord; -begin - vNewCaret.Line := Value; - vNewCaret.Char := CaretX; - InternalSetCaretXY(vNewCaret); -end; - -function TCustomSynEdit.GetCaretXY: TBufferCoord; begin - Result.Char := CaretX; - Result.Line := CaretY; + InternalSetCaretXY(BufferCoord(CaretX, Value)); end; function TCustomSynEdit.GetDisplayX: Integer; @@ -4168,218 +3611,320 @@ function TCustomSynEdit.GetDisplayX: Integer; function TCustomSynEdit.GetDisplayY: Integer; begin -{$IFDEF SYN_CodeFolding} - if not WordWrap and not UseCodeFolding then -{$ELSE} - if not WordWrap then -{$ENDIF} - Result := CaretY - else - Result := DisplayXY.Row; + Result := DisplayXY.Row; end; -Function TCustomSynEdit.GetDisplayXY: TDisplayCoord; +function TCustomSynEdit.SelectionToDisplayCoord(var Sel: TSynSelection): TDisplayCoord; begin - Result := BufferToDisplayPos(CaretXY); - if WordWrap and FCaretAtEOL then + Result := BufferToDisplayPos(Sel.Caret); + if WordWrap and Sel.CaretAtEOL then begin if Result.Column = 1 then begin Dec(Result.Row); - Result.Column := FWordWrapPlugin.GetRowLength(Result.Row) +1; + Result.Column := fWordWrapPlugin.GetRowLength(Result.Row) + 1; end else begin - // Work-around situations where FCaretAtEOL should have been updated because of - //text change (it's only valid when Column = 1). Updating it in ProperSetLine() - //would probably be the right thing, but... - FCaretAtEOL := False; + // Work-around situations where CaretAtEOL should have been updated because of + //text change (it's only valid when Column = 1). + Sel.CaretAtEOL := False; end; end; end; -procedure TCustomSynEdit.SetCaretXY(const Value: TBufferCoord); -//there are two setCaretXY methods. One Internal, one External. The published -//property CaretXY (re)sets the block as well +function TCustomSynEdit.SelectMatchingText(BackwardSearch: Boolean; + AddSelection: Boolean): Boolean; +var + Engine, OldEngine: TSynEditSearchCustom; + SearchOptions: TSynSearchOptions; + SelStorage: TSynSelStorage; + NewSel: TSynSelection; + Pattern: string; begin - IncPaintLock; + if (FSelection.IsEmpty) or (FSelection.Start.Line <> FSelection.Stop.Line) then + Exit(False); // Only match single line text + + Pattern := SelText; + + if Pattern = WordAtCursor then + SearchOptions := [ssoWholeWord]; + if CaseSensitive then + Include(SearchOptions, ssoMatchCase); + if BackwardSearch then + Include(SearchOptions, ssoBackwards); + + OldEngine := SearchEngine; + Engine := TSynEditSearch.Create(Self); + SearchEngine := Engine; try - Include(FStatusChanges, scSelection); - SetCaretXYEx(True, Value); - if SelAvail then - InvalidateSelection; - FBlockBegin.Char := FCaretX; - FBlockBegin.Line := FCaretY; - FBlockEnd := FBlockBegin; + IncPaintLock; + try + // SearchReplace will clear existing selections if successful + // So we need to store and restore + FSelections.Store(SelStorage); + Result := SearchReplace(Pattern, '', SearchOptions, + FSelection.Normalized.Stop, + BufferCoord(Lines[Lines.Count -1].Length + 1, Lines.Count)) > 0; + + if Result and AddSelection then + begin + NewSel := FSelection; + FSelections.Restore(SelStorage); + FSelection := NewSel; + if not FSelections.AddCaret(FSelection.Start) then + // Try again. This time it will not fail + FSelections.AddCaret(FSelection.Start); + // Deal with overlapping selections as if the range was mouse selected + FSelections.MouseSelection(FSelection); + end; + finally + DecPaintLock; + end; finally - DecPaintLock; + Engine.Free; + SearchEngine := OldEngine; + end; +end; + +procedure TCustomSynEdit.InternalCommandHook(Sender: TObject; + AfterProcessing: Boolean; var Handled: Boolean; + var Command: TSynEditorCommand; var AChar: WideChar; Data, + HandlerData: Pointer); +var + Spaces: string; + I: Integer; +begin + if not AfterProcessing and (Command <> ecChar) then + FAutoCompleteChar := #0; + + if not AfterProcessing and (Command = ecSelWord) then + begin + if not FSelection.IsEmpty then + begin + SelectMatchingText(False, True); + Handled := True; + Command := ecNone; + end + end + else if not AfterProcessing and (Command = ecPaste) then + begin + if not CanPaste then + begin + Handled := True; + Command := ecNone; + Exit; + end; + FPasteArray := []; + if (FSelections.Count > 1) and Clipboard.HasFormat(SynEditClipboardFormat) then + begin + FPasteArray := GetInternalClipText; + if Length(FPasteArray) <> FSelections.Count then + FPasteArray := []; + end; + + if Length(FPasteArray) = 0 then + FPasteArray := [GetClipboardText]; + + if eoTabsToSpaces in Options then + begin + Spaces := StringOfChar(#32, TabWidth); + for I := 0 to Length(FPasteArray) - 1 do + FPasteArray[I] := StringReplace(FPasteArray[I], #9, Spaces, [rfReplaceAll]); + end; + end + else if AfterProcessing and (Command = ecPaste) then + begin + FPasteArray := []; + EnsureCursorPosVisible; end; end; +function TCustomSynEdit.GetDisplayXY: TDisplayCoord; +begin + Result := SelectionToDisplayCoord(FSelection); +end; + +procedure TCustomSynEdit.SetCaretXY(const Value: TBufferCoord); +{ There are two setCaretXY methods. One Internal, one External. + Property CaretXY (re)sets the block as well } +begin + SetCaretAndSelection(Value, Value, Value); +end; + procedure TCustomSynEdit.InternalSetCaretXY(const Value: TBufferCoord); +{ Unlike SetCaretXY it does not affect BlockBegin/End } begin SetCaretXYEx(True, Value); end; -procedure TCustomSynEdit.UpdateLastCaretX; +procedure TCustomSynEdit.UpdateLastPosX; begin - FLastCaretX := DisplayX; + FLastPosX := RowColumnToPixels(DisplayXY).X - fTextOffset; end; -procedure TCustomSynEdit.SetCaretXYEx(CallEnsureCursorPos: Boolean; Value: TBufferCoord); +procedure TCustomSynEdit.SetCaretXYEx(EnsureVisible: Boolean; Value: TBufferCoord); var nMaxX: Integer; - vTriggerPaint: Boolean; + S, TS: string; begin - FCaretAtEOL := False; - vTriggerPaint := HandleAllocated; - if vTriggerPaint then + CaretAtEOL := False; + if HandleAllocated then DoOnPaintTransient(ttBefore); - if WordWrap then - nMaxX := MaxInt - else - nMaxX := MaxScrollWidth + 1; + nMaxX := MaxInt; if Value.Line > Lines.Count then Value.Line := Lines.Count; if Value.Line < 1 then begin // this is just to make sure if Lines stringlist should be empty Value.Line := 1; - if not (eoScrollPastEol in FOptions) then + if not (eoScrollPastEol in fScrollOptions) then nMaxX := 1; end else begin - if not (eoScrollPastEol in FOptions) then + if not (eoScrollPastEol in fScrollOptions) then nMaxX := Length(Lines[Value.Line - 1]) + 1; end; - if (Value.Char > nMaxX) and (not(eoScrollPastEol in Options) or - not(eoAutoSizeMaxScrollWidth in Options)) then - begin + if (Value.Char > nMaxX) and (not(eoScrollPastEol in fScrollOptions)) then Value.Char := nMaxX; - end; if Value.Char < 1 then Value.Char := 1; - if (Value.Char <> FCaretX) or (Value.Line <> FCaretY) then + + //Trim here + if not FReadOnly and (Value.Line <> CaretY) and (eoTrimTrailingSpaces in fOptions) and + (CaretY <= Lines.Count) and (CaretY >= 1) then + begin + S := Lines[CaretY-1]; + TS := S.TrimRight; + if S <> TS then + Lines[CaretY-1] := TS; + end; + + if (Value.Char <> CaretX) or (Value.Line <> CaretY) then begin IncPaintLock; try - // simply include the flags, FPaintLock is > 0 - if FCaretX <> Value.Char then + // simply include the flags, fPaintLock is > 0 + if CaretX <> Value.Char then begin - FCaretX := Value.Char; - Include(FStatusChanges, scCaretX); + FSelection.Caret.Char := Value.Char; + Include(fStatusChanges, scCaretX); end; - if FCaretY <> Value.Line then + if CaretY <> Value.Line then begin - if ActiveLineColor <> clNone then + if (ActiveLineColor <> clNone) or (eoShowLigatures in fOptions) then begin InvalidateLine(Value.Line); - InvalidateLine(FCaretY); + InvalidateLine(CaretY); end; - FCaretY := Value.Line; - Include(FStatusChanges, scCaretY); -{$IFDEF SYN_CodeFolding} - UncollapseAroundLine(fCaretY); -{$ENDIF} + FSelection.Caret.Line := Value.Line; + Include(fStatusChanges, scCaretY); + // CodeFolding + UncollapseAroundLine(CaretY); + // Annotated Scrollbars + if FScrollbarAnnotations.Count > 0 then + Include(fStateFlags, sfScrollbarChanged); end; - // Call UpdateLastCaretX before DecPaintLock because the event handler it - // calls could raise an exception, and we don't want fLastCaretX to be + // Call UpdateLastPosX before DecPaintLock because the event handler it + // calls could raise an exception, and we don't want FLastPosX to be // left in an undefined state if that happens. - UpdateLastCaretX; - if CallEnsureCursorPos then + UpdateLastPosX; + if EnsureVisible then EnsureCursorPosVisible; - Include(FStateFlags, sfCaretChanged); -//++ Flicker Reduction -// Include(fStateFlags, sfScrollbarChanged); -//-- Flicker Reduction + Include(fStateFlags, sfCaretChanged); finally DecPaintLock; end; end else begin - // Also call UpdateLastCaretX if the caret didn't move. Apps don't know - // anything about FLastCaretX and they shouldn't need to. So, to avoid any - // unwanted surprises, always update FLastCaretX whenever CaretXY is + // Also call UpdateLastPosX if the caret didn't move. Apps don't know + // anything about FLastPosX and they shouldn't need to. So, to avoid any + // unwanted surprises, always update FLastPosX whenever CaretXY is // assigned to. // Note to SynEdit developers: If this is undesirable in some obscure - // case, just save the value of FLastCaretX before assigning to CaretXY and + // case, just save the value of FLastPosX before assigning to CaretXY and // restore it afterward as appropriate. - UpdateLastCaretX; + UpdateLastPosX; end; - if vTriggerPaint then + if HandleAllocated then DoOnPaintTransient(ttAfter); end; +function TCustomSynEdit.RowColumnInView(RowCol: TDisplayCoord): Boolean; +// Returns True even if it is partially visible. Used in CaretInView +begin + Result := InRange(RowCol.Row, TopLine, TopLine + LinesInWindow) and + InRange(RowColumnToPixels(RowCol).X, FGutterWidth + TextMargin, + ClientWidth - TextMargin); +end; + +procedure TCustomSynEdit.CalcTextAreaWidth; +begin + if WordWrap and (eoWrapWithRightEdge in FOptions) and (fRightEdge > 0) then + FTextAreaWidth := Min(WrapAreaWidth, + Max(ClientWidth - fGutterWidth - 2 * TextMargin, 0)) + else + FTextAreaWidth := Max(ClientWidth - fGutterWidth - 2 * TextMargin, 0); +end; + function TCustomSynEdit.CaretInView: Boolean; -var - vCaretRowCol: TDisplayCoord; begin - vCaretRowCol := DisplayXY; - Result := (vCaretRowCol.Column >= LeftChar) - and (vCaretRowCol.Column <= LeftChar + CharsInWindow) - and (vCaretRowCol.Row >= TopLine) - and (vCaretRowCol.Row <= TopLine + LinesInWindow); + Result := RowColumnInView(DisplayXY); end; -procedure TCustomSynEdit.SetActiveLineColor(Value: TColor); +procedure TCustomSynEdit.CaretsAtLineEnds; +var + SelList: TList; + Sel: TSynSelection; + Line: Integer; + LineText: string; + SelStorage: TSynSelStorage; begin - if (FActiveLineColor <> Value) then - begin - FActiveLineColor := Value; - InvalidateLine(CaretY); + FSelections.Clear; // Operates on Active Selection only + + SelList := TList.Create; + try + for Line := BlockBegin.Line to BlockEnd.Line do + begin + LineText := Lines[Line - 1]; + Sel.Caret := BufferCoord(LineText.Length + 1, Line); + Sel.Start := Sel.Caret; + Sel.Stop := Sel.Caret; + Sel.CaretAtEOL := False; + Sel.LastPosX := RowColumnToPixels(BufferToDisplayPos(Sel.Caret)).X - fTextOffset; + + SelList.Add(Sel); + + SelStorage.Selections := SelList.ToArray; + SelStorage.BaseIndex := SelList.Count - 1; + SelStorage.ActiveIndex := SelList.Count - 1; + FSelections.Restore(SelStorage); + end; + finally + SelList.Free; end; end; -procedure TCustomSynEdit.SetFont(const Value: TFont); -var - DC: HDC; - Save: THandle; - Metrics: TTextMetric; - AveCW, MaxCW: Integer; +procedure TCustomSynEdit.SetActiveLineColor(Value: TColor); begin - DC := GetDC(0); - Save := SelectObject(DC, Value.Handle); - GetTextMetrics(DC, Metrics); - SelectObject(DC, Save); - ReleaseDC(0, DC); - with Metrics do + if (fActiveLineColor<>Value) then begin - AveCW := tmAveCharWidth; - MaxCW := tmMaxCharWidth; - end; - case AveCW = MaxCW of - True: inherited Font := Value; - False: - begin - with FFontDummy do - begin - Color := Value.Color; - Pitch := fpFixed; - Size := Value.Size; - Style := Value.Style; - Name := Value.Name; - end; - inherited Font := FFontDummy; - end; + fActiveLineColor:=Value; + InvalidateLine(CaretY); end; - - TSynEditStringList(FLines).FontChanged; - if FGutter.ShowLineNumbers then - GutterChanged(Self); end; procedure TCustomSynEdit.SetGutterWidth(Value: Integer); begin Value := Max(Value, 0); - if FGutterWidth <> Value then + if fGutterWidth <> Value then begin - FGutterWidth := Value; - FTextOffset := FGutterWidth + 2 - (LeftChar - 1) * FCharWidth; + fGutterWidth := Value; if HandleAllocated then begin - FCharsInWindow := Max(ClientWidth - FGutterWidth - 2, 0) div FCharWidth; + CalcTextAreaWidth; if WordWrap then - FWordWrapPlugin.DisplayChanged; + fWordWrapPlugin.DisplayChanged; UpdateScrollBars; Invalidate; end; @@ -4392,67 +3937,70 @@ procedure TCustomSynEdit.SetLeftChar(Value: Integer); iDelta: Integer; iTextArea: TRect; begin - if WordWrap then - Value := 1; + if Value = FLeftChar then Exit; - if eoScrollPastEol in Options then - begin - if eoAutoSizeMaxScrollWidth in Options then - MaxVal := MaxInt - CharsInWindow - else - MaxVal := MaxScrollWidth - CharsInWindow + 1 - end + // when wrapping with right edge and right edge is behind the window width + if WordWrap and not ((eoWrapWithRightEdge in FOptions) and + (WrapAreaWidth > FTextAreaWidth)) + then + Value := 1 else begin - MaxVal := TSynEditStringList(Lines).LengthOfLongestLine; - if MaxVal > CharsInWindow then - MaxVal := MaxVal - CharsInWindow + 1 + if eoScrollPastEol in ScrollOptions then + MaxVal := MaxInt + else if WordWrap and (eoWrapWithRightEdge in FOptions) and + (WrapAreaWidth > FTextAreaWidth - FCharWidth) + then + MaxVal := CeilOfIntDiv(WrapAreaWidth, FCharWidth) + 2 + + - FTextAreaWidth div FCharWidth else - MaxVal := 1; + // + 2 because we want to allow for an extra space at the end + // and LeftChar 1 would mean that the char appears right at the edge + MaxVal := CeilOfIntDiv(TSynEditStringList(Lines).MaxWidth, FCharWidth) + + 2 - FTextAreaWidth div fCharWidth; + Value := MinMax(Value, 1, MaxVal); end; - Value := MinMax(Value, 1, MaxVal); - if Value <> FLeftChar then + + if Value <> fLeftChar then begin - iDelta := FLeftChar - Value; - FLeftChar := Value; - FTextOffset := FGutterWidth + 2 - (LeftChar - 1) * FCharWidth; - if Abs(iDelta) < CharsInWindow then - begin - iTextArea := ClientRect; - Inc(iTextArea.Left, FGutterWidth + 2); - ScrollWindow(Handle, iDelta * CharWidth, 0, @iTextArea, @iTextArea); - end - else - InvalidateLines(-1, -1); - if (Options >= [eoAutoSizeMaxScrollWidth, eoScrollPastEol]) and - (MaxScrollWidth < LeftChar + CharsInWindow) then - begin - MaxScrollWidth := LeftChar + CharsInWindow - end - else - UpdateScrollBars; - StatusChanged([scLeftChar]); + IncPaintLock; + try + FCarets.HideCarets; + iDelta := fLeftChar - Value; + fLeftChar := Value; + fTextOffset := fGutterWidth + fTextMargin - (LeftChar - 1) * fCharWidth; + if (Abs(iDelta) * FCharWidth < ClientWidth - GutterWidth - TextMargin) and + (FSelections.Count = 1) + then + begin + iTextArea := ClientRect; + Inc(iTextArea.Left, fGutterWidth + fTextMargin); + ScrollWindow(Handle, iDelta * CharWidth, 0, @iTextArea, @iTextArea); + end + else + InvalidateLines(-1, -1); + Include(fStateFlags, sfScrollbarChanged); + StatusChanged([scLeftChar]); + finally + DecPaintLock; + end; end; end; -procedure TCustomSynEdit.SetLines(Value: TUnicodeStrings); +procedure TCustomSynEdit.SetLines(Value: TStrings); begin Lines.Assign(Value); end; -procedure TCustomSynEdit.SetLineText(Value: UnicodeString); +procedure TCustomSynEdit.SetLineText(Value: string); begin if (CaretY >= 1) and (CaretY <= Max(1, Lines.Count)) then Lines[CaretY - 1] := Value; end; -procedure TCustomSynEdit.SetFontSmoothing(AValue: TSynFontSmoothMethod); +procedure TCustomSynEdit.SetFontQuality(AValue: TFontQuality); begin - if FFontSmoothing <> AValue then - begin - FFontSmoothing := AValue; - FontSmoothingChanged; - end; + Font.Quality := AValue; end; procedure TCustomSynEdit.SetName(const Value: TComponentName); @@ -4466,6 +4014,12 @@ procedure TCustomSynEdit.SetName(const Value: TComponentName); Text := Value; end; +procedure TCustomSynEdit.SetScrollBarAnnotations( + const Value: TSynScrollbarAnnotations); +begin + FScrollbarAnnotations.Assign(Value); +end; + procedure TCustomSynEdit.SetScrollBars(const Value: TScrollStyle); begin if (FScrollBars <> Value) then @@ -4476,9 +4030,9 @@ procedure TCustomSynEdit.SetScrollBars(const Value: TScrollStyle); end; end; -procedure TCustomSynEdit.SetSelTextPrimitive(const Value: UnicodeString); +procedure TCustomSynEdit.SetSelText(const Value: string); begin - SetSelTextPrimitiveEx(FActiveSelectionMode, PWideChar(Value), True); + SetSelTextPrimitiveEx(Value, True); end; // This is really a last minute change and I hope I did it right. @@ -4487,373 +4041,178 @@ procedure TCustomSynEdit.SetSelTextPrimitive(const Value: UnicodeString); // as we would typically want the cursor to stay where it is. // To fix this (in the absence of a better idea), I changed the code in // DeleteSelection not to trim the string if eoScrollPastEol is not set. -procedure TCustomSynEdit.SetSelTextPrimitiveEx(PasteMode: TSynSelectionMode; - Value: PWideChar; AddToUndoList: Boolean); +procedure TCustomSynEdit.SetSelTextPrimitiveEx(const Value: string; + AddToUndoList: Boolean = True; SelectValue: Boolean = False); +{ + Works in two stages: + - First deletes selection. + - Second inserts text taking into account PasteMode. +} var BB, BE: TBufferCoord; - TempString: UnicodeString; + TempString, SelectedText: string; procedure DeleteSelection; - var - x, MarkOffset, MarkOffset2: Integer; - UpdateMarks: Boolean; - Count: Integer; - begin - UpdateMarks := False; - MarkOffset := 0; - MarkOffset2 := 0; - case FActiveSelectionMode of - smNormal: - begin - if Lines.Count > 0 then - begin - // Create a string that contains everything on the first line up - // to the selection mark, and everything on the last line after - // the selection mark. - if BB.Char > 1 then - MarkOffset2 := 1; - TempString := Copy(Lines[BB.Line - 1], 1, BB.Char - 1) + - Copy(Lines[BE.Line - 1], BE.Char, MaxInt); - // Delete all lines in the selection range. - TSynEditStringList(Lines).DeleteLines(BB.Line, BE.Line - BB.Line); - // Put the stuff that was outside of selection back in. - if Options >= [eoScrollPastEol, eoTrimTrailingSpaces] then - TempString := TrimTrailingSpaces(TempString); - Lines[BB.Line - 1] := TempString; - end; - UpdateMarks := True; - InternalCaretXY := BB; - end; - smColumn: - begin - // swap X if needed - if BB.Char > BE.Char then - SwapInt(Integer(BB.Char), Integer(BE.Char)); - - for x := BB.Line - 1 to BE.Line - 1 do - begin - TempString := Lines[x]; - Delete(TempString, BB.Char, BE.Char - BB.Char); - ProperSetLine(x, TempString); - end; - // Lines never get deleted completely, so keep caret at end. - InternalCaretXY := BufferCoord(BB.Char, FBlockEnd.Line); - // Column deletion never removes a line entirely, so no mark - // updating is needed here. - end; - smLine: - begin - if BE.Line = Lines.Count then - begin - Lines[BE.Line - 1] := ''; - for x := BE.Line - 2 downto BB.Line - 1 do - Lines.Delete(x); - end - else begin - for x := BE.Line - 1 downto BB.Line - 1 do - Lines.Delete(x); - end; - // smLine deletion always resets to first column. - InternalCaretXY := BufferCoord(1, BB.Line); - UpdateMarks := TRUE; - MarkOffset := 1; - end; - end; - - // Update marks - if UpdateMarks then + begin + if Lines.Count > 0 then begin - Count := BE.Line - BB.Line + MarkOffset; - if Count > 0 then - DoLinesDeleted(BB.Line + MarkOffset2, Count); + // Create a string that contains everything on the first line up + // to the selection mark, and everything on the last line after + // the selection mark. + TempString := Copy(Lines[BB.Line - 1], 1, BB.Char - 1) + + Copy(Lines[BE.Line - 1], BE.Char, MaxInt); + // Delete all lines in the selection range. + TSynEditStringList(Lines).DeleteLines(BB.Line, BE.Line - BB.Line); + // Put the stuff that was outside of selection back in. + if (eoTrimTrailingSpaces in Options) and (eoScrollPastEol in ScrollOptions) then + TempString := TempString.TrimRight; + Lines[BB.Line - 1] := TempString; end; + CaretXY := BB; end; procedure InsertText; + var + sLeftSide: string; + sRightSide: string; + NewLines: TArray; + LineCount: Integer; + I: Integer; + begin + if Value = '' then + Exit; - function CountLines(p: PWideChar): Integer; - begin - Result := 0; - while p^ <> #0 do - begin - if p^ = #13 then - Inc(p); - if p^ = #10 then - Inc(p); - Inc(Result); - p := GetEOL(p); - end; - end; + NewLines := StringToLines(Value); + LineCount := Length(NewLines); - function InsertNormal: Integer; - var - sLeftSide: UnicodeString; - sRightSide: UnicodeString; - Str: UnicodeString; - Start: PWideChar; - P: PWideChar; - begin - Result := 0; - sLeftSide := Copy(LineText, 1, CaretX - 1); - if CaretX - 1 > Length(sLeftSide) then - begin - sLeftSide := sLeftSide + UnicodeStringOfChar(#32, - CaretX - 1 - Length(sLeftSide)); - end; - sRightSide := Copy(LineText, CaretX, Length(LineText) - (CaretX - 1)); - // step1: insert the first line of Value into current line - Start := PWideChar(Value); - P := GetEOL(Start); - if P^ <> #0 then - begin - Str := sLeftSide + Copy(Value, 1, P - Start); - ProperSetLine(CaretY - 1, Str); - TSynEditStringList(Lines).InsertLines(CaretY, CountLines(P)); - end - else begin - Str := sLeftSide + Value + sRightSide; - ProperSetLine(CaretY -1, Str); - end; - // step2: insert left lines of Value - while P^ <> #0 do - begin - if P^ = #13 then - Inc(P); - if P^ = #10 then - Inc(P); - Inc(FCaretY); - Include(FStatusChanges, scCaretY); - Start := P; - P := GetEOL(Start); - if P = Start then - begin - if p^ <> #0 then - Str := '' - else - Str := sRightSide; - end - else begin - SetString(Str, Start, P - Start); - if p^ = #0 then - Str := Str + sRightSide - end; - ProperSetLine(CaretY -1, Str); - Inc(Result); - end; - if eoTrimTrailingSpaces in Options then - if sRightSide = '' then - FCaretX := GetExpandedLength(Str, TabWidth) + 1 - else - FCaretX := 1 + Length(Lines[CaretY - 1]) - Length(TrimTrailingSpaces(sRightSide)) - else FCaretX := 1 + Length(Lines[CaretY - 1]) - Length(sRightSide); - StatusChanged([scCaretX]); - end; + if LineCount = 0 then Exit; - function InsertColumn: Integer; - var - Str: UnicodeString; - Start: PWideChar; - P: PWideChar; - Len: Integer; - InsertPos: Integer; - LineBreakPos: TBufferCoord; - begin - Result := 0; - // Insert string at current position - InsertPos := CaretX; - Start := PWideChar(Value); - repeat - P := GetEOL(Start); - if P <> Start then - begin - SetLength(Str, P - Start); - Move(Start^, Str[1], (P - Start) * sizeof(WideChar)); - if CaretY > Lines.Count then - begin - Inc(Result); - TempString := UnicodeStringOfChar(#32, InsertPos - 1) + Str; - Lines.Add(''); - if AddToUndoList then - begin - LineBreakPos.Line := CaretY -1; - LineBreakPos.Char := Length(Lines[CaretY - 2]) + 1; - FUndoList.AddChange(crLineBreak, LineBreakPos, LineBreakPos, '', smNormal); - end; - end - else begin - TempString := Lines[CaretY - 1]; - Len := Length(TempString); - if Len < InsertPos then - begin - TempString := - TempString + UnicodeStringOfChar(#32, InsertPos - Len - 1) + Str - end - else - Insert(Str, TempString, InsertPos); - end; - ProperSetLine(CaretY - 1, TempString); - // Add undo change here from PasteFromClipboard - if AddToUndoList then - begin - FUndoList.AddChange(crPaste, BufferCoord(InsertPos, CaretY), - BufferCoord(InsertPos + (P - Start), CaretY), '', FActiveSelectionMode); - end; - end; - if P^ = #13 then - begin - Inc(P); - if P^ = #10 then - Inc(P); - Inc(FCaretY); - Include(FStatusChanges, scCaretY); - end; - Start := P; - until P^ = #0; - Inc(FCaretX, Length(Str)); - Include(FStatusChanges, scCaretX); + sLeftSide := Copy(LineText, 1, CaretX - 1); + if CaretX - 1 > Length(sLeftSide) then + begin + sLeftSide := sLeftSide + StringofChar(#32, + CaretX - 1 - Length(sLeftSide)); end; + sRightSide := Copy(LineText, CaretX, Length(LineText) - (CaretX - 1)); + if eoTrimTrailingSpaces in Options then + sRightSide := sRightSide.TrimRight; - function InsertLine: Integer; - var - Start: PWideChar; - P: PWideChar; - Str: UnicodeString; - n: Integer; - begin - Result := 0; - FCaretX := 1; - // Insert string before current line - Start := PWideChar(Value); - repeat - P := GetEOL(Start); - if P <> Start then - begin - SetLength(Str, P - Start); - Move(Start^, Str[1], (P - Start) * sizeof(WideChar)); - end - else - Str := ''; - if (P^ = #0) then - begin - n := Lines.Count; - if (n >= CaretY) then - Lines[CaretY - 1] := Str + Lines[CaretY - 1] - else - Lines.Add(Str); - if eoTrimTrailingSpaces in Options then - Lines[CaretY - 1] := TrimTrailingSpaces(Lines[CaretY - 1]); - FCaretX := 1 + Length(Str); - end - else begin - //--------- KV from SynEditStudio - if (CaretY = Lines.Count) or InsertMode then - begin - Lines.Insert(CaretY -1, ''); - Inc(Result); - end; - //--------- - ProperSetLine(CaretY - 1, Str); - Inc(FCaretY); - Include(FStatusChanges, scCaretY); - Inc(Result); - if P^ = #13 then - Inc(P); - if P^ = #10 then - Inc(P); - Start := P; - end; - until P^ = #0; - StatusChanged([scCaretX]); - end; + // step1: insert the first line of Value into current line + NewLines[0] := sLeftSide + NewLines[0]; + // step2: insert left lines of Value + NewLines[LineCount - 1] := NewLines[LineCount - 1] + sRightSide; - var - StartLine: Integer; - StartCol: Integer; - InsertedLines: Integer; - begin - if Value = '' then - Exit; + if eoTrimTrailingSpaces in Options then + for I := 0 to LineCount - 1 do + NewLines[I] := NewLines[I].TrimRight; - StartLine := CaretY; - StartCol := CaretX; - case PasteMode of - smNormal: - InsertedLines := InsertNormal; - smColumn: - InsertedLines := InsertColumn; - smLine: - InsertedLines := InsertLine; - else - InsertedLines := 0; - end; - // We delete selected based on the current selection mode, but paste - // what's on the clipboard according to what it was when copied. - // Update marks - if InsertedLines > 0 then + Lines[CaretY -1] := NewLines[0]; + if LineCount > 1 then begin - if (PasteMode = smNormal) and (StartCol > 1) then - Inc(StartLine); - DoLinesInserted(StartLine, InsertedLines); + TSynEditStringList(Lines).InsertStrings(CaretY, NewLines, 1); + Inc(FSelection.Caret.Line, LineCount - 1); + Include(fStatusChanges, scCaretY); end; + + FSelection.Caret.Char := 1 + Length(Lines[CaretY - 1]) - Length(sRightSide); + StatusChanged([scCaretX]); + // Force caret reset - InternalCaretXY := CaretXY; + CaretXY := CaretXY; end; begin - IncPaintLock; + BB := BlockBegin; + BE := BlockEnd; + + if (Value.Length = 0) and (BB = BE) then Exit; // nothing to do + Lines.BeginUpdate; + IncPaintLock; + if AddToUndoList then BeginUndoBlock else fUndoRedo.Lock; try - BB := BlockBegin; - BE := BlockEnd; - if SelAvail then - begin + SelectedText := SelectionText(FSelection); + + if SelectedText <> '' then DeleteSelection; - InternalCaretXY := BB; - end; - if (Value <> nil) and (Value[0] <> #0) then + + if Length(Value) > 0 then + begin InsertText; - if CaretY < 1 then - InternalCaretY := 1; + if SelectValue then + SetCaretAndSelection(CaretXY, BB, CaretXY); + end; finally - Lines.EndUpdate; + if AddToUndoList then EndUndoBlock else fUndoRedo.UnLock; DecPaintLock; + Lines.EndUpdate; end; end; -procedure TCustomSynEdit.SynSetText(const Value: UnicodeString); +procedure TCustomSynEdit.SetTextHint(const Value: string); begin - Lines.Text := Value; + FTextHint := Value; + if (FTextHint <> '') and (FLines.Count <= 1) and (FLines[0] = '') then + Invalidate; +end; + +procedure TCustomSynEdit.SynSetText(const Value: string); +begin + FSelections.Clear(); + BeginUndoBlock; + try + IncPaintLock; + try + Lines.Text := Value; + finally + DecPaintLock; + end; + finally + EndUndoBlock; + end; end; procedure TCustomSynEdit.SetTopLine(Value: Integer); var Delta: Integer; begin - if (eoScrollPastEof in Options) then - Value := Min(Value, DisplayLineCount) + if (eoScrollPastEof in ScrollOptions) then + Value := Min(Value, DisplayRowCount) else - Value := Min(Value, DisplayLineCount - FLinesInWindow + 1); + Value := Min(Value, DisplayRowCount - fLinesInWindow + 1); Value := Max(Value, 1); if Value <> TopLine then begin - Delta := TopLine - Value; - FTopLine := Value; - if Abs(Delta) < FLinesInWindow then - ScrollWindow(Handle, 0, FTextHeight * Delta, nil, nil) - else - Invalidate; + IncPaintLock; + try + FCarets.HideCarets; + Delta := TopLine - Value; + fTopLine := Value; + if (Abs(Delta) < fLinesInWindow) and (FSelections.Count = 1) then + ScrollWindow(Handle, 0, fTextHeight * Delta, nil, nil) + else + Invalidate; - UpdateWindow(Handle); - UpdateScrollBars; - StatusChanged([scTopLine]); + Include(fStateFlags, sfScrollbarChanged); + StatusChanged([scTopLine]); + finally + DecPaintLock; + end; end; end; -{$IFDEF SYN_CodeFolding} procedure TCustomSynEdit.SetUseCodeFolding(const Value: Boolean); -Var - ValidValue : Boolean; +var + ValidValue: Boolean; begin + if csLoading in ComponentState then + begin + // when loading the highlighter may not have been assigned + // this is taken care in Loaded. + fUseCodeFolding := Value; + Exit; + end; + ValidValue := Value and ((Assigned(fHighlighter) and (fHighlighter is TSynCustomCodeFoldingHighlighter)) or Assigned(fOnScanForFoldRanges)); @@ -4867,24 +4226,152 @@ procedure TCustomSynEdit.SetUseCodeFolding(const Value: Boolean); begin // !!Mutually exclusive with WordWrap to reduce complexity WordWrap := False; + if fHighlighter is TSynCustomCodeFoldingHighlighter then + begin + TSynCustomCodeFoldingHighlighter(fHighlighter).InitFoldRanges(fAllFoldRanges); + AllFoldRanges.AdjustRangesProc := + TSynCustomCodeFoldingHighlighter(fHighlighter).AdjustFoldRanges; + end + else + AllFoldRanges.AdjustRangesProc := nil; + FullFoldScan; - end; + end + else + AllFoldRanges.AdjustRangesProc := nil; + OnCodeFoldingChange(Self); InvalidateGutter; end; end; +procedure TCustomSynEdit.OleDragEnter(Sender: TObject; DataObject: IDataObject; + State: TShiftState; MousePt: TPoint; var Effect: LongInt; + var Result: HResult); +begin + if ReadOnly or not HasFormat(DataObject, CF_UNICODETEXT) then + Effect := DROPEFFECT_NONE; +end; + +procedure TCustomSynEdit.OleDragLeave(Sender: TObject; var Result: HResult); +begin + fScrollTimer.Enabled := False; + SetCaretAndSelection(FSelection.Stop, FSelection.Start, FSelection.Stop); +end; + +procedure TCustomSynEdit.OleDragOver(Sender: TObject; State: TShiftState; + MousePt: TPoint; var Effect: LongInt; var Result: HResult); +var + vNewPos: TDisplayCoord; + Pt: TPoint; +begin + Pt := ScreenToClient(MousePt); + vNewPos := PixelsToNearestRowColumn(Pt.X, Pt.Y); + InternalCaretXY := DisplayToBufferPos(vNewPos); + ComputeScroll(Pt.X, Pt.Y); +end; + +procedure TCustomSynEdit.OleDrop(Sender: TObject; DataObject: IDataObject; + State: TShiftState; MousePt: TPoint; var Effect: LongInt; + var Result: HResult); +var + vNewCaret: TBufferCoord; + DoDrop, DropAfter, DropMove: Boolean; + vBB, vBE: TBufferCoord; + DragDropText: string; + ChangeScrollPastEOL: Boolean; + FormatEtc: TFormatEtc; + Medium: TStgMedium; + Pt: TPoint; +begin + Pt := ScreenToClient(MousePt); + DropMove := Effect = DROPEFFECT_MOVE; + + IncPaintLock; + try + ComputeCaret(Pt.X, Pt.Y); + vNewCaret := CaretXY; + if not (sfOleDragSource in fStateFlags) then + begin + DoDrop := True; + DropAfter := False; + end + else + begin + // Internal dragging + vBB := BlockBegin; + vBE := BlockEnd; + DropAfter := (vNewCaret.Line > vBE.Line) + or ((vNewCaret.Line = vBE.Line) and ((vNewCaret.Char > vBE.Char) or + ((not DropMove) and (vNewCaret.Char = vBE.Char)))); + DoDrop := DropAfter or (vNewCaret.Line < vBB.Line) + or ((vNewCaret.Line = vBB.Line) and ((vNewCaret.Char < vBB.Char) or + ((not DropMove) and (vNewCaret.Char = vBB.Char)))); + end; + + if DoDrop then begin + with FormatEtc do begin + cfFormat := CF_UNICODETEXT; + dwAspect := DVASPECT_CONTENT; + ptd := nil; + tymed := TYMED_HGLOBAL; + lindex := -1; + end; + if DataObject.GetData(FormatEtc, Medium) = S_OK then begin + if Medium.hGlobal <> 0 then begin + DragDropText := PChar(GlobalLock(Medium.hGlobal)); + GlobalUnLock(Medium.hGlobal); + DoDrop := DragDropText <> ''; + end else + DoDrop := False; + ReleaseStgMedium(Medium); + end else + DoDrop := False; + end; + + if DoDrop then begin + BeginUndoBlock; + try + // delete the selected text if necessary + if DropMove then + begin + if sfOleDragSource in fStateFlags then begin + // Internal dragging + Effect := DROPEFFECT_NONE; // do not clear selection after drop + SelText := ''; + // adjust horizontal drop position + if DropAfter and (vNewCaret.Line = vBE.Line) then + Dec(vNewCaret.Char, vBE.Char - vBB.Char); + // adjust vertical drop position + if DropAfter and (vBE.Line > vBB.Line) then + Dec(vNewCaret.Line, vBE.Line - vBB.Line); + end; + end; + // insert the selected text + ChangeScrollPastEOL := not (eoScrollPastEol in fScrollOptions); + try + if ChangeScrollPastEOL then + Include(fScrollOptions, eoScrollPastEol); + CaretXY := vNewCaret; + SelText := DragDropText; // creates undo action + finally + if ChangeScrollPastEOL then + Exclude(fScrollOptions, eoScrollPastEol); + end; + SetCaretAndSelection(CaretXY, vNewCaret, CaretXY); + finally + EndUndoBlock; + end; + end else + Effect := DROPEFFECT_NONE; + finally + DecPaintLock; + end; +end; + procedure TCustomSynEdit.OnCodeFoldingChange(Sender: TObject); begin - if fUseCodeFolding then - // The fold shape is drawn in a square 2 * Gutter.RightMargin - // to the right of RightOffset and 2 * Gutter.RightMagin to the left of - // fGuttterWidth. It is centered vertically. - // Gutter.RightMargin is 2 at 96 DPI - Gutter.RightOffset := CodeFolding.GutterShapeSize + 3 * Gutter.RightMargin - else - Gutter.RightOffset := Gutter.RightMargin; - Invalidate; + GutterChanged(Sender); end; function TCustomSynEdit.GetCollapseMarkRect(Row, Line: Integer): TRect; @@ -4908,305 +4395,107 @@ function TCustomSynEdit.GetCollapseMarkRect(Row, Line: Integer): TRect; end; Result.Left := fTextOffset + - (TSynEditStringList(fLines).ExpandedStringLengths[Line-1] + 1) * fCharWidth; + TSynEditStringList(fLines).TextWidth[Line-1] + fCharWidth; { Fix rect } - if eoShowSpecialChars in fOptions then + if scEOL in FVisibleSpecialChars then Inc(Result.Left, fCharWidth); - // Deal wwth horizontal Scroll - Result.Left := Max(Result.Left, fGutterWidth + fCharWidth); - Result.Right := Result.Left + fCharWidth * 3 + 4 * (fCharWidth div 7); end; -function TCustomSynEdit.GetFoldShapeRect(Row: Integer): TRect; -begin - // Form a square rect for the square the user can click on - // The fold shape is drawn in a square 4 pixels to the right of RightOffset - // 4 pixels from the fGuttterWidth. It is vertically centered within a line. - Result.Left := fGutterWidth - CodeFolding.GutterShapeSize - 2 * Gutter.RightMargin; - Result.Right := Result.Left + CodeFolding.GutterShapeSize; - Result.Top := (Row - fTopLine) * LineHeight; - // make a square rect - Result.Top := Result.Top + ((LineHeight - (Result.Right - Result.Left)) div 2); - Result.Bottom := Result.Top + (Result.Right - Result.Left); -end; -{$ENDIF} - -procedure TCustomSynEdit.ShowCaret; -begin - if not (eoNoCaret in Options) and not (sfCaretVisible in FStateFlags) then - begin - if Windows.ShowCaret(Handle) then - Include(FStateFlags, sfCaretVisible); - end; -end; - -procedure TCustomSynEdit.UpdateCaret; +procedure TCustomSynEdit.UpdateCarets; var - CX, CY: Integer; iClientRect: TRect; vCaretDisplay: TDisplayCoord; vCaretPix: TPoint; - cf: TCompositionForm; - vSelStartPix: TPoint; + Sel: TSynSelection; + Index: Integer; begin - if (PaintLock <> 0) or not (Focused or FAlwaysShowCaret) then - Include(FStateFlags, sfCaretChanged) + if eoNoCaret in FOptions then + Exclude(fStateFlags, sfCaretChanged) + else if (PaintLock <> 0) or not (Focused or FAlwaysShowCaret) then + Include(fStateFlags, sfCaretChanged) else begin - Exclude(FStateFlags, sfCaretChanged); - vCaretDisplay := DisplayXY; - if WordWrap and (vCaretDisplay.Column > CharsInWindow + 1) then - vCaretDisplay.Column := CharsInWindow + 1; - vCaretPix := RowColumnToPixels(vCaretDisplay); - CX := vCaretPix.X + FCaretOffset.X; - CY := vCaretPix.Y + FCaretOffset.Y; - iClientRect := GetClientRect; - Inc(iClientRect.Left, FGutterWidth); - if (CX >= iClientRect.Left) and (CX < iClientRect.Right) - and (CY >= iClientRect.Top) and (CY < iClientRect.Bottom) then - begin - SetCaretPos(CX, CY); - ShowCaret; - end - else - begin - SetCaretPos(CX, CY); - HideCaret; - end; - if (Self.SelAvail = False) then - begin - cf.dwStyle := CFS_POINT; - cf.ptCurrentPos := Point(CX, CY); - ImmSetCompositionWindow(ImmGetContext(Handle), @cf); - end - else + Exclude(fStateFlags, sfCaretChanged); + + FCarets.HideCarets; + FCarets.CaretRects.Clear; + + for Index := 0 to FSelections.Count - 1 do begin - vSelStartPix := Self.RowColumnToPixels(BufferToDisplayPos(Self.BlockBegin)); - Self.SetImeCompositionWindow(Self.Font, vSelStartPix.X, vSelStartPix.Y); + Sel := FSelections[Index]; + if not Sel.Caret.IsValid then + Continue; + // The last space of a wrapped line may be out of view + vCaretDisplay := SelectionToDisplayCoord(Sel); + if WordWrap and not (eoWrapWithRightEdge in FOptions) and + Sel.CaretAtEOL and not RowColumnInView(vCaretDisplay) + then + Dec(vCaretDisplay.Column); + + vCaretPix := RowColumnToPixels(vCaretDisplay); + vCaretPix.Offset(FCarets.Shape.Offset); + iClientRect := ClientRect; + Inc(iClientRect.Left, fGutterWidth); + if PtInRect(iClientRect, vCaretPix) then + FCarets.CaretRects.Add(TRect.Create(vCaretPix, FCarets.Shape.Width, + FCarets.Shape.Height)); end; + + FCarets.ShowCarets; + UpdateIME; end; end; -procedure TCustomSynEdit.UpdateScrollBars; +procedure TCustomSynEdit.UpdateIME; var - nMaxScroll: Integer; - ScrollInfo: TScrollInfo; - iRightChar: Integer; + BC: TBufferCoord; + PosPix: TPoint; begin - if not HandleAllocated or (PaintLock <> 0) then - Include(FStateFlags, sfScrollbarChanged) - else begin - Exclude(FStateFlags, sfScrollbarChanged); - if fScrollBars <> ssNone then - begin - ScrollInfo.cbSize := SizeOf(ScrollInfo); - ScrollInfo.fMask := SIF_ALL; - if not(eoHideShowScrollbars in Options) then - begin - ScrollInfo.fMask := ScrollInfo.fMask or SIF_DISABLENOSCROLL; - end; - - if Visible then SendMessage(Handle, WM_SETREDRAW, 0, 0); - - if (fScrollBars in [{$IFDEF SYN_COMPILER_17_UP}TScrollStyle.{$ENDIF}ssBoth, {$IFDEF SYN_COMPILER_17_UP}TScrollStyle.{$ENDIF}ssHorizontal]) and not WordWrap then - begin - if eoScrollPastEol in Options then - nMaxScroll := MaxScrollWidth - else - nMaxScroll := Max(TSynEditStringList(Lines).LengthOfLongestLine, 1); - if nMaxScroll <= MAX_SCROLL then - begin - ScrollInfo.nMin := 1; - ScrollInfo.nMax := nMaxScroll; - ScrollInfo.nPage := CharsInWindow; - ScrollInfo.nPos := LeftChar; - end - else begin - ScrollInfo.nMin := 0; - ScrollInfo.nMax := MAX_SCROLL; - ScrollInfo.nPage := MulDiv(MAX_SCROLL, CharsInWindow, nMaxScroll); - ScrollInfo.nPos := MulDiv(MAX_SCROLL, LeftChar, nMaxScroll); - end; - - ShowScrollBar(Handle, SB_HORZ, not(eoHideShowScrollbars in Options) or - (ScrollInfo.nMin = 0) or (ScrollInfo.nMax > CharsInWindow)); - SetScrollInfo(Handle, SB_HORZ, ScrollInfo, True); - - //Now for the arrows - if (eoDisableScrollArrows in Options) or (nMaxScroll <= CharsInWindow) then - begin - iRightChar := LeftChar + CharsInWindow -1; - if (LeftChar <= 1) and (iRightChar >= nMaxScroll) then - begin - EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_BOTH); - end - else begin - EnableScrollBar(Handle, SB_HORZ, ESB_ENABLE_BOTH); - if (LeftChar <= 1) then - EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_LEFT) - else if iRightChar >= nMaxScroll then - EnableScrollBar(Handle, SB_HORZ, ESB_DISABLE_RIGHT) - end; - end - else - EnableScrollBar(Handle, SB_HORZ, ESB_ENABLE_BOTH); - end - else - ShowScrollBar(Handle, SB_HORZ, False); - - if fScrollBars in [ssBoth, ssVertical] then - begin - nMaxScroll := DisplayLineCount; - if (eoScrollPastEof in Options) then - Inc(nMaxScroll, LinesInWindow - 1); - if nMaxScroll <= MAX_SCROLL then - begin - ScrollInfo.nMin := 1; - ScrollInfo.nMax := Max(1, nMaxScroll); - ScrollInfo.nPage := LinesInWindow; - ScrollInfo.nPos := TopLine; - end - else begin - ScrollInfo.nMin := 0; - ScrollInfo.nMax := MAX_SCROLL; - ScrollInfo.nPage := MulDiv(MAX_SCROLL, LinesInWindow, nMaxScroll); - ScrollInfo.nPos := MulDiv(MAX_SCROLL, TopLine, nMaxScroll); - end; - - ShowScrollBar(Handle, SB_VERT, not(eoHideShowScrollbars in Options) or - (ScrollInfo.nMin = 0) or (ScrollInfo.nMax > LinesInWindow)); - SetScrollInfo(Handle, SB_VERT, ScrollInfo, True); + if FSelection.IsEmpty then + BC := CaretXY + else + BC := BlockBegin; - if (eoDisableScrollArrows in Options) or (nMaxScroll <= LinesInWindow) then - begin - if (TopLine <= 1) and (nMaxScroll <= LinesInWindow) then - begin - EnableScrollBar(Handle, SB_VERT, ESB_DISABLE_BOTH); - end - else begin - EnableScrollBar(Handle, SB_VERT, ESB_ENABLE_BOTH); - if (TopLine <= 1) then - EnableScrollBar(Handle, SB_VERT, ESB_DISABLE_UP) - else if ((DisplayLineCount - TopLine - LinesInWindow + 1) = 0) then - EnableScrollBar(Handle, SB_VERT, ESB_DISABLE_DOWN); - end; - end - else - EnableScrollBar(Handle, SB_VERT, ESB_ENABLE_BOTH); + PosPix := RowColumnToPixels(BufferToDisplayPos(BC)); + // Font is set in WMIMENotify + SetImeCompositionWindow(nil, PosPix.X, PosPix.Y); +end; - if Visible then SendMessage(Handle, WM_SETREDRAW, -1, 0); - if FPaintLock=0 then - Invalidate; +procedure TCustomSynEdit.UpdateScrollBars; +begin + if not HandleAllocated or (PaintLock <> 0) then + Include(fStateFlags, sfScrollbarChanged) + else begin + // In case TopLine is not valid when not eoScollPastEOF in Options + TopLine := TopLine; - end - else - ShowScrollBar(Handle, SB_VERT, False); + Exclude(fStateFlags, sfScrollbarChanged); - end {endif fScrollBars <> ssNone} - else - ShowScrollBar(Handle, SB_BOTH, False); + if FSynEditScrollBars.UpdateScrollBars then + Update + else if FScrollbarAnnotations.Count > 0 then + SendMessage(Handle, WM_NCPAINT, 0, 0); end; end; -{$IFDEF SYN_COMPILER_6_UP} function TCustomSynEdit.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; -const - WHEEL_DIVISOR = 120; // Mouse Wheel standard -var - iWheelClicks: Integer; - iLinesToScroll: Integer; begin Result := inherited DoMouseWheel(Shift, WheelDelta, MousePos); - if Result then - Exit; - if GetKeyState(SYNEDIT_CONTROL) < 0 then - iLinesToScroll := LinesInWindow shr Ord(eoHalfPageScroll in FOptions) - else - iLinesToScroll := 3; - Inc(FMouseWheelAccumulator, WheelDelta); - iWheelClicks := FMouseWheelAccumulator div WHEEL_DIVISOR; - FMouseWheelAccumulator := FMouseWheelAccumulator mod WHEEL_DIVISOR; - TopLine := TopLine - iWheelClicks * iLinesToScroll; - Update; - if Assigned(OnScroll) then OnScroll(Self,sbVertical); + if not Result then + FSynEditScrollBars.DoMouseWheel(Shift, WheelDelta, MousePos); Result := True; end; -{$ENDIF} - -{$IFDEF SYN_COMPILER_12_UP} -type - PHintInfo = Controls.PHintInfo; -{$ENDIF} - -procedure TCustomSynEdit.CMHintShow(var Msg: TMessage); -var - FoundHint: Boolean; - MouseCoords, TokenCoords: TBufferCoord; - TokenStr: UnicodeString; - TokenHint: string; - TokenType, Start: Integer; - Attri: TSynHighlighterAttributes; - D: TDisplayCoord; - P1, P2: TPoint; - TokenRect: TRect; -begin - if FHintMode = shmToken then - begin - FoundHint := False; - if Assigned(FOnTokenHint) and GetPositionOfMouse(MouseCoords) and - GetHighlighterAttriAtRowColEx(MouseCoords, TokenStr, TokenType, Start, Attri) then - begin - TokenCoords.Char := Start; - TokenCoords.Line := MouseCoords.Line; - FOnTokenHint(Self, TokenCoords, TokenStr, TokenType, Attri, TokenHint); - FoundHint := TokenHint <> ''; - end; - - if FoundHint then - begin - D := BufferToDisplayPos(TokenCoords); - P1 := RowColumnToPixels(D); - P2.X := P1.X + Length(TokenStr) * CharWidth; - P2.Y := P1.Y + FTextHeight; - TokenRect.TopLeft := P1; - TokenRect.BottomRight := P2; - - InflateRect(TokenRect, 2, 2); - with PHintInfo(Msg.LParam)^ do - begin - HintStr := TokenHint; - CursorRect := TokenRect; - HintData := nil; - end; - Msg.Result := 0; - end - else - Msg.Result := 1; - end - else - inherited; -end; procedure TCustomSynEdit.WMCaptureChanged(var Msg: TMessage); begin - FScrollTimer.Enabled := False; + fScrollTimer.Enabled := False; inherited; end; -procedure TCustomSynEdit.WMChar(var Msg: TWMChar); -begin -{$IFNDEF UNICODE} - if not Win32PlatformIsUnicode then - Msg.CharCode := Word(KeyUnicode(AnsiChar(Msg.CharCode))); -{$ENDIF} - - DoKeyPressW(Msg); -end; - procedure TCustomSynEdit.WMClear(var Msg: TMessage); begin if not ReadOnly then @@ -5229,41 +4518,26 @@ procedure TCustomSynEdit.WMCut(var Message: TMessage); procedure TCustomSynEdit.WMDropFiles(var Msg: TMessage); var i, iNumberDropped: Integer; - {$IFNDEF UNICODE} - FileNameA: array[0..MAX_PATH - 1] of AnsiChar; - {$ENDIF} FileNameW: array[0..MAX_PATH - 1] of WideChar; Point: TPoint; - FilesList: TUnicodeStringList; + FilesList: TStringList; begin try - if Assigned(FOnDropFiles) then + if Assigned(fOnDropFiles) then begin - FilesList := TUnicodeStringList.Create; + FilesList := TStringList.Create; try iNumberDropped := DragQueryFile(THandle(Msg.wParam), Cardinal(-1), nil, 0); DragQueryPoint(THandle(Msg.wParam), Point); -{$IFNDEF UNICODE} - if Win32PlatformIsUnicode then -{$ENDIF} - for i := 0 to iNumberDropped - 1 do - begin - DragQueryFileW(THandle(Msg.wParam), i, FileNameW, - sizeof(FileNameW) div 2); - FilesList.Add(FileNameW) -{$IFNDEF UNICODE} - end - else - for i := 0 to iNumberDropped - 1 do - begin - DragQueryFileA(THandle(Msg.wParam), i, FileNameA, - sizeof(FileNameA)); - FilesList.Add(UnicodeString(FileNameA)) -{$ENDIF} - end; - FOnDropFiles(Self, Point.X, Point.Y, FilesList); + for i := 0 to iNumberDropped - 1 do + begin + DragQueryFileW(THandle(Msg.wParam), i, FileNameW, + sizeof(FileNameW) div 2); + FilesList.Add(FileNameW) + end; + fOnDropFiles(Self, Point.X, Point.Y, FilesList); finally FilesList.Free; end; @@ -5276,11 +4550,21 @@ procedure TCustomSynEdit.WMDropFiles(var Msg: TMessage); procedure TCustomSynEdit.WMDestroy(var Message: TWMDestroy); begin - {$IFDEF UNICODE} - // assign WindowText here, otherwise the VCL will call GetText twice - if WindowText = nil then - WindowText := Lines.GetText; - {$ENDIF} + // See https://en.delphipraxis.net/topic/456-destroywnd-not-called-at-destruction-of-wincontrols/ + if (eoDropFiles in fOptions) and not (csDesigning in ComponentState) then + DragAcceptFiles(Handle, False); + + //https://learn.microsoft.com/en-us/windows/win32/api/uiautomationcoreapi/nf-uiautomationcoreapi-uiareturnrawelementprovider + + if Assigned(FUIAutomationProvider) then + begin + (FUIAutomationProvider as TSynUIAutomationProvider).EditorDestroyed; + UiaReturnRawElementProvider(Handle, 0, 0, nil); + FUIAutomationProvider := nil; + end; + + RevokeDragDrop(Handle); + inherited; end; @@ -5293,84 +4577,44 @@ procedure TCustomSynEdit.WMGetDlgCode(var Msg: TWMGetDlgCode); begin inherited; Msg.Result := Msg.Result or DLGC_WANTARROWS or DLGC_WANTCHARS; - if FWantTabs then + if fWantTabs then Msg.Result := Msg.Result or DLGC_WANTTAB; - if FWantReturns then + if fWantReturns then Msg.Result := Msg.Result or DLGC_WANTALLKEYS; end; -procedure TCustomSynEdit.WMGetText(var Msg: TWMGetText); +procedure TCustomSynEdit.WMGetObject(var Message: TMessage); begin - if HandleAllocated and IsWindowUnicode(Handle) then + if (Message.LParam = UiaRootObjectId) and not (csDestroying in ComponentState) + and (eoAccessibility in FOptions) then begin - WStrLCopy(PWideChar(Msg.Text), PWideChar(Text), Msg.TextMax - 1); - Msg.Result := WStrLen(PWideChar(Msg.Text)); + if FUIAutomationProvider = nil then + FUIAutomationProvider := TSynUIAutomationProvider.Create(Self) as IRawElementProviderSimple; + Message.Result := UiaReturnRawElementProvider(Handle, Message.WParam, + Message.LParam, FUIAutomationProvider as IRawElementProviderSimple); end else - begin - {$IFDEF SYN_COMPILER_18_UP}AnsiStrings.{$ENDIF}StrLCopy(PAnsiChar(Msg.Text), PAnsiChar(AnsiString(Text)), Msg.TextMax - 1); - Msg.Result := {$IFDEF SYN_COMPILER_18_UP}AnsiStrings.{$ENDIF}StrLen(PAnsiChar(Msg.Text)); - end; + inherited; +end; + +procedure TCustomSynEdit.WMGetText(var Msg: TWMGetText); +begin + Msg.Result := StrLen(StrLCopy(PChar(Msg.Text), PChar(Text), Msg.TextMax - 1)); end; procedure TCustomSynEdit.WMGetTextLength(var Msg: TWMGetTextLength); begin -{$IFDEF SYN_COMPILER_4_UP} // Avoid (useless) temporary copy of WindowText while window is recreated // because of docking. if csDocking in ControlState then Msg.Result := 0 else -{$ENDIF} Msg.Result := Length(Text); end; procedure TCustomSynEdit.WMHScroll(var Msg: TWMScroll); -var - iMaxWidth: Integer; begin - Msg.Result := 0; - case Msg.ScrollCode of - // Scrolls to start / end of the line - SB_LEFT: LeftChar := 1; - SB_RIGHT: - if eoScrollPastEol in Options then - LeftChar := MaxScrollWidth - CharsInWindow +1 - else - // Simply set LeftChar property to the LengthOfLongestLine, - // it would do the range checking and constrain the value if necessary - LeftChar := TSynEditStringList(Lines).LengthOfLongestLine; - // Scrolls one char left / right - SB_LINERIGHT: LeftChar := LeftChar + 1; - SB_LINELEFT: LeftChar := LeftChar - 1; - // Scrolls one page of chars left / right - SB_PAGERIGHT: LeftChar := LeftChar - + (FCharsInWindow - Ord(eoScrollByOneLess in FOptions)); - SB_PAGELEFT: LeftChar := LeftChar - - (FCharsInWindow - Ord(eoScrollByOneLess in FOptions)); - // Scrolls to the current scroll bar position - SB_THUMBPOSITION, - SB_THUMBTRACK: - begin - FIsScrolling := True; - if eoScrollPastEol in Options then - iMaxWidth := MaxScrollWidth - else - iMaxWidth := Max(TSynEditStringList(Lines).LengthOfLongestLine, 1); - if iMaxWidth > MAX_SCROLL then - LeftChar := MulDiv(iMaxWidth, Msg.Pos, MAX_SCROLL) - else - LeftChar := Msg.Pos; - end; - SB_ENDSCROLL: FIsScrolling := False; - end; - if Assigned(OnScroll) then OnScroll(Self,sbHorizontal); -end; - -function IsWindows98orLater: Boolean; -begin - Result := (Win32MajorVersion > 4) or - (Win32MajorVersion = 4) and (Win32MinorVersion > 0); + FSynEditScrollBars.WMHScroll(Msg); end; procedure TCustomSynEdit.WMImeChar(var Msg: TMessage); @@ -5385,49 +4629,21 @@ procedure TCustomSynEdit.WMImeComposition(var Msg: TMessage); var imc: HIMC; PW: PWideChar; - PA: PAnsiChar; - PWLength: Integer; ImeCount: Integer; begin if (Msg.LParam and GCS_RESULTSTR) <> 0 then begin imc := ImmGetContext(Handle); try - if IsWindows98orLater then - begin - ImeCount := ImmGetCompositionStringW(imc, GCS_RESULTSTR, nil, 0); - // ImeCount is always the size in bytes, also for Unicode - GetMem(PW, ImeCount + sizeof(WideChar)); - try - ImmGetCompositionStringW(imc, GCS_RESULTSTR, PW, ImeCount); - PW[ImeCount div sizeof(WideChar)] := #0; - CommandProcessor(ecImeStr, #0, PW); - finally - FreeMem(PW); - end; - end - else - begin - ImeCount := ImmGetCompositionStringA(imc, GCS_RESULTSTR, nil, 0); - // ImeCount is always the size in bytes, also for Unicode - GetMem(PA, ImeCount + sizeof(AnsiChar)); - try - ImmGetCompositionStringA(imc, GCS_RESULTSTR, PA, ImeCount); - PA[ImeCount] := #0; - - PWLength := MultiByteToWideChar(DefaultSystemCodePage, 0, PA, ImeCount, - nil, 0); - GetMem(PW, (PWLength + 1) * sizeof(WideChar)); - try - MultiByteToWideChar(DefaultSystemCodePage, 0, PA, ImeCount, - PW, PWLength); - CommandProcessor(ecImeStr, #0, PW); - finally - FreeMem(PW); - end; - finally - FreeMem(PA); - end; + ImeCount := ImmGetCompositionStringW(imc, GCS_RESULTSTR, nil, 0); + // ImeCount is always the size in bytes, also for Unicode + GetMem(PW, ImeCount + sizeof(WideChar)); + try + ImmGetCompositionStringW(imc, GCS_RESULTSTR, PW, ImeCount); + PW[ImeCount div sizeof(WideChar)] := #0; + CommandProcessor(ecImeStr, #0, PW); + finally + FreeMem(PW); end; finally ImmReleaseContext(Handle, imc); @@ -5440,7 +4656,6 @@ procedure TCustomSynEdit.WMImeNotify(var Msg: TMessage); var imc: HIMC; LogFontW: TLogFontW; - LogFontA: TLogFontA; begin with Msg do begin @@ -5450,16 +4665,8 @@ procedure TCustomSynEdit.WMImeNotify(var Msg: TMessage); imc := ImmGetContext(Handle); if imc <> 0 then begin - if IsWindows98orLater then - begin - GetObjectW(Font.Handle, SizeOf(TLogFontW), @LogFontW); - ImmSetCompositionFontW(imc, @LogFontW); - end - else - begin - GetObjectA(Font.Handle, SizeOf(TLogFontA), @LogFontA); - ImmSetCompositionFontA(imc, @LogFontA); - end; + GetObjectW(Font.Handle, SizeOf(TLogFontW), @LogFontW); + ImmSetCompositionFontW(imc, @LogFontW); ImmReleaseContext(Handle, imc); end; end; @@ -5469,6 +4676,25 @@ procedure TCustomSynEdit.WMImeNotify(var Msg: TMessage); end; procedure TCustomSynEdit.WMImeRequest(var Message: TMessage); +type + // Reconversion string. + PReconvertString = ^TReconvertString; + TReconvertString = record + dwSize: DWord; + dwVersion: DWord; + dwStrLen: DWord; + dwStrOffset: DWord; + dwCompStrLen: DWord; + dwCompStrOffset: DWord; + dwTargetStrLen: DWord; + dwTargetStrOffset: DWord; + end; + +const + IMR_RECONVERTSTRING = $0004; + IMR_DOCUMENTFEED = $0007; + SCS_QUERYRECONVERTSTRING = $00020000; + var pReconvert: PReconvertString; TargetText: string; @@ -5492,7 +4718,6 @@ procedure TCustomSynEdit.WMImeRequest(var Message: TMessage); TargetText := ''; end; TargetByteLength := Length(TargetText) * sizeof(Char); - if (Message.LParam = 0) then begin // 1st time (get buffer size (bytes)) @@ -5510,10 +4735,8 @@ procedure TCustomSynEdit.WMImeRequest(var Message: TMessage); pReconvert.dwVersion := 0; pReconvert.dwStrLen := Length(TargetText); pReconvert.dwStrOffset := Sizeof(TReconvertString); - pTarget := Pointer(Message.LParam + Sizeof(TReconvertString)); move(TargetText[1], pTarget^, TargetByteLength); - if (Self.SelLength <> 0) then begin pReconvert.dwTargetStrLen := 0; @@ -5565,10 +4788,9 @@ procedure TCustomSynEdit.WMImeRequest(var Message: TMessage); pReconvert.dwCompStrOffset := 0; pReconvert.dwTargetStrLen := 0; pReconvert.dwTargetStrOffset := (Self.CaretX - 1) * sizeof(Char); - pTarget := Pointer(Message.LParam + Sizeof(TReconvertString)); - move(TargetText[1], pTarget^, Length(TargetText) * sizeof(Char)); - + if TargetText <> '' then + move(TargetText[1], pTarget^, Length(TargetText) * sizeof(Char)); Message.Result := Sizeof(TReconvertString) + Length(TargetText) * sizeof(Char); end; end; @@ -5579,13 +4801,42 @@ procedure TCustomSynEdit.WMKillFocus(var Msg: TWMKillFocus); begin inherited; CommandProcessor(ecLostFocus, #0, nil); + //Added check for focused to prevent caret disappearing problem - if Focused or FAlwaysShowCaret then - Exit; - HideCaret; - Windows.DestroyCaret; - if FHideSelection and SelAvail then - InvalidateSelection; + if not (Focused or FAlwaysShowCaret) then + FCarets.HideCarets; + if FHideSelection and not FSelections.IsEmpty then + FSelections.InvalidateAll; +end; + +procedure TCustomSynEdit.WMMouseHWheel(var Message: TWMMouseWheel); +var + Shift: TShiftState; + WheelDelta: SmallInt; + MousePos: TSmallPoint; +begin + // Message.Keys does not always contain correct shift state + Shift := KeyboardStateToShiftState; + Include(Shift, System.Classes.ssHorizontal); + WheelDelta := - Message.WheelDelta; // HWheel directions are reversed from Wheel + MousePos := Message.Pos; + // Choosing not to call inherited DoMouseWheel as this would most likely + // cause issues with handlers that don't support ssHorizontal + FSynEditScrollBars.DoMouseWheel(Shift, WheelDelta, MousePos); + Message.Result := 1; +end; + +procedure TCustomSynEdit.WMPaint(var Message: TWMPaint); +begin + DoOnPaintTransient(ttBefore); + try + // Paint everything while the caret is hidden. + FCarets.HideCarets; + inherited; + UpdateCarets; + finally + DoOnPaintTransient(ttAfter); + end; end; procedure TCustomSynEdit.WMPaste(var Message: TMessage); @@ -5605,28 +4856,23 @@ procedure TCustomSynEdit.WMSetFocus(var Msg: TWMSetFocus); CommandProcessor(ecGotFocus, #0, nil); InitializeCaret; - if FHideSelection and SelAvail then - InvalidateSelection; + if FHideSelection and not FSelections.IsEmpty then + FSelections.InvalidateAll; end; procedure TCustomSynEdit.WMSetText(var Msg: TWMSetText); begin Msg.Result := 1; - try - if HandleAllocated and IsWindowUnicode(Handle) then - Text := PWideChar(Msg.Text) - else - Text := UnicodeString(PAnsiChar(Msg.Text)); - except - Msg.Result := 0; - raise - end + Text := PWideChar(Msg.Text) end; procedure TCustomSynEdit.WMSize(var Msg: TWMSize); begin inherited; SizeOrFontChanged(False); + + if Assigned(FUIAutomationProvider) then + (FUIAutomationProvider as TSynUIAutomationProvider).NotifyBoundingRectangleChange; end; procedure TCustomSynEdit.WMUndo(var Msg: TMessage); @@ -5634,106 +4880,9 @@ procedure TCustomSynEdit.WMUndo(var Msg: TMessage); Undo; end; -var - ScrollHintWnd: THintWindow; - -function GetScrollHint: THintWindow; -begin - if ScrollHintWnd = nil then - ScrollHintWnd := HintWindowClass.Create(Application); - Result := ScrollHintWnd; -end; - procedure TCustomSynEdit.WMVScroll(var Msg: TWMScroll); -var - s: string; - rc: TRect; - pt: TPoint; - ScrollHint: THintWindow; - ButtonH: Integer; - ScrollInfo: TScrollInfo; -begin - Msg.Result := 0; - case Msg.ScrollCode of - // Scrolls to start / end of the text - SB_TOP: TopLine := 1; - SB_BOTTOM: TopLine := DisplayLineCount; - // Scrolls one line up / down - SB_LINEDOWN: TopLine := TopLine + 1; - SB_LINEUP: TopLine := TopLine - 1; - // Scrolls one page of lines up / down - SB_PAGEDOWN: TopLine := TopLine - + (FLinesInWindow - Ord(eoScrollByOneLess in FOptions)); - SB_PAGEUP: TopLine := TopLine - - (FLinesInWindow - Ord(eoScrollByOneLess in FOptions)); - // Scrolls to the current scroll bar position - SB_THUMBPOSITION, - SB_THUMBTRACK: - begin - FIsScrolling := True; - if DisplayLineCount > MAX_SCROLL then - TopLine := MulDiv(LinesInWindow + DisplayLineCount - 1, Msg.Pos, - MAX_SCROLL) - else - TopLine := Msg.Pos; - - if eoShowScrollHint in FOptions then - begin - ScrollHint := GetScrollHint; - ScrollHint.Color := FScrollHintColor; - case FScrollHintFormat of - shfTopLineOnly: - s := Format(SYNS_ScrollInfoFmtTop, [RowToLine(TopLine)]); - else - s := Format(SYNS_ScrollInfoFmt, [RowToLine(TopLine), - RowToLine(TopLine + Min(LinesInWindow, DisplayLineCount-TopLine))]); - end; - -{$IFDEF SYN_COMPILER_3_UP} - rc := ScrollHint.CalcHintRect(200, s, nil); -{$ELSE} - rc := Rect(0, 0, TextWidth(ScrollHint.Canvas, s) + 6, - TextHeight(ScrollHint.Canvas, s) + 4); -{$ENDIF} - if eoScrollHintFollows in FOptions then - begin - ButtonH := GetSystemMetrics(SM_CYVSCROLL); - - FillChar(ScrollInfo, SizeOf(ScrollInfo), 0); - ScrollInfo.cbSize := SizeOf(ScrollInfo); - ScrollInfo.fMask := SIF_ALL; - GetScrollInfo(Handle, SB_VERT, ScrollInfo); - - pt := ClientToScreen(Point(ClientWidth - rc.Right - 4, - ((rc.Bottom - rc.Top) shr 1) + //half the size of the hint window - Round((ScrollInfo.nTrackPos / ScrollInfo.nMax) * //The percentage of the page that has been scrolled - (ClientHeight - (ButtonH * 2))) //The height minus the arrow buttons - + ButtonH)); //The height of the top button - end - else - pt := ClientToScreen(Point(ClientWidth - rc.Right - 4, 10)); - - OffsetRect(rc, pt.x, pt.y); - ScrollHint.ActivateHint(rc, s); -{$IFDEF SYN_COMPILER_3} - SendMessage(ScrollHint.Handle, WM_NCPAINT, 1, 0); -{$ENDIF} -{$IFNDEF SYN_COMPILER_3_UP} - ScrollHint.Invalidate; -{$ENDIF} - ScrollHint.Update; - end; - end; - // Ends scrolling - SB_ENDSCROLL: - begin - FIsScrolling := False; - if eoShowScrollHint in FOptions then - ShowWindow(GetScrollHint.Handle, SW_HIDE); - end; - end; - Update; - if Assigned(OnScroll) then OnScroll(Self,sbVertical); +begin + FSynEditScrollBars.WMVScroll(Msg); end; function TCustomSynEdit.ScanFrom(Index: Integer): Integer; @@ -5744,16 +4893,16 @@ function TCustomSynEdit.ScanFrom(Index: Integer): Integer; if Result >= Lines.Count then Exit; if Result = 0 then - FHighlighter.ResetRange + fHighlighter.ResetRange else - FHighlighter.SetRange(TSynEditStringList(Lines).Ranges[Result - 1]); + fHighlighter.SetRange(TSynEditStringList(Lines).Ranges[Result - 1]); repeat - FHighlighter.SetLine(Lines[Result], Result); - FHighlighter.NextToEol; - iRange := FHighlighter.GetRange; + fHighlighter.SetLine(Lines[Result], Result); + fHighlighter.NextToEol; + iRange := fHighlighter.GetRange; if TSynEditStringList(Lines).Ranges[Result] = iRange then - Exit; // avoid the final decrement + Exit; // avoid the final Decrement TSynEditStringList(Lines).Ranges[Result] := iRange; Inc(Result); until (Result = Lines.Count); @@ -5762,32 +4911,44 @@ function TCustomSynEdit.ScanFrom(Index: Integer): Integer; procedure TCustomSynEdit.ListCleared(Sender: TObject); begin + FSelections.Clear; + if WordWrap then - FWordWrapPlugin.Reset; + fWordWrapPlugin.Reset; -{$IFDEF SYN_CodeFolding} +//++ CodeFolding if UseCodeFolding then AllFoldRanges.Reset; -{$ENDIF} +//-- CodeFolding + + fMarkList.Clear; // fMarkList.Clear also frees all bookmarks, + FillChar(fBookMarks, sizeof(fBookMarks), 0); // so fBookMarks should be cleared too ClearUndo; // invalidate the *whole* client area - FillChar(FInvalidateRect, SizeOf(TRect), 0); Invalidate; // set caret and selected block to start of text CaretXY := BufferCoord(1, 1); // scroll to start of text TopLine := 1; LeftChar := 1; - Include(FStatusChanges, scAll); + Include(fStatusChanges, scAll); +end; + +procedure TCustomSynEdit.ListBeforeDeleted(Sender: TObject; aIndex: Integer; + aCount: Integer); +begin + DoLinesBeforeDeleted(aIndex, aCount); end; procedure TCustomSynEdit.ListDeleted(Sender: TObject; aIndex: Integer; aCount: Integer); -{$IFDEF SYN_CodeFolding} -Var +var vLastScan: Integer; begin + if WordWrap then + fWordWrapPlugin.LinesDeleted(aIndex, aCount); + vLastScan := aIndex; if Assigned(fHighlighter) and (Lines.Count > 0) then vLastScan := ScanFrom(aIndex); @@ -5796,46 +4957,33 @@ procedure TCustomSynEdit.ListDeleted(Sender: TObject; aIndex: Integer; AllFoldRanges.LinesDeleted(aIndex, aCount); // Scan the same lines the highlighter has scanned ReScanForFoldRanges(aIndex, vLastScan); - InvalidateGutter; end; -{$ELSE} -begin -{$ENDIF} - if Assigned(FHighlighter) and (Lines.Count > 0) then - ScanFrom(aIndex); - if WordWrap then - FWordWrapPlugin.LinesDeleted(aIndex, aCount); + DoLinesDeleted(aIndex, aCount); InvalidateLines(aIndex + 1, MaxInt); InvalidateGutterLines(aIndex + 1, MaxInt); -//++ Flicker Reduction Include(fStateFlags, sfScrollbarChanged); -//-- Flicker Reduction end; procedure TCustomSynEdit.ListInserted(Sender: TObject; Index: Integer; aCount: Integer); var - L: Integer; vLastScan: Integer; -{$IFDEF SYN_CodeFolding} FoldIndex: Integer; begin + if WordWrap then + fWordWrapPlugin.LinesInserted(Index, aCount); + vLastScan := Index; -{$ELSE} -begin -{$ENDIF} - if Assigned(FHighlighter) and (Lines.Count > 0) then + if Assigned(fHighlighter) and (Lines.Count > 0) then begin - vLastScan := Index; repeat vLastScan := ScanFrom(vLastScan); Inc(vLastScan); until vLastScan >= Index + aCount; end; -{$IFDEF SYN_CodeFolding} if UseCodeFolding then begin if fAllFoldRanges.CollapsedFoldStartAtLine(Index, FoldIndex) then // insertion starts at collapsed fold @@ -5844,92 +4992,63 @@ procedure TCustomSynEdit.ListInserted(Sender: TObject; Index: Integer; // Scan the same lines the highlighter has scanned ReScanForFoldRanges(Index, vLastScan-1); end; -{$ENDIF} - if WordWrap then - FWordWrapPlugin.LinesInserted(Index, aCount); + DoLinesInserted(Index, aCount); InvalidateLines(Index + 1, MaxInt); InvalidateGutterLines(Index + 1, MaxInt); -//++ Flicker Reduction + // Flicker Reduction Include(fStateFlags, sfScrollbarChanged); -//-- Flicker Reduction - - if (eoAutoSizeMaxScrollWidth in FOptions) then - begin - L := TSynEditStringList(Lines).ExpandedStringLengths[Index]; - if L > MaxScrollWidth then - MaxScrollWidth := L; - end; end; -procedure TCustomSynEdit.ListPutted(Sender: TObject; Index: Integer; - aCount: Integer); +procedure TCustomSynEdit.ListPut(Sender: TObject; Index: Integer; + const OldLine: string); var - L: Integer; vEndLine: Integer; -{$IFDEF SYN_CodeFolding} vLastScan: Integer; FoldIndex: Integer; -{$ENDIF} begin vEndLine := Index +1; - if WordWrap then - begin - if FWordWrapPlugin.LinesPutted(Index, aCount) <> 0 then - vEndLine := MaxInt; - InvalidateGutterLines(Index + 1, vEndLine); - end; -{$IFDEF SYN_CodeFolding} + if WordWrap and (fWordWrapPlugin.LinePut(Index, OldLine) <> 0) then + vEndLine := MaxInt; vLastScan := Index; if Assigned(fHighlighter) then begin vLastScan := ScanFrom(Index); vEndLine := Max(vEndLine, vLastScan + 1); -{$ELSE} - if Assigned(FHighlighter) then - begin - vEndLine := Max(vEndLine, ScanFrom(Index) + 1); -{$ENDIF} // If this editor is chained then the real owner of text buffer will probably // have already parsed the changes, so ScanFrom will return immediately. - if FLines <> FOrigLines then + if fLines <> fOrigLines then vEndLine := MaxInt; end; - {$IFDEF SYN_CodeFolding} if fUseCodeFolding then begin if fAllFoldRanges.CollapsedFoldStartAtLine(Index + 1, FoldIndex) then // modification happens at collapsed fold Uncollapse(FoldIndex); - AllFoldRanges.LinesPutted(Index, aCount); + AllFoldRanges.LinePut(Index, OldLine); // Scan the same lines the highlighter has scanned ReScanForFoldRanges(Index, vLastScan); end; -{$ENDIF} + + DoLinePut(Index, OldLine); InvalidateLines(Index + 1, vEndLine); InvalidateGutterLines(Index + 1, vEndLine); - - if (eoAutoSizeMaxScrollWidth in FOptions) then - begin - L := TSynEditStringList(Lines).ExpandedStringLengths[Index]; - if L > MaxScrollWidth then - MaxScrollWidth := L; - end; + Include(fStateFlags, sfScrollbarChanged); end; procedure TCustomSynEdit.ScanRanges; var i: Integer; begin - if Assigned(FHighlighter) and (Lines.Count > 0) then begin - FHighlighter.ResetRange; + if Assigned(fHighlighter) and (Lines.Count > 0) then begin + fHighlighter.ResetRange; i := 0; repeat - FHighlighter.SetLine(Lines[i], i); - FHighlighter.NextToEol; - TSynEditStringList(Lines).Ranges[i] := FHighlighter.GetRange; + fHighlighter.SetLine(Lines[i], i); + fHighlighter.NextToEol; + TSynEditStringList(Lines).Ranges[i] := fHighlighter.GetRange; Inc(i); until i >= Lines.Count; end; @@ -5937,52 +5056,11 @@ procedure TCustomSynEdit.ScanRanges; procedure TCustomSynEdit.SetWordBlock(Value: TBufferCoord); var - vBlockBegin: TBufferCoord; - vBlockEnd: TBufferCoord; - TempString: UnicodeString; - - procedure CharScan; - var - cRun: Integer; - begin - { search BlockEnd } - vBlockEnd.Char := Length(TempString); - for cRun := Value.Char to Length(TempString) do - if not IsIdentChar(TempString[cRun]) then - begin - vBlockEnd.Char := cRun; - Break; - end; - { search BlockBegin } - vBlockBegin.Char := 1; - for cRun := Value.Char - 1 downto 1 do - if not IsIdentChar(TempString[cRun]) then - begin - vBlockBegin.Char := cRun + 1; - Break; - end; - end; - + BB: TBufferCoord; + BE: TBufferCoord; begin - if (eoScrollPastEol in Options) and not WordWrap then - Value.Char := MinMax(Value.Char, 1, FMaxScrollWidth + 1) - else - Value.Char := Max(Value.Char, 1); - Value.Line := MinMax(Value.Line, 1, Lines.Count); - TempString := Lines[Value.Line - 1] + #0; //needed for CaretX = LineLength + 1 - if Value.Char > Length(TempString) then - begin - InternalCaretXY := BufferCoord(Length(TempString), Value.Line); - Exit; - end; - - CharScan; - - vBlockBegin.Line := Value.Line; - vBlockEnd.Line := Value.Line; - SetCaretAndSelection(vBlockEnd, vBlockBegin, vBlockEnd); - InvalidateLine(Value.Line); - StatusChanged([scSelection]); + GetWordBoundaries(Value, BB, BE); + SetCaretAndSelection(BE, BB, BE); end; procedure TCustomSynEdit.DblClick; @@ -5991,14 +5069,11 @@ procedure TCustomSynEdit.DblClick; begin GetCursorPos(ptMouse); ptMouse := ScreenToClient(ptMouse); - if ptMouse.X >= FGutterWidth + 2 then + if ptMouse.X >= fGutterWidth + fTextMargin then begin - if not (eoNoSelection in FOptions) then + if not (eoNoSelection in fOptions) then SetWordBlock(CaretXY); inherited; - Include(FStateFlags, sfDblClicked); - Exclude(FStateFlags, sfMouseCaptured); - MouseCapture := False; end else inherited; @@ -6006,289 +5081,64 @@ procedure TCustomSynEdit.DblClick; function TCustomSynEdit.GetCanUndo: Boolean; begin - Result := not ReadOnly and FUndoList.CanUndo; -end; - -function TCustomSynEdit.GetCanRedo: Boolean; -begin - Result := not ReadOnly and FRedoList.CanUndo; + Result := not ReadOnly and fUndoRedo.CanUndo; end; -function TCustomSynEdit.GetCanPaste; +function TCustomSynEdit.GetCaseSensitive: Boolean; begin - Result := not ReadOnly and ClipboardProvidesText; + if Assigned(fHighlighter) then + Result := fHighlighter.CaseSensitive + else + Result := FCaseSensitive; end; -procedure TCustomSynEdit.InsertBlock(const BB, BE: TBufferCoord; ChangeStr: PWideChar; - AddToUndoList: Boolean); -// used by BlockIndent and Redo +function TCustomSynEdit.GetCanRedo: Boolean; begin - SetCaretAndSelection(BB, BB, BE); - ActiveSelectionMode := smColumn; - SetSelTextPrimitiveEx(smColumn, ChangeStr, AddToUndoList); - StatusChanged([scSelection]); + Result := not ReadOnly and fUndoRedo.CanRedo; end; -procedure TCustomSynEdit.InsertLine(const BB, BE: TBufferCoord; ChangeStr: PWideChar; - AddToUndoList: Boolean); +function TCustomSynEdit.GetCanPaste; begin - SetCaretAndSelection(BB, BB, BE); - ActiveSelectionMode := smLine; - SetSelTextPrimitiveEx(smLine, ChangeStr, AddToUndoList); - StatusChanged([scSelection]); + Result := not ReadOnly and ClipboardProvidesText; end; procedure TCustomSynEdit.Redo; - - procedure RemoveGroupBreak; - var - Item: TSynEditUndoItem; - OldBlockNumber: Integer; - begin - if FRedoList.LastChangeReason = crGroupBreak then - begin - OldBlockNumber := UndoList.BlockChangeNumber; - Item := FRedoList.PopItem; - try - UndoList.BlockChangeNumber := Item.ChangeNumber; - FUndoList.AddGroupBreak; - finally - UndoList.BlockChangeNumber := OldBlockNumber; - Item.Free; - end; - UpdateModifiedStatus; - end; - end; - -var - Item: TSynEditUndoItem; - OldChangeNumber: Integer; - SaveChangeNumber: Integer; - FLastChange : TSynChangeReason; - FAutoComplete: Boolean; - FPasteAction: Boolean; - FSpecial1: Boolean; - FSpecial2: Boolean; - FKeepGoing: Boolean; begin if ReadOnly then Exit; - FLastChange := FRedoList.LastChangeReason; - FAutoComplete := FLastChange = crAutoCompleteBegin; - FPasteAction := FLastChange = crPasteBegin; - FSpecial1 := FLastChange = crSpecial1Begin; - FSpecial2 := FLastChange = crSpecial2Begin; - - Item := FRedoList.PeekItem; - if Item <> nil then - begin - OldChangeNumber := Item.ChangeNumber; - SaveChangeNumber := FUndoList.BlockChangeNumber; - FUndoList.BlockChangeNumber := Item.ChangeNumber; - try - repeat - RedoItem; - Item := FRedoList.PeekItem; - if Item = nil then - FKeepGoing := False - else begin - if FAutoComplete then - FKeepGoing := (FRedoList.LastChangeReason <> crAutoCompleteEnd) - else if FPasteAction then - FKeepGoing := (FRedoList.LastChangeReason <> crPasteEnd) - else if FSpecial1 then - FKeepGoing := (FRedoList.LastChangeReason <> crSpecial1End) - else if FSpecial2 then - FKeepGoing := (FRedoList.LastChangeReason <> crSpecial2End) - else if Item.ChangeNumber = OldChangeNumber then - FKeepGoing := True - else begin - FKeepGoing := ((eoGroupUndo in FOptions) and - (FLastChange = Item.ChangeReason) and - not(FLastChange in [crIndent, crUnindent])); - end; - FLastChange := Item.ChangeReason; - end; - until not(FKeepGoing); - - //we need to eat the last command since it does nothing and also update modified status... - if (FAutoComplete and (FRedoList.LastChangeReason = crAutoCompleteEnd)) or - (FPasteAction and (FRedoList.LastChangeReason = crPasteEnd)) or - (FSpecial1 and (FRedoList.LastChangeReason = crSpecial1End)) or - (FSpecial2 and (FRedoList.LastChangeReason = crSpecial2End)) then - begin - RedoItem; - UpdateModifiedStatus; - end; - - finally - FUndoList.BlockChangeNumber := SaveChangeNumber; - end; - RemoveGroupBreak; - end; -end; - -procedure TCustomSynEdit.RedoItem; -var - Item: TSynEditUndoItem; - Run, StrToDelete: PWideChar; - Len: Integer; - TempString: UnicodeString; - CaretPt: TBufferCoord; - ChangeScrollPastEol: Boolean; - BeginX: Integer; -begin - ChangeScrollPastEol := not (eoScrollPastEol in Options); - Item := FRedoList.PopItem; - if Assigned(Item) then + DoOnPaintTransient(ttBefore); + IncPaintLock; + Lines.BeginUpdate; try - ActiveSelectionMode := Item.ChangeSelMode; - IncPaintLock; - Include(FOptions, eoScrollPastEol); - FUndoList.InsideRedo := True; - case Item.ChangeReason of - crCaret: - begin - FUndoList.AddChange(Item.ChangeReason, CaretXY, CaretXY, '', FActiveSelectionMode); - InternalCaretXY := Item.ChangeStartPos; - end; - crSelection: - begin - FUndoList.AddChange(Item.ChangeReason, BlockBegin, BlockEnd, '', FActiveSelectionMode); - SetCaretAndSelection(CaretXY, Item.ChangeStartPos, Item.ChangeEndPos); - end; - crInsert, crPaste, crDragDropInsert: - begin - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeStartPos); - SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), - False); - InternalCaretXY := Item.ChangeEndPos; - FUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, SelText, Item.ChangeSelMode); - if Item.ChangeReason = crDragDropInsert then begin - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeEndPos); - end; - end; - crDeleteAfterCursor, crSilentDeleteAfterCursor: - begin - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeEndPos); - TempString := SelText; - SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), - False); - FUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, TempString, Item.ChangeSelMode); - InternalCaretXY := Item.ChangeEndPos; - end; - crDelete, crSilentDelete: - begin - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeEndPos); - TempString := SelText; - SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), - False); - FUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, TempString, Item.ChangeSelMode); - InternalCaretXY := Item.ChangeStartPos; - end; - crLineBreak: - begin - CaretPt := Item.ChangeStartPos; - SetCaretAndSelection(CaretPt, CaretPt, CaretPt); - CommandProcessor(ecLineBreak, #13, nil); - end; - crIndent: - begin - SetCaretAndSelection(Item.ChangeEndPos, Item.ChangeStartPos, - Item.ChangeEndPos); - FUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); - end; - crUnindent : - begin // re-delete the (raggered) column - // Delete string - StrToDelete := PWideChar(Item.ChangeStr); - InternalCaretY := Item.ChangeStartPos.Line; - if Item.ChangeSelMode = smColumn then - BeginX := Min(Item.ChangeStartPos.Char, Item.ChangeEndPos.Char) - else - BeginX := 1; - repeat - Run := GetEOL(StrToDelete); - if Run <> StrToDelete then - begin - Len := Run - StrToDelete; - if Len > 0 then - begin - TempString := Lines[CaretY - 1]; - Delete(TempString, BeginX, Len); - Lines[CaretY - 1] := TempString; - end; - end - else - Len := 0; - if Run^ = #13 then - begin - Inc(Run); - if Run^ = #10 then - Inc(Run); - Inc(FCaretY); - end; - StrToDelete := Run; - until Run^ = #0; - if Item.ChangeSelMode = smColumn then - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeEndPos) - else begin - // restore selection - CaretPt.Char := Item.ChangeStartPos.Char - FTabWidth; - CaretPt.Line := Item.ChangeStartPos.Line; - SetCaretAndSelection( CaretPt, CaretPt, - BufferCoord(Item.ChangeEndPos.Char - Len, Item.ChangeEndPos.Line) ); - end; - // add to undo list - FUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); - end; - crWhiteSpaceAdd: - begin - FUndoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, '', Item.ChangeSelMode); - SetCaretAndSelection(Item.ChangeEndPos, Item.ChangeEndPos, - Item.ChangeEndPos); - SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), True); - InternalCaretXY := Item.ChangeStartPos; - end; - end; + FUndoRedo.Redo(Self); finally - FUndoList.InsideRedo := False; - if ChangeScrollPastEol then - Exclude(FOptions, eoScrollPastEol); - Item.Free; + Lines.EndUpdate; DecPaintLock; + DoOnPaintTransient(ttAfter); end; end; -{$IFDEF SYN_CodeFolding} procedure TCustomSynEdit.Collapse(FoldRangeIndex: Integer; Invalidate:Boolean); +var + Range: TSynFoldRange; begin - AllFoldRanges.Ranges.List[FoldRangeIndex].Collapsed := True; + if not fUseCodeFolding then Exit; - with AllFoldRanges.Ranges[FoldRangeIndex] do + if AllFoldRanges.Collapse(FoldRangeIndex) then begin + Range := AllFoldRanges[FoldRangeIndex]; + // Extract caret from fold - if (fCaretY > FromLine) and (fCaretY <= ToLine) then - CaretXY := BufferCoord(Length(Lines[FromLine - 1]) + 1, FromLine); + if (CaretY > Range.FromLine) and (CaretY <= Range.ToLine) then + CaretXY := BufferCoord(Length(Lines[Range.FromLine - 1]) + 1, Range.FromLine); if Invalidate then begin // Redraw the collapsed line and below - InvalidateLines(FromLine, MaxInt); + InvalidateLines(Range.FromLine, MaxInt); // Redraw fold mark - InvalidateGutterLines(FromLine, MaxInt); + InvalidateGutterLines(Range.FromLine, MaxInt); UpdateScrollBars; end else @@ -6298,66 +5148,63 @@ procedure TCustomSynEdit.Collapse(FoldRangeIndex: Integer; Invalidate:Boolean); end; procedure TCustomSynEdit.CollapseAll; -var - i: Integer; begin if not fUseCodeFolding then Exit; - for i := fAllFoldRanges.Count - 1 downto 0 do - Collapse(i, False); + + fAllFoldRanges.CollapseAll; + SurfaceCaretFromHiddenFolds; InvalidateLines(-1, -1); InvalidateGutterLines(-1, -1); EnsureCursorPosVisible; + UpdateScrollBars; end; -procedure TCustomSynEdit.CollapseLevel(Level: integer); -Var - i : integer; - RangeIndices : TArray; +procedure TCustomSynEdit.CollapseLevel(Level: Integer); begin if not fUseCodeFolding then Exit; - RangeIndices := AllFoldRanges.FoldsAtLevel(Level); - for i := Low(RangeIndices) to High(RangeIndices) do - Collapse(RangeIndices[i], False); + + AllFoldRanges.CollapseLevel(Level); + SurfaceCaretFromHiddenFolds; InvalidateLines(-1, -1); InvalidateGutterLines(-1, -1); EnsureCursorPosVisible; + UpdateScrollBars; end; procedure TCustomSynEdit.CollapseNearest; -Var - Index : integer; +var + Index: Integer; begin if not fUseCodeFolding then Exit; + if AllFoldRanges.FoldAroundLineEx(CaretY, False, True, True, Index) then Collapse(Index); - EnsureCursorPosVisible; + EnsureCursorPosVisible; end; -procedure TCustomSynEdit.CollapseFoldType(FoldType : Integer); -Var - i : integer; - RangeIndices : TArray; +procedure TCustomSynEdit.CollapseFoldType(FoldType: Integer); begin if not fUseCodeFolding then Exit; - RangeIndices := AllFoldRanges.FoldsOfType(FoldType); - for i := Low(RangeIndices) to High(RangeIndices) do - Collapse(RangeIndices[i],False); + + AllFoldRanges.CollapseFoldType(FoldType); + SurfaceCaretFromHiddenFolds; InvalidateLines(-1, -1); InvalidateGutterLines(-1, -1); EnsureCursorPosVisible; + UpdateScrollBars; end; procedure TCustomSynEdit.Uncollapse(FoldRangeIndex: Integer; Invalidate:Boolean); begin - AllFoldRanges.Ranges.List[FoldRangeIndex].Collapsed := False; + AllFoldRanges.UnCollapse(FoldRangeIndex); if Invalidate then with AllFoldRanges.Ranges[FoldRangeIndex] do begin @@ -6382,29 +5229,26 @@ procedure TCustomSynEdit.UncollapseAroundLine(Line: Integer); begin if not fUseCodeFolding then Exit; // Open up the closed folds around the focused line until we can see the line we're looking for - while AllFoldRanges.FoldHidesLine(line, Index) do + while AllFoldRanges.FoldHidesLine(Line, Index) do Uncollapse(Index); end; -procedure TCustomSynEdit.UnCollapseLevel(Level: integer); -Var - i : integer; - RangeIndices : TArray; +procedure TCustomSynEdit.UnCollapseLevel(Level: Integer); begin if not fUseCodeFolding then Exit; - RangeIndices := AllFoldRanges.FoldsAtLevel(Level); - for i := Low(RangeIndices) to High(RangeIndices) do - Uncollapse(RangeIndices[i], False); + + AllFoldRanges.UnCollapseLevel(Level); InvalidateLines(-1, -1); InvalidateGutterLines(-1, -1); EnsureCursorPosVisible; + UpdateScrollBars; end; procedure TCustomSynEdit.UncollapseNearest; -Var - Index : integer; +var + Index: Integer; begin if not fUseCodeFolding then Exit; if AllFoldRanges.CollapsedFoldStartAtLine(CaretY, Index) then @@ -6413,20 +5257,208 @@ procedure TCustomSynEdit.UncollapseNearest; EnsureCursorPosVisible; end; -procedure TCustomSynEdit.UnCollapseFoldType(FoldType : Integer); -Var - i : integer; - RangeIndices : TArray; +procedure TCustomSynEdit.UnCollapseFoldType(FoldType: Integer); begin if not fUseCodeFolding then Exit; - RangeIndices := AllFoldRanges.FoldsOfType(FoldType); - for i := Low(RangeIndices) to High(RangeIndices) do - Uncollapse(RangeIndices[i], False); + + AllFoldRanges.UnCollapseFoldType(FoldType); InvalidateLines(-1, -1); InvalidateGutterLines(-1, -1); EnsureCursorPosVisible; + UpdateScrollBars; +end; + +procedure TCustomSynEdit.DoMouseSelectLineRange(NewPos: TBufferCoord); +{ Select whole lines } +var + BB, BE: TBufferCoord; +begin + BB := BlockBegin; + BE := BlockEnd; + + // Set AnchorLine + if CaretXY >= BE then + begin + if BB.Line < Lines.Count then + BE := BufferCoord(1, BB.Line + 1) + else + BE := BufferCoord(Length(Lines[BB.Line - 1]), BB.Line); + end + else + begin + BB := BufferCoord(1, Max(1, IfThen(BE.Line < Lines.Count, BE.Line - 1, BE.Line))); + end; + + if NewPos >= BB then + begin + BB := BufferCoord(1, BB.Line); + if NewPos.Line < Lines.Count then + BE := BufferCoord(1, NewPos.Line + 1) + else + BE := BufferCoord(Length(Lines[NewPos.Line - 1]), NewPos.Line); + end + else + begin + BB := BE; + BE := BufferCoord(1, NewPos.Line); + end; + + SetCaretAndSelection(BE, BB, BE); +end; + +procedure TCustomSynEdit.DoMouseSelectWordRange(NewPos: TBufferCoord); +{ Select whole words } +var + BB, BE: TBufferCoord; +begin + // Set Anchor Selection (Word) + BB := BlockBegin; + BE := BlockEnd; + if CaretXY > BB then + BE := WordEndEx(BB) + else + BB := WordStartEx(BE); + + NewPos.Char := Min(NewPos.Char, Lines[NewPos.Line-1].Length + 1); + if NewPos > BE then begin + BE := NewPos; + if (BE.Char > 1) and IsIdentChar(Lines[BE.Line-1][BE.Char - 1]) then + BE := WordEndEx(BE); + end else if NewPos < BB then begin + BB := BE; + BE := NewPos; + if (BE.Char < Lines[BE.Line-1].Length) and IsIdentChar(Lines[BE.Line-1][BE.Char]) then + BE := WordStartEx(BE); + end; + + SetCaretAndSelection(BE, BB, BE); +end; + +procedure TCustomSynEdit.ExecCmdCopyOrMoveLine(const Command: TSynEditorCommand); +var + vCaretRow, SelShift: Integer; + Caret, BB, BE: TBufferCoord; + StartBC, EndBC: TBufferCoord; + Text: string; +begin + if not ReadOnly and + ((Command <> ecMoveLineUp) or (BlockBegin.Line > 1)) and + ((Command <> ecMoveLineDown) or (BlockEnd.Line < Lines.Count)) then + begin + // Get Caret and selection + Caret := CaretXY; + StartBC := FSelection.Start; + EndBC := FSelection.Stop; + SelShift := Succ(Abs(EndBC.Line - StartBC.Line)); + + //BB and BE define where insertion of Text will take place + // SelShift is the number lines the Selection is shifted up or down + case Command of + ecCopyLineUp: + begin + BB := BufferCoord(1, BlockBegin.Line); + BE := BB; + SelShift := 0; + end; + ecMoveLineUp: + begin + BB := BufferCoord(1, Pred(BlockBegin.Line)); + if (StartBC.Line <> EndBC.Line) and (BlockEnd.Char = 1) then + BE := BufferCoord(Succ(Length(Lines[BlockEnd.Line - 2])), BlockEnd.Line - 1) + else + BE := BufferCoord(Succ(Length(Lines[BlockEnd.Line - 1])), BlockEnd.Line); + SelShift := -1; + end; + ecCopyLineDown: + begin + if (StartBC.Line <> EndBC.Line) and (BlockEnd.Char = 1) then begin + BE := BufferCoord(Succ(Length(Lines[BlockEnd.Line - 2])), BlockEnd.Line - 1); + Dec(SelShift); + end else + BE := BufferCoord(Succ(Length(Lines[BlockEnd.Line - 1])), BlockEnd.Line); + BB := BE; + end; + ecMoveLineDown: + begin + BB := BufferCoord(1, BlockBegin.Line); + if (StartBC.Line <> EndBC.Line) and (BlockEnd.Char = 1) then + BE := BufferCoord(Succ(Length(Lines[BlockEnd.Line - 1])), BlockEnd.Line) + else + BE := BufferCoord(Succ(Length(Lines[BlockEnd.Line])), BlockEnd.Line + 1); + SelShift := 1; + end; + else + Exit; //should not happen + end; + // store the lines into Text + Text := ''; + for vCaretRow := BlockBegin.Line to BlockEnd.Line do + begin + if (vCaretRow = BlockEnd.Line) and + (StartBC.Line <> EndBC.Line) and (BlockEnd.Char = 1) + then + Break; + if (Command = ecCopyLineDown) or (Command = ecMoveLineDown) then + Text := Text + SLineBreak + Lines[vCaretRow - 1] + else + Text := Text + Lines[vCaretRow - 1] + SLineBreak; + end; + // Add the line over which we move + if Command = ecMoveLineDown then + Text := Lines[BE.Line - 1] + Text + else if Command = ecMoveLineUp then + Text := Text + Lines[BB.Line-1]; + + // group undo redo actions and reduce transient painting + BeginUndoBlock; + try + // Insert/replace text at selection BB-BE + SetCaretAndSelection(BB, BB, BE); + SetSelText(Text); + + // Set as new selection the shifted old one + if SelShift <> 0 then + begin + Inc(Caret.Line, SelShift); + Inc(StartBC.Line, SelShift); + Inc(EndBC.Line, SelShift); + end; + SetCaretAndSelection(Caret, StartBC, EndBC); + finally + EndUndoBlock; + end; + end; +end; + +procedure TCustomSynEdit.ExecCmdDeleteLine; +var + BB, BE: TBufferCoord; +begin + if not ReadOnly and (Lines.Count > 0) and not + ((BlockBegin.Line = Lines.Count) and (Length(Lines[BlockBegin.Line - 1]) = 0)) then + begin + BeginUndoBlock; + try + // Normalize selection + FSelection.Normalize; + BB := FSelection.Start; + BE := FSelection.Stop; + BB.Char := 1; + if (BB.Line = BE.Line) or (BE.Char > 1) then + begin + if BE.Line = Lines.Count then + BE.Char := Length(Lines[BE.Line - 1]) + 1 + else + BE := BufferCoord(1, Succ(BE.Line)); + end; + SetCaretAndSelection(BB, BB, BE); + SetSelText(''); + finally + EndUndoBlock; + end; + end; end; procedure TCustomSynEdit.UncollapseAll; @@ -6440,255 +5472,72 @@ procedure TCustomSynEdit.UncollapseAll; InvalidateLines(-1, -1); InvalidateGutterLines(-1, -1); + UpdateScrollBars; EnsureCursorPosVisible; end; -{$ENDIF} - -procedure TCustomSynEdit.Undo; - procedure RemoveGroupBreak; - var - Item: TSynEditUndoItem; - OldBlockNumber: Integer; - begin - if FUndoList.LastChangeReason = crGroupBreak then - begin - OldBlockNumber := RedoList.BlockChangeNumber; - try - Item := FUndoList.PopItem; - RedoList.BlockChangeNumber := Item.ChangeNumber; - Item.Free; - FRedoList.AddGroupBreak; - finally - RedoList.BlockChangeNumber := OldBlockNumber; - end; - end; - end; +//-- CodeFolding -var - Item: TSynEditUndoItem; - OldChangeNumber: Integer; - SaveChangeNumber: Integer; - FLastChange : TSynChangeReason; - FAutoComplete: Boolean; - FPasteAction: Boolean; - FSpecial1: Boolean; - FSpecial2: Boolean; - FKeepGoing: Boolean; +procedure TCustomSynEdit.Undo; begin if ReadOnly then Exit; - RemoveGroupBreak; - - FLastChange := FUndoList.LastChangeReason; - FAutoComplete := FLastChange = crAutoCompleteEnd; - FPasteAction := FLastChange = crPasteEnd; - FSpecial1 := FLastChange = crSpecial1End; - FSpecial2 := FLastChange = crSpecial2End; - - Item := FUndoList.PeekItem; - if Item <> nil then - begin - OldChangeNumber := Item.ChangeNumber; - SaveChangeNumber := FRedoList.BlockChangeNumber; - FRedoList.BlockChangeNumber := Item.ChangeNumber; - - try - repeat - UndoItem; - Item := FUndoList.PeekItem; - if Item = nil then - FKeepGoing := False - else begin - if FAutoComplete then - FKeepGoing := (FUndoList.LastChangeReason <> crAutoCompleteBegin) - else if FPasteAction then - FKeepGoing := (FUndoList.LastChangeReason <> crPasteBegin) - else if FSpecial1 then - FKeepGoing := (FUndoList.LastChangeReason <> crSpecial1Begin) - else if FSpecial2 then - FKeepGoing := (FUndoList.LastChangeReason <> crSpecial2Begin) - else if Item.ChangeNumber = OldChangeNumber then - FKeepGoing := True - else begin - FKeepGoing := ((eoGroupUndo in FOptions) and - (FLastChange = Item.ChangeReason) and - not(FLastChange in [crIndent, crUnindent])); - end; - FLastChange := Item.ChangeReason; - end; - until not(FKeepGoing); - - //we need to eat the last command since it does nothing and also update modified status... - if (FAutoComplete and (FUndoList.LastChangeReason = crAutoCompleteBegin)) or - (FPasteAction and (FUndoList.LastChangeReason = crPasteBegin)) or - (FSpecial1 and (FUndoList.LastChangeReason = crSpecial1Begin)) or - (FSpecial2 and (FUndoList.LastChangeReason = crSpecial2Begin)) then - begin - UndoItem; - UpdateModifiedStatus; - end; - - finally - FRedoList.BlockChangeNumber := SaveChangeNumber; - end; + DoOnPaintTransient(ttBefore); + IncPaintLock; + Lines.BeginUpdate; + try + FUndoRedo.Undo(Self); + finally + Lines.EndUpdate; + DecPaintLock; + DoOnPaintTransient(ttAfter); end; end; -procedure TCustomSynEdit.UndoItem; +procedure TCustomSynEdit.GotoNextChange; var - Item: TSynEditUndoItem; - TmpPos: TBufferCoord; - TmpStr: UnicodeString; - ChangeScrollPastEol: Boolean; - BeginX: Integer; + Line: Integer; begin - ChangeScrollPastEol := not (eoScrollPastEol in Options); - Item := FUndoList.PopItem; - if Assigned(Item) then - try - ActiveSelectionMode := Item.ChangeSelMode; - IncPaintLock; - Include(FOptions, eoScrollPastEol); - case Item.ChangeReason of - crCaret: - begin - FRedoList.AddChange(Item.ChangeReason, CaretXY, CaretXY, '', FActiveSelectionMode); - InternalCaretXY := Item.ChangeStartPos; - end; - crSelection: - begin - FRedoList.AddChange(Item.ChangeReason, BlockBegin, BlockEnd, '', FActiveSelectionMode); - SetCaretAndSelection(CaretXY, Item.ChangeStartPos, Item.ChangeEndPos); - end; - crInsert, crPaste, crDragDropInsert: - begin - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeEndPos); - TmpStr := SelText; - SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), - False); - FRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, TmpStr, Item.ChangeSelMode); - InternalCaretXY := Item.ChangeStartPos; - end; - crDeleteAfterCursor, crDelete, - crSilentDelete, crSilentDeleteAfterCursor, - crDeleteAll: - begin - // If there's no selection, we have to set - // the Caret's position manualy. - if Item.ChangeSelMode = smColumn then - TmpPos := BufferCoord( - Min(Item.ChangeStartPos.Char, Item.ChangeEndPos.Char), - Min(Item.ChangeStartPos.Line, Item.ChangeEndPos.Line)) - else - TmpPos := TBufferCoord(MinPoint( - TPoint(Item.ChangeStartPos), TPoint(Item.ChangeEndPos))); - if (Item.ChangeReason in [crDeleteAfterCursor, - crSilentDeleteAfterCursor]) and (TmpPos.Line > Lines.Count) then - begin - InternalCaretXY := BufferCoord(1, Lines.Count); - FLines.Add(''); - end; - CaretXY := TmpPos; - SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), - False ); - if Item.ChangeReason in [crDeleteAfterCursor, - crSilentDeleteAfterCursor] - then - TmpPos := Item.ChangeStartPos - else - TmpPos := Item.ChangeEndPos; - if Item.ChangeReason in [crSilentDelete, crSilentDeleteAfterCursor] - then - InternalCaretXY := TmpPos - else begin - SetCaretAndSelection(TmpPos, Item.ChangeStartPos, - Item.ChangeEndPos); - end; - FRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, '', Item.ChangeSelMode); - if Item.ChangeReason = crDeleteAll then begin - InternalCaretXY := BufferCoord(1, 1); - FBlockEnd := BufferCoord(1, 1); - end; - EnsureCursorPosVisible; - end; - crLineBreak: - begin - // If there's no selection, we have to set - // the Caret's position manualy. - InternalCaretXY := Item.ChangeStartPos; - if CaretY > 0 then - begin - TmpStr := Lines.Strings[CaretY - 1]; - if (Length(TmpStr) < CaretX - 1) - and (LeftSpaces(Item.ChangeStr) = 0) - then - TmpStr := TmpStr + UnicodeStringOfChar(#32, CaretX - 1 - Length(TmpStr)); - ProperSetLine(CaretY - 1, TmpStr + Item.ChangeStr); - Lines.Delete(Item.ChangeEndPos.Line); - end - else - ProperSetLine(CaretY - 1, Item.ChangeStr); - DoLinesDeleted(CaretY + 1, 1); - FRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, '', Item.ChangeSelMode); - end; - crIndent: - begin - SetCaretAndSelection(Item.ChangeEndPos, Item.ChangeStartPos, - Item.ChangeEndPos); - FRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); - end; - crUnindent: // reinsert the (raggered) column that was deleted - begin - // reinsert the string - if Item.ChangeSelMode <> smColumn then - InsertBlock(BufferCoord(1, Item.ChangeStartPos.Line), - BufferCoord(1, Item.ChangeEndPos.Line), - PWideChar(Item.ChangeStr), False) - else - begin - BeginX := Min( Item.ChangeStartPos.Char, Item.ChangeEndPos.Char ); - InsertBlock(BufferCoord(BeginX, Item.ChangeStartPos.Line), - BufferCoord(BeginX, Item.ChangeEndPos.Line), - PWideChar(Item.ChangeStr), False); - end; - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeEndPos); - FRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, Item.ChangeStr, Item.ChangeSelMode); - end; - crWhiteSpaceAdd: - begin - SetCaretAndSelection(Item.ChangeStartPos, Item.ChangeStartPos, - Item.ChangeEndPos); - TmpStr := SelText; - SetSelTextPrimitiveEx(Item.ChangeSelMode, PWideChar(Item.ChangeStr), True); - FRedoList.AddChange(Item.ChangeReason, Item.ChangeStartPos, - Item.ChangeEndPos, TmpStr, Item.ChangeSelMode); - InternalCaretXY := Item.ChangeStartPos; - end; - end; - finally - if ChangeScrollPastEol then - Exclude(FOptions, eoScrollPastEol); - Item.Free; - DecPaintLock; - end; + Line := CaretY; + while (Line <= Lines.Count) and IsLineModified(Line) do + Inc(Line); + while (Line <= Lines.Count) do + if IsLineModified(Line) then + begin + CaretY := Line; + Exit; + end + else + Inc(Line); +end; + +procedure TCustomSynEdit.GotoPrevChange; +var + Line: Integer; +begin + Line := Min(CaretY, Lines.Count); + while (Line >= 1) and IsLineModified(Line) do + Dec(Line); + while Line >= 1 do + if IsLineModified(Line) then + begin + while (Line > 1) and IsLineModified(Line - 1) do + Dec(Line); + CaretY := Line; + Exit; + end + else + Dec(Line); end; procedure TCustomSynEdit.ClearBookMark(BookMark: Integer); begin - if (BookMark in [0..9]) and assigned(FBookMarks[BookMark]) then + if (BookMark in [0..9]) and assigned(fBookMarks[BookMark]) then begin - DoOnClearBookmark(FBookMarks[BookMark]); - FMarkList.Remove(FBookMarks[Bookmark]); - FBookMarks[BookMark] := nil; + DoOnClearBookmark(fBookMarks[BookMark]); + FMarkList.Remove(fBookMarks[Bookmark]); + fBookMarks[BookMark] := nil; end end; @@ -6697,40 +5546,31 @@ procedure TCustomSynEdit.GotoBookMark(BookMark: Integer); iNewPos: TBufferCoord; begin if (BookMark in [0..9]) and - assigned(FBookMarks[BookMark]) and - (FBookMarks[BookMark].Line <= FLines.Count) + assigned(fBookMarks[BookMark]) and + (fBookMarks[BookMark].Line <= fLines.Count) then begin - iNewPos.Char := FBookMarks[BookMark].Char; - iNewPos.Line := FBookMarks[BookMark].Line; + iNewPos.Char := fBookMarks[BookMark].Char; + iNewPos.Line := fBookMarks[BookMark].Line; //call it this way instead to make sure that the caret ends up in the middle //if it is off screen (like Delphi does with bookmarks) - SetCaretXYEx(False, iNewPos); - EnsureCursorPosVisibleEx(True); - if SelAvail then - InvalidateSelection; - FBlockBegin.Char := FCaretX; - FBlockBegin.Line := FCaretY; - FBlockEnd := FBlockBegin; + SetCaretAndSelection(iNewPos, iNewPos, iNewPos, True, True); end; end; procedure TCustomSynEdit.GotoLineAndCenter(ALine: Integer); +var + iNewPos: TBufferCoord; begin - SetCaretXYEx( False, BufferCoord(1, ALine) ); - if SelAvail then - InvalidateSelection; - FBlockBegin.Char := FCaretX; - FBlockBegin.Line := FCaretY; - FBlockEnd := FBlockBegin; - EnsureCursorPosVisibleEx(True); + iNewPos := BufferCoord(1, ALine); + SetCaretAndSelection(iNewPos, iNewPos, iNewPos, True, True); end; procedure TCustomSynEdit.SetBookMark(BookMark: Integer; X: Integer; Y: Integer); var mark: TSynEditMark; begin - if (BookMark in [0..9]) and (Y >= 1) and (Y <= Max(1, FLines.Count)) then + if (BookMark in [0..9]) and (Y >= 1) and (Y <= Max(1, fLines.Count)) then begin mark := TSynEditMark.Create(self); with mark do @@ -6740,394 +5580,223 @@ procedure TCustomSynEdit.SetBookMark(BookMark: Integer; X: Integer; Y: Integer); ImageIndex := Bookmark; BookmarkNumber := Bookmark; Visible := True; - InternalImage := (FBookMarkOpt.BookmarkImages = nil); + InternalImage := (fBookMarkOpt.BookmarkImages = nil); end; DoOnPlaceMark(Mark); if (mark <> nil) then begin - if assigned(FBookMarks[BookMark]) then + if assigned(fBookMarks[BookMark]) then ClearBookmark(BookMark); - FBookMarks[BookMark] := mark; - FMarkList.Add(FBookMarks[BookMark]); + fBookMarks[BookMark] := mark; + FMarkList.Add(fBookMarks[BookMark]); end; end; end; -function IsTextMessage(Msg: UINT): Boolean; -begin - Result := (Msg = WM_SETTEXT) or (Msg = WM_GETTEXT) or (Msg = WM_GETTEXTLENGTH); -end; - procedure TCustomSynEdit.WndProc(var Msg: TMessage); const ALT_KEY_DOWN = $20000000; begin - // Prevent Alt-Backspace from beeping - if (Msg.Msg = WM_SYSCHAR) and (Msg.wParam = VK_BACK) and - (Msg.lParam and ALT_KEY_DOWN <> 0) + // Prevent Alt+ from beeping + if (Msg.Msg = WM_SYSCHAR) and (Msg.lParam and ALT_KEY_DOWN <> 0) and + (Msg.wParam in [VK_BACK, Ord('+'), Ord('-')]) then Msg.Msg := 0; - // handle direct WndProc calls that could happen through VCL-methods like Perform - if HandleAllocated and IsWindowUnicode(Handle) then - if not FWindowProducedMessage then - begin - FWindowProducedMessage := True; - if IsTextMessage(Msg.Msg) then - begin - with Msg do - Result := SendMessageA(Handle, Msg, wParam, lParam); - Exit; - end; - end - else - FWindowProducedMessage := False; - inherited; end; procedure TCustomSynEdit.ChainListCleared(Sender: TObject); begin - if Assigned(FChainListCleared) then - FChainListCleared(Sender); - TSynEditStringList(FOrigLines).OnCleared(Sender); + if Assigned(fChainListCleared) then + fChainListCleared(Sender); + TSynEditStringList(fOrigLines).OnCleared(Sender); end; procedure TCustomSynEdit.ChainListDeleted(Sender: TObject; aIndex: Integer; aCount: Integer); begin - if Assigned(FChainListDeleted) then - FChainListDeleted(Sender, aIndex, aCount); - TSynEditStringList(FOrigLines).OnDeleted(Sender, aIndex, aCount); + if Assigned(fChainListDeleted) then + fChainListDeleted(Sender, aIndex, aCount); + TSynEditStringList(fOrigLines).OnDeleted(Sender, aIndex, aCount); end; procedure TCustomSynEdit.ChainListInserted(Sender: TObject; aIndex: Integer; aCount: Integer); begin - if Assigned(FChainListInserted) then - FChainListInserted(Sender, aIndex, aCount); - TSynEditStringList(FOrigLines).OnInserted(Sender, aIndex, aCount); + if Assigned(fChainListInserted) then + fChainListInserted(Sender, aIndex, aCount); + TSynEditStringList(fOrigLines).OnInserted(Sender, aIndex, aCount); end; -procedure TCustomSynEdit.ChainListPutted(Sender: TObject; aIndex: Integer; - aCount: Integer); +procedure TCustomSynEdit.ChainListPut(Sender: TObject; aIndex: Integer; + const OldLine: string); begin - if Assigned(FChainListPutted) then - FChainListPutted(Sender, aIndex, aCount); - TSynEditStringList(FOrigLines).OnPutted(Sender, aIndex, aCount); + if Assigned(fChainListPut) then + fChainListPut(Sender, aIndex, OldLine); + TSynEditStringList(fOrigLines).OnPut(Sender, aIndex, OldLine); end; procedure TCustomSynEdit.ChainLinesChanging(Sender: TObject); begin - if Assigned(FChainLinesChanging) then - FChainLinesChanging(Sender); - TSynEditStringList(FOrigLines).OnChanging(Sender); + if Assigned(fChainLinesChanging) then + fChainLinesChanging(Sender); + TSynEditStringList(fOrigLines).OnChanging(Sender); end; procedure TCustomSynEdit.ChainLinesChanged(Sender: TObject); begin - if Assigned(FChainLinesChanged) then - FChainLinesChanged(Sender); - TSynEditStringList(FOrigLines).OnChange(Sender); + if Assigned(fChainLinesChanged) then + fChainLinesChanged(Sender); + TSynEditStringList(fOrigLines).OnChange(Sender); end; -procedure TCustomSynEdit.ChainUndoRedoAdded(Sender: TObject); -var - iList: TSynEditUndoList; - iHandler: TNotifyEvent; +procedure TCustomSynEdit.ChainModifiedChanged(Sender: TObject); begin - if Sender = FUndoList then - begin - iList := FOrigUndoList; - iHandler := FChainUndoAdded; - end - else { if Sender = FRedoList then } - begin - iList := FOrigRedoList; - iHandler := FChainRedoAdded; - end; - if Assigned(iHandler) then - iHandler(Sender); - iList.OnAddedUndo(Sender); + if Assigned(fChainModifiedChanged) then + fChainModifiedChanged(Sender); + FOrigUndoRedo.OnModifiedChanged(Sender); end; -//++ DPI-Aware -procedure TCustomSynEdit.ChangeScale(M, D: Integer{$if CompilerVersion >= 31}; isDpiChange: Boolean{$ifend}); +procedure TCustomSynEdit.ChangeScale(M, D: Integer; isDpiChange: Boolean); begin - {$if CompilerVersion >= 31}if isDpiChange then begin{$ifend} - if Assigned(fGutter) then fGutter.ChangeScale(M,D); - if Assigned(fBookMarkOpt) then fBookMarkOpt.ChangeScale(M, D); - if Assigned(fWordWrapGlyph) then fWordWrapGlyph.ChangeScale(M, D); - {$if CompilerVersion >= 31}end;{$ifend} - inherited ChangeScale(M, D{$if CompilerVersion >= 31}, isDpiChange{$ifend}); + if isDpiChange then + begin + IncPaintLock; + try + fExtraLineSpacing := MulDiv(fExtraLineSpacing, M, D); + fTextMargin := MulDiv(fTextMargin, M, D); + FCarets.CaretSize := MulDiv(FCarets.CaretSize, M, D); + fGutter.ChangeScale(M,D); + fBookMarkOpt.ChangeScale(M, D); + fWordWrapGlyph.ChangeScale(M, D); + // Adjust Font.PixelsPerInch so that Font.Size is correct + // Delphi should be doing that but it doesn't + {$if CompilerVersion < 36} + Font.PixelsPerInch := M; + {$endif} + finally + DecPaintLock; + end; + end; + inherited ChangeScale(M, D, isDpiChange); end; -//-- DPI-Aware procedure TCustomSynEdit.UnHookTextBuffer; var vOldWrap: Boolean; begin - Assert(FChainedEditor = nil); - if FLines = FOrigLines then + Assert(fChainedEditor = nil); + if fLines = fOrigLines then Exit; vOldWrap := WordWrap; WordWrap := False; //first put back the real methods - with TSynEditStringList(FLines) do - begin - OnCleared := FChainListCleared; - OnDeleted := FChainListDeleted; - OnInserted := FChainListInserted; - OnPutted := FChainListPutted; - OnChanging := FChainLinesChanging; - OnChange := FChainLinesChanged; - end; - FUndoList.OnAddedUndo := FChainUndoAdded; - FRedoList.OnAddedUndo := FChainRedoAdded; - - FChainListCleared := nil; - FChainListDeleted := nil; - FChainListInserted := nil; - FChainListPutted := nil; - FChainLinesChanging := nil; - FChainLinesChanged := nil; - FChainUndoAdded := nil; + with TSynEditStringList(fLines) do + begin + OnCleared := fChainListCleared; + OnDeleted := fChainListDeleted; + OnInserted := fChainListInserted; + OnPut := fChainListPut; + OnChanging := fChainLinesChanging; + OnChange := fChainLinesChanged; + end; + fUndoRedo.OnModifiedChanged := fChainModifiedChanged; + + fChainListCleared := nil; + fChainListDeleted := nil; + fChainListInserted := nil; + fChainListPut := nil; + fChainLinesChanging := nil; + fChainLinesChanged := nil; + fChainModifiedChanged := nil; //make the switch - FLines := FOrigLines; - FUndoList := FOrigUndoList; - FRedoList := FOrigRedoList; + fLines := fOrigLines; + fUndoRedo := fOrigUndoRedo; LinesHookChanged; WordWrap := vOldWrap; end; -procedure TCustomSynEdit.HookTextBuffer(aBuffer: TSynEditStringList; - aUndo, aRedo: TSynEditUndoList); +procedure TCustomSynEdit.HookTextBuffer(aBuffer: TSynEditStringList; aUndoRedo: + ISynEditUndo); var vOldWrap: Boolean; begin - Assert(FChainedEditor = nil); - Assert(FLines = FOrigLines); + Assert(fChainedEditor = nil); + Assert(fLines = fOrigLines); vOldWrap := WordWrap; WordWrap := False; - if FChainedEditor <> nil then + if fChainedEditor <> nil then RemoveLinesPointer - else if FLines <> FOrigLines then + else if fLines <> fOrigLines then UnHookTextBuffer; //store the current values and put in the chained methods - FChainListCleared := aBuffer.OnCleared; + fChainListCleared := aBuffer.OnCleared; aBuffer.OnCleared := ChainListCleared; - FChainListDeleted := aBuffer.OnDeleted; + fChainListDeleted := aBuffer.OnDeleted; aBuffer.OnDeleted := ChainListDeleted; - FChainListInserted := aBuffer.OnInserted; + fChainListInserted := aBuffer.OnInserted; aBuffer.OnInserted := ChainListInserted; - FChainListPutted := aBuffer.OnPutted; - aBuffer.OnPutted := ChainListPutted; - FChainLinesChanging := aBuffer.OnChanging; + fChainListPut := aBuffer.OnPut; + aBuffer.OnPut := ChainListPut; + fChainLinesChanging := aBuffer.OnChanging; aBuffer.OnChanging := ChainLinesChanging; - FChainLinesChanged := aBuffer.OnChange; + fChainLinesChanged := aBuffer.OnChange; aBuffer.OnChange := ChainLinesChanged; - FChainUndoAdded := aUndo.OnAddedUndo; - aUndo.OnAddedUndo := ChainUndoRedoAdded; - FChainRedoAdded := aRedo.OnAddedUndo; - aRedo.OnAddedUndo := ChainUndoRedoAdded; + fChainModifiedChanged := aUndoRedo.OnModifiedChanged; + aUndoRedo.OnModifiedChanged := ChainModifiedChanged; //make the switch - FLines := aBuffer; - FUndoList := aUndo; - FRedoList := aRedo; + fLines := aBuffer; + fUndoRedo := aUndoRedo; LinesHookChanged; WordWrap := vOldWrap; end; procedure TCustomSynEdit.LinesHookChanged; -var - iLongestLineLength: Integer; begin Invalidate; - if eoAutoSizeMaxScrollWidth in FOptions then - begin - iLongestLineLength := TSynEditStringList(Lines).LengthOfLongestLine; - if iLongestLineLength > MaxScrollWidth then - MaxScrollWidth := iLongestLineLength; - end; UpdateScrollBars; end; procedure TCustomSynEdit.SetLinesPointer(ASynEdit: TCustomSynEdit); begin - HookTextBuffer(TSynEditStringList(ASynEdit.Lines), - ASynEdit.UndoList, ASynEdit.RedoList); + HookTextBuffer(TSynEditStringList(ASynEdit.Lines), ASynEdit.UndoRedo); - FChainedEditor := ASynEdit; + fChainedEditor := ASynEdit; ASynEdit.FreeNotification(Self); end; procedure TCustomSynEdit.RemoveLinesPointer; begin - {$IFDEF SYN_COMPILER_5_UP} - if Assigned(FChainedEditor) then - RemoveFreeNotification(FChainedEditor); - {$ENDIF} - FChainedEditor := nil; + if Assigned(fChainedEditor) then + RemoveFreeNotification(fChainedEditor); + fChainedEditor := nil; UnHookTextBuffer; end; -procedure TCustomSynEdit.DragCanceled; -begin - FScrollTimer.Enabled := False; - inherited; -end; - -procedure TCustomSynEdit.DragOver(Source: TObject; X, Y: Integer; - State: TDragState; var Accept: Boolean); -var - vNewPos: TDisplayCoord; +procedure TCustomSynEdit.SetRightEdge(Value: Integer); begin - inherited; - if (Source is TCustomSynEdit) and not ReadOnly then + if fRightEdge <> Value then begin - Accept := True; - - //Ctrl is pressed => change cursor to indicate copy instead of move - if GetKeyState(VK_CONTROL) < 0 then - DragCursor := crMultiDrag - else - DragCursor := crDrag; - - if Dragging then //if the drag source is the SynEdit itself + fRightEdge := Value; + // when wrapping with right edge, we must rewrap when edge is changed + if WordWrap and (eoWrapWithRightEdge in fOptions) then begin - if State = dsDragLeave then //restore prev caret position - ComputeCaret(FMouseDownX, FMouseDownY) - else - begin - vNewPos := PixelsToNearestRowColumn(X, Y); - vNewPos.Column := MinMax(vNewPos.Column, LeftChar, LeftChar + CharsInWindow - 1); - vNewPos.Row := MinMax(vNewPos.Row, TopLine, TopLine + LinesInWindow - 1); - InternalCaretXY := DisplayToBufferPos(vNewPos); - ComputeScroll(X, Y); - end; - end - else //if is dragging from another SynEdit - ComputeCaret(X, Y); //position caret under the mouse cursor - end; -end; - -procedure TCustomSynEdit.DragDrop(Source: TObject; X, Y: Integer); -var - vNewCaret: TBufferCoord; - DoDrop, DropAfter, DropMove: Boolean; - vBB, vBE: TBufferCoord; - DragDropText: UnicodeString; - ChangeScrollPastEOL: Boolean; -begin - if not ReadOnly and (Source is TCustomSynEdit) - and TCustomSynEdit(Source).SelAvail then - begin - IncPaintLock; - try - inherited; - ComputeCaret(X, Y); - vNewCaret := CaretXY; - // if from other control then move when SHIFT, else copy - // if from Self then copy when CTRL, else move - if Source <> Self then - begin - DropMove := GetKeyState(VK_SHIFT) < 0; - DoDrop := True; - DropAfter := False; - end - else - begin - DropMove := GetKeyState(VK_CONTROL) >= 0; - vBB := BlockBegin; - vBE := BlockEnd; - DropAfter := (vNewCaret.Line > vBE.Line) - or ((vNewCaret.Line = vBE.Line) and ((vNewCaret.Char > vBE.Char) or - ((not DropMove) and (vNewCaret.Char = vBE.Char)))); - DoDrop := DropAfter or (vNewCaret.Line < vBB.Line) - or ((vNewCaret.Line = vBB.Line) and ((vNewCaret.Char < vBB.Char) or - ((not DropMove) and (vNewCaret.Char = vBB.Char)))); - end; - if DoDrop then begin - BeginUndoBlock; - try - DragDropText := TCustomSynEdit(Source).SelText; - // delete the selected text if necessary - if DropMove then - begin - if Source <> Self then - TCustomSynEdit(Source).SelText := '' - else - begin - SelText := ''; - // adjust horizontal drop position - if DropAfter and (vNewCaret.Line = vBE.Line) then - Dec(vNewCaret.Char, vBE.Char - vBB.Char); - // adjust vertical drop position - if DropAfter and (vBE.Line > vBB.Line) then - Dec(vNewCaret.Line, vBE.Line - vBB.Line); - end; - end; - //todo: this is probably already done inside SelText - // insert the selected text - ChangeScrollPastEOL := not (eoScrollPastEol in FOptions); - try - if ChangeScrollPastEOL then - Include(FOptions, eoScrollPastEol); - InternalCaretXY := vNewCaret; - BlockBegin := vNewCaret; - { Add the text. Undo is locked so the action is recorded as crDragDropInsert - instead of crInsert (code right bellow). } - Assert(not SelAvail); - LockUndo; - try - SelText := DragDropText; - finally - UnlockUndo; - end; - finally - if ChangeScrollPastEOL then - Exclude(FOptions, eoScrollPastEol); - end; - // save undo information - if Source = Self then - begin - FUndoList.AddChange(crDragDropInsert, vNewCaret, BlockEnd, SelText, - FActiveSelectionMode); - end - else begin - FUndoList.AddChange(crInsert, vNewCaret, BlockEnd, - SelText, FActiveSelectionMode); - end; - BlockEnd := CaretXY; - CommandProcessor(ecSelGotoXY, #0, @vNewCaret); - finally - EndUndoBlock; - end; - end; - finally - DecPaintLock; + CalcTextAreaWidth; + fWordWrapPlugin.DisplayChanged; + EnsureCursorPosVisible; end; - end - else - inherited; -end; - -procedure TCustomSynEdit.SetRightEdge(Value: Integer); -begin - if FRightEdge <> Value then - begin - FRightEdge := Value; Invalidate; end; end; @@ -7137,12 +5806,12 @@ procedure TCustomSynEdit.SetRightEdgeColor(Value: TColor); nX: Integer; rcInval: TRect; begin - if FRightEdgeColor <> Value then + if fRightEdgeColor <> Value then begin - FRightEdgeColor := Value; + fRightEdgeColor := Value; if HandleAllocated then begin - nX := FTextOffset + FRightEdge * FCharWidth; + nX := fTextOffset + fRightEdge * fCharWidth; rcInval := Rect(nX - 1, 0, nX + 1, Height); InvalidateRect(rcInval, False); end; @@ -7151,16 +5820,17 @@ procedure TCustomSynEdit.SetRightEdgeColor(Value: TColor); function TCustomSynEdit.GetMaxUndo: Integer; begin - result := FUndoList.MaxUndoActions; + Result := fUndoRedo.MaxUndoActions; +end; + +function TCustomSynEdit.GetModified: Boolean; +begin + Result := fUndoRedo.Modified; end; procedure TCustomSynEdit.SetMaxUndo(const Value: Integer); begin - if Value > -1 then - begin - FUndoList.MaxUndoActions := Value; - FRedoList.MaxUndoActions := Value; - end; + fUndoRedo.MaxUndoActions := Value; end; procedure TCustomSynEdit.Notification(AComponent: TComponent; @@ -7169,77 +5839,73 @@ procedure TCustomSynEdit.Notification(AComponent: TComponent; inherited Notification(AComponent, Operation); if Operation = opRemove then begin - if AComponent = FSearchEngine then + if AComponent = fSearchEngine then begin SearchEngine := nil; end; - if AComponent = FHighlighter then + if AComponent = fHighlighter then begin Highlighter := nil; end; - if AComponent = FChainedEditor then + if AComponent = fChainedEditor then begin RemoveLinesPointer; end; - if (FBookMarkOpt <> nil) then - if (AComponent = FBookMarkOpt.BookmarkImages) then + if (fBookmarkOpt <> nil) then + if (AComponent = fBookmarkOpt.BookmarkImages) then begin - FBookMarkOpt.BookmarkImages := nil; + fBookmarkOpt.BookmarkImages := nil; InvalidateGutterLines(-1, -1); end; end; end; procedure TCustomSynEdit.SetHighlighter(const Value: TSynCustomHighlighter); -{$IFDEF SYN_CodeFolding} -Var - OldUseCodeFolding : Boolean; -{$ENDIF} +var + OldUseCodeFolding: Boolean; begin - if Value <> FHighlighter then + if Value <> fHighlighter then begin - if Assigned(FHighlighter) then + if Assigned(fHighlighter) then begin - FHighlighter.UnhookAttrChangeEvent(HighlighterAttrChanged); -{$IFDEF SYN_COMPILER_5_UP} - FHighlighter.RemoveFreeNotification(Self); -{$ENDIF} + fHighlighter.UnhookAttrChangeEvent(HighlighterAttrChanged); + fHighlighter.RemoveFreeNotification(Self); end; if Assigned(Value) then begin Value.HookAttrChangeEvent(HighlighterAttrChanged); Value.FreeNotification(Self); end; - FHighlighter := Value; + fHighlighter := Value; if not(csDestroying in ComponentState) then - HighlighterAttrChanged(FHighlighter); + HighlighterAttrChanged(fHighlighter); -{$IFDEF SYN_CodeFolding} // Disable Code Folding if not supported by highlighter - OldUseCodeFolding := fUseCodeFolding; - UseCodeFolding := False; - UseCodeFolding := OldUseCodeFolding; - if fHighlighter is TSynCustomCodeFoldingHighlighter then - TSynCustomCodeFoldingHighlighter(fHighlighter).InitFoldRanges(fAllFoldRanges); -{$ENDIF} + // If Loading then this is taken care of in Loaded + if not (csLoading in ComponentState) then + begin + OldUseCodeFolding := fUseCodeFolding; + UseCodeFolding := False; + UseCodeFolding := OldUseCodeFolding; + end; end; end; procedure TCustomSynEdit.SetBorderStyle(Value: TSynBorderStyle); begin - if FBorderStyle <> Value then + if fBorderStyle <> Value then begin - FBorderStyle := Value; + fBorderStyle := Value; RecreateWnd; end; end; procedure TCustomSynEdit.SetHideSelection(const Value: Boolean); begin - if FHideSelection <> Value then + if fHideSelection <> Value then begin FHideSelection := Value; InvalidateSelection; @@ -7248,9 +5914,9 @@ procedure TCustomSynEdit.SetHideSelection(const Value: Boolean); procedure TCustomSynEdit.SetInsertMode(const Value: Boolean); begin - if FInserting <> Value then + if fInserting <> Value then begin - FInserting := Value; + fInserting := Value; if not (csDesigning in ComponentState) then // Reset the caret. InitializeCaret; @@ -7261,56 +5927,189 @@ procedure TCustomSynEdit.SetInsertMode(const Value: Boolean); procedure TCustomSynEdit.InitializeCaret; var ct: TSynEditCaretType; - cw, ch: Integer; begin - // CreateCaret automatically destroys the previous one, so we don't have to - // worry about cleaning up the old one here with DestroyCaret. - // Ideally, we will have properties that control what these two carets look like. if InsertMode then ct := FInsertCaret else ct := FOverwriteCaret; case ct of ctHorizontalLine: - begin - cw := FCharWidth; - ch := 2; - FCaretOffset := Point(0, FTextHeight - 2); - end; + FCarets.Shape.Create(fCharWidth, FCarets.CaretSize, Point(0, fTextHeight - FCarets.CaretSize)); ctHalfBlock: - begin - cw := FCharWidth; - ch := (FTextHeight - 2) div 2; - FCaretOffset := Point(0, ch); - end; + FCarets.Shape.Create(fCharWidth, (fTextHeight - FCarets.CaretSize) div 2, + Point(0, (fTextHeight - FCarets.CaretSize) div 2)); ctBlock: + FCarets.Shape.Create(fCharWidth, fTextHeight - FCarets.CaretSize, Point(0, 0)); + else // ctVerticalLine + FCarets.Shape.Create(FCarets.CaretSize, fTextHeight - FCarets.CaretSize, Point(-1, 0)); + end; + fCarets.HideCarets; + + if Focused or FAlwaysShowCaret then + UpdateCarets; +end; + +procedure TCustomSynEdit.InsertCharAtCursor(const AChar: string); +{ + This is a private routine that is used in processing the + ecChar and ecIMEStr commands. + Note: AChar can be a multi-codepoint character, hence it is a string and not + a WideChar. +} + + function DeleteGrapheme(var S: string; Index: Integer): Boolean; + var + After: string; + GraphemeEnd: Integer; + begin + After := Copy(S, Index); + if After.Length = 0 then Exit(False); + + GraphemeEnd := ValidTextPos(After, 2, True); + Delete(After, 1, GraphemeEnd - 1); + + S := Copy(S, 1, Index - 1) + After; + Result := True; + end; + + procedure AutoCompleteBracketsAndQuotes(Chr: Char; InString: Boolean); + var + Len: Integer; + Line: string; + CharRight, CharLeft, TmpChar: WideChar; + begin + if (fOptions * [eoCompleteBrackets, eoCompleteQuotes] <> []) and + (FSelections.Count = 1) and (FSelection.IsEmpty) then + begin + Line := LineText; + Len := Line.Length; + + if Chr = FAutoCompleteChar then begin - cw := FCharWidth; - ch := FTextHeight - 2; - FCaretOffset := Point(0, 0); - end; - ctVerticalLine2: + if InsertMode and (CaretX <= Len) and + (Line[CaretX] = FAutoCompleteChar) then + ExecuteCommand(ecDeleteChar, WideNull, nil); + FAutoCompleteChar := #0; + end + else begin - cw := 2; - ch := FTextHeight + 1; - FCaretOffset := Point(0, 0); + CharRight := ' '; + if CaretX <= Len then + CharRight := Line[CaretX]; + if (eoCompleteBrackets in fOptions) and + IsOpeningBracket(Chr, Brackets) and + not IsOpeningBracket(CharRight, Brackets) then + begin + // Auto-complete brackets if the next Char is not an + // opening bracket + TmpChar := MatchingBracket(Chr, Brackets); + ExecuteCommand(ecChar, TmpChar, nil); + FAutoCompleteChar := TmpChar; + CaretX := CaretX - 1; + end + else if (eoCompleteQuotes in fOptions) and + CharInSet(Chr, ['"', '''']) then + begin + // Auto-complete quotes if not inside a string, the previous char + // is not a quote and the next char is not an identifier or quote + CharLeft := ' '; + if CaretX > 2 then + CharLeft := Line[CaretX - 2]; + + if not InString and + not CharInSet(CharLeft, ['"', '''']) and + not IsIdentChar(CharRight) and + not CharInSet(CharLeft, ['"', '''']) then + begin + ExecuteCommand(ecChar, Chr, nil); + FAutoCompleteChar := Chr; + CaretX := CaretX - 1; + end; + end; end; - else - begin // ctVerticalLine - cw := 2; - ch := FTextHeight - 2; - FCaretOffset := Point(-1, 0); end; end; - Exclude(FStateFlags, sfCaretVisible); - if Focused or FAlwaysShowCaret then +var + SLine, Grapheme: string; + SpaceBuffer: string; + Len, CaretXNew: Integer; + OldRow: Integer; + InString: Boolean; + Token: string; + Attri: TSynHighlighterAttributes; +begin + if ReadOnly or ((AChar.Length = 1) + and ((AChar[1] < #32) or (AChar[1] = #127))) // #127 is Ctrl+Backspace + then + Exit; + + if SelAvail then + begin + if (AChar.Length = 1) and (eoCompleteBrackets in fOptions) and + IsOpeningBracket(AChar[1], Brackets) + then + SurroundSelection(AChar, MatchingBracket(AChar[1], Brackets)) + else if (AChar.Length = 1) and (eoCompleteQuotes in fOptions) and + CharInSet(AChar[1], ['"', '''']) + then + SurroundSelection(AChar) + else + SetSelText(AChar) + end + else begin - CreateCaret(Handle, 0, cw, ch); - UpdateCaret; + // This is to set fCaretXY correctly + OldRow := BufferToDisplayPos(BufferCoord(Max(CaretX - 1, 1), CaretY)).Row; + + // for Autocomplete quotes check whether typing occurs inside a string + InString := (CaretX > 1) and Assigned(fHighlighter) and + GetHighlighterAttriAtRowCol(BufferCoord(CaretX - 1, CaretY), Token, Attri) and + (Attri = fHighlighter.StringAttribute); + + SLine := LineText; + Len := SLine.Length; + if Len < CaretX then + begin + if (Len > 0) then + SpaceBuffer := StringofChar(#32, CaretX - Len - Ord(fInserting)) + else + SpaceBuffer := GetLeftSpacing(CaretX - Len - Ord(fInserting), True); + + SLine := SLine + SpaceBuffer; + end; + + CaretXNew := IfThen(Len = 0, Length(SLine) + Ord(fInserting), CaretX); + if fInserting then + begin + Insert(AChar, SLine, CaretXNew); + Lines[CaretY - 1] := SLine; + end + else + begin + // Deal with multi-codepoint graphemes like emojis + // Delete as many graphemes as in AChar + for Grapheme in Graphemes(AChar) do + if not DeleteGrapheme(SLine, CaretXNew) then Break; + + Insert(AChar, SLine, CaretXNew); + Lines[CaretY - 1] := SLine; + end; + SetCaretInRow(BufferCoord(CaretXNew + AChar.Length, CaretY), OldRow); + + if AChar.Length = 1 then + AutoCompleteBracketsAndQuotes(AChar[1], InString); + + if not CaretInView then + LeftChar := LeftChar + Min(25, FTextAreaWidth div FCharWidth); end; end; +procedure TCustomSynEdit.SetIndentGuides(const Value: TSynIndentGuides); +begin + FIndentGuides.Assign(Value); +end; + procedure TCustomSynEdit.SetInsertCaret(const Value: TSynEditCaretType); begin if FInsertCaret <> Value then @@ -7329,15 +6128,31 @@ procedure TCustomSynEdit.SetOverwriteCaret(const Value: TSynEditCaretType); end; end; -procedure TCustomSynEdit.SetMaxScrollWidth(Value: Integer); +procedure TCustomSynEdit.EnsureCaretInView; +{ Ensure cursor is visible by moving it to the edge of the text area if needed } +var + DC, OldDC: TDisplayCoord; + MinX, MaxX: Integer; + P: TPoint; begin - Value := MinMax(Value, 1, MaxInt - 1); - if MaxScrollWidth <> Value then + if CaretInView then Exit; + + DC := DisplayXY; + OldDC := DC; + + P := RowColumnToPixels(DC); + MinX := FGutterWidth + TextMargin; + MaxX := ClientWidth - TextMargin - CharWidth; + if not InRange(P.X, MinX, MaxX) then begin - FMaxScrollWidth := Value; - if eoScrollPastEol in Options then - UpdateScrollBars; + P.X := MinMax(P.X, MinX, MaxX); + DC := PixelsToRowColumn(P.X, P.Y); end; + + if (DC <> OldDC) or + not InRange(TopLine, DC.Row - (LinesInWindow - 1), DC.Row) + then + DisplayXY := DC; end; procedure TCustomSynEdit.EnsureCursorPosVisible; @@ -7347,55 +6162,56 @@ procedure TCustomSynEdit.EnsureCursorPosVisible; procedure TCustomSynEdit.EnsureCursorPosVisibleEx(ForceToMiddle: Boolean; EvenIfVisible: Boolean = False); +{ Ensure cursor is visible by changing LeftChar and TopLine } var + DC: TDisplayCoord; + WidthToX: Integer; TmpMiddle: Integer; - VisibleX: Integer; - vCaretRow: Integer; + SRow: string; begin - HandleNeeded; + if not HandleAllocated then Exit; IncPaintLock; try + DC := DisplayXY; + SRow := Rows[DC.Row]; + // Make sure X is visible - VisibleX := DisplayX; - if VisibleX < LeftChar then - LeftChar := VisibleX - else if VisibleX >= CharsInWindow + LeftChar then - LeftChar := VisibleX - CharsInWindow + 1 + if (eoScrollPastEol in fScrollOptions) and (DC.Column > SRow.Length) then + WidthToX := TextWidth(SRow) + (DC.Column - SRow.Length) * FCharWidth + else + WidthToX := TextWidth(Copy(SRow, 1, DC.Column - 1)); + if WidthToX < (FLeftChar - 1) * FCharWidth then + LeftChar := Max(WidthToX div fCharWidth, 1) + else if WidthToX >= FTextAreaWidth + (LeftChar - 1) * FCharWidth then + LeftChar := CeilofIntDiv(WidthToX - FTextAreaWidth, FCharWidth) + 2 else LeftChar := LeftChar; // Make sure Y is visible - vCaretRow := DisplayY; if ForceToMiddle then begin - if vCaretRow < (TopLine - 1) then + if DC.Row < (TopLine - 1) then begin TmpMiddle := LinesInWindow div 2; - if vCaretRow - TmpMiddle < 0 then + if DC.Row - TmpMiddle < 0 then TopLine := 1 else - TopLine := vCaretRow - TmpMiddle + 1; + TopLine := DC.Row - TmpMiddle + 1; end - else if vCaretRow > (TopLine + (LinesInWindow - 2)) then + else if DC.Row > (TopLine + (LinesInWindow - 2)) then begin TmpMiddle := LinesInWindow div 2; - TopLine := vCaretRow - (LinesInWindow - 1) + TmpMiddle; + TopLine := DC.Row - (LinesInWindow - 1) + TmpMiddle; end { Forces to middle even if visible in viewport } else if EvenIfVisible then begin - TmpMiddle := FLinesInWindow div 2; - TopLine := vCaretRow - TmpMiddle + 1; + TmpMiddle := fLinesInWindow div 2; + TopLine := DC.Row - TmpMiddle + 1; end; end - else begin - if vCaretRow < TopLine then - TopLine := vCaretRow - else if vCaretRow > TopLine + Max(1, LinesInWindow) - 1 then - TopLine := vCaretRow - (LinesInWindow - 1) - else - TopLine := TopLine; - end; + else + TopLine := MinMax(TopLine, DC.Row - (LinesInWindow - 1), DC.Row); finally DecPaintLock; end; @@ -7404,29 +6220,84 @@ procedure TCustomSynEdit.EnsureCursorPosVisibleEx(ForceToMiddle: Boolean; procedure TCustomSynEdit.SetKeystrokes(const Value: TSynEditKeyStrokes); begin if Value = nil then - FKeyStrokes.Clear + FKeystrokes.Clear else - FKeyStrokes.Assign(Value); + FKeystrokes.Assign(Value); end; procedure TCustomSynEdit.SetDefaultKeystrokes; begin - FKeyStrokes.ResetDefaults; + FKeystrokes.ResetDefaults; +end; + +function TCustomSynEdit.TextWidth(const S: string): Integer; +begin + Result := TextWidth(PChar(S), S.Length); +end; + +function TCustomSynEdit.TextWidth(P: PChar; Len: Integer): Integer; +{ Ascii caracters are assumed to be fixed width. Remaining text sequences + are measured using TSynTextLayout } +var + Layout: TSynTextLayout; + P2, PStart, PEnd: PChar; + CopyS: string; +begin + if P^ = #0 then Exit(0); + + if scControlChars in FVisibleSpecialChars then + begin + SetString(CopyS, P, Len); + SubstituteControlChars(CopyS); + P := PChar(CopyS); + end; + + PStart := P; + PEnd:= P + Len; + Result := 0; + + while P < PEnd do + begin + while P < PEnd do + begin + case P^ of + #9: Inc(Result, fTabWidth * fCharWidth - Result mod (fTabWidth * fCharWidth)); + #32..#126, #$00A0: Inc(Result, FCharWidth); + else + Break; + end; + Inc(P); + end; + + if P >= PEnd then Break; + + // Just in case P is followed by combining characters + if (P > PStart) and not (Word((P-1)^) in [9, 32]) then + begin + Dec(P); + Dec(Result, FCharWidth); + end; + // Measure non-ascii text code points + P2 := P; + while P2 < PEnd do + begin + Inc(P2); + if Word(P2^) in [9, 65..90, 97..122] then Break; + end; + Layout.Create(FTextFormat, P, P2-P, MaxInt, fTextHeight); + Inc(Result, Round(Layout.TextMetrics.widthIncludingTrailingWhitespace)); + P := P2; + end; end; // If the translations requires Data, memory will be allocated for it via a // GetMem call. The client must call FreeMem on Data if it is not NIL. - -function TCustomSynEdit.TranslateKeyCode(Code: Word; Shift: TShiftState; +function TCustomSynEdit.TranslateKeyCode(Code: word; Shift: TShiftState; var Data: Pointer): TSynEditorCommand; var i: Integer; -{$IFNDEF SYN_COMPILER_3_UP} -const - VK_ACCEPT = $30; -{$ENDIF} begin - i := KeyStrokes.FindKeycode2(FLastKey, FLastShiftState, Code, Shift); + i := KeyStrokes.FindKeycode2(fLastKey, fLastShiftState, Code, Shift); if i >= 0 then Result := KeyStrokes[i].Command else begin @@ -7438,19 +6309,47 @@ function TCustomSynEdit.TranslateKeyCode(Code: Word; Shift: TShiftState; end; if (Result = ecNone) and (Code >= VK_ACCEPT) and (Code <= VK_SCROLL) then begin - FLastKey := Code; - FLastShiftState := Shift; + fLastKey := Code; + fLastShiftState := Shift; end else begin - FLastKey := 0; - FLastShiftState := []; + fLastKey := 0; + fLastShiftState := []; + end; +end; + +procedure TCustomSynEdit.TripleClick; +var + BB, BE: TBufferCoord; +begin + if not (eoNoSelection in fOptions) then + begin + BB := BufferCoord(1, CaretY); + if CaretY < Lines.Count then + BE := BufferCoord(1, CaretY + 1) + else + BE := BufferCoord(Length(Lines[CaretY-1]) + 1, CaretY); + SetCaretAndSelection(BE, BB, BE); end; + if Assigned(fOnTripleClick) then + fOnTripleClick(Self); end; procedure TCustomSynEdit.CommandProcessor(Command: TSynEditorCommand; AChar: WideChar; Data: Pointer); +var + CommandInfo: TSynCommandInfo; begin + if csPanning in ControlState then + begin + // As in Word, Notepad stop panning and ignore the command + Assert(Assigned(Mouse.PanningWindow)); + Mouse.PanningWindow.StopPanning; + Exit; + end; + + fUndoRedo.CommandProcessed := Command; // first the program event handler gets a chance to process the command DoOnProcessCommand(Command, AChar, Data); if Command <> ecNone then @@ -7460,92 +6359,90 @@ procedure TCustomSynEdit.CommandProcessor(Command: TSynEditorCommand; NotifyHookedCommandHandlers(False, Command, AChar, Data); // internal command handler if (Command <> ecNone) and (Command < ecUserFirst) then - ExecuteCommand(Command, AChar, Data); + begin + CommandInfo := SynCommandsInfo[Command]; + if (CommandInfo.CommandKind in [ckStandard, ckSingleCaret]) + or (FSelections.Count = 1) + then + begin + if (CommandInfo.CommandKind = ckSingleCaret) and (FSelections.Count > 1) then + FSelections.Clear(TSynSelections.TKeepSelection.ksKeepBase); + ExecuteCommand(Command, AChar, Data); + end + else + ExecuteMultiCaretCommand(Command, Achar, Data, CommandInfo); + end; // notify hooked command handlers after the command was executed inside of // the class if Command <> ecNone then NotifyHookedCommandHandlers(True, Command, AChar, Data); end; DoOnCommandProcessed(Command, AChar, Data); + fUndoRedo.CommandProcessed := ecNone; end; procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorCommand; AChar: WideChar; Data: Pointer); - - procedure SetSelectedTextEmpty; - var - vSelText: UnicodeString; - vUndoBegin, vUndoEnd: TBufferCoord; - begin - vUndoBegin := FBlockBegin; - vUndoEnd := FBlockEnd; - vSelText := SelText; - SetSelTextPrimitive(''); - if (vUndoBegin.Line < vUndoEnd.Line) or ( - (vUndoBegin.Line = vUndoEnd.Line) and (vUndoBegin.Char < vUndoEnd.Char)) then - begin - FUndoList.AddChange(crDelete, vUndoBegin, vUndoEnd, vSelText, - FActiveSelectionMode); - end - else - begin - FUndoList.AddChange(crDeleteAfterCursor, vUndoBegin, vUndoEnd, vSelText, - FActiveSelectionMode); - end; - end; - - procedure ForceCaretX(aCaretX: Integer); - var - vRestoreScroll: Boolean; - begin - vRestoreScroll := not (eoScrollPastEol in FOptions); - Include(FOptions, eoScrollPastEol); - try - InternalCaretX := aCaretX; - finally - if vRestoreScroll then - Exclude(FOptions, eoScrollPastEol); - end; - end; - var CX: Integer; Len: Integer; - Temp: UnicodeString; - Temp2: UnicodeString; - Helper: UnicodeString; - TabBuffer: UnicodeString; - SpaceBuffer: UnicodeString; + Temp: string; + Temp2: string; + Helper: string; + SpaceBuffer: string; SpaceCount1: Integer; SpaceCount2: Integer; BackCounter: Integer; - StartOfBlock: TBufferCoord; - EndOfBlock: TBufferCoord; - bChangeScroll: Boolean; moveBkm: Boolean; WP: TBufferCoord; Caret: TBufferCoord; CaretNew: TBufferCoord; + CaretXNew: Integer; counter: Integer; - InsDelta: Integer; - iUndoBegin, iUndoEnd: TBufferCoord; vCaretRow: Integer; - vTabTrim: Integer; - s: UnicodeString; - i: Integer; + SaveLastPosX: Integer; + begin + DoOnPaintTransient(ttBefore); IncPaintLock; try case Command of -// horizontal caret movement or selection - ecLeft, ecSelLeft: - MoveCaretHorz(-1, Command = ecSelLeft); - ecRight, ecSelRight: - MoveCaretHorz(1, Command = ecSelRight); + ecCancelSelections: + begin + if FSelections.Count = 1 then + CaretXY := CaretXY // removes selection + else + FSelections.Clear(ksKeepBase); + end; + ecDeleteSelections: + begin + SelText := ''; + end; + // horizontal caret movement or selection + ecLeft, ecSelLeft, ecSelColumnLeft: + if not FSelection.IsEmpty and (Command = ecLeft) then + CaretXY := FSelection.Normalized.Start + else + begin + Caret := ColumnSelectionStart; + MoveCaretHorz(-1, Command = ecSelLeft); + if Command = ecSelColumnLeft then + FSelections.ColumnSelection(Caret, CaretXY, FLastPosX); + end; + ecRight, ecSelRight, ecSelColumnRight: + if not FSelection.IsEmpty and (Command = ecRight) then + CaretXY := FSelection.Normalized.Stop + else + begin + Caret := ColumnSelectionStart; + MoveCaretHorz(1, Command = ecSelRight); + if Command = ecSelColumnRight then + FSelections.ColumnSelection(Caret, CaretXY, FLastPosX); + end; ecPageLeft, ecSelPageLeft: - MoveCaretHorz(-CharsInWindow, Command = ecSelPageLeft); + MoveCaretHorz(-(FTextAreaWidth div FCharWidth), Command = ecSelPageLeft); ecPageRight, ecSelPageRight: - MoveCaretHorz(CharsInWindow, Command = ecSelPageRight); + MoveCaretHorz(FTextAreaWidth div FCharWidth, Command = ecSelPageRight); ecLineStart, ecSelLineStart: begin DoHomeKey(Command = ecSelLineStart); @@ -7553,74 +6450,106 @@ procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorCommand; AChar: WideC ecLineEnd, ecSelLineEnd: DoEndKey(Command = ecSelLineEnd); // vertical caret movement or selection - ecUp, ecSelUp: + ecUp, ecSelUp, ecSelColumnUp: begin - MoveCaretVert(-1, Command = ecSelUp); - Update; + Caret := ColumnSelectionStart; + { on the first line we select first line too } + if DisplayY = 1 then + begin + SaveLastPosX := FLastPosX; + DoHomeKey(Command = ecSelUp); + FLastPosX := SaveLastPosX; + end + else + MoveCaretVert(-1, Command = ecSelUp); + + if Command = ecSelColumnUp then + FSelections.ColumnSelection(Caret, CaretXY, FLastPosX); end; - ecDown, ecSelDown: + ecDown, ecSelDown, ecSelColumnDown: begin - MoveCaretVert(1, Command = ecSelDown); - Update; + Caret := ColumnSelectionStart; + { on the last line we will select last line too } + if ((not Wordwrap and (CaretY = Lines.Count)) or + (WordWrap and (DisplayY = fWordWrapPlugin.RowCount))) then + begin + SaveLastPosX := FLastPosX; + DoEndKey(Command = ecSelDown); + FLastPosX := SaveLastPosX; + end + else + MoveCaretVert(1, Command = ecSelDown); + + if Command = ecSelColumnDown then + FSelections.ColumnSelection(Caret, CaretXY, FLastPosX); end; - ecPageUp, ecSelPageUp, ecPageDown, ecSelPageDown: + ecPageUp, ecSelPageUp, ecPageDown, ecSelPageDown, ecSelColumnPageUp, ecSelColumnPageDown: begin - counter := FLinesInWindow shr Ord(eoHalfPageScroll in FOptions); - if eoScrollByOneLess in FOptions then + Caret := ColumnSelectionStart; + counter := fLinesInWindow shr Ord(eoHalfPageScroll in fScrollOptions); + if eoScrollByOneLess in fScrollOptions then Dec(counter); - if (Command in [ecPageUp, ecSelPageUp]) then + if (Command in [ecPageUp, ecSelPageUp, ecSelColumnPageUp]) then counter := -counter; TopLine := TopLine + counter; - MoveCaretVert(counter, Command in [ecSelPageUp, ecSelPageDown]); - Update; + { on the first line we will select first line too } + if (Command in [ecPageUp, ecSelPageUp, ecSelColumnPageUp]) and (DisplayY = 1) then + begin + SaveLastPosX := FLastPosX; + DoHomeKey(Command = ecSelPageUp); + FLastPosX := SaveLastPosX; + end + else + { on the last line we will select last line too } + if (Command in [ecPageDown, ecSelPageDown, ecSelColumnPageDown]) and + ((not Wordwrap and (CaretY = Lines.Count)) or + (WordWrap and (DisplayY = fWordWrapPlugin.RowCount))) then + begin + SaveLastPosX := FLastPosX; + DoEndKey(Command = ecSelPageDown); + FLastPosX := SaveLastPosX; + end + else + MoveCaretVert(counter, Command in [ecSelPageUp, ecSelPageDown]); + + if Command in [ecSelColumnPageUp, ecSelColumnPageDown] then + FSelections.ColumnSelection(Caret, CaretXY, FLastPosX); end; ecPageTop, ecSelPageTop: begin - CaretNew := DisplayToBufferPos( - DisplayCoord(DisplayX, TopLine) ); - MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelPageTop); - Update; + MoveDisplayPosAndSelection(DisplayCoord(DisplayX, TopLine), + Command = ecSelPageTop); end; ecPageBottom, ecSelPageBottom: begin - CaretNew := DisplayToBufferPos( - DisplayCoord(DisplayX, TopLine + LinesInWindow -1) ); - MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelPageBottom); - Update; + MoveDisplayPosAndSelection( + DisplayCoord(DisplayX, TopLine + LinesInWindow -1), + Command = ecSelPageBottom); end; ecEditorTop, ecSelEditorTop: begin - CaretNew.Char := 1; - CaretNew.Line := 1; - MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelEditorTop); - Update; + MoveDisplayPosAndSelection(DisplayCoord(1, 1), + Command = ecSelEditorTop); end; ecEditorBottom, ecSelEditorBottom: begin - CaretNew.Char := 1; - CaretNew.Line := Lines.Count; - if (CaretNew.Line > 0) then - CaretNew.Char := Length(Lines[CaretNew.Line - 1]) + 1; - MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelEditorBottom); - Update; + CaretNew := BufferCoord(1, Max(1, Lines.Count)); + if (Lines.Count > 0) then + CaretNew.Char := Lines[CaretNew.Line - 1].Length + 1; + MoveCaretAndSelection(CaretNew, Command = ecSelEditorBottom); end; -// goto special line / column position ecGotoXY, ecSelGotoXY: if Assigned(Data) then - begin - MoveCaretAndSelection(CaretXY, TBufferCoord(Data^), Command = ecSelGotoXY); - Update; - end; -// Word selection + MoveCaretAndSelection(TBufferCoord(Data^), Command = ecSelGotoXY); ecWordLeft, ecSelWordLeft: begin CaretNew := PrevWordPos; - MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelWordLeft); + MoveCaretAndSelection(CaretNew, Command = ecSelWordLeft); end; ecWordRight, ecSelWordRight: begin CaretNew := NextWordPos; - MoveCaretAndSelection(CaretXY, CaretNew, Command = ecSelWordRight); + MoveCaretAndSelection(CaretNew, Command = ecSelWordRight); end; ecSelWord: begin @@ -7632,326 +6561,219 @@ procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorCommand; AChar: WideC end; ecDeleteLastChar: if not ReadOnly then begin - DoOnPaintTransientEx(ttBefore,true); - try - if SelAvail then - SetSelectedTextEmpty - else begin - Temp := LineText; - TabBuffer := TSynEditStringList(Lines).ExpandedStrings[CaretY - 1]; - Len := Length(Temp); - Caret := CaretXY; - vTabTrim := 0; - if CaretX > Len + 1 then + if SelAvail then + SetSelText('') + else begin + Temp := LineText; + Len := Length(Temp); + Caret := CaretXY; + if CaretX > Len + 1 then + begin + if eoSmartTabDelete in fOptions then begin - Helper := ''; - if eoSmartTabDelete in FOptions then - begin - //It's at the end of the line, move it to the length - if Len > 0 then - InternalCaretX := Len + 1 - else begin - //move it as if there were normal spaces there - SpaceCount1 := CaretX - 1; - SpaceCount2 := 0; - // unindent - if SpaceCount1 > 0 then + //It's at the end of the line, move it to the length + if Len > 0 then + CaretX := Len + 1 + else begin + //move it as if there were normal spaces there + SpaceCount1 := CaretX - 1; + SpaceCount2 := 0; + // unindent + if SpaceCount1 > 0 then + begin + BackCounter := CaretY - 2; + while BackCounter >= 0 do begin - BackCounter := CaretY - 2; - //It's better not to have if statement inside loop - if (eoTrimTrailingSpaces in Options) then - while BackCounter >= 0 do - begin - SpaceCount2 := LeftSpacesEx(Lines[BackCounter], True); - if (SpaceCount2 > 0) and (SpaceCount2 < SpaceCount1) then - Break; - Dec(BackCounter); - end - else - while BackCounter >= 0 do - begin - SpaceCount2 := LeftSpaces(Lines[BackCounter]); - if (SpaceCount2 > 0) and (SpaceCount2 < SpaceCount1) then - Break; - Dec(BackCounter); - end; - if (BackCounter = -1) and (SpaceCount2 > SpaceCount1) then - SpaceCount2 := 0; + SpaceCount2 := LeftSpaces(Lines[BackCounter], False); + if (SpaceCount2 > 0) and (SpaceCount2 < SpaceCount1) then + Break; + Dec(BackCounter); end; - if SpaceCount2 = SpaceCount1 then + if (BackCounter = -1) and (SpaceCount2 > SpaceCount1) then SpaceCount2 := 0; - FCaretX := FCaretX - (SpaceCount1 - SpaceCount2); - UpdateLastCaretX; - FStateFlags := FStateFlags + [sfCaretChanged]; - StatusChanged([scCaretX]); end; - end - else begin - // only move caret one column - InternalCaretX := CaretX - 1; - end; - end else if CaretX = 1 then begin - // join this line with the last line if possible - if CaretY > 1 then - begin - InternalCaretY := CaretY - 1; - InternalCaretX := Length(Lines[CaretY - 1]) + 1; - Lines.Delete(CaretY); - DoLinesDeleted(CaretY+1, 1); - if eoTrimTrailingSpaces in Options then - Temp := TrimTrailingSpaces(Temp); - - LineText := LineText + Temp; - Helper := #13#10; + if SpaceCount2 = SpaceCount1 then + SpaceCount2 := 0; + CaretX := CaretX - (SpaceCount1 - SpaceCount2); end; end else begin - // delete text before the caret - SpaceCount1 := LeftSpaces(Temp); - SpaceCount2 := 0; - if (Temp[CaretX - 1] <= #32) and (SpaceCount1 = CaretX - 1) then + // only move caret one column + CaretX := CaretX - 1; + end; + end // CaretX > Len + 1 + else if CaretX = 1 then + begin + // join this line with the last line if possible + if CaretY > 1 then + begin + Lines.BeginUpdate; + BeginUndoBlock; + try + CaretXNew := Lines[CaretY - 2].Length + 1; + Lines[CaretY - 1] := Lines[CaretY - 2] + Temp; + Lines.Delete(CaretY - 2); + CaretXY := BufferCoord(CaretXNew, CaretY - 1); + finally + EndUndoBlock; + Lines.EndUpdate; + end; + end; + end + else begin + // delete text before the caret + if ((Temp[CaretX - 1] <= #32) or (Temp[CaretX - 1] = #$00A0)) + and (LeftSpaces(Temp, False) = CaretX - 1) then + begin + SpaceCount1 := LeftSpaces(Temp, True, FTabWidth); + Assert(SpaceCount1 > 0); + // only spaces - special treatment + if eoSmartTabDelete in fOptions then begin - if eoSmartTabDelete in FOptions then + // unindent + SpaceCount2 := 0; + BackCounter := CaretY - 2; + while BackCounter >= 0 do begin - // unindent - if SpaceCount1 > 0 then - begin - BackCounter := CaretY - 2; - //It's better not to have if statement inside loop - if (eoTrimTrailingSpaces in Options) then - while BackCounter >= 0 do - begin - SpaceCount2 := LeftSpacesEx(Lines[BackCounter], True); - if (SpaceCount2 > 0) and (SpaceCount2 < SpaceCount1) then - Break; - Dec(BackCounter); - end - else - while BackCounter >= 0 do - begin - SpaceCount2 := LeftSpaces(Lines[BackCounter]); - if (SpaceCount2 > 0) and (SpaceCount2 < SpaceCount1) then - Break; - Dec(BackCounter); - end; - if (BackCounter = -1) and (SpaceCount2 > SpaceCount1) then - SpaceCount2 := 0; - end; - if SpaceCount2 = SpaceCount1 then - SpaceCount2 := 0; - Helper := Copy(Temp, 1, SpaceCount1 - SpaceCount2); - Delete(Temp, 1, SpaceCount1 - SpaceCount2); - end - else begin - SpaceCount2 := SpaceCount1; - //how much till the next tab column - BackCounter := (DisplayX - 1) mod FTabWidth; - if BackCounter = 0 then BackCounter := FTabWidth; - - SpaceCount1 := 0; - CX := DisplayX - BackCounter; - while (SpaceCount1 < FTabWidth) and - (SpaceCount1 < BackCounter) and - (TabBuffer[CX] <> #9) do - begin - Inc(SpaceCount1); - Inc(CX); - end; - {$IFOPT R+} - // Avoids an exception when compiled with $R+. - // 'CX' can be 'Length(TabBuffer)+1', which isn't an AV and evaluates - //to #0. But when compiled with $R+, Delphi raises an Exception. - if CX <= Length(TabBuffer) then - {$ENDIF} - if TabBuffer[CX] = #9 then - SpaceCount1 := SpaceCount1 + 1; - - if SpaceCount2 = SpaceCount1 then - begin - Helper := Copy(Temp, 1, SpaceCount1); - Delete(Temp, 1, SpaceCount1); - end - else begin - Helper := Copy(Temp, SpaceCount2 - SpaceCount1 + 1, SpaceCount1); - Delete(Temp, SpaceCount2 - SpaceCount1 + 1, SpaceCount1); - end; - SpaceCount2 := 0; + Temp2 := Lines[BackCounter]; + SpaceCount2 := LeftSpaces(Temp2, True, FTabWidth); + if (Temp2.Length > 0) and (SpaceCount2 < SpaceCount1) then + Break; + Dec(BackCounter); end; - FCaretX := FCaretX - (SpaceCount1 - SpaceCount2); - UpdateLastCaretX; - // Stores the previous "expanded" CaretX if the line contains tabs. - if (eoTrimTrailingSpaces in Options) and (Len <> Length(TabBuffer)) then - vTabTrim := CharIndex2CaretPos(CaretX, TabWidth, Temp); - ProperSetLine(CaretY - 1, Temp); - FStateFlags := FStateFlags + [sfCaretChanged]; - StatusChanged([scCaretX]); - // Calculates a delta to CaretX to compensate for trimmed tabs. - if vTabTrim <> 0 then - if Length(Temp) <> Length(LineText) then - Dec(vTabTrim, CharIndex2CaretPos(CaretX, TabWidth, LineText)) - else - vTabTrim := 0; + if (BackCounter = -1) and (SpaceCount2 >= SpaceCount1) then + SpaceCount2 := 0; end - else begin - // delete char - counter := 1; - InternalCaretX := CaretX - counter; - // Stores the previous "expanded" CaretX if the line contains tabs. - if (eoTrimTrailingSpaces in Options) and (Len <> Length(TabBuffer)) then - vTabTrim := CharIndex2CaretPos(CaretX, TabWidth, Temp); - Helper := Copy(Temp, CaretX, counter); - Delete(Temp, CaretX, counter); - ProperSetLine(CaretY - 1, Temp); - // Calculates a delta to CaretX to compensate for trimmed tabs. - if vTabTrim <> 0 then - if Length(Temp) <> Length(LineText) then - Dec(vTabTrim, CharIndex2CaretPos(CaretX, TabWidth, LineText)) - else - vTabTrim := 0; - end; - end; - if (Caret.Char <> CaretX) or (Caret.Line <> CaretY) then - begin - FUndoList.AddChange(crSilentDelete, CaretXY, Caret, Helper, - smNormal); - if vTabTrim <> 0 then - ForceCaretX(CaretX + vTabTrim); + else + SpaceCount2 := SpaceCount1 - (SpaceCount1 - 1) mod TabWidth - 1; + Delete(Temp, 1, LeftSpaces(Temp, False)); + Temp2 := GetLeftSpacing(SpaceCount2, True); + Temp := Temp2 + Temp; + CaretXNew := Temp2.Length + 1; + Lines[CaretY - 1] := Temp; + CaretX := CaretXNew; + end + else begin + // delete char accounting for surrogate pairs + CaretXNew := CaretX - 1; + if (CaretXNew > 1) and Temp[CaretXNew].IsLowSurrogate then + Dec(CaretXNew); + Delete(Temp, CaretXNew, CaretX - CaretXNew); + CaretNew := BufferCoord(CaretXNew, CaretY); + vCaretRow := BufferToDisplayPos(CaretNew).Row; + Lines[CaretY - 1] := Temp; + SetCaretInRow(CaretNew, vCaretRow); // to deal with FCaretEOL end; end; - EnsureCursorPosVisible; - finally - DoOnPaintTransientEx(ttAfter,true); end; + EnsureCursorPosVisible; end; ecDeleteChar: if not ReadOnly then begin - DoOnPaintTransient(ttBefore); if SelAvail then - SetSelectedTextEmpty + SetSelText('') else begin - // Call UpdateLastCaretX. Even though the caret doesn't move, the + // Call UpdateLastPosX. Even though the caret doesn't move, the // current caret position should "stick" whenever text is modified. - UpdateLastCaretX; + UpdateLastPosX; Temp := LineText; Len := Length(Temp); if CaretX <= Len then begin // delete char - counter := 1; - Helper := Copy(Temp, CaretX, counter); - Caret.Char := CaretX + counter; - Caret.Line := CaretY; - Delete(Temp, CaretX, counter); - ProperSetLine(CaretY - 1, Temp); + vCaretRow := DisplayY; + CaretXNew := ValidTextPos(BufferCoord(CaretX + 1, CaretY), True).Char; + Delete(Temp, CaretX, CaretXNew - CaretX); + Lines[CaretY - 1] := Temp; + SetCaretInRow(CaretXY, vCaretRow); // to deal with FCaretEOL end else begin // join line with the line after if CaretY < Lines.Count then begin - Helper := UnicodeStringOfChar(#32, CaretX - 1 - Len); - ProperSetLine(CaretY - 1, Temp + Helper + Lines[CaretY]); - Caret.Char := 1; - Caret.Line := CaretY + 1; - Helper := #13#10; - Lines.Delete(CaretY); - DoLinesDeleted(CaretY +1, 1); + Lines.BeginUpdate; + BeginUndoBlock; + try + Helper := StringofChar(#32, CaretX - 1 - Len); + Lines[CaretY] := Temp + Helper + Lines[CaretY]; + Lines.Delete(CaretY - 1); + finally + EndUndoBlock; + Lines.EndUpdate; + end; end; end; - if (Caret.Char <> CaretX) or (Caret.Line <> CaretY) then - begin - FUndoList.AddChange(crSilentDeleteAfterCursor, CaretXY, Caret, - Helper, smNormal); - end; end; - DoOnPaintTransient(ttAfter); end; ecDeleteWord, ecDeleteEOL: - if not ReadOnly then begin - DoOnPaintTransient(ttBefore); + if not ReadOnly then + begin Len := Length(LineText); if Command = ecDeleteWord then begin - WP := WordEnd; - Temp := LineText; - if (WP.Char < CaretX) or ((WP.Char = CaretX) and (WP.Line < FLines.Count)) then + // in case of ident char, we delete word else char + WP := CaretXY; + // as first we skip all white chars behind cursor + if (Len > WP.Char) and IsWhiteChar(LineText[WP.Char]) then begin - if WP.Char > Len then - begin - Inc(WP.Line); - WP.Char := 1; - Temp := Lines[WP.Line - 1]; - end - else if Temp[WP.Char] <> #32 then - Inc(WP.Char); + cx := StrScanForCharInCategory(LineText, WP.Char, IsNonWhiteChar); + // if not found, StrScanForCharInCategory() returns zero + WP.Char := Max(WP.Char, cx); + end; + // in case of not ident char we move one char right + if (Len > WP.Char) and not IsIdentChar(LineText[WP.Char]) then + WP.Char := WP.Char + 1 + // in case of ident char, we move to word end + else + WP := WordEndEx(WP); + // now we skip whitespaces behind + if (Len > WP.Char) and IsWhiteChar(LineText[WP.Char]) then + begin + cx := StrScanForCharInCategory(LineText, WP.Char, IsNonWhiteChar); + // if not found, StrScanForCharInCategory() returns 0 + WP.Char := Max(WP.Char, cx); end; - {$IFOPT R+} - Temp := Temp + #0; - {$ENDIF} - if Temp <> '' then - while Temp[WP.Char] = #32 do - Inc(WP.Char); end else begin WP.Char := Len + 1; WP.Line := CaretY; end; - if (WP.Char <> CaretX) or (WP.Line <> CaretY) then + + if (WP > CaretXY) and (WP.Line = CaretY) then begin - SetBlockBegin(CaretXY); - SetBlockEnd(WP); - ActiveSelectionMode := smNormal; - Helper := SelText; - SetSelTextPrimitive(UnicodeStringOfChar(' ', CaretX - BlockBegin.Char)); - FUndoList.AddChange(crSilentDeleteAfterCursor, CaretXY, WP, - Helper, smNormal); - InternalCaretXY := CaretXY; + Temp := Lines[CaretY - 1]; + Delete(Temp, CaretX, WP.Char - CaretX); + Lines[CaretY - 1] := Temp; end; end; ecDeleteLastWord, ecDeleteBOL: if not ReadOnly then begin - DoOnPaintTransient(ttBefore); if Command = ecDeleteLastWord then - WP := PrevWordPos + begin + // we must find word end first + WP := CaretXY; + // in case scroll past EOL cursor can be behind the line end + WP.Char := Min(Length(LineText), WP.Char); + if (WP.Char > 1) and IsWordBreakChar(LineText[WP.Char - 1]) then + WP.Char := StrRScanForCharInCategory(LineText, WP.Char - 1, IsIdentChar) + 1; + // now we move to word start + WP := WordStartEx(WP); + end else begin WP.Char := 1; WP.Line := CaretY; end; - if (WP.Char <> CaretX) or (WP.Line <> CaretY) then + if (WP < CaretXY) and (WP.Line = CaretY) then begin - SetBlockBegin(CaretXY); - SetBlockEnd(WP); - ActiveSelectionMode := smNormal; - Helper := SelText; - SetSelTextPrimitive(''); - FUndoList.AddChange(crSilentDelete, WP, CaretXY, Helper, - smNormal); - InternalCaretXY := WP; + Temp := Lines[CaretY - 1]; + Delete(Temp, WP.Char, CaretX - WP.Char); + Lines[CaretY - 1] := Temp; + CaretXY := WP; end; - DoOnPaintTransient(ttAfter); end; ecDeleteLine: - if not ReadOnly and (Lines.Count > 0) and not ((CaretY = Lines.Count) and (Length(Lines[CaretY - 1]) = 0)) - then begin - DoOnPaintTransient(ttBefore); - if SelAvail then - SetBlockBegin(CaretXY); - Helper := LineText; - if CaretY = Lines.Count then - begin - Lines[CaretY - 1] := ''; - FUndoList.AddChange(crSilentDeleteAfterCursor, BufferCoord(1, CaretY), - BufferCoord(Length(Helper) + 1, CaretY), Helper, smNormal); - end - else begin - Lines.Delete(CaretY - 1); - Helper := Helper + #13#10; - FUndoList.AddChange(crSilentDeleteAfterCursor, BufferCoord(1, CaretY), - BufferCoord(1, CaretY + 1), Helper, smNormal); - DoLinesDeleted(CaretY, 1); - end; - InternalCaretXY := BufferCoord(1, CaretY); // like seen in the Delphi editor - end; + ExecCmdDeleteLine; ecClearAll: begin if not ReadOnly then ClearAll; @@ -7959,240 +6781,80 @@ procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorCommand; AChar: WideC ecInsertLine, ecLineBreak: if not ReadOnly then begin - UndoList.BeginBlock; + Lines.BeginUpdate; + BeginUndoBlock; try - if SelAvail then - begin - Helper := SelText; - iUndoBegin := FBlockBegin; - iUndoEnd := FBlockEnd; - SetSelTextPrimitive(''); - FUndoList.AddChange(crDelete, iUndoBegin, iUndoEnd, Helper, - FActiveSelectionMode); - end; - Temp := LineText; - Temp2 := Temp; -// This is sloppy, but the Right Thing would be to track the column of markers -// too, so they could be moved depending on whether they are after the caret... - InsDelta := Ord(CaretX = 1); - Len := Length(Temp); - if Len > 0 then - begin - if Len >= CaretX then + if SelAvail then + SetSelText(''); + Temp := LineText; + Temp2 := Temp; + Len := Length(Temp); + if (Len > 0) and (CaretX <= Len) then begin if CaretX > 1 then begin Temp := Copy(LineText, 1, CaretX - 1); - SpaceCount1 := LeftSpacesEx(Temp,true); + if eoAutoIndent in Options then + SpaceCount1 := LeftSpaces(Temp, True, FTabWidth) + else + SpaceCount1 := 0; Delete(Temp2, 1, CaretX - 1); - Lines.Insert(CaretY, GetLeftSpacing(SpaceCount1, True) + Temp2); - ProperSetLine(CaretY - 1, Temp); - FUndoList.AddChange(crLineBreak, CaretXY, CaretXY, Temp2, - smNormal); + SpaceBuffer := GetLeftSpacing(SpaceCount1, True); + Lines.Insert(CaretY - 1, Temp); + Lines[CaretY] := SpaceBuffer + Temp2; if Command = ecLineBreak then - InternalCaretXY := BufferCoord( - Length(GetLeftSpacing(SpaceCount1,true)) + 1, - CaretY + 1); + CaretXY := BufferCoord(SpaceBuffer.Length + 1, CaretY + 1); end else begin Lines.Insert(CaretY - 1, ''); - FUndoList.AddChange(crLineBreak, CaretXY, CaretXY, Temp2, - smNormal); if Command = ecLineBreak then - InternalCaretY := CaretY + 1; + CaretY := CaretY + 1; end; - end + end // (Len > 0) and (CaretX < Len) else begin + // either empty or at the end of line: insert new line below + if fLines.Count = 0 then + fLines.Add(''); SpaceCount2 := 0; - BackCounter := CaretY; - if eoAutoIndent in Options then + // Autoindent only in case we are not at the start of the line + if (eoAutoIndent in Options) and (CaretX > 1) then begin + BackCounter := CaretY; repeat Dec(BackCounter); Temp := Lines[BackCounter]; - SpaceCount2 := LeftSpaces(Temp); + SpaceCount2 := LeftSpaces(Temp, True, FTabWidth); until (BackCounter = 0) or (Temp <> ''); end; - Lines.Insert(CaretY, ''); - Caret := CaretXY; - - FUndoList.AddChange(crLineBreak, Caret, Caret, '', smNormal); //KV + SpaceBuffer := GetLeftSpacing(SpaceCount2, True); + Lines.Insert(CaretY, SpaceBuffer); if Command = ecLineBreak then - begin - InternalCaretXY := BufferCoord(1, CaretY +1); - if SpaceCount2 > 0 then - begin - SpaceBuffer := Copy(Lines[BackCounter], 1, SpaceCount2); - for i := 1 to Length(SpaceBuffer) do - if SpaceBuffer[i] = #9 then - CommandProcessor(ecTab, #0, nil) - else - CommandProcessor(ecChar, SpaceBuffer[i], nil); - end; - end; - end; - end - else begin - if FLines.Count = 0 then - FLines.Add(''); - SpaceCount2 := 0; - if eoAutoIndent in Options then - begin - BackCounter := CaretY - 1; - while BackCounter >= 0 do - begin - SpaceCount2 := LeftSpacesEx(Lines[BackCounter],True); - if Length(Lines[BackCounter]) > 0 then - Break; - Dec(BackCounter); - end; + CaretXY := BufferCoord(SpaceBuffer.Length + 1, CaretY + 1); end; - Lines.Insert(CaretY - 1, ''); - FUndoList.AddChange(crLineBreak, CaretXY, CaretXY, '', smNormal); - if Command = ecLineBreak then - InternalCaretX := SpaceCount2 + 1; - if Command = ecLineBreak then - InternalCaretY := CaretY + 1; - end; - DoLinesInserted(CaretY - InsDelta, 1); - BlockBegin := CaretXY; - BlockEnd := CaretXY; - EnsureCursorPosVisible; - UpdateLastCaretX; + UpdateLastPosX; finally - UndoList.EndBlock; + EndUndoBlock; + Lines.EndUpdate; end; end; ecTab: if not ReadOnly then DoTabKey; ecShiftTab: if not ReadOnly then DoShiftTabKey; - ecMatchBracket: - FindMatchingBracket; - ecChar: - // #127 is Ctrl + Backspace, #32 is space - if not ReadOnly and (AChar >= #32) and (AChar <> #127) then + ecMatchBracket, + ecSelMatchBracket: begin - if SelAvail then - begin - BeginUndoBlock; - try - Helper := SelText; - iUndoBegin := FBlockBegin; - iUndoEnd := FBlockEnd; - StartOfBlock := BlockBegin; - if FActiveSelectionMode = smLine then - StartOfBlock.Char := 1; - FUndoList.AddChange(crDelete, iUndoBegin, iUndoEnd, Helper, - FActiveSelectionMode); - SetSelTextPrimitive(AChar); - if FActiveSelectionMode <> smColumn then - begin - FUndoList.AddChange(crInsert, StartOfBlock, BlockEnd, '', - smNormal); - end; - finally - EndUndoBlock; - end; - end - else - begin - SpaceCount2 := 0; - Temp := LineText; - Len := Length(Temp); - if Len < CaretX then - begin - if (Len > 0) then - SpaceBuffer := UnicodeStringOfChar(#32, CaretX - Len - Ord(FInserting)) - else - SpaceBuffer := GetLeftSpacing(CaretX - Len - Ord(FInserting), True); - SpaceCount2 := Length(SpaceBuffer); - - Temp := Temp + SpaceBuffer; - end; - // Added the check for whether or not we're in insert mode. - // If we are, we append one less space than we would in overwrite mode. - // This is because in overwrite mode we have to put in a final space - // character which will be overwritten with the typed character. If we put the - // extra space in in insert mode, it would be left at the end of the line and - // cause problems unless eoTrimTrailingSpaces is set. - bChangeScroll := not (eoScrollPastEol in FOptions); - try - if bChangeScroll then Include(FOptions, eoScrollPastEol); - StartOfBlock := CaretXY; - - if FInserting then - begin - if not WordWrap and not (eoAutoSizeMaxScrollWidth in Options) - and (CaretX > MaxScrollWidth) then - begin - Exit; - end; - Insert(AChar, Temp, CaretX); - if (eoTrimTrailingSpaces in Options) and ((AChar = #9) or (AChar = #32)) and (Length(TrimTrailingSpaces(LineText)) = 0) then - InternalCaretX := GetExpandedLength(Temp, TabWidth) + 1 - else - begin - if Len = 0 then - InternalCaretX := Length(Temp) + 1 - else - InternalCaretX := CaretX + 1; - end; - ProperSetLine(CaretY - 1, Temp); - if SpaceCount2 > 0 then - begin - BeginUndoBlock; - try - //if we inserted spaces with this char, we need to account for those - //in the X Position - StartOfBlock.Char := StartOfBlock.Char - SpaceCount2; - EndOfBlock := CaretXY; - EndOfBlock.Char := EndOfBlock.Char - 1; - //The added whitespace - FUndoList.AddChange(crWhiteSpaceAdd, EndOfBlock, StartOfBlock, '', - smNormal); - StartOfBlock.Char := StartOfBlock.Char + SpaceCount2; - - FUndoList.AddChange(crInsert, StartOfBlock, CaretXY, '', - smNormal); - finally - EndUndoBlock; - end; - end - else begin - FUndoList.AddChange(crInsert, StartOfBlock, CaretXY, '', - smNormal); - end; - end - else begin -// Processing of case character covers on LeadByte. - counter := 1; - Helper := Copy(Temp, CaretX, counter); - Temp[CaretX] := AChar; - CaretNew.Char := CaretX + counter; - CaretNew.Line := CaretY; - ProperSetLine(CaretY - 1, Temp); - FUndoList.AddChange(crInsert, StartOfBlock, CaretNew, Helper, - smNormal); - InternalCaretX := CaretX + 1; - end; - if CaretX >= LeftChar + FCharsInWindow then - LeftChar := LeftChar + Min(25, FCharsInWindow - 1); - finally - if bChangeScroll then Exclude(FOptions, eoScrollPastEol); - end; - end; - DoOnPaintTransient(ttAfter); + CaretNew := GetMatchingBracket; + if CaretNew.IsValid then + MoveCaretAndSelection(CaretNew, Command = ecSelMatchBracket); end; + ecChar: + InsertCharAtCursor(AChar); ecUpperCase, ecLowerCase, ecToggleCase, - ecTitleCase, - ecUpperCaseBlock, - ecLowerCaseBlock, - ecToggleCaseBlock, - ecTitleCaseBlock: - if not ReadOnly then DoCaseChange(Command); + ecTitleCase: + ExecCmdCaseChange(Command); ecUndo: begin if not ReadOnly then Undo; @@ -8201,6 +6863,10 @@ procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorCommand; AChar: WideC begin if not ReadOnly then Redo; end; + ecNextChange: + GotoNextChange; + ecPreviousChange: + GotoPrevChange; ecGotoMarker0..ecGotoMarker9: begin if BookMarkOptions.EnableKeys then @@ -8215,9 +6881,9 @@ procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorCommand; AChar: WideC Caret := TBufferCoord(Data^) else Caret := CaretXY; - if assigned(FBookMarks[CX]) then + if assigned(fBookMarks[CX]) then begin - moveBkm := (FBookMarks[CX].Line <> Caret.Line); + moveBkm := (fBookMarks[CX].Line <> Caret.Line); ClearBookMark(CX); if moveBkm then SetBookMark(CX, Caret.Char, Caret.Line); @@ -8228,7 +6894,7 @@ procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorCommand; AChar: WideC end; ecCut: begin - if (not ReadOnly) and SelAvail then + if not ReadOnly then CutToClipboard; end; ecCopy: @@ -8237,7 +6903,10 @@ procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorCommand; AChar: WideC end; ecPaste: begin - if not ReadOnly then PasteFromClipboard; + if Length(FPasteArray) > 1 then + SelText := FPasteArray[FSelections.ActiveSelIndex] + else + SelText := FPasteArray[0]; end; ecScrollUp, ecScrollDown: begin @@ -8259,24 +6928,17 @@ procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorCommand; AChar: WideC MoveCaretVert(TopLine - vCaretRow, False); end; EnsureCursorPosVisible; - Update; end; end; ecScrollLeft: begin LeftChar := LeftChar - 1; - // todo: The following code was commented out because it is not MBCS or hard-tab safe. - //if CaretX > LeftChar + CharsInWindow then - // InternalCaretX := LeftChar + CharsInWindow; - Update; + EnsureCaretInView; end; ecScrollRight: begin LeftChar := LeftChar + 1; - // todo: The following code was commented out because it is not MBCS or hard-tab safe. - //if CaretX < LeftChar then - // InternalCaretX := LeftChar; - Update; + EnsureCaretInView; end; ecInsertMode: begin @@ -8294,69 +6956,15 @@ procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorCommand; AChar: WideC if not ReadOnly then DoBlockIndent; ecBlockUnindent: if not ReadOnly then DoBlockUnindent; - ecNormalSelect: - SelectionMode := smNormal; - ecColumnSelect: - SelectionMode := smColumn; - ecLineSelect: - SelectionMode := smLine; ecContextHelp: begin - if Assigned (FOnContextHelp) then - FOnContextHelp (self,WordAtCursor); - end; - ecImeStr: - if not ReadOnly then - begin - SetString(S, PWideChar(Data), WStrLen(Data)); - if SelAvail then - begin - BeginUndoBlock; - try - FUndoList.AddChange(crDelete, FBlockBegin, FBlockEnd, SelText, - smNormal); - StartOfBlock := BlockBegin; - EndOfBlock.Line := BlockBegin.Line; - EndOfBlock.Char := BlockBegin.Char + Length(s); - SetSelTextPrimitive(s); - FUndoList.AddChange(crInsert, StartOfBlock, EndOfBlock, '', - smNormal); - finally - EndUndoBlock; - end; - InvalidateGutterLines(-1, -1); - end - else - begin - Temp := LineText; - Len := Length(Temp); - if Len < CaretX then - Temp := Temp + UnicodeStringOfChar(#32, CaretX - Len - 1); - bChangeScroll := not (eoScrollPastEol in FOptions); - try - if bChangeScroll then Include(FOptions, eoScrollPastEol); - StartOfBlock := CaretXY; - Len := Length(s); - if not FInserting then - begin - Helper := Copy(Temp, CaretX, Len); - Delete(Temp, CaretX, Len); - end; - Insert(s, Temp, CaretX); - InternalCaretX := (CaretX + Len); - ProperSetLine(CaretY - 1, Temp); - if FInserting then - Helper := ''; - FUndoList.AddChange(crInsert, StartOfBlock, CaretXY, Helper, - smNormal); - if CaretX >= LeftChar + FCharsInWindow then - LeftChar := LeftChar + min(25, FCharsInWindow - 1); - finally - if bChangeScroll then Exclude(FOptions, eoScrollPastEol); - end; - end; + if Assigned (fOnContextHelp) then + fOnContextHelp (self,WordAtCursor); end; -{$IFDEF SYN_CodeFolding} + ecImeStr: + InsertCharAtCursor(PWideChar(Data)); + ecCopyLineUp, ecCopyLineDown, ecMoveLineUp, ecMoveLineDown: + ExecCmdCopyOrMoveLine(Command); ecFoldAll: begin CollapseAll; end; ecUnfoldAll: begin UncollapseAll; end; ecFoldNearest: begin CollapseNearest; end; @@ -8369,18 +6977,82 @@ procedure TCustomSynEdit.ExecuteCommand(Command: TSynEditorCommand; AChar: WideC ecUnfoldLevel3: begin UncollapseLevel(3); end; ecFoldRegions: begin CollapseFoldType(FoldRegionType) end; ecUnfoldRegions: begin UnCollapseFoldType(FoldRegionType) end; -{$ENDIF} + ecSelMatchingText: + begin + SelectAllMatchingText; + end; + ecCaretsAtLineEnds: + begin + CaretsAtLineEnds; + end; + ecZoomIn: Zoom(1); + ecZoomOut: Zoom(-1); + ecZoomReset: ZoomReset; + end; + finally + DecPaintLock; + DoOnPaintTransient(ttBefore); + end; +end; + +procedure TCustomSynEdit.ExecuteMultiCaretCommand(Command: TSynEditorCommand; + AChar: WideChar; Data: Pointer; CommandInfo: TSynCommandInfo); +var + OldActiveSelIndex: Integer; + I: Integer; + OldTopLine, OldLeftChar: Integer; +begin + DoOnPaintTransient(ttBefore); + IncPaintLock; + try + if CommandInfo.StoreMultiCaret then + begin + Lines.BeginUpdate; + BeginUndoBlock; + end; + + OldActiveSelIndex := Selections.ActiveSelIndex; + OldLeftChar := LeftChar; + OldTopLine := TopLine; + + for I := 0 to FSelections.Count -1 do + begin + // Make the current selection active + Selections.ActiveSelIndex := I; + + if not FSelection.IsValid then Continue; + + ExecuteCommand(Command, AChar, Data); + Selections.ActiveSelection := FSelection; + end; + + // Restore Active Selection + Selections.ActiveSelIndex := OldActiveSelIndex; + + // Merge Selections + FSelections.Merge; + + TopLine := OldTopLine; + LeftChar := OldLeftChar; + + EnsureCursorPosVisible; + + if CommandInfo.StoreMultiCaret then + begin + EndUndoBlock; + Lines.EndUpdate; end; finally DecPaintLock; + DoOnPaintTransient(ttAfter); end; end; procedure TCustomSynEdit.DoOnCommandProcessed(Command: TSynEditorCommand; AChar: WideChar; Data: Pointer); begin - if Assigned(FOnCommandProcessed) then - FOnCommandProcessed(Self, Command, AChar, Data); + if Assigned(fOnCommandProcessed) then + fOnCommandProcessed(Self, Command, AChar, Data); end; procedure TCustomSynEdit.DoOnProcessCommand(var Command: TSynEditorCommand; @@ -8399,18 +7071,22 @@ procedure TCustomSynEdit.DoOnProcessCommand(var Command: TSynEditorCommand; procedure TCustomSynEdit.ClearAll; begin - Lines.Clear; - FMarkList.Clear; // FMarkList.Clear also frees all bookmarks, - FillChar(FBookMarks, sizeof(FBookMarks), 0); // so FBookMarks should be cleared too - FUndoList.Clear; - FRedoList.Clear; + Lines.Clear; // triggers ListCleared + fUndoRedo.Clear; Modified := False; + UpdateScrollBars; end; -procedure TCustomSynEdit.ClearSelection; +procedure TCustomSynEdit.DeleteSelections; begin - if SelAvail then - SelText := ''; + if not FSelections.IsEmpty then + CommandProcessor(ecDeleteSelections, ' ', nil); +end; + +procedure TCustomSynEdit.ClearTrackChanges; +begin + fUndoRedo.ClearTrackChanges(Lines); + InvalidateGutter; end; function TCustomSynEdit.NextWordPosEx(const XY: TBufferCoord): TBufferCoord; @@ -8427,29 +7103,40 @@ function TCustomSynEdit.NextWordPosEx(const XY: TBufferCoord): TBufferCoord; Line := Lines[CY - 1]; LineLen := Length(Line); - if CX >= LineLen then + if CX > LineLen then begin - // find first IdentChar or multibyte char in the next line + // invalid char + // find first non-whitespace char in the next line if CY < Lines.Count then begin Line := Lines[CY]; + LineLen := Length(Line); Inc(CY); - CX := StrScanForCharInCategory(Line, 1, IsIdentChar); - if CX = 0 then + CX := 1; + while (CX <= LineLen) and IsWhiteChar(Line[CX]) do Inc(CX); end; end else begin - // find next Word-break-char if current char is an IdentChar - if IsIdentChar(Line[CX]) then - CX := StrScanForCharInCategory(Line, CX, IsWordBreakChar); - // if Word-break-char found, find the next IdentChar - if CX > 0 then - CX := StrScanForCharInCategory(Line, CX, IsIdentChar); - // if one of those failed just position at the end of the line if CX = 0 then - CX := LineLen + 1; + CX := 1; + // valid char + if IsIdentChar(Line[CX]) then begin + while (CX <= LineLen) and IsIdentChar(Line[CX]) do + Inc(CX); + while (CX <= LineLen) and IsWhiteChar(Line[CX]) do + Inc(CX); + end else if IsWhiteChar(Line[CX]) then begin + while (CX <= LineLen) and IsWhiteChar(Line[CX]) do + Inc(CX); + end else begin + // breakchar and not whitechar + while (CX <= LineLen) and (IsWordBreakChar(Line[CX]) and not IsWhiteChar(Line[CX])) do + Inc(CX); + while (CX <= LineLen) and IsWhiteChar(Line[CX]) do + Inc(CX); + end; end; end; Result.Char := CX; @@ -8459,7 +7146,7 @@ function TCustomSynEdit.NextWordPosEx(const XY: TBufferCoord): TBufferCoord; function TCustomSynEdit.WordStartEx(const XY: TBufferCoord): TBufferCoord; var CX, CY: Integer; - Line: UnicodeString; + Line: string; begin CX := XY.Char; CY := XY.Line; @@ -8470,7 +7157,8 @@ function TCustomSynEdit.WordStartEx(const XY: TBufferCoord): TBufferCoord; CX := Min(CX, Length(Line) + 1); if CX > 1 then - begin // only find previous char, if not already on start of line + begin + // only find previous char, if not already on start of line // if previous char isn't a word-break-char search for the last IdentChar if not IsWordBreakChar(Line[CX - 1]) then CX := StrRScanForCharInCategory(Line, CX - 1, IsWordBreakChar) + 1; @@ -8483,7 +7171,7 @@ function TCustomSynEdit.WordStartEx(const XY: TBufferCoord): TBufferCoord; function TCustomSynEdit.WordEndEx(const XY: TBufferCoord): TBufferCoord; var CX, CY: Integer; - Line: UnicodeString; + Line: string; begin CX := XY.Char; CY := XY.Line; @@ -8493,7 +7181,7 @@ function TCustomSynEdit.WordEndEx(const XY: TBufferCoord): TBufferCoord; Line := Lines[CY - 1]; CX := StrScanForCharInCategory(Line, CX, IsWordBreakChar); - // if no Word-break-char is found just position at the end of the line + // if no word-break-char is found just position at the end of the line if CX = 0 then CX := Length(Line) + 1; end; @@ -8508,6 +7196,7 @@ function TCustomSynEdit.PrevWordPosEx(const XY: TBufferCoord): TBufferCoord; begin CX := XY.Char; CY := XY.Line; + // valid line? if (CY >= 1) and (CY <= Lines.Count) then begin @@ -8516,33 +7205,39 @@ function TCustomSynEdit.PrevWordPosEx(const XY: TBufferCoord): TBufferCoord; if CX <= 1 then begin - // find last IdentChar in the previous line + // skip whitespace at the end of the previous line if CY > 1 then begin Dec(CY); Line := Lines[CY - 1]; CX := Length(Line) + 1; + if CX > 1 then + Exit(PrevWordPosEx(BufferCoord(CX, CY))); // recursive call end; end else begin - // if previous char is a Word-break-char search for the last IdentChar - if IsWordBreakChar(Line[CX - 1]) then - CX := StrRScanForCharInCategory(Line, CX - 1, IsIdentChar); - if CX > 0 then - // search for the first IdentChar of this "word" - CX := StrRScanForCharInCategory(Line, CX - 1, IsWordBreakChar) + 1; - if CX = 0 then - begin - // else just position at the end of the previous line - if CY > 1 then + // CX > 1 and <= LineLenght + 1 + if IsIdentChar(Line[CX-1]) then begin + while (CX > 1) and IsIdentChar(Line[CX-1]) do + Dec(CX); + end else if IsWhiteChar(Line[CX-1]) then begin + while (CX > 1) and IsWhiteChar(Line[CX-1]) do + Dec(CX); + if (CX > 1) then begin - Dec(CY); - Line := Lines[CY - 1]; - CX := Length(Line) + 1; - end - else - CX := 1; + if IsIdentChar(Line[CX-1]) then + while (CX > 1) and IsIdentChar(Line[CX-1]) do + Dec(CX) + else + // breakchar and not whitechar + while (CX > 1) and (IsWordBreakChar(Line[CX-1]) and not IsWhiteChar(Line[CX-1])) do + Dec(CX); + end; + end else begin + // breakchar and not whitechar + while (CX > 1) and (IsWordBreakChar(Line[CX-1]) and not IsWhiteChar(Line[CX-1])) do + Dec(CX); end; end; end; @@ -8550,26 +7245,9 @@ function TCustomSynEdit.PrevWordPosEx(const XY: TBufferCoord): TBufferCoord; Result.Line := CY; end; -procedure TCustomSynEdit.SetSelectionMode(const Value: TSynSelectionMode); -begin - if FSelectionMode <> Value then - begin - FSelectionMode := Value; - ActiveSelectionMode := Value; - end; -end; - -procedure TCustomSynEdit.SetActiveSelectionMode(const Value: TSynSelectionMode); +procedure TCustomSynEdit.SetSelectedColor(const Value: TSynSelectedColor); begin - if FActiveSelectionMode <> Value then - begin - if SelAvail then - InvalidateSelection; - FActiveSelectionMode := Value; - if SelAvail then - InvalidateSelection; - StatusChanged([scSelection]); - end; + FSelectedColor.Assign(Value); end; procedure TCustomSynEdit.SetAdditionalIdentChars(const Value: TSysCharSet); @@ -8584,7 +7262,7 @@ procedure TCustomSynEdit.SetAdditionalWordBreakChars(const Value: TSysCharSet); procedure TCustomSynEdit.BeginUndoBlock; begin - FUndoList.BeginBlock; + fUndoRedo.BeginBlock(Self); end; procedure TCustomSynEdit.BeginUpdate; @@ -8594,7 +7272,7 @@ procedure TCustomSynEdit.BeginUpdate; procedure TCustomSynEdit.EndUndoBlock; begin - FUndoList.EndBlock; + fUndoRedo.EndBlock(Self); end; procedure TCustomSynEdit.EndUpdate; @@ -8603,7 +7281,7 @@ procedure TCustomSynEdit.EndUpdate; end; procedure TCustomSynEdit.AddKey(Command: TSynEditorCommand; - Key1: Word; SS1: TShiftState; Key2: Word; SS2: TShiftState); + Key1: word; SS1: TShiftState; Key2: word; SS2: TShiftState); var Key: TSynEditKeyStroke; begin @@ -8616,16 +7294,20 @@ procedure TCustomSynEdit.AddKey(Command: TSynEditorCommand; end; { Called by FMarkList if change } -procedure TCustomSynEdit.MarkListChange(Sender: TObject); +procedure TCustomSynEdit.MarkListNotify(Sender: TObject; const Mark: TSynEditMark; + Action: TCollectionNotification); begin - InvalidateGutter; + if ([csDestroying, csLoading] * ComponentState = []) and + (Action in [cnAdded, cnRemoved]) and Assigned(Mark) + then + InvalidateGutterLines(Mark.fLine, Mark.fLine); end; -procedure TCustomSynEdit.MarkModifiedLinesAsSaved; +procedure TCustomSynEdit.MarkSaved; begin - TSynEditStringList(FLines).MarkModifiedLinesAsSaved; - if FGutter.ShowModification then - InvalidateGutter; + fUndoRedo.BufferSaved(Lines); + InvalidateGutter; + UpdateScrollBars; end; function TCustomSynEdit.GetSelStart: Integer; @@ -8641,28 +7323,22 @@ procedure TCustomSynEdit.SetAlwaysShowCaret(const Value: Boolean); if FAlwaysShowCaret <> Value then begin FAlwaysShowCaret := Value; - if not(csDestroying in ComponentState) and not(focused) then + if not(csDestroying in ComponentState) and not Focused then begin if Value then - begin - InitializeCaret; - end + UpdateCarets else - begin - HideCaret; - Windows.DestroyCaret; - end; + FCarets.HideCarets; end; end; end; procedure TCustomSynEdit.SetSelStart(const Value: Integer); begin - { if we don't call HandleNeeded, CharsInWindow may be 0 and LeftChar will + { if we don't call HandleNeeded, TextAreaWidth may be 0 and LeftChar will be set to CaretX } HandleNeeded; - InternalCaretXY := CharIndexToRowCol(Value); - BlockBegin := CaretXY; + CaretXY := CharIndexToRowCol(Value); end; function TCustomSynEdit.GetSelEnd: Integer; @@ -8686,7 +7362,7 @@ procedure TCustomSynEdit.SetSelWord; procedure TCustomSynEdit.SetExtraLineSpacing(const Value: Integer); begin - FExtraLineSpacing := Value; + fExtraLineSpacing := Value; SynFontChanged(self); end; @@ -8707,6 +7383,14 @@ function TCustomSynEdit.GetBookMark(BookMark: Integer; var X, Y: Integer): end; end; +function TCustomSynEdit.GetBrackets: string; +begin + if Assigned(fHighlighter) then + Result := fHighlighter.Brackets + else + Result := FBrackets; +end; + function TCustomSynEdit.IsBookmark(BookMark: Integer): Boolean; var x, y: Integer; @@ -8714,143 +7398,71 @@ function TCustomSynEdit.IsBookmark(BookMark: Integer): Boolean; Result := GetBookMark(BookMark, x, y); end; +function TCustomSynEdit.IsChained: Boolean; +begin + Result := Assigned(fChainedEditor); +end; + procedure TCustomSynEdit.ClearUndo; begin - FUndoList.Clear; - FRedoList.Clear; + fUndoRedo.Clear; + ClearTrackChanges; end; -procedure TCustomSynEdit.SetSelTextExternal(const Value: UnicodeString); +procedure TCustomSynEdit.CMHintShow(var Message: TCMHintShow); var - StartOfBlock, EndOfBlock: TBufferCoord; + CanShow: Boolean; + HintStr: string; begin - BeginUndoBlock; - try - if SelAvail then + if Assigned(fOnShowHint) then + begin + HintStr := Message.HintInfo.HintStr; + CanShow := HintStr <> ''; + fOnShowHint(HintStr, CanShow, Message.HintInfo^); + if CanShow then begin - FUndoList.AddChange(crDelete, FBlockBegin, FBlockEnd, - SelText, FActiveSelectionMode); + Message.Result := 0; + Message.HintInfo.HintStr := HintStr; end else - ActiveSelectionMode := SelectionMode; - StartOfBlock := BlockBegin; - EndOfBlock := BlockEnd; - FBlockBegin := StartOfBlock; - FBlockEnd := EndOfBlock; - SetSelTextPrimitive(Value); - if (Value <> '') and (FActiveSelectionMode <> smColumn) then - FUndoList.AddChange(crInsert, StartOfBlock, BlockEnd, '', FActiveSelectionMode); - finally - EndUndoBlock; - end; + Message.Result := 1; + end + else + inherited;; end; procedure TCustomSynEdit.SetGutter(const Value: TSynGutter); begin - FGutter.Assign(Value); + fGutter.Assign(Value); end; procedure TCustomSynEdit.GutterChanged(Sender: TObject); var nW: Integer; begin - if not (csLoading in ComponentState) then + if ComponentState * [csLoading, csDestroying] = [] then begin - if FGutter.ShowLineNumbers and FGutter.AutoSize then - FGutter.AutoSizeDigitCount(Lines.Count); - if FGutter.UseFontStyle then - begin - FTextDrawer.SetBaseFont(FGutter.Font); - nW := FGutter.RealGutterWidth(FTextDrawer.CharWidth); - FTextDrawer.SetBaseFont(Font); - end - else - nW := FGutter.RealGutterWidth(FCharWidth); - if nW = FGutterWidth then + nW := fGutter.RealGutterWidth; + fTextOffset := nw + fTextMargin - (LeftChar - 1) * fCharWidth; + if nW = fGutterWidth then InvalidateGutter else SetGutterWidth(nW); end; + + // Used in Zoom + FOrigGutterFontSize := Font.Size; end; procedure TCustomSynEdit.LockUndo; begin - FUndoList.Lock; - FRedoList.Lock; + fUndoRedo.Lock; end; procedure TCustomSynEdit.UnlockUndo; begin - FUndoList.Unlock; - FRedoList.Unlock; -end; - -function TCustomSynEdit.UnifiedSelection: TBufferBlock; -begin - if BlockBegin.Line > BlockEnd.Line then begin - Result.BeginLine := BlockEnd.Line; - Result.EndLine := BlockBegin.Line; - end else begin - Result.BeginLine := BlockBegin.Line; - Result.EndLine := BlockEnd.Line; - end; - if BlockBegin.Char > BlockEnd.Char then begin - Result.BeginChar := BlockEnd.Char; - Result.EndChar := BlockBegin.Char; - end else begin - Result.BeginChar := BlockBegin.Char; - Result.EndChar := BlockEnd.Char; - end; -end; - - -{$IFNDEF SYN_COMPILER_6_UP} -procedure TCustomSynEdit.WMMouseWheel(var Msg: TMessage); -var - nDelta: Integer; - nWheelClicks: Integer; -{$IFNDEF SYN_COMPILER_4_UP} -const - LinesToScroll = 3; - WHEEL_DELTA = 120; - WHEEL_PAGESCROLL = MAXDWORD; - SPI_GETWHEELSCROLLLINES = 104; -{$ENDIF} -begin - if csDesigning in ComponentState then - Exit; - - Msg.Result := 1; - -{$IFDEF SYN_COMPILER_4_UP} - // In some occasions Windows will not properly initialize mouse wheel, but - // will still keep sending WM_MOUSEWHEEL message. Calling inherited procedure - // will re-initialize related properties (i.e. Mouse.WheelScrollLines) - inherited; -{$ENDIF} - - if GetKeyState(VK_CONTROL) >= 0 then - begin -{$IFDEF SYN_COMPILER_4_UP} - nDelta := Mouse.WheelScrollLines -{$ELSE} - if not SystemParametersInfo(SPI_GETWHEELSCROLLLINES, 0, @nDelta, 0) then - nDelta := LinesToScroll; -{$ENDIF} - end - else - nDelta := LinesInWindow shr Ord(eoHalfPageScroll in FOptions); - - Inc(FMouseWheelAccumulator, SmallInt(Msg.wParamHi)); - nWheelClicks := FMouseWheelAccumulator div WHEEL_DELTA; - FMouseWheelAccumulator := FMouseWheelAccumulator mod WHEEL_DELTA; - if (nDelta = Integer(WHEEL_PAGESCROLL)) or (nDelta > LinesInWindow) then - nDelta := LinesInWindow; - TopLine := TopLine - (nDelta * nWheelClicks); - Update; - if Assigned(OnScroll) then OnScroll(Self,sbVertical); + fUndoRedo.Unlock; end; -{$ENDIF} procedure TCustomSynEdit.WMSetCursor(var Msg: TWMSetCursor); begin @@ -8866,155 +7478,125 @@ procedure TCustomSynEdit.WMSetCursor(var Msg: TWMSetCursor); procedure TCustomSynEdit.SetTabWidth(Value: Integer); begin Value := MinMax(Value, 1, 256); - if (Value <> FTabWidth) then begin - FTabWidth := Value; + if (Value <> fTabWidth) then begin + fTabWidth := Value; TSynEditStringList(Lines).TabWidth := Value; + FTextFormat.Create(Font, fTabWidth, 0, fExtraLineSpacing); Invalidate; // to redraw text containing tab chars if WordWrap then begin - FWordWrapPlugin.Reset; + fWordWrapPlugin.Reset; InvalidateGutter; end; end; end; -procedure TCustomSynEdit.SelectedColorsChanged(Sender: TObject); +procedure TCustomSynEdit.SelectedColorChanged(Sender: TObject); begin InvalidateSelection; end; // find / replace -function TCustomSynEdit.SearchReplace(const ASearch, AReplace: UnicodeString; +function TCustomSynEdit.SearchReplace(const ASearch, AReplace: string; AOptions: TSynSearchOptions): Integer; +begin + Result := SearchReplace(ASearch, AReplace, AOptions, + TBufferCoord.Invalid, TBufferCoord.Invalid); +end; + +function TCustomSynEdit.SearchReplace(const ASearch, AReplace: string; + AOptions: TSynSearchOptions; const Start, Stop: TBufferCoord): Integer; var ptStart, ptEnd: TBufferCoord; // start and end of the search range - ptCurrent: TBufferCoord; // current search position - nSearchLen, nReplaceLen, n, nFound: Integer; - nInLine: Integer; + nEOLCount, i: Integer; bBackward, bFromCursor: Boolean; bPrompt: Boolean; bReplace, bReplaceAll: Boolean; bEndUndoBlock: Boolean; - nAction: TSynReplaceAction; - iResultOffset: Integer; + sReplace: string; - function InValidSearchRange(First, Last: Integer): Boolean; + function ProcessTextRange(const ptStart: TBufferCoord; + var ptEnd: TBufferCoord): Integer; + var + lnStart, lnEnd: Integer; // the part of the line that is searched + nSearchLen, nReplaceLen, n, nFound: Integer; + nInLine: Integer; + nAction: TSynReplaceAction; + iResultOffset: Integer; + CurrentLine: Integer; + Line: string; begin - Result := True; - if (FActiveSelectionMode = smNormal) or not (ssoSelectedOnly in AOptions) then - begin - if ((ptCurrent.Line = ptStart.Line) and (First < ptStart.Char)) or - ((ptCurrent.Line = ptEnd.Line) and (Last > ptEnd.Char)) - then - Result := False; - end - else - if (FActiveSelectionMode = smColumn) then - // solves bug in search/replace when smColumn mode active and no selection - Result := (First >= ptStart.Char) and (Last <= ptEnd.Char) or (ptEnd.Char - ptStart.Char < 1); - end; - -begin - if not Assigned(FSearchEngine) then - raise ESynEditError.Create('No search engine has been assigned'); - - Result := 0; - // can't search for or replace an empty string - if Length(ASearch) = 0 then Exit; - // get the text range to search in, ignore the "Search in selection only" - // option if nothing is selected - bBackward := (ssoBackwards in AOptions); - bPrompt := (ssoPrompt in AOptions); - bReplace := (ssoReplace in AOptions); - bReplaceAll := (ssoReplaceAll in AOptions); - bFromCursor := not (ssoEntireScope in AOptions); - if not SelAvail then Exclude(AOptions, ssoSelectedOnly); - if (ssoSelectedOnly in AOptions) then begin - ptStart := BlockBegin; - ptEnd := BlockEnd; - // search the whole line in the line selection mode - if (FActiveSelectionMode = smLine) then - begin - ptStart.Char := 1; - ptEnd.Char := Length(Lines[ptEnd.Line - 1]) + 1; - end - else if (FActiveSelectionMode = smColumn) then - // make sure the start column is smaller than the end column - if (ptStart.Char > ptEnd.Char) then - SwapInt(Integer(ptStart.Char), Integer(ptEnd.Char)); - // ignore the cursor position when searching in the selection + Result := 0; if bBackward then - ptCurrent := ptEnd + CurrentLine := ptEnd.Line else - ptCurrent := ptStart; - end - else - begin - ptStart.Char := 1; - ptStart.Line := 1; - ptEnd.Line := Lines.Count; - ptEnd.Char := Length(Lines[ptEnd.Line - 1]) + 1; - if bFromCursor then - if bBackward then ptEnd := CaretXY else ptStart := CaretXY; - if bBackward then ptCurrent := ptEnd else ptCurrent := ptStart; - end; - // initialize the search engine - FSearchEngine.Options := AOptions; - FSearchEngine.Pattern := ASearch; - // search while the current search position is inside of the search range - nReplaceLen := 0; - DoOnPaintTransient(ttBefore); - if bReplaceAll and not bPrompt then - begin - IncPaintLock; - BeginUndoBlock; - bEndUndoBlock := True; - end - else - bEndUndoBlock := False; - Inc(FPaintTransientLock); - try - while (ptCurrent.Line >= ptStart.Line) and (ptCurrent.Line <= ptEnd.Line) do + CurrentLine := ptStart.Line; + + while (CurrentLine >= ptStart.Line) and (CurrentLine <= ptEnd.Line) do begin - nInLine := FSearchEngine.FindAll(Lines[ptCurrent.Line - 1]); + Line := Lines[CurrentLine - 1]; + if CurrentLine = ptStart.Line then + lnStart := ptStart.Char + else + lnStart := 1; + + if CurrentLine = ptEnd.Line then + lnEnd := ptEnd.Char + else + lnEnd := Length(Line) + 1; + + if lnEnd <= lnStart then + begin + CurrentLine := CurrentLine + IfThen(bBackward, -1, 1); + Continue; + end; + nInLine := fSearchEngine.FindAll(Line, lnStart, lnEnd); iResultOffset := 0; if bBackward then - n := Pred(FSearchEngine.ResultCount) + n := Pred(fSearchEngine.ResultCount) else n := 0; // Operate on all results in this line. while nInLine > 0 do begin // An occurrence may have been replaced with a text of different length - nFound := FSearchEngine.Results[n] + iResultOffset; - nSearchLen := FSearchEngine.Lengths[n]; + nFound := fSearchEngine.Results[n] + iResultOffset; + nSearchLen := fSearchEngine.Lengths[n]; if bBackward then Dec(n) else Inc(n); Dec(nInLine); - // Is the search result entirely in the search range? - if not InValidSearchRange(nFound, nFound + nSearchLen) then continue; + + // We have a match Inc(Result); // Select the text, so the user can see it in the OnReplaceText event // handler or as the search result. - - ptCurrent.Char := nFound; - BlockBegin := ptCurrent; - // Be sure to use the Ex version of CursorPos so that it appears in the middle if necessary - SetCaretXYEx(False, BufferCoord(1, ptCurrent.Line)); - EnsureCursorPosVisibleEx(True); - Inc(ptCurrent.Char, nSearchLen); - BlockEnd := ptCurrent; - InternalCaretXY := ptCurrent; - if bBackward then InternalCaretXY := BlockBegin else InternalCaretXY := ptCurrent; + // It is not necessary to see changes if replacing without confirmation. + // It signicatntly slow down replace + FSelections.Clear; + if bBackward then + SetCaretAndSelection( + BufferCoord(nFound, CurrentLine), + BufferCoord(nFound + nSearchLen, CurrentLine), + BufferCoord(nFound, CurrentLine), + not bReplaceAll or bPrompt, not bReplaceAll or bPrompt) + else + SetCaretAndSelection( + BufferCoord(nFound + nSearchLen, CurrentLine), + BufferCoord(nFound , CurrentLine), + BufferCoord(nFound + nSearchLen, CurrentLine), + not bReplaceAll or bPrompt, not bReplaceAll or bPrompt); // If it's a search only we can leave the procedure now. if not (bReplace or bReplaceAll) then Exit; // Prompt and replace or replace all. If user chooses to replace // all after prompting, turn off prompting. - if bPrompt and Assigned(FOnReplaceText) then + if bPrompt and Assigned(fOnReplaceText) then begin - nAction := DoOnReplaceText(ASearch, AReplace, ptCurrent.Line, nFound); + nAction := DoOnReplaceText(ASearch, sReplace, CurrentLine, nFound); if nAction = raCancel then + begin + Dec(Result); Exit; + end; end else nAction := raReplace; @@ -9023,31 +7605,42 @@ function TCustomSynEdit.SearchReplace(const ASearch, AReplace: UnicodeString; else begin // user has been prompted and has requested to silently replace all // so turn off prompting - if nAction = raReplaceAll then begin + if nAction = raReplaceAll then + begin if not bReplaceAll or bPrompt then begin bReplaceAll := True; IncPaintLock; end; bPrompt := False; - if bEndUndoBlock = False then + if not bEndUndoBlock then BeginUndoBlock; - bEndUndoBlock := true; + bEndUndoBlock := True; end; - // Allow advanced substition in the search engine - SelText := FSearchEngine.Replace(SelText, AReplace); + // Allow advanced substitution in the search engine + SelText := fSearchEngine.Replace(SelText, sReplace); nReplaceLen := CaretX - nFound; - end; - // fix the caret position and the remaining results - if not bBackward then begin - InternalCaretX := nFound + nReplaceLen; - if (nSearchLen <> nReplaceLen) and (nAction <> raSkip) then + // fix the caret position and the remaining results + if not bBackward then begin - Inc(iResultOffset, nReplaceLen - nSearchLen); - if (FActiveSelectionMode <> smColumn) and (CaretY = ptEnd.Line) then + InternalCaretX := nFound + nReplaceLen; + if nSearchLen <> nReplaceLen then + begin + Inc(iResultOffset, nReplaceLen - nSearchLen); + if CaretY = ptEnd.Line then + begin + Inc(ptEnd.Char, nReplaceLen - nSearchLen); + //BlockEnd := ptEnd; // not sure what was the purpose of this + end; + end; + //Fix new line ends + if nEOLCount > 0 then begin - Inc(ptEnd.Char, nReplaceLen - nSearchLen); - BlockEnd := ptEnd; + Inc(ptEnd.Line, nEOLCount); + if not bBackward then + // New lines have been entered, so the remaining matches will not + // be vaild and will be matched on the following line + Break; end; end; end; @@ -9055,110 +7648,202 @@ function TCustomSynEdit.SearchReplace(const ASearch, AReplace: UnicodeString; Exit; end; // search next / previous line - if bBackward then - Dec(ptCurrent.Line) + CurrentLine := CurrentLine + IfThen(bBackward, -1, 1); + end; + end; + +var + Sel: TSynSelection; + Index, J, LineAdjustment: Integer; + SelStorage: TSynSelStorage; +begin + if not Assigned(fSearchEngine) then + raise ESynEditError.Create('No search engine has been assigned'); + + Result := 0; + // can't search for or replace an empty string + if Length(ASearch) = 0 then Exit; + // get the text range to search in, ignore the "Search in selection only" + // option if nothing is selected + bBackward := (ssoBackwards in AOptions); + bPrompt := (ssoPrompt in AOptions); + bReplace := (ssoReplace in AOptions); + bReplaceAll := (ssoReplaceAll in AOptions); + bFromCursor := not (ssoEntireScope in AOptions); + if FSelections.IsEmpty then Exclude(AOptions, ssoSelectedOnly); + // translate \n and \t to real chars for regular expressions + sReplace := fSearchEngine.PreprocessReplaceExpression(AReplace); + + //count line ends + nEOLCount := 0; + I := 1; + repeat + I := Pos(WideCrLf, sReplace, I); + if I <> 0 then + begin + I := I + Length(WideCrLf); + Inc(nEolCount); + end; + until I = 0; + // initialize the search engine + fSearchEngine.Options := AOptions; + fSearchEngine.Pattern := ASearch; + fSearchEngine.IsWordBreakFunction := IsWordBreakChar; + // search while the current search position is inside of the search range + DoOnPaintTransient(ttBefore); + if bReplaceAll and not bPrompt then + begin + IncPaintLock; + BeginUndoBlock; + bEndUndoBlock := True; + end + else + bEndUndoBlock := False; + try + if Start.IsValid and Stop.IsValid then + begin + if Start > Stop then + begin + ptStart := Stop; + ptEnd := Start; + end else - Inc(ptCurrent.Line); + begin + ptStart := Start; + ptEnd := Stop; + end; + Result := ProcessTextRange(ptStart, ptEnd); + end + else if not (ssoSelectedOnly in AOptions) then + begin + ptStart.Char := 1; + ptStart.Line := 1; + ptEnd.Line := Lines.Count; + ptEnd.Char := Length(Lines[ptEnd.Line - 1]) + 1; + if bFromCursor then + if bBackward then + ptEnd := CaretXY + else + ptStart := CaretXY; + Result := ProcessTextRange(ptStart, ptEnd); + end + else + begin + FSelections.Store(SelStorage); + for I := 0 to Length(SelStorage.Selections) - 1 do + begin + if bBackward then + Index := Length(SelStorage.Selections) - 1 - I + else + Index := I; + Sel := SelStorage.Selections[Index].Normalized; + + ptStart := Sel.Start; + ptEnd := Sel.Stop; + // Ignore the cursor position when searching in the selection + // but take account of a valid Start + if Start.IsValid then + begin + // if you pass a valid start search from there + if bBackward then + begin + if Start <= Sel.Start then Continue; + ptEnd := TBufferCoord.Min(Start, ptEnd); + end + else + begin + if Start >= ptEnd then Continue; + ptStart := TBufferCoord.Max(Start, ptStart); + end; + end; + + if ptStart >= ptEnd then Continue; + + Inc(Result, ProcessTextRange(ptStart, ptEnd)); + + if (Result > 0) and not bReplaceAll then + Break; + + LineAdjustment := ptEnd.Line - Sel.Stop.Line; + for J := Index + 1 to Length(SelStorage.Selections) - 1 do + begin + // Adjust lines + Inc(SelStorage.Selections[J].Start.Line, LineAdjustment); + Inc(SelStorage.Selections[J].Stop.Line, LineAdjustment); + end; + + if SelStorage.Selections[Index] = Sel then + SelStorage.Selections[Index].Stop := ptEnd + else + SelStorage.Selections[Index].Start := ptEnd + end; end; finally if bReplaceAll and not bPrompt then DecPaintLock; if bEndUndoBlock then EndUndoBlock; - Dec(FPaintTransientLock); - DoOnPaintTransient( ttAfter ); + DoOnPaintTransient(ttAfter); end; end; function TCustomSynEdit.IsPointInSelection(const Value: TBufferCoord): Boolean; var - ptBegin, ptEnd: TBufferCoord; + Index: Integer; begin - ptBegin := BlockBegin; - ptEnd := BlockEnd; - if (Value.Line >= ptBegin.Line) and (Value.Line <= ptEnd.Line) and - ((ptBegin.Line <> ptEnd.Line) or (ptBegin.Char <> ptEnd.Char)) then - begin - if FActiveSelectionMode = smLine then - Result := True - else if (FActiveSelectionMode = smColumn) then - begin - if (ptBegin.Char > ptEnd.Char) then - Result := (Value.Char >= ptEnd.Char) and (Value.Char < ptBegin.Char) - else if (ptBegin.Char < ptEnd.Char) then - Result := (Value.Char >= ptBegin.Char) and (Value.Char < ptEnd.Char) - else - Result := False; - end - else - Result := ((Value.Line > ptBegin.Line) or (Value.Char >= ptBegin.Char)) and - ((Value.Line < ptEnd.Line) or (Value.Char < ptEnd.Char)); - end - else - Result := False; + Result := FSelections.FindSelection(Value, Index) and + not FSelections[Index].IsEmpty; end; procedure TCustomSynEdit.SetFocus; begin - if (FFocusList.Count > 0) then + if (fFocusList.Count > 0) then begin - if TWinControl (FFocusList.Last).CanFocus then - TWinControl (FFocusList.Last).SetFocus; + if TWinControl (fFocusList.Last).CanFocus then + TWinControl (fFocusList.Last).SetFocus; Exit; end; inherited; end; procedure TCustomSynEdit.UpdateMouseCursor; - var ptCursor: TPoint; ptLineCol: TBufferCoord; iNewCursor: TCursor; -{$IFDEF SYN_CodeFolding} ptRowCol: TDisplayCoord; Rect: TRect; -{$ENDIF} + Band: TSynGutterBand; begin GetCursorPos(ptCursor); ptCursor := ScreenToClient(ptCursor); -{$IFDEF SYN_CodeFolding} ptRowCol := PixelsToRowColumn(ptCursor.X, ptCursor.Y); ptLineCol := DisplayToBufferPos(ptRowCol); - if (ptCursor.X < fGutterWidth) then begin - if UseCodeFolding and - fAllFoldRanges.FoldStartAtLine(ptLineCol.Line) then - begin - Rect := GetFoldShapeRect(ptRowCol.Row); - if PtInRect(Rect, ptCursor) then - SetCursor(Screen.Cursors[crHandPoint]) - else - SetCursor(Screen.Cursors[fGutter.Cursor]); - end else - SetCursor(Screen.Cursors[fGutter.Cursor]) - end else begin - if (eoDragDropEditing in fOptions) and (not MouseCapture) and IsPointInSelection(ptLineCol) then + if (ptCursor.X < fGutterWidth) then + begin + iNewCursor := Gutter.Cursor; + Band := FGutter.BandAtX(ptCursor.X); + if Assigned(Band) and Assigned(Band) then + Band.DoMouseCursor(Self, ptCursor.X, ptCursor.Y, ptRowCol.Row, + ptLineCol.Line, iNewCursor); + end + else + begin + if (eoDragDropEditing in fOptions) and (not MouseCapture) and + (FSelections.Count = 1) and IsPointInSelection(ptLineCol) + then iNewCursor := crArrow else if UseCodeFolding and CodeFolding.ShowHintMark and fAllFoldRanges.CollapsedFoldStartAtLine(ptLineCol.Line) then begin Rect := GetCollapseMarkRect(ptRowCol.Row, ptLineCol.Line); - if PtInRect(Rect, ptCursor) then + if PtInRect(Rect, ptCursor) and (ptCursor.X > FGutterWidth + fTextMargin) then iNewCursor := crHandPoint; end else -{$ELSE} - if (ptCursor.X < FGutterWidth) then - SetCursor(Screen.Cursors[FGutter.Cursor]) - else begin - ptLineCol := DisplayToBufferPos(PixelsToRowColumn(ptCursor.X, ptCursor.Y)); - if (eoDragDropEditing in FOptions) and (not MouseCapture) and not (sfMouseCaptured in FStateFlags) and IsPointInSelection(ptLineCol) then - iNewCursor := crArrow - else -{$ENDIF} iNewCursor := Cursor; - if Assigned(OnMouseCursor) then - OnMouseCursor(Self, ptLineCol, iNewCursor); - FKbdHandler.ExecuteMouseCursor(Self, ptLineCol, iNewCursor); - SetCursor(Screen.Cursors[iNewCursor]); + + DoOnMouserCursor(ptLineCol, iNewCursor); + fKbdHandler.ExecuteMouseCursor(Self, ptLineCol, iNewCursor); end; + SetCursor(Screen.Cursors[iNewCursor]); end; procedure TCustomSynEdit.BookMarkOptionsChanged(Sender: TObject); @@ -9166,315 +7851,327 @@ procedure TCustomSynEdit.BookMarkOptionsChanged(Sender: TObject); InvalidateGutter; end; -function TCustomSynEdit.GetOptions: TSynEditorOptions; -begin - Result := FOptions; -end; - procedure TCustomSynEdit.SetOptions(Value: TSynEditorOptions); -const - ScrollOptions = [eoDisableScrollArrows,eoHideShowScrollbars, - eoScrollPastEof,eoScrollPastEol]; var bSetDrag: Boolean; - TmpBool: Boolean; - bUpdateScroll: Boolean; - vTempBlockBegin, vTempBlockEnd : TBufferCoord; begin - if (Value <> FOptions) then + if (Value <> fOptions) then begin - bSetDrag := (eoDropFiles in FOptions) <> (eoDropFiles in Value); - - if not (eoScrollPastEol in Options) then - LeftChar := LeftChar; - if not (eoScrollPastEof in Options) then - TopLine := TopLine; + bSetDrag := (eoDropFiles in fOptions) <> (eoDropFiles in Value); + fOptions := Value; - bUpdateScroll := (Options * ScrollOptions) <> (Value * ScrollOptions); + FUndoRedo.GroupUndo := eoGroupUndo in Options; - FOptions := Value; - - // constrain caret position to MaxScrollWidth if eoScrollPastEol is enabled - InternalCaretXY := CaretXY; - if (eoScrollPastEol in Options) then + if HandleAllocated then begin - vTempBlockBegin := BlockBegin; - vTempBlockEnd := BlockEnd; - SetBlockBegin(vTempBlockBegin); - SetBlockEnd(vTempBlockEnd); - end; + CalcTextAreaWidth; // in case eoWrapWithRightEdge changed - // (un)register HWND as drop target - if bSetDrag and not (csDesigning in ComponentState) and HandleAllocated then - DragAcceptFiles(Handle, (eoDropFiles in FOptions)); + // (un)register HWND as drop target + if bSetDrag and not (csDesigning in ComponentState) then + DragAcceptFiles(Handle, (eoDropFiles in fOptions)); + end; + end; +end; - TmpBool := eoShowSpecialChars in Value; - if TmpBool <> FShowSpecChar then +procedure TCustomSynEdit.SetScrollOptions(Value: TSynEditorScrollOptions); +const + TestScrollOptions = [eoDisableScrollArrows, eoHideShowScrollbars, + eoScrollPastEof, eoScrollPastEol]; +var + UpdateScroll: Boolean; +begin + if (Value <> fScrollOptions) then + begin + UpdateScroll := (ScrollOptions * TestScrollOptions) <> (Value * TestScrollOptions); + fScrollOptions := Value; + if HandleAllocated and UpdateScroll then begin - FShowSpecChar := TmpBool; - Invalidate; - end; - if bUpdateScroll then + if not (eoScrollPastEol in ScrollOptions) then + LeftChar := LeftChar; + if not (eoScrollPastEof in ScrollOptions) then + TopLine := TopLine; UpdateScrollBars; + end; + end; +end; + +procedure TCustomSynEdit.SetVisibleSpecialChars(Value: TSynVisibleSpecialChars); +begin + if Value <> FVisibleSpecialChars then + begin + FVisibleSpecialChars := Value; + TSynEditStringList(fLines).ResetMaxWidth; + Invalidate; end; end; procedure TCustomSynEdit.SizeOrFontChanged(bFont: Boolean); begin - if HandleAllocated and (FCharWidth <> 0) then + if HandleAllocated and (fCharWidth <> 0) then begin - FCharsInWindow := Max(ClientWidth - FGutterWidth - 2, 0) div FCharWidth; - FLinesInWindow := ClientHeight div FTextHeight; + fLinesInWindow := ClientHeight div fTextHeight; + CalcTextAreaWidth; if WordWrap then begin - FWordWrapPlugin.DisplayChanged; + fWordWrapPlugin.DisplayChanged; Invalidate; end; if bFont then begin - if Gutter.ShowLineNumbers then + if Gutter.ShowLineNumbers and not Gutter.UseFontStyle then GutterChanged(Self) else UpdateScrollbars; InitializeCaret; - Exclude(FStateFlags, sfCaretChanged); + Exclude(fStateFlags, sfCaretChanged); Invalidate; end else UpdateScrollbars; - Exclude(FStateFlags, sfScrollbarChanged); - if not (eoScrollPastEol in Options) then + if not (eoScrollPastEol in ScrollOptions) then LeftChar := LeftChar; - if not (eoScrollPastEof in Options) then + if not (eoScrollPastEof in ScrollOptions) then TopLine := TopLine; end; end; procedure TCustomSynEdit.MoveCaretHorz(DX: Integer; SelectionCommand: Boolean); var - ptO, ptDst: TBufferCoord; - s: UnicodeString; - nLineLen: Integer; - bChangeY: Boolean; - vCaretRowCol: TDisplayCoord; + Dst: TDisplayCoord; + SRow: string; + RowLen: Integer; + ChangeY: Boolean; begin - if WordWrap then - begin - if DX > 0 then - begin - if FCaretAtEOL then - begin - FCaretAtEOL := False; - UpdateLastCaretX; - IncPaintLock; - Include(FStateFlags, sfCaretChanged); - DecPaintLock; - Exit; - end; - end - else - begin // DX < 0. Handle ecLeft/ecPageLeft at BOL. - if (not FCaretAtEOL) and (CaretX > 1) and (DisplayX = 1) then - begin - FCaretAtEOL := True; - UpdateLastCaretX; - if DisplayX > CharsInWindow +1 then - SetInternalDisplayXY( DisplayCoord(CharsInWindow +1, DisplayY) ) - else begin - IncPaintLock; - Include(FStateFlags, sfCaretChanged); - DecPaintLock; - end; - Exit; - end; - end; - end; - ptO := CaretXY; - ptDst := ptO; - s := LineText; - nLineLen := Length(s); + Dst := DisplayXY; + SRow := Rows[Dst.Row]; + RowLen := SRow.Length; // only moving or selecting one char can change the line - bChangeY := not (eoScrollPastEol in FOptions); - if bChangeY and (DX = -1) and (ptO.Char = 1) and (ptO.Line > 1) then + ChangeY := WordWrap or not (eoScrollPastEol in fScrollOptions); + if ChangeY and (DX = -1) and (Dst.Column = 1) and (Dst.Row > 1) then begin // end of previous line - Dec(ptDst.Line); - ptDst.Char := Length(Lines[ptDst.Line - 1]) + 1; + Dec(Dst.Row); + Dst.Column := Length(Rows[Dst.Row]) + 1; end - else if bChangeY and (DX = 1) and (ptO.Char > nLineLen) and (ptO.Line < Lines.Count) then + else if ChangeY and (DX = 1) and (Dst.Column > RowLen) and (Dst.Row < DisplayRowCount) then begin - // start of next line - Inc(ptDst.Line); - ptDst.Char := 1; + // start of next row + Inc(Dst.Row); + Dst.Column := 1; end else begin - ptDst.Char := Max(1, ptDst.Char + DX); + Dst.Column := Max(1, Dst.Column + DX); // don't go past last char when ScrollPastEol option not set - if (DX > 0) and bChangeY then - ptDst.Char := Min(ptDst.Char, nLineLen + 1); - end; - // set caret and block begin / end - MoveCaretAndSelection(FBlockBegin, ptDst, SelectionCommand); - // if caret is beyond CharsInWindow move to next row (this means there are - // spaces/tabs at the end of the row) - if WordWrap and (DX > 0) and (CaretX < Length(LineText)) then - begin - vCaretRowCol := DisplayXY; - if (vCaretRowCol.Column = 1) and (LineToRow(CaretY) <> vCaretRowCol.Row) then - begin - FCaretAtEOL := True; - UpdateLastCaretX; - end - else if vCaretRowCol.Column > CharsInWindow +1 then - begin - Inc(vCaretRowCol.Row); - vCaretRowCol.Column := 1; - InternalCaretXY := DisplayToBufferPos(vCaretRowCol); - end; + if (DX > 0) and ChangeY then + Dst.Column := Min(Dst.Column, RowLen + 1); + Dst.Column := ValidTextPos(SRow, Dst.Column, DX > 0); end; + // set display pos and selection + MoveDisplayPosAndSelection(Dst, SelectionCommand); end; procedure TCustomSynEdit.MoveCaretVert(DY: Integer; SelectionCommand: Boolean); var - ptO, ptDst, vEOLTestPos: TDisplayCoord; - vDstLineChar: TBufferCoord; - SaveLastCaretX: Integer; + Org, Dst: TDisplayCoord; + SaveLastPosX: Integer; + SDestRow: string; begin - ptO := DisplayXY; - ptDst := ptO; + Org := DisplayXY; + Dst := Org; - Inc(ptDst.Row, DY); + Inc(Dst.Row, DY); if DY >= 0 then begin - if RowToLine(ptDst.Row) > Lines.Count then - ptDst.Row := Max(1, DisplayLineCount); + if RowToLine(Dst.Row) > Lines.Count then + Dst.Row := Max(1, DisplayRowCount); end - else begin - if ptDst.Row < 1 then - ptDst.Row := 1; - end; + else + Dst.Row := Max(Dst.Row, 1); - if (ptO.Row <> ptDst.Row) then + if (Org.Row <> Dst.Row) then begin if eoKeepCaretX in Options then - ptDst.Column := FLastCaretX; + begin + SDestRow := Rows[Dst.Row]; + Dst.Column := PixelsToColumn(PChar(SDestRow), SDestRow.Length, FLastPosX); + end; end; - vDstLineChar := DisplayToBufferPos(ptDst); - SaveLastCaretX := FLastCaretX; + Dst.Column := ValidTextPos(Rows[Dst.Row], Dst.Column, False); - // set caret and block begin / end - IncPaintLock; - MoveCaretAndSelection(FBlockBegin, vDstLineChar, SelectionCommand); - if WordWrap then - begin - vEOLTestPos := BufferToDisplayPos(vDstLineChar); - FCaretAtEOL := (vEOLTestPos.Column = 1) and (vEOLTestPos.Row <> ptDst.Row); - end; - DecPaintLock; + // set caret and block begin/end + SaveLastPosX := FLastPosX; + MoveDisplayPosAndSelection(Dst, SelectionCommand); - // Restore FLastCaretX after moving caret, since UpdateLastCaretX, called by + // Restore FLastPosX after moving caret, since UpdateLastPosX, called by // SetCaretXYEx, changes them. This is the one case where we don't want that. - FLastCaretX := SaveLastCaretX; + FLastPosX := SaveLastPosX; +end; + +procedure TCustomSynEdit.MoveCaretAndSelection(const NewPos: TBufferCoord; + SelectionCmd: Boolean); +{ Moves the cursor to ptAfter (new cursor) + If SelectionCmd is True sets selection from the old cursor to the new cursor + If SelectionCmd is False it clears the selection } +var + DC: TDisplayCoord; +begin + DC := BufferToDisplayPos(NewPos); + MoveDisplayPosAndSelection(DC, SelectionCmd); end; -procedure TCustomSynEdit.MoveCaretAndSelection(const ptBefore, ptAfter: TBufferCoord; - SelectionCommand: Boolean); +procedure TCustomSynEdit.MoveDisplayPosAndSelection(const NewPos: TDisplayCoord; + SelectionCmd: Boolean); +{ Similar to MoveCaretAndSelection, but with display coordinates. + It correctly sets fCaretEOL } +var + BC: TBufferCoord; begin - if (eoGroupUndo in FOptions) and UndoList.CanUndo then - FUndoList.AddGroupBreak; + if (eoGroupUndo in FOptions) and fUndoRedo.CanUndo then + fUndoRedo.AddGroupBreak; + + BC := DisplayToBufferPos(NewPos); + + if ((CaretY = BC.Line) and (not FSelection.IsEmpty or SelectionCmd)) or + ((ActiveLineColor <> clNone) and WordWrap and (DisplayY <> NewPos.Row)) + then + InvalidateLine(BC.Line); IncPaintLock; - if SelectionCommand then - begin - if not SelAvail then - SetBlockBegin(ptBefore); - SetBlockEnd(ptAfter); - end - else - SetBlockBegin(ptAfter); - InternalCaretXY := ptAfter; - DecPaintLock; + try + if SelectionCmd then + SetBlockEnd(BC) + else + SetBlockBegin(BC); // Also sets BlockEnd = NewPos + DisplayXY := NewPos; // Correctly sets CaretAtEOL when WordWrap is True + finally + DecPaintLock; + end; +end; + +procedure TCustomSynEdit.SetCaretAndSelection(const Sel: TSynSelection; + EnsureVisible, ForceToMiddle: Boolean); +begin + SetCaretAndSelection(Sel.Caret, Sel.Start, Sel.Stop, + EnsureVisible, ForceToMiddle); + CaretAtEOL := Sel.CaretAtEOL; + FLastPosX := Sel.LastPosX; end; procedure TCustomSynEdit.SetCaretAndSelection(const ptCaret, ptBefore, - ptAfter: TBufferCoord); + ptAfter: TBufferCoord; EnsureVisible: Boolean; ForceToMiddle: Boolean); +{ Sets the caret and the selection in one step + The caret may be different than BlockBegin/End } var - vOldMode: TSynSelectionMode; + ValidBB, ValidBE: TBufferCoord; begin - vOldMode := FActiveSelectionMode; + if (ActiveLineColor <> clNone) and (CaretY = ptCaret.Line) and + (FSelection.IsEmpty xor (ptBefore = ptAfter)) + then + InvalidateLine(ptCaret.Line); + IncPaintLock; try - InternalCaretXY := ptCaret; - SetBlockBegin(ptBefore); - SetBlockEnd(ptAfter); + InvalidateSelection; + SetCaretXYEx(False, ptCaret); + if EnsureVisible then + EnsureCursorPosVisibleEx(ForceToMiddle); + if eoNoSelection in fOptions then + begin + FSelection.Start := ptCaret; + FSelection.Stop := ptCaret; + end + else + begin + ValidBB := ValidBC(ptBefore); + ValidBE := ValidBC(ptAfter); + if (FSelection.Start <> ValidBB) or (FSelection.Stop <> ValidBE) then + Include(fStatusChanges, scSelection); + FSelection.Start := ValidBB; + FSelection.Stop := ValidBE; + InvalidateSelection; + end; finally - ActiveSelectionMode := vOldMode; DecPaintLock; end; end; -procedure TCustomSynEdit.RecalcCharExtent; -const - iFontStyles: array[0..3] of TFontStyles = ([], [fsItalic], [fsBold], - [fsItalic, fsBold]); +procedure TCustomSynEdit.SetCaretInRow(Value: TBufferCoord; Row: Integer); +{ Set the caret taking care of fCaretEOL } var - iHasStyle: array[0..3] of Boolean; - cAttr: Integer; - cStyle: Integer; - iCurr: TFontStyles; - Done: Boolean; + DC: TDisplayCoord; begin - FillChar(iHasStyle, SizeOf(iHasStyle), 0); - if Assigned(FHighlighter) and (FHighlighter.AttrCount > 0) then + if WordWrap then begin - for cAttr := 0 to FHighlighter.AttrCount - 1 do + DC := BufferToDisplayPos(Value); + if DC = DisplayCoord(1, Row + 1) then begin - iCurr := FHighlighter.Attribute[cAttr].Style * [fsItalic, fsBold]; - for cStyle := 0 to 3 do - if iCurr = iFontStyles[cStyle] then - begin - iHasStyle[cStyle] := True; - Break; - end; - end; + DC := DisplayCoord(fWordWrapPlugin.RowLength[Row] + 1, Row); + DisplayXY := DC; + end + else + CaretXY := Value; end else + CaretXY := Value; +end; + +procedure TCustomSynEdit.HighlightBrackets; +var + Token: string; + Attri: TSynHighlighterAttributes; + BracketPos, + MatchingBracketPos: TBufferCoord; + Indicator: TSynIndicator; +begin + if HandleAllocated and (eoBracketsHighlight in FOptions) then begin - iCurr := Font.Style * [fsItalic, fsBold]; - for cStyle := 0 to 3 do - if iCurr = iFontStyles[cStyle] then - begin - iHasStyle[cStyle] := True; - Break; - end; - end; + BracketPos := CaretXY; + + // Do not highlight inside comments and strings + if Assigned(fHighlighter) and GetHighlighterAttriAtRowCol(BracketPos, Token, Attri) and + ((Attri = fHighlighter.CommentAttribute) or (Attri = fHighlighter.StringAttribute)) + then + Exit; + + Indicators.Clear(BracketsHighlight.MatchingBracketsIndicatorID); + Indicators.Clear(BracketsHighlight.UnbalancedBracketIndicatorID); - Done := False; - FTextHeight := 0; - FCharWidth := 0; - FTextDrawer.BaseFont := Self.Font; + BracketPos := CaretXY; + MatchingBracketPos := GetMatchingBracketEnhanced(BracketPos, Brackets, False); - if not Done then - for cStyle := 0 to 3 do - if iHasStyle[cStyle] then + if MatchingBracketPos.IsValid then + begin + // We have a bracket at BracketPos + if MatchingBracketPos.Char = 0 then + begin + // The bracket at BracketPos is unbalanced + Indicator := TSynIndicator.Create(fBracketsHighlight.UnbalancedBracketIndicatorID, + BracketPos.Char, BracketPos.Char + 1); + Indicators.Add(BracketPos.Line, Indicator); + end + else begin - FTextDrawer.BaseStyle := iFontStyles[cStyle]; - FTextHeight := Max(FTextHeight, FTextDrawer.CharHeight); - FCharWidth := Max(FCharWidth, FTextDrawer.CharWidth); + // Matching pair of brackets + Indicator := TSynIndicator.Create(fBracketsHighlight.MatchingBracketsIndicatorID, + BracketPos.Char, BracketPos.Char + 1); + Indicators.Add(BracketPos.Line, Indicator); + Indicator := TSynIndicator.Create(fBracketsHighlight.MatchingBracketsIndicatorID, + MatchingBracketPos.Char, MatchingBracketPos.Char + 1); + Indicators.Add(MatchingBracketPos.Line, Indicator); end; - Inc(FTextHeight, FExtraLineSpacing); + end; + end; end; procedure TCustomSynEdit.HighlighterAttrChanged(Sender: TObject); begin - RecalcCharExtent; if Sender is TSynCustomHighlighter then begin - Lines.BeginUpdate; + IncPaintLock; try ScanRanges; finally - Lines.EndUpdate; + DecPaintLock; end; end else @@ -9484,797 +8181,543 @@ procedure TCustomSynEdit.HighlighterAttrChanged(Sender: TObject); procedure TCustomSynEdit.StatusChanged(AChanges: TSynStatusChanges); begin - FStatusChanges := FStatusChanges + AChanges; + fStatusChanges := fStatusChanges + AChanges; if PaintLock = 0 then - DoOnStatusChange(FStatusChanges); + DoOnStatusChange(fStatusChanges); +end; + +procedure TCustomSynEdit.SurfaceCaretFromHiddenFolds; +var + Index: Integer; + BC: TBufferCoord; + Range: TSynFoldRange; +begin + if not fUseCodeFolding then Exit; + + BC := CaretXY; + while AllFoldRanges.FoldHidesLine(BC.Line, Index) do + begin + Range := AllFoldRanges[Index]; + BC := BufferCoord(Length(Lines[Range.FromLine - 1]) + 1, Range.FromLine); + end; + if BC <> CaretXY then + CaretXY := BC; end; -procedure TCustomSynEdit.DoCaseChange(const Cmd: TSynEditorCommand); +procedure TCustomSynEdit.SurroundSelection(const Before: string; After: string); +var + Sel: string; + OldLen: Integer; +begin + Sel := SelText; + if Sel = '' then Exit; + + if After = '' then + After := Before; + + OldLen := Sel.Length; + Sel := Before + Sel + After; + SetSelTextPrimitiveEx(Sel, True, True); + IncPaintLock; + try + SelStart := SelStart + Before.Length; + SelLength := OldLen; + finally + DecPaintLock; + end; +end; + +procedure TCustomSynEdit.ExecCmdCaseChange(const Cmd: TSynEditorCommand); - function ToggleCase(const aStr: UnicodeString): UnicodeString; + function ToggleCase(const aStr: string): string; var - i: Integer; - sLower: UnicodeString; + I: Integer; + sLower: string; begin - Result := SynWideUpperCase(aStr); - sLower := SynWideLowerCase(aStr); - for i := 1 to Length(aStr) do + Result := aStr.ToUpper; + sLower := aStr.ToLower; + for I := 1 to Length(aStr) do begin - if Result[i] = aStr[i] then - Result[i] := sLower[i]; + if Result[I] = aStr[I] then + Result[I] := sLower[I]; end; end; - function TitleCase(const aStr: UnicodeString): UnicodeString; + function TitleCase(S:string): string; var - i: Integer; + I: Integer; begin - Result := SynWideLowerCase(aStr); - for i := 1 to Length(Result) do - if (i = 1) or IsWordBreakChar(Result[i-1]) then Result[i] := SynWideUpperCase(Result[i])[1]; + S[1] := S[1].ToUpper; + For I := 1 to Length(S) - 1 Do + If IsWordBreakChar(S[I]) then + S[I+1] := S[I + 1].ToUpper + else + S[I + 1] := S[I + 1].ToLower; + Result := S; end; var - w: UnicodeString; - oldCaret, oldBlockBegin, oldBlockEnd: TBufferCoord; - bHadSel : Boolean; + S: string; + OldCaret, OldBlockBegin, OldBlockEnd: TBufferCoord; begin - Assert((Cmd >= ecUpperCase) and (Cmd <= ecTitleCaseBlock)); - if SelAvail then - begin - bHadSel := True; - oldBlockBegin := BlockBegin; - oldBlockEnd := BlockEnd; - end - else begin - bHadSel := False; - end; - oldCaret := CaretXY; + Assert((Cmd >= ecUpperCase) and (Cmd <= ecTitleCase)); + if ReadOnly then Exit; + + OldBlockBegin := BlockBegin; + OldBlockEnd := BlockEnd; + OldCaret := CaretXY; try - if Cmd < ecUpperCaseBlock then - begin - { Word commands } + if not SelAvail then SetSelWord; - if SelText = '' then - begin - { searches a previous Word } - InternalCaretXY := PrevWordPos; - SetSelWord; - if SelText = '' then - begin - { try once more since PrevWordPos may have failed last time. - (PrevWordPos "points" to the end of the previous line instead of the - beggining of the previous Word if invoked (e.g.) when CaretX = 1) } - InternalCaretXY := PrevWordPos; - SetSelWord; - end; - end; - end - else begin - { block commands } - if not SelAvail then - begin - if CaretX <= Length(LineText) then - MoveCaretHorz(1, True) - else if CaretY < Lines.Count then - InternalCaretXY := BufferCoord(1, CaretY +1); - end; - end; - w := SelText; - if w <> '' then + S := SelText; + if S <> '' then begin case Cmd of - ecUpperCase, ecUpperCaseBlock: - w := SynWideUpperCase(w); - ecLowerCase, ecLowerCaseBlock: - w := SynWideLowerCase(w); - ecToggleCase, ecToggleCaseBlock: - w := ToggleCase(w); - ecTitleCase, ecTitleCaseBlock: - w := TitleCase(w); - end; - BeginUndoBlock; - try - if bHadSel then - FUndoList.AddChange(crSelection, oldBlockBegin, oldBlockEnd, '', FActiveSelectionMode) - else - FUndoList.AddChange(crSelection, oldCaret, oldCaret, '', FActiveSelectionMode); - FUndoList.AddChange(crCaret, oldCaret, oldCaret, '', FActiveSelectionMode); - SelText := w; - finally - EndUndoBlock; + ecUpperCase: + S := S.ToUpper; + ecLowerCase: + S := S.ToLower; + ecToggleCase: + S := ToggleCase(S); + ecTitleCase: + S := TitleCase(S); end; + SelText := S; end; finally - { "word" commands do not restore Selection } - if bHadSel and (Cmd >= ecUpperCaseBlock) then - begin - BlockBegin := oldBlockBegin; - BlockEnd := oldBlockEnd; - end; - { "block" commands with empty Selection move the Caret } - if bHadSel or (Cmd < ecUpperCaseBlock) then - CaretXY := oldCaret; + SetCaretAndSelection(OldCaret, OldBlockBegin, OldBlockEnd); end; end; procedure TCustomSynEdit.DoTabKey; var StartOfBlock: TBufferCoord; - i, MinLen, iLine: Integer; - PrevLine, Spaces: UnicodeString; - p: PWideChar; + I, MinLen, Line: Integer; + PrevLine, Spaces: string; + P: PWideChar; NewCaretX: Integer; - ChangeScroll: Boolean; - nPhysX, nDistanceToTab, nSpacesToNextTabStop : Integer; - OldSelTabLine, vIgnoreSmartTabs: Boolean; + PhysX, DistanceToTab, SpacesToNextTabStop: Integer; + IgnoreSmartTabs, TrimTrailingActive: Boolean; begin // Provide Visual Studio like block indenting - OldSelTabLine := SelTabLine; - if (eoTabIndent in Options) and ((SelTabBlock) or (OldSelTabLine)) then + if (eoTabIndent in Options) and not FSelection.IsEmpty then begin DoBlockIndent; - if OldSelTabLine then - begin - if FBlockBegin.Char < FBlockEnd.Char then - FBlockBegin.Char := 1 - else - FBlockEnd.Char := 1; - end; Exit; end; - i := 0; - iLine := 0; + I := 0; + Line := 0; MinLen := 0; - vIgnoreSmartTabs := False; - if eoSmartTabs in FOptions then + IgnoreSmartTabs := False; + if eoSmartTabs in fOptions then begin - iLine := CaretY - 1; - if (iLine > 0) and (iLine < Lines.Count) then + Line := CaretY - 1; + if (Line > 0) and (Line < Lines.Count) then begin - Dec(iLine); + Dec(Line); repeat //todo: rethink it MinLen := DisplayToBufferPos(DisplayCoord( - BufferToDisplayPos(CaretXY).Column, LineToRow(iLine + 1))).Char; - PrevLine := Lines[iLine]; + BufferToDisplayPos(CaretXY).Column, LineToRow(Line + 1))).Char; + PrevLine := Lines[Line]; if (Length(PrevLine) >= MinLen) then begin - p := @PrevLine[MinLen]; + P := @PrevLine[MinLen]; // scan over non-whitespaces repeat - if (p^ = #9) or (p^ = #32) then - Break; - Inc(i); - Inc(p); - until p^ = #0; + if (P^ = #9) or (P^ = #32) or (P^ = #$00A0) then Break; + Inc(I); + Inc(P); + until P^ = #0; // scan over whitespaces - if p^ <> #0 then + if P^ <> #0 then repeat - if (p^ <> #9) and (p^ <> #32) then Break; - Inc(i); - Inc(p); - until p^ = #0; + if (P^ <> #9) and (P^ <> #32) and (P^ <> #$00A0) then Break; + Inc(I); + Inc(P); + until P^ = #0; Break; end; - Dec(iLine); - until iLine < 0; + Dec(Line); + until Line < 0; end else - vIgnoreSmartTabs := True; + IgnoreSmartTabs := True; end; - FUndoList.BeginBlock; + BeginUndoBlock; try if SelAvail then - begin - FUndoList.AddChange(crDelete, FBlockBegin, FBlockEnd, SelText, - FActiveSelectionMode); - SetSelTextPrimitive(''); - end; + SetSelText(''); StartOfBlock := CaretXY; - if i = 0 then + if I = 0 then begin - if (eoTabsToSpaces in FOptions) then + if (eoTabsToSpaces in fOptions) then begin - i := TabWidth - (StartOfBlock.Char - 1) mod TabWidth; - if i = 0 then - i := TabWidth; + I := TabWidth - (StartOfBlock.Char - 1) mod TabWidth; + if I = 0 then + I := TabWidth; end else - i := TabWidth; + I := TabWidth; end; - if eoTabsToSpaces in FOptions then - begin - Spaces := UnicodeStringOfChar(#32, i); - NewCaretX := StartOfBlock.Char + i; - end - else if (eoTrimTrailingSpaces in Options) and (StartOfBlock.Char > Length(LineText)) then + if eoTabsToSpaces in fOptions then begin - // work-around for trimming Tabs - nPhysX := BufferToDisplayPos(CaretXY).Column; - if (eoSmartTabs in FOptions) and not vIgnoreSmartTabs and (iLine > -1) then - begin - i := BufferToDisplayPos( BufferCoord(MinLen+i, iLine+1) ).Column; - nDistanceToTab := i - nPhysX; - end - else - nDistanceToTab := TabWidth - ((nPhysX - 1) mod TabWidth); - NewCaretX := StartOfBlock.Char + nDistanceToTab; + Spaces := StringOfChar(#32, I); + NewCaretX := StartOfBlock.Char + I; end else begin - if (eoSmartTabs in FOptions) and not vIgnoreSmartTabs and (iLine > -1) then + if (eoSmartTabs in fOptions) and not IgnoreSmartTabs and (Line > -1) then begin - Spaces := Copy(FLines[CaretXY.Line - 1], 1, CaretXY.Char - 1); + Spaces := Copy(fLines[CaretXY.Line - 1], 1, CaretXY.Char - 1); while Pos(#9, Spaces) > 0 do Delete(Spaces, Pos(#9, Spaces), 1); - Spaces := WideTrim(Spaces); + Spaces := Trim(Spaces); //smart tabs are only in the front of the line *NOT IN THE MIDDLE* if Spaces = '' then begin - i := BufferToDisplayPos( BufferCoord(MinLen+i, iLine+1) ).Column; + I := BufferToDisplayPos( BufferCoord(MinLen+I, Line+1) ).Column; - nPhysX := DisplayX; - nDistanceToTab := i - nPhysX; - nSpacesToNextTabStop := TabWidth - ((nPhysX - 1) mod TabWidth); - if nSpacesToNextTabStop <= nDistanceToTab then begin + PhysX := DisplayX; + DistanceToTab := I - PhysX; + SpacesToNextTabStop := TabWidth - ((PhysX - 1) mod TabWidth); + if SpacesToNextTabStop <= DistanceToTab then begin Spaces := #9; - Dec(nDistanceToTab, nSpacesToNextTabStop); + Dec(DistanceToTab, SpacesToNextTabStop); end; - while nDistanceToTab >= TabWidth do begin + while DistanceToTab >= TabWidth do begin Spaces := Spaces + #9; - Dec(nDistanceToTab, TabWidth); + Dec(DistanceToTab, TabWidth); end; - if nDistanceToTab > 0 then - Spaces := Spaces + UnicodeStringOfChar(#32, nDistanceToTab); + if DistanceToTab > 0 then + Spaces := Spaces + StringofChar(#32, DistanceToTab); end else Spaces := #9; end else begin Spaces := #9; end; - if (eoTrimTrailingSpaces in Options) and (Length(TrimTrailingSpaces(LineText)) = 0) then - NewCaretX := StartOfBlock.Char + GetExpandedLength(Spaces, TabWidth) - else - NewCaretX := StartOfBlock.Char + Length(Spaces); - end; - - SetSelTextPrimitive(Spaces); - // Undo is already handled in SetSelText when SelectionMode is Column - if FActiveSelectionMode <> smColumn then - begin - FUndoList.AddChange(crInsert, StartOfBlock, CaretXY, SelText, - FActiveSelectionMode); + NewCaretX := StartOfBlock.Char + Length(Spaces); end; + // Do not Trim + TrimTrailingActive := eoTrimTrailingSpaces in Options; + if TrimTrailingActive then Exclude(fOptions, eoTrimTrailingSpaces); + SetSelText(Spaces); + if TrimTrailingActive then Include(fOptions, eoTrimTrailingSpaces); finally - FUndoList.EndBlock; - end; - - ChangeScroll := not(eoScrollPastEol in FOptions); - try - Include(FOptions, eoScrollPastEol); - InternalCaretX := NewCaretX; - finally - if ChangeScroll then - Exclude(FOptions, eoScrollPastEol); + EndUndoBlock; end; + ForceCaretX(NewCaretX); EnsureCursorPosVisible; end; +procedure TCustomSynEdit.PaintText(S: string; P: TPoint; ClipR: TRect; + FontStyle: TFontStyles; FontColor: TColor; BkgColor: TColor = clNone); +{ Support routine that can be used in plugins, handlers of AfterPaint etc. + P is relative to ClipRect } +var + RT: ID2D1DCRenderTarget; + Layout: TSynTextLayout; +begin + Layout.Create(FTextFormat, PChar(S), S.Length, MaxInt, fTextHeight); + Layout.SetFontStyle(FontStyle, 1, S.Length); + RT := TSynDWrite.RenderTarget; + RT.SetTransform(TD2DMatrix3X2F.Identity); + RT.BindDC(Canvas.Handle, ClipR); + RT.BeginDraw; + if BkgColor <> clNone then + RT.Clear(D2D1ColorF(BkgColor)); + Layout.Draw(RT, P.X, P.Y, FontColor); + if RT.EndDraw <> S_OK then TSynDWrite.ResetRenderTarget; +end; + procedure TCustomSynEdit.DoShiftTabKey; // shift-tab key handling var - NewX: Integer; - Line: UnicodeString; - LineLen: Integer; - DestX: Integer; - MaxLen, iLine: Integer; - PrevLine, OldSelText: UnicodeString; + PrevLine: string; p: PWideChar; - OldCaretXY: TBufferCoord; - ChangeScroll: Boolean; + SpaceCount1, SpaceCount2: Integer; + TempS, TempS2: string; begin - // Provide Visual Studio like block indenting - if (eoTabIndent in Options) and ((SelTabBlock) or (SelTabLine)) then - begin - DoBlockUnIndent; - Exit; - end; - - NewX := CaretX; - - if (NewX <> 1) and (eoSmartTabs in FOptions) then + if (eoSmartTabs in Options) and not SelAvail then begin iLine := CaretY - 1; if (iLine > 0) and (iLine < Lines.Count) then begin + TempS := Lines[CaretY - 1]; + SpaceCount1 := LeftSpaces(TempS, True, FTabWidth); + if SpaceCount1 = 0 then Exit; + Dec(iLine); - MaxLen := CaretX - 1; + MaxLen := SpaceCount1; + SpaceCount2 := 0; repeat - PrevLine := Lines[iLine]; - if (Length(PrevLine) >= MaxLen) then + PrevLine := ExpandTabs(Lines[iLine], fTabWidth); + if (PrevLine.Length > 0) and (Length(PrevLine) >= MaxLen) then begin p := @PrevLine[MaxLen]; // scan over whitespaces repeat - if p^ <> #32 then Break; - Dec(NewX); + if (p^ <> #32) and (p^ <> #$00A0) then Break; + Inc(SpaceCount2); Dec(p); - until NewX = 1; + until SpaceCount2 = SpaceCount1; // scan over non-whitespaces - if NewX <> 1 then + if SpaceCount2 < SpaceCount1 then repeat - if p^ = #32 then Break; - Dec(NewX); + if (p^ = #32) or (p^ = #$00A0) then Break; + Inc(SpaceCount2); Dec(p); - until NewX = 1; + until SpaceCount2 = SpaceCount1; Break; end; Dec(iLine); until iLine < 0; + if SpaceCount2 = 0 then // UnIndent at least + SpaceCount2 := ((SpaceCount1 -1) mod TabWidth) + 1; + TempS2 := GetLeftSpacing(SpaceCount1 - SpaceCount2, True); + SpaceCount1 := LeftSpaces(TempS, False); + Delete(TempS, 1, SpaceCount1); + TempS := TempS2 + TempS; + Lines[CaretY - 1] := TempS; + CaretX := CaretX + TempS2.Length - SpaceCount1; end; - end; - - if NewX = CaretX then - begin - Line := LineText; - LineLen := Length(Line); - - // find real un-tab position - - DestX := ((CaretX - 2) div TabWidth) * TabWidth + 1; - if NewX > LineLen then - NewX := DestX - else if (NewX > DestX) and (Line[NewX - 1] = #9) then - Dec(NewX) - else begin - while (NewX > DestX) and ((NewX - 1 > LineLen) or (Line[NewX - 1] = #32)) do - Dec(NewX); - end; - end; - - // perform un-tab - if (NewX <> CaretX) then - begin - SetBlockBegin(BufferCoord(NewX, CaretY)); - SetBlockEnd(CaretXY); - OldCaretXY := CaretXY; - - OldSelText := SelText; - SetSelTextPrimitive(''); - - FUndoList.AddChange(crSilentDelete, BufferCoord(NewX, CaretY), - OldCaretXY, OldSelText, smNormal); - - // KV - ChangeScroll := not(eoScrollPastEol in FOptions); - try - Include(FOptions, eoScrollPastEol); - InternalCaretX := NewX; - finally - if ChangeScroll then - Exclude(FOptions, eoScrollPastEol); - end; - end; + end + else + DoBlockUnIndent; end; procedure TCustomSynEdit.DoHomeKey(Selection: Boolean); - - function LastCharInRow: Integer; - var - vPos: TDisplayCoord; - begin - if FLines.Count = 0 then - Result := 1 - else - begin - vPos := DisplayXY; - vPos.Column := Min(CharsInWindow, FWordWrapPlugin.GetRowLength(vPos.Row) + 1); - Result := DisplayToBufferPos(vPos).Char; - end; - end; - var - newX: Integer; - first_nonblank: Integer; - s: UnicodeString; - vNewPos: TDisplayCoord; - vMaxX: Integer; + FirstNonBlank: Integer; + S: string; + NewPos: TDisplayCoord; + MaxX: Integer; begin // home key enhancement - if (eoEnhanceHomeKey in FOptions) and (LineToRow(CaretY) = DisplayY) then - begin - s := FLines[CaretXY.Line - 1]; - - first_nonblank := 1; - if WordWrap then - vMaxX := LastCharInRow() -1 + NewPos := DisplayXY; + if eoEnhanceHomeKey in fOptions then + begin + S := Rows[NewPos.Row]; + FirstNonBlank := 1; + MaxX := Length(S); + while (FirstNonBlank <= MaxX) and IsWhiteChar(S[FirstNonBlank]) do + Inc(FirstNonBlank); + if NewPos.Column = FirstNonBlank then + NewPos.Column := 1 else - vMaxX := Length(s); - while (first_nonblank <= vMaxX) and - CharInSet(s[first_nonblank], [#32, #9]) - do - Inc(first_nonblank); - Dec(first_nonblank); - - newX := CaretXY.Char - 1; - - if (newX > first_nonblank) or (newX = 0) then - newX := first_nonblank + 1 - else - newX := 1; + NewPos.Column := FirstNonBlank; end else - newX := 1; + NewPos.Column := 1; - if WordWrap then - begin - vNewPos.Row := DisplayY; - vNewPos.Column := BufferToDisplayPos(BufferCoord(newX, CaretY)).Column; - MoveCaretAndSelection(CaretXY, DisplayToBufferPos(vNewPos), Selection); - end - else - MoveCaretAndSelection(CaretXY, BufferCoord(newX, CaretY), Selection); + MoveDisplayPosAndSelection(NewPos, Selection); end; procedure TCustomSynEdit.DoEndKey(Selection: Boolean); - - function CaretInLastRow: Boolean; - var - vLastRow: Integer; - begin - if not WordWrap then - Result := True - else - begin - vLastRow := LineToRow(CaretY + 1) - 1; - // This check allows good behaviour with empty rows (this can be useful in a diff app ;-) - while (vLastRow > 1) - and (FWordWrapPlugin.GetRowLength(vLastRow) = 0) - and (RowToLine(vLastRow) = CaretY) do - begin - Dec(vLastRow); - end; - Result := DisplayY = vLastRow; - end; - end; - - function FirstCharInRow: Integer; - var - vPos: TDisplayCoord; - begin - vPos.Row := DisplayY; - vPos.Column := 1; - Result := DisplayToBufferPos(vPos).Char; - end; - var - vText: UnicodeString; - vLastNonBlank: Integer; - vNewX: Integer; - vNewCaret: TDisplayCoord; - vMinX: Integer; - vEnhance: Boolean; + S: string; + LastNonBlank: Integer; + NewPos: TDisplayCoord; begin - if (eoEnhanceEndKey in FOptions) and CaretInLastRow then + NewPos := DisplayXY; + S := Rows[NewPos.Row]; + if eoEnhanceEndKey in fOptions then begin - vEnhance := True; - vText := LineText; - vLastNonBlank := Length(vText); - if WordWrap then - vMinX := FirstCharInRow() - 1 - else - vMinX := 0; - while (vLastNonBlank > vMinX) and CharInSet(vText[vLastNonBlank], [#32, #9]) do - Dec(vLastNonBlank); + LastNonBlank := Length(S); + while (LastNonBlank > 0) and IsWhiteChar(S[LastNonBlank]) do + Dec(LastNonBlank); - vNewX := CaretX - 1; - if vNewX = vLastNonBlank then - vNewX := Length(LineText) + 1 + if NewPos.Column = LastNonBlank + 1 then + NewPos.Column := Length(S) + 1 else - vNewX := vLastNonBlank + 1; + NewPos.Column := LastNonBlank + 1; end else - begin - vNewX := Length(LineText) + 1; - vEnhance := False; - end; + NewPos.Column := Length(S) + 1; - if WordWrap then - begin - vNewCaret.Row := DisplayY; - if vEnhance then - vNewCaret.Column := BufferToDisplayPos(BufferCoord(vNewX, CaretY)).Column - else - vNewCaret.Column := FWordWrapPlugin.GetRowLength(vNewCaret.Row) + 1; - vNewCaret.Column := Min(CharsInWindow + 1, vNewCaret.Column); - MoveCaretAndSelection(CaretXY, DisplayToBufferPos(vNewCaret), Selection); - // Updates FCaretAtEOL flag. - SetInternalDisplayXY(vNewCaret); - end - else - MoveCaretAndSelection(CaretXY, - BufferCoord(vNewX, CaretY), Selection); + MoveDisplayPosAndSelection(NewPos, Selection); end; procedure TCustomSynEdit.CreateWnd; +var + DropTarget: TSynDropTarget; begin inherited; + // This is to avoid getting the text of the control while recreating + WindowText := StrNew('SynEdit'); // dummy caption -{$IFNDEF UNICODE} - if not (csDesigning in ComponentState) then - begin - // "redefine" window-procedure to get Unicode messages - if Win32PlatformIsUnicode then - SetWindowLongW(Handle, GWL_WNDPROC, Integer(GetWindowLongA(Handle, GWL_WNDPROC))); - end; -{$ENDIF} - - if (eoDropFiles in FOptions) and not (csDesigning in ComponentState) then + if (eoDropFiles in fOptions) and not (csDesigning in ComponentState) then DragAcceptFiles(Handle, True); + if not (csDesigning in ComponentState) then begin + DropTarget := TSynDropTarget.Create; + with DropTarget do begin + OnDragEnter := OleDragEnter; + OnDragOver := OleDragOver; + OnDragLeave := OleDragLeave; + OnDrop := OleDrop; + end; + RegisterDragDrop (Handle, DropTarget); + end; + UpdateScrollBars; end; -procedure TCustomSynEdit.DestroyWnd; +procedure TCustomSynEdit.InvalidateRange(const BB, BE: TBufferCoord); +var + DB, DE: TDisplayCoord; + P1, P2: TPoint; + R: TRect; begin - if (eoDropFiles in FOptions) and not (csDesigning in ComponentState) then - DragAcceptFiles(Handle, False); - -{$IFNDEF UNICODE} - if not (csDesigning in ComponentState) then + if BB.Line <> BE.Line then + InvalidateLines(BB.Line, BE.Line) + else if BB.Char <> BE.Char then begin - // restore window-procedure to what VCL expects - if Win32PlatformIsUnicode then - SetWindowLongA(Handle, GWL_WNDPROC, Integer(GetWindowLongW(Handle, GWL_WNDPROC))); + DB := BufferToDisplayPos(BB); + DE := BufferToDisplayPos(BE); + if DB.Row <> DE.Row then + InvalidateLine(BB.Line) + else + begin + // part of a row + if not InRange(DB.Row, TopLine, TopLine + LinesInWindow) or + (DB.Column = DE.Column) + then + Exit; + P1 := RowColumnToPixels(DB); + P2 := RowColumnToPixels(DE); + R := Rect(P1.X, fTextHeight * (DB.Row - TopLine), P2.X, + fTextHeight * (DB.Row - TopLine + 1)); + R.NormalizeRect; + InvalidateRect(R, False); + end; end; -{$ENDIF} - -{$IFDEF UNICODE} - // assign WindowText here, otherwise the VCL will call GetText twice - if WindowText = nil then - WindowText := Lines.GetText; -{$ENDIF} - inherited; end; procedure TCustomSynEdit.InvalidateRect(const aRect: TRect; aErase: Boolean); begin - Windows.InvalidateRect(Handle, @aRect, aErase); + Winapi.Windows.InvalidateRect(Handle, @aRect, aErase); end; procedure TCustomSynEdit.DoBlockIndent; var OrgCaretPos: TBufferCoord; BB, BE: TBufferCoord; - Run, StrToInsert: PWideChar; - e, x, i, InsertStrLen: Integer; - Spaces: UnicodeString; - OrgSelectionMode: TSynSelectionMode; - InsertionPos: TBufferCoord; + Line: string; + EndLine, I: Integer; + Spaces: string; begin - OrgSelectionMode := FActiveSelectionMode; OrgCaretPos := CaretXY; - StrToInsert := nil; - if SelAvail then - try - // keep current selection detail - BB := BlockBegin; - BE := BlockEnd; + // keep current selection detail + BB := BlockBegin; + BE := BlockEnd; - // build text to insert - if (BE.Char = 1) then - begin - e := BE.Line - 1; - x := 1; - end - else begin - e := BE.Line; - if eoTabsToSpaces in Options then - x := CaretX + FTabWidth - else x := CaretX + 1; - end; - if (eoTabsToSpaces in Options) then - begin - InsertStrLen := (FTabWidth + 2) * (e - BB.Line) + FTabWidth + 1; - // chars per line * lines-1 + last line + null char - StrToInsert := WStrAlloc(InsertStrLen); - Run := StrToInsert; - Spaces := UnicodeStringOfChar(#32, FTabWidth); - end - else begin - InsertStrLen := 3 * (e - BB.Line) + 2; - // #9#13#10 * lines-1 + (last line's #9 + null char) - StrToInsert := WStrAlloc(InsertStrLen); - Run := StrToInsert; - Spaces := #9; - end; - for i := BB.Line to e-1 do + // build text to insert + if (BE.Char = 1) and (BE.Line > BB.Line) then + EndLine := BE.Line - 1 + else + EndLine := BE.Line; + if (eoTabsToSpaces in Options) then + Spaces := StringofChar(#32, FTabWidth) + else + Spaces := #9; + + Lines.BeginUpdate; + BeginUndoBlock; + try + for I := BB.Line to EndLine do begin - WStrCopy(Run, PWideChar(Spaces + #13#10)); - Inc(Run, Length(spaces) + 2); + Line := Lines[I - 1]; + if (Line <> '') or (I = EndLine) then + Lines[I - 1] := Spaces + Line; end; - WStrCopy(Run, PWideChar(Spaces)); - FUndoList.BeginBlock; - try - InsertionPos.Line := BB.Line; - if FActiveSelectionMode = smColumn then - InsertionPos.Char := Min(BB.Char, BE.Char) - else - InsertionPos.Char := 1; - InsertBlock(InsertionPos, InsertionPos, StrToInsert, True); - FUndoList.AddChange(crIndent, BB, BE, '', smColumn); - //We need to save the position of the end block for redo - FUndoList.AddChange(crIndent, - BufferCoord(BB.Char + length(Spaces), BB.Line), - BufferCoord(BE.Char + length(Spaces), BE.Line), - '', smColumn); - finally - FUndoList.EndBlock; - end; + if (OrgCaretPos.Char > 1) or (BB.Line = BE.Line) then + Inc(OrgCaretPos.Char, Spaces.Length); + if (BB.Char > 1) or (BB.Line = BE.Line) then + Inc(BB.Char, Spaces.Length); + if (BE.Char > 1) or (BB.Line = BE.Line) then + Inc(BE.Char, Spaces.Length); - //adjust the x position of orgcaretpos appropriately - OrgCaretPos.Char := X; + SetCaretAndSelection(OrgCaretPos, BB, BE); finally - if BE.Char > 1 then - Inc(BE.Char, Length(Spaces)); - WStrDispose(StrToInsert); - SetCaretAndSelection(OrgCaretPos, - BufferCoord(BB.Char + Length(Spaces), BB.Line), BE); - ActiveSelectionMode := OrgSelectionMode; + EndUndoBlock; + Lines.EndUpdate; end; end; procedure TCustomSynEdit.DoBlockUnindent; -var - OrgCaretPos, - BB, BE: TBufferCoord; - Line, Run, - FullStrToDelete, - StrToDelete: PWideChar; - Len, x, StrToDeleteLen, i, TmpDelLen, FirstIndent, LastIndent, e: Integer; - TempString: UnicodeString; - OrgSelectionMode: TSynSelectionMode; - SomethingToDelete: Boolean; - - function GetDelLen: Integer; + + function GetDelLen(Line: PChar): Integer; var - Run: PWideChar; + Run: PChar; begin Result := 0; Run := Line; //Take care of tab character - if Run[0] = #9 then - begin - Result := 1; - SomethingToDelete := True; - Exit; - end; + if Run[0] = #9 then Exit(1); //Deal with compound tabwidths Sometimes they have TabChars after a few //spaces, yet we need to delete the whole tab width even though the char //count might not be FTabWidth because of the TabChar - while (Run[0] = #32) and (Result < FTabWidth) do + while ((Run[0] = #32) or (Run[0] = #$00A0)) and (Result < FTabWidth) do begin Inc(Result); Inc(Run); - SomethingToDelete := True; end; if (Run[0] = #9) and (Result < FTabWidth) then Inc(Result); end; +var + OrgCaretPos, BB, BE: TBufferCoord; + Line: string; + EndLine, I, TmpDelLen: Integer; + begin - OrgSelectionMode := FActiveSelectionMode; - Len := 0; - LastIndent := 0; - if SelAvail then - begin - // store current selection detail - BB := BlockBegin; - BE := BlockEnd; - OrgCaretPos := CaretXY; - x := FCaretX; + BB := BlockBegin; + BE := BlockEnd; + OrgCaretPos := CaretXY; - // convert selection to complete lines - if BE.Char = 1 then - e := BE.Line - 1 - else - e := BE.Line; - - // build string to delete - StrToDeleteLen := (FTabWidth + 2) * (e - BB.Line) + FTabWidth + 1; - // chars per line * lines-1 + last line + null char - StrToDelete := WStrAlloc(StrToDeleteLen); - StrToDelete[0] := #0; - SomethingToDelete := False; - for i := BB.Line to e-1 do - begin - Line := PWideChar(Lines[i - 1]); - //'Line' is 0-based, 'BB.x' is 1-based, so the '-1' - //And must not increment 'Line' pointer by more than its 'Length' - if FActiveSelectionMode = smColumn then - Inc(Line, MinIntValue([BB.Char - 1, BE.Char - 1, Length(Lines[i - 1])])); - //Instead of doing a UnicodeStringOfChar, we need to get *exactly* what was - //being deleted incase there is a TabChar - TmpDelLen := GetDelLen; - WStrCat(StrToDelete, PWideChar(Copy(Line, 1, TmpDelLen))); - WStrCat(StrToDelete, PWideChar(UnicodeString(#13#10))); - if (FCaretY = i) and (x <> 1) then - x := x - TmpDelLen; - end; - Line := PWideChar(Lines[e - 1]); - if FActiveSelectionMode = smColumn then - Inc(Line, MinIntValue([BB.Char - 1, BE.Char - 1, Length(Lines[e - 1])])); - TmpDelLen := GetDelLen; - WStrCat(StrToDelete, PWideChar(Copy(Line, 1, TmpDelLen))); - if (FCaretY = e) and (x <> 1) then - x := x - TmpDelLen; - - FirstIndent := -1; - FullStrToDelete := nil; - // Delete string - if SomethingToDelete then - begin - FullStrToDelete := StrToDelete; - InternalCaretY := BB.Line; - if FActiveSelectionMode <> smColumn then - i := 1 - else - i := Min(BB.Char, BE.Char); - repeat - Run := GetEOL(StrToDelete); - if Run <> StrToDelete then - begin - Len := Run - StrToDelete; - if FirstIndent = -1 then - FirstIndent := Len; - if Len > 0 then - begin - TempString := Lines[CaretY - 1]; - Delete(TempString, i, Len); - Lines[CaretY - 1] := TempString; - end; - end; - if Run^ = #13 then - begin - Inc(Run); - if Run^ = #10 then - Inc(Run); - Inc(FCaretY); - end; - StrToDelete := Run; - until Run^ = #0; - LastIndent := Len; - FUndoList.AddChange(crUnindent, BB, BE, FullStrToDelete, FActiveSelectionMode); - end; - // restore selection - if FirstIndent = -1 then - FirstIndent := 0; - //adjust the x position of orgcaretpos appropriately - if FActiveSelectionMode = smColumn then - SetCaretAndSelection(OrgCaretPos, BB, BE) - else + // convert selection to complete lines + if BE.Char = 1 then + EndLine := BE.Line - 1 + else + EndLine := BE.Line; + + Lines.BeginUpdate; + BeginUndoBlock; + try + for I := BB.Line to EndLine do begin - OrgCaretPos.Char := X; - Dec(BB.Char, FirstIndent); - Dec(BE.Char, LastIndent); - SetCaretAndSelection(OrgCaretPos, BB, BE); + Line := Lines[I - 1]; + //Instead of doing a StringofChar, we need to get *exactly* what was + //being deleted incase there is a TabChar + TmpDelLen := GetDelLen(PChar(Line)); + if TmpDelLen > 0 then + begin + Delete(Line, 1, TmpDelLen); + Lines[I - 1] := Line; + if I = BB.Line then + BB.Char := Max(BB.Char - TmpDelLen, 1); + if I = BE.Line then + BE.Char := Max(BE.Char - TmpDelLen, 1); + if I = OrgCaretPos.Line then + OrgCaretPos.Char := Max(OrgCaretPos.Char - TmpDelLen, 1); + end; end; - ActiveSelectionMode := OrgSelectionMode; - if FullStrToDelete <> nil then - WStrDispose(FullStrToDelete) - else - WStrDispose(StrToDelete); + SetCaretAndSelection(OrgCaretPos, BB, BE); + finally + EndUndoBlock; + Lines.EndUpdate; end; end; -{$IFDEF SYN_COMPILER_4_UP} function TCustomSynEdit.ExecuteAction(Action: TBasicAction): Boolean; begin if Action is TEditAction then @@ -10288,22 +8731,14 @@ function TCustomSynEdit.ExecuteAction(Action: TBasicAction): Boolean; CommandProcessor(ecCopy, ' ', nil) else if Action is TEditPaste then CommandProcessor(ecPaste, ' ', nil) -{$IFDEF SYN_COMPILER_5_UP} else if Action is TEditDelete then - begin - if SelAvail then - ClearSelection - else - CommandProcessor(ecDeleteChar, ' ', nil) - end + DeleteSelections else if Action is TEditUndo then CommandProcessor(ecUndo, ' ', nil) else if Action is TEditSelectAll then CommandProcessor(ecSelectAll, ' ', nil); -{$ENDIF} end end -{$IFDEF SYN_COMPILER_6_UP} else if Action is TSearchAction then begin Result := Focused; @@ -10319,67 +8754,60 @@ function TCustomSynEdit.ExecuteAction(Action: TBasicAction): Boolean; Result := Focused; DoSearchFindNextExecute(TSearchFindNext(Action)) end -{$ENDIF} else Result := inherited ExecuteAction(Action); end; function TCustomSynEdit.UpdateAction(Action: TBasicAction): Boolean; +var + IsEmpty: Boolean; begin + IsEmpty := (Lines.Count = 0) or (Lines.Count = 1) and (Lines[0] = ''); if Action is TEditAction then begin Result := Focused; if Result then begin if Action is TEditCut then - TEditAction(Action).Enabled := SelAvail and not ReadOnly + TEditAction(Action).Enabled := not (IsEmpty or ReadOnly) else if Action is TEditCopy then - TEditAction(Action).Enabled := SelAvail + TEditAction(Action).Enabled := not IsEmpty else if Action is TEditPaste then TEditAction(Action).Enabled := CanPaste -{$IFDEF SYN_COMPILER_5_UP} else if Action is TEditDelete then - TEditAction(Action).Enabled := not ReadOnly + TEditAction(Action).Enabled := not (FSelections.IsEmpty or ReadOnly) else if Action is TEditUndo then TEditAction(Action).Enabled := CanUndo else if Action is TEditSelectAll then TEditAction(Action).Enabled := True; -{$ENDIF} end; -{$IFDEF SYN_COMPILER_6_UP} - end else if Action is TSearchAction then + end else if (Action is TSearchAction) or (Action is TSearchFindNext) then begin Result := Focused; if Result then begin if Action is TSearchFindFirst then - TSearchAction(Action).Enabled := (Text<>'') and assigned(FSearchEngine) + TSearchAction(Action).Enabled := not IsEmpty and Assigned(fSearchEngine) else if Action is TSearchFind then - TSearchAction(Action).Enabled := (Text<>'') and assigned(FSearchEngine) + TSearchAction(Action).Enabled := not IsEmpty and Assigned(fSearchEngine) else if Action is TSearchReplace then - TSearchAction(Action).Enabled := (Text<>'') and assigned(FSearchEngine); + TSearchAction(Action).Enabled := not IsEmpty and Assigned(fSearchEngine) + else if Action is TSearchFindNext then + TSearchAction(Action).Enabled := not IsEmpty and Assigned(fSearchEngine) + and (TSearchFindNext(Action).SearchFind <> nil) + and (TSearchFindNext(Action).SearchFind.Dialog.FindText <> ''); end; - end else if Action is TSearchFindNext then - begin - Result := Focused; - if Result then - TSearchAction(Action).Enabled := (Text<>'') - and (TSearchFindNext(Action).SearchFind <> nil) - and (TSearchFindNext(Action).SearchFind.Dialog.FindText <> ''); -{$ENDIF} end else Result := inherited UpdateAction(Action); end; -{$ENDIF} procedure TCustomSynEdit.SetModified(Value: Boolean); begin - if Value <> FModified then begin - FModified := Value; - if (eoGroupUndo in Options) and (not Value) and UndoList.CanUndo then - UndoList.AddGroupBreak; - UndoList.InitialState := not Value; + if Value <> FUndoRedo.Modified then begin + fUndoRedo.Modified := Value; + if (eoGroupUndo in Options) and (not Value) and fUndoRedo.CanUndo then + fUndoRedo.AddGroupBreak; StatusChanged([scModified]); end; end; @@ -10388,20 +8816,8 @@ function TCustomSynEdit.DoOnSpecialLineColors(Line: Integer; var Foreground, Background: TColor): Boolean; begin Result := False; - if Assigned(FOnSpecialLineColors) then - FOnSpecialLineColors(Self, Line, Result, Foreground, Background); -end; - -procedure TCustomSynEdit.DoOnSpecialTokenAttributes(ALine, APos: Integer; const AToken: string; var FG, BG: TColor; - var AStyle: TFontStyles); -var - Special: Boolean; -begin - if Assigned(FOnSpecialTokenAttributes) then - begin - Special := False; - FOnSpecialTokenAttributes(Self, ALine, APos, AToken, Special, FG, BG, AStyle); - end; + if Assigned(fOnSpecialLineColors) then + fOnSpecialLineColors(Self, Line, Result, Foreground, Background); end; procedure TCustomSynEdit.InvalidateLine(Line: Integer); @@ -10411,11 +8827,7 @@ procedure TCustomSynEdit.InvalidateLine(Line: Integer); if (not HandleAllocated) or (Line < 1) or (Line > Lines.Count) or (not Visible) then Exit; -{$IFDEF SYN_CodeFolding} if UseCodeFolding or WordWrap then -{$ELSE} - if WordWrap then -{$ENDIF} begin InvalidateLines(Line, Line); Exit; @@ -10424,25 +8836,58 @@ procedure TCustomSynEdit.InvalidateLine(Line: Integer); if (Line >= TopLine) and (Line <= TopLine + LinesInWindow) then begin // invalidate text area of this line - rcInval := Rect(FGutterWidth, FTextHeight * (Line - TopLine), ClientWidth, 0); - rcInval.Bottom := rcInval.Top + FTextHeight; - if sfLinesChanging in FStateFlags then - UnionRect(fInvalidateRect, rcInval, fInvalidateRect) - else - InvalidateRect(rcInval, False); + rcInval := Rect(fGutterWidth, fTextHeight * (Line - TopLine), ClientWidth, 0); + rcInval.Bottom := rcInval.Top + fTextHeight; + InvalidateRect(rcInval, False); end; end; function TCustomSynEdit.GetReadOnly: Boolean; begin - Result := FReadOnly; + Result := fReadOnly; +end; + +function TCustomSynEdit.GetRow(RowIndex: Integer): string; +var + BC: TBufferCoord; + Len: Integer; +begin + BC := DisplayToBufferPos(DisplayCoord(1, RowIndex)); + if InRange(BC.Line, 1, Lines.Count) then + begin + if WordWrap then + begin + Len := fWordWrapPlugin.RowLength[RowIndex]; + Result := Copy(Lines[BC.Line - 1], BC.Char, Len); + end + else + Result := Lines[BC.Line - 1]; + end + else + Result := ''; +end; + +function TCustomSynEdit.GetRowLength(RowIndex: Integer): Integer; +var + BC: TBufferCoord; +begin + BC := DisplayToBufferPos(DisplayCoord(1, RowIndex)); + if InRange(BC.Line, 1, Lines.Count) then + begin + if WordWrap then + Result := fWordWrapPlugin.RowLength[RowIndex] + else + Result := Lines[BC.Line - 1].Length; + end + else + Result := 0; end; procedure TCustomSynEdit.SetReadOnly(Value: Boolean); begin - if FReadOnly <> Value then + if fReadOnly <> Value then begin - FReadOnly := Value; + fReadOnly := Value; StatusChanged([scReadOnly]); end; end; @@ -10452,587 +8897,524 @@ procedure TCustomSynEdit.FindMatchingBracket; InternalCaretXY := GetMatchingBracket; end; -procedure TCustomSynEdit.FontSmoothingChanged; -const - NONANTIALIASED_QUALITY = 3; - ANTIALIASED_QUALITY = 4; - CLEARTYPE_QUALITY = 5; -var - bMethod: Byte; - lf: TLogFont; -begin - case FFontSmoothing of - fsmAntiAlias: - bMethod := ANTIALIASED_QUALITY; - fsmClearType: - bMethod := CLEARTYPE_QUALITY; - else // fsmNone also - bMethod := NONANTIALIASED_QUALITY; - end; - GetObject(Font.Handle, SizeOf(TLogFont), @lf); - lf.lfQuality := bMethod; - Font.Handle := CreateFontIndirect(lf); -end; - function TCustomSynEdit.GetMatchingBracket: TBufferCoord; +var + Pos: TBufferCoord; begin - Result := GetMatchingBracketEx(CaretXY); + Pos := CaretXY; + Result := GetMatchingBracketEnhanced(Pos, Brackets); end; -function TCustomSynEdit.GetMatchingBracketEx(const APoint: TBufferCoord): TBufferCoord; -const - Brackets: array[0..7] of WideChar = ('(', ')', '[', ']', '{', '}', '<', '>'); +function TCustomSynEdit.GetMatchingBracketEx(const APoint: TBufferCoord; + Brackets: string): TBufferCoord; var - Line: UnicodeString; - i, PosX, PosY, Len: Integer; - Test, BracketInc, BracketDec: WideChar; + Line: string; + Index, PosX, PosY, Len, Increment: Integer; + Test, BracketInc, BracketDec: Char; NumBrackets: Integer; - vDummy: UnicodeString; - attr: TSynHighlighterAttributes; - p: TBufferCoord; - isCommentOrString: Boolean; -begin - Result.Char := 0; - Result.Line := 0; - // get char at caret + SDummy: string; + Attr: TSynHighlighterAttributes; + P: TBufferCoord; +begin + Result := TBufferCoord.Invalid; + + // Get char at caret PosX := APoint.Char; PosY := APoint.Line; - Line := Lines[APoint.Line - 1]; - if Length(Line) >= PosX then - begin - Test := Line[PosX]; - // is it one of the recognized brackets? - for i := Low(Brackets) to High(Brackets) do - if Test = Brackets[i] then + + // Check position is valid + if not InRange(PosY, 1, Lines.Count) then Exit; + Line := Lines[PosY - 1]; + if not BracketAtPos(PosX, Brackets, Line) then Exit; + + Test := Line[PosX]; + // is it one of the recognized brackets? + Index := Brackets.IndexOf(Test); // zero based + // this is the bracket, get the matching one and the direction + BracketInc := Brackets.Chars[Index]; + BracketDec := Brackets.Chars[Index xor 1]; // 0 -> 1, 1 -> 0, ... + + // search for the matching bracket (that is until NumBrackets = 0) + NumBrackets := 1; + if Odd(Index) then + Increment := -1 + else + Increment := + 1; + + repeat + Len := Line.Length; + // search within the line + repeat + PosX := PosX + Increment; + if not InRange(PosX, 1, Len) then Break; + + Test := Line[PosX]; + P.Char := PosX; + P.Line := PosY; + if ((Test = BracketInc) or (Test = BracketDec)) and + // not inside strings and comments + not (GetHighlighterAttriAtRowCol(BufferCoord(PosX, PosY), SDummy, Attr) + and ((Attr = Highlighter.StringAttribute) or + (Attr = Highlighter.CommentAttribute))) + then begin - // this is the bracket, get the matching one and the direction - BracketInc := Brackets[i]; - BracketDec := Brackets[i xor 1]; // 0 -> 1, 1 -> 0, ... - // search for the matching bracket (that is until NumBrackets = 0) - NumBrackets := 1; - if Odd(i) then + if Test = BracketInc then + Inc(NumBrackets) + else if Test = BracketDec then begin - repeat - // search until start of line - while PosX > 1 do - begin - Dec(PosX); - Test := Line[PosX]; - p.Char := PosX; - p.Line := PosY; - if (Test = BracketInc) or (Test = BracketDec) then - begin - if GetHighlighterAttriAtRowCol(p, vDummy, attr) then - isCommentOrString := (attr = Highlighter.StringAttribute) or - (attr = Highlighter.CommentAttribute) - else - isCommentOrString := False; - if (Test = BracketInc) and (not isCommentOrString) then - Inc(NumBrackets) - else if (Test = BracketDec) and (not isCommentOrString) then - begin - Dec(NumBrackets); - if NumBrackets = 0 then - begin - // matching bracket found, set caret and bail out - Result := P; - Exit; - end; - end; - end; - end; - // get previous line if possible - if PosY = 1 then Break; - Dec(PosY); - Line := Lines[PosY - 1]; - PosX := Length(Line) + 1; - until False; - end - else begin - repeat - // search until end of line - Len := Length(Line); - while PosX < Len do - begin - Inc(PosX); - Test := Line[PosX]; - p.Char := PosX; - p.Line := PosY; - if (Test = BracketInc) or (Test = BracketDec) then - begin - if GetHighlighterAttriAtRowCol(p, vDummy, attr) then - isCommentOrString := (attr = Highlighter.StringAttribute) or - (attr = Highlighter.CommentAttribute) - else - isCommentOrString := False; - if (Test = BracketInc) and (not isCommentOrString) then - Inc(NumBrackets) - else if (Test = BracketDec)and (not isCommentOrString) then - begin - Dec(NumBrackets); - if NumBrackets = 0 then - begin - // matching bracket found, set caret and bail out - Result := P; - Exit; - end; - end; - end; - end; - // get next line if possible - if PosY = Lines.Count then - Break; - Inc(PosY); - Line := Lines[PosY - 1]; - PosX := 0; - until False; + Dec(NumBrackets); + if NumBrackets = 0 then + begin + // matching bracket found, set Result and Exit + Result := P; + Exit; + end; end; - // don't test the other brackets, we're done - Break; end; - end; + until False; + // get next/previous line if possible + PosY := PosY + Increment; + if not InRange(PosY, 1, Lines.Count) then Break; + Line := Lines[PosY - 1]; + if Increment > 0 then + PosX := 0 + else + PosX := Line.Length + 1; + until False; end; -function TCustomSynEdit.GetHighlighterAttriAtRowCol(const XY: TBufferCoord; - var Token: UnicodeString; var Attri: TSynHighlighterAttributes): Boolean; -var - TmpType, TmpStart: Integer; -begin - Result := GetHighlighterAttriAtRowColEx(XY, Token, TmpType, TmpStart, Attri); -end; +function TCustomSynEdit.GetMatchingBracketEnhanced(var BracketPos: TBufferCoord; + Brackets: string = '()[]{}<>'; AdjustMatchingPos: Boolean = True): TBufferCoord; +{ + If there is a bracket on the left of BracketPos.Char it is used instead. + On Exit BracketPos points at the position of the bracket used for matching. + Returns BufferCoord(-1, -1) if BracketPos is not a bracket. + Returns BufferCoord(0, 0) if BracketPos contains an unbalanced bracket. + If AdjustMatchingPos and there is a match, the matching pair of positions + will be both either inside or outside the brackets. +} -function TCustomSynEdit.GetHighlighterAttriAtRowColEx(const XY: TBufferCoord; - var Token: UnicodeString; var TokenType, Start: Integer; - var Attri: TSynHighlighterAttributes): Boolean; var - PosX, PosY: Integer; - Line: UnicodeString; + Line: string; + HasBracket, IsPreviousChar, IsOpenChar, IsOutside: Boolean; begin - PosY := XY.Line - 1; - if Assigned(Highlighter) and (PosY >= 0) and (PosY < Lines.Count) then + Result := BufferCoord(-1, -1); + if BracketPos.Line > Lines.Count then Exit; + Line := Lines[BracketPos.Line - 1]; + + // First Look at the previous character like Site + IsPreviousChar := BracketPos.Char > 1; + if IsPreviousChar then + Dec(BracketPos.Char); + HasBracket := BracketAtPos(BracketPos.Char, Brackets, Line); + //if it is not a bracket then look at the next character; + if not HasBracket and IsPreviousChar then begin - Line := Lines[PosY]; - if PosY = 0 then - Highlighter.ResetRange - else - Highlighter.SetRange(TSynEditStringList(Lines).Ranges[PosY - 1]); - Highlighter.SetLine(Line, PosY); - PosX := XY.Char; - if (PosX > 0) and (PosX <= Length(Line)) then - while not Highlighter.GetEol do - begin - Start := Highlighter.GetTokenPos + 1; - Token := Highlighter.GetToken; - if (PosX >= Start) and (PosX < Start + Length(Token)) then - begin - Attri := Highlighter.GetTokenAttribute; - TokenType := Highlighter.GetTokenKind; - Result := True; - Exit; - end; - Highlighter.Next; - end; + Inc(BracketPos.Char); + IsPreviousChar := False; + HasBracket := BracketAtPos(BracketPos.Char, Brackets, Line); end; - Token := ''; - Attri := nil; - Result := False; -end; -function TCustomSynEdit.FindHookedCmdEvent(AHandlerProc: THookedCommandEvent): Integer; -var - Entry: THookedCommandHandlerEntry; -begin - Result := GetHookedCommandHandlersCount - 1; - while Result >= 0 do + if HasBracket then begin - Entry := THookedCommandHandlerEntry(FHookedCommandHandlers[Result]); - if Entry.Equals(AHandlerProc) then - Break; - Dec(Result); + Result := GetMatchingBracketEx(BracketPos, Brackets); + if (Result.Char > 0) and AdjustMatchingPos then + begin + IsOpenChar := IsOpeningBracket(Line[BracketPos.Char], Brackets); + IsOutside := IsOpenChar xor IsPreviousChar; + if IsOutside xor not IsOpenChar then + Inc(Result.Char); + end; end; end; -function TCustomSynEdit.GetHookedCommandHandlersCount: Integer; +function TCustomSynEdit.GetHighlighterAttriAtRowCol(const XY: TBufferCoord; + var Token: string; var Attri: TSynHighlighterAttributes): Boolean; +begin + Attri := nil; + if Assigned(fHighlighter) then + Attri := fHighlighter.GetHighlighterAttriAtRowCol(Lines, XY.Line - 1, XY.Char); + Result := Attri <> nil; +end; + +function TCustomSynEdit.GetHighlighterAttriAtRowColEx(const XY: TBufferCoord; + var Token: string; var TokenType, Start: Integer; + var Attri: TSynHighlighterAttributes): Boolean; begin - if Assigned(FHookedCommandHandlers) then - Result := FHookedCommandHandlers.Count + if Assigned(fHighlighter) then + Result := fHighlighter.GetHighlighterAttriAtRowColEx(Lines, XY.Line - 1, + XY.Char, Token, TokenType, Start, Attri) else - Result := 0; + Result := False; +end; + +function TCustomSynEdit.GetIsScrolling: Boolean; +begin + Result := FSynEditScrollBars.IsScrolling; end; procedure TCustomSynEdit.RegisterCommandHandler( const AHandlerProc: THookedCommandEvent; AHandlerData: Pointer); begin - if not Assigned(AHandlerProc) then - begin -{$IFDEF SYN_DEVELOPMENT_CHECKS} - raise Exception.Create('Event handler is NIL in RegisterCommandHandler'); -{$ENDIF} - Exit; - end; + if not Assigned(AHandlerProc) then Exit; + if not Assigned(FHookedCommandHandlers) then - FHookedCommandHandlers := TObjectList.Create; - if FindHookedCmdEvent(AHandlerProc) = -1 then - FHookedCommandHandlers.Add(THookedCommandHandlerEntry.Create( - AHandlerProc, AHandlerData)) - else -{$IFDEF SYN_DEVELOPMENT_CHECKS} - raise Exception.CreateFmt('Event handler (%p, %p) already registered', - [TMethod(AHandlerProc).Data, TMethod(AHandlerProc).Code]); -{$ENDIF} + FHookedCommandHandlers := TDictionary.Create; + FHookedCommandHandlers.AddOrSetValue(AHandlerProc, AHandlerData); end; procedure TCustomSynEdit.UnregisterCommandHandler(AHandlerProc: THookedCommandEvent); -var - i: Integer; begin - if not Assigned(AHandlerProc) then - begin -{$IFDEF SYN_DEVELOPMENT_CHECKS} - raise Exception.Create('Event handler is NIL in UnregisterCommandHandler'); -{$ENDIF} + if not (Assigned(AHandlerProc) and Assigned(FHookedCommandHandlers)) then Exit; - end; - i := FindHookedCmdEvent(AHandlerProc); - if i > -1 then - FHookedCommandHandlers.Delete(i) - else -{$IFDEF SYN_DEVELOPMENT_CHECKS} - raise Exception.CreateFmt('Event handler (%p, %p) is not registered', - [TMethod(AHandlerProc).Data, TMethod(AHandlerProc).Code]); -{$ENDIF} + + FHookedCommandHandlers.Remove(AHandlerProc); end; procedure TCustomSynEdit.NotifyHookedCommandHandlers(AfterProcessing: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer); var Handled: Boolean; - i: Integer; - Entry: THookedCommandHandlerEntry; + Handler: TPair; begin Handled := False; - for i := 0 to GetHookedCommandHandlersCount - 1 do - begin - Entry := THookedCommandHandlerEntry(FHookedCommandHandlers[i]); - // NOTE: Command should NOT be set to ecNone, because this might interfere - // with other handlers. Set Handled to False instead (and check its value - // to not process the command twice). - Entry.FEvent(Self, AfterProcessing, Handled, Command, AChar, Data, - Entry.FData); - end; + + if not Assigned(FHookedCommandHandlers) then Exit; + + for Handler in FHookedCommandHandlers do + Handler.Key(Self, AfterProcessing, Handled, Command, AChar, Data, + Handler.Value); if Handled then Command := ecNone; end; procedure TCustomSynEdit.DoOnClearBookmark(var Mark: TSynEditMark); begin - if Assigned(FOnClearMark) then - FOnClearMark(Self, Mark); + if Assigned(fOnClearMark) then + fOnClearMark(Self, Mark); end; -procedure TCustomSynEdit.DoOnPaintTransientEx(TransientType: TTransientType; Lock: Boolean); +procedure TCustomSynEdit.DoOnPaintTransient(TransientType: TTransientType); var DoTransient: Boolean; - i: Integer; + Plugin: TSynEditPlugin; begin - DoTransient :=(FPaintTransientLock=0); - if Lock then - begin - if (TransientType=ttBefore) then Inc(FPaintTransientLock) - else - begin - Dec(FPaintTransientLock); - DoTransient :=(FPaintTransientLock=0); - end; - end; + if (TransientType=ttBefore) then + Inc(FPaintTransientLock) + else + Dec(FPaintTransientLock); - if DoTransient then - begin - // plugins - if FPlugins <> nil then - for i := 0 to FPlugins.Count - 1 do - TSynEditPlugin(FPlugins[i]).PaintTransient(Canvas, TransientType); - // event - if Assigned(FOnPaintTransient) then - begin - Canvas.Font.Assign(Font); - Canvas.Brush.Color := Color; - HideCaret; - try - FOnPaintTransient(Self, Canvas, TransientType); - finally - ShowCaret; + DoTransient := (FPaintTransientLock = 0) or (fPaintLock = 0) and + (FPaintTransientPlugins or Assigned(fOnPaintTransient)); + + if DoTransient then + begin + FCarets.HideCarets; + Canvas.Font.Assign(Font); + Canvas.Brush.Color := Color; + try + // plugins + if FPlugins <> nil then + for Plugin in FPlugins do + if phPaintTransient in Plugin.Handlers then + PlugIn.PaintTransient(Canvas, TransientType); + // event + if Assigned(fOnPaintTransient) then + begin + fOnPaintTransient(Self, Canvas, TransientType); end; + finally + UpdateCarets; end; end; end; -procedure TCustomSynEdit.DoOnPaintTransient(TransientType: TTransientType); -begin - DoOnPaintTransientEx(TransientType, False); -end; - procedure TCustomSynEdit.DoOnPaint; begin - if Assigned(FOnPaint) then + if Assigned(fOnPaint) then begin Canvas.Font.Assign(Font); Canvas.Brush.Color := Color; - FOnPaint(Self, Canvas); + fOnPaint(Self, Canvas); end; end; procedure TCustomSynEdit.DoOnPlaceMark(var Mark: TSynEditMark); begin - if Assigned(FOnPlaceMark) then - FOnPlaceMark(Self, Mark); + if Assigned(fOnPlaceMark) then + fOnPlaceMark(Self, Mark); end; -function TCustomSynEdit.DoOnReplaceText(const ASearch, AReplace: UnicodeString; +function TCustomSynEdit.DoOnReplaceText(const ASearch, AReplace: string; Line, Column: Integer): TSynReplaceAction; begin Result := raCancel; - if Assigned(FOnReplaceText) then - FOnReplaceText(Self, ASearch, AReplace, Line, Column, Result); + if Assigned(fOnReplaceText) then + fOnReplaceText(Self, ASearch, AReplace, Line, Column, Result); end; procedure TCustomSynEdit.DoOnStatusChange(Changes: TSynStatusChanges); begin - if Assigned(FOnStatusChange) then - begin - FOnStatusChange(Self, FStatusChanges); - FStatusChanges := []; - end; -end; + if Changes * [scCaretX, scCaretY] <> [] then + HighlightBrackets; -procedure TCustomSynEdit.UpdateModifiedStatus; -begin - Modified := not UndoList.InitialState; + if (Changes * [scCaretX, scCaretY, scSelection] <> []) + and Assigned(FUIAutomationProvider) + then + (FUIAutomationProvider as TSynUIAutomationProvider).RaiseTextSelectionChangedEvent; + + if Assigned(fOnStatusChange) then + fOnStatusChange(Self, fStatusChanges); + fStatusChanges := []; end; -procedure TCustomSynEdit.UndoRedoAdded(Sender: TObject); +procedure TCustomSynEdit.ModifiedChanged(Sender: TObject); begin - UpdateModifiedStatus; - - // we have to clear the redo information, since adding undo info removes - // the necessary context to undo earlier edit actions - if (Sender = FUndoList) and not FUndoList.InsideRedo and - (FUndoList.PeekItem<>nil) and (FUndoList.PeekItem.ChangeReason<>crGroupBreak) then - FRedoList.Clear; - if TSynEditUndoList(Sender).BlockCount = 0 then - DoChange; + StatusChanged([scModified]); end; -function TCustomSynEdit.GetWordAtRowCol(XY: TBufferCoord): UnicodeString; - -// TODO: consider removing the use of Low/High(string) since this code is anyway not zero-based strings ready -{$IFNDEF SYN_COMPILER_17_UP} - function Low(AStr: UnicodeString): Integer; {$IFDEF SYN_COMPILER_9_UP}inline;{$ENDIF} - begin - Result := 1; - end; - - function High(AStr: UnicodeString): Integer; {$IFDEF SYN_COMPILER_9_UP}inline;{$ENDIF} - begin - Result := Length(AStr); - end; -{$ENDIF} - +function TCustomSynEdit.GetWordAtRowCol(XY: TBufferCoord): string; var - Line: UnicodeString; - Start, Stop: Integer; + Line: string; + Len, Start, Stop: Integer; begin Result := ''; if (XY.Line >= 1) and (XY.Line <= Lines.Count) then begin Line := Lines[XY.Line - 1]; - if (Length(Line) > 0) and - ((XY.Char >= Low(Line)) and (XY.Char <= High(Line))) and - IsIdentChar(Line[XY.Char]) then + Len := Length(Line); + if (Len > 0) and InRange(XY.Char, 1, Len + 1) then begin - Start := XY.Char; - while (Start > Low(Line)) and IsIdentChar(Line[Start - 1]) do - Dec(Start); + Start := XY.Char; + while (Start > 1) and IsIdentChar(Line[Start - 1]) do + Dec(Start); - Stop := XY.Char + 1; - while (Stop <= High(Line)) and IsIdentChar(Line[Stop]) do - Inc(Stop); + Stop := XY.Char; + while (Stop <= Len) and IsIdentChar(Line[Stop]) do + Inc(Stop); - Result := Copy(Line, Start, Stop - Start); + Result := Copy(Line, Start, Stop - Start); end; end; end; -function TCustomSynEdit.BufferToDisplayPos(const p: TBufferCoord): TDisplayCoord; -// BufferToDisplayPos takes a position in the text and transforms it into -// the row and column it appears to be on the screen +procedure TCustomSynEdit.GetWordBoundaries(XY: TBufferCoord; var BB, + BE: TBufferCoord); var - s: UnicodeString; - i, L: Integer; - x, CountOfAvgGlyphs: Integer; -begin - Canvas.Font := Font; + TempString: string; - Result := TDisplayCoord(p); - if p.Line - 1 < Lines.Count then + procedure CharScan; + var + cRun: Integer; begin - s := Lines[p.Line - 1]; - l := Length(s); - x := 0; - - for i := 1 to p.Char - 1 do begin - if (i <= l) and (s[i] = #9) then - Inc(x, TabWidth - (x mod TabWidth)) - else if i <= l then + { search BlockEnd } + BE.Char := Length(TempString); + for cRun := XY.Char to Length(TempString) do + if not IsIdentChar(TempString[cRun]) then begin - CountOfAvgGlyphs := CeilOfIntDiv(FTextDrawer.TextWidth(s[i]), FCharWidth); - Inc(x, CountOfAvgGlyphs); - end - else - Inc(x); - end; - Result.Column := x + 1; + BE.Char := cRun; + Break; + end; + { search BlockBegin } + BB.Char := 1; + for cRun := XY.Char - 1 downto 1 do + if not IsIdentChar(TempString[cRun]) then + begin + BB.Char := cRun + 1; + Break; + end; end; + +begin + XY.Char := Max(XY.Char, 1); + XY.Line := MinMax(XY.Line, 1, Lines.Count); + TempString := Lines[XY.Line - 1] + #0; //needed for CaretX = LineLength + 1 + if XY.Char > Length(TempString) then + begin + BB.Char := TempString.Length; + BE.Char := BB.Char; + end + else + CharScan; + + BB.Line := XY.Line; + BE.Line := XY.Line; +end; + +function TCustomSynEdit.BufferToDisplayPos(const BC: TBufferCoord): TDisplayCoord; +// BufferToDisplayPos takes a position in the text and transforms it into +// the row and column it appears to be on the screen +begin + Result := TDisplayCoord(BC); if WordWrap then - Result := FWordWrapPlugin.BufferToDisplayPos(TBufferCoord(Result)); -{$IFDEF SYN_CodeFolding} + Result := fWordWrapPlugin.BufferToDisplayPos(TBufferCoord(Result)); if UseCodeFolding then Result.Row := fAllFoldRanges.FoldLineToRow(Result.Row) -{$ENDIF} end; -function TCustomSynEdit.DisplayToBufferPos(const p: TDisplayCoord): TBufferCoord; +function TCustomSynEdit.DisplayToBufferPos(const DC: TDisplayCoord): TBufferCoord; // DisplayToBufferPos takes a position on screen and transfrom it -// into position of text -var - s: UnicodeString; - i, L: Integer; - x, CountOfAvgGlyphs: Integer; +// into a position of text begin - Canvas.Font := Font; - if WordWrap then - Result := FWordWrapPlugin.DisplayToBufferPos(p) + Result := fWordWrapPlugin.DisplayToBufferPos(DC) else - Result := TBufferCoord(p); -{$IFDEF SYN_CodeFolding} + Result := TBufferCoord(DC); if UseCodeFolding then - Result.Line := fAllFoldRanges.FoldRowToLine(p.Row); -{$ENDIF} + Result.Line := fAllFoldRanges.FoldRowToLine(DC.Row); +end; - if Result.Line <= lines.Count then - begin - s := Lines[Result.Line - 1]; - l := Length(s); - x := 0; - i := 0; +procedure TCustomSynEdit.DoLinesBeforeDeleted(FirstLine, Count: Integer); +var + Plugin: TSynEditPlugin; +begin + // plugins + if FPlugins <> nil then + for Plugin in FPlugins do + if phLinesBeforeDeleted in Plugin.Handlers then + PlugIn.LinesBeforeDeleted(FirstLine, Count); +end; - while x < Result.Char do - begin - Inc(i); - if (i <= l) and (s[i] = #9) then - Inc(x, TabWidth - (x mod TabWidth)) - else if i <= l then - begin - CountOfAvgGlyphs := CeilOfIntDiv(FTextDrawer.TextWidth(s[i]), FCharWidth); - Inc(x, CountOfAvgGlyphs); - end - else - Inc(x); - end; - Result.Char := i; - end; +procedure TCustomSynEdit.DoLinesChanged; +var + Plugin: TSynEditPlugin; +begin + // plugins + if FPlugins <> nil then + for Plugin in FPlugins do + if phLinesChanged in Plugin.Handlers then + PlugIn.LinesChanged; end; procedure TCustomSynEdit.DoLinesDeleted(FirstLine, Count: Integer); var - i: Integer; + Mark: TSynEditMark; + Plugin: TSynEditPlugin; begin + fGutter.AutoSizeDigitCount; + // gutter marks - for i := 0 to Marks.Count - 1 do - if Marks[i].Line >= FirstLine + Count then - Marks[i].Line := Marks[i].Line - Count - else if Marks[i].Line > FirstLine then - Marks[i].Line := FirstLine; + for Mark in Marks do + if Mark.Line >= FirstLine + Count then + Mark.Line := Mark.Line - Count + else if Mark.Line > FirstLine then + Mark.Line := FirstLine; + + // SynIndicators + FIndicators.LinesDeleted(FirstLine, Count); + + // Selections + if not fUndoRedo.InsideUndoRedo then + FSelections.LinesDeleted(FirstLine, Count); // plugins if FPlugins <> nil then - for i := 0 to FPlugins.Count - 1 do - TSynEditPlugin(FPlugins[i]).LinesDeleted(FirstLine, Count); + for Plugin in FPlugins do + if phLinesDeleted in Plugin.Handlers then + Plugin.LinesDeleted(FirstLine, Count); end; procedure TCustomSynEdit.DoLinesInserted(FirstLine, Count: Integer); var - i: Integer; + Mark: TSynEditMark; + Plugin: TSynEditPlugin; begin - // gutter marks - for i := 0 to Marks.Count - 1 do - if Marks[i].Line >= FirstLine then - Marks[i].Line := Marks[i].Line + Count; + fGutter.AutoSizeDigitCount; + // Gutter marks + for Mark in Marks do + if Mark.Line >= FirstLine then + Mark.Line := Mark.Line + Count; + + // SynIndicators + FIndicators.LinesInserted(FirstLine, Count); + + // Selections + if not fUndoRedo.InsideUndoRedo then + FSelections.LinesInserted(FirstLine, Count); + + // Plugins + if FPlugins <> nil then + for Plugin in FPlugins do + if phLinesInserted in Plugin.Handlers then + Plugin.LinesInserted(FirstLine, Count); +end; + +procedure TCustomSynEdit.DoLinePut(Index: Integer; const OldLine: string); +var + Plugin: TSynEditPlugin; +begin + // SynIndicators + FIndicators.LinePut(Index); + + // Selections + if not fUndoRedo.InsideUndoRedo then + FSelections.LinePut(Index, OldLine); // plugins if FPlugins <> nil then - for i := 0 to FPlugins.Count - 1 do - TSynEditPlugin(FPlugins[i]).LinesInserted(FirstLine, Count); + for Plugin in FPlugins do + if phLinePut in Plugin.Handlers then + Plugin.LinePut(Index, OldLine); end; procedure TCustomSynEdit.PluginsAfterPaint(ACanvas: TCanvas; const AClip: TRect; FirstLine, LastLine: Integer); var - i: Integer; + Plugin: TSynEditPlugin; begin if FPlugins <> nil then - for i := 0 to FPlugins.Count - 1 do - TSynEditPlugin(FPlugins[i]).AfterPaint(ACanvas, AClip, FirstLine, LastLine); + for Plugin in FPlugins do + if phAfterPaint in Plugin.Handlers then + Plugin.AfterPaint(ACanvas, AClip, FirstLine, LastLine); end; -procedure TCustomSynEdit.ProperSetLine(ALine: Integer; const ALineText: UnicodeString); +procedure TCustomSynEdit.QuadrupleClick; begin - if eoTrimTrailingSpaces in Options then - Lines[ALine] := TrimTrailingSpaces(ALineText) - else - Lines[ALine] := ALineText; + if not (eoNoSelection in fOptions) then + SelectAll; + if Assigned(fOnQudrupleClick) then + fOnQudrupleClick(Self); end; procedure TCustomSynEdit.AddKeyUpHandler(aHandler: TKeyEvent); begin - FKbdHandler.AddKeyUpHandler(aHandler); + fKbdHandler.AddKeyUpHandler(aHandler); end; procedure TCustomSynEdit.RemoveKeyUpHandler(aHandler: TKeyEvent); begin - FKbdHandler.RemoveKeyUpHandler(aHandler); + fKbdHandler.RemoveKeyUpHandler(aHandler); end; procedure TCustomSynEdit.AddKeyDownHandler(aHandler: TKeyEvent); begin - FKbdHandler.AddKeyDownHandler(aHandler); + fKbdHandler.AddKeyDownHandler(aHandler); end; procedure TCustomSynEdit.RemoveKeyDownHandler(aHandler: TKeyEvent); begin - FKbdHandler.RemoveKeyDownHandler(aHandler); + fKbdHandler.RemoveKeyDownHandler(aHandler); end; -procedure TCustomSynEdit.AddKeyPressHandler(aHandler: TKeyPressWEvent); +procedure TCustomSynEdit.AddKeyPressHandler(aHandler: TKeyPressEvent); begin - FKbdHandler.AddKeyPressHandler(aHandler); + fKbdHandler.AddKeyPressHandler(aHandler); end; -procedure TCustomSynEdit.RemoveKeyPressHandler(aHandler: TKeyPressWEvent); +procedure TCustomSynEdit.RemoveKeyPressHandler(aHandler: TKeyPressEvent); begin - FKbdHandler.RemoveKeyPressHandler(aHandler); + fKbdHandler.RemoveKeyPressHandler(aHandler); end; procedure TCustomSynEdit.AddFocusControl(aControl: TWinControl); begin - FFocusList.Add(aControl); + fFocusList.Add(aControl); end; procedure TCustomSynEdit.RemoveFocusControl(aControl: TWinControl); begin - FFocusList.Remove(aControl); + fFocusList.Remove(aControl); end; function TCustomSynEdit.IsIdentChar(AChar: WideChar): Boolean; @@ -11040,14 +9422,18 @@ function TCustomSynEdit.IsIdentChar(AChar: WideChar): Boolean; if Assigned(Highlighter) then Result := Highlighter.IsIdentChar(AChar) else - Result := AChar >= #33; + Result := (AChar = '_') or AChar.IsLetterOrDigit or + CharInSet(AChar, FAdditionalIdentChars); +end; - if Assigned(Highlighter) then - Result := Result or CharInSet(AChar, Highlighter.AdditionalIdentChars) - else - Result := Result or CharInSet(AChar, Self.AdditionalIdentChars); +function TCustomSynEdit.IsLineMOdified(ALine: Integer): Boolean; +begin + Result := sfModified in TSynEditStringList(Lines).ChangeFlags[ALine - 1]; +end; - Result := Result and not IsWordBreakChar(AChar); +function TCustomSynEdit.IsNonWhiteChar(AChar: WideChar): Boolean; +begin + Result := not IsWhiteChar(AChar); end; function TCustomSynEdit.IsWhiteChar(AChar: WideChar): Boolean; @@ -11055,12 +9441,7 @@ function TCustomSynEdit.IsWhiteChar(AChar: WideChar): Boolean; if Assigned(Highlighter) then Result := Highlighter.IsWhiteChar(AChar) else - case AChar of - #0..#32: - Result := True; - else - Result := not (IsIdentChar(AChar) or IsWordBreakChar(AChar)) - end + Result := AChar.IsWhiteSpace and not IsIdentChar(AChar); end; function TCustomSynEdit.IsWordBreakChar(AChar: WideChar): Boolean; @@ -11068,35 +9449,29 @@ function TCustomSynEdit.IsWordBreakChar(AChar: WideChar): Boolean; if Assigned(Highlighter) then Result := Highlighter.IsWordBreakChar(AChar) else + begin case AChar of - #0..#32, '.', ',', ';', ':', '"', '''', WideChar(#$00B4), '`', - WideChar(#$00B0), '^', '!', '?', '&', '$', '@', WideChar(#$00A7), '%', - '#', '~', '[', ']', '(', ')', '{', '}', '<', '>', '-', '=', '+', '*', + #0..#32, '.', ',', ';', ':', '"', '''', #$00B4, '`', + #$00B0, '^', '!', '?', '&', '$', '@', #$00A7, '%', + '#', '~', '[', ']', '(', ')', '{', '}', '<', '>', '-', '=', '+', '*', '/', '\', '|': Result := True; else Result := False; end; - if Assigned(Highlighter) then - begin - Result := Result or CharInSet(AChar, Highlighter.AdditionalWordBreakChars); - Result := Result and not CharInSet(AChar, Highlighter.AdditionalIdentChars); - end - else - begin - Result := Result or CharInSet(AChar, Self.AdditionalWordBreakChars); - Result := Result and not CharInSet(AChar, Self.AdditionalIdentChars); + Result := Result or CharInSet(AChar, FAdditionalWordBreakChars); + Result := Result and not IsIdentChar(AChar); end; end; procedure TCustomSynEdit.SetSearchEngine(Value: TSynEditSearchCustom); begin - if (FSearchEngine <> Value) then + if (fSearchEngine <> Value) then begin - FSearchEngine := Value; - if Assigned(FSearchEngine) then - FSearchEngine.FreeNotification(Self); + fSearchEngine := Value; + if Assigned(fSearchEngine) then + fSearchEngine.FreeNotification(Self); end; end; @@ -11135,54 +9510,86 @@ function TCustomSynEdit.GetPositionOfMouse(out aPos: TBufferCoord): Boolean; Exit; end; - { inside the editor, get the Word under the mouse pointer } + { inside the editor, get the word under the mouse pointer } aPos := DisplayToBufferPos(PixelsToRowColumn(Point.X, Point.Y)); Result := True; end; -function TCustomSynEdit.GetWordAtMouse: UnicodeString; +function TCustomSynEdit.GetWordAtMouse: string; var Point: TBufferCoord; begin - { Return the Word under the mouse } + { Return the word under the mouse } if GetPositionOfMouse(Point) then // if point is valid Result := Self.GetWordAtRowCol(Point); // return the point at the mouse position end; -function TCustomSynEdit.CharIndexToRowCol(Index: Integer): TBufferCoord; -{ Index is 0-based; Result.x and Result.y are 1-based } +function TCustomSynEdit.CharIndexToRowCol(Index: Integer; LineBreak: string): TBufferCoord; +// Index is 0-based; Result.Char and Result.Line are 1-based +// Treats the last line as infinitely long (for index past EOF.) var - x, y, Chars: Integer; + RowIndex, LBLen: Integer; + RowStartIndex: Integer; + RowLen: Integer; + LBFudge: Integer; + FirstLine, LastLine, TestLine: Integer; + procedure GetLineInfo; + begin + RowIndex := TSynEditStringList(Lines).LineCharIndex(TestLine) + (TestLine * LBLen); + RowLen := TSynEditStringList(Lines).LineCharLength(TestLine); + if TestLine > 0 then + RowStartIndex := RowIndex - LBFudge // Move the startindex back by LBLen - 1 + else + RowStartIndex := RowIndex; + end; begin - x := 0; - y := 0; - Chars := 0; - while y < Lines.Count do + if Index < 1 then + Exit(BufferCoord(1, 1)); + case Lines.Count of + 0: Exit(BufferCoord(1, 1)); + 1: Exit(BufferCoord(Index + 1, 1)); + end; + LBLen := LineBreak.Length; + LBFudge := Max(0, LBLen - 1); + TestLine := 0; + FirstLine := 0; + LastLine := Lines.Count - 1; + while FirstLine <= LastLine do begin - x := Length(Lines[y]); - if Chars + x + 2 > Index then + TestLine := FirstLine + (LastLine - FirstLine) div 2; + GetLineInfo; + if (Index >= RowStartIndex) and (Index <= (RowIndex + RowLen)) then begin - x := Index - Chars; - Break; - end; - Inc(Chars, x + 2); - x := 0; - Inc(y); + if LBLen = 0 then + begin + // if Linebreak is empty need to check previous lines for matches. + repeat + Dec(TestLine); + if TestLine < 0 then + Break; + GetLineInfo; + until ((Index < RowStartIndex) or (Index > (RowIndex + RowLen))); + Inc(TestLine); + GetLineInfo; + end; + Exit(BufferCoord(Max(Index + 1 - RowIndex, 1), TestLine + 1)) + end + else if (RowIndex < Index) then + FirstLine := TestLine + 1 + else + LastLine := TestLine - 1; end; - Result.Char := x + 1; - Result.Line := y + 1; + RowIndex := TSynEditStringList(Lines).LineCharIndex(Lines.Count - 1) + ((Lines.Count - 1) * LBLen); + Exit(BufferCoord(Max(Index + 1 - RowIndex, 1), Lines.Count)); end; -function TCustomSynEdit.RowColToCharIndex(RowCol: TBufferCoord): Integer; +function TCustomSynEdit.RowColToCharIndex(RowCol: TBufferCoord; + LineBreak: string): Integer; { Row and Col are 1-based; Result is 0-based } -var - synEditStringList : TSynEditStringList; begin RowCol.Line := Max(0, Min(Lines.Count, RowCol.Line) - 1); - synEditStringList := (FLines as TSynEditStringList); - // CharIndexToRowCol assumes a line break size of two - Result := synEditStringList.LineCharIndex(RowCol.Line) - + RowCol.Line * 2 + (RowCol.Char -1); + Result := TSynEditStringList(Lines).LineCharIndex(RowCol.Line) + + RowCol.Line * LineBreak.Length + (RowCol.Char - 1); end; procedure TCustomSynEdit.Clear; @@ -11225,12 +9632,10 @@ procedure TCustomSynEdit.SetSelLength(const Value: Integer); procedure TCustomSynEdit.DefineProperties(Filer: TFiler); -{$IFDEF SYN_COMPILER_6_UP} function CollectionsEqual(C1, C2: TCollection): Boolean; begin - Result := Classes.CollectionsEqual(C1, C2, nil, nil); + Result := System.Classes.CollectionsEqual(C1, C2, nil, nil); end; -{$ENDIF} function HasKeyData: Boolean; var @@ -11256,9 +9661,6 @@ procedure TCustomSynEdit.DefineProperties(Filer: TFiler); iSaveKeyData: Boolean; begin inherited; -{$IFNDEF UNICODE} - UnicodeDefineProperties(Filer, Self); -{$ENDIF} iSaveKeyData := HasKeyData; Filer.DefineProperty('RemovedKeystrokes', ReadRemovedKeystrokes, WriteRemovedKeystrokes, iSaveKeyData); @@ -11268,8 +9670,32 @@ procedure TCustomSynEdit.DefineProperties(Filer: TFiler); procedure TCustomSynEdit.DoChange; begin - if Assigned(FOnChange) then - FOnChange(Self); + if Assigned(fOnChange) then + fOnChange(Self); +end; + +procedure TCustomSynEdit.DoContextPopup(MousePos: TPoint; var Handled: Boolean); +var + Band: TSynGutterBand; + RowColumn: TDisplayCoord; + Line: Integer; +begin + if MousePos.X <= fGutterWidth then + begin + RowColumn := PixelsToRowColumn(MousePos.X, MousePos.Y); + Line := RowToLine(RowColumn.Row); + + if Line <= Lines.Count then + begin + Band := FGutter.BandAtX(MousePos.X); + if Assigned(Band) and Assigned(Band.OnContextPopup) then + begin + Band.OnContextPopup(Self, MousePos, RowColumn.Row, Line, Handled); + if Handled then Exit; + end; + end; + end; + inherited DoContextPopup(MousePos, Handled); end; procedure TCustomSynEdit.ReadAddedKeystrokes(Reader: TReader); @@ -11317,6 +9743,21 @@ procedure TCustomSynEdit.ReadRemovedKeystrokes(Reader: TReader); end; end; +procedure TCustomSynEdit.ReadState(Reader: TReader); +// See https://en.delphipraxis.net/topic/12792-reading-empty-collections/ +// If the component is inherited from another form, ReadState will be called +// more than once. We only clear the collections if it is the first call +// i.e. when reading the base form. +begin + if not FStateRead then + begin + FScrollbarAnnotations.Clear; + FGutter.Bands.Clear; + FStateRead := True; + end; + inherited ReadState(Reader); +end; + procedure TCustomSynEdit.WriteAddedKeystrokes(Writer: TWriter); var iDefaultKeys: TSynEditKeyStrokes; @@ -11381,43 +9822,34 @@ procedure TCustomSynEdit.WriteRemovedKeystrokes(Writer: TWriter); procedure TCustomSynEdit.AddMouseDownHandler(aHandler: TMouseEvent); begin - FKbdHandler.AddMouseDownHandler(aHandler); + fKbdHandler.AddMouseDownHandler(aHandler); end; procedure TCustomSynEdit.RemoveMouseDownHandler(aHandler: TMouseEvent); begin - FKbdHandler.RemoveMouseDownHandler(aHandler); + fKbdHandler.RemoveMouseDownHandler(aHandler); end; procedure TCustomSynEdit.AddMouseUpHandler(aHandler: TMouseEvent); begin - FKbdHandler.AddMouseUpHandler(aHandler); + fKbdHandler.AddMouseUpHandler(aHandler); end; procedure TCustomSynEdit.RemoveMouseUpHandler(aHandler: TMouseEvent); begin - FKbdHandler.RemoveMouseUpHandler(aHandler); -end; - -procedure TCustomSynEdit.ResetModificationIndicator; -begin - TSynEditStringList(FLines).ResetModificationIndicator; - if FGutter.ShowModification then - InvalidateGutter; + fKbdHandler.RemoveMouseUpHandler(aHandler); end; -{$IFDEF SYN_CodeFolding} +//++ CodeFolding procedure TCustomSynEdit.FullFoldScan; begin if UseCodeFolding then - begin ReScanForFoldRanges(0, fLines.Count -1); - end; end; -procedure TCustomSynEdit.ReScanForFoldRanges(FromLine : Integer; ToLine : Integer); -Var +procedure TCustomSynEdit.ReScanForFoldRanges(FromLine: Integer; ToLine: Integer); +var AdjustedToLine: Integer; begin AdjustedToLine := Max(Min(ToLine, Lines.Count - 1), FromLine); @@ -11428,42 +9860,42 @@ procedure TCustomSynEdit.ReScanForFoldRanges(FromLine : Integer; ToLine : Intege and StopScanning will be called when LinesChanged is executed } if not (sfLinesChanging in fStateFlags) and fAllFoldRanges.StopScanning(fLines) then begin - if Assigned(fHighlighter) and (fHighlighter is TSynCustomCodeFoldingHighlighter) then - TSynCustomCodeFoldingHighlighter(fHighlighter).AdjustFoldRanges(AllFoldRanges, - fLines); - InvalidateGutter; - Include(fStateFlags, sfScrollbarChanged); + InvalidateGutterBand(gbkFold); + if FIndentGuides.Visible and FIndentGuides.StructureHighlight and + Assigned(fHighlighter) and (hcStructureHighlight in fHighlighter.Capabilities) + then + InvalidateLines(-1, -1); + UpdateScrollBars; end; end; procedure TCustomSynEdit.ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine : Integer; ToLine : Integer); + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); begin - if Assigned(fHighlighter) and (fHighlighter is TSynCustomCodeFoldingHighlighter) then + if fHighlighter is TSynCustomCodeFoldingHighlighter then TSynCustomCodeFoldingHighlighter(fHighlighter).ScanForFoldRanges(FoldRanges, LinesToScan, FromLine, ToLine); if Assigned(fOnScanForFoldRanges) then fOnScanForFoldRanges(Self, FoldRanges, LinesToScan, FromLine, ToLine); end; -{$ENDIF} +//-- CodeFolding procedure TCustomSynEdit.AddMouseCursorHandler(aHandler: TMouseCursorEvent); begin - FKbdHandler.AddMouseCursorHandler(aHandler); + fKbdHandler.AddMouseCursorHandler(aHandler); end; procedure TCustomSynEdit.RemoveMouseCursorHandler(aHandler: TMouseCursorEvent); begin - FKbdHandler.RemoveMouseCursorHandler(aHandler); + fKbdHandler.RemoveMouseCursorHandler(aHandler); end; -{$IFDEF SYN_COMPILER_6_UP} procedure TCustomSynEdit.DoSearchFindFirstExecute(Action: TSearchFindFirst); begin - FOnFindBeforeSearch := Action.Dialog.OnFind; - FOnCloseBeforeSearch := Action.Dialog.OnClose; - FSelStartBeforeSearch := SelStart; FSelLengthBeforeSearch := SelLength; + OnFindBeforeSearch := Action.Dialog.OnFind; + OnCloseBeforeSearch := Action.Dialog.OnClose; + FSelections.Store(FSelStorage); Action.Dialog.OnFind := FindDialogFindFirst; Action.Dialog.OnClose := FindDialogClose; @@ -11472,8 +9904,8 @@ procedure TCustomSynEdit.DoSearchFindFirstExecute(Action: TSearchFindFirst); procedure TCustomSynEdit.DoSearchFindExecute(Action: TSearchFind); begin - FOnFindBeforeSearch := Action.Dialog.OnFind; - FOnCloseBeforeSearch := Action.Dialog.OnClose; + OnFindBeforeSearch := Action.Dialog.OnFind; + OnCloseBeforeSearch := Action.Dialog.OnClose; Action.Dialog.OnFind := FindDialogFind; Action.Dialog.OnClose := FindDialogClose; @@ -11482,9 +9914,9 @@ procedure TCustomSynEdit.DoSearchFindExecute(Action: TSearchFind); procedure TCustomSynEdit.DoSearchReplaceExecute(Action: TSearchReplace); begin - FOnFindBeforeSearch := Action.Dialog.OnFind; - FOnReplaceBeforeSearch := Action.Dialog.OnReplace; - FOnCloseBeforeSearch := Action.Dialog.OnClose; + OnFindBeforeSearch := Action.Dialog.OnFind; + OnReplaceBeforeSearch := Action.Dialog.OnReplace; + OnCloseBeforeSearch := Action.Dialog.OnClose; Action.Dialog.OnFind := FindDialogFind; Action.Dialog.OnReplace := FindDialogFind; @@ -11501,17 +9933,13 @@ procedure TCustomSynEdit.FindDialogFindFirst(Sender: TObject); begin TFindDialog(Sender).CloseDialog; - if (SelStart = FSelStartBeforeSearch) and (SelLength = FSelLengthBeforeSearch) then - begin - SelStart := 0; - SelLength := 0; - end; + CaretXY := BufferCoord(1, 1); if Sender is TFindDialog then - if not SearchByFindDialog(TFindDialog(Sender)) and (SelStart = 0) and (SelLength = 0) then + if not SearchByFindDialog(TFindDialog(Sender)) then begin - SelStart := FSelStartBeforeSearch; - SelLength := FSelLengthBeforeSearch; + FSelections.Restore(FSelStorage); + FSelStorage.Clear; end; end; @@ -11521,34 +9949,32 @@ procedure TCustomSynEdit.FindDialogFind(Sender: TObject); SearchByFindDialog(TFindDialog(Sender)); end; -function TCustomSynEdit.SearchByFindDialog(FindDialog: TFindDialog) : bool; +function TCustomSynEdit.SearchByFindDialog(FindDialog: TFindDialog): Boolean; var Options :TSynSearchOptions; ReplaceText, MessageText: string; - OldSelStart, OldSelLength: Integer; begin - if (frReplaceAll in FindDialog.Options) then Options := [ssoReplaceAll] - else if (frReplace in FindDialog.Options) then Options := [ssoReplace] - else Options := [ssoSelectedOnly]; - + // If there is a selection apply to the selection only + Options := [ssoSelectedOnly]; + if (frReplaceAll in FindDialog.Options) then Options := Options + [ssoReplaceAll] + else if (frReplace in FindDialog.Options) then Options := Options + [ssoReplace]; if (frMatchCase in FindDialog.Options) then Options := Options + [ssoMatchCase]; if (frWholeWord in FindDialog.Options) then Options := Options + [ssoWholeWord]; if (not (frDown in FindDialog.Options)) then Options := Options + [ssoBackwards]; - if (ssoSelectedOnly in Options) - then ReplaceText := '' - else ReplaceText := TReplaceDialog(FindDialog).ReplaceText; + ReplaceText := TReplaceDialog(FindDialog).ReplaceText; - OldSelStart := SelStart; OldSelLength := SelLength; - if (UpperCase(SelText) = UpperCase(FindDialog.FindText)) and not (frReplace in FindDialog.Options) then - SelStart := SelStart + SelLength - else - SelLength := 0; + if (UpperCase(SelText) = UpperCase(FindDialog.FindText)) and not (frReplace in FindDialog.Options) + or not (ssoSelectedOnly in Options) + then + begin + FSelections.Clear; + CaretXY := CaretXY; + end; Result := SearchReplace(FindDialog.FindText, ReplaceText, Options) > 0; if not Result then begin - SelStart := OldSelStart; SelLength := OldSelLength; if Assigned(OnSearchNotFound) then OnSearchNotFound(self, FindDialog.FindText) else @@ -11556,146 +9982,145 @@ function TCustomSynEdit.SearchByFindDialog(FindDialog: TFindDialog) : bool; MessageText := Format(STextNotFound, [FindDialog.FindText]); ShowMessage(MessageText); end; - end - else if (frReplace in FindDialog.Options) then - begin - SelStart := SelStart - Length(FindDialog.FindText) - 1; - SelLength := Length(FindDialog.FindText) + 1; end; end; procedure TCustomSynEdit.FindDialogClose(Sender: TObject); begin - TFindDialog(Sender).OnFind := FOnFindBeforeSearch; + TFindDialog(Sender).OnFind := OnFindBeforeSearch; if Sender is TReplaceDialog then - TReplaceDialog(Sender).OnReplace := FOnReplaceBeforeSearch; - TFindDialog(Sender).OnClose := FOnCloseBeforeSearch; + TReplaceDialog(Sender).OnReplace := OnReplaceBeforeSearch; + TFindDialog(Sender).OnClose := OnCloseBeforeSearch; end; -{$ENDIF} function TCustomSynEdit.GetWordWrap: Boolean; begin - Result := FWordWrapPlugin <> nil; + Result := fWordWrapPlugin <> nil; +end; + +function TCustomSynEdit.GetWrapAreaWidth: Integer; +begin + if (eoWrapWithRightEdge in FOptions) and (fRightEdge > 0) then + Result := Max(fRightEdge * CharWidth - TextMargin, 0) + else if HandleAllocated then + Result := Max(ClientWidth - fGutterWidth - 2 * TextMargin, 0) + else + Result := 80 * fCharWidth; // will be set correctly when the Handle is created end; procedure TCustomSynEdit.SetWordWrap(const Value: Boolean); var - vTempBlockBegin, vTempBlockEnd : TBufferCoord; vOldTopLine: Integer; vShowCaret: Boolean; begin if WordWrap <> Value then begin - Invalidate; // better Invalidate before changing LeftChar and TopLine - vShowCaret := CaretInView; - vOldTopLine := RowToLine(TopLine); -{$IFDEF SYN_CodeFolding} - // !!Mutually exclusive with CodeFolding to reduce complexity - if Value and not UseCodeFolding then -{$ELSE} + // !!Mutually exclusive with CodeFolding to reduce complexity + if Value and UseCodeFolding then Exit; + + if HandleAllocated then + begin + Invalidate; // better Invalidate before changing LeftChar and TopLine + vShowCaret := CaretInView; + vOldTopLine := RowToLine(TopLine); + end + else + begin + // to keep compiler happy + vShowCaret := False; + vOldTopLine := 1; + end; + if Value then -{$ENDIF} begin - FWordWrapPlugin := TSynWordWrapPlugin.Create(Self); + fWordWrapPlugin := TSynWordWrapPlugin.Create(Self); LeftChar := 1; end else - FWordWrapPlugin := nil; - TopLine := LineToRow(vOldTopLine); - UpdateScrollBars; + fWordWrapPlugin := nil; - // constrain caret position to MaxScrollWidth if eoScrollPastEol is enabled - if (eoScrollPastEol in Options) then + if HandleAllocated then begin - InternalCaretXY := CaretXY; - vTempBlockBegin := BlockBegin; - vTempBlockEnd := BlockEnd; - SetBlockBegin(vTempBlockBegin); - SetBlockEnd(vTempBlockEnd); + CalcTextAreaWidth; + TopLine := LineToRow(vOldTopLine); + UpdateScrollBars; + + if vShowCaret then + EnsureCursorPosVisible; end; - if vShowCaret then - EnsureCursorPosVisible; end; end; -function TCustomSynEdit.GetDisplayLineCount: Integer; +function TCustomSynEdit.GetDisplayRowCount: Integer; begin -{$IFDEF SYN_CodeFolding} if fWordWrapPlugin = nil then begin if fUseCodeFolding then Result := LineToRow(Lines.Count) else Result := Lines.Count end else if Lines.Count = 0 then -{$ELSE} - if FWordWrapPlugin = nil then - Result := Lines.Count - else if Lines.Count = 0 then -{$ENDIF} Result := 0 else begin - Result := FWordWrapPlugin.RowCount; + Result := fWordWrapPlugin.RowCount; end; end; function TCustomSynEdit.LineToRow(aLine: Integer): Integer; -var - vBufferPos: TBufferCoord; begin -{$IFDEF SYN_CodeFolding} - if not WordWrap and not UseCodeFolding then -{$ELSE} - if not WordWrap then -{$ENDIF} + if not UseCodeFolding and not WordWrap then Result := aLine - else begin - vBufferPos.Char := 1; - vBufferPos.Line := aLine; - Result := BufferToDisplayPos(vBufferPos).Row; - end; + else + Result := BufferToDisplayPos(BufferCoord(1, aLine)).Row; end; function TCustomSynEdit.RowToLine(aRow: Integer): Integer; -var - vDisplayPos: TDisplayCoord; begin -{$IFDEF SYN_CodeFolding} - if not WordWrap and not UseCodeFolding then -{$ELSE} - if not WordWrap then -{$ENDIF} + if not UseCodeFolding and not WordWrap then Result := aRow else begin - vDisplayPos.Column := 1; - vDisplayPos.Row := aRow; - Result := DisplayToBufferPos(vDisplayPos).Line; + Result := DisplayToBufferPos(DisplayCoord(1, aRow)).Line; end; end; -procedure TCustomSynEdit.SetInternalDisplayXY(const aPos: TDisplayCoord); +procedure TCustomSynEdit.SetDisplayXY(const aPos: TDisplayCoord); +var + OldCaretAtEOL: Boolean; begin + OldCaretAtEOL := CaretAtEOL; IncPaintLock; - InternalCaretXY := DisplayToBufferPos(aPos); - FCaretAtEOL := WordWrap and (aPos.Row <= FWordWrapPlugin.RowCount) and - (aPos.Column > FWordWrapPlugin.GetRowLength(aPos.Row)) and - (DisplayY <> aPos.Row); - DecPaintLock; - UpdateLastCaretX; + try + SetCaretXYEx(False, DisplayToBufferPos(aPos)); + + // fCaretEOL is set if we are at the end of wrapped row + CaretAtEOL := WordWrap and (aPos.Row <= fWordWrapPlugin.RowCount) and + (aPos.Column > fWordWrapPlugin.GetRowLength(aPos.Row)) and + (DisplayY <> aPos.Row); + if CaretAtEOL <> OldCaretAtEOL then + begin + InvalidateLine(CaretY); + Include(fStateFlags, sfCaretChanged); + UpdateLastPosX; + end; + + EnsureCursorPosVisible; + finally + DecPaintLock; + end; end; procedure TCustomSynEdit.SetWantReturns(Value: Boolean); begin - FWantReturns := Value; + fWantReturns := Value; end; procedure TCustomSynEdit.SetWantTabs(Value: Boolean); begin - FWantTabs := Value; + fWantTabs := Value; end; procedure TCustomSynEdit.SetWordWrapGlyph(const Value: TSynGlyph); begin - FWordWrapGlyph.Assign(Value); + fWordWrapGlyph.Assign(Value); end; procedure TCustomSynEdit.WordWrapGlyphChange(Sender: TObject); @@ -11704,6 +10129,29 @@ procedure TCustomSynEdit.WordWrapGlyphChange(Sender: TObject); InvalidateGutter; end; +procedure TCustomSynEdit.Zoom(ExtraFontSize: Integer); +var + OldFontSize: Integer; + OldGutterFontSize: Integer; +begin + OldFontSize := FOrigFontSize; + OldGutterFontSize := FOrigGutterFontSize; + Font.Size := EnsureRange(Font.Size + ExtraFontSize, 3, 50); + Gutter.Font.Size := EnsureRange(Gutter.Font.Size + ExtraFontSize, 2, 49); + FOrigFontSize := OldFontSize; + FOrigGutterFontSize := OldGutterFontSize; + if Assigned(FOnZoom) then + FOnZoom(Self, Font.Size, FOrigFontSize); +end; + + +procedure TCustomSynEdit.ZoomReset; +begin + Font.Size := FOrigFontSize; + Gutter.Font.Size := FOrigGutterFontSize; + if Assigned(FOnZoom) then + FOnZoom(Self, Font.Size, FOrigFontSize); +end; { TSynEditMark } @@ -11720,7 +10168,7 @@ function TSynEditMark.GetEdit: TCustomSynEdit; function TSynEditMark.GetIsBookmark: Boolean; begin - Result := (FBookmarkNum >= 0); + Result := (fBookmarkNum >= 0); end; procedure TSynEditMark.SetChar(const Value: Integer); @@ -11731,85 +10179,53 @@ procedure TSynEditMark.SetChar(const Value: Integer); procedure TSynEditMark.SetImage(const Value: Integer); begin FImage := Value; - if FVisible and Assigned(FEdit) then - FEdit.InvalidateGutterLines(FLine, FLine); + if fVisible and Assigned(fEdit) then + fEdit.InvalidateGutterLines(fLine, fLine); end; procedure TSynEditMark.SetInternalImage(const Value: Boolean); begin - FInternalImage := Value; - if FVisible and Assigned(FEdit) then - FEdit.InvalidateGutterLines(FLine, FLine); + fInternalImage := Value; + if fVisible and Assigned(fEdit) then + fEdit.InvalidateGutterLines(fLine, fLine); end; procedure TSynEditMark.SetLine(const Value: Integer); begin - if FVisible and Assigned(FEdit) then + if fVisible and Assigned(fEdit) then begin - if FLine > 0 then - FEdit.InvalidateGutterLines(FLine, FLine); - FLine := Value; - FEdit.InvalidateGutterLines(FLine, FLine); + if fLine > 0 then + fEdit.InvalidateGutterLines(fLine, fLine); + fLine := Value; + fEdit.InvalidateGutterLines(fLine, fLine); end else - FLine := Value; + fLine := Value; end; procedure TSynEditMark.SetVisible(const Value: Boolean); begin - if FVisible <> Value then + if fVisible <> Value then begin - FVisible := Value; - if Assigned(FEdit) then - FEdit.InvalidateGutterLines(FLine, FLine); + fVisible := Value; + if Assigned(fEdit) then + fEdit.InvalidateGutterLines(fLine, fLine); end; end; constructor TSynEditMark.Create(AOwner: TCustomSynEdit); begin inherited Create; - FBookmarkNum := -1; - FEdit := AOwner; + fBookmarkNum := -1; + fEdit := AOwner; end; { TSynEditMarkList } -procedure TSynEditMarkList.Notify(Ptr: Pointer; Action: TListNotification); -begin - inherited; - if Assigned(FOnChange) then - FOnChange(Self); -end; - -function TSynEditMarkList.GetItem(Index: TListSize): TSynEditMark; -begin - Result := TSynEditMark(inherited GetItem(Index)); -end; - -procedure TSynEditMarkList.SetItem(Index: TListSize; Item: TSynEditMark); -begin - inherited SetItem(Index, Item); -end; - constructor TSynEditMarkList.Create(AOwner: TCustomSynEdit); begin inherited Create; - FEdit := AOwner; -end; - -function TSynEditMarkList.First: TSynEditMark; -begin - Result := TSynEditMark(inherited First); -end; - -function TSynEditMarkList.Last: TSynEditMark; -begin - Result := TSynEditMark(inherited Last); -end; - -function TSynEditMarkList.Extract(Item: TSynEditMark): TSynEditMark; -begin - Result := TSynEditMark(inherited Extract(Item)); + fEdit := AOwner; end; procedure TSynEditMarkList.ClearLine(Line: Integer); @@ -11835,39 +10251,52 @@ procedure TSynEditMarkList.GetMarksForLine(line: Integer; var marks: TSynEditMar begin Inc(cnt); marks[cnt] := Items[i]; - if cnt = MAX_MARKS then - Break; + if cnt = MAX_MARKS then Break; end; end; end; -procedure TSynEditMarkList.Place(mark: TSynEditMark); +procedure TSynEditMarkList.Place(Mark: TSynEditMark); begin - if assigned(FEdit) then - if Assigned(FEdit.OnPlaceBookmark) then - FEdit.OnPlaceBookmark(FEdit, mark); - if assigned(mark) then - Add(mark); + if assigned(fEdit) then + if Assigned(fEdit.OnPlaceBookmark) then + fEdit.OnPlaceBookmark(fEdit, Mark); + if assigned(Mark) then + Add(Mark); end; { TSynEditPlugin } constructor TSynEditPlugin.Create(AOwner: TCustomSynEdit); +const + AllPlugInHandlers = [phLinesInserted, phLinesBeforeDeleted, phLinesDeleted, + phLinePut, phLinesChanged, phPaintTransient, phAfterPaint]; + +begin + Create(AOwner, AllPlugInHandlers); // for backward compatibility +end; + +constructor TSynEditPlugin.Create(AOwner: TCustomSynEdit; + AHandlers: TPlugInHandlers); begin inherited Create; if AOwner <> nil then begin FOwner := AOwner; if FOwner.FPlugins = nil then - FOwner.FPlugins := TObjectList.Create; + FOwner.FPlugins := TObjectList.Create; FOwner.FPlugins.Add(Self); end; + FHandlers := AHandlers; + + if phPaintTransient in Handlers then + FOwner.FPaintTransientPlugins := True; end; destructor TSynEditPlugin.Destroy; begin if FOwner <> nil then - FOwner.FPlugins.Extract(Self); // we are being destroyed, FOwner should not free us + FOwner.FPlugins.Extract(Self); // we are being destroyed, fOwner should not free us inherited Destroy; end; @@ -11882,75 +10311,36 @@ procedure TSynEditPlugin.PaintTransient(ACanvas: TCanvas; ATransientType: TTrans // nothing end; -procedure TSynEditPlugin.LinesInserted(FirstLine, Count: Integer); +procedure TSynEditPlugin.LinesChanged; begin // nothing end; -procedure TSynEditPlugin.LinesDeleted(FirstLine, Count: Integer); +procedure TSynEditPlugin.LinesInserted(FirstLine, Count: Integer); begin // nothing end; -{$IFNDEF UNICODE} -var - GetMsgHook: HHOOK; - -function GetMsgProc(Code: Integer; wParam: WPARAM; lParam: LPARAM): LRESULT; stdcall; -var -{$IFNDEF SYN_COMPILER_9_UP} - WndProc: Pointer; -{$ENDIF} - WinCtrl: TWinControl; +procedure TSynEditPlugin.LinePut(aIndex: Integer; const OldLine: string); begin - WinCtrl := TCustomSynEdit(FindControl(PMsg(lParam)^.hWnd)); - if WinCtrl is TCustomSynEdit then - begin - TCustomSynEdit(WinCtrl).FWindowProducedMessage := True; - -{$IFNDEF SYN_COMPILER_9_UP} - if Code = HC_ACTION then - begin - with PMsg(lParam)^ do - case message of - WM_CHAR: - begin - if wParam > Ord(High(AnsiChar)) then - if IsWindowUnicode(hWnd) then - begin - WndProc := Pointer(GetWindowLong(hWnd, GWL_WNDPROC)); - CallWindowProcW(WndProc, hWnd, WM_CHAR, wParam, lParam); - Message := WM_NULL; - end; - end; - end; - end; -{$ENDIF} + // nothing +end; - end; +procedure TSynEditPlugin.LinesBeforeDeleted(FirstLine, Count: Integer); +begin + // nothing +end; - Result := CallNextHookEx(GetMsgHook, Code, wParam, lParam); +procedure TSynEditPlugin.LinesDeleted(FirstLine, Count: Integer); +begin + // nothing end; -{$ENDIF} + initialization -{$IFNDEF UNICODE} - if Win32PlatformIsUnicode and not (csDesigning in Application.ComponentState) then - begin - // Hooking GetMessage/PeekMessage-calls is necessary as the use of - // PeekMessageA in TApplication.ProcessMessage mutilates Unicode-messages. - GetMsgHook := SetWindowsHookExW(WH_GETMESSAGE, GetMsgProc, 0, - GetCurrentThreadId); - end - else - GetMsgHook := 0; -{$ENDIF} - SynEditClipboardFormat := RegisterClipboardFormat(SYNEDIT_CLIPBOARD_FORMAT); + TCustomStyleEngine.RegisterStyleHook(TCustomSynEdit, TSynScrollingStyleHook); finalization -{$IFNDEF UNICODE} - if Win32PlatformIsUnicode and (GetMsgHook <> 0) then - UnhookWindowsHookEx(GetMsgHook); -{$ENDIF} + TCustomStyleEngine.UnRegisterStyleHook(TCustomSynEdit, TSynScrollingStyleHook); end. diff --git a/Ext/SynEdit/Source/SynEdit.res b/Ext/SynEdit/Source/SynEdit.res index 1e15ec3b0a52c1227d37574752018cdc6a0b1c4c..f009ab5ece0b06537cb50c0eb2018a62e2885af9 100644 GIT binary patch literal 7244 zcmeI1OK#gh3_#g*-+Gy4mpwuk*%(L=2S|+|E)et*MUUX4`6fP!LRxt!#d2n3Sas4s zGA5kQ;~Q!OBQPW)@)WNsN@u$6LN@YK)^a1)awk8ut@ZDXJZfCZy^g*Y*J8cD#kRcO z)nchP=43TQhH=K?CDvHh#;}oLT&p4aYb-u;GS=2&v%HMOM{IfFEY{eJv$?DWJmfIW zSoVb>W-M!Cy}02mW?sMU_o%VPwOGII`s}i&A)S4sqYhxp7(vtWxp6xZOBcT P(qt>w)=RDAJlFg)RZBU3 literal 1268 zcmbVLOHRW;41Ij0kwAiq6R_kEY$~M!DyR@eLR8s+yr*Rdv@BS zQH5yTc>Koko3Wi50IsPyyAp26>;$-{C+A~K@s0^bDDZ$+>V)eEFSJ8Ea{okoN6)l5 zVK8Wqx*`0aUQmy4YA*&nd$&{oA5@hau7p^vRoA2HWlT}`$sO(LKsT=z&)`;o#rAn5>xh^RKVfiJ?H$Bxa7Lr10MXp{^FS2+NkvB_l=V~ z#4~@I=v|_jy`*+$mLDEh=dPXcrnj=EKeL)w&Fx<^yL6fN?Ho9x&;8@&e9rBHR&hl! VZuX1j{epYNH+#2*;uKHW*k4Xp@+JTP diff --git a/Ext/SynEdit/Source/SynEditAutoComplete.pas b/Ext/SynEdit/Source/SynEditAutoComplete.pas deleted file mode 100644 index 746defd..0000000 --- a/Ext/SynEdit/Source/SynEditAutoComplete.pas +++ /dev/null @@ -1,517 +0,0 @@ -{------------------------------------------------------------------------------- -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: SynEditAutoComplete.pas, released 2000-06-25. - -The Initial Author of the Original Code is Michael Hieke. -Portions written by Michael Hieke are Copyright 2000 Michael Hieke. -Portions written by Cyrille de Brebisson (from mwCompletionProposal.pas) are -Copyright 1999 Cyrille de Brebisson. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit and mwEdit projects are listed in the -Contributors.txt file. - -Alternatively, the contents of this file may be used under the terms of the -GNU General Public License Version 2 or later (the "GPL"), in which case -the provisions of the GPL are applicable instead of those above. -If you wish to allow use of your version of this file only under the terms -of the GPL and not to allow others to use your version of this file -under the MPL, indicate your decision by deleting the provisions above and -replace them with the notice and other provisions required by the GPL. -If you do not delete the provisions above, a recipient may use your version -of this file under either the MPL or the GPL. - -$Id: SynEditAutoComplete.pas,v 1.10.2.4 2008/09/14 16:24:58 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -{$IFNDEF QSYNEDITAUTOCOMPLETE} -unit SynEditAutoComplete; -{$ENDIF} - -{$I SynEdit.inc} - -interface - -uses - Windows, - Menus, - SynEdit, - SynEditKeyCmds, - SynUnicode, - Classes; - -type - TCustomSynAutoComplete = class(TComponent) - protected - FAutoCompleteList: TUnicodeStrings; - FCompletions: TUnicodeStrings; - FCompletionComments: TUnicodeStrings; - FCompletionValues: TUnicodeStrings; - FEditor: TCustomSynEdit; - FEditors: TList; - FEOTokenChars: UnicodeString; - FCaseSensitive: Boolean; - FParsed: Boolean; - procedure CompletionListChanged(Sender: TObject); - procedure DefineProperties(Filer: TFiler); override; - function GetCompletions: TUnicodeStrings; - function GetCompletionComments: TUnicodeStrings; - function GetCompletionValues: TUnicodeStrings; - function GetEditorCount: Integer; - function GetNthEditor(Index: Integer): TCustomSynEdit; - procedure SetAutoCompleteList(Value: TUnicodeStrings); virtual; - procedure SetEditor(Value: TCustomSynEdit); - procedure SynEditCommandHandler(Sender: TObject; AfterProcessing: Boolean; - var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; - Data, HandlerData: Pointer); - procedure Notification(AComponent: TComponent; Operation: TOperation); - override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - - function AddEditor(AEditor: TCustomSynEdit): Boolean; - function RemoveEditor(AEditor: TCustomSynEdit): Boolean; - - procedure AddCompletion(const AToken, AValue, AComment: UnicodeString); - procedure Execute(AEditor: TCustomSynEdit); virtual; - procedure ExecuteCompletion(const AToken: UnicodeString; AEditor: TCustomSynEdit); - virtual; - procedure ParseCompletionList; virtual; - public - property AutoCompleteList: TUnicodeStrings read FAutoCompleteList - write SetAutoCompleteList; - property CaseSensitive: Boolean read FCaseSensitive write FCaseSensitive; - property Completions: TUnicodeStrings read GetCompletions; - property CompletionComments: TUnicodeStrings read GetCompletionComments; - property CompletionValues: TUnicodeStrings read GetCompletionValues; - property Editor: TCustomSynEdit read FEditor write SetEditor; - property EditorCount: Integer read GetEditorCount; - property Editors[Index: Integer]: TCustomSynEdit read GetNthEditor; - property EndOfTokenChr: UnicodeString read FEOTokenChars write FEOTokenChars; - end; - - TSynAutoComplete = class(TCustomSynAutoComplete) - published - property AutoCompleteList; - property CaseSensitive; - property Editor; - property EndOfTokenChr; - end; - -implementation - -uses - SynEditTypes, - SysUtils; - -{ TCustomSynAutoComplete } - -procedure TCustomSynAutoComplete.AddCompletion(const AToken, AValue, AComment: UnicodeString); -begin - if AToken <> '' then - begin - if (FAutoCompleteList.Count = 0) and (FCompletions.Count = 0) then - FParsed := True; - FCompletions.Add(AToken); - FCompletionComments.Add(AComment); - FCompletionValues.Add(AValue); - end; -end; - -function TCustomSynAutoComplete.AddEditor(AEditor: TCustomSynEdit): Boolean; -var - i: Integer; -begin - if AEditor <> nil then - begin - i := FEditors.IndexOf(AEditor); - if i = -1 then - begin - AEditor.FreeNotification(Self); - FEditors.Add(AEditor); - AEditor.RegisterCommandHandler(SynEditCommandHandler, nil); - end; - Result := True; - end - else - Result := False; -end; - -procedure TCustomSynAutoComplete.CompletionListChanged(Sender: TObject); -begin - FParsed := False; -end; - -constructor TCustomSynAutoComplete.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - FAutoCompleteList := TUnicodeStringList.Create; - TUnicodeStringList(FAutoCompleteList).OnChange := CompletionListChanged; - FCompletions := TUnicodeStringList.Create; - FCompletionComments := TUnicodeStringList.Create; - FCompletionValues := TUnicodeStringList.Create; - FEditors := TList.Create; - FEOTokenChars := '()[]{}.'; -end; - -destructor TCustomSynAutoComplete.Destroy; -begin - Editor := nil; - while EditorCount > 0 do - RemoveEditor(TCustomSynEdit(FEditors.Last)); - - inherited Destroy; - FEditors.Free; - FCompletions.Free; - FCompletionComments.Free; - FCompletionValues.Free; - FAutoCompleteList.Free; -end; - -procedure TCustomSynAutoComplete.DefineProperties(Filer: TFiler); -begin - inherited; -{$IFNDEF UNICODE} - UnicodeDefineProperties(Filer, Self); -{$ENDIF} -end; - -procedure TCustomSynAutoComplete.Execute(AEditor: TCustomSynEdit); -var - s: UnicodeString; - i, j: Integer; -begin - if AEditor <> nil then - begin - // get token - s := AEditor.LineText; - j := AEditor.CaretX; - i := j - 1; - if i <= Length(s) then - begin - while (i > 0) and (s[i] > ' ') and (Pos(s[i], FEOTokenChars) = 0) do - Dec(i); - Inc(i); - s := Copy(s, i, j - i); - ExecuteCompletion(s, AEditor); - end; - end; -end; - -procedure TCustomSynAutoComplete.ExecuteCompletion(const AToken: UnicodeString; - AEditor: TCustomSynEdit); -var - i, j, Len, IndentLen: Integer; - s: UnicodeString; - IdxMaybe, NumMaybe: Integer; - p: TBufferCoord; - NewCaretPos: Boolean; - Temp: TUnicodeStringList; -begin - if not FParsed then - ParseCompletionList; - Len := Length(AToken); - if (Len > 0) and (AEditor <> nil) and not AEditor.ReadOnly - and (FCompletions.Count > 0) then - begin - // find completion for this token - not all chars necessary if unambiguous - i := FCompletions.Count - 1; - IdxMaybe := -1; - NumMaybe := 0; - if FCaseSensitive then - begin - while i > -1 do - begin - s := FCompletions[i]; - if WideCompareStr(s, AToken) = 0 then - Break - else if WideCompareStr(Copy(s, 1, Len), AToken) = 0 then - begin - Inc(NumMaybe); - IdxMaybe := i; - end; - Dec(i); - end; - end - else - begin - while i > -1 do - begin - s := FCompletions[i]; - if WideCompareText(s, AToken) = 0 then - Break - else if WideCompareText(Copy(s, 1, Len), AToken) = 0 then - begin - Inc(NumMaybe); - IdxMaybe := i; - end; - Dec(i); - end; - end; - if (i = -1) and (NumMaybe = 1) then - i := IdxMaybe; - if i > -1 then - begin - // select token in editor - p := AEditor.CaretXY; - AEditor.BeginUpdate; - try - AEditor.BlockBegin := BufferCoord(p.Char - Len, p.Line); - AEditor.BlockEnd := p; - // indent the completion string if necessary, determine the caret pos - IndentLen := p.Char - Len - 1; - p := AEditor.BlockBegin; - NewCaretPos := False; - Temp := TUnicodeStringList.Create; - try - Temp.Text := FCompletionValues[i]; - // indent lines - if (IndentLen > 0) and (Temp.Count > 1) then - begin - s := UnicodeStringOfChar(' ', IndentLen); - for i := 1 to Temp.Count - 1 do - Temp[i] := s + Temp[i]; - end; - // find first '|' and use it as caret position - for i := 0 to Temp.Count - 1 do - begin - s := Temp[i]; - j := Pos('|', s); - if j > 0 then - begin - Delete(s, j, 1); - Temp[i] := s; -// if j > 1 then -// Dec(j); - NewCaretPos := True; - Inc(p.Line, i); - if i = 0 then -// Inc(p.x, j) - Inc(p.Char, j - 1) - else - p.Char := j; - Break; - end; - end; - s := Temp.Text; - // strip the trailing #13#10 that was appended by the stringlist - i := Length(s); - if (i >= 2) and (s[i - 1] = #13) and (s[i] = #10) then - SetLength(s, i - 2); - finally - Temp.Free; - end; - // replace the selected text and position the caret - AEditor.SelText := s; - if NewCaretPos then - AEditor.CaretXY := p; - finally - AEditor.EndUpdate; - end; - end; - end; -end; - -function TCustomSynAutoComplete.GetCompletions: TUnicodeStrings; -begin - if not FParsed then - ParseCompletionList; - Result := FCompletions; -end; - -function TCustomSynAutoComplete.GetCompletionComments: TUnicodeStrings; -begin - if not FParsed then - ParseCompletionList; - Result := FCompletionComments; -end; - -function TCustomSynAutoComplete.GetCompletionValues: TUnicodeStrings; -begin - if not FParsed then - ParseCompletionList; - Result := FCompletionValues; -end; - -function TCustomSynAutoComplete.GetEditorCount: Integer; -begin - Result := FEditors.Count; -end; - -function TCustomSynAutoComplete.GetNthEditor(Index: Integer): TCustomSynEdit; -begin - if (Index >= 0) and (Index < FEditors.Count) then - Result := FEditors[Index] - else - Result := nil; -end; - -procedure TCustomSynAutoComplete.Notification(AComponent: TComponent; - Operation: TOperation); -begin - inherited Notification(AComponent, Operation); - if Operation = opRemove then - begin - if AComponent = Editor then - Editor := nil - else if AComponent is TCustomSynEdit then - RemoveEditor(TCustomSynEdit(AComponent)); - end; -end; - -procedure TCustomSynAutoComplete.ParseCompletionList; -var - BorlandDCI: Boolean; - i, j, Len: Integer; - s, sCompl, sComment, sComplValue: UnicodeString; - - procedure SaveEntry; - begin - FCompletions.Add(sCompl); - sCompl := ''; - FCompletionComments.Add(sComment); - sComment := ''; - FCompletionValues.Add(sComplValue); - sComplValue := ''; - end; - -begin - FCompletions.Clear; - FCompletionComments.Clear; - FCompletionValues.Clear; - - if FAutoCompleteList.Count > 0 then - begin - s := FAutoCompleteList[0]; - BorlandDCI := (s <> '') and (s[1] = '['); - - sCompl := ''; - sComment := ''; - sComplValue := ''; - for i := 0 to FAutoCompleteList.Count - 1 do - begin - s := FAutoCompleteList[i]; - Len := Length(s); - if BorlandDCI then - begin - // the style of the Delphi32.dci file - if (Len > 0) and (s[1] = '[') then - begin - // save last entry - if sCompl <> '' then - SaveEntry; - // new completion entry - j := 2; - while (j <= Len) and (s[j] > ' ') do - Inc(j); - sCompl := Copy(s, 2, j - 2); - // start of comment in DCI file - while (j <= Len) and (s[j] <= ' ') do - Inc(j); - if (j <= Len) and (s[j] = '|') then - Inc(j); - while (j <= Len) and (s[j] <= ' ') do - Inc(j); - sComment := Copy(s, j, Len); - if sComment[Length(sComment)] = ']' then - SetLength(sComment, Length(sComment) - 1); - end - else - begin - if sComplValue <> '' then - sComplValue := sComplValue + #13#10; - sComplValue := sComplValue + s; - end; - end - else - begin - // the original style - if (Len > 0) and (s[1] <> '=') then - begin - // save last entry - if sCompl <> '' then - SaveEntry; - // new completion entry - sCompl := s; - end - else if (Len > 0) and (s[1] = '=') then - begin - if sComplValue <> '' then - sComplValue := sComplValue + #13#10; - sComplValue := sComplValue + Copy(s, 2, Len); - end; - end; - end; - if sCompl <> '' then //mg 2000-11-07 - SaveEntry; - end; - FParsed := True; -end; - -function TCustomSynAutoComplete.RemoveEditor(AEditor: TCustomSynEdit): Boolean; -var - i: Integer; -begin - if AEditor <> nil then - begin - i := FEditors.IndexOf(AEditor); - if (i > -1) then - begin - if FEditor = AEditor then - FEditor := nil; - FEditors.Delete(i); - AEditor.UnregisterCommandHandler(SynEditCommandHandler); - {$IFDEF SYN_COMPILER_5_UP} - RemoveFreeNotification(AEditor); - {$ENDIF} - end; - end; - Result := False; -end; - -procedure TCustomSynAutoComplete.SetAutoCompleteList(Value: TUnicodeStrings); -begin - FAutoCompleteList.Assign(Value); - FParsed := False; -end; - -procedure TCustomSynAutoComplete.SetEditor(Value: TCustomSynEdit); -begin - if Value <> FEditor then - begin - if FEditor <> nil then - RemoveEditor(FEditor); - FEditor := Value; - if (Value <> nil) then - AddEditor(Value); - end; -end; - -procedure TCustomSynAutoComplete.SynEditCommandHandler(Sender: TObject; - AfterProcessing: Boolean; var Handled: Boolean; - var Command: TSynEditorCommand; var AChar: WideChar; Data, - HandlerData: Pointer); -begin - if not AfterProcessing and not Handled and (Command = ecAutoCompletion) then - begin - Handled := True; - Execute(Sender as TCustomSynEdit); - end; -end; - -end. diff --git a/Ext/SynEdit/Source/SynEditCodeFolding.pas b/Ext/SynEdit/Source/SynEditCodeFolding.pas index 88147ee..24ccfd9 100644 --- a/Ext/SynEdit/Source/SynEditCodeFolding.pas +++ b/Ext/SynEdit/Source/SynEditCodeFolding.pas @@ -8,10 +8,6 @@ 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 SynEditWordWrap.pas by Flávio Etrusco, released 2003-12-11. - Unicode translation by Maël Hörz. - All Rights Reserved. - Contributors to the SynEdit and mwEdit projects are listed in the Contributors.txt file. @@ -47,9 +43,9 @@ FoldRanges.NoFoldInfo ScanForFoldRanges is called after the standard highlighter scanning has taken place so one can use the Range information stored inside LinesToScan, which - is a TSynEditStringList, to avoid duplicating effort. + is a TSynEditStringList, to avoid duplicating effort. - Initally two hightlighters have been converted SynHighlighterJScript and + Initally two highlighters have been converted SynHighlighterJScript and SynHighlighterPython, to serve as examples of adding code folding suppot to brace-based and indentation-based languagges. @@ -62,8 +58,8 @@ Python highlighters as well as the use of the OnScanForFoldRangesEvent event to support code folding in C++ files. - Synedit Commands and Shortcuts - ============================== + Synedit Commants and Shortcuts + ========= The following commands have been added: ecFoldAll, ecUnfoldAll, ecFoldNearest, ecUnfoldNearest, ecFoldLevel1, ecFoldLevel2, ecFoldLevel3,, ecUnfoldLevel1, ecUnfoldLevel2, @@ -106,28 +102,17 @@ } interface -{$I SynEdit.inc} - uses - Graphics, - Types, - Classes, - SysUtils, - Generics.Defaults, - Generics.Collections, + System.Types, + System.UITypes, + System.Classes, + System.SysUtils, + System.Generics.Defaults, + System.Generics.Collections, + Vcl.Graphics, SynEditHighlighter; type -{$IFNDEF SYN_DELPHI_XE3_UP} - // use small hack in XE and XE2 to make internal array accessible as in XE3 and up - TList = class(Generics.Collections.TList) - private - function GetList: TArray; - public - property List: TArray read GetList; - end; -{$ENDIF} - // Custom COde Folding Exception TSynCodeFoldingException = class(Exception) end; @@ -138,16 +123,20 @@ TSynFoldRange = record FromLine: Integer; // Beginning line ToLine: Integer; // End line FoldType: Integer; // Could be used by some complex highlighters - Indent : Integer; // Only used for Indent based folding (Python) - Collapsed: Boolean; // Is collapsed? + Indent: Integer; // Only used for Indent based folding (Python) private - function GetLinesCollapsed: Integer; + FCollapsed: Boolean; // Is collapsed? + // The following private variables are used for efficienct + // conversion from lines to rows and vice versa. + // They are updated in AdjustRangeRows + FFromRow: Integer; // starting row + FCollapsedIndex: Integer; // Index of enclosing collapsed range public procedure Move(Count: Integer); - property LinesCollapsed: Integer read GetLinesCollapsed; - constructor Create(AFromLine : Integer; AToLine : Integer = -1; - AFoldType : Integer = 1; AIndent : Integer = -1; - ACollapsed : Boolean = False); + property Collapsed: Boolean read FCollapsed; + constructor Create(AFromLine: Integer; AToLine: Integer = -1; + AFoldType: Integer = 1; AIndent: Integer = -1; + ACollapsed: Boolean = False); end; PSynFoldRange = ^TSynFoldRange; @@ -155,6 +144,10 @@ TSynFoldRange = record {Support for indendation based code folding as in Python, F#} TSynCodeFoldingMode = (cfmStandard, cfmIndentation); + TSynFoldRanges = class; + TSynAdjustRangesProc = procedure(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings) of object; + TSynFoldRanges = class(TObject) { The main code folding data structure. @@ -166,76 +159,92 @@ TSynFoldRanges = class(TObject) } private type - TFoldOpenClose = (focOpen, focClose); + TFoldOpenClose = (focOpen, focClose, focCloseOpen); TLineFoldInfo = record - Line : Integer; - FoldOpenClose : TFoldOpenClose; - FoldType : Integer; - Indent : Integer; - constructor Create(ALine : Integer; - AFoldOpenClose : TFoldOpenClose = focOpen; - AFoldType : Integer = 1; AIndent : Integer = -1); + Line: Integer; + FoldOpenClose: TFoldOpenClose; + FoldType: Integer; + Indent: Integer; + constructor Create(ALine: Integer; + AFoldOpenClose: TFoldOpenClose = focOpen; + AFoldType: Integer = 1; AIndent: Integer = -1); end; - private - fCodeFoldingMode : TSynCodeFoldingMode; - fRangesNeedFixing : Boolean; + fCodeFoldingMode: TSynCodeFoldingMode; + fRangesNeedFixing: Boolean; fRanges: TList; - fCollapsedState : TList; - fFoldInfoList : TList; + fCollapsedState: TList; + fFoldInfoList: TList; + FRowComparer: IComparer; + FAdjustRangesProc: TSynAdjustRangesProc; function Get(Index: Integer): TSynFoldRange; function GetCount: Integer; + procedure RecreateFoldRanges(Lines: TStrings); + procedure AdjustRangeRows; public constructor Create; destructor Destroy; override; {utility routines} + procedure CollapseAll; + function Collapse(RangeIndex: Integer): Boolean; + procedure CollapseLevel(Level: Integer); + procedure CollapseFoldType(FoldType: Integer); + procedure UnCollapseAll; + procedure UnCollapse(RangeIndex: Integer); + procedure UnCollapseLevel(Level: Integer); + procedure UnCollapseFoldType(FoldType: Integer); function FoldStartAtLine(Line: Integer): Boolean; overload; function FoldStartAtLine(Line: Integer; out Index: Integer): Boolean; overload; function CollapsedFoldStartAtLine(Line: Integer): Boolean; overload; function CollapsedFoldStartAtLine(Line: Integer; out Index: Integer): Boolean; overload; - function FoldEndAtLine(Line: Integer) : Boolean; overload; - function FoldEndAtLine(Line: Integer; out Index: Integer) : Boolean; overload; + function FoldEndAtLine(Line: Integer): Boolean; overload; + function FoldEndAtLine(Line: Integer; out Index: Integer): Boolean; overload; function FoldAroundLineEx(Line: Integer; WantCollapsed, AcceptFromLine, AcceptToLine: Boolean; out Index: Integer): Boolean; function CollapsedFoldAroundLine(Line: Integer): Boolean; overload; function CollapsedFoldAroundLine(Line: Integer; out Index: Integer): Boolean; overload; - function FoldAroundLine(Line: Integer) : Boolean; overload; - function FoldAroundLine(Line: Integer; out Index: Integer) : Boolean; overload; - function FoldHidesLine(Line: Integer) : Boolean; overload; - function FoldHidesLine(Line: Integer; out Index: Integer) : Boolean; overload; - function FoldsAtLevel(Level : integer) : TArray; - function FoldsOfType(aType : integer) : TArray; + function FoldAroundLine(Line: Integer): Boolean; overload; + function FoldAroundLine(Line: Integer; out Index: Integer): Boolean; overload; + function FoldHidesLine(Line: Integer): Boolean; overload; + function FoldHidesLine(Line: Integer; out Index: Integer): Boolean; overload; + function FoldsAtLevel(Level: Integer): TArray; + function FoldsOfType(aType: Integer): TArray; + function FoldRangesForTextRange(FromLine, ToLine: Integer): + TArray; {Scanning support} - procedure StoreCollapsedState; - procedure RestoreCollapsedState; + procedure StoreCollapsedState; overload; + procedure RestoreCollapsedState; overload; + procedure StoreCollapsedState(Stream: TStream); overload; + procedure RestoreCollapsedState(Stream: TStream); overload; procedure StartScanning; - function StopScanning(Lines : TStrings) : Boolean; // Returns True of Ranges were updated + function StopScanning(Lines: TStrings): Boolean; // Returns True of Ranges were updated procedure AddLineInfo(ALine: Integer; AFoldType: Integer; - AFoldOpenClose: TFoldOpenClose; AIndent : Integer); - procedure StartFoldRange(ALine : Integer; AFoldType : integer; AIndent : Integer = -1); - procedure StopFoldRange(ALine : Integer; AFoldType : integer; AIndent : Integer = -1); - procedure NoFoldInfo(ALine : Integer); - function GetIndentLevel(Line : Integer) : Integer; - procedure RecreateFoldRanges(Lines : TStrings); + AFoldOpenClose: TFoldOpenClose; AIndent: Integer); + procedure StartFoldRange(ALine: Integer; AFoldType: Integer; AIndent: Integer = -1); + procedure StopFoldRange(ALine: Integer; AFoldType: Integer; AIndent: Integer = -1); + procedure StopStartFoldRange(ALine: Integer; AFoldType: Integer; AIndent: Integer = -1); + procedure NoFoldInfo(ALine: Integer); + function GetIndentLevel(Line: Integer): Integer; // plugin notifications and support routines function FoldLineToRow(Line: Integer): Integer; function FoldRowToLine(Row: Integer): Integer; function LinesInserted(aIndex: Integer; aCount: Integer): Integer; function LinesDeleted(aIndex: Integer; aCount: Integer): Integer; - function LinesPutted(aIndex: Integer; aCount: Integer): Integer; + function LinePut(aIndex: Integer; const OldLine: string): Integer; procedure Reset; {Access to the internal FoldRange list routines} procedure AddByParts(AFoldType: Integer; AFromLine: Integer; AToLine: Integer = -1); procedure AddFoldRange(FoldRange: TSynFoldRange); - property CodeFoldingMode : TSynCodeFoldingMode + property CodeFoldingMode: TSynCodeFoldingMode read fCodeFoldingMode write fCodeFoldingMode; + property AdjustRangesProc: TSynAdjustRangesProc write fAdjustRangesProc; property Count: Integer read GetCount; - property FoldRange[Index : Integer] : TSynFoldRange read Get; default; + property FoldRange[Index: Integer]: TSynFoldRange read Get; default; property Ranges: TList read fRanges; end; @@ -244,56 +253,49 @@ TLineFoldInfo = record TSynCodeFolding = class(TPersistent) { Class to store and expose to the designer Code Folding properties } private - fIndentGuides: Boolean; + fIndentGuides: Boolean; //Ethea: backward compatibility fCollapsedLineColor: TColor; fFolderBarLinesColor: TColor; - fIndentGuidesColor: TColor; + fIndentGuidesColor: TColor; //Ethea: backward compatibility fShowCollapsedLine: Boolean; - fShowHintMark : Boolean; - fGutterShapeSize : Integer; - fOnChange : TSynCodeFoldingChangeEvent; - procedure SetIndentGuides(const Value: Boolean); + fShowHintMark: Boolean; + fGutterShapeSize: Integer; + fOnChange: TSynCodeFoldingChangeEvent; procedure SetCollapsedLineColor(const Value: TColor); procedure SetFolderBarLinesColor(const Value: TColor); - procedure SetIndentGuidesColor(const Value: TColor); procedure SetShowCollapsedLine(const Value: Boolean); procedure SetShowHintMark(const Value: Boolean); procedure SetGutterShapeSize(const Value: Integer); public constructor Create; procedure Assign(Source: TPersistent); override; + function ScaledGutterShapeSize(PPI: Integer): Integer; property OnChange: TSynCodeFoldingChangeEvent read fOnChange write fOnChange; published - // Size of the gutter shapes in pixels at 96 PPI - had to be odd number + // Size of the gutter shapes in pixels at 96 PPI property GutterShapeSize: Integer read fGutterShapeSize - write SetGutterShapeSize; + write SetGutterShapeSize default 9; property CollapsedLineColor: TColor read fCollapsedLineColor - write SetCollapsedLineColor; + write SetCollapsedLineColor default clGrayText; property FolderBarLinesColor: TColor read fFolderBarLinesColor - write SetFolderBarLinesColor; - property IndentGuidesColor: TColor read fIndentGuidesColor - write SetIndentGuidesColor; - property IndentGuides: Boolean read fIndentGuides write SetIndentGuides; + write SetFolderBarLinesColor default clGrayText; + property IndentGuidesColor: TColor read fIndentGuidesColor write fIndentGuidesColor; //Ethea: backward compatibility + property IndentGuides: Boolean read fIndentGuides write fIndentGuides; //Ethea: backward compatibility property ShowCollapsedLine: Boolean read fShowCollapsedLine - write SetShowCollapsedLine; + write SetShowCollapsedLine default False; property ShowHintMark: Boolean read fShowHintMark - write SetShowHintMark; + write SetShowHintMark default True; end; TSynCustomCodeFoldingHighlighter = class(TSynCustomHighlighter) protected // Utility functions - function GetLineRange(Lines: TStrings; Line : Integer) : Pointer; - function GetHighlighterAttriAtRowCol(const Lines : TStrings; - const Line: Integer; const Char: Integer): TSynHighlighterAttributes; - function GetHighlighterAttriAtRowColEx(const Lines : TStrings; - const Line, Char: Integer; var Token: string; - var TokenType, Start: Integer; var Attri: TSynHighlighterAttributes): boolean; - function TabWidth(LinesToScan: TStrings) : integer; + function GetLineRange(Lines: TStrings; Line: Integer): Pointer; + function TabWidth(LinesToScan: TStrings): Integer; public // Called when a Highlighter is assigned to Synedit; // No need to override except to change the SynCodeFoldingMode - procedure InitFoldRanges(FoldRanges : TSynFoldRanges); virtual; + procedure InitFoldRanges(FoldRanges: TSynFoldRanges); virtual; // Called after Highlighter ranges have been set procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); virtual; abstract; @@ -301,35 +303,51 @@ TSynCustomCodeFoldingHighlighter = class(TSynCustomHighlighter) // Override only if some finetuning of the FoldRanges is need. procedure AdjustFoldRanges(FoldRanges: TSynFoldRanges; LinesToScan: TStrings); virtual; + class function GetCapabilities: TSynHighlighterCapabilities; override; end; - Const - FoldRegionType: Integer = 99; +const + FoldRegionType: Integer = 99; implementation -uses - SynEditTextBuffer, - Math; - -{$IFNDEF SYN_DELPHI_XE3_UP} -function TList.GetList: TArray; -begin - // use bug that existed in XE and XE2 that made - // it possible to access private members from parent class - Result := TArray(FItems); -end; -{$ENDIF} +Uses + Winapi.Windows, + System.Math, + SynEditTextBuffer; { TSynEditFoldRanges } function TSynFoldRanges.CollapsedFoldAroundLine(Line: Integer): Boolean; -Var +var Index: Integer; begin Result := CollapsedFoldAroundLine(Line, Index); end; +function TSynFoldRanges.Collapse(RangeIndex: Integer): Boolean; +begin + Result := False; + if not InRange(RangeIndex, 0, Count - 1) then Exit; + + with fRanges.List[RangeIndex] do + if not Collapsed and (FromLine < ToLine) then + begin + FCollapsed := True; + AdjustRangeRows; + Result := True; + end; +end; + +procedure TSynFoldRanges.CollapseAll; +var + Index: Integer; +begin + for Index := 0 to Count -1 do + fRanges.List[Index].FCollapsed := True; + AdjustRangeRows; +end; + function TSynFoldRanges.CollapsedFoldAroundLine(Line: Integer; out Index: Integer): Boolean; begin @@ -337,7 +355,7 @@ function TSynFoldRanges.CollapsedFoldAroundLine(Line: Integer; end; function TSynFoldRanges.CollapsedFoldStartAtLine(Line: Integer): Boolean; -Var +var Index: Integer; begin Result := CollapsedFoldStartAtLine(Line, Index); @@ -351,6 +369,30 @@ function TSynFoldRanges.CollapsedFoldStartAtLine(Line: Integer; Result := Result and fRanges[Index].Collapsed; end; +procedure TSynFoldRanges.CollapseFoldType(FoldType: Integer); +var + I: Integer; +begin + for I := 0 to Count - 1 do + if fRanges.List[I].FoldType = FoldType then + fRanges.List[I].FCollapsed := True; + + AdjustRangeRows; +end; + +procedure TSynFoldRanges.CollapseLevel(Level: Integer); +var + I: Integer; + RangeIndices: TArray; +begin + RangeIndices := FoldsAtLevel(Level); + + for I := Low(RangeIndices) to High(RangeIndices) do + fRanges.List[RangeIndices[I]].FCollapsed := True; + + AdjustRangeRows; +end; + constructor TSynFoldRanges.Create; begin inherited; @@ -362,6 +404,12 @@ constructor TSynFoldRanges.Create; Result := L.FromLine - R.FromLine; end)); + FRowComparer := TComparer.Construct( + function(const L, R: TSynFoldRange): Integer + begin + Result := L.FFromRow - R.FFromRow; + end); + fCollapsedState := TList.Create; fFoldInfoList := TList.Create(TComparer.Construct( @@ -380,7 +428,7 @@ destructor TSynFoldRanges.Destroy; end; function TSynFoldRanges.FoldAroundLine(Line: Integer): Boolean; -Var +var Index: Integer; begin Result := FoldAroundLine(Line, Index); @@ -403,8 +451,8 @@ function TSynFoldRanges.FoldAroundLineEx(Line: Integer; begin with fRanges.List[i] do begin - if ((FromLine < Line) or ((FromLine <= Line) and AcceptFromLine)) and - ((ToLine > Line) or ((ToLine >= Line) and AcceptToLine)) and + if ((FromLine < Line) or ((FromLine = Line) and AcceptFromLine)) and + ((ToLine > Line) or ((ToLine = Line) and AcceptToLine)) and (Collapsed = WantCollapsed) then begin Index := i; @@ -435,14 +483,14 @@ function TSynFoldRanges.FoldEndAtLine(Line: Integer; end; function TSynFoldRanges.FoldEndAtLine(Line: Integer): Boolean; -Var +var Index: Integer; begin Result := FoldEndAtLine(Line, Index); end; function TSynFoldRanges.FoldHidesLine(Line: Integer): Boolean; -Var +var Index: Integer; begin Result := FoldHidesLine(Line, Index); @@ -456,87 +504,113 @@ function TSynFoldRanges.FoldHidesLine(Line: Integer; function TSynFoldRanges.FoldLineToRow(Line: Integer): Integer; var - i: Integer; - CollapsedTo: Integer; + Index: Integer; + CollapsedLines: Integer; + Range: TSynFoldRange; begin - Result := Line; - CollapsedTo := 0; - for i := 0 to fRanges.Count - 1 do - with fRanges.List[i] do - begin - // fold after line - if FromLine >= Line then - Break; + if Count = 0 then Exit(Line); - if Collapsed then - begin - // Line is found after fold - if ToLine < Line then - begin - Dec(Result, Max(ToLine - Max(FromLine, CollapsedTo), 0)); - CollapsedTo := Max(CollapsedTo, ToLine); - // Inside fold - end - else - begin - Dec(Result, Line - Max(FromLine, CollapsedTo)); - Break; - end; - end; - end; + // binary search + if FoldStartAtLine(Line, Index) then + Exit(fRanges.List[Index].FFromRow) + else + begin + // Line before first fold + if Index = 0 then Exit(Line); + + // previous range + Range := fRanges[Index - 1]; + if Range.FCollapsedIndex >= 0 then + Range := fRanges[Range.FCollapsedIndex]; + CollapsedLines := Range.FromLine - Range.FFromRow; + if Range.Collapsed then + begin + Inc(CollapsedLines, Range.ToLine - Range.FromLine); + if Line <= Range.ToLine then Exit(Range.FFromRow); + end; + Result := Line - CollapsedLines; + end; +end; + +function TSynFoldRanges.FoldRangesForTextRange(FromLine, + ToLine: Integer): TArray; +// Used for structure highlight +var + Range: TSynFoldRange; +begin + Result := []; + for Range in fRanges do + begin + if Range.ToLine < FromLine then Continue; + if Range.FromLine > ToLine then Break; + // Only add if indent > 0 + if not Range.Collapsed and (Range.Indent > 0) then + Result := Result + [Range]; + end; end; function TSynFoldRanges.FoldRowToLine(Row: Integer): Integer; var - i: Integer; - CollapsedTo: Integer; + Index: Integer; + Range: TSynFoldRange; begin - Result := Row; - CollapsedTo := 0; - for i := 0 to fRanges.Count - 1 do - with fRanges.List[i] do - begin - if FromLine >= Result then - Break; + if Count = 0 then Exit(Row); - if Collapsed then - begin - Inc(Result, Max(ToLine - Max(FromLine, CollapsedTo), 0)); - CollapsedTo := Max(CollapsedTo, ToLine); - end; - end; + // binary search + + if fRanges.BinarySearch(TSynFoldRange.Create(Row), Index, FRowComparer) then + begin + // deal with duplicates return the top line + while (Index > 0) and (fRanges.List[Index - 1].FFromRow = Row) do + Dec(Index); + Exit(fRanges.List[Index].FromLine); + end + else + begin + // Row before first fold + if Index = 0 then Exit(Row); + + // previous range + Range := fRanges[Index - 1]; + if Range.FCollapsedIndex >= 0 then + Range := fRanges[Range.FCollapsedIndex]; + if Range.Collapsed then + Result := Range.ToLine + Row - Range.FFromRow + else + Result := Range.FromLine + Row - Range.FFromRow; + end; end; -function TSynFoldRanges.FoldsAtLevel(Level: integer): TArray; +function TSynFoldRanges.FoldsAtLevel(Level: Integer): TArray; { Returns an array of indices of folds with level = Level ignoring fold ranges of type FoldRegionType } -Var - i : integer; - FRStack : TList; - ResultList : TList; - - procedure RemoveClosed(Line : integer); - Var - j : integer; +var + I: Integer; + FRStack: TList; + ResultList: TList; + + procedure RemoveClosed(Line: Integer); + var + J: Integer; begin - for j := FRStack.Count-1 downto 0 do - if fRanges.List[FRStack[j]].ToLine <= Line then - FRStack.Delete(j); + for J := FRStack.Count-1 downto 0 do + if fRanges.List[FRStack[J]].ToLine <= Line then + FRStack.Delete(J); end; begin FRStack := TList.Create; - ResultList := TList.Create; + ResultList := TList.Create; try - for i := 0 to fRanges.Count - 1 do + for I := 0 to fRanges.Count - 1 do begin - if fRanges.List[i].FoldType = FoldRegionType then - continue; - RemoveClosed(fRanges.List[i].FromLine); - FRStack.Add(i); + if fRanges.List[I].FoldType = FoldRegionType then + Continue; + RemoveClosed(fRanges.List[I].FromLine); + FRStack.Add(I); if FRStack.Count = Level then - ResultList.Add(i); + ResultList.Add(I); end; Result := ResultList.ToArray; finally @@ -545,20 +619,20 @@ function TSynFoldRanges.FoldsAtLevel(Level: integer): TArray; end; end; -function TSynFoldRanges.FoldsOfType(aType: integer): TArray; +function TSynFoldRanges.FoldsOfType(aType: Integer): TArray; { Returns an array of indices of folds with FoldType = aType } -Var - i : integer; - ResultList : TList; +var + I: Integer; + ResultList: TList; begin ResultList := TList.Create; try - for i := 0 to fRanges.Count - 1 do + for I := 0 to fRanges.Count - 1 do begin - if fRanges.List[i].FoldType = aType then - ResultList.Add(i); + if fRanges.List[I].FoldType = aType then + ResultList.Add(I); end; Result := ResultList.ToArray; finally @@ -567,7 +641,7 @@ function TSynFoldRanges.FoldsOfType(aType: integer): TArray; end; function TSynFoldRanges.FoldStartAtLine(Line: Integer): Boolean; -Var +var Index: Integer; begin Result := FoldStartAtLine(Line, Index); @@ -583,9 +657,9 @@ function TSynFoldRanges.FoldStartAtLine(Line: Integer; out Index: Integer): Bool procedure TSynFoldRanges.AddByParts(AFoldType: Integer; AFromLine: Integer; AToLine: Integer); -Var - Index : integer; - FR : TSynFoldRange; +var + Index: Integer; + FR: TSynFoldRange; begin // Insert keeping the list sorted FR := TSynFoldRange.Create(AFromLine, AToLine, AFoldType); @@ -601,7 +675,7 @@ procedure TSynFoldRanges.AddFoldRange(FoldRange: TSynFoldRange); end; procedure TSynFoldRanges.AddLineInfo(ALine: Integer; AFoldType: Integer; - AFoldOpenClose: TFoldOpenClose; AIndent : Integer); + AFoldOpenClose: TFoldOpenClose; AIndent: Integer); var LineFoldInfo: TLineFoldInfo; Index: Integer; @@ -611,13 +685,11 @@ procedure TSynFoldRanges.AddLineInfo(ALine: Integer; AFoldType: Integer; // Insert keeping the list sorted if fFoldInfoList.BinarySearch(LineFoldInfo, Index) then begin - if (fFoldInfoList.List[Index].FoldOpenClose <> AFoldOpenClose) or - (fFoldInfoList.List[Index].FoldType <> AFoldType) or - (fFoldInfoList.List[Index].Indent <> AIndent) then + if not CompareMem(@LineFoldInfo, @fFoldInfoList.List[Index], + SizeOf(TLineFoldInfo)) + then begin - fFoldInfoList.List[Index].FoldOpenClose := AFoldOpenClose; - fFoldInfoList.List[Index].FoldType := AFoldType; - fFoldInfoList.List[Index].Indent := AIndent; + fFoldInfoList.List[Index] := LineFoldInfo; fRangesNeedFixing := True; end; end @@ -627,6 +699,57 @@ procedure TSynFoldRanges.AddLineInfo(ALine: Integer; AFoldType: Integer; end; end; +procedure TSynFoldRanges.AdjustRangeRows; +var + I: Integer; + CollapsedTo: Integer; + CollapsedCount: Integer; + CollapsedFromRow: Integer; + CollapsedIndex: Integer; +begin + if fRanges.Count = 0 then Exit; + + CollapsedTo := 0; + CollapsedCount := 0; + CollapsedFromRow := MaxInt; + CollapsedIndex := -1; + + for I := 0 to fRanges.Count - 1 do + with fRanges.List[I] do + begin + FFromRow := FromLine; + FCollapsedIndex := -1; + + if FromLine < CollapsedTo then + begin + FFromRow := CollapsedFromRow; + FCollapsedIndex := CollapsedIndex; + end + else + Dec(FFromRow, CollapsedCount); + + if Collapsed then + begin + if CollapsedTo < FromLine then + begin + Inc(CollapsedCount, ToLine - FromLine); + CollapsedTo := ToLine; + CollapsedFromRow := FFromRow; + FCollapsedIndex := -1; + CollapsedIndex := I; + end + else if CollapsedTo < ToLine then + begin + Inc(CollapsedCount, ToLine - CollapsedTo); + CollapsedTo := ToLine; + CollapsedFromRow := Min(FFromRow, CollapsedFromRow); + FCollapsedIndex := -1; + CollapsedIndex := I; + end; + end; + end; +end; + function TSynFoldRanges.Get(Index: Integer): TSynFoldRange; begin Result := TSynFoldRange(fRanges[Index]); @@ -639,17 +762,17 @@ function TSynFoldRanges.GetCount: Integer; function TSynFoldRanges.GetIndentLevel(Line: Integer): Integer; -Var - Index : Integer; - i : Integer; +var + Index: Integer; + I: Integer; begin Result := -1; fFoldInfoList.BinarySearch(TLineFoldInfo.Create(Line), Index); // Search above Line for I := Index - 1 downto 0 do - if fFoldInfoList.List[i].Indent >= 0 then begin - Result := fFoldInfoList.List[i].Indent; - break + if fFoldInfoList.List[I].Indent >= 0 then begin + Result := fFoldInfoList.List[I].Indent; + Break end; end; @@ -660,36 +783,38 @@ function TSynFoldRanges.LinesDeleted(aIndex, aCount: Integer): Integer; If needed recreate fRanges } var - i : Integer; + I: Integer; begin fRangesNeedFixing := False; Result := aCount; // Adjust fFoldInfoList // aIndex is 0-based fFoldInfoList is 1-based - for i := fFoldInfoList.Count - 1 downto 0 do - with fFoldInfoList.List[i] do + for I := fFoldInfoList.Count - 1 downto 0 do + with fFoldInfoList.List[I] do if Line > aIndex + aCount then - Dec(fFoldInfoList.List[i].Line, aCount) + Dec(fFoldInfoList.List[I].Line, aCount) else if Line > aIndex then begin fRangesNeedFixing := True; - fFoldInfoList.Delete(i); + fFoldInfoList.Delete(I); end else - break; + Break; - for i := fRanges.Count - 1 downto 0 do - with fRanges.List[i] do + if fRangesNeedFixing then Exit; + + for I := fRanges.Count - 1 downto 0 do + with fRanges.List[I] do if (FromLine > aIndex + aCount) then // Move after affected area - Ranges.List[i].Move(-aCount) + Ranges.List[I].Move(-aCount) else if FromLine > aIndex then begin fRangesNeedFixing := True; - fRanges.Delete(i); + fRanges.Delete(I); end else if ToLine > aIndex + aCount then - Dec(fRanges.List[i].ToLine, aCount) + Dec(fRanges.List[I].ToLine, aCount) else if ToLine > aIndex then - Dec(fRanges.List[i].ToLine, ToLine - aIndex) + Dec(fRanges.List[I].ToLine, ToLine - aIndex) end; function TSynFoldRanges.LinesInserted(aIndex, aCount: Integer): Integer; @@ -698,34 +823,34 @@ function TSynFoldRanges.LinesInserted(aIndex, aCount: Integer): Integer; aIndex is 0-based fFoldInfoList and fRanges are 1-based } var - i: Integer; + I: Integer; begin Result := aCount; - for i := fFoldInfoList.Count - 1 downto 0 do - with fFoldInfoList.List[i] do + for I := fFoldInfoList.Count - 1 downto 0 do + with fFoldInfoList.List[I] do if Line > aIndex then - Inc(fFoldInfoList.List[i].Line, aCount) + Inc(fFoldInfoList.List[I].Line, aCount) else - break; + Break; - for i := fRanges.Count - 1 downto 0 do - with fRanges.List[i] do + for I := fRanges.Count - 1 downto 0 do + with fRanges.List[I] do begin if (FromLine > aIndex) then // insertion of count lines above FromLine - fRanges.List[i].Move(aCount) + fRanges.List[I].Move(aCount) else if (ToLine > aIndex) then - Inc(fRanges.List[i].ToLine, aCount); + Inc(fRanges.List[I].ToLine, aCount); end; end; -function TSynFoldRanges.LinesPutted(aIndex, aCount: Integer): Integer; +function TSynFoldRanges.LinePut(aIndex: Integer; const OldLine: string): Integer; begin Result := 1; end; procedure TSynFoldRanges.NoFoldInfo(ALine: Integer); -Var - Index : Integer; +var + Index: Integer; begin if fFoldInfoList.BinarySearch(TLineFoldInfo.Create(ALine), Index) then @@ -733,94 +858,105 @@ procedure TSynFoldRanges.NoFoldInfo(ALine: Integer); // we have deleted an existing fold open or close mark fRangesNeedFixing := True; fFoldInfoList.Delete(Index); - end; + end + else if (Index < fFoldInfoList.Count) and + (fFoldInfoList.List[Index].Line = ALine + 1) and + (fFoldInfoList.List[Index].FoldOpenClose = focCloseOpen) + then + fRangesNeedFixing := True; end; -procedure TSynFoldRanges.RecreateFoldRanges(Lines : TStrings); -Var - OpenFoldStack : TList; - LFI : TLineFoldInfo; - PFoldRange : PSynFoldRange; - i : Integer; - Line : integer; +procedure TSynFoldRanges.RecreateFoldRanges(Lines: TStrings); +var + OpenFoldStack: TList; + LFI: TLineFoldInfo; + PFoldRange: PSynFoldRange; + I: Integer; + Line: Integer; begin - { TODO : Account for type } + { TODO: Account for type } fRanges.Clear; OpenFoldStack := TList.Create; try for LFI in fFoldInfoList do begin - if LFI.FoldOpenClose = focOpen then + if LFI.FoldOpenClose in [focClose, focCloseOpen] then begin if LFI.Indent >= 0 then begin - for i := OpenFoldStack.Count - 1 downto 0 do + for I := OpenFoldStack.Count - 1 downto 0 do begin - // Close all Fold Ranges with less Indent - PFoldRange := @fRanges.List[OpenFoldStack.List[i]]; + // Close all Fold Ranges with greater Indent + PFoldRange := @fRanges.List[OpenFoldStack.List[I]]; if (PFoldRange^.Indent >= LFI.Indent) then begin PFoldRange^.ToLine := LFI.Line - 1; // Do not include Line - OpenFoldStack.Delete(i); + OpenFoldStack.Delete(I); + if PFoldRange^.FromLine = PFoldRange^.ToLine then + fRanges.Remove(PFoldRange^); end; end; - end; - fRanges.Add(TSynFoldRange.Create(LFI.Line, LFI.Line, LFI.FoldType, LFI.Indent)); - OpenFoldStack.Add(FRanges.Count -1); - end - else - // foClose + end + else + for I := OpenFoldStack.Count - 1 downto 0 do + begin + PFoldRange := @fRanges.List[OpenFoldStack.List[I]]; + if (PFoldRange^.FoldType = LFI.FoldType) then begin + PFoldRange^.ToLine := IfThen(LFI.FoldOpenClose = focClose, + LFI.Line, LFI.Line - 1); + OpenFoldStack.Delete(I); + Break; + end; + end; + end; + + if LFI.FoldOpenClose in [focOpen, focCloseOpen] then begin if LFI.Indent >= 0 then begin - for i := OpenFoldStack.Count - 1 downto 0 do + for I := OpenFoldStack.Count - 1 downto 0 do begin // Close all Fold Ranges with less Indent - PFoldRange := @fRanges.List[OpenFoldStack.List[i]]; + PFoldRange := @fRanges.List[OpenFoldStack.List[I]]; if (PFoldRange^.Indent >= LFI.Indent) then begin PFoldRange^.ToLine := LFI.Line - 1; // Do not include Line - OpenFoldStack.Delete(i); - end; - end; - end - else - for i := OpenFoldStack.Count - 1 downto 0 do - begin - PFoldRange := @fRanges.List[OpenFoldStack.List[i]]; - if (PFoldRange^.FoldType = LFI.FoldType) then begin - PFoldRange^.ToLine := LFI.Line; - OpenFoldStack.Delete(i); - break; + OpenFoldStack.Delete(I); + if PFoldRange^.FromLine = PFoldRange^.ToLine then + fRanges.Remove(PFoldRange^); end; end; + end; + fRanges.Add(TSynFoldRange.Create(LFI.Line, LFI.Line, LFI.FoldType, LFI.Indent)); + OpenFoldStack.Add(FRanges.Count -1); end; end; if CodeFoldingMode = cfmIndentation then begin // close all open indent based folds - for i := OpenFoldStack.Count - 1 downto 0 do + for I := OpenFoldStack.Count - 1 downto 0 do begin // Close all Fold Ranges with less Indent - PFoldRange := @fRanges.List[OpenFoldStack.List[i]]; + PFoldRange := @fRanges.List[OpenFoldStack.List[I]]; if (PFoldRange^.Indent >= 0) then begin PFoldRange^.ToLine := Lines.Count; // - OpenFoldStack.Delete(i); + OpenFoldStack.Delete(I); end; end; // Adjust LineTo for Indent based folds with empty lines in the end - for i := 0 to fRanges.Count - 1 do begin - PFoldRange := @fRanges.List[i]; + for I := fRanges.Count - 1 downto 0 do begin + PFoldRange := @fRanges.List[I]; if PFoldRange^.Indent >= 0 then begin Line := PFoldRange^.ToLine; - while (Line > PFoldRange^.FromLine) and (TrimLeft( Lines[Line-1]) = '') do + while (Line > PFoldRange^.FromLine) and (TrimLeft(Lines[Line-1]) = '') do begin Dec(PFoldRange^.ToLine); Dec(Line); end; + if PFoldRange^.FromLine = PFoldRange^.ToLine then + fRanges.Delete(I); end; end; end; - finally OpenFoldStack.Free; end; @@ -834,18 +970,34 @@ procedure TSynFoldRanges.Reset; fRangesNeedFixing := False; end; -procedure TSynFoldRanges.ReStoreCollapsedState; -Var - i, Index : integer; +procedure TSynFoldRanges.RestoreCollapsedState(Stream: TStream); +var + Size, Line, Index: Integer; +begin + Size := Stream.Size; + while Stream.Position < Size do begin + Stream.ReadData(Line); + if FoldStartAtLine(Line, Index) then + fRanges.List[Index].FCollapsed := True; + end; + + AdjustRangeRows; +end; + +procedure TSynFoldRanges.RestoreCollapsedState; +var + I, Index: Integer; begin - for i in fCollapsedState do begin - if FoldStartAtLine(i, Index) then - fRanges.List[Index].Collapsed := True; + for I in fCollapsedState do begin + if FoldStartAtLine(I, Index) then + fRanges.List[Index].FCollapsed := True; end; fCollapsedState.Clear; + + AdjustRangeRows; end; -procedure TSynFoldRanges.StartFoldRange(ALine, AFoldType: integer; AIndent : Integer); +procedure TSynFoldRanges.StartFoldRange(ALine, AFoldType: Integer; AIndent: Integer); begin AddLineInfo(ALine, AFoldType, focOpen, AIndent); end; @@ -854,15 +1006,20 @@ procedure TSynFoldRanges.StartScanning; begin end; -procedure TSynFoldRanges.StopFoldRange(ALine, AFoldType: integer; AIndent : Integer); +procedure TSynFoldRanges.StopFoldRange(ALine, AFoldType: Integer; AIndent: Integer); begin AddLineInfo(ALine, AFoldType, focClose, AIndent); end; -function TSynFoldRanges.StopScanning(Lines : TStrings) : Boolean; +procedure TSynFoldRanges.StopStartFoldRange(ALine, AFoldType: Integer; AIndent: Integer); +begin + AddLineInfo(ALine, AFoldType, focCloseOpen, AIndent); +end; + +function TSynFoldRanges.StopScanning(Lines: TStrings): Boolean; { - Returns true if fold ranges changed - Recreates FoldRanges if the Synedit lines are not updating + Returns True if fold ranges changed + Recreates FoldRanges if needed } begin Result := fRangesNeedFixing; @@ -870,14 +1027,72 @@ function TSynFoldRanges.StopScanning(Lines : TStrings) : Boolean; if Result then begin StoreCollapsedState; RecreateFoldRanges(Lines); + // Adjustment of ranges by highlighters + if Assigned(FAdjustRangesProc) then + FAdjustRangesProc(Self, Lines); + // RestoreCollapsedState calls AdjustRangeRows + // which stores Row numbers for quick access RestoreCollapsedState; fRangesNeedFixing := False; end; end; +procedure TSynFoldRanges.StoreCollapsedState(Stream: TStream); +var + FoldRange: TSynFoldRange; +begin + for FoldRange in fRanges do + if FoldRange.Collapsed then + Stream.WriteData(FoldRange.FromLine); +end; + +procedure TSynFoldRanges.UnCollapse(RangeIndex: Integer); +begin + if not InRange(RangeIndex, 0, Count - 1) then Exit; + + if fRanges.List[RangeIndex].Collapsed then + begin + fRanges.List[RangeIndex].FCollapsed := False; + AdjustRangeRows; + end; +end; + +procedure TSynFoldRanges.UnCollapseAll; +var + Index: Integer; +begin + for Index := 0 to Count -1 do + fRanges.List[Index].FCollapsed := False; + AdjustRangeRows; +end; + +procedure TSynFoldRanges.UnCollapseFoldType(FoldType: Integer); +var + I: Integer; +begin + for I := 0 to Count - 1 do + if fRanges.List[I].FoldType = FoldType then + fRanges.List[I].FCollapsed := False; + + AdjustRangeRows; +end; + +procedure TSynFoldRanges.UnCollapseLevel(Level: Integer); +var + I: Integer; + RangeIndices: TArray; +begin + RangeIndices := FoldsAtLevel(Level); + + for I := Low(RangeIndices) to High(RangeIndices) do + fRanges.List[RangeIndices[I]].FCollapsed := False; + + AdjustRangeRows; +end; + procedure TSynFoldRanges.StoreCollapsedState; -Var - FoldRange : TSynFoldRange; +var + FoldRange: TSynFoldRange; begin fCollapsedState.Clear; for FoldRange in fRanges do @@ -888,60 +1103,27 @@ procedure TSynFoldRanges.StoreCollapsedState; { TSynEditFoldRange } constructor TSynFoldRange.Create(AFromLine, AToLine, AFoldType: Integer; - AIndent : Integer; ACollapsed: Boolean); + AIndent: Integer; ACollapsed: Boolean); begin FromLine := AFromLine; + FFromRow := AFromLine; ToLine := AToLine; FoldType := AFoldType; Indent := AIndent; - Collapsed := ACollapsed; -end; - -function TSynFoldRange.GetLinesCollapsed: Integer; -begin - if Collapsed then - Result := ToLine - FromLine - else - Result := 0; + FCollapsed := ACollapsed; end; procedure TSynFoldRange.Move(Count: Integer); begin Inc(FromLine, Count); Inc(ToLine, Count); -end; - -procedure TSynCodeFolding.Assign(Source: TPersistent); -begin - if Source is TSynCodeFolding then - begin - fIndentGuides := TSynCodeFolding(Source).fIndentGuides; - fCollapsedLineColor := TSynCodeFolding(Source).fCollapsedLineColor; - fFolderBarLinesColor := TSynCodeFolding(Source).fFolderBarLinesColor; - fIndentGuidesColor := TSynCodeFolding(Source).fIndentGuidesColor; - fShowCollapsedLine := TSynCodeFolding(Source).fShowCollapsedLine; - fShowHintMark := TSynCodeFolding(Source).fShowHintMark; - fGutterShapeSize := TSynCodeFolding(Source).fGutterShapeSize; - end - else - inherited Assign(Source); -end; - -constructor TSynCodeFolding.Create; -begin - fIndentGuides := True; - fCollapsedLineColor := clGrayText; - fFolderBarLinesColor := clGrayText; - fIndentGuidesColor := clGray; - fShowCollapsedLine := False; - fShowHintMark := True; - fGutterShapeSize := 11; + Inc(FFromRow, Count); end; { TSynFoldRanges.TLineFoldInfo } constructor TSynFoldRanges.TLineFoldInfo.Create(ALine: Integer; - AFoldOpenClose: TFoldOpenClose; AFoldType: Integer; AIndent : Integer); + AFoldOpenClose: TFoldOpenClose; AFoldType: Integer; AIndent: Integer); begin Line := ALine; FoldOpenClose := AFoldOpenClose; @@ -957,49 +1139,9 @@ procedure TSynCustomCodeFoldingHighlighter.AdjustFoldRanges( // Do nothing end; -function TSynCustomCodeFoldingHighlighter.GetHighlighterAttriAtRowCol( - const Lines: TStrings; const Line: Integer; - const Char: Integer): TSynHighlighterAttributes; -var - Token: string; - TokenType, Start: Integer; -begin - GetHighlighterAttriAtRowColEx(Lines, Line, Char, Token, TokenType, - Start, Result); -end; - -function TSynCustomCodeFoldingHighlighter.GetHighlighterAttriAtRowColEx( - const Lines: TStrings; const Line, Char: Integer; var Token: string; - var TokenType, Start: Integer; var Attri: TSynHighlighterAttributes): boolean; -var - LineText: string; +class function TSynCustomCodeFoldingHighlighter.GetCapabilities: TSynHighlighterCapabilities; begin - if (Line >= 0) and (Line < Lines.Count) then - begin - LineText := Lines[Line]; - if Line = 0 then - ResetRange - else - SetRange(TSynEditStringList(Lines).Ranges[Line - 1]); - SetLine(LineText, Line); - if (Char > 0) and (Char <= Length(LineText)) then - while not GetEol do - begin - Start := GetTokenPos + 1; - Token := GetToken; - if (Char >= Start) and (Char < Start + Length(Token)) then - begin - Attri := GetTokenAttribute; - TokenType := GetTokenKind; - Result := True; - exit; - end; - Next; - end; - end; - Token := ''; - Attri := nil; - Result := False; + Result := inherited GetCapabilities + [hcCodeFolding]; end; function TSynCustomCodeFoldingHighlighter.GetLineRange(Lines: TStrings; @@ -1018,13 +1160,45 @@ procedure TSynCustomCodeFoldingHighlighter.InitFoldRanges( end; function TSynCustomCodeFoldingHighlighter.TabWidth( - LinesToScan: TStrings): integer; + LinesToScan: TStrings): Integer; begin Result := TSynEditStringList(LinesToScan).TabWidth; end; { TSynCodeFolding } +procedure TSynCodeFolding.Assign(Source: TPersistent); +begin + if Source is TSynCodeFolding then + begin + fCollapsedLineColor := TSynCodeFolding(Source).fCollapsedLineColor; + fFolderBarLinesColor := TSynCodeFolding(Source).fFolderBarLinesColor; + fShowCollapsedLine := TSynCodeFolding(Source).fShowCollapsedLine; + fShowHintMark := TSynCodeFolding(Source).fShowHintMark; + fGutterShapeSize := TSynCodeFolding(Source).fGutterShapeSize; + if Assigned(fOnChange) then fOnChange(Self); + end + else + inherited Assign(Source); +end; + +constructor TSynCodeFolding.Create; +begin + fCollapsedLineColor := clGrayText; + fFolderBarLinesColor := clGrayText; + fShowCollapsedLine := False; + fShowHintMark := True; + fGutterShapeSize := 9; +end; + +function TSynCodeFolding.ScaledGutterShapeSize(PPI: Integer): Integer; +{ Always returns an odd number } +begin + Result := MulDiv(fGutterShapeSize, PPI, 96); + if not Odd(Result) then + Dec(Result); +end; + procedure TSynCodeFolding.SetCollapsedLineColor(const Value: TColor); begin if fCollapsedLineColor <> Value then begin @@ -1042,30 +1216,9 @@ procedure TSynCodeFolding.SetFolderBarLinesColor(const Value: TColor); end; procedure TSynCodeFolding.SetGutterShapeSize(const Value: Integer); -Var - NewValue: Integer; -begin - NewValue := Value; - if not Odd(NewValue) then - Dec(NewValue); - if fGutterShapeSize <> NewValue then begin - fGutterShapeSize := NewValue; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynCodeFolding.SetIndentGuides(const Value: Boolean); -begin - if fIndentGuides <> Value then begin - fIndentGuides := Value; - if Assigned(fOnChange) then fOnChange(Self); - end; -end; - -procedure TSynCodeFolding.SetIndentGuidesColor(const Value: TColor); begin - if fIndentGuidesColor <> Value then begin - fIndentGuidesColor := Value; + if fGutterShapeSize <> Value then begin + fGutterShapeSize := Value; if Assigned(fOnChange) then fOnChange(Self); end; end; @@ -1086,4 +1239,5 @@ procedure TSynCodeFolding.SetShowCollapsedLine(const Value: Boolean); end; end; + end. diff --git a/Ext/SynEdit/Source/SynEditDataObject.pas b/Ext/SynEdit/Source/SynEditDataObject.pas new file mode 100644 index 0000000..d8d83e0 --- /dev/null +++ b/Ext/SynEdit/Source/SynEditDataObject.pas @@ -0,0 +1,400 @@ +unit SynEditDataObject; +{ + 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. + + Contributors to the SynEdit and mwEdit projects are listed in the + Contributors.txt file. + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License Version 2 or later (the "GPL"), in which case + the provisions of the GPL are applicable instead of those above. + If you wish to allow use of your version of this file only under the terms + of the GPL and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the GPL. + If you do not delete the provisions above, a recipient may use your version + of this file under either the MPL or the GPL. + + This unit implements the IDataObject interface for Clipboard and Drag & Drop + operations. + Code based on Grahame Marsh's articles on OLE Drag & Drop + published in UNDO (www.undo.com) +} + +interface +uses + Winapi.Windows, + Winapi.ActiveX, + System.SysUtils, + System.Classes, + System.Generics.Collections; + +Type + + TSynEnumFormatEtc = class (TInterfacedObject, IEnumFORMATETC) + private + FList: TArray; + FIndex: Integer; + protected + function GetFormatEtc(ClipFormat: TClipFormat): TFormatEtc; + {IEnumFORMATETC} + function Next (celt: Longint; out elt; pceltFetched: PLongint): HResult; stdcall; + function Skip (celt: Longint): HResult; stdcall; + function Reset: HResult; stdcall; + function Clone (out Enum: IEnumFormatEtc): HResult; stdcall; + public + constructor Create (FormatList: TArray; Index: Integer = 0); + end; + + TSynEditDataObject = class (TInterfacedObject, IDataObject) + private + FText: string; + FInternalText: string; + FFormatEtc: TList; + HtmlStream: TMemoryStream; + procedure StreamHTML(Editor: TObject; Stream: TStream); + protected + function GetData (const formatetcIn: TFormatEtc; out medium: TStgMedium): HResult; overload; stdcall; + function GetDataHere (const formatetc: TFormatEtc; out medium: TStgMedium): HResult; overload; stdcall; + function QueryGetData (const formatetc: TFormatEtc): HResult; overload; stdcall; + function GetCanonicalFormatEtc (const formatetc: TFormatEtc; out formatetcOut: TFormatEtc): HResult; overload; stdcall; + function SetData (const formatetc: TFormatEtc; var medium: TStgMedium; fRelease: BOOL): HResult; overload; stdcall; + function EnumFormatEtc (dwDirection: Longint; out enumFormatEtc: IEnumFormatEtc): HResult; overload; stdcall; + function DAdvise (const formatetc: TFormatEtc; advf: Longint; const advSink: IAdviseSink; out dwConnection: Longint): HResult; overload; stdcall; + function DUnadvise (dwConnection: Longint): HResult; overload; stdcall; + function EnumDAdvise (out enumAdvise: IEnumStatData): HResult; overload; stdcall; + public + constructor Create(ASynEdit: TObject); + destructor Destroy; override; + end; + +function MakeGlobal (const S: string): hGlobal; overload; +function MakeGlobal (var P; Size: Integer): hGlobal; overload; +function HasFormat(DataObject: IDataObject; Format: TClipFormat): Boolean; +function GetInternalClipText: TArray; + +const + IntClipFormatDelimiter = #$EEFF; // from private unicode area + +var + SynEditClipboardFormat: UINT; + HTMLClipboardFormat: UINT; + +implementation + +uses + Vcl.Clipbrd, + SynEdit, + SynEditTypes, + SynExportHTML; + +function MakeGlobal (const S: string): hGlobal; +var + P: PChar; + Size: Integer; +begin + Size := ByteLength(S) + SizeOf(Char); + Result := GlobalAlloc (GHND, Size); + if Result = 0 then + OutOfMemoryError; + P := GlobalLock (Result); + try + Move(PChar(S)^, P^, Size) + finally + GlobalUnlock (Result) + end +end; + +function MakeGlobal (var P; Size: Integer): hGlobal; +var + D: pointer; +begin + Result := GlobalAlloc (GHND, Size); + if Result = 0 then + OutOfMemoryError; + D := GlobalLock (Result); + try + Move (P, D^, Size) + finally + GlobalUnlock (Result) + end +end; + +function HasFormat(DataObject: IDataObject; Format: TClipFormat):Boolean; +var + FormatEnumerator: IEnumFormatEtc; + FormatEtc: TFormatEtc; + Returned: Integer; +begin + Result := False; + if (DataObject.EnumFormatEtc (DATADIR_GET, FormatEnumerator) = S_OK) then begin + FormatEnumerator.Reset; + while FormatEnumerator.Next (1, FormatEtc, @Returned) = S_OK do + if FormatEtc.cfFormat = Format then + Exit(True); + end; +end; + +function GetInternalClipText: TArray; +var + Data: THandle; + TempS: string; +begin + Result := []; + if not Clipboard.HasFormat(SynEditClipboardFormat) then Exit; + Data := Clipboard.GetAsHandle(SynEditClipboardFormat); + + if Data <> 0 then + try + TempS := PChar(GlobalLock(Data)); + Result := TempS.Split([IntClipFormatDelimiter]); + finally + GlobalUnlock(Data); + end; +end; + + +constructor TSynEditDataObject.Create(ASynEdit: TObject); +var + Ed: TCustomSynEdit; + + function DelimitedText(Delimiter: string): string; + var + Index: Integer; + Sel: TSynSelection; + begin + Result := ''; + for Index := 0 to Ed.Selections.Count - 1 do + begin + Sel := Ed.Selections[Index]; + if Sel.IsEmpty then + Result := Result + Ed.Lines[Sel.Caret.Line - 1] + else + Result := Result + Ed.SelectionText(Sel); + + if Index < Ed.Selections.Count - 1 then + Result := Result + Delimiter; + end; + end; + +begin + inherited Create; + + Ed := ASynEdit as TCustomSynEdit; + + FFormatEtc := TList.Create; + + FFormatEtc.Add(CF_UNICODETEXT); + FText := DelimitedText(SLineBreak); + + if Ed.Selections.Count > 1 then + begin + FFormatEtc.Add(SynEditClipboardFormat); // InternalFormat + FInternalText := DelimitedText(IntClipFormatDelimiter); + end; + + if not (eoCopyPlainText in TCustomSynEdit(ASynEdit).Options) and + Assigned(TCustomSynEdit(ASynEdit).Highlighter) and (FText <> '') + then + begin + FFormatEtc.Add(HTMLClipboardFormat); // HTMLFormat + HtmlStream := TMemoryStream.Create; + StreamHtml(ASynEdit, HtmlStream); + end; +end; + +destructor TSynEditDataObject.Destroy; +begin + FFormatEtc.Free; + HtmlStream.Free; + inherited Destroy +end; + +function TSynEditDataObject.GetData (const formatetcIn: TFormatEtc; out medium: TStgMedium): HResult; +begin + ZeroMemory (@Medium, sizeof (TStgMedium)); + Result := QueryGetData(formatetcIn); + if Result = S_OK then + try + Medium.tymed := TYMED_HGLOBAL; + if FormatEtcIn.cfFormat = CF_UNICODETEXT then + Medium.hGlobal := MakeGlobal(FText) + else if FormatEtcIn.cfFormat = SynEditClipboardFormat then + Medium.hGlobal := MakeGlobal(FInternalText) + else if (FormatEtcIn.cfFormat = HTMLClipboardFormat) then + Medium.hGlobal := MakeGlobal(HtmlStream.Memory^, HtmlStream.Position); + except + Result := E_UNEXPECTED; + end +end; + +function TSynEditDataObject.GetDataHere (const formatetc: TFormatEtc; out medium: TStgMedium): HResult; +begin + Result := E_NOTIMPL; +end; + +procedure TSynEditDataObject.StreamHTML(Editor: TObject; Stream: TStream); +var + HTMLExport: TSynExporterHTML; + SL: TStringList; + Ed: TCustomSynEdit; +begin + Ed := Editor as TCustomSynEdit; + HTMLExport := TSynExporterHTML.Create(nil); + try + HTMLExport.Font := Ed.Font; + HTMLExport.CreateHTMLFragment := True; + HTMLExport.UseBackground := not (eoNoHTMLBackground in TCustomSynEdit(Editor).Options); + HTMLExport.Highlighter := Ed.Highlighter; + SL := TStringList.Create; + try + SL.Text := FText; + HTMLExport.ExportAll(SL); + HTMLExport.SaveToStream(Stream); + finally + SL.Free; + end; + // Adding a terminating null byte to the Stream. + Stream.WriteData(0, 1); + finally + HTMLExport.Free; + end; +end; + +function TSynEditDataObject.QueryGetData (const formatetc: TFormatEtc): HResult; +begin + if (formatetc.tymed and TYMED_HGLOBAL = TYMED_HGLOBAL) and + FFormatEtc.Contains(formatetc.cfFormat) + then + Result := S_OK + else + Result := DV_E_FORMATETC; +end; + +function TSynEditDataObject.GetCanonicalFormatEtc (const formatetc: TFormatEtc; out formatetcOut: TFormatEtc): HResult; +begin + FormatEtcOut.ptd := nil; + Result := DATA_S_SAMEFORMATETC; +end; + +function TSynEditDataObject.SetData (const formatetc: TFormatEtc; var medium: TStgMedium; fRelease: BOOL): HResult; +begin + Result := E_NOTIMPL; +end; + +function TSynEditDataObject.EnumFormatEtc (dwDirection: Longint; out enumFormatEtc: IEnumFormatEtc): HResult; +begin + try + if dwDirection = DATADIR_GET then + begin + EnumFormatEtc := TSynEnumFormatEtc.Create(FFormatEtc.ToArray); + Result := S_OK + end else + Result := E_NOTIMPL; + except + Result := E_UNEXPECTED; + end +end; + +function TSynEditDataObject.DAdvise (const formatetc: TFormatEtc; advf: Longint; const advSink: IAdviseSink; out dwConnection: Longint): HResult; +begin + Result := OLE_E_ADVISENOTSUPPORTED; +end; + +function TSynEditDataObject.DUnadvise (dwConnection: Longint): HResult; +begin + Result := OLE_E_ADVISENOTSUPPORTED; +end; + +function TSynEditDataObject.EnumDAdvise (out enumAdvise: IEnumStatData): HResult; +begin + Result := OLE_E_ADVISENOTSUPPORTED; +end; + + +//=== BASE ENUM FORMATETC CLASS ================================================ + +constructor TSynEnumFormatEtc.Create(FormatList: TArray; + Index: Integer); +begin + inherited Create; + FList := FormatList; + FIndex := Index; +end; + +function TSynEnumFormatEtc.GetFormatEtc(ClipFormat: TClipFormat): TFormatEtc; +begin + with Result do + begin + cfFormat := ClipFormat; + dwAspect := DVASPECT_CONTENT; + ptd := nil; + tymed := TYMED_HGLOBAL; + lindex := -1; + end; +end; + +function TSynEnumFormatEtc.Next (celt: Longint; out elt; pceltFetched: PLongint): HResult; +var + I: Integer; + FormatEtc: PFormatEtc; +begin + I := 0; + FormatEtc:= PFormatEtc(@Elt); + while (I < Celt) and (FIndex < Length(FList)) do + begin + FormatEtc^ := GetFormatEtc(FList[FIndex]); + Inc(FormatEtc); + Inc (FIndex); + Inc (I) + end; + + if (pCeltFetched <> nil) then pCeltFetched^:= i; + + if (I = Celt) then + Result:= S_OK + else + Result:= S_FALSE; +end; + +function TSynEnumFormatEtc.Skip (celt: Longint): HResult; +begin + Result := S_OK; + if Celt <= Length(FList) - FIndex then + FIndex := FIndex + Celt + else begin + FIndex := Length(FList); + Result := S_FALSE + end +end; + +function TSynEnumFormatEtc.Reset: HResult; +begin + FIndex := 0; + Result := S_OK; +end; + +function TSynEnumFormatEtc.Clone (out Enum: IEnumFormatEtc): HResult; +begin + Result := S_OK; + Enum := TSynEnumFormatEtc.Create (FList, FIndex); +end; + + +const + CF_HTML = 'HTML Format'; +initialization + OleInitialize(nil); + SynEditClipboardFormat := RegisterClipboardFormat ('Internal SynEdit clipboard format'); + HTMLClipboardFormat := RegisterClipboardFormat(CF_HTML); +finalization + OleFlushClipboard; + OleUninitialize; +end. diff --git a/Ext/SynEdit/Source/SynEditDocumentManager.pas b/Ext/SynEdit/Source/SynEditDocumentManager.pas deleted file mode 100644 index 282b5ee..0000000 --- a/Ext/SynEdit/Source/SynEditDocumentManager.pas +++ /dev/null @@ -1,492 +0,0 @@ -unit SynEditDocumentManager; - -interface - -uses - Classes, - Messages, - ExtCtrls, - SynEditTypes, - SynEdit, - SynMemo, - SynEditTextBuffer, - SynEditHighlighter; - -type - ISynDocument = interface - ['{DC80C7CF-FC56-4FDE-9E3E-6A1C53D6EFCD}'] - procedure SetCaretXY(const value: TBufferCoord); - function GetCaretXY: TBufferCoord; - procedure SetLines(const value: TStrings); - function GetLines: TStrings; - function GetUndoList: TSynEditUndoList; - function GetRedoList: TSynEditUndoList; - function GetTopLine: Integer; - procedure SetTopLine(const value: Integer); - procedure SetModified(const value: Boolean); - function GetModified: Boolean; - function GetName: string; - function GetHighLighter: TSynCustomHighlighter; - procedure SetHighlighter(const value: TSynCustomHighlighter); - function GetDataIntf: IInterface; - procedure SetDataIntf(const value: IInterface); - function GetMarks: TSynEditMarkList; - - property CaretXY: TBufferCoord read GetCaretXY write SetCaretXY; - property Lines: TStrings read GetLines write SetLines; - property UndoList: TSynEditUndoList read GetUndoList; - property RedoList: TSynEditUndoList read GetRedoList; - property TopLine: Integer read GetTopLine write SetTopLine; - property Modified: Boolean read GetModified write SetModified; - property Name: string read GetName; - property Highlighter: TSynCustomHighlighter read GetHighlighter write SetHighLighter; - property DataIntf: IInterface read GetDataIntf write SetDataIntf; - property Marks: TSynEditMarkList read GetMarks; - //Line info allows us to store stuff like gutter icons, breakpoints etc. - end; - - TSynEditDocumentManager = class(TComponent) - private - FDocuments: IInterfaceList; - FCurrentDocumentIndex: Integer; - FMemo: TSynMemo; - FMemoWndProc: TWndMethod; - FUpdateTimer: TTimer; - function GetCount: Integer; - function GetCurrentDocument: ISynDocument; - protected - procedure MemoWndProc(var Msg: TMessage); - procedure SetMemo(const Value: TSynMemo); - function GetDocument(index: Integer): ISynDocument; - function GetDocumentByName(index: string): ISynDocument; - procedure SetCurrentDocumentIndex(const Value: Integer); - procedure UpdateTimerEvent(Sender: TObject); - - procedure Notification(AComponent: TComponent; Operation: TOperation); override; - public - constructor Create(AOwner: TComponent); override; - destructor Destroy; override; - procedure UpdateCurrentDocument; //saves editor to document - procedure ApplyCurrentDocument; //applies document to editor - function AddDocument(const AName: string; const ALines: TStrings; const AHighlighter: TSynCustomHighlighter): ISynDocument; - procedure RemoveDocument(const index: Integer); overload; - procedure RemoveDocument(const AName: string); overload; - procedure RemoveDocument(const ADocument: ISynDocument); overload; - procedure RemoveAll; - property Documents[index: Integer]: ISynDocument read GetDocument; - property CurrentDocument: ISynDocument read GetCurrentDocument; - property DocumentsByName[index: string]: ISynDocument read GetDocumentByName; - property CurrentDocumentIndex: Integer read FCurrentDocumentIndex write SetCurrentDocumentIndex; - property Count: Integer read GetCount; - published - property Memo: TSynMemo read FMemo write SetMemo; - end; - -implementation - -uses - Windows, SysUtils; -{ TSynEditDocumentManager } - -type - TSynDocument = class(TInterfacedObject, ISynDocument) - private - FName: string; - FLines: TStringList; - FCaretXY: TBufferCoord; - FModified: Boolean; - FRedoList: TSynEditUndoList; - FUndoList: TSynEditUndoList; - FTopLine: Integer; - FHighLighter: TSynCustomHighlighter; - FDataIntf: IInterface; - FMarks: TSynEditMarkList; - protected - function GetCaretXY: TBufferCoord; - function GetLines: TStrings; - function GetModified: Boolean; - function GetName: string; - function GetRedoList: TSynEditUndoList; - function GetTopLine: Integer; - function GetUndoList: TSynEditUndoList; - procedure SetCaretXY(const value: TBufferCoord); - procedure SetLines(const value: TStrings); - procedure SetModified(const value: Boolean); - procedure SetTopLine(const value: Integer); - function GetHighLighter: TSynCustomHighlighter; - procedure SetHighlighter(const value: TSynCustomHighlighter); - function GetDataIntf: IInterface; - procedure SetDataIntf(const value: IInterface); - function GetMarks: TSynEditMarkList; - public - constructor Create(const AName: string; ALines: TStrings); - destructor Destroy; override; - end; - - -constructor TSynEditDocumentManager.Create(AOwner: TComponent); -begin - inherited; - FDocuments := TInterfaceList.Create; - FCurrentDocumentIndex := -1; - FUpdateTimer := TTimer.Create(Self); - FUpdateTimer.enabled := False; - FUpdateTimer.Interval := 200; - FUpdateTimer.OnTimer := UpdateTimerEvent; -end; - -destructor TSynEditDocumentManager.Destroy; -begin - FUpdateTimer.Free; - inherited; -end; - -function TSynEditDocumentManager.AddDocument(const AName: string; - const ALines: TStrings; const AHighlighter: TSynCustomHighlighter): ISynDocument; -begin - Result := GetDocumentByName(AName); - if Result <> nil then - begin - Result.Lines.Assign(ALines); - Result.Highlighter := AHighlighter; - end - else - begin - Result := TSynDocument.Create(AName,ALines); - Result.Highlighter := AHighlighter; - FDocuments.Add(Result); -{ if CurrentDocumentIndex = -1 then - CurrentDocumentIndex := 0;} - end; -end; - -function TSynEditDocumentManager.GetDocument(index: Integer): ISynDocument; -begin - if (index >= 0) and (index < FDocuments.Count) then - Result := FDocuments.Items[index] as ISynDocument - else - Result := nil; -end; - -function TSynEditDocumentManager.GetDocumentByName(index: string): ISynDocument; -var - i: Integer; -begin - Result := nil; - for i := 0 to FDocuments.Count -1 do - begin - Result := GetDocument(i); - if CompareText(Result.Name,index) = 0 then - Break - else - Result := nil; - end; -end; - -procedure TSynEditDocumentManager.RemoveDocument(const index: Integer); -begin - FDocuments.Delete(index); - if FDocuments.Count = 0 then - FCurrentDocumentIndex := -1; -end; - -procedure TSynEditDocumentManager.RemoveDocument(const AName: string); -var - doc: ISynDocument; -begin - doc := GetDocumentByName(AName); - if doc <> nil then - FDocuments.Remove(doc); - if FDocuments.Count = 0 then - FCurrentDocumentIndex := -1; - -end; - -procedure TSynEditDocumentManager.MemoWndProc(var Msg: TMessage); -begin - if (Msg.Msg = WM_CHAR) then - begin - FUpdateTimer.Enabled := False; - FUpdateTimer.Enabled := True; - end; - if Assigned(FMemoWndProc) then - FMemoWndProc(Msg); -end; - -procedure TSynEditDocumentManager.RemoveDocument(const ADocument: ISynDocument); -begin - FDocuments.Remove(ADocument); - if FDocuments.Count = 0 then - FCurrentDocumentIndex := -1; -end; - -procedure TSynEditDocumentManager.SetCurrentDocumentIndex(const Value: Integer); -begin - if FCurrentDocumentIndex <> Value then - begin - UpdateCurrentDocument; - if (Value >= 0) and (Value < FDocuments.Count) then - begin - FCurrentDocumentIndex := Value; - ApplyCurrentDocument; - end; - end; -end; - -procedure TSynEditDocumentManager.SetMemo(const Value: TSynMemo); -begin - if FMemo <> Value then - begin - if FMemo <> nil then - begin - FMemo.RemoveFreeNotification(Self); - if not (csDesigning in ComponentState) then - begin - if Assigned(FMemoWndProc) then - FMemo.WindowProc := FMemoWndProc; - end; - end; - FMemo := Value; - if FMemo <> nil then - begin - FMemo.FreeNotification(Self); - if not (csDesigning in ComponentState) then - begin - FMemoWndProc := FMemo.WindowProc; - FMemo.WindowProc := Self.MemoWndProc; - end; - end; - end; -end; - -procedure TSynEditDocumentManager.RemoveAll; -begin - FDocuments.Clear; - FCurrentDocumentIndex := -1; -end; - -function TSynEditDocumentManager.GetCount: Integer; -begin - Result := FDocuments.Count; -end; - -function TSynEditDocumentManager.GetCurrentDocument: ISynDocument; -begin - if FCurrentDocumentIndex <> -1 then - Result := GetDocument(FCurrentDocumentIndex) - else - Result := nil; -end; - -function CloneMark(const AOwner: TCustomSynEdit; const source: TSynEditMark): TSynEditMark; -begin - Result := TSynEditMark.Create(AOwner); - Result.Line := source.Line; - Result.Char := source.Char; - Result.ImageIndex := source.ImageIndex; - Result.BookmarkNumber := source.BookmarkNumber; - Result.InternalImage := source.InternalImage; - Result.Visible := source.Visible; -end; - -procedure TSynEditDocumentManager.ApplyCurrentDocument; -var - doc: ISynDocument; - I: Integer; -begin - if FCurrentDocumentIndex <> -1 then - begin - if FMemo <> nil then - begin - doc := GetDocument(FCurrentDocumentIndex); - if doc <> nil then - begin - FMemo.Lines.Assign(doc.Lines); - FMemo.TopLine := doc.TopLine; - FMemo.CaretXY := doc.CaretXY; - FMemo.UndoList.Assign(doc.UndoList); - FMemo.RedoList.Assign(doc.RedoList); - FMemo.Highlighter := doc.Highlighter; - //can't do this because it av's now??? -// FMemo.Marks.Assign(doc.Marks); - FMemo.Marks.Clear; - for i := 0 to doc.Marks.Count - 1 do - begin - FMemo.Marks.Place(CloneMark(FMemo,doc.Marks.Items[i])); - end; - FMemo.Modified := doc.Modified; - FMemo.Refresh; - end; - end; - end; -end; - -{ TSynDocument } - -constructor TSynDocument.Create(const AName: string; ALines: TStrings); -begin - inherited Create; - FLines := TStringList.Create; - FRedoList := TSynEditUndoList.Create; - FUndoList := TSynEditUndoList.Create; - FName := AName; - FLines.Assign(ALines); - FModified := False; - FTopLine := 0; - FMarks := TSynEditMarkList.Create(nil); -end; - -destructor TSynDocument.Destroy; -begin - FLines.Free; - FRedoList.Free; - FUndoList.Free; - FMarks.Free; - inherited; -end; - -function TSynDocument.GetCaretXY: TBufferCoord; -begin - Result := FCaretXY; -end; - -function TSynDocument.GetDataIntf: IInterface; -begin - Result := FDataIntf; -end; - -function TSynDocument.GetHighLighter: TSynCustomHighlighter; -begin - Result := FHighLighter; -end; - - -function TSynDocument.GetLines: TStrings; -begin - Result := FLines; -end; - -function TSynDocument.GetMarks: TSynEditMarkList; -begin - Result := FMarks; -end; - -function TSynDocument.GetModified: Boolean; -begin - Result := FModified; -end; - -function TSynDocument.GetName: string; -begin - Result := FName; -end; - -function TSynDocument.GetRedoList: TSynEditUndoList; -begin - Result := FRedoList; -end; - -function TSynDocument.GetTopLine: Integer; -begin - Result := FTopLine; -end; - -function TSynDocument.GetUndoList: TSynEditUndoList; -begin - Result := FUndoList; -end; - -procedure TSynDocument.SetCaretXY(const value: TBufferCoord); -begin - FCaretXY := value; -end; - -procedure TSynDocument.SetDataIntf(const value: IInterface); -begin - FDataIntf := Value; -end; - -procedure TSynDocument.SetHighlighter(const value: TSynCustomHighlighter); -begin - FHighLighter := value; -end; - - -procedure TSynDocument.SetLines(const value: TStrings); -begin - FLines.Assign(value); -end; - -procedure TSynDocument.SetModified(const value: Boolean); -begin - FModified := Value; -end; - -procedure TSynDocument.SetTopLine(const value: Integer); -begin - FTopLine := Value; -end; - -procedure TSynEditDocumentManager.Notification(AComponent: TComponent; - Operation: TOperation); -begin - inherited; - if (AComponent = FMemo) and (Operation = opRemove) then - begin - SetMemo(nil); - end; -end; - -procedure TSynEditDocumentManager.UpdateTimerEvent(Sender: TObject); -var - doc: ISynDocument; -begin - FUpdateTimer.Enabled := False; - if FCurrentDocumentIndex <> -1 then - begin - if FMemo <> nil then - begin - doc := GetDocument(FCurrentDocumentIndex); - if doc <> nil then - begin - doc.Modified := FMemo.Modified; - doc.Lines.Assign(FMemo.Lines); - doc.TopLine := FMemo.TopLine; - doc.CaretXY := FMemo.CaretXY; - doc.UndoList.Assign(FMemo.UndoList); - doc.RedoList.Assign(FMemo.RedoList); - end; - end; - end; -end; - - -procedure TSynEditDocumentManager.UpdateCurrentDocument; -var - doc: ISynDocument; - i: Integer; -begin - if FCurrentDocumentIndex <> -1 then - begin - //save the state of the current document - if FMemo <> nil then - begin - doc := GetDocument(FCurrentDocumentIndex); - if doc <> nil then - begin - doc.Modified := FMemo.Modified; - doc.Lines.Assign(FMemo.Lines); - doc.TopLine := FMemo.TopLine; - doc.CaretXY := FMemo.CaretXY; - doc.UndoList.Assign(FMemo.UndoList); - doc.RedoList.Assign(FMemo.RedoList); - doc.Marks.Clear; - for i := 0 to FMemo.Marks.Count - 1 do - doc.Marks.Place(CloneMark(nil,FMemo.Marks.Items[i])); - FMemo.Highlighter := doc.Highlighter; - end; - end; - end; -end; - -end. diff --git a/Ext/SynEdit/Source/SynEditDragDrop.pas b/Ext/SynEdit/Source/SynEditDragDrop.pas new file mode 100644 index 0000000..384ffa6 --- /dev/null +++ b/Ext/SynEdit/Source/SynEditDragDrop.pas @@ -0,0 +1,190 @@ +unit SynEditDragDrop; +{ + 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. + + Contributors to the SynEdit and mwEdit projects are listed in the + Contributors.txt file. + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License Version 2 or later (the "GPL"), in which case + the provisions of the GPL are applicable instead of those above. + If you wish to allow use of your version of this file only under the terms + of the GPL and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the GPL. + If you do not delete the provisions above, a recipient may use your version + of this file under either the MPL or the GPL. + + OLE Drag and Drop components and routines + Based on Grahame Marsh's code for UNDO +} + +interface + +Uses + Windows, ActiveX, SysUtils, Classes, Messages, Controls, Forms, ExtCtrls; + + +// Drop effects as Delphi style constants (originals in ActiveX) +const + deNone = DROPEFFECT_NONE; + deMove = DROPEFFECT_MOVE; + deCopy = DROPEFFECT_COPY; + deLink = DROPEFFECT_LINK; + deScroll = DROPEFFECT_SCROLL; + +type + TOnDragEvent = procedure(Sender: TObject; DataObject: IDataObject; State: TShiftState; MousePt: TPoint; var Effect: LongInt; var Result: HResult) of object; + TOnDragOverEvent = procedure(Sender: TObject; State: TShiftState; MousePt: TPoint; var Effect: LongInt; var Result: HResult) of object; + TOnDragLeaveEvent = procedure(Sender: TObject; var Result: HResult) of Object; + + // Implementation of the IDropTarget interface + TSynDropTarget = class(TInterfacedObject, IDropTarget) + private + FOnDragEnter: TOnDragEvent; + FOnDragOver: TOnDragOverEvent; + FOnDragLeave: TOnDragLeaveEvent; + FOnDrop: TOnDragEvent; +// IDropTarget + function DragEnter(const DataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; overload; stdcall; + function DragOver(grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; overload; stdcall; + function DragLeave: HResult; overload; stdcall; + function Drop(const DataObj: IDataObject; grfKeyState: Longint; pt: TPoint; var dwEffect: Longint): HResult; overload; stdcall; + protected + procedure DragEnter(DataObject: IDataObject; State: TShiftState; Pt: TPoint; var Effect: LongInt; var Result: HResult); overload; + procedure DragOver(State: TShiftState; Pt: TPoint; var Effect: LongInt; var Result: HResult); overload; + procedure DragLeave(var Result: HResult);overload; + procedure Drop(DataObject: IDataObject; State: TShiftState; Pt: TPoint; var Effect: LongInt; var Result: HResult); overload; + public + property OnDragEnter: TOnDragEvent read FOnDragEnter write FOnDragEnter; + property OnDragOver: TOnDragOverEvent read FOnDragOver write FOnDragOver; + property OnDragLeave: TOnDragLeaveEvent read FOnDragLeave write FOnDragLeave; + property OnDrop: TOnDragEvent read FOnDrop write FOnDrop; + end; + + // Implementation of the IDropSource interface + TSynDragSource = class(TInterfacedObject, IDropSource) + private + // Called routinely by Windows to check that drag operations are to continue. See the + // implementation below of QueryContinueDrag method for the default operation. + function QueryContinueDrag(fEscapePressed: BOOL; grfKeyState: Longint): HResult; overload; stdcall; + // Called routinely to modify the displayed cursor. + function GiveFeedback(dwEffect: Longint): HResult; stdcall; + end; + +implementation + +//--- returns the normal response for a wanted effect: +// no keys = "move" +// control only = "copy" +// control/shift = "link" - ignored in this case +function StandardEffect(Keys: TShiftState): Integer; +begin + Result := deMove; + if ssCtrl in Keys then + begin + Result := deCopy; + end +end; + +{ TDropTarget } + +function TSynDropTarget.DragEnter(const DataObj: IDataObject; + grfKeyState: Integer; pt: TPoint; var dwEffect: LongInt): HResult; +begin + Result := S_OK; + try + DragEnter(DataObj, KeysToShiftState(grfKeyState), Pt, dwEffect, Result); + except + Result := E_UNEXPECTED; + end +end; + +function TSynDropTarget.DragLeave: HResult; +begin + Result := S_OK; + try + DragLeave(Result) + except + Result := E_UNEXPECTED; + end +end; + +function TSynDropTarget.DragOver(grfKeyState: Integer; pt: TPoint; + var dwEffect: LongInt): HResult; +begin + Result := S_OK; + try + DragOver(KeysToShiftState(grfKeyState), Pt, dwEffect, Result); + except + Result := E_UNEXPECTED; + end +end; + +function TSynDropTarget.Drop(const DataObj: IDataObject; grfKeyState: Integer; + pt: TPoint; var dwEffect: LongInt): HResult; +begin + Result := S_OK; + try + Drop(DataObj, KeysToShiftState(grfKeyState), Pt, dwEffect, Result); + except + Result := E_UNEXPECTED; + end +end; + +procedure TSynDropTarget.DragEnter(DataObject: IDataObject; + State: TShiftState; Pt: TPoint; var Effect: LongInt; var Result: HResult); +begin + Effect := StandardEffect(State); + if Assigned(FOnDragEnter) then + FOnDragEnter(Self, DataObject, State, Pt, Effect, Result); +end; + +procedure TSynDropTarget.DragLeave(var Result: HResult); +begin + if Assigned(FOnDragLeave) then + FOnDragLeave(Self, Result) +end; + +procedure TSynDropTarget.DragOver(State: TShiftState; + Pt: TPoint; var Effect: LongInt; var Result: HResult); +begin + Effect := StandardEffect(State); + if Assigned(FOnDragOver) then + FOnDragOver(Self, State, Pt, Effect, Result) +end; + +procedure TSynDropTarget.Drop(DataObject: IDataObject; State: TShiftState; + Pt: TPoint; var Effect: LongInt; var Result: HResult); +begin + Effect := StandardEffect(State); + if Assigned(FOnDrop) then + FOnDrop(Self, DataObject, State, Pt, Effect, Result) +end; + +//=== DRAG SOURCE CLASS =================================================== + +function TSynDragSource.QueryContinueDrag(fEscapePressed: BOOL; grfKeyState: Longint): HResult; +begin + if fEscapePressed then // cancel the drop + Result := DRAGDROP_S_CANCEL + else if(grfKeyState and MK_LBUTTON) = 0 then + Result := DRAGDROP_S_DROP // drop has occurred + else + Result := S_OK; +end; + +function TSynDragSource.GiveFeedback(dwEffect: Longint): HResult; +begin + Result := DRAGDROP_S_USEDEFAULTCURSORS; +end; + + +end. diff --git a/Ext/SynEdit/Source/SynEditExport.pas b/Ext/SynEdit/Source/SynEditExport.pas index ce00078..0434d4a 100644 --- a/Ext/SynEdit/Source/SynEditExport.pas +++ b/Ext/SynEdit/Source/SynEditExport.pas @@ -29,21 +29,12 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditExport.pas,v 1.17.2.8 2008/09/17 13:59:12 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { Base class for exporting a programming language source file or part of it to a formatted output like HTML or RTF and copying this to the Windows clipboard or saving it to a file. } -{$IFNDEF QSYNEDITEXPORT} unit SynEditExport; -{$ENDIF} {$I SynEdit.inc} @@ -68,36 +59,36 @@ ESynEncoding = class(ESynError); actual formatting of tokens. } TSynCustomExporter = class(TComponent) private - FBuffer: TMemoryStream; + fBuffer: TMemoryStream; FCharSize: Integer; - FFirstAttribute: Boolean; + fFirstAttribute: Boolean; FStreaming: Boolean; procedure AssignFont(Value: TFont); procedure SetEncoding(const Value: TSynEncoding); procedure SetExportAsText(Value: Boolean); procedure SetFont(Value: TFont); procedure SetHighlighter(Value: TSynCustomHighlighter); - procedure SetTitle(const Value: UnicodeString); + procedure SetTitle(const Value: string); procedure SetUseBackground(const Value: Boolean); - function StringSize(const AText: UnicodeString): Integer; - procedure WriteString(const AText: UnicodeString); + function StringSize(const AText: string): Integer; + procedure WriteString(const AText: string); protected - FBackgroundColor: TColor; - FClipboardFormat: UINT; - FDefaultFilter: string; + fBackgroundColor: TColor; + fClipboardFormat: UINT; + fDefaultFilter: string; FEncoding: TSynEncoding; - FExportAsText: Boolean; - FFont: TFont; - FHighlighter: TSynCustomHighlighter; - FLastBG: TColor; - FLastFG: TColor; - FLastStyle: TFontStyles; - FTitle: UnicodeString; - FUseBackground: Boolean; + fExportAsText: Boolean; + fFont: TFont; + fHighlighter: TSynCustomHighlighter; + fLastBG: TColor; + fLastFG: TColor; + fLastStyle: TFontStyles; + fTitle: string; + fUseBackground: Boolean; { Adds a string to the output buffer. } - procedure AddData(const AText: UnicodeString); + procedure AddData(const AText: string); { Adds a string and a trailing newline to the output buffer. } - procedure AddDataNewLine(const AText: UnicodeString); + procedure AddDataNewLine(const AText: string); { Adds a newline to the output buffer. } procedure AddNewLine; { Copies the data under this format to the clipboard. The clipboard has to @@ -124,7 +115,7 @@ TSynCustomExporter = class(TComponent) virtual; abstract; { Has to be overridden in descendant classes to add the formatted text of the actual token text to the output buffer. } - procedure FormatToken(Token: UnicodeString); virtual; + procedure FormatToken(Token: string); virtual; { Has to be overridden in descendant classes to add a newline in the output format to the output buffer. } procedure FormatNewLine; virtual; abstract; @@ -135,21 +126,21 @@ TSynCustomExporter = class(TComponent) function GetClipboardFormat: UINT; virtual; { Has to be overridden in descendant classes to return the correct output format footer. } - function GetFooter: UnicodeString; virtual; abstract; + function GetFooter: string; virtual; abstract; { Has to be overridden in descendant classes to return the name of the output format. } function GetFormatName: string; virtual; { Has to be overridden in descendant classes to return the correct output format header. } - function GetHeader: UnicodeString; virtual; abstract; + function GetHeader: string; virtual; abstract; { Inserts a data block at the given position into the output buffer. Is used to insert the format header after the exporting, since some header data may be known only after the conversion is done. } - procedure InsertData(APos: Integer; const AText: UnicodeString); - function ReplaceReservedChar(AChar: WideChar): UnicodeString; virtual; abstract; + procedure InsertData(APos: Integer; const AText: string); + function ReplaceReservedChar(AChar: WideChar): string; virtual; abstract; { Returns a string that has all the invalid chars of the output format replaced with the entries in the replacement array. } - function ReplaceReservedChars(AToken: UnicodeString): UnicodeString; + function ReplaceReservedChars(AToken: string): string; { Sets the token attribute of the next token to determine the changes of colors and font styles so the properties of the next token can be added to the output buffer. } @@ -167,35 +158,36 @@ TSynCustomExporter = class(TComponent) or as text depending on the ExportAsText property. } procedure CopyToClipboard; { Exports everything in the strings parameter to the output buffer. } - procedure ExportAll(ALines: TUnicodeStrings); + procedure ExportAll(ALines: TStrings); { Exports the given range of the strings parameter to the output buffer. } - procedure ExportRange(ALines: TUnicodeStrings; Start, Stop: TBufferCoord); + procedure ExportRange(ALines: TStrings; Start, Stop: TBufferCoord); { Saves the contents of the output buffer to a file. } - procedure SaveToFile(const FileName: UnicodeString); + procedure SaveToFile(const FileName: string); { Saves the contents of the output buffer to a stream. } procedure SaveToStream(Stream: TStream); function SupportedEncodings: TSynEncodings; virtual; abstract; + function ExportedText: string; public { Default background color for text that has no token attribute assigned or for token attributes that have the background set to default. } - property Color: TColor read FBackgroundColor write FBackgroundColor; + property Color: TColor read fBackgroundColor write fBackgroundColor; { Filter string for the output format for SaveAs file dialogs. } - property DefaultFilter: string read FDefaultFilter write FDefaultFilter; + property DefaultFilter: string read fDefaultFilter write fDefaultFilter; property Encoding: TSynEncoding read FEncoding write SetEncoding default seUTF8; - property ExportAsText: Boolean read FExportAsText write SetExportAsText; + property ExportAsText: Boolean read fExportAsText write SetExportAsText; { The font to be used for the output format. The font color is used for text that has no token attribute assigned or for token attributes that have the background set to default. } - property Font: TFont read FFont write SetFont; + property Font: TFont read fFont write SetFont; { The output format of the exporter. } property FormatName: string read GetFormatName; { The highlighter to use for exporting. } property Highlighter: TSynCustomHighlighter - read FHighlighter write SetHighlighter; + read fHighlighter write SetHighlighter; { The title to embedd into the output header. } - property Title: UnicodeString read FTitle write SetTitle; + property Title: string read fTitle write SetTitle; { Use the token attribute background for the exporting. } - property UseBackground: Boolean read FUseBackground write SetUseBackground; + property UseBackground: Boolean read fUseBackground write SetUseBackground; end; const @@ -208,9 +200,7 @@ TSynCustomExporter = class(TComponent) implementation uses -{$IFDEF SYN_COMPILER_4_UP} Math, -{$ENDIF} SynEditMiscProcs, SynEditStrConst; @@ -219,34 +209,34 @@ implementation constructor TSynCustomExporter.Create(AOwner: TComponent); begin inherited Create(AOwner); - FBuffer := TMemoryStream.Create; - FClipboardFormat := CF_TEXT; + fBuffer := TMemoryStream.Create; + fClipboardFormat := CF_TEXT; FCharSize := 1; FEncoding := seUTF8; - FFont := TFont.Create; - FBackgroundColor := clWindow; + fFont := TFont.Create; + fBackgroundColor := clWindow; AssignFont(nil); Clear; - FTitle := SYNS_Untitled; + fTitle := SYNS_Untitled; end; destructor TSynCustomExporter.Destroy; begin - FFont.Free; - FBuffer.Free; + fFont.Free; + fBuffer.Free; inherited Destroy; end; -procedure TSynCustomExporter.AddData(const AText: UnicodeString); +procedure TSynCustomExporter.AddData(const AText: string); begin if AText <> '' then begin WriteString(AText); - FBuffer.SetSize(FBuffer.Position); + fBuffer.SetSize(fBuffer.Position); end; end; -procedure TSynCustomExporter.AddDataNewLine(const AText: UnicodeString); +procedure TSynCustomExporter.AddDataNewLine(const AText: string); begin AddData(AText); AddNewLine; @@ -255,33 +245,33 @@ procedure TSynCustomExporter.AddDataNewLine(const AText: UnicodeString); procedure TSynCustomExporter.AddNewLine; begin WriteString(WideCRLF); - FBuffer.SetSize(FBuffer.Position); + fBuffer.SetSize(fBuffer.Position); end; procedure TSynCustomExporter.AssignFont(Value: TFont); begin if Value <> nil then - FFont.Assign(Value) + fFont.Assign(Value) else begin - FFont.Name := 'Courier New'; - FFont.Size := 10; - FFont.Color := clWindowText; - FFont.Style := []; + fFont.Name := DefaultFontName; + fFont.Size := 10; + fFont.Color := clWindowText; + fFont.Style := []; end; end; procedure TSynCustomExporter.Clear; begin - FBuffer.Position := 0; + fBuffer.Position := 0; // Size is ReadOnly in Delphi 2 - FBuffer.SetSize(0); - FLastStyle := []; - FLastBG := clWindow; - FLastFG := clWindowText; + fBuffer.SetSize(0); + fLastStyle := []; + fLastBG := clWindow; + fLastFG := clWindowText; end; -procedure SetClipboardText(Text: UnicodeString); +procedure SetClipboardText(Text: string); var Mem: HGLOBAL; P: PByte; @@ -292,25 +282,6 @@ procedure SetClipboardText(Text: UnicodeString); try Clipboard.Clear; - // set ANSI text only on Win9X, WinNT automatically creates ANSI from Unicode - if Win32Platform <> VER_PLATFORM_WIN32_NT then - begin - Mem := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE, SLen + 1); - if Mem <> 0 then - begin - P := GlobalLock(Mem); - try - if P <> nil then - begin - Move(PAnsiChar(AnsiString(Text))^, P^, SLen + 1); - Clipboard.SetAsHandle(CF_TEXT, Mem); - end; - finally - GlobalUnlock(Mem); - end; - end; - end; - // set unicode text, this also works on Win9X, even if the clipboard-viewer // can't show it, Word 2000+ can paste it including the unicode only characters Mem := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE, @@ -336,34 +307,9 @@ procedure SetClipboardText(Text: UnicodeString); end; procedure TSynCustomExporter.CopyToClipboard; -const - Nulls: array[0..1] of Byte = (0, 0); -var - S: UnicodeString; begin - if FExportAsText then - begin - FBuffer.Position := FBuffer.Size; - FBuffer.Write(Nulls, FCharSize); - case Encoding of - seUTF16LE: - S := PWideChar(FBuffer.Memory); - seUTF16BE: - begin - S := PWideChar(FBuffer.Memory); - StrSwapByteOrder(PWideChar(S)); - end; - seUTF8: -{$IFDEF UNICODE} - S := UTF8ToUnicodeString(PAnsiChar(FBuffer.Memory)); -{$ELSE} - S := UTF8Decode(PAnsiChar(FBuffer.Memory)); -{$ENDIF} - seAnsi: - S := UnicodeString(PAnsiChar(FBuffer.Memory)); - end; - SetClipboardText(S); - end + if fExportAsText then + SetClipboardText(ExportedText) else CopyToClipboardFormat(GetClipboardFormat); end; @@ -382,8 +328,8 @@ procedure TSynCustomExporter.CopyToClipboardFormat(AFormat: UINT); if Assigned(PtrData) then begin try - FBuffer.Position := 0; - FBuffer.Read(PtrData^, hDataSize - 1); // trailing #0 + fBuffer.Position := 0; + fBuffer.Read(PtrData^, hDataSize - 1); // trailing #0 finally GlobalUnlock(hData); end; @@ -400,20 +346,38 @@ procedure TSynCustomExporter.CopyToClipboardFormat(AFormat: UINT); procedure TSynCustomExporter.DefineProperties(Filer: TFiler); begin inherited; -{$IFNDEF UNICODE} - UnicodeDefineProperties(Filer, Self); -{$ENDIF} end; -procedure TSynCustomExporter.ExportAll(ALines: TUnicodeStrings); +procedure TSynCustomExporter.ExportAll(ALines: TStrings); begin ExportRange(ALines, BufferCoord(1, 1), BufferCoord(MaxInt, MaxInt)); end; -procedure TSynCustomExporter.ExportRange(ALines: TUnicodeStrings; Start, Stop: TBufferCoord); +function TSynCustomExporter.ExportedText: string; +const + Nulls: array[0..1] of Byte = (0, 0); +begin + fBuffer.Position := fBuffer.Size; + fBuffer.Write(Nulls, FCharSize); + case Encoding of + seUTF16LE: + Result := PWideChar(fBuffer.Memory); + seUTF16BE: + begin + Result := PWideChar(fBuffer.Memory); + StrSwapByteOrder(PWideChar(Result)); + end; + seUTF8: + Result := UTF8ToUnicodeString(PAnsiChar(fBuffer.Memory)); + seAnsi: + Result := string(PAnsiChar(fBuffer.Memory)); + end; +end; + +procedure TSynCustomExporter.ExportRange(ALines: TStrings; Start, Stop: TBufferCoord); var i: Integer; - Line, Token: UnicodeString; + Line, Token: string; Attri: TSynHighlighterAttributes; begin FStreaming := True; @@ -423,20 +387,18 @@ procedure TSynCustomExporter.ExportRange(ALines: TUnicodeStrings; Start, Stop: T or (Start.Line > ALines.Count) or (Start.Line > Stop.Line) then Abort; - Stop.Line := Max(1, Min(Stop.Line, ALines.Count)); Stop.Char := Max(1, Min(Stop.Char, Length(ALines[Stop.Line - 1]) + 1)); Start.Char := Max(1, Min(Start.Char, Length(ALines[Start.Line - 1]) + 1)); if (Start.Line = Stop.Line) and (Start.Char >= Stop.Char) then Abort; - // initialization - FBuffer.Position := 0; + fBuffer.Position := 0; // Size is ReadOnly in Delphi 2 - FBuffer.SetSize(Max($1000, (Stop.Line - Start.Line) * 128) * FCharSize); + fBuffer.SetSize(Max($1000, (Stop.Line - Start.Line) * 128) * FCharSize); Highlighter.ResetRange; - // export all the lines into FBuffer - FFirstAttribute := True; + // export all the lines into fBuffer + fFirstAttribute := True; for i := Start.Line to Stop.Line do begin Line := ALines[i - 1]; @@ -460,7 +422,7 @@ procedure TSynCustomExporter.ExportRange(ALines: TUnicodeStrings; Start, Stop: T end; FormatNewLine; end; - if not FFirstAttribute then + if not fFirstAttribute then FormatAfterLastAttribute; // insert header @@ -472,19 +434,19 @@ procedure TSynCustomExporter.ExportRange(ALines: TUnicodeStrings; Start, Stop: T end end; -procedure TSynCustomExporter.FormatToken(Token: UnicodeString); +procedure TSynCustomExporter.FormatToken(Token: string); begin AddData(Token); end; function TSynCustomExporter.GetBufferSize: Integer; begin - Result := FBuffer.Size; + Result := fBuffer.Size; end; function TSynCustomExporter.GetClipboardFormat: UINT; begin - Result := FClipboardFormat; + Result := fClipboardFormat; end; function TSynCustomExporter.GetFormatName: string; @@ -492,7 +454,7 @@ function TSynCustomExporter.GetFormatName: string; Result := ''; end; -procedure TSynCustomExporter.InsertData(APos: Integer; const AText: UnicodeString); +procedure TSynCustomExporter.InsertData(APos: Integer; const AText: string); var Size, ToMove, SizeNeeded: Integer; Dest: PByte; @@ -500,74 +462,50 @@ procedure TSynCustomExporter.InsertData(APos: Integer; const AText: UnicodeStrin Size := StringSize(AText); if Size > 0 then begin - ToMove := FBuffer.Position; + ToMove := fBuffer.Position; SizeNeeded := ToMove + Size; - if FBuffer.Size < SizeNeeded then + if fBuffer.Size < SizeNeeded then // Size is ReadOnly in Delphi 2 - FBuffer.SetSize((SizeNeeded + $1800) and not $FFF); // increment in pages - Dest := FBuffer.Memory; + fBuffer.SetSize((SizeNeeded + $1800) and not $FFF); // increment in pages + Dest := fBuffer.Memory; Inc(Dest, Size); - Move(FBuffer.Memory^, Dest^, ToMove); - FBuffer.Position := 0; + Move(fBuffer.Memory^, Dest^, ToMove); + fBuffer.Position := 0; WriteString(AText); - FBuffer.Position := ToMove + Size; - FBuffer.SetSize(FBuffer.Position); + fBuffer.Position := ToMove + Size; + fBuffer.SetSize(fBuffer.Position); end; end; -function TSynCustomExporter.ReplaceReservedChars(AToken: UnicodeString): UnicodeString; +function TSynCustomExporter.ReplaceReservedChars(AToken: string): string; var - I, ISrc, IDest, SrcLen, DestLen: Integer; - Replace: UnicodeString; - c: WideChar; //mh 2000-10-10 + Chr: Char; + Replacement: string; + SB: TStringBuilder; begin - if AToken <> '' then - begin - SrcLen := Length(AToken); - ISrc := 1; - DestLen := SrcLen; - IDest := 1; - SetLength(Result, DestLen); - while ISrc <= SrcLen do + if AToken = '' then Exit(''); + + SB := TStringBuilder.Create(AToken.Length * 2); // Initial capacity estimate + try + for Chr in AToken do begin - c := AToken[ISrc]; - Replace := ReplaceReservedChar(c); - if Replace <> '' then - Inc(ISrc) + Replacement := ReplaceReservedChar(Chr); + if Replacement = '' then + SB.Append(Chr) else - begin - if IDest > DestLen then - begin - Inc(DestLen, 32); - SetLength(Result, DestLen); - end; - Result[IDest] := c; - Inc(ISrc); - Inc(IDest); - continue; - end; - if IDest + Length(Replace) - 1 > DestLen then - begin - Inc(DestLen, Max(32, IDest + Length(Replace) - DestLen)); - SetLength(Result, DestLen); - end; - for I := 1 to Length(Replace) do - begin - Result[IDest] := Replace[I]; - Inc(IDest); - end; + SB.Append(Replacement); end; - SetLength(Result, IDest - 1); - end - else - Result := ''; + Result := SB.ToString; + finally + SB.Free; + end; end; -procedure TSynCustomExporter.SaveToFile(const FileName: UnicodeString); +procedure TSynCustomExporter.SaveToFile(const FileName: string); var Stream: TStream; begin - Stream := TWideFileStream.Create(FileName, fmCreate); + Stream := TFileStream.Create(FileName, fmCreate); try SaveToStream(Stream); finally @@ -586,8 +524,8 @@ procedure TSynCustomExporter.SaveToStream(Stream: TStream); seUTF16BE: Stream.WriteBuffer(UTF16BOMBE, 2); end; - FBuffer.Position := 0; - FBuffer.SaveToStream(Stream); + fBuffer.Position := 0; + fBuffer.SaveToStream(Stream); end; procedure TSynCustomExporter.SetEncoding(const Value: TSynEncoding); @@ -608,9 +546,9 @@ procedure TSynCustomExporter.SetEncoding(const Value: TSynEncoding); procedure TSynCustomExporter.SetExportAsText(Value: Boolean); begin - if FExportAsText <> Value then + if fExportAsText <> Value then begin - FExportAsText := Value; + fExportAsText := Value; Clear; end; end; @@ -622,25 +560,25 @@ procedure TSynCustomExporter.SetFont(Value: TFont); procedure TSynCustomExporter.SetHighlighter(Value: TSynCustomHighlighter); begin - if FHighlighter <> Value then + if fHighlighter <> Value then begin - if FHighlighter <> nil then - FHighlighter.FreeNotification(Self); - FHighlighter := Value; + if fHighlighter <> nil then + fHighlighter.FreeNotification(Self); + fHighlighter := Value; Clear; - if Assigned(FHighlighter) and Assigned(FHighlighter.WhitespaceAttribute) and FUseBackground then - FBackgroundColor := FHighlighter.WhitespaceAttribute.Background; + if Assigned(fHighlighter) and Assigned(fHighlighter.WhitespaceAttribute) and fUseBackground then + fBackgroundColor := fHighlighter.WhitespaceAttribute.Background; end; end; -procedure TSynCustomExporter.SetTitle(const Value: UnicodeString); +procedure TSynCustomExporter.SetTitle(const Value: string); begin - if FTitle <> Value then + if fTitle <> Value then begin if Value <> '' then - FTitle := Value + fTitle := Value else - FTitle := SYNS_Untitled; + fTitle := SYNS_Untitled; end; end; @@ -659,30 +597,30 @@ procedure TSynCustomExporter.SetTokenAttribute(Attri: TSynHighlighterAttributes) end; begin - if FFirstAttribute then + if fFirstAttribute then begin - FFirstAttribute := False; - FLastBG := ValidatedColor(Attri.Background, FBackgroundColor); - FLastFG := ValidatedColor(Attri.Foreground, FFont.Color); - FLastStyle := Attri.Style; - FormatBeforeFirstAttribute(UseBackground and (FLastBG <> FBackgroundColor), - FLastFG <> FFont.Color, Attri.Style); + fFirstAttribute := False; + fLastBG := ValidatedColor(Attri.Background, fBackgroundColor); + fLastFG := ValidatedColor(Attri.Foreground, fFont.Color); + fLastStyle := Attri.Style; + FormatBeforeFirstAttribute(UseBackground and (fLastBG <> fBackgroundColor), + fLastFG <> fFont.Color, Attri.Style); end else begin ChangedBG := UseBackground and - (FLastBG <> ValidatedColor(Attri.Background, FBackgroundColor)); - ChangedFG := (FLastFG <> ValidatedColor(Attri.Foreground, FFont.Color)); + (fLastBG <> ValidatedColor(Attri.Background, fBackgroundColor)); + ChangedFG := (fLastFG <> ValidatedColor(Attri.Foreground, fFont.Color)); // which font style bits are to be reset? - ChangedStyles := FLastStyle - Attri.Style; - if ChangedBG or ChangedFG or (FLastStyle <> Attri.Style) then + ChangedStyles := fLastStyle - Attri.Style; + if ChangedBG or ChangedFG or (fLastStyle <> Attri.Style) then begin FormatAttributeDone(ChangedBG, ChangedFG, ChangedStyles); // which font style bits are to be set? - ChangedStyles := Attri.Style - FLastStyle; - FLastBG := ValidatedColor(Attri.Background, FBackgroundColor); - FLastFG := ValidatedColor(Attri.Foreground, FFont.Color); - FLastStyle := Attri.Style; + ChangedStyles := Attri.Style - fLastStyle; + fLastBG := ValidatedColor(Attri.Background, fBackgroundColor); + fLastFG := ValidatedColor(Attri.Foreground, fFont.Color); + fLastStyle := Attri.Style; FormatAttributeInit(ChangedBG, ChangedFG, ChangedStyles); end; end; @@ -690,26 +628,27 @@ procedure TSynCustomExporter.SetTokenAttribute(Attri: TSynHighlighterAttributes) procedure TSynCustomExporter.SetUseBackground(const Value: Boolean); begin - FUseBackground := Value; - if Assigned(FHighlighter) and Assigned(FHighlighter.WhitespaceAttribute) and FUseBackground then - FBackgroundColor := FHighlighter.WhitespaceAttribute.Background; + fUseBackground := Value; + if Assigned(fHighlighter) and Assigned(fHighlighter.WhitespaceAttribute) and fUseBackground then + fBackgroundColor := fHighlighter.WhitespaceAttribute.Background; end; -function TSynCustomExporter.StringSize(const AText: UnicodeString): Integer; +function TSynCustomExporter.StringSize(const AText: string): Integer; begin - Result := 0; case Encoding of seUTF8: Result := Length(UTF8Encode(AText)); seUTF16LE, seUTF16BE: Result := Length(AText); seAnsi: - Result := Length(AnsiString(PWideChar(AText))); + Result := Length(AnsiString(AText)); + else + Result := Length(AText); end; Result := Result * FCharSize; end; -procedure TSynCustomExporter.WriteString(const AText: UnicodeString); +procedure TSynCustomExporter.WriteString(const AText: string); var UTF8Str: UTF8String; AnsiStr: AnsiString; @@ -718,21 +657,23 @@ procedure TSynCustomExporter.WriteString(const AText: UnicodeString); seUTF8: begin UTF8Str := UTF8Encode(AText); - FBuffer.WriteBuffer(UTF8Str[1], Length(UTF8Str)); + fBuffer.WriteBuffer(UTF8Str[1], Length(UTF8Str)); end; seUTF16LE: - FBuffer.WriteBuffer(AText[1], Length(AText) * sizeof(WideChar)); + fBuffer.WriteBuffer(AText[1], Length(AText) * sizeof(WideChar)); seUTF16BE: begin StrSwapByteOrder(PWideChar(AText)); - FBuffer.WriteBuffer(AText[1], Length(AText) * sizeof(WideChar)); + fBuffer.WriteBuffer(AText[1], Length(AText) * sizeof(WideChar)); end; seAnsi: begin AnsiStr := AnsiString(PWideChar(AText)); - FBuffer.WriteBuffer(AnsiStr[1], Length(AnsiStr)); + fBuffer.WriteBuffer(AnsiStr[1], Length(AnsiStr)); end; end; end; + end. + diff --git a/Ext/SynEdit/Source/SynEditHighlighter.pas b/Ext/SynEdit/Source/SynEditHighlighter.pas index fd1b482..c43f053 100644 --- a/Ext/SynEdit/Source/SynEditHighlighter.pas +++ b/Ext/SynEdit/Source/SynEditHighlighter.pas @@ -13,18 +13,11 @@ the mwEdit component suite. Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. Unicode translation by Maël Hörz. -Options property added by CodehunterWorks +Options property restored by Ethea for backward compatibility of dfm All Rights Reserved. Contributors to the SynEdit and mwEdit projects are listed in the Contributors.txt file. - -$Id: SynEditHighlighter.pas,v 1.9.1 2012/09/12 08:17:19 CodehunterWorks Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} unit SynEditHighlighter; @@ -34,32 +27,30 @@ interface uses - Graphics, - Windows, - Registry, - IniFiles, + Winapi.Windows, + System.SysUtils, + System.Classes, + System.Win.Registry, + System.IniFiles, + Generics.Collections, + Vcl.Graphics, SynEditTypes, SynEditMiscClasses, SynUnicode, - SysUtils, - Classes, - SynEditHighlighterOptions; - -type - TBetterRegistry = SynEditMiscClasses.TBetterRegistry; + SynEditHighlighterOptions; //Ethea: backward compatibility type TSynHighlighterAttributes = class(TPersistent) private - FBackground: TColor; - FBackgroundDefault: TColor; - FForeground: TColor; - FForegroundDefault: TColor; - FFriendlyName: UnicodeString; - FName: string; - FStyle: TFontStyles; - FStyleDefault: TFontStyles; - FOnChange: TNotifyEvent; + fBackground: TColor; + fBackgroundDefault: TColor; + fForeground: TColor; + fForegroundDefault: TColor; + fFriendlyName: string; + fName: string; + fStyle: TFontStyles; + fStyleDefault: TFontStyles; + fOnChange: TNotifyEvent; procedure Changed; virtual; function GetBackgroundColorStored: Boolean; function GetForegroundColorStored: Boolean; @@ -72,35 +63,34 @@ TSynHighlighterAttributes = class(TPersistent) public procedure Assign(Source: TPersistent); override; procedure AssignColorAndStyle(Source: TSynHighlighterAttributes); - constructor Create(AName: string); overload; - constructor Create(AName: string; AFriendlyName: UnicodeString); overload; + constructor Create(AName: string; AFriendlyName: string); procedure InternalSaveDefaultValues; - function LoadFromBorlandRegistry(RootKey: HKEY; AttrKey, AttrName: string; OldStyle: Boolean): Boolean; virtual; - function LoadFromRegistry(Reg: TBetterRegistry): Boolean; - function SaveToRegistry(Reg: TBetterRegistry): Boolean; -//Fix type changed to TCustomIniFile for use both TMemIniFile and TIniFile + function LoadFromRegistry(Reg: TRegistry): Boolean; + function SaveToRegistry(Reg: TRegistry): Boolean; function LoadFromFile(Ini: TCustomIniFile): Boolean; function SaveToFile(Ini: TCustomIniFile): Boolean; public procedure SetColors(Foreground, Background: TColor); - property FriendlyName: UnicodeString read FFriendlyName; + property FriendlyName: string read fFriendlyName; property IntegerStyle: Integer read GetStyleFromInt write SetStyleFromInt; - property Name: string read FName; - property OnChange: TNotifyEvent read FOnChange write FOnChange; + property Name: string read fName; + property OnChange: TNotifyEvent read fOnChange write fOnChange; published - property Background: TColor read FBackground write SetBackground + property Background: TColor read fBackground write SetBackground stored GetBackgroundColorStored; - property Foreground: TColor read FForeground write SetForeground + property Foreground: TColor read fForeground write SetForeground stored GetForegroundColorStored; - property Style: TFontStyles read FStyle write SetStyle + property Style: TFontStyles read fStyle write SetStyle stored GetFontStyleStored; end; TSynHighlighterCapability = ( - hcUserSettings, // supports Enum/UseUserSettings - hcRegistry // supports LoadFrom/SaveToRegistry + hcUserSettings, // supports Enum/UseUserSettings + hcRegistry, // supports LoadFrom/SaveToRegistry + hcCodeFolding, // supports code folding + hcStructureHighlight // supports structure highlighting ); TSynHighlighterCapabilities = set of TSynHighlighterCapability; @@ -116,38 +106,37 @@ TSynHighlighterAttributes = class(TPersistent) type TSynCustomHighlighter = class(TComponent) private - FAttributes: TStringList; - FAttrChangeHooks: TSynNotifyEventChain; - FUpdateCount: Integer; - FEnabled: Boolean; + fAttributes: TStringList; + fAttrChangeHooks: TSynNotifyEventChain; + fUpdateCount: Integer; + fEnabled: Boolean; FAdditionalWordBreakChars: TSysCharSet; FAdditionalIdentChars: TSysCharSet; FExportName: string; - FOptions: TSynEditHighlighterOptions; + FOptions: TSynEditHighlighterOptions; //Ethea: backward compatibility function GetExportName: string; procedure SetEnabled(const Value: Boolean); procedure SetAdditionalIdentChars(const Value: TSysCharSet); procedure SetAdditionalWordBreakChars(const Value: TSysCharSet); + function IsBracketsStored: Boolean; protected - FCasedLine: PWideChar; - FCasedLineStr: UnicodeString; - FCaseSensitive: Boolean; - FDefaultFilter: string; - FExpandedLine: PWideChar; - FExpandedLineLen: Integer; - FExpandedLineStr: UnicodeString; - FExpandedTokenPos: Integer; - FLine: PWideChar; - FLineLen: Integer; - FLineStr: UnicodeString; - FLineNumber: Integer; - FStringLen: Integer; - FToIdent: PWideChar; - FTokenPos: Integer; - FUpdateChange: Boolean; + fCasedLine: PWideChar; + fCasedLineStr: string; + fCaseSensitive: Boolean; + fDefaultFilter: string; + fLine: PWideChar; + fLineLen: Integer; + fLineStr: string; + fLineNumber: Integer; + fStringLen: Integer; + fToIdent: PWideChar; + fTokenPos: Integer; + fUpdateChange: Boolean; + fBrackets: string; Run: Integer; - FExpandedRun: Integer; - FOldRun: Integer; + fOldRun: Integer; + // If FScanningToEOL is True then only ranges need to be scanned. + FScanningToEOL: Boolean; procedure Loaded; override; procedure AddAttribute(Attri: TSynHighlighterAttributes); procedure DefHighlightChange(Sender: TObject); @@ -158,22 +147,18 @@ TSynCustomHighlighter = class(TComponent) function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; virtual; abstract; function GetDefaultFilter: string; virtual; - function GetSampleSource: UnicodeString; virtual; - procedure DoSetLine(const Value: UnicodeString; LineNumber: Integer); virtual; - function IsCurrentToken(const Token: UnicodeString): Boolean; virtual; + function GetSampleSource: string; virtual; + procedure DoSetLine(const Value: string; LineNumber: Integer); virtual; + function IsCurrentToken(const Token: string): Boolean; virtual; function IsFilterStored: Boolean; virtual; function IsLineEnd(Run: Integer): Boolean; virtual; procedure SetAttributesOnChange(AEvent: TNotifyEvent); procedure SetDefaultFilter(Value: string); virtual; - procedure SetSampleSource(Value: UnicodeString); virtual; - protected - function GetCapabilitiesProp: TSynHighlighterCapabilities; - function GetFriendlyLanguageNameProp: UnicodeString; - function GetLanguageNameProp: string; + procedure SetSampleSource(Value: string); virtual; public class function GetCapabilities: TSynHighlighterCapabilities; virtual; - class function GetFriendlyLanguageName: UnicodeString; virtual; - class function GetLanguageName: string; virtual; + class function GetFriendlyLanguageName: string; virtual; abstract; + class function GetLanguageName: string; virtual; abstract; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -181,46 +166,49 @@ TSynCustomHighlighter = class(TComponent) procedure BeginUpdate; procedure EndUpdate; function GetEol: Boolean; virtual; abstract; - function GetExpandedToken: UnicodeString; virtual; - function GetExpandedTokenPos: Integer; virtual; - function GetKeyWords(TokenKind: Integer): UnicodeString; virtual; + function GetKeyWords(TokenKind: Integer): string; virtual; function GetRange: Pointer; virtual; - function GetToken: UnicodeString; virtual; + function GetToken: string; virtual; function GetTokenAttribute: TSynHighlighterAttributes; virtual; abstract; function GetTokenKind: Integer; virtual; abstract; + function GetTokenLength: Integer; virtual; function GetTokenPos: Integer; virtual; - function IsKeyword(const AKeyword: UnicodeString): Boolean; virtual; + function IsKeyword(const AKeyword: string): Boolean; virtual; procedure Next; virtual; procedure NextToEol; - function PosToExpandedPos(Pos: Integer): Integer; - procedure SetLineExpandedAtWideGlyphs(const Line, ExpandedLine: UnicodeString; - LineNumber: Integer); virtual; - procedure SetLine(const Value: UnicodeString; LineNumber: Integer); virtual; + procedure SetLine(const Value: string; LineNumber: Integer); virtual; procedure SetRange(Value: Pointer); virtual; procedure ResetRange; virtual; function UseUserSettings(settingIndex: Integer): Boolean; virtual; procedure EnumUserSettings(Settings: TStrings); virtual; - function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; virtual; function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; virtual; + function LoadFromIniFile(AIni: TCustomIniFile): Boolean; + function SaveToIniFile(AIni: TCustomIniFile): Boolean; function LoadFromFile(AFileName: string): Boolean; function SaveToFile(AFileName: string): Boolean; - procedure HookAttrChangeEvent(ANotifyEvent: TNotifyEvent); procedure UnhookAttrChangeEvent(ANotifyEvent: TNotifyEvent); function IsIdentChar(AChar: WideChar): Boolean; virtual; function IsWhiteChar(AChar: WideChar): Boolean; virtual; function IsWordBreakChar(AChar: WideChar): Boolean; virtual; - property FriendlyLanguageName: UnicodeString read GetFriendlyLanguageNameProp; - property LanguageName: string read GetLanguageNameProp; + function GetHighlighterAttriAtRowCol(const Lines: TStrings; + const Line: Integer; const Char: Integer): TSynHighlighterAttributes; + function GetHighlighterAttriAtRowColEx(const Lines: TStrings; + const Line, Char: Integer; var Token: string; + var TokenType, Start: Integer; var Attri: TSynHighlighterAttributes): Boolean; + function FlowControlAtLine(Lines: TStrings; Line: Integer): TSynFlowControl; virtual; + property FriendlyLanguageName: string read GetFriendlyLanguageName; + property LanguageName: string read GetLanguageName; public property AdditionalIdentChars: TSysCharSet read FAdditionalIdentChars write SetAdditionalIdentChars; property AdditionalWordBreakChars: TSysCharSet read FAdditionalWordBreakChars write SetAdditionalWordBreakChars; property AttrCount: Integer read GetAttribCount; property Attribute[Index: Integer]: TSynHighlighterAttributes read GetAttribute; - property Capabilities: TSynHighlighterCapabilities read GetCapabilitiesProp; - property SampleSource: UnicodeString read GetSampleSource write SetSampleSource; + property Capabilities: TSynHighlighterCapabilities read GetCapabilities; + property CaseSensitive: Boolean read fCaseSensitive; + property SampleSource: string read GetSampleSource write SetSampleSource; property CommentAttribute: TSynHighlighterAttributes index SYN_ATTR_COMMENT read GetDefaultAttribute; property IdentifierAttribute: TSynHighlighterAttributes @@ -235,64 +223,35 @@ TSynCustomHighlighter = class(TComponent) index SYN_ATTR_WHITESPACE read GetDefaultAttribute; property ExportName: string read GetExportName; published + property Brackets: string read fBrackets write fBrackets + stored IsBracketsStored; property DefaultFilter: string read GetDefaultFilter write SetDefaultFilter stored IsFilterStored; - property Enabled: Boolean read FEnabled write SetEnabled default True; - property Options: TSynEditHighlighterOptions read FOptions write FOptions; // <-- Codehunter patch + property Enabled: Boolean read fEnabled write SetEnabled default True; + property Options: TSynEditHighlighterOptions read FOptions write FOptions; //Ethea: backward compatibility end; TSynCustomHighlighterClass = class of TSynCustomHighlighter; -{$IFNDEF SYN_CPPB_1} - TSynHighlighterList = class(TList) - private - FHighlighterList: TList; - function GetItem(Index: TListSize): TSynCustomHighlighterClass; - public - constructor Create; - destructor Destroy; override; - function Count: Integer; + TSynHighlighterList = class(TList) function FindByFriendlyName(FriendlyName: string): Integer; function FindByName(Name: string): Integer; function FindByClass(Comp: TComponent): Integer; - property Items[Index: TListSize]: TSynCustomHighlighterClass - read GetItem; default; end; procedure RegisterPlaceableHighlighter(highlighter: TSynCustomHighlighterClass); function GetPlaceableHighlighters: TSynHighlighterList; -{$ENDIF} implementation uses + System.Character, SynEditMiscProcs, -{$IFDEF UNICODE} - WideStrUtils, -{$ENDIF} - SynEditStrConst; + SynEditStrConst, + SynEditTextBuffer; -{$IFNDEF SYN_CPPB_1} { THighlighterList } - -function TSynHighlighterList.Count: Integer; -begin - Result := FHighlighterList.Count; -end; - -constructor TSynHighlighterList.Create; -begin - inherited Create; - FHighlighterList := TList.Create; -end; - -destructor TSynHighlighterList.Destroy; -begin - FHighlighterList.Free; - inherited; -end; - function TSynHighlighterList.FindByClass(Comp: TComponent): Integer; var i: Integer; @@ -338,11 +297,6 @@ function TSynHighlighterList.FindByName(Name: string): Integer; end; end; -function TSynHighlighterList.GetItem(Index: TListSize): TSynCustomHighlighterClass; -begin - Result := TSynCustomHighlighterClass(FHighlighterList[Index]); -end; - var G_PlaceableHighlighters: TSynHighlighterList; @@ -353,10 +307,9 @@ function TSynHighlighterList.GetItem(Index: TListSize): TSynCustomHighlighterCla procedure RegisterPlaceableHighlighter(highlighter: TSynCustomHighlighterClass); begin - if G_PlaceableHighlighters.FHighlighterList.IndexOf(highlighter) < 0 then - G_PlaceableHighlighters.FHighlighterList.Add(highlighter); + if G_PlaceableHighlighters.IndexOf(highlighter) < 0 then + G_PlaceableHighlighters.Add(highlighter); end; -{$ENDIF} { TSynHighlighterAttributes } @@ -364,7 +317,7 @@ procedure TSynHighlighterAttributes.Assign(Source: TPersistent); begin if Source is TSynHighlighterAttributes then begin - FName := TSynHighlighterAttributes(Source).FName; + fName := TSynHighlighterAttributes(Source).fName; AssignColorAndStyle(TSynHighlighterAttributes(Source)); end else @@ -376,19 +329,19 @@ procedure TSynHighlighterAttributes.AssignColorAndStyle(Source: TSynHighlighterA bChanged: Boolean; begin bChanged := False; - if FBackground <> Source.FBackground then + if fBackground <> Source.fBackground then begin - FBackground := Source.FBackground; + fBackground := Source.fBackground; bChanged := True; end; - if FForeground <> Source.FForeground then + if fForeground <> Source.fForeground then begin - FForeground := Source.FForeground; + fForeground := Source.fForeground; bChanged := True; end; - if FStyle <> Source.FStyle then + if fStyle <> Source.fStyle then begin - FStyle := Source.FStyle; + fStyle := Source.fStyle; bChanged := True; end; if bChanged then @@ -398,44 +351,39 @@ procedure TSynHighlighterAttributes.AssignColorAndStyle(Source: TSynHighlighterA procedure TSynHighlighterAttributes.Changed; begin - if Assigned(FOnChange) then - FOnChange(Self); -end; - -constructor TSynHighlighterAttributes.Create(AName: string); -begin - Create(AName, AName); + if Assigned(fOnChange) then + fOnChange(Self); end; -constructor TSynHighlighterAttributes.Create(AName: string; AFriendlyName: UnicodeString); +constructor TSynHighlighterAttributes.Create(AName: string; AFriendlyName: string); begin inherited Create; Background := clNone; Foreground := clNone; - FName := AName; - FFriendlyName := AFriendlyName; + fName := AName; + fFriendlyName := AFriendlyName; end; function TSynHighlighterAttributes.GetBackgroundColorStored: Boolean; begin - Result := FBackground <> FBackgroundDefault; + Result := fBackground <> fBackgroundDefault; end; function TSynHighlighterAttributes.GetForegroundColorStored: Boolean; begin - Result := FForeground <> FForegroundDefault; + Result := fForeground <> fForegroundDefault; end; function TSynHighlighterAttributes.GetFontStyleStored: Boolean; begin - Result := FStyle <> FStyleDefault; + Result := fStyle <> fStyleDefault; end; procedure TSynHighlighterAttributes.InternalSaveDefaultValues; begin - FForegroundDefault := FForeground; - FBackgroundDefault := FBackground; - FStyleDefault := FStyle; + fForegroundDefault := fForeground; + fBackgroundDefault := fBackground; + fStyleDefault := fStyle; end; function TSynHighlighterAttributes.LoadFromBorlandRegistry(RootKey: HKEY; @@ -483,7 +431,7 @@ function TSynHighlighterAttributes.LoadFromBorlandRegistry(RootKey: HKEY; bgDefault: string; fgIndex16: string; bgIndex16: string; - reg: TBetterRegistry; + reg: TRegistry; function Get(var Name: string): string; var @@ -498,7 +446,7 @@ function TSynHighlighterAttributes.LoadFromBorlandRegistry(RootKey: HKEY; begin { LoadOldStyle } Result := False; try - reg := TBetterRegistry.Create; + reg := TRegistry.Create; reg.RootKey := RootKey; try with reg do @@ -551,7 +499,7 @@ function TSynHighlighterAttributes.LoadFromBorlandRegistry(RootKey: HKEY; fontUnderline: string; fgDefault: string; bgDefault: string; - reg: TBetterRegistry; + reg: TRegistry; function IsTrue(Value: string): Boolean; begin @@ -561,7 +509,7 @@ function TSynHighlighterAttributes.LoadFromBorlandRegistry(RootKey: HKEY; begin Result := False; try - reg := TBetterRegistry.Create; + reg := TRegistry.Create; reg.RootKey := RootKey; try with reg do @@ -628,67 +576,62 @@ function TSynHighlighterAttributes.LoadFromBorlandRegistry(RootKey: HKEY; procedure TSynHighlighterAttributes.SetBackground(Value: TColor); begin - if FBackground <> Value then + if fBackGround <> Value then begin - FBackground := Value; + fBackGround := Value; Changed; end; end; procedure TSynHighlighterAttributes.SetColors(Foreground, Background: TColor); begin - if (FForeground <> Foreground) or (FBackground <> Background) then + if (fForeGround <> Foreground) or (fBackground <> Background) then begin - FForeground := Foreground; - FBackground := Background; + fForeGround := Foreground; + fBackground := Background; Changed; end; end; procedure TSynHighlighterAttributes.SetForeground(Value: TColor); begin - if FForeground <> Value then + if fForeGround <> Value then begin - FForeground := Value; + fForeGround := Value; Changed; end; end; procedure TSynHighlighterAttributes.SetStyle(Value: TFontStyles); begin - if FStyle <> Value then + if fStyle <> Value then begin - FStyle := Value; + fStyle := Value; Changed; end; end; -function TSynHighlighterAttributes.LoadFromRegistry(Reg: TBetterRegistry): Boolean; +function TSynHighlighterAttributes.LoadFromRegistry(Reg: TRegistry): Boolean; var Key: string; begin Key := Reg.CurrentPath; - if Reg.KeyExists(Name) then + if Reg.OpenKeyReadOnly(Name) then begin - if Reg.OpenKeyReadOnly(Name) then - begin - if Reg.ValueExists('Background') then - Background := Reg.ReadInteger('Background'); - if Reg.ValueExists('Foreground') then - Foreground := Reg.ReadInteger('Foreground'); - if Reg.ValueExists('Style') then - IntegerStyle := Reg.ReadInteger('Style'); - reg.OpenKeyReadOnly('\' + Key); - Result := True; - end - else - Result := False; + if Reg.ValueExists('Background') then + Background := Reg.ReadInteger('Background'); + if Reg.ValueExists('Foreground') then + Foreground := Reg.ReadInteger('Foreground'); + if Reg.ValueExists('Style') then + IntegerStyle := Reg.ReadInteger('Style'); + reg.OpenKeyReadOnly('\' + Key); + Result := True; end else Result := False; end; -function TSynHighlighterAttributes.SaveToRegistry(Reg: TBetterRegistry): Boolean; +function TSynHighlighterAttributes.SaveToRegistry(Reg: TRegistry): Boolean; var Key: string; begin @@ -705,7 +648,7 @@ function TSynHighlighterAttributes.SaveToRegistry(Reg: TBetterRegistry): Boolean Result := False; end; -function TSynHighlighterAttributes.LoadFromFile(Ini : TCustomIniFile): boolean; +function TSynHighlighterAttributes.LoadFromFile(Ini: TCustomIniFile): Boolean; var S: TStringList; begin @@ -720,7 +663,7 @@ function TSynHighlighterAttributes.LoadFromFile(Ini : TCustomIniFile): boolean; Foreground := Ini.ReadInteger(Name, 'Foreground', Foreground); if S.IndexOf('Style') <> -1 then IntegerStyle := Ini.ReadInteger(Name, 'Style', IntegerStyle); - Result := true; + Result := True; end else Result := False; @@ -729,7 +672,7 @@ function TSynHighlighterAttributes.LoadFromFile(Ini : TCustomIniFile): boolean; end; end; -function TSynHighlighterAttributes.SaveToFile(Ini : TCustomIniFile): boolean; +function TSynHighlighterAttributes.SaveToFile(Ini: TCustomIniFile): Boolean; begin Ini.WriteInteger(Name, 'Background', Background); Ini.WriteInteger(Name, 'Foreground', Foreground); @@ -758,51 +701,58 @@ procedure TSynHighlighterAttributes.SetStyleFromInt(const Value: Integer); constructor TSynCustomHighlighter.Create(AOwner: TComponent); begin inherited Create(AOwner); - FAttributes := TStringList.Create; - FAttributes.Duplicates := dupError; - FAttributes.Sorted := True; - FAttrChangeHooks := TSynNotifyEventChain.CreateEx(Self); - FDefaultFilter := ''; - FEnabled := True; - FOptions:= TSynEditHighlighterOptions.Create; // <-- Codehunter patch + fAttributes := TStringList.Create; + fAttributes.Duplicates := dupError; + fAttributes.Sorted := True; + fAttrChangeHooks := TSynNotifyEventChain.CreateEx(Self); + fDefaultFilter := ''; + fEnabled := True; + fBrackets := DefaultBrackets; + FOptions:= TSynEditHighlighterOptions.Create; //Ethea: backward compatibility end; destructor TSynCustomHighlighter.Destroy; begin inherited Destroy; FreeHighlighterAttributes; - FAttributes.Free; - FAttrChangeHooks.Free; - FOptions.Free; // <-- Codehunter patch + fAttributes.Free; + fAttrChangeHooks.Free; + FOptions.Free; //Ethea: backward compatibility end; procedure TSynCustomHighlighter.BeginUpdate; begin - Inc(FUpdateCount); + Inc(fUpdateCount); end; procedure TSynCustomHighlighter.EndUpdate; begin - if FUpdateCount > 0 then + if fUpdateCount > 0 then begin - Dec(FUpdateCount); - if (FUpdateCount = 0) and FUpdateChange then + Dec(fUpdateCount); + if (fUpdateCount = 0) and fUpdateChange then begin - FUpdateChange := False; + fUpdateChange := False; DefHighlightChange(nil); end; end; end; +function TSynCustomHighlighter.FlowControlAtLine(Lines: TStrings; Line: + Integer): TSynFlowControl; +begin + Result := fcNone; +end; + procedure TSynCustomHighlighter.FreeHighlighterAttributes; var i: Integer; begin - if FAttributes <> nil then + if fAttributes <> nil then begin - for i := FAttributes.Count - 1 downto 0 do - TSynHighlighterAttributes(FAttributes.Objects[i]).Free; - FAttributes.Clear; + for i := fAttributes.Count - 1 downto 0 do + TSynHighlighterAttributes(fAttributes.Objects[i]).Free; + fAttributes.Clear; end; end; @@ -815,27 +765,33 @@ procedure TSynCustomHighlighter.Assign(Source: TPersistent); begin if (Source <> nil) and (Source is TSynCustomHighlighter) then begin - Src := TSynCustomHighlighter(Source); - for i := 0 to AttrCount - 1 do - begin - // assign first attribute with the same name - AttriName := Attribute[i].Name; - for j := 0 to Src.AttrCount - 1 do + BeginUpdate; + try + Src := TSynCustomHighlighter(Source); + for i := 0 to AttrCount - 1 do begin - SrcAttri := Src.Attribute[j]; - if AttriName = SrcAttri.Name then + // assign first attribute with the same name + AttriName := Attribute[i].Name; + for j := 0 to Src.AttrCount - 1 do begin - Attribute[i].Assign(SrcAttri); - Break; + SrcAttri := Src.Attribute[j]; + if AttriName = SrcAttri.Name then + begin + Attribute[i].Assign(SrcAttri); + Break; + end; end; end; + // assign the sample source text only if same or descendant class + if Src is ClassType then + SampleSource := Src.SampleSource; + //fWordBreakChars := Src.WordBreakChars; //TODO: does this make sense anyway? + DefaultFilter := Src.DefaultFilter; + Enabled := Src.Enabled; + Brackets := Src.Brackets; + finally + EndUpdate; end; - // assign the sample source text only if same or descendant class - if Src is ClassType then - SampleSource := Src.SampleSource; - //fWordBreakChars := Src.WordBreakChars; //TODO: does this make sense anyway? - DefaultFilter := Src.DefaultFilter; - Enabled := Src.Enabled; end else inherited Assign(Source); @@ -854,10 +810,10 @@ function TSynCustomHighlighter.UseUserSettings(settingIndex: Integer): Boolean; function TSynCustomHighlighter.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; var - r: TBetterRegistry; + r: TRegistry; i: Integer; begin - r := TBetterRegistry.Create; + r := TRegistry.Create; try r.RootKey := RootKey; if r.OpenKeyReadOnly(Key) then @@ -876,10 +832,10 @@ function TSynCustomHighlighter.LoadFromRegistry(RootKey: HKEY; function TSynCustomHighlighter.SaveToRegistry(RootKey: HKEY; Key: string): Boolean; var - r: TBetterRegistry; + r: TRegistry; i: Integer; begin - r := TBetterRegistry.Create; + r := TRegistry.Create; try r.RootKey := RootKey; if r.OpenKey(Key,True) then @@ -895,37 +851,25 @@ function TSynCustomHighlighter.SaveToRegistry(RootKey: HKEY; end; end; -function TSynCustomHighlighter.LoadFromFile(AFileName : String): Boolean; +function TSynCustomHighlighter.LoadFromFile(AFileName: string): Boolean; var - AIni: TIniFile; - i: Integer; + AIni: TMemIniFile; begin - AIni := TIniFile.Create(AFileName); + AIni := TMemIniFile.Create(AFileName); try - with AIni do - begin - Result := True; - for i := 0 to AttrCount - 1 do - Result := Attribute[i].LoadFromFile(AIni) and Result; - end; + Result := LoadFromIniFile(AIni); finally AIni.Free; end; end; -function TSynCustomHighlighter.SaveToFile(AFileName : String): Boolean; +function TSynCustomHighlighter.SaveToFile(AFileName: string): Boolean; var - AIni: TIniFile; - i: Integer; + AIni: TMemIniFile; begin - AIni := TIniFile.Create(AFileName); + AIni := TMemIniFile.Create(AFileName); try - with AIni do - begin - Result := True; - for i := 0 to AttrCount - 1 do - Result := Attribute[i].SaveToFile(AIni) and Result; - end; + Result := SaveToIniFile(AIni); finally AIni.Free; end; @@ -933,39 +877,36 @@ function TSynCustomHighlighter.SaveToFile(AFileName : String): Boolean; procedure TSynCustomHighlighter.AddAttribute(Attri: TSynHighlighterAttributes); begin - FAttributes.AddObject(Attri.Name, Attri); + fAttributes.AddObject(Attri.Name, Attri); end; procedure TSynCustomHighlighter.DefHighlightChange(Sender: TObject); begin - if FUpdateCount > 0 then - FUpdateChange := True + if fUpdateCount > 0 then + fUpdateChange := True else if not(csLoading in ComponentState) then begin - FAttrChangeHooks.Sender := Sender; - FAttrChangeHooks.Fire; + fAttrChangeHooks.Sender := Sender; + fAttrChangeHooks.Fire; end; end; procedure TSynCustomHighlighter.DefineProperties(Filer: TFiler); begin inherited; -{$IFNDEF UNICODE} - UnicodeDefineProperties(Filer, Self); -{$ENDIF} end; function TSynCustomHighlighter.GetAttribCount: Integer; begin - Result := FAttributes.Count; + Result := fAttributes.Count; end; function TSynCustomHighlighter.GetAttribute(Index: Integer): TSynHighlighterAttributes; begin Result := nil; - if (Index >= 0) and (Index < FAttributes.Count) then - Result := TSynHighlighterAttributes(FAttributes.Objects[Index]); + if (Index >= 0) and (Index < fAttributes.Count) then + Result := TSynHighlighterAttributes(fAttributes.Objects[Index]); end; class function TSynCustomHighlighter.GetCapabilities: TSynHighlighterCapabilities; @@ -973,22 +914,9 @@ class function TSynCustomHighlighter.GetCapabilities: TSynHighlighterCapabilitie Result := [hcRegistry]; //registry save/load supported by default end; -function TSynCustomHighlighter.GetCapabilitiesProp: TSynHighlighterCapabilities; -begin - Result := GetCapabilities; -end; - function TSynCustomHighlighter.GetDefaultFilter: string; begin - Result := FDefaultFilter; -end; - -function TSynCustomHighlighter.GetExpandedTokenPos: Integer; -begin - if FExpandedLine = nil then - Result := FTokenPos - else - Result := FExpandedTokenPos; + Result := fDefaultFilter; end; function TSynCustomHighlighter.GetExportName: string; @@ -998,46 +926,48 @@ function TSynCustomHighlighter.GetExportName: string; Result := FExportName; end; -function TSynCustomHighlighter.GetExpandedToken: UnicodeString; +function TSynCustomHighlighter.GetHighlighterAttriAtRowCol( + const Lines: TStrings; const Line, Char: Integer): TSynHighlighterAttributes; var - Len: Integer; + Token: string; + TokenType, Start: Integer; begin - if FExpandedLine = nil then - begin - Result := GetToken; - Exit; - end; - - Len := FExpandedRun - FExpandedTokenPos; - SetLength(Result, Len); - if Len > 0 then - WStrLCopy(@Result[1], FExpandedLine + FExpandedTokenPos, Len); + GetHighlighterAttriAtRowColEx(Lines, Line, Char, Token, TokenType, + Start, Result); end; -class function TSynCustomHighlighter.GetFriendlyLanguageName: UnicodeString; -begin -{$IFDEF SYN_DEVELOPMENT_CHECKS} - raise Exception.CreateFmt('%s.GetFriendlyLanguageName not implemented', [ClassName]); -{$ENDIF} - Result := SYNS_FriendlyLangUnknown; -end; - -class function TSynCustomHighlighter.GetLanguageName: string; -begin -{$IFDEF SYN_DEVELOPMENT_CHECKS} - raise Exception.CreateFmt('%s.GetLanguageName not implemented', [ClassName]); -{$ENDIF} - Result := SYNS_LangUnknown; -end; - -function TSynCustomHighlighter.GetFriendlyLanguageNameProp: UnicodeString; -begin - Result := GetFriendlyLanguageName; -end; - -function TSynCustomHighlighter.GetLanguageNameProp: string; +function TSynCustomHighlighter.GetHighlighterAttriAtRowColEx( + const Lines: TStrings; const Line, Char: Integer; var Token: string; + var TokenType, Start: Integer; var Attri: TSynHighlighterAttributes): Boolean; +var + LineText: string; begin - Result := GetLanguageName; + if (Line >= 0) and (Line < Lines.Count) then + begin + LineText := Lines[Line]; + if Line = 0 then + ResetRange + else + SetRange(TSynEditStringList(Lines).Ranges[Line - 1]); + SetLine(LineText, Line); + if (Char > 0) and (Char <= Length(LineText)) then + while not GetEol do + begin + Start := GetTokenPos + 1; + Token := GetToken; + if (Char >= Start) and (Char < Start + Length(Token)) then + begin + Attri := GetTokenAttribute; + TokenType := GetTokenKind; + Result := True; + Exit; + end; + Next; + end; + end; + Token := ''; + Attri := nil; + Result := False; end; function TSynCustomHighlighter.GetRange: Pointer; @@ -1045,46 +975,54 @@ function TSynCustomHighlighter.GetRange: Pointer; Result := nil; end; -function TSynCustomHighlighter.GetToken: UnicodeString; +function TSynCustomHighlighter.GetToken: string; var Len: Integer; begin - Len := Run - FTokenPos; - SetLength(Result, Len); - if Len > 0 then - WStrLCopy(@Result[1], FCasedLine + FTokenPos, Len); + Len := Run - fTokenPos; + SetString(Result, fCasedLine + fTokenPos, Len); +end; + +function TSynCustomHighlighter.GetTokenLength: Integer; +begin + Result := Run - fTokenPos; end; function TSynCustomHighlighter.GetTokenPos: Integer; begin - Result := FTokenPos; + Result := fTokenPos; end; -function TSynCustomHighlighter.GetKeyWords(TokenKind: Integer): UnicodeString; +function TSynCustomHighlighter.GetKeyWords(TokenKind: Integer): string; begin Result := ''; end; -function TSynCustomHighlighter.GetSampleSource: UnicodeString; +function TSynCustomHighlighter.GetSampleSource: string; begin Result := ''; end; procedure TSynCustomHighlighter.HookAttrChangeEvent(ANotifyEvent: TNotifyEvent); begin - FAttrChangeHooks.Add(ANotifyEvent); + fAttrChangeHooks.Add(ANotifyEvent); end; -function TSynCustomHighlighter.IsCurrentToken(const Token: UnicodeString): Boolean; +function TSynCustomHighlighter.IsBracketsStored: Boolean; +begin + Result := FBrackets <> DefaultBrackets; +end; + +function TSynCustomHighlighter.IsCurrentToken(const Token: string): Boolean; var I: Integer; Temp: PWideChar; begin - Temp := FToIdent; - if Length(Token) = FStringLen then + Temp := fToIdent; + if Length(Token) = fStringLen then begin Result := True; - for i := 1 to FStringLen do + for i := 1 to fStringLen do begin if Temp^ <> Token[i] then begin @@ -1105,68 +1043,91 @@ function TSynCustomHighlighter.IsFilterStored: Boolean; function TSynCustomHighlighter.IsIdentChar(AChar: WideChar): Boolean; begin - if IsWordBreakChar(Achar) then - Result := False - else + case AChar of + '_', '0'..'9', 'A'..'Z', 'a'..'z': Result := True; + else + Result := False; + end; + Result := Result or CharInSet(AChar, FAdditionalIdentChars); end; -function TSynCustomHighlighter.IsKeyword(const AKeyword: UnicodeString): Boolean; +function TSynCustomHighlighter.IsKeyword(const AKeyword: string): Boolean; begin Result := False; end; function TSynCustomHighlighter.IsLineEnd(Run: Integer): Boolean; begin - Result := (Run >= FLineLen) or (FLine[Run] = #10) or (FLine[Run] = #13); + Result := (Run >= fLineLen) or (fLine[Run] = #10) or (fLine[Run] = #13); end; function TSynCustomHighlighter.IsWhiteChar(AChar: WideChar): Boolean; begin - case AChar of - #0..#32: + case Ord(AChar) of + 0..32: Result := True; else - Result := not (IsIdentChar(AChar) or IsWordBreakChar(AChar)) + Result := AChar.IsWhiteSpace and not IsIdentChar(AChar); end end; function TSynCustomHighlighter.IsWordBreakChar(AChar: WideChar): Boolean; begin case AChar of - #0..#32, '.', ',', ';', ':', '"', '''', WideChar(#$00B4), WideChar(#$0060), - WideChar(#$00B0), '^', '!', '?', '&', '$', '@', WideChar(#$00A7), '%', '#', - '~', '[', ']', '(', ')', '{', '}', '<', '>', '-', '=', '+', '*', '/', '\', - '|': + '.', ',', ';', ':', '"', '''', '´', '`', '°', '^', '!', '?', '&', + '$', '@', '§', '%', '#', '~', '[', ']', '(', ')', '{', '}', '<', '>', + '-', '=', '+', '*', '/', '\', '|': Result := True; else - Result := False; + begin + case Ord(AChar) of + 0..32: Result := True; + else + Result := False; + end; + end; end; + Result := Result or CharInSet(AChar, FAdditionalWordBreakChars); + Result := Result and not IsIdentChar(AChar); end; -procedure TSynCustomHighlighter.Next; +function TSynCustomHighlighter.SaveToIniFile(AIni: TCustomIniFile): Boolean; var - Delta: Integer; + i: Integer; begin - if FOldRun = Run then Exit; - - FExpandedTokenPos := FExpandedRun; - if FExpandedLine = nil then Exit; + with AIni do + begin + Result := True; + for i := 0 to AttrCount - 1 do + Result := Attribute[i].SaveToFile(AIni) and Result; + end; + AIni.UpdateFile; +end; - Delta := Run - FOldRun; - while Delta > 0 do +function TSynCustomHighlighter.LoadFromIniFile(AIni: TCustomIniFile): Boolean; +var + i: Integer; +begin + with AIni do begin - while FExpandedLine[FExpandedRun] = FillerChar do - Inc(FExpandedRun); - Inc(FExpandedRun); - Dec(Delta); + Result := True; + for i := 0 to AttrCount - 1 do + Result := Attribute[i].LoadFromFile(AIni) and Result; end; - FOldRun := Run; +end; + +procedure TSynCustomHighlighter.Next; +begin + if fOldRun <> Run then + fOldRun := Run; end; procedure TSynCustomHighlighter.NextToEol; begin + FScanningToEOL := True; while not GetEol do Next; + FScanningToEOL := False; end; procedure TSynCustomHighlighter.ResetRange; @@ -1190,9 +1151,9 @@ procedure TSynCustomHighlighter.SetAttributesOnChange(AEvent: TNotifyEvent); i: Integer; Attri: TSynHighlighterAttributes; begin - for i := FAttributes.Count - 1 downto 0 do + for i := fAttributes.Count - 1 downto 0 do begin - Attri := TSynHighlighterAttributes(FAttributes.Objects[i]); + Attri := TSynHighlighterAttributes(fAttributes.Objects[i]); if Attri <> nil then begin Attri.OnChange := AEvent; @@ -1201,55 +1162,41 @@ procedure TSynCustomHighlighter.SetAttributesOnChange(AEvent: TNotifyEvent); end; end; -procedure TSynCustomHighlighter.SetLineExpandedAtWideGlyphs(const Line, - ExpandedLine: UnicodeString; LineNumber: Integer); -begin - FExpandedLineStr := ExpandedLine; - FExpandedLine := PWideChar(FExpandedLineStr); - FExpandedLineLen := Length(FExpandedLineStr); - DoSetLine(Line, LineNumber); - Next; -end; - -procedure TSynCustomHighlighter.SetLine(const Value: UnicodeString; LineNumber: Integer); +procedure TSynCustomHighlighter.SetLine(const Value: string; LineNumber: Integer); begin - FExpandedLineStr := ''; - FExpandedLine := nil; - FExpandedLineLen := 0; + FScanningToEOL := False; DoSetLine(Value, LineNumber); Next; end; -procedure TSynCustomHighlighter.DoSetLine(const Value: UnicodeString; LineNumber: Integer); +procedure TSynCustomHighlighter.DoSetLine(const Value: string; LineNumber: Integer); - procedure DoWideLowerCase(const value : UnicodeString; var dest : UnicodeString); + procedure DoWideLowerCase(const value: string; var dest: string); begin // segregated here so case-insensitive highlighters don't have to pay the overhead // of the exception frame for the release of the temporary string - dest := SynWideLowerCase(value); + dest := System.SysUtils.AnsiLowerCase(value); end; begin - // UnicodeStrings are not reference counted, hence we need to copy - if FCaseSensitive then + if fCaseSensitive then begin - FLineStr := Value; - FCasedLineStr := ''; - FCasedLine := PWideChar(FLineStr); + fLineStr := Value; + fCasedLineStr := ''; + fCasedLine := PWideChar(fLineStr); end else begin - DoWideLowerCase(Value, FLineStr); - FCasedLineStr := Value; - FCasedLine := PWideChar(FCasedLineStr); + DoWideLowerCase(Value, fLineStr); + fCasedLineStr := Value; + fCasedLine := PWideChar(fCasedLineStr); end; - FLine := PWideChar(FLineStr); - FLineLen := Length(FLineStr); + fLine := PWideChar(fLineStr); + fLineLen := Length(fLineStr); Run := 0; - FExpandedRun := 0; - FOldRun := Run; - FLineNumber := LineNumber; + fOldRun := Run; + fLineNumber := LineNumber; end; procedure TSynCustomHighlighter.SetRange(Value: Pointer); @@ -1258,24 +1205,23 @@ procedure TSynCustomHighlighter.SetRange(Value: Pointer); procedure TSynCustomHighlighter.SetDefaultFilter(Value: string); begin - FDefaultFilter := Value; + fDefaultFilter := Value; end; -procedure TSynCustomHighlighter.SetSampleSource(Value: UnicodeString); +procedure TSynCustomHighlighter.SetSampleSource(Value: string); begin - // TODO: sure this should be empty? end; procedure TSynCustomHighlighter.UnhookAttrChangeEvent(ANotifyEvent: TNotifyEvent); begin - FAttrChangeHooks.Remove(ANotifyEvent); + fAttrChangeHooks.Remove(ANotifyEvent); end; procedure TSynCustomHighlighter.SetEnabled(const Value: Boolean); begin - if FEnabled <> Value then + if fEnabled <> Value then begin - FEnabled := Value; + fEnabled := Value; DefHighlightChange(nil); end; end; @@ -1286,33 +1232,9 @@ procedure TSynCustomHighlighter.Loaded; DefHighlightChange(nil); end; -// Pos and Result are 1-based (i.e. positions in a UnicodeString not a PWideChar) -function TSynCustomHighlighter.PosToExpandedPos(Pos: Integer): Integer; -var - i: Integer; -begin - if FExpandedLine = nil then - begin - Result := Pos; - Exit; - end; - - Result := 0; - i := 0; - while i < Pos do - begin - while FExpandedLine[Result] = FillerChar do - Inc(Result); - Inc(Result); - Inc(i); - end; -end; - -{$IFNDEF SYN_CPPB_1} initialization G_PlaceableHighlighters := TSynHighlighterList.Create; finalization G_PlaceableHighlighters.Free; G_PlaceableHighlighters := nil; -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynEditJedi.inc b/Ext/SynEdit/Source/SynEditJedi.inc index d361ffc..94b1c27 100644 --- a/Ext/SynEdit/Source/SynEditJedi.inc +++ b/Ext/SynEdit/Source/SynEditJedi.inc @@ -30,7 +30,7 @@ { This file defines various generic compiler directives used in different libraries, e.g. in the } { JEDI Code Library (JCL) and JEDI Visual Component Library Library (JVCL). The directives in } { this file are of generic nature and consist mostly of mappings from the VERXXX directives } -{ defined by Delphi, C++ Builder and FPC to friendly names such as DELPHI5 and } +{ defined by Delphi, C++Builder and FPC to friendly names such as DELPHI5 and } { SUPPORTS_WIDESTRING. These friendly names are subsequently used in the libraries to test for } { compiler versions and/or whether the compiler supports certain features (such as widestrings or } { 64 bit integers. The libraries provide an additional, library specific, include file. For the } @@ -39,9 +39,9 @@ { } {**************************************************************************************************} { } -{ Last modified: $Date: 2009/01/06 16:26:01 $ } -{ Revision: $Rev:: 2446 $ } -{ Author: $Author: maelh $ } +{ Last modified: $Date:: $ } +{ Revision: $Rev:: $ } +{ Author: $Author:: $ } { } {**************************************************************************************************} @@ -51,18 +51,18 @@ This file defines two directives to indicate which development environment the library is being compiled with. Currently this can either be Delphi, Kylix, - C++ Builder or FPC. + C++Builder or FPC. Directive Description ------------------------------------------------------------------------------ DELPHI Defined if compiled with Delphi KYLIX Defined if compiled with Kylix DELPHICOMPILER Defined if compiled with Delphi or Kylix/Delphi - BCB Defined if compiled with C++ Builder - CPPBUILDER Defined if compiled with C++ Builder (alias for BCB) - BCBCOMPILER Defined if compiled with C++ Builder or Kylix/C++ - DELPHILANGUAGE Defined if compiled with Delphi, Kylix or C++ Builder - BORLAND Defined if compiled with Delphi, Kylix or C++ Builder + BCB Defined if compiled with C++Builder + CPPBUILDER Defined if compiled with C++Builder (alias for BCB) + BCBCOMPILER Defined if compiled with C++Builder or Kylix/C++ + DELPHILANGUAGE Defined if compiled with Delphi, Kylix or C++Builder + BORLAND Defined if compiled with Delphi, Kylix or C++Builder FPC Defined if compiled with FPC - Platform Directives @@ -87,6 +87,7 @@ CPUx86_64 Defined when target platform is native x86_64 (win64) CPU32 Defined when target is 32-bit CPU64 Defined when target is 64-bit + CPUASM Defined when target assembler is available - Visual library Directives @@ -121,38 +122,99 @@ Directive Description ------------------------------------------------------------------------------ - DELPHI1 Defined when compiling with Delphi 1 - DELPHI2 Defined when compiling with Delphi 2 - DELPHI3 Defined when compiling with Delphi 3 - DELPHI4 Defined when compiling with Delphi 4 - DELPHI5 Defined when compiling with Delphi 5 - DELPHI6 Defined when compiling with Delphi 6 - DELPHI7 Defined when compiling with Delphi 7 - DELPHI8 Defined when compiling with Delphi 8 - DELPHI2005 Defined when compiling with Delphi 2005 - DELPHI9 Alias for DELPHI2005 - DELPHI10 Defined when compiling with Delphi Personality of BDS 4.0 - DELPHI2006 Alias for DELPHI10 - DELPHI11 Defined when compiling with Delphi 2007 for Win32 - DELPHI2007 Alias for DELPHI11 - DELPHI12 Defined when compiling with Delphi for Win32 2009 - DELPHI2009 Alias for DELPHI12 - DELPHI1_UP Defined when compiling with Delphi 1 or higher - DELPHI2_UP Defined when compiling with Delphi 2 or higher - DELPHI3_UP Defined when compiling with Delphi 3 or higher - DELPHI4_UP Defined when compiling with Delphi 4 or higher - DELPHI5_UP Defined when compiling with Delphi 5 or higher - DELPHI6_UP Defined when compiling with Delphi 6 or higher - DELPHI7_UP Defined when compiling with Delphi 7 or higher - DELPHI8_UP Defined when compiling with Delphi 8 or higher - DELPHI2005_UP Defined when compiling with Delphi 2005 or higher - DELPHI9_UP Alias for DELPHI2005_UP - DELPHI10_UP Defined when compiling with Delphi Personality of BDS 4.0 or higher - DELPHI2006_UP Alias for DELPHI10_UP - DELPHI11_UP Defined when compiling with Delphi 2007 for Win32 or higher - DELPHI2007_UP Alias for DELPHI11_UP - DELPHI12_UP Defined when compiling with Delphi for Win32 2009 or higher - DELPHI2009_UP Alias for DELPHI12_UP + DELPHI1 Defined when compiling with Delphi 1 (Codename WASABI/MANGO) + DELPHI2 Defined when compiling with Delphi 2 (Codename POLARIS) + DELPHI3 Defined when compiling with Delphi 3 (Codename IVORY) + DELPHI4 Defined when compiling with Delphi 4 (Codename ALLEGRO) + DELPHI5 Defined when compiling with Delphi 5 (Codename ARGUS) + DELPHI6 Defined when compiling with Delphi 6 (Codename ILLIAD) + DELPHI7 Defined when compiling with Delphi 7 (Codename AURORA) + DELPHI8 Defined when compiling with Delphi 8 (Codename OCTANE) + DELPHI2005 Defined when compiling with Delphi 2005 (Codename DIAMONDBACK) + DELPHI9 Alias for DELPHI2005 + DELPHI10 Defined when compiling with Delphi 2006 (Codename DEXTER) + DELPHI2006 Alias for DELPHI10 + DELPHI11 Defined when compiling with Delphi 2007 for Win32 (Codename SPACELY) + DELPHI2007 Alias for DELPHI11 + DELPHI12 Defined when compiling with Delphi 2009 for Win32 (Codename TIBURON) + DELPHI2009 Alias for DELPHI12 + DELPHI14 Defined when compiling with Delphi 2010 for Win32 (Codename WEAVER) + DELPHI2010 Alias for DELPHI14 + DELPHI15 Defined when compiling with Delphi XE for Win32 (Codename FULCRUM) + DELPHIXE Alias for DELPHI15 + DELPHI16 Defined when compiling with Delphi XE2 for Win32 (Codename PULSAR) + DELPHIXE2 Alias for DELPHI16 + DELPHI17 Defined when compiling with Delphi XE3 for Win32 (Codename WATERDRAGON) + DELPHIXE3 Alias for DELPHI17 + DELPHI18 Defined when compiling with Delphi XE4 for Win32 (Codename QUINTESSENCE) + DELPHIXE4 Alias for DELPHI18 + DELPHI19 Defined when compiling with Delphi XE5 for Win32 (Codename ZEPHYR) + DELPHIXE5 Alias for DELPHI19 + DELPHI20 Defined when compiling with Delphi XE6 for Win32 (Codename PROTEUS) + DELPHIXE6 Alias for DELPHI20 + DELPHI21 Defined when compiling with Delphi XE7 for Win32 (Codename CARPATHIA) + DELPHIXE7 Alias for DELPHI21 + DELPHI22 Defined when compiling with Delphi XE8 for Win32 (Codename ELBRUS) + DELPHIXE8 Alias for DELPHI22 + DELPHI23 Defined when compiling with Delphi 10 for Win32 (Codename AITANA) + DELPHIX_SEATTLE Alias for DELPHI23 + DELPHI24 Defined when compiling with Delphi 10.1 for Win32 (Codename BIGBEN) + DELPHIX_BERLIN Alias for DELPHI24 + DELPHI25 Defined when compiling with Delphi 10.2 for Win32 (Codename GODZILLA) + DELPHIX_TOKYO Alias for DELPHI25 + DELPHI26 Defined when compiling with Delphi 10.3 for Win32 (Codename CARNIVAL) + DELPHIX_RIO Alias for DELPHI26 + DELPHI27 Defined when compiling with Delphi 10.4 for Win32 (Codename DENALI) + DELPHIX_SYDNEY Alias for DELPHI27 + DELPHI28 Defined when compiling with Delphi 11 for Win32 (Codename OLYMPUS) + DELPHIX_ALEXANDRIA Alias for DELPHI28 + DELPHI1_UP Defined when compiling with Delphi 1 or higher + DELPHI2_UP Defined when compiling with Delphi 2 or higher + DELPHI3_UP Defined when compiling with Delphi 3 or higher + DELPHI4_UP Defined when compiling with Delphi 4 or higher + DELPHI5_UP Defined when compiling with Delphi 5 or higher + DELPHI6_UP Defined when compiling with Delphi 6 or higher + DELPHI7_UP Defined when compiling with Delphi 7 or higher + DELPHI8_UP Defined when compiling with Delphi 8 or higher + DELPHI2005_UP Defined when compiling with Delphi 2005 or higher + DELPHI9_UP Alias for DELPHI2005_UP + DELPHI10_UP Defined when compiling with Delphi 2006 or higher + DELPHI2006_UP Alias for DELPHI10_UP + DELPHI11_UP Defined when compiling with Delphi 2007 for Win32 or higher + DELPHI2007_UP Alias for DELPHI11_UP + DELPHI12_UP Defined when compiling with Delphi 2009 for Win32 or higher + DELPHI2009_UP Alias for DELPHI12_UP + DELPHI14_UP Defined when compiling with Delphi 2010 for Win32 or higher + DELPHI2010_UP Alias for DELPHI14_UP + DELPHI15_UP Defined when compiling with Delphi XE for Win32 or higher + DELPHIXE_UP Alias for DELPHI15_UP + DELPHI16_UP Defined when compiling with Delphi XE2 for Win32 or higher + DELPHIXE2_UP Alias for DELPHI16_UP + DELPHI17_UP Defined when compiling with Delphi XE3 for Win32 or higher + DELPHIXE3_UP Alias for DELPHI17_UP + DELPHI18_UP Defined when compiling with Delphi XE4 for Win32 or higher + DELPHIXE4_UP Alias for DELPHI18_UP + DELPHI19_UP Defined when compiling with Delphi XE5 for Win32 or higher + DELPHIXE5_UP Alias for DELPHI19_UP + DELPHI20_UP Defined when compiling with Delphi XE6 for Win32 or higher + DELPHIXE6_UP Alias for DELPHI20_UP + DELPHI21_UP Defined when compiling with Delphi XE7 for Win32 or higher + DELPHIXE7_UP Alias for DELPHI21_UP + DELPHI22_UP Defined when compiling with Delphi XE8 for Win32 or higher + DELPHIXE8_UP Alias for DELPHI22_UP + DELPHI23_UP Defined when compiling with Delphi 10 for Win32 or higher + DELPHIX_SEATTLE_UP Alias for DELPHI23_UP + DELPHI24_UP Defined when compiling with Delphi 10.1 for Win32 or higher + DELPHIX_BERLIN_UP Alias for DELPHI24_UP + DELPHI25_UP Defined when compiling with Delphi 10.2 for Win32 or higher + DELPHIX_TOKYO_UP Alias for DELPHI25_UP + DELPHI26_UP Defined when compiling with Delphi 10.3 for Win32 or higher + DELPHIX_RIO_UP Alias for DELPHI26_UP + DELPHI27_UP Defined when compiling with Delphi 10.4 for Win32 or higher + DELPHIX_SYDNEY_UP Alias for DELPHI27_UP + DELPHI28_UP Defined when compiling with Delphi 11 for Win32 or higher + DELPHIX_ALEXANDRIA_UP Alias for DELPHI28_UP + DELPHI29_UP Defined when compiling with Delphi 12 for Win32 or higher - Kylix Versions @@ -165,7 +227,7 @@ ------------------------------------------------------------------------------ KYLIX1 Defined when compiling with Kylix 1 KYLIX2 Defined when compiling with Kylix 2 - KYLIX3 Defined when compiling with Kylix 3 + KYLIX3 Defined when compiling with Kylix 3 (Codename CORTEZ) KYLIX1_UP Defined when compiling with Kylix 1 or higher KYLIX2_UP Defined when compiling with Kylix 2 or higher KYLIX3_UP Defined when compiling with Kylix 3 or higher @@ -187,6 +249,22 @@ DELPHICOMPILER10 Defined when compiling with Delphi Personality of BDS 4.0 DELPHICOMPILER11 Defined when compiling with Delphi 2007 for Win32 DELPHICOMPILER12 Defined when compiling with Delphi Personality of BDS 6.0 + DELPHICOMPILER14 Defined when compiling with Delphi Personality of BDS 7.0 + DELPHICOMPILER15 Defined when compiling with Delphi Personality of BDS 8.0 + DELPHICOMPILER16 Defined when compiling with Delphi Personality of BDS 9.0 + DELPHICOMPILER17 Defined when compiling with Delphi Personality of BDS 10.0 + DELPHICOMPILER18 Defined when compiling with Delphi Personality of BDS 11.0 + DELPHICOMPILER19 Defined when compiling with Delphi Personality of BDS 12.0 + DELPHICOMPILER20 Defined when compiling with Delphi Personality of BDS 14.0 + DELPHICOMPILER21 Defined when compiling with Delphi Personality of BDS 15.0 + DELPHICOMPILER22 Defined when compiling with Delphi Personality of BDS 16.0 + DELPHICOMPILER23 Defined when compiling with Delphi Personality of BDS 17.0 + DELPHICOMPILER24 Defined when compiling with Delphi Personality of BDS 18.0 + DELPHICOMPILER25 Defined when compiling with Delphi Personality of BDS 19.0 + DELPHICOMPILER26 Defined when compiling with Delphi Personality of BDS 20.0 + DELPHICOMPILER27 Defined when compiling with Delphi Personality of BDS 21.0 + DELPHICOMPILER28 Defined when compiling with Delphi Personality of BDS 22.0 + DELPHICOMPILER29 Defined when compiling with Delphi Personality of BDS 23.0 DELPHICOMPILER1_UP Defined when compiling with Delphi 1 or higher DELPHICOMPILER2_UP Defined when compiling with Delphi 2 or higher DELPHICOMPILER3_UP Defined when compiling with Delphi 3 or higher @@ -196,38 +274,86 @@ DELPHICOMPILER7_UP Defined when compiling with Delphi 7 or higher DELPHICOMPILER8_UP Defined when compiling with Delphi 8 or higher DELPHICOMPILER9_UP Defined when compiling with Delphi 2005 - DELPHICOMPILER10_UP Defined when compiling with Delphi Personality of BDS 4.0 or higher + DELPHICOMPILER10_UP Defined when compiling with Delphi 2006 or higher DELPHICOMPILER11_UP Defined when compiling with Delphi 2007 for Win32 or higher - DELPHICOMPILER12_UP Defined when compiling with Delphi Personality of BDS 6.0 or higher - - -- C++ Builder Versions + DELPHICOMPILER12_UP Defined when compiling with Delphi 2009 for Win32 or higher + DELPHICOMPILER14_UP Defined when compiling with Delphi 2010 for Win32 or higher + DELPHICOMPILER15_UP Defined when compiling with Delphi XE for Win32 or higher + DELPHICOMPILER16_UP Defined when compiling with Delphi XE2 for Win32 or higher + DELPHICOMPILER17_UP Defined when compiling with Delphi XE3 for Win32 or higher + DELPHICOMPILER18_UP Defined when compiling with Delphi XE4 for Win32 or higher + DELPHICOMPILER19_UP Defined when compiling with Delphi XE5 for Win32 or higher + DELPHICOMPILER20_UP Defined when compiling with Delphi XE6 for Win32 or higher + DELPHICOMPILER21_UP Defined when compiling with Delphi XE7 for Win32 or higher + DELPHICOMPILER22_UP Defined when compiling with Delphi XE8 for Win32 or higher + DELPHICOMPILER23_UP Defined when compiling with Delphi 10 for Win32 or higher + DELPHICOMPILER24_UP Defined when compiling with Delphi 10.1 for Win32 or higher + DELPHICOMPILER25_UP Defined when compiling with Delphi 10.2 for Win32 or higher + DELPHICOMPILER26_UP Defined when compiling with Delphi 10.3 for Win32 or higher + DELPHICOMPILER27_UP Defined when compiling with Delphi 10.4 for Win32 or higher + DELPHICOMPILER28_UP Defined when compiling with Delphi 11 for Win32 or higher + DELPHICOMPILER29_UP Defined when compiling with Delphi 12 for Win32 or higher + + +- C++Builder Versions The following directives are direct mappings from the VERXXX directives to a friendly name of the associated compiler. These directives are only defined if - the compiler is C++ Builder (ie BCB is defined). + the compiler is C++Builder (ie BCB is defined). Directive Description ------------------------------------------------------------------------------ - BCB1 Defined when compiling with C++ Builder 1 - BCB3 Defined when compiling with C++ Builder 3 - BCB4 Defined when compiling with C++ Builder 4 - BCB5 Defined when compiling with C++ Builder 5 - BCB6 Defined when compiling with C++ Builder 6 - BCB10 Defined when compiling with C++ Builder Personality of BDS 4.0 (also known as C++Builder 2006) - BCB11 Defined when compiling with C++ Builder Personality of RAD Studio 2007 (also known as C++Builder 2007) - BCB12 Defined when compiling with C++ Builder Personality of RAD Studio 2009 (also known as C++Builder 2009) - BCB1_UP Defined when compiling with C++ Builder 1 or higher - BCB3_UP Defined when compiling with C++ Builder 3 or higher - BCB4_UP Defined when compiling with C++ Builder 4 or higher - BCB5_UP Defined when compiling with C++ Builder 5 or higher - BCB6_UP Defined when compiling with C++ Builder 6 or higher - BCB10_UP Defined when compiling with C++ Builder Personality of BDS 4.0 or higher - BCB11_UP Defined when compiling with C++ Builder Personality of RAD Studio 2007 or higher - BCB12_UP Defined when compiling with C++ Builder Personality of RAD Studio 2009 or higher - - -- CodeGear RAD Studio / Borland Developer Studio Versions + BCB1 Defined when compiling with C++Builder 1 + BCB3 Defined when compiling with C++Builder 3 + BCB4 Defined when compiling with C++Builder 4 + BCB5 Defined when compiling with C++Builder 5 (Codename RAMPAGE) + BCB6 Defined when compiling with C++Builder 6 (Codename RIPTIDE) + BCB10 Defined when compiling with C++Builder Personality of BDS 4.0 (also known as C++Builder 2006) (Codename DEXTER) + BCB11 Defined when compiling with C++Builder Personality of RAD Studio 2007 (also known as C++Builder 2007) (Codename COGSWELL) + BCB12 Defined when compiling with C++Builder Personality of RAD Studio 2009 (also known as C++Builder 2009) (Codename TIBURON) + BCB14 Defined when compiling with C++Builder Personality of RAD Studio 2010 (also known as C++Builder 2010) (Codename WEAVER) + BCB15 Defined when compiling with C++Builder Personality of RAD Studio XE (also known as C++Builder XE) (Codename FULCRUM) + BCB16 Defined when compiling with C++Builder Personality of RAD Studio XE2 (also known as C++Builder XE2) (Codename PULSAR) + BCB17 Defined when compiling with C++Builder Personality of RAD Studio XE3 (also known as C++Builder XE3) (Codename WATERDRAGON) + BCB18 Defined when compiling with C++Builder Personality of RAD Studio XE4 (also known as C++Builder XE4) (Codename QUINTESSENCE) + BCB19 Defined when compiling with C++Builder Personality of RAD Studio XE5 (also known as C++Builder XE5) (Codename ZEPHYR) + BCB20 Defined when compiling with C++Builder Personality of RAD Studio XE6 (also known as C++Builder XE6) (Codename PROTEUS) + BCB21 Defined when compiling with C++Builder Personality of RAD Studio XE7 (also known as C++Builder XE7) (Codename CARPATHIA) + BCB22 Defined when compiling with C++Builder Personality of RAD Studio XE8 (also known as C++Builder XE8) (Codename ELBRUS) + BCB23 Defined when compiling with C++Builder Personality of RAD Studio 10 Seattle (also known as C++Builder 10 Seattle) (Codename AITANA) + BCB24 Defined when compiling with C++Builder Personality of RAD Studio 10.1 Berlin (also known as C++Builder 10.1 Berlin) (Codename BIGBEN) + BCB25 Defined when compiling with C++Builder Personality of RAD Studio 10.2 Tokyo (also known as C++Builder 10.2 Tokyo) (Codename GODZILLA) + BCB26 Defined when compiling with C++Builder Personality of RAD Studio 10.3 Rio (also known as C++Builder 10.3) (Codename CARNIVAL) + BCB27 Defined when compiling with C++Builder Personality of RAD Studio 10.4 Rio (also known as C++Builder 10.4) (Codename DENALI) + BCB28 Defined when compiling with C++Builder Personality of RAD Studio 11 (also known as C++Builder 11) (Codename OLYMPUS) + BCB29 Defined when compiling with C++Builder Personality of RAD Studio 12 (also known as C++Builder 12) (Codename ATHENS) + BCB1_UP Defined when compiling with C++Builder 1 or higher + BCB3_UP Defined when compiling with C++Builder 3 or higher + BCB4_UP Defined when compiling with C++Builder 4 or higher + BCB5_UP Defined when compiling with C++Builder 5 or higher + BCB6_UP Defined when compiling with C++Builder 6 or higher + BCB10_UP Defined when compiling with C++Builder Personality of BDS 4.0 or higher + BCB11_UP Defined when compiling with C++Builder Personality of RAD Studio 2007 or higher + BCB12_UP Defined when compiling with C++Builder Personality of RAD Studio 2009 or higher + BCB14_UP Defined when compiling with C++Builder Personality of RAD Studio 2010 or higher + BCB15_UP Defined when compiling with C++Builder Personality of RAD Studio XE or higher + BCB16_UP Defined when compiling with C++Builder Personality of RAD Studio XE2 or higher + BCB17_UP Defined when compiling with C++Builder Personality of RAD Studio XE3 or higher + BCB18_UP Defined when compiling with C++Builder Personality of RAD Studio XE4 or higher + BCB19_UP Defined when compiling with C++Builder Personality of RAD Studio XE5 or higher + BCB20_UP Defined when compiling with C++Builder Personality of RAD Studio XE6 or higher + BCB21_UP Defined when compiling with C++Builder Personality of RAD Studio XE7 or higher + BCB22_UP Defined when compiling with C++Builder Personality of RAD Studio XE8 or higher + BCB23_UP Defined when compiling with C++Builder Personality of RAD Studio 10 or higher + BCB24_UP Defined when compiling with C++Builder Personality of RAD Studio 10.1 or higher + BCB25_UP Defined when compiling with C++Builder Personality of RAD Studio 10.2 or higher + BCB26_UP Defined when compiling with C++Builder Personality of RAD Studio 10.3 or higher + BCB27_UP Defined when compiling with C++Builder Personality of RAD Studio 10.4 or higher + BCB28_UP Defined when compiling with C++Builder Personality of RAD Studio 11 or higher + BCB29_UP Defined when compiling with C++Builder Personality of RAD Studio 12 or higher + + +- RAD Studio / Borland Developer Studio Versions The following directives are direct mappings from the VERXXX directives to a friendly name of the associated IDE. These directives are only defined if @@ -238,17 +364,49 @@ Directive Description ------------------------------------------------------------------------------ - BDS Defined when compiling with a Borland Developer Studio version's dcc32.exe - BDS2 Defined when compiling with BDS 2.0 (Delphi 8) - BDS3 Defined when compiling with BDS 3.0 (Delphi 2005) - BDS4 Defined when compiling with BDS 4.0 (Borland Developer Studio 2006) - BDS5 Defined when compiling with BDS 5.0 (CodeGear RAD Studio 2007) - BDS6 Defined when compiling with BDS 6.0 (CodeGear RAD Studio 2009) + BDS Defined when compiling with BDS version of dcc32.exe (Codename SIDEWINDER) + BDS2 Defined when compiling with BDS 2.0 (Delphi 8) (Codename OCTANE) + BDS3 Defined when compiling with BDS 3.0 (Delphi 2005) (Codename DIAMONDBACK) + BDS4 Defined when compiling with BDS 4.0 (Borland Developer Studio 2006) (Codename DEXTER) + BDS5 Defined when compiling with BDS 5.0 (CodeGear RAD Studio 2007) (Codename HIGHLANDER) + BDS6 Defined when compiling with BDS 6.0 (CodeGear RAD Studio 2009) (Codename TIBURON) + BDS7 Defined when compiling with BDS 7.0 (Embarcadero RAD Studio 2010) (Codename WEAVER) + BDS8 Defined when compiling with BDS 8.0 (Embarcadero RAD Studio XE) (Codename FULCRUM) + BDS9 Defined when compiling with BDS 9.0 (Embarcadero RAD Studio XE2) (Codename PULSAR) + BDS10 Defined when compiling with BDS 10.0 (Embarcadero RAD Studio XE3) (Codename WATERDRAGON) + BDS11 Defined when compiling with BDS 11.0 (Embarcadero RAD Studio XE4) (Codename QUINTESSENCE) + BDS12 Defined when compiling with BDS 12.0 (Embarcadero RAD Studio XE5) (Codename ZEPHYR) + BDS14 Defined when compiling with BDS 14.0 (Embarcadero RAD Studio XE6) (Codename PROTEUS) + BDS15 Defined when compiling with BDS 15.0 (Embarcadero RAD Studio XE7) (Codename CARPATHIA) + BDS16 Defined when compiling with BDS 16.0 (Embarcadero RAD Studio XE8) (Codename ELBRUS) + BDS17 Defined when compiling with BDS 17.0 (Embarcadero RAD Studio 10) (Codename AITANA) + BDS18 Defined when compiling with BDS 18.0 (Embarcadero RAD Studio 10.1) (Codename BIGBEN) + BDS19 Defined when compiling with BDS 19.0 (Embarcadero RAD Studio 10.2) (Codename GODZILLA) + BDS20 Defined when compiling with BDS 20.0 (Embarcadero RAD Studio 10.3) (Codename CARNIVAL) + BDS21 Defined when compiling with BDS 21.0 (Embarcadero RAD Studio 10.4) (Codename DENALI) + BDS22 Defined when compiling with BDS 22.0 (Embarcadero RAD Studio 11) (Codename OLYMPUS) + BDS23 Defined when compiling with BDS 22.0 (Embarcadero RAD Studio 12) (Codename YUKON) BDS2_UP Defined when compiling with BDS 2.0 or higher BDS3_UP Defined when compiling with BDS 3.0 or higher BDS4_UP Defined when compiling with BDS 4.0 or higher BDS5_UP Defined when compiling with BDS 5.0 or higher BDS6_UP Defined when compiling with BDS 6.0 or higher + BDS7_UP Defined when compiling with BDS 7.0 or higher + BDS8_UP Defined when compiling with BDS 8.0 or higher + BDS9_UP Defined when compiling with BDS 9.0 or higher + BDS10_UP Defined when compiling with BDS 10.0 or higher + BDS11_UP Defined when compiling with BDS 11.0 or higher + BDS12_UP Defined when compiling with BDS 12.0 or higher + BDS14_UP Defined when compiling with BDS 14.0 or higher + BDS15_UP Defined when compiling with BDS 15.0 or higher + BDS16_UP Defined when compiling with BDS 16.0 or higher + BDS17_UP Defined when compiling with BDS 17.0 or higher + BDS18_UP Defined when compiling with BDS 18.0 or higher + BDS19_UP Defined when compiling with BDS 19.0 or higher + BDS20_UP Defined when compiling with BDS 20.0 or higher + BDS21_UP Defined when compiling with BDS 21.0 or higher + BDS22_UP Defined when compiling with BDS 22.0 or higher + BDS23_UP Defined when compiling with BDS 23.0 or higher - Compiler Versions @@ -256,36 +414,68 @@ friendly name of the associated compiler. Unlike the DELPHI_X and BCB_X directives, these directives are indepedent of the development environment. That is, they are defined regardless of whether compilation takes place using - Delphi or C++ Builder. + Delphi or C++Builder. Directive Description ------------------------------------------------------------------------------ COMPILER1 Defined when compiling with Delphi 1 - COMPILER2 Defined when compiling with Delphi 2 or C++ Builder 1 + COMPILER2 Defined when compiling with Delphi 2 or C++Builder 1 COMPILER3 Defined when compiling with Delphi 3 - COMPILER35 Defined when compiling with C++ Builder 3 - COMPILER4 Defined when compiling with Delphi 4 or C++ Builder 4 - COMPILER5 Defined when compiling with Delphi 5 or C++ Builder 5 - COMPILER6 Defined when compiling with Delphi 6 or C++ Builder 6 + COMPILER35 Defined when compiling with C++Builder 3 + COMPILER4 Defined when compiling with Delphi 4 or C++Builder 4 + COMPILER5 Defined when compiling with Delphi 5 or C++Builder 5 + COMPILER6 Defined when compiling with Delphi 6 or C++Builder 6 COMPILER7 Defined when compiling with Delphi 7 COMPILER8 Defined when compiling with Delphi 8 COMPILER9 Defined when compiling with Delphi 9 - COMPILER10 Defined when compiling with Delphi or C++ Builder Personalities of BDS 4.0 - COMPILER11 Defined when compiling with Delphi 2007 for Win32 - COMPILER12 Defined when compiling with Delphi or C++ Builder Personalities of BDS 6.0 + COMPILER10 Defined when compiling with Delphi or C++Builder Personalities of BDS 4.0 + COMPILER11 Defined when compiling with Delphi or C++Builder Personalities of BDS 5.0 + COMPILER12 Defined when compiling with Delphi or C++Builder Personalities of BDS 6.0 + COMPILER14 Defined when compiling with Delphi or C++Builder Personalities of BDS 7.0 + COMPILER15 Defined when compiling with Delphi or C++Builder Personalities of BDS 8.0 + COMPILER16 Defined when compiling with Delphi or C++Builder Personalities of BDS 9.0 + COMPILER17 Defined when compiling with Delphi or C++Builder Personalities of BDS 10.0 + COMPILER18 Defined when compiling with Delphi or C++Builder Personalities of BDS 11.0 + COMPILER19 Defined when compiling with Delphi or C++Builder Personalities of BDS 12.0 + COMPILER20 Defined when compiling with Delphi or C++Builder Personalities of BDS 14.0 + COMPILER21 Defined when compiling with Delphi or C++Builder Personalities of BDS 15.0 + COMPILER22 Defined when compiling with Delphi or C++Builder Personalities of BDS 16.0 + COMPILER23 Defined when compiling with Delphi or C++Builder Personalities of BDS 17.0 + COMPILER24 Defined when compiling with Delphi or C++Builder Personalities of BDS 18.0 + COMPILER25 Defined when compiling with Delphi or C++Builder Personalities of BDS 19.0 + COMPILER26 Defined when compiling with Delphi or C++Builder Personalities of BDS 20.0 + COMPILER27 Defined when compiling with Delphi or C++Builder Personalities of BDS 21.0 + COMPILER28 Defined when compiling with Delphi or C++Builder Personalities of BDS 22.0 + COMPILER29 Defined when compiling with Delphi or C++Builder Personalities of BDS 23.0 COMPILER1_UP Defined when compiling with Delphi 1 or higher - COMPILER2_UP Defined when compiling with Delphi 2 or C++ Builder 1 or higher + COMPILER2_UP Defined when compiling with Delphi 2 or C++Builder 1 or higher COMPILER3_UP Defined when compiling with Delphi 3 or higher - COMPILER35_UP Defined when compiling with C++ Builder 3 or higher - COMPILER4_UP Defined when compiling with Delphi 4 or C++ Builder 4 or higher - COMPILER5_UP Defined when compiling with Delphi 5 or C++ Builder 5 or higher - COMPILER6_UP Defined when compiling with Delphi 6 or C++ Builder 6 or higher + COMPILER35_UP Defined when compiling with C++Builder 3 or higher + COMPILER4_UP Defined when compiling with Delphi 4 or C++Builder 4 or higher + COMPILER5_UP Defined when compiling with Delphi 5 or C++Builder 5 or higher + COMPILER6_UP Defined when compiling with Delphi 6 or C++Builder 6 or higher COMPILER7_UP Defined when compiling with Delphi 7 COMPILER8_UP Defined when compiling with Delphi 8 COMPILER9_UP Defined when compiling with Delphi Personalities of BDS 3.0 - COMPILER10_UP Defined when compiling with Delphi or C++ Builder Personalities of BDS 4.0 or higher - COMPILER11_UP Defined when compiling with Delphi 2007 for Win32 or higher - COMPILER12_UP Defined when compiling with Delphi or C++ Builder Personalities of BDS 6.0 or higher + COMPILER10_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 4.0 or higher + COMPILER11_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 5.0 or higher + COMPILER12_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 6.0 or higher + COMPILER14_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 7.0 or higher + COMPILER15_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 8.0 or higher + COMPILER16_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 9.0 or higher + COMPILER17_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 10.0 or higher + COMPILER18_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 11.0 or higher + COMPILER19_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 12.0 or higher + COMPILER20_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 14.0 or higher + COMPILER21_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 15.0 or higher + COMPILER22_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 16.0 or higher + COMPILER23_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 17.0 or higher + COMPILER24_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 18.0 or higher + COMPILER25_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 19.0 or higher + COMPILER26_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 20.0 or higher + COMPILER27_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 21.0 or higher + COMPILER28_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 22.0 or higher + COMPILER29_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 23.0 or higher - RTL Versions @@ -293,7 +483,7 @@ Use e.g. following to determine the exact RTL version since version 14.0: {$IFDEF CONDITIONALEXPRESSIONS} {$IF Declared(RTLVersion) and (RTLVersion >= 14.2)} - // code for Delphi 6.02 or higher, Kylix 2 or higher, C++ Builder 6 or higher + // code for Delphi 6.02 or higher, Kylix 2 or higher, C++Builder 6 or higher ... {$IFEND} {$ENDIF} @@ -302,20 +492,36 @@ ------------------------------------------------------------------------------ RTL80_UP Defined when compiling with Delphi 1 or higher RTL90_UP Defined when compiling with Delphi 2 or higher - RTL93_UP Defined when compiling with C++ Builder 1 or higher + RTL93_UP Defined when compiling with C++Builder 1 or higher RTL100_UP Defined when compiling with Delphi 3 or higher - RTL110_UP Defined when compiling with C++ Builder 3 or higher + RTL110_UP Defined when compiling with C++Builder 3 or higher RTL120_UP Defined when compiling with Delphi 4 or higher - RTL125_UP Defined when compiling with C++ Builder 4 or higher - RTL130_UP Defined when compiling with Delphi 5 or C++ Builder 5 or higher - RTL140_UP Defined when compiling with Delphi 6, Kylix 1, 2 or 3 or C++ Builder 6 or higher + RTL125_UP Defined when compiling with C++Builder 4 or higher + RTL130_UP Defined when compiling with Delphi 5 or C++Builder 5 or higher + RTL140_UP Defined when compiling with Delphi 6, Kylix 1, 2 or 3 or C++Builder 6 or higher RTL150_UP Defined when compiling with Delphi 7 or higher RTL160_UP Defined when compiling with Delphi 8 or higher RTL170_UP Defined when compiling with Delphi Personalities of BDS 3.0 or higher - RTL180_UP Defined when compiling with Delphi or C++ Builder Personalities of BDS 4.0 or higher - RTL185_UP Defined when compiling with Delphi 2007 for Win32 or higher - RTL190_UP Defined when compiling with Delphi.NET of BDS 5.0 or later - RTL200_UP Defined when compiling with Delphi or C++ Builder Personalities of BDS 6.0 or later + RTL180_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 4.0 or higher + RTL185_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 5.0 or higher + RTL190_UP Defined when compiling with Delphi.NET of BDS 5.0 or higher + RTL200_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 6.0 or higher + RTL210_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 7.0 or higher + RTL220_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 8.0 or higher + RTL230_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 9.0 or higher + RTL240_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 10.0 or higher + RTL250_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 11.0 or higher + RTL260_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 12.0 or higher + RTL270_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 14.0 or higher + RTL280_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 15.0 or higher + RTL290_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 16.0 or higher + RTL300_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 17.0 or higher + RTL310_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 18.0 or higher + RTL320_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 19.0 or higher + RTL330_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 20.0 or higher + RTL340_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 21.0 or higher + RTL350_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 22.0 or higher + RTL360_UP Defined when compiling with Delphi or C++Builder Personalities of BDS 23.0 or higher - CLR Versions @@ -340,67 +546,109 @@ Directive Description ------------------------------------------------------------------------------ - SUPPORTS_CONSTPARAMS Compiler supports const parameters (D1+) - SUPPORTS_SINGLE Compiler supports the Single type (D1+) - SUPPORTS_DOUBLE Compiler supports the Double type (D1+) - SUPPORTS_EXTENDED Compiler supports the Extended type (D1+) - SUPPORTS_CURRENCY Compiler supports the Currency type (D2+) - SUPPORTS_THREADVAR Compiler supports threadvar declarations (D2+) - SUPPORTS_OUTPARAMS Compiler supports out parameters (D3+) - SUPPORTS_VARIANT Compiler supports variant (D2+) - SUPPORTS_WIDECHAR Compiler supports the WideChar type (D2+) - SUPPORTS_WIDESTRING Compiler supports the WideString type (D3+/BCB3+) - SUPPORTS_INTERFACE Compiler supports interfaces (D3+/BCB3+) - SUPPORTS_DISPINTERFACE Compiler supports dispatch interfaces (D3+/BCB3+) - SUPPORTS_DISPID Compiler supports dispatch ids (D3+/BCB3+/FPC) - SUPPORTS_EXTSYM Compiler supports the $EXTERNALSYM directive (D4+/BCB3+) - SUPPORTS_NODEFINE Compiler supports the $NODEFINE directive (D4+/BCB3+) - SUPPORTS_LONGWORD Compiler supports the LongWord type (unsigned 32 bit) (D4+/BCB4+) - SUPPORTS_INT64 Compiler supports the Int64 type (D4+/BCB4+) - SUPPORTS_DYNAMICARRAYS Compiler supports dynamic arrays (D4+/BCB4+) - SUPPORTS_DEFAULTPARAMS Compiler supports default parameters (D4+/BCB4+) - SUPPORTS_OVERLOAD Compiler supports overloading (D4+/BCB4+) - SUPPORTS_IMPLEMENTS Compiler supports implements (D4+/BCB4+) - SUPPORTS_DEPRECATED Compiler supports the deprecated directive (D6+/BCB6+) - SUPPORTS_PLATFORM Compiler supports the platform directive (D6+/BCB6+) - SUPPORTS_LIBRARY Compiler supports the library directive (D6+/BCB6+/FPC) - SUPPORTS_LOCAL Compiler supports the local directive (D6+/BCB6+) - SUPPORTS_INLINE Compiler supports the inline directive (D9+/FPC) - SUPPORTS_FOR_IN Compiler supports for in loops (D9+) - SUPPORTS_NESTED_CONSTANTS Compiler supports nested constants (D9+) - SUPPORTS_NESTED_TYPES Compiler supports nested types (D9+) - SUPPORTS_ENHANCED_RECORDS Compiler supports class [operator|function|procedure] for record types (D9.NET, D10+) - SUPPORTS_CLASS_FIELDS Compiler supports class fields (D9.NET, D10+) - SUPPORTS_CLASS_HELPERS Compiler supports class helpers (D9.NET, D10+) - SUPPORTS_CLASS_OPERATORS Compiler supports class operators (D9.NET, D10+) - SUPPORTS_STRICT Compiler supports strict keyword (D9.NET, D10+) - SUPPORTS_STATIC Compiler supports static keyword (D9.NET, D10+) - SUPPORTS_FINAL Compiler supports final keyword (D9.NET, D10+) - SUPPORTS_GENERICS Compiler supports generic implementations (D11.net, D12+) - ACCEPT_DEPRECATED Compiler supports or ignores the deprecated directive (D6+/BCB6+/FPC) - ACCEPT_PLATFORM Compiler supports or ignores the platform directive (D6+/BCB6+/FPC) - ACCEPT_LIBRARY Compiler supports or ignores the library directive (D6+/BCB6+) - SUPPORTS_CUSTOMVARIANTS Compiler supports custom variants (D6+/BCB6+) - SUPPORTS_VARARGS Compiler supports varargs (D6+/BCB6+) - SUPPORTS_ENUMVALUE Compiler supports assigning ordinalities to values of enums (D6+/BCB6+) - SUPPORTS_DEPRECATED_WARNINGS Compiler supports deprecated warnings (D6+/BCB6+) - SUPPORTS_LIBRARY_WARNINGS Compiler supports library warnings (D6+/BCB6+) - SUPPORTS_PLATFORM_WARNINGS Compiler supports platform warnings (D6+/BCB6+) - SUPPORTS_UNSAFE_WARNINGS Compiler supports unsafe warnings (D7) - SUPPORTS_WEAKPACKAGEUNIT Compiler supports the WEAKPACKAGEUNIT directive - SUPPORTS_COMPILETIME_MESSAGES Compiler supports the MESSAGE directive - SUPPORTS_PACKAGES Compiler supports Packages - HAS_UNIT_LIBC Unit Libc exists (Kylix, FPC on Linux/x86) - HAS_UNIT_RTLCONSTS Unit RTLConsts exists (D6+/BCB6+/FPC) - HAS_UNIT_TYPES Unit Types exists (D6+/BCB6+/FPC) - HAS_UNIT_VARIANTS Unit Variants exists (D6+/BCB6+/FPC) - HAS_UNIT_STRUTILS Unit StrUtils exists (D6+/BCB6+/FPC) - HAS_UNIT_DATEUTILS Unit DateUtils exists (D6+/BCB6+/FPC) - HAS_UNIT_CONTNRS Unit contnrs exists (D6+/BCB6+/FPC) - HAS_UNIT_ANSISTRINGS Unit AnsiStrings exists (D12+) - XPLATFORM_RTL The RTL supports crossplatform function names (e.g. RaiseLastOSError) (D6+/BCB6+/FPC) - SUPPORTS_UNICODE string type is aliased to an unicode string (WideString or UnicodeString) (DX.net, D12+) - SUPPORTS_UNICODE_STRING Compiler supports UnicodeString (D12+) + SUPPORTS_CONSTPARAMS Compiler supports const parameters (D1+) + SUPPORTS_SINGLE Compiler supports the Single type (D1+) + SUPPORTS_DOUBLE Compiler supports the Double type (D1+) + SUPPORTS_EXTENDED Compiler supports the Extended type (D1+) + SUPPORTS_CURRENCY Compiler supports the Currency type (D2+) + SUPPORTS_THREADVAR Compiler supports threadvar declarations (D2+) + SUPPORTS_OUTPARAMS Compiler supports out parameters (D3+) + SUPPORTS_VARIANT Compiler supports variant (D2+) + SUPPORTS_WIDECHAR Compiler supports the WideChar type (D2+) + SUPPORTS_WIDESTRING Compiler supports the WideString type (D3+/BCB3+) + SUPPORTS_INTERFACE Compiler supports interfaces (D3+/BCB3+) + SUPPORTS_DISPINTERFACE Compiler supports dispatch interfaces (D3+/BCB3+) + SUPPORTS_DISPID Compiler supports dispatch ids (D3+/BCB3+/FPC) + SUPPORTS_EXTSYM Compiler supports the $EXTERNALSYM directive (D4+/BCB3+) + SUPPORTS_NODEFINE Compiler supports the $NODEFINE directive (D4+/BCB3+) + SUPPORTS_LONGWORD Compiler supports the LongWord type (unsigned 32 bit) (D4+/BCB4+) + SUPPORTS_INT64 Compiler supports the Int64 type (D4+/BCB4+) + SUPPORTS_UINT64 Compiler supports the UInt64 type (D7+) + SUPPORTS_DYNAMICARRAYS Compiler supports dynamic arrays (D4+/BCB4+) + SUPPORTS_DEFAULTPARAMS Compiler supports default parameters (D4+/BCB4+) + SUPPORTS_OVERLOAD Compiler supports overloading (D4+/BCB4+) + SUPPORTS_IMPLEMENTS Compiler supports implements (D4+/BCB4+) + SUPPORTS_DEPRECATED Compiler supports the deprecated directive (D6+/BCB6+) + SUPPORTS_PLATFORM Compiler supports the platform directive (D6+/BCB6+) + SUPPORTS_LIBRARY Compiler supports the library directive (D6+/BCB6+/FPC) + SUPPORTS_LOCAL Compiler supports the local directive (D6+/BCB6+) + SUPPORTS_SETPEFLAGS Compiler supports the SetPEFlags directive (D6+/BCB6+) + SUPPORTS_EXPERIMENTAL_WARNINGS Compiler supports the WARN SYMBOL_EXPERIMENTAL and WARN UNIT_EXPERIMENTAL directives (D6+/BCB6+) + SUPPORTS_INLINE Compiler supports the inline directive (D9+/FPC) + SUPPORTS_FOR_IN Compiler supports for in loops (D9+) + SUPPORTS_NESTED_CONSTANTS Compiler supports nested constants (D9+) + SUPPORTS_NESTED_TYPES Compiler supports nested types (D9+) + SUPPORTS_REGION Compiler supports the REGION and ENDREGION directives (D9+) + SUPPORTS_ENHANCED_RECORDS Compiler supports class [operator|function|procedure] for record types (D9.NET, D10+) + SUPPORTS_CLASS_FIELDS Compiler supports class fields (D9.NET, D10+) + SUPPORTS_CLASS_HELPERS Compiler supports class helpers (D9.NET, D10+) + SUPPORTS_CLASS_OPERATORS Compiler supports class operators (D9.NET, D10+) + SUPPORTS_CLASS_CTORDTORS Compiler supports class contructors/destructors (D14+) + SUPPORTS_STRICT Compiler supports strict keyword (D9.NET, D10+) + SUPPORTS_STATIC Compiler supports static keyword (D9.NET, D10+) + SUPPORTS_FINAL Compiler supports final keyword (D9.NET, D10+) + SUPPORTS_METHODINFO Compiler supports the METHODINFO directives (D10+) + SUPPORTS_GENERICS Compiler supports generic implementations (D11.NET, D12+) + SUPPORTS_GENERIC_TYPES Compiler supports generic implementations of types (D11.NET, D12+, FPC) + SUPPORTS_GENERIC_METHODS Compiler supports generic implementations of methods (D11.NET, D12+, FPC) + SUPPORTS_GENERIC_ROUTINES Compiler supports generic implementations of global functions/procedures (FPC) + SUPPORTS_DEPRECATED_DETAILS Compiler supports additional text for the deprecated directive (D11.NET, D12+) + ACCEPT_DEPRECATED Compiler supports or ignores the deprecated directive (D6+/BCB6+/FPC) + ACCEPT_PLATFORM Compiler supports or ignores the platform directive (D6+/BCB6+/FPC) + ACCEPT_LIBRARY Compiler supports or ignores the library directive (D6+/BCB6+) + SUPPORTS_CUSTOMVARIANTS Compiler supports custom variants (D6+/BCB6+) + SUPPORTS_VARARGS Compiler supports varargs (D6+/BCB6+) + SUPPORTS_ENUMVALUE Compiler supports assigning ordinalities to values of enums (D6+/BCB6+) + SUPPORTS_DEPRECATED_WARNINGS Compiler supports deprecated warnings (D6+/BCB6+) + SUPPORTS_LIBRARY_WARNINGS Compiler supports library warnings (D6+/BCB6+) + SUPPORTS_PLATFORM_WARNINGS Compiler supports platform warnings (D6+/BCB6+) + SUPPORTS_UNSAFE_WARNINGS Compiler supports unsafe warnings (D7+) + SUPPORTS_WEAKPACKAGEUNIT Compiler supports the WEAKPACKAGEUNIT directive (D3+) + SUPPORTS_COMPILETIME_MESSAGES Compiler supports the MESSAGE directive (D6+) + SUPPORTS_PACKAGES Compiler supports Packages (D1+) + HAS_UNIT_LIBC Unit Libc exists (Kylix, FPC on Linux/x86) + HAS_UNIT_RTLCONSTS Unit RTLConsts exists (D6+/BCB6+/FPC) + HAS_UNIT_TYPES Unit Types exists (D6+/BCB6+/FPC) + HAS_UNIT_VARIANTS Unit Variants exists (D6+/BCB6+/FPC) + HAS_UNIT_STRUTILS Unit StrUtils exists (D6+/BCB6+/FPC) + HAS_UNIT_DATEUTILS Unit DateUtils exists (D6+/BCB6+/FPC) + HAS_UNIT_CONTNRS Unit contnrs exists (D6+/BCB6+/FPC) + HAS_UNIT_HTTPPROD Unit HTTPProd exists (D9+) + HAS_UNIT_GIFIMG Unit GifImg exists (D11+) + HAS_UNIT_ANSISTRINGS Unit AnsiStrings exists (D12+) + HAS_UNIT_PNGIMAGE Unit PngImage exists (D12+) + HAS_UNIT_CHARACTER Unit Character exists (D12+) + XPLATFORM_RTL The RTL supports crossplatform function names (e.g. RaiseLastOSError) (D6+/BCB6+/FPC) + SUPPORTS_TYPED_POINTERMATH Compiler supports arithmetic operations on typed pointers (D12+) + SUPPORTS_STRINGCHECKS Compiler supports the STRINGCHECKS directive (D12+) + SUPPORTS_UNICODE string type is aliased to an unicode string (WideString or UnicodeString) (DX.NET, D12+) + SUPPORTS_UNICODE_STRING Compiler supports UnicodeString (D12+) + SUPPORTS_INT_ALIASES Types Int8, Int16, Int32, UInt8, UInt16 and UInt32 are defined in the unit System (D12+) + HAS_UNIT_RTTI Unit RTTI is available (D14+) + SUPPORTS_EXTENDED_RTTI Compiler supports the extended RTTI directive (D14+) + SUPPORTS_CAST_INTERFACE_TO_OBJ The compiler supports casts from interfaces to objects (D14+) + SUPPORTS_DELAYED_LOADING The compiler generates stubs for delaying imported function loads (D14+) + HAS_UNIT_REGULAREXPRESSIONSAPI Unit RegularExpressionsAPI is available (D15+) + HAS_UNITSCOPE Has unit scope, i.e. System.Classes instead of Classes (D16+) + HAS_UNIT_SYSTEM_UITYPES Unit System.UITypes is available (D16+) + HAS_UNIT_SYSTEM_ZIP Unit System.Zip is available (D16+) + HAS_UNIT_SYSTEM_ZLIB Unit System.ZLib is available (D16+) + HAS_UNIT_SYSTEM_ACTIONS Unit System.Actions is available (D17+) + DEPRECATED_SYSUTILS_ANSISTRINGS AnsiString functions from SysUtils are deprecated and moved to System.AnsiStrings (D18+) + HAS_PROPERTY_STYLEELEMENTS TControl has a StyleElements property (D17+) + HAS_AUTOMATIC_DB_FIELDS Database fields are automatically created/refreshed (D20+) + HAS_EARGUMENTEXCEPTION Exception class EArgumentException is available (D14+) + HAS_ENOTIMPLEMENTED Exception class ENotImplemented is available (D15+) + HAS_UNIT_VCL_THEMES Unit Vcl.Themes is available (D16+) + SUPPORTS_EXCESSPRECISION Compiler supports the EXCESSPRECISION directive (D16+) + HAS_TSTRINGS_ENCODING RTL supports TStrings.Encoding (D16+) + EXTENDED_IS_DOUBLE_ALIAS Compiler uses Double instead of Extended (64 bit D16+) + HAS_UNIT_UXTHEME Unit (Vcl.)UxTheme is available (D7+) + HAS_EXCEPTION_STACKTRACE Exception class has the StackTrace propery (D12+) + SUPPORTS_LEGACYIFEND Compiler supports the LEGACYIFEND directive (D17+) + DEPRECATED_TCHARACTER TCharacter is deprecated and replaced by a record helper on Char (D18+) + HAS_PROPERTY_OLDCREATEORDER The OldCreateOrder property is available (D5 - D27) + SUPPORTS_SCOPEDENUMS Compiler supports the SCOPEDENUMS directive and enumerations can be scoped (D12+) - Compiler Settings @@ -420,6 +668,7 @@ IOCHECKS_ON Compiling in the I+ state (I/O checking enabled) WRITEABLECONST_ON Compiling in the J+ state (typed constants can be modified) LOCALSYMBOLS Compiling in the L+ state (local symbol generation) + LOCALSYMBOLS_ON Alias of LOCALSYMBOLS TYPEINFO_ON Compiling in the M+ state (RTTI generation on) OPTIMIZATION_ON Compiling in the O+ state (code optimization on) OPENSTRINGS_ON Compiling in the P+ state (variable string parameters are openstrings) @@ -437,18 +686,40 @@ { Set FreePascal to Delphi mode } {$IFDEF FPC} {$MODE DELPHI} - {$ASMMODE Intel} + // Assembler mode Intel is only available for the x86 CPU family + {$IF DEFINED(CPUI8086) OR DEFINED(CPUI386) OR DEFINED(CPUX86_64)} + {$ASMMODE Intel} + {$IFEND} {$UNDEF BORLAND} - // FPC defines CPU* and Unix automatically + {$DEFINE CPUASM} + // FPC defines CPU32, CPU64 and Unix automatically {$ENDIF} {$IFDEF BORLAND} {$IFDEF LINUX} - {$DEFINE KYLIX} + {$IFDEF VER140} // Only under Delphi 6, LINUX implies Kylix + {$DEFINE KYLIX} + {$ENDIF} {$ENDIF LINUX} {$IFNDEF CLR} - {$DEFINE CPU386} // For Borland compilers select the x86 compat assembler by default - {$DEFINE CPU32} // Assume Borland compilers are 32-bit (rather than 64-bit) + {$IFNDEF CPUX86} + // CPUX86 is not defined, which means it most likely is a 64 bits compiler. + // However, this is only the case if either of two other symbols are defined: + // http://docwiki.embarcadero.com/RADStudio/Alexandria/en/Conditional_compilation_%28Delphi%29 + {$DEFINE CPU64} + {$DEFINE DELPHI64_TEMPORARY} + {$IFNDEF CPUX64} + {$IFNDEF CPU64BITS} + {$DEFINE CPU386} // None of the two 64-bits symbols are defined, assume this is 32-bit + {$DEFINE CPU32} + {$UNDEF CPU64} + {$UNDEF DELPHI64_TEMPORARY} + {$ENDIF ~CPU64BITS} + {$ENDIF ~CPUX64} + {$ELSE ~CPUX86} + {$DEFINE CPU386} + {$DEFINE CPU32} + {$ENDIF ~CPUX86} {$ENDIF ~CLR} {$ENDIF BORLAND} @@ -498,6 +769,7 @@ {$IFDEF VER110} {$DEFINE COMPILER35} {$DEFINE BCB3} + {$DEFINE BCB} {$DEFINE RTL110_UP} {$UNDEF UNKNOWN_COMPILER_VERSION} {$ENDIF} @@ -644,22 +916,256 @@ {$UNDEF UNKNOWN_COMPILER_VERSION} {$ENDIF VER200} - {$IFDEF UNKNOWN_COMPILER_VERSION} // adjust for newer version (always use latest version) + {$IFDEF VER210} // RAD Studio 2010 {$DEFINE BDS} - {$DEFINE BDS6} - {$DEFINE COMPILER12} + {$DEFINE BDS7} + {$DEFINE COMPILER14} {$IFDEF BCB} - {$DEFINE BCB12} + {$DEFINE BCB14} {$ELSE} - {$DEFINE DELPHI12} - {$DEFINE DELPHI2009} // synonym to DELPHI12 - {$DEFINE DELPHICOMPILER12} + {$DEFINE DELPHI14} + {$DEFINE DELPHI2010} // synonym to DELPHI14 + {$DEFINE DELPHICOMPILER14} {$ENDIF BCB} - {$IFDEF CLR} - {$DEFINE RTL190_UP} + {$DEFINE RTL210_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER210} + + {$IFDEF VER220} // RAD Studio XE + {$DEFINE BDS} + {$DEFINE BDS8} + {$DEFINE COMPILER15} + {$IFDEF BCB} + {$DEFINE BCB15} {$ELSE} - {$DEFINE RTL200_UP} - {$ENDIF} + {$DEFINE DELPHI15} + {$DEFINE DELPHIXE} // synonym to DELPHI15 + {$DEFINE DELPHICOMPILER15} + {$ENDIF BCB} + {$DEFINE RTL220_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER220} + + {$IFDEF VER230} // RAD Studio XE2 + {$DEFINE BDS} + {$DEFINE BDS9} + {$DEFINE COMPILER16} + {$IFDEF BCB} + {$DEFINE BCB16} + {$ELSE} + {$DEFINE DELPHI16} + {$DEFINE DELPHIXE2} // synonym to DELPHI16 + {$DEFINE DELPHICOMPILER16} + {$ENDIF BCB} + {$DEFINE RTL230_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER230} + + {$IFDEF VER240} // RAD Studio XE3 + {$DEFINE BDS} + {$DEFINE BDS10} + {$DEFINE COMPILER17} + {$IFDEF BCB} + {$DEFINE BCB17} + {$ELSE} + {$DEFINE DELPHI17} + {$DEFINE DELPHIXE3} // synonym to DELPHI17 + {$DEFINE DELPHICOMPILER17} + {$ENDIF BCB} + {$DEFINE RTL240_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER240} + + {$IFDEF VER250} // RAD Studio XE4 + {$DEFINE BDS} + {$DEFINE BDS11} + {$DEFINE COMPILER18} + {$IFDEF BCB} + {$DEFINE BCB18} + {$ELSE} + {$DEFINE DELPHI18} + {$DEFINE DELPHIXE4} // synonym to DELPHI18 + {$DEFINE DELPHICOMPILER18} + {$ENDIF BCB} + {$DEFINE RTL250_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER250} + + {$IFDEF VER260} // RAD Studio XE5 + {$DEFINE BDS} + {$DEFINE BDS12} + {$DEFINE COMPILER19} + {$IFDEF BCB} + {$DEFINE BCB19} + {$ELSE} + {$DEFINE DELPHI19} + {$DEFINE DELPHIXE5} // synonym to DELPHI19 + {$DEFINE DELPHICOMPILER19} + {$ENDIF BCB} + {$DEFINE RTL260_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER260} + + {$IFDEF VER270} // RAD Studio XE6 + {$DEFINE BDS} + {$DEFINE BDS14} + {$DEFINE COMPILER20} + {$IFDEF BCB} + {$DEFINE BCB20} + {$ELSE} + {$DEFINE DELPHI20} + {$DEFINE DELPHIXE6} // synonym to DELPHI20 + {$DEFINE DELPHICOMPILER20} + {$ENDIF BCB} + {$DEFINE RTL270_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER270} + + {$IFDEF VER280} // RAD Studio XE7 + {$DEFINE BDS} + {$DEFINE BDS15} + {$DEFINE COMPILER21} + {$IFDEF BCB} + {$DEFINE BCB21} + {$ELSE} + {$DEFINE DELPHI21} + {$DEFINE DELPHIXE7} // synonym to DELPHI21 + {$DEFINE DELPHICOMPILER21} + {$ENDIF BCB} + {$DEFINE RTL280_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER280} + + {$IFDEF VER290} // RAD Studio XE8 + {$DEFINE BDS} + {$DEFINE BDS16} + {$DEFINE COMPILER22} + {$IFDEF BCB} + {$DEFINE BCB22} + {$ELSE} + {$DEFINE DELPHI22} + {$DEFINE DELPHIXE8} // synonym to DELPHI22 + {$DEFINE DELPHICOMPILER22} + {$ENDIF BCB} + {$DEFINE RTL290_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER290} + + {$IFDEF VER300} // RAD Studio 10 + {$DEFINE BDS} + {$DEFINE BDS17} + {$DEFINE COMPILER23} + {$IFDEF BCB} + {$DEFINE BCB23} + {$ELSE} + {$DEFINE DELPHI23} + {$DEFINE DELPHIX_SEATTLE} // synonym to DELPHI23 + {$DEFINE DELPHICOMPILER23} + {$ENDIF BCB} + {$DEFINE RTL300_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER300} + + {$IFDEF VER310} // RAD Studio 10.1 + {$DEFINE BDS} + {$DEFINE BDS18} + {$DEFINE COMPILER24} + {$IFDEF BCB} + {$DEFINE BCB24} + {$ELSE} + {$DEFINE DELPHI24} + {$DEFINE DELPHIX_BERLIN} // synonym to DELPHI24 + {$DEFINE DELPHICOMPILER24} + {$ENDIF BCB} + {$DEFINE RTL310_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER310} + + {$IFDEF VER320} // RAD Studio 10.2 + {$DEFINE BDS} + {$DEFINE BDS19} + {$DEFINE COMPILER25} + {$IFDEF BCB} + {$DEFINE BCB25} + {$ELSE} + {$DEFINE DELPHI25} + {$DEFINE DELPHIX_TOKYO} // synonym to DELPHI25 + {$DEFINE DELPHICOMPILER25} + {$ENDIF BCB} + {$DEFINE RTL320_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER320} + + {$IFDEF VER330} // RAD Studio 10.3 + {$DEFINE BDS} + {$DEFINE BDS20} + {$DEFINE COMPILER26} + {$IFDEF BCB} + {$DEFINE BCB26} + {$ELSE} + {$DEFINE DELPHI26} + {$DEFINE DELPHIX_RIO} // synonym to DELPHI26 + {$DEFINE DELPHICOMPILER26} + {$ENDIF BCB} + {$DEFINE RTL330_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER330} + + {$IFDEF VER340} // RAD Studio 10.4 + {$DEFINE BDS} + {$DEFINE BDS21} + {$DEFINE COMPILER27} + {$IFDEF BCB} + {$DEFINE BCB27} + {$ELSE} + {$DEFINE DELPHI27} + {$DEFINE DELPHIX_SYDNEY} // synonym to DELPHI27 + {$DEFINE DELPHICOMPILER27} + {$ENDIF BCB} + {$DEFINE RTL340_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER340} + + {$IFDEF VER350} // RAD Studio 11 + {$DEFINE BDS} + {$DEFINE BDS22} + {$DEFINE COMPILER28} + {$IFDEF BCB} + {$DEFINE BCB28} + {$ELSE} + {$DEFINE DELPHI28} + {$DEFINE DELPHIX_ALEXANDRIA} // synonym to DELPHI28 + {$DEFINE DELPHICOMPILER28} + {$ENDIF BCB} + {$DEFINE RTL350_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER350} + + {$IFDEF VER360} // RAD Studio 12 + {$DEFINE BDS} + {$DEFINE BDS23} + {$DEFINE COMPILER29} + {$IFDEF BCB} + {$DEFINE BCB29} + {$ELSE} + {$DEFINE DELPHI29} + {$DEFINE DELPHICOMPILER29} + {$ENDIF BCB} + {$DEFINE RTL360_UP} + {$UNDEF UNKNOWN_COMPILER_VERSION} + {$ENDIF VER360} + + {$IFDEF UNKNOWN_COMPILER_VERSION} // adjust for newer version (always use latest version) + {$DEFINE BDS} + {$DEFINE BDS23} + {$DEFINE COMPILER29} + {$IFDEF BCB} + {$DEFINE BCB29} + {$ELSE} + {$DEFINE DELPHI29} + {$DEFINE DELPHICOMPILER29} + {$ENDIF BCB} + {$DEFINE RTL360_UP} {$UNDEF UNKNOWN_COMPILER_VERSION} {$ENDIF} @@ -679,6 +1185,22 @@ { DELPHIX_UP from DELPHIX mappings } {------------------------------------------------------------------------------} +{$IFDEF DELPHI29} {$DEFINE DELPHI29_UP} {$ENDIF} +{$IFDEF DELPHI28} {$DEFINE DELPHI28_UP} {$ENDIF} +{$IFDEF DELPHI27} {$DEFINE DELPHI27_UP} {$ENDIF} +{$IFDEF DELPHI26} {$DEFINE DELPHI26_UP} {$ENDIF} +{$IFDEF DELPHI25} {$DEFINE DELPHI25_UP} {$ENDIF} +{$IFDEF DELPHI24} {$DEFINE DELPHI24_UP} {$ENDIF} +{$IFDEF DELPHI23} {$DEFINE DELPHI23_UP} {$ENDIF} +{$IFDEF DELPHI22} {$DEFINE DELPHI22_UP} {$ENDIF} +{$IFDEF DELPHI21} {$DEFINE DELPHI21_UP} {$ENDIF} +{$IFDEF DELPHI20} {$DEFINE DELPHI20_UP} {$ENDIF} +{$IFDEF DELPHI19} {$DEFINE DELPHI19_UP} {$ENDIF} +{$IFDEF DELPHI18} {$DEFINE DELPHI18_UP} {$ENDIF} +{$IFDEF DELPHI17} {$DEFINE DELPHI17_UP} {$ENDIF} +{$IFDEF DELPHI16} {$DEFINE DELPHI16_UP} {$ENDIF} +{$IFDEF DELPHI15} {$DEFINE DELPHI15_UP} {$ENDIF} +{$IFDEF DELPHI14} {$DEFINE DELPHI14_UP} {$ENDIF} {$IFDEF DELPHI12} {$DEFINE DELPHI12_UP} {$ENDIF} {$IFDEF DELPHI11} {$DEFINE DELPHI11_UP} {$ENDIF} {$IFDEF DELPHI10} {$DEFINE DELPHI10_UP} {$ENDIF} @@ -696,6 +1218,85 @@ { DELPHIX_UP from DELPHIX_UP mappings } {------------------------------------------------------------------------------} +{$IFDEF DELPHI29_UP} + {$DEFINE DELPHI28_UP} +{$ENDIF} + +{$IFDEF DELPHI28_UP} + {$DEFINE DELPHIX_ALEXANDRIA_UP} // synonym to DELPHI28_UP + {$DEFINE DELPHI27_UP} +{$ENDIF} + +{$IFDEF DELPHI27_UP} + {$DEFINE DELPHIX_SYDNEY_UP} // synonym to DELPHI27_UP + {$DEFINE DELPHI26_UP} +{$ENDIF} + +{$IFDEF DELPHI26_UP} + {$DEFINE DELPHIX_RIO_UP} // synonym to DELPHI26_UP + {$DEFINE DELPHI25_UP} +{$ENDIF} + +{$IFDEF DELPHI25_UP} + {$DEFINE DELPHIX_TOKYO_UP} // synonym to DELPHI25_UP + {$DEFINE DELPHI24_UP} +{$ENDIF} + +{$IFDEF DELPHI24_UP} + {$DEFINE DELPHIX_BERLIN_UP} // synonym to DELPHI24_UP + {$DEFINE DELPHI23_UP} +{$ENDIF} + +{$IFDEF DELPHI23_UP} + {$DEFINE DELPHIX_SEATTLE_UP} // synonym to DELPHI23_UP + {$DEFINE DELPHI22_UP} +{$ENDIF} + +{$IFDEF DELPHI22_UP} + {$DEFINE DELPHIXE8_UP} // synonym to DELPHI22_UP + {$DEFINE DELPHI21_UP} +{$ENDIF} + +{$IFDEF DELPHI21_UP} + {$DEFINE DELPHIXE7_UP} // synonym to DELPHI21_UP + {$DEFINE DELPHI20_UP} +{$ENDIF} + +{$IFDEF DELPHI20_UP} + {$DEFINE DELPHIXE6_UP} // synonym to DELPHI20_UP + {$DEFINE DELPHI19_UP} +{$ENDIF} + +{$IFDEF DELPHI19_UP} + {$DEFINE DELPHIXE5_UP} // synonym to DELPHI19_UP + {$DEFINE DELPHI18_UP} +{$ENDIF} + +{$IFDEF DELPHI18_UP} + {$DEFINE DELPHIXE4_UP} // synonym to DELPHI18_UP + {$DEFINE DELPHI17_UP} +{$ENDIF} + +{$IFDEF DELPHI17_UP} + {$DEFINE DELPHIXE3_UP} // synonym to DELPHI17_UP + {$DEFINE DELPHI16_UP} +{$ENDIF} + +{$IFDEF DELPHI16_UP} + {$DEFINE DELPHIXE2_UP} // synonym to DELPHI16_UP + {$DEFINE DELPHI15_UP} +{$ENDIF} + +{$IFDEF DELPHI15_UP} + {$DEFINE DELPHIXE_UP} // synonym to DELPHI15_UP + {$DEFINE DELPHI14_UP} +{$ENDIF} + +{$IFDEF DELPHI14_UP} + {$DEFINE DELPHI2010_UP} // synonym to DELPHI14_UP + {$DEFINE DELPHI12_UP} +{$ENDIF} + {$IFDEF DELPHI12_UP} {$DEFINE DELPHI2009_UP} // synonym to DELPHI12_UP {$DEFINE DELPHI11_UP} @@ -728,6 +1329,22 @@ { BCBX_UP from BCBX mappings } {------------------------------------------------------------------------------} +{$IFDEF BCB29} {$DEFINE BCB29_UP} {$ENDIF} +{$IFDEF BCB28} {$DEFINE BCB28_UP} {$ENDIF} +{$IFDEF BCB27} {$DEFINE BCB27_UP} {$ENDIF} +{$IFDEF BCB26} {$DEFINE BCB26_UP} {$ENDIF} +{$IFDEF BCB25} {$DEFINE BCB25_UP} {$ENDIF} +{$IFDEF BCB24} {$DEFINE BCB24_UP} {$ENDIF} +{$IFDEF BCB23} {$DEFINE BCB23_UP} {$ENDIF} +{$IFDEF BCB22} {$DEFINE BCB22_UP} {$ENDIF} +{$IFDEF BCB21} {$DEFINE BCB21_UP} {$ENDIF} +{$IFDEF BCB20} {$DEFINE BCB20_UP} {$ENDIF} +{$IFDEF BCB19} {$DEFINE BCB19_UP} {$ENDIF} +{$IFDEF BCB18} {$DEFINE BCB18_UP} {$ENDIF} +{$IFDEF BCB17} {$DEFINE BCB17_UP} {$ENDIF} +{$IFDEF BCB16} {$DEFINE BCB16_UP} {$ENDIF} +{$IFDEF BCB15} {$DEFINE BCB15_UP} {$ENDIF} +{$IFDEF BCB14} {$DEFINE BCB14_UP} {$ENDIF} {$IFDEF BCB12} {$DEFINE BCB12_UP} {$ENDIF} {$IFDEF BCB11} {$DEFINE BCB11_UP} {$ENDIF} {$IFDEF BCB10} {$DEFINE BCB10_UP} {$ENDIF} @@ -741,6 +1358,22 @@ { BCBX_UP from BCBX_UP mappings } {------------------------------------------------------------------------------} +{$IFDEF BCB29_UP} {$DEFINE BCB28_UP} {$ENDIF} +{$IFDEF BCB28_UP} {$DEFINE BCB27_UP} {$ENDIF} +{$IFDEF BCB27_UP} {$DEFINE BCB26_UP} {$ENDIF} +{$IFDEF BCB26_UP} {$DEFINE BCB25_UP} {$ENDIF} +{$IFDEF BCB25_UP} {$DEFINE BCB24_UP} {$ENDIF} +{$IFDEF BCB24_UP} {$DEFINE BCB23_UP} {$ENDIF} +{$IFDEF BCB23_UP} {$DEFINE BCB22_UP} {$ENDIF} +{$IFDEF BCB22_UP} {$DEFINE BCB21_UP} {$ENDIF} +{$IFDEF BCB21_UP} {$DEFINE BCB20_UP} {$ENDIF} +{$IFDEF BCB20_UP} {$DEFINE BCB19_UP} {$ENDIF} +{$IFDEF BCB19_UP} {$DEFINE BCB18_UP} {$ENDIF} +{$IFDEF BCB18_UP} {$DEFINE BCB17_UP} {$ENDIF} +{$IFDEF BCB17_UP} {$DEFINE BCB16_UP} {$ENDIF} +{$IFDEF BCB16_UP} {$DEFINE BCB15_UP} {$ENDIF} +{$IFDEF BCB15_UP} {$DEFINE BCB14_UP} {$ENDIF} +{$IFDEF BCB14_UP} {$DEFINE BCB12_UP} {$ENDIF} {$IFDEF BCB12_UP} {$DEFINE BCB11_UP} {$ENDIF} {$IFDEF BCB11_UP} {$DEFINE BCB10_UP} {$ENDIF} {$IFDEF BCB10_UP} {$DEFINE BCB6_UP} {$ENDIF} @@ -753,6 +1386,22 @@ { BDSX_UP from BDSX mappings } {------------------------------------------------------------------------------} +{$IFDEF BDS23} {$DEFINE BDS23_UP} {$ENDIF} +{$IFDEF BDS22} {$DEFINE BDS22_UP} {$ENDIF} +{$IFDEF BDS21} {$DEFINE BDS21_UP} {$ENDIF} +{$IFDEF BDS20} {$DEFINE BDS20_UP} {$ENDIF} +{$IFDEF BDS19} {$DEFINE BDS19_UP} {$ENDIF} +{$IFDEF BDS18} {$DEFINE BDS18_UP} {$ENDIF} +{$IFDEF BDS17} {$DEFINE BDS17_UP} {$ENDIF} +{$IFDEF BDS16} {$DEFINE BDS16_UP} {$ENDIF} +{$IFDEF BDS15} {$DEFINE BDS15_UP} {$ENDIF} +{$IFDEF BDS14} {$DEFINE BDS14_UP} {$ENDIF} +{$IFDEF BDS12} {$DEFINE BDS12_UP} {$ENDIF} +{$IFDEF BDS11} {$DEFINE BDS11_UP} {$ENDIF} +{$IFDEF BDS10} {$DEFINE BDS10_UP} {$ENDIF} +{$IFDEF BDS9} {$DEFINE BDS9_UP} {$ENDIF} +{$IFDEF BDS8} {$DEFINE BDS8_UP} {$ENDIF} +{$IFDEF BDS7} {$DEFINE BDS7_UP} {$ENDIF} {$IFDEF BDS6} {$DEFINE BDS6_UP} {$ENDIF} {$IFDEF BDS5} {$DEFINE BDS5_UP} {$ENDIF} {$IFDEF BDS4} {$DEFINE BDS4_UP} {$ENDIF} @@ -763,6 +1412,22 @@ { BDSX_UP from BDSX_UP mappings } {------------------------------------------------------------------------------} +{$IFDEF BDS23_UP} {$DEFINE BDS22_UP} {$ENDIF} +{$IFDEF BDS22_UP} {$DEFINE BDS21_UP} {$ENDIF} +{$IFDEF BDS21_UP} {$DEFINE BDS20_UP} {$ENDIF} +{$IFDEF BDS20_UP} {$DEFINE BDS19_UP} {$ENDIF} +{$IFDEF BDS19_UP} {$DEFINE BDS18_UP} {$ENDIF} +{$IFDEF BDS18_UP} {$DEFINE BDS17_UP} {$ENDIF} +{$IFDEF BDS17_UP} {$DEFINE BDS16_UP} {$ENDIF} +{$IFDEF BDS16_UP} {$DEFINE BDS15_UP} {$ENDIF} +{$IFDEF BDS15_UP} {$DEFINE BDS14_UP} {$ENDIF} +{$IFDEF BDS14_UP} {$DEFINE BDS12_UP} {$ENDIF} +{$IFDEF BDS12_UP} {$DEFINE BDS11_UP} {$ENDIF} +{$IFDEF BDS11_UP} {$DEFINE BDS10_UP} {$ENDIF} +{$IFDEF BDS10_UP} {$DEFINE BDS9_UP} {$ENDIF} +{$IFDEF BDS9_UP} {$DEFINE BDS8_UP} {$ENDIF} +{$IFDEF BDS8_UP} {$DEFINE BDS7_UP} {$ENDIF} +{$IFDEF BDS7_UP} {$DEFINE BDS6_UP} {$ENDIF} {$IFDEF BDS6_UP} {$DEFINE BDS5_UP} {$ENDIF} {$IFDEF BDS5_UP} {$DEFINE BDS4_UP} {$ENDIF} {$IFDEF BDS4_UP} {$DEFINE BDS3_UP} {$ENDIF} @@ -772,6 +1437,22 @@ { DELPHICOMPILERX_UP from DELPHICOMPILERX mappings } {------------------------------------------------------------------------------} +{$IFDEF DELPHICOMPILER29} {$DEFINE DELPHICOMPILER29_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER28} {$DEFINE DELPHICOMPILER28_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER27} {$DEFINE DELPHICOMPILER27_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER26} {$DEFINE DELPHICOMPILER26_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER25} {$DEFINE DELPHICOMPILER25_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER24} {$DEFINE DELPHICOMPILER24_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER23} {$DEFINE DELPHICOMPILER23_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER22} {$DEFINE DELPHICOMPILER22_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER21} {$DEFINE DELPHICOMPILER21_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER20} {$DEFINE DELPHICOMPILER20_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER19} {$DEFINE DELPHICOMPILER19_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER18} {$DEFINE DELPHICOMPILER18_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER17} {$DEFINE DELPHICOMPILER17_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER16} {$DEFINE DELPHICOMPILER16_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER15} {$DEFINE DELPHICOMPILER15_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER14} {$DEFINE DELPHICOMPILER14_UP} {$ENDIF} {$IFDEF DELPHICOMPILER12} {$DEFINE DELPHICOMPILER12_UP} {$ENDIF} {$IFDEF DELPHICOMPILER11} {$DEFINE DELPHICOMPILER11_UP} {$ENDIF} {$IFDEF DELPHICOMPILER10} {$DEFINE DELPHICOMPILER10_UP} {$ENDIF} @@ -789,6 +1470,22 @@ { DELPHICOMPILERX_UP from DELPHICOMPILERX_UP mappings } {------------------------------------------------------------------------------} +{$IFDEF DELPHICOMPILER29_UP} {$DEFINE DELPHICOMPILER28_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER28_UP} {$DEFINE DELPHICOMPILER27_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER27_UP} {$DEFINE DELPHICOMPILER26_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER26_UP} {$DEFINE DELPHICOMPILER25_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER25_UP} {$DEFINE DELPHICOMPILER24_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER24_UP} {$DEFINE DELPHICOMPILER23_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER23_UP} {$DEFINE DELPHICOMPILER22_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER22_UP} {$DEFINE DELPHICOMPILER21_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER21_UP} {$DEFINE DELPHICOMPILER20_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER20_UP} {$DEFINE DELPHICOMPILER19_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER19_UP} {$DEFINE DELPHICOMPILER18_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER18_UP} {$DEFINE DELPHICOMPILER17_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER17_UP} {$DEFINE DELPHICOMPILER16_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER16_UP} {$DEFINE DELPHICOMPILER15_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER15_UP} {$DEFINE DELPHICOMPILER14_UP} {$ENDIF} +{$IFDEF DELPHICOMPILER14_UP} {$DEFINE DELPHICOMPILER12_UP} {$ENDIF} {$IFDEF DELPHICOMPILER12_UP} {$DEFINE DELPHICOMPILER11_UP} {$ENDIF} {$IFDEF DELPHICOMPILER11_UP} {$DEFINE DELPHICOMPILER10_UP} {$ENDIF} {$IFDEF DELPHICOMPILER10_UP} {$DEFINE DELPHICOMPILER9_UP} {$ENDIF} @@ -806,6 +1503,22 @@ { COMPILERX_UP from COMPILERX mappings } {------------------------------------------------------------------------------} +{$IFDEF COMPILER29} {$DEFINE COMPILER29_UP} {$ENDIF} +{$IFDEF COMPILER28} {$DEFINE COMPILER28_UP} {$ENDIF} +{$IFDEF COMPILER27} {$DEFINE COMPILER27_UP} {$ENDIF} +{$IFDEF COMPILER26} {$DEFINE COMPILER26_UP} {$ENDIF} +{$IFDEF COMPILER25} {$DEFINE COMPILER25_UP} {$ENDIF} +{$IFDEF COMPILER24} {$DEFINE COMPILER24_UP} {$ENDIF} +{$IFDEF COMPILER23} {$DEFINE COMPILER23_UP} {$ENDIF} +{$IFDEF COMPILER22} {$DEFINE COMPILER22_UP} {$ENDIF} +{$IFDEF COMPILER21} {$DEFINE COMPILER21_UP} {$ENDIF} +{$IFDEF COMPILER20} {$DEFINE COMPILER20_UP} {$ENDIF} +{$IFDEF COMPILER19} {$DEFINE COMPILER19_UP} {$ENDIF} +{$IFDEF COMPILER18} {$DEFINE COMPILER18_UP} {$ENDIF} +{$IFDEF COMPILER17} {$DEFINE COMPILER17_UP} {$ENDIF} +{$IFDEF COMPILER16} {$DEFINE COMPILER16_UP} {$ENDIF} +{$IFDEF COMPILER15} {$DEFINE COMPILER15_UP} {$ENDIF} +{$IFDEF COMPILER14} {$DEFINE COMPILER14_UP} {$ENDIF} {$IFDEF COMPILER12} {$DEFINE COMPILER12_UP} {$ENDIF} {$IFDEF COMPILER11} {$DEFINE COMPILER11_UP} {$ENDIF} {$IFDEF COMPILER10} {$DEFINE COMPILER10_UP} {$ENDIF} @@ -824,6 +1537,22 @@ { COMPILERX_UP from COMPILERX_UP mappings } {------------------------------------------------------------------------------} +{$IFDEF COMPILER29_UP} {$DEFINE COMPILER28_UP} {$ENDIF} +{$IFDEF COMPILER28_UP} {$DEFINE COMPILER27_UP} {$ENDIF} +{$IFDEF COMPILER27_UP} {$DEFINE COMPILER26_UP} {$ENDIF} +{$IFDEF COMPILER26_UP} {$DEFINE COMPILER25_UP} {$ENDIF} +{$IFDEF COMPILER25_UP} {$DEFINE COMPILER24_UP} {$ENDIF} +{$IFDEF COMPILER24_UP} {$DEFINE COMPILER23_UP} {$ENDIF} +{$IFDEF COMPILER23_UP} {$DEFINE COMPILER22_UP} {$ENDIF} +{$IFDEF COMPILER22_UP} {$DEFINE COMPILER21_UP} {$ENDIF} +{$IFDEF COMPILER21_UP} {$DEFINE COMPILER20_UP} {$ENDIF} +{$IFDEF COMPILER20_UP} {$DEFINE COMPILER19_UP} {$ENDIF} +{$IFDEF COMPILER19_UP} {$DEFINE COMPILER18_UP} {$ENDIF} +{$IFDEF COMPILER18_UP} {$DEFINE COMPILER17_UP} {$ENDIF} +{$IFDEF COMPILER17_UP} {$DEFINE COMPILER16_UP} {$ENDIF} +{$IFDEF COMPILER16_UP} {$DEFINE COMPILER15_UP} {$ENDIF} +{$IFDEF COMPILER15_UP} {$DEFINE COMPILER14_UP} {$ENDIF} +{$IFDEF COMPILER14_UP} {$DEFINE COMPILER12_UP} {$ENDIF} {$IFDEF COMPILER12_UP} {$DEFINE COMPILER11_UP} {$ENDIF} {$IFDEF COMPILER11_UP} {$DEFINE COMPILER10_UP} {$ENDIF} {$IFDEF COMPILER10_UP} {$DEFINE COMPILER9_UP} {$ENDIF} @@ -841,6 +1570,22 @@ { RTLX_UP from RTLX_UP mappings } {------------------------------------------------------------------------------} +{$IFDEF RTL360_UP} {$DEFINE RTL350_UP} {$ENDIF} +{$IFDEF RTL350_UP} {$DEFINE RTL340_UP} {$ENDIF} +{$IFDEF RTL340_UP} {$DEFINE RTL330_UP} {$ENDIF} +{$IFDEF RTL330_UP} {$DEFINE RTL320_UP} {$ENDIF} +{$IFDEF RTL320_UP} {$DEFINE RTL310_UP} {$ENDIF} +{$IFDEF RTL310_UP} {$DEFINE RTL300_UP} {$ENDIF} +{$IFDEF RTL300_UP} {$DEFINE RTL290_UP} {$ENDIF} +{$IFDEF RTL290_UP} {$DEFINE RTL280_UP} {$ENDIF} +{$IFDEF RTL280_UP} {$DEFINE RTL270_UP} {$ENDIF} +{$IFDEF RTL270_UP} {$DEFINE RTL260_UP} {$ENDIF} +{$IFDEF RTL260_UP} {$DEFINE RTL250_UP} {$ENDIF} +{$IFDEF RTL250_UP} {$DEFINE RTL240_UP} {$ENDIF} +{$IFDEF RTL240_UP} {$DEFINE RTL230_UP} {$ENDIF} +{$IFDEF RTL230_UP} {$DEFINE RTL220_UP} {$ENDIF} +{$IFDEF RTL220_UP} {$DEFINE RTL210_UP} {$ENDIF} +{$IFDEF RTL210_UP} {$DEFINE RTL200_UP} {$ENDIF} {$IFDEF RTL200_UP} {$DEFINE RTL190_UP} {$ENDIF} {$IFDEF RTL190_UP} {$DEFINE RTL185_UP} {$ENDIF} {$IFDEF RTL185_UP} {$DEFINE RTL180_UP} {$ENDIF} @@ -931,15 +1676,26 @@ {$IFDEF VER1_0} Please use FPC 2.0 or higher to compile this. {$ELSE} + { FPC_FULLVERSION is available from 2.2.4 on } + {$DEFINE SUPPORTS_OUTPARAMS} {$DEFINE SUPPORTS_WIDECHAR} {$DEFINE SUPPORTS_WIDESTRING} - {$IFDEF HASINTF} + {$IF DEFINED(VER2_0) OR DEFINED(VER2_1)} + {$IFDEF HASINTF} + {$DEFINE SUPPORTS_INTERFACE} + {$ENDIF} + {$IFDEF HASVARIANT} + {$DEFINE SUPPORTS_VARIANT} + {$ENDIF} + {$IFDEF HASCURRENCY} + {$DEFINE SUPPORTS_CURRENCY} + {$ENDIF} + {$ELSE} {$DEFINE SUPPORTS_INTERFACE} - {$ENDIF} - {$IFDEF HASVARIANT} {$DEFINE SUPPORTS_VARIANT} - {$ENDIF} + {$DEFINE SUPPORTS_CURRENCY} + {$IFEND} {$IFDEF FPC_HAS_TYPE_SINGLE} {$DEFINE SUPPORTS_SINGLE} {$ENDIF} @@ -949,9 +1705,6 @@ {$IFDEF FPC_HAS_TYPE_EXTENDED} {$DEFINE SUPPORTS_EXTENDED} {$ENDIF} - {$IFDEF HASCURRENCY} - {$DEFINE SUPPORTS_CURRENCY} - {$ENDIF} {$DEFINE SUPPORTS_THREADVAR} {$DEFINE SUPPORTS_CONSTPARAMS} {$DEFINE SUPPORTS_LONGWORD} @@ -962,15 +1715,26 @@ {$DEFINE ACCEPT_DEPRECATED} // 2.2 also gives warnings {$DEFINE ACCEPT_PLATFORM} // 2.2 also gives warnings {$DEFINE ACCEPT_LIBRARY} + {$DEFINE SUPPORTS_DEPRECATED} + {$DEFINE SUPPORTS_PLATFORM} + {$DEFINE SUPPORTS_LIBRARY} + {$DEFINE SUPPORTS_DEPRECATED_WARNINGS} + {$DEFINE SUPPORTS_PLATFORM_WARNINGS} {$DEFINE SUPPORTS_EXTSYM} {$DEFINE SUPPORTS_NODEFINE} + {$DEFINE SUPPORTS_DISPINTERFACE} + {$DEFINE SUPPORTS_IMPLEMENTS} + {$DEFINE SUPPORTS_DISPID} + {$DEFINE SUPPORTS_INLINE} + {$DEFINE SUPPORTS_STATIC} + {$DEFINE SUPPORTS_COMPILETIME_MESSAGES} {$DEFINE SUPPORTS_CUSTOMVARIANTS} {$DEFINE SUPPORTS_VARARGS} {$DEFINE SUPPORTS_ENUMVALUE} - {$IFDEF LINUX} + {$IF DEFINED(LINUX) AND DEFINED(CPU386)} {$DEFINE HAS_UNIT_LIBC} - {$ENDIF LINUX} + {$IFEND} {$DEFINE HAS_UNIT_CONTNRS} {$DEFINE HAS_UNIT_TYPES} {$DEFINE HAS_UNIT_VARIANTS} @@ -980,15 +1744,68 @@ {$DEFINE XPLATFORM_RTL} - {$IFDEF VER2_2} - {$DEFINE SUPPORTS_DISPINTERFACE} - {$DEFINE SUPPORTS_IMPLEMENTS} - {$DEFINE SUPPORTS_DISPID} + {$IF DEFINED(FPC_FULLVERSION)} + { 2.2.4 or newer } + + {$DEFINE SUPPORTS_SETPEFLAGS} + {$DEFINE SUPPORTS_STRICT} + + {$IF defined(FPC_FULLVERSION) and (FPC_FULLVERSION >= 20400)} + {$DEFINE SUPPORTS_UINT64} + {$DEFINE SUPPORTS_EXPERIMENTAL_WARNINGS} + {$DEFINE SUPPORTS_REGION} + {$DEFINE SUPPORTS_UNICODE_STRING} + {$IFEND} + + {$IF defined(FPC_FULLVERSION) and (FPC_FULLVERSION >= 20402)} + {$DEFINE SUPPORTS_FOR_IN} + {$IFEND} + + {$IF defined(FPC_FULLVERSION) and (FPC_FULLVERSION >= 20600)} + {$DEFINE SUPPORTS_LIBRARY_WARNINGS} + {$DEFINE SUPPORTS_DEPRECATED_DETAILS} + {$DEFINE SUPPORTS_NESTED_TYPES} + {$DEFINE SUPPORTS_NESTED_CONSTANTS} + {$DEFINE SUPPORTS_ENHANCED_RECORDS} // called Advanced Records in FPC + {$DEFINE SUPPORTS_CLASS_FIELDS} + {$DEFINE SUPPORTS_CLASS_HELPERS} + {$DEFINE SUPPORTS_CLASS_OPERATORS} + {$DEFINE SUPPORTS_CLASS_CTORDTORS} + {$DEFINE SUPPORTS_FINAL} + {$DEFINE SUPPORTS_CAST_INTERFACE_TO_OBJ} + + {$DEFINE HAS_ENOTIMPLEMENTED} + {$IFEND} + + {$IF defined(FPC_FULLVERSION) and (FPC_FULLVERSION >= 20602)} + {$DEFINE SUPPORTS_INT_ALIASES} + + {$DEFINE HAS_EARGUMENTEXCEPTION} + {$IFEND} + + {$IF defined(FPC_FULLVERSION) and (FPC_FULLVERSION >= 30000)} + {$DEFINE SUPPORTS_GENERICS} + {$DEFINE SUPPORTS_GENERIC_TYPES} + + {$DEFINE HAS_UNIT_CHARACTER} + {$IFEND} + + {$IF defined(FPC_FULLVERSION) and (FPC_FULLVERSION >= 30200)} + {$DEFINE SUPPORTS_GENERIC_METHODS} + {$DEFINE SUPPORTS_GENERIC_ROUTINES} + {$DEFINE SUPPORTS_WEAKPACKAGEUNIT} + + {$DEFINE HAS_UNIT_RTTI} + {$DEFINE HAS_UNIT_SYSTEM_UITYPES} + {$IFEND} {$ELSE} - {$UNDEF SUPPORTS_DISPINTERFACE} - {$UNDEF SUPPORTS_IMPLEMENTS} - {$endif} - {$UNDEF SUPPORTS_UNSAFE_WARNINGS} + { older than 2.2.4 } + + {$IFDEF VER2_2} + {$DEFINE SUPPORTS_SETPEFLAGS} + {$DEFINE SUPPORTS_STRICT} + {$ENDIF} + {$IFEND} {$ENDIF} {$ENDIF FPC} @@ -996,6 +1813,19 @@ {$DEFINE SUPPORTS_UNICODE} {$ENDIF CLR} +{$IFDEF BORLAND} + {$IFNDEF CLR} + // The ASSEMBLER symbol appeared with Delphi 7 + {$IFNDEF COMPILER7_UP} + {$DEFINE CPUASM} + {$ELSE} + {$IFDEF ASSEMBLER} + {$DEFINE CPUASM} + {$ENDIF ASSEMBLER} + {$ENDIF ~COMPILER7_UP} + {$ENDIF ~CLR} +{$ENDIF BORLAND} + {$IFDEF COMPILER1_UP} {$DEFINE SUPPORTS_CONSTPARAMS} {$DEFINE SUPPORTS_SINGLE} @@ -1039,6 +1869,8 @@ {$DEFINE SUPPORTS_LIBRARY} {$DEFINE SUPPORTS_PLATFORM} {$DEFINE SUPPORTS_LOCAL} + {$DEFINE SUPPORTS_SETPEFLAGS} + {$DEFINE SUPPORTS_EXPERIMENTAL_WARNINGS} {$DEFINE ACCEPT_DEPRECATED} {$DEFINE ACCEPT_PLATFORM} {$DEFINE ACCEPT_LIBRARY} @@ -1053,6 +1885,7 @@ {$IFDEF COMPILER7_UP} {$DEFINE SUPPORTS_UNSAFE_WARNINGS} + {$DEFINE SUPPORTS_UINT64} {$ENDIF COMPILER7_UP} {$IFDEF COMPILER9_UP} @@ -1060,6 +1893,7 @@ {$DEFINE SUPPORTS_INLINE} {$DEFINE SUPPORTS_NESTED_CONSTANTS} {$DEFINE SUPPORTS_NESTED_TYPES} + {$DEFINE SUPPORTS_REGION} {$IFDEF CLR} {$DEFINE SUPPORTS_ENHANCED_RECORDS} {$DEFINE SUPPORTS_CLASS_FIELDS} @@ -1079,23 +1913,63 @@ {$DEFINE SUPPORTS_STRICT} {$DEFINE SUPPORTS_STATIC} {$DEFINE SUPPORTS_FINAL} + {$DEFINE SUPPORTS_METHODINFO} {$ENDIF COMPILER10_UP} {$IFDEF COMPILER11_UP} {$IFDEF CLR} {$DEFINE SUPPORTS_GENERICS} + {$DEFINE SUPPORTS_GENERIC_TYPES} + {$DEFINE SUPPORTS_GENERIC_METHODS} + {$DEFINE SUPPORTS_DEPRECATED_DETAILS} {$ENDIF CLR} {$ENDIF COMPILER11_UP} {$IFDEF COMPILER12_UP} {$DEFINE SUPPORTS_GENERICS} - {$DEFINE HAS_UNIT_ANSISTRINGS} + {$DEFINE SUPPORTS_GENERIC_TYPES} + {$DEFINE SUPPORTS_GENERIC_METHODS} + {$DEFINE SUPPORTS_DEPRECATED_DETAILS} + {$DEFINE SUPPORTS_TYPED_POINTERMATH} + {$DEFINE SUPPORTS_STRINGCHECKS} + {$DEFINE SUPPORTS_INT_ALIASES} + {$DEFINE SUPPORTS_SCOPEDENUMS} {$IFNDEF CLR} {$DEFINE SUPPORTS_UNICODE} {$DEFINE SUPPORTS_UNICODE_STRING} {$ENDIF CLR} {$ENDIF COMPILER12_UP} +{$IFDEF COMPILER14_UP} + {$DEFINE SUPPORTS_CLASS_CTORDTORS} + {$DEFINE SUPPORTS_EXTENDED_RTTI} + {$DEFINE HAS_UNIT_RTTI} + {$DEFINE SUPPORTS_CAST_INTERFACE_TO_OBJ} + {$DEFINE SUPPORTS_DELAYED_LOADING} +{$ENDIF COMPILER14_UP} + +{$IFDEF COMPILER16_UP} + {$DEFINE USE_64BIT_TYPES} // TODO -oOutchy : Document in Feature Directives + {$DEFINE SUPPORTS_EXCESSPRECISION} + {$IFDEF CPU64} + {$DEFINE EXTENDED_IS_DOUBLE_ALIAS} + {$ENDIF} +{$ENDIF COMPILER16_UP} + +{$IFDEF COMPILER17_UP} + {$DEFINE SUPPORTS_LEGACYIFEND} +{$ENDIF COMPILER17_UP} + +{$IFDEF RTL130_UP} + {$DEFINE HAS_UNIT_CONTNRS} + {$IFDEF COMPILER25} + {$IFDEF LINUX} + {$UNDEF HAS_UNIT_CONTNRS} + {$ENDIF LINUX} + {$ENDIF COMPILER25} + {$DEFINE HAS_PROPERTY_OLDCREATEORDER} +{$ENDIF RTL130_UP} + {$IFDEF RTL140_UP} {$IFDEF LINUX} {$DEFINE HAS_UNIT_LIBC} @@ -1108,17 +1982,72 @@ {$DEFINE XPLATFORM_RTL} {$ENDIF RTL140_UP} -{$IFDEF RTL130_UP} - {$DEFINE HAS_UNIT_CONTNRS} -{$ENDIF RTL130_UP} +{$IFDEF RTL150_UP} + {$DEFINE HAS_UNIT_UXTHEME} +{$ENDIF RTL150_UP} + +{$IFDEF RTL170_UP} + {$DEFINE HAS_UNIT_HTTPPROD} +{$ENDIF RTL170_UP} + +{$IFDEF RTL185_UP} + {$DEFINE HAS_UNIT_GIFIMG} +{$ENDIF RTL185_UP} + +{$IFDEF RTL200_UP} + {$DEFINE HAS_UNIT_ANSISTRINGS} + {$DEFINE HAS_UNIT_PNGIMAGE} + {$DEFINE HAS_UNIT_CHARACTER} + {$DEFINE HAS_EXCEPTION_STACKTRACE} +{$ENDIF RTL200_UP} + +{$IFDEF RTL210_UP} + {$DEFINE HAS_EARGUMENTEXCEPTION} +{$ENDIF RTL210_UP} + +{$IFDEF RTL220_UP} + {$DEFINE HAS_UNIT_REGULAREXPRESSIONSAPI} + {$DEFINE HAS_ENOTIMPLEMENTED} +{$ENDIF RTL220_UP} + +{$IFDEF RTL230_UP} + {$DEFINE HAS_UNITSCOPE} + {$DEFINE HAS_UNIT_SYSTEM_UITYPES} + {$DEFINE HAS_UNIT_VCL_THEMES} + {$DEFINE HAS_UNIT_SYSTEM_ZIP} + {$DEFINE HAS_UNIT_SYSTEM_ZLIB} + {$DEFINE HAS_TSTRINGS_ENCODING} +{$ENDIF RTL230_UP} + +{$IFDEF RTL240_UP} + {$DEFINE HAS_UNIT_SYSTEM_ACTIONS} + {$DEFINE HAS_PROPERTY_STYLEELEMENTS} +{$ENDIF RTL240_UP} + +{$IFDEF RTL250_UP} + {$DEFINE DEPRECATED_SYSUTILS_ANSISTRINGS} + {$DEFINE DEPRECATED_TCHARACTER} +{$ENDIF RTL250_UP} + +{$IFDEF RTL270_UP} + {$DEFINE HAS_AUTOMATIC_DB_FIELDS} +{$ENDIF RTL270_UP} + +{$IFDEF RTL320_UP} + {$UNDEF HAS_UNIT_LIBC} +{$ENDIF RTL320_UP} + +{$IFDEF RTL350_UP} + {$UNDEF HAS_PROPERTY_OLDCREATEORDER} +{$ENDIF} {------------------------------------------------------------------------------} { Cross-platform related defines } {------------------------------------------------------------------------------} -{$IFNDEF CPU386} +{$IFNDEF CPUASM} {$DEFINE PUREPASCAL} -{$ENDIF} +{$ENDIF ~CPUASM} {$IFDEF WIN32} {$DEFINE MSWINDOWS} // predefined for D6+/BCB6+ @@ -1160,7 +2089,7 @@ {$IFDEF COMPILER2_UP} {$IFOPT J+} {$DEFINE WRITEABLECONST_ON} {$ENDIF} {$ENDIF} -{$IFOPT L+} {$DEFINE LOCALSYMBOLS} {$ENDIF} +{$IFOPT L+} {$DEFINE LOCALSYMBOLS} {$DEFINE LOCALSYMBOLS_ON} {$ENDIF} {$IFOPT M+} {$DEFINE TYPEINFO_ON} {$ENDIF} {$IFOPT O+} {$DEFINE OPTIMIZATION_ON} {$ENDIF} {$IFOPT P+} {$DEFINE OPENSTRINGS_ON} {$ENDIF} diff --git a/Ext/SynEdit/Source/SynEditKbdHandler.pas b/Ext/SynEdit/Source/SynEditKbdHandler.pas index 89c9b38..9036a0e 100644 --- a/Ext/SynEdit/Source/SynEditKbdHandler.pas +++ b/Ext/SynEdit/Source/SynEditKbdHandler.pas @@ -27,18 +27,9 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditKbdHandler.pas,v 1.10.2.1 2004/08/31 12:55:17 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITKBDHANDLER} unit SynEditKbdHandler; -{$ENDIF} {$I SynEdit.inc} @@ -55,21 +46,12 @@ interface Classes; type - { This class provides a TWinControl-Object which supports only the - needed Methods } - TKeyboardControl = class(TWinControl) - public - property OnKeyDown; - property OnKeyPress; - property OnMouseDown; - end; - TMouseCursorEvent = procedure(Sender: TObject; const aLineCharPos: TBufferCoord; var aCursor: TCursor) of object; TMethodList = class private - FData: TList; + fData: TList; function GetItem(Index: Integer): TMethod; function GetCount: Integer; public @@ -83,19 +65,19 @@ TMethodList = class TSynEditKbdHandler = class (TObject) private - FKeyPressChain: TMethodList; - FKeyDownChain: TMethodList; - FKeyUpChain: TMethodList; - FMouseDownChain: TMethodList; - FMouseUpChain: TMethodList; - FMouseCursorChain: TMethodList; + fKeyPressChain: TMethodList; + fKeyDownChain: TMethodList; + fKeyUpChain: TMethodList; + fMouseDownChain: TMethodList; + fMouseUpChain: TMethodList; + fMouseCursorChain: TMethodList; { avoid infinite recursiveness } - FInKeyPress: Boolean; - FInKeyDown: Boolean; - FInKeyUp: Boolean; - FInMouseDown: Boolean; - FInMouseUp: Boolean; - FInMouseCursor: Boolean; + fInKeyPress: Boolean; + fInKeyDown: Boolean; + fInKeyUp: Boolean; + fInMouseDown: Boolean; + fInMouseUp: Boolean; + fInMouseCursor: Boolean; public constructor Create; destructor Destroy; override; @@ -114,8 +96,8 @@ TSynEditKbdHandler = class (TObject) procedure RemoveKeyDownHandler(aHandler: TKeyEvent); procedure AddKeyUpHandler(aHandler: TKeyEvent); procedure RemoveKeyUpHandler(aHandler: TKeyEvent); - procedure AddKeyPressHandler(aHandler: TKeyPressWEvent); - procedure RemoveKeyPressHandler(aHandler: TKeyPressWEvent); + procedure AddKeyPressHandler(aHandler: TKeyPressEvent); + procedure RemoveKeyPressHandler(aHandler: TKeyPressEvent); procedure AddMouseDownHandler(aHandler: TMouseEvent); procedure RemoveMouseDownHandler(aHandler: TMouseEvent); procedure AddMouseUpHandler(aHandler: TMouseEvent); @@ -131,65 +113,65 @@ implementation procedure TSynEditKbdHandler.AddKeyDownHandler(aHandler: TKeyEvent); begin - FKeyDownChain.Add(TMethod(aHandler)); + fKeyDownChain.Add(TMethod(aHandler)); end; procedure TSynEditKbdHandler.AddKeyUpHandler(aHandler: TKeyEvent); begin - FKeyUpChain.Add(TMethod(aHandler)); + fKeyUpChain.Add(TMethod(aHandler)); end; -procedure TSynEditKbdHandler.AddKeyPressHandler(aHandler: TKeyPressWEvent); +procedure TSynEditKbdHandler.AddKeyPressHandler(aHandler: TKeyPressEvent); begin - FKeyPressChain.Add(TMethod(aHandler)); + fKeyPressChain.Add(TMethod(aHandler)); end; procedure TSynEditKbdHandler.AddMouseDownHandler(aHandler: TMouseEvent); begin - FMouseDownChain.Add(TMethod(aHandler)); + fMouseDownChain.Add(TMethod(aHandler)); end; procedure TSynEditKbdHandler.AddMouseUpHandler(aHandler: TMouseEvent); begin - FMouseUpChain.Add(TMethod(aHandler)); + fMouseUpChain.Add(TMethod(aHandler)); end; procedure TSynEditKbdHandler.AddMouseCursorHandler(aHandler: TMouseCursorEvent); begin - FMouseCursorChain.Add(TMethod(aHandler)); + fMouseCursorChain.Add(TMethod(aHandler)); end; constructor TSynEditKbdHandler.Create; begin - inherited; + inherited Create; { Elements to handle KeyDown-Events } - FKeyDownChain := TMethodList.Create; + fKeyDownChain := TMethodList.Create; { Elements to handle KeyUp-Events } - FKeyUpChain := TMethodList.Create; + fKeyUpChain := TMethodList.Create; { Elements to handle KeyPress-Events } - FKeyPressChain := TMethodList.Create; + fKeyPressChain := TMethodList.Create; { Elements to handle MouseDown Events } - FMouseDownChain := TMethodList.Create; + fMouseDownChain := TMethodList.Create; { Elements to handle MouseUp Events } - FMouseUpChain := TMethodList.Create; + fMouseUpChain := TMethodList.Create; { Elements to handle MouseCursor Events } - FMouseCursorChain := TMethodList.Create; + fMouseCursorChain := TMethodList.Create; end; destructor TSynEditKbdHandler.Destroy; begin - FKeyPressChain.Free; - FKeyDownChain.Free; - FKeyUpChain.Free; - FMouseDownChain.Free; - FMouseUpChain.Free; - FMouseCursorChain.Free; + fKeyPressChain.Free; + fKeyDownChain.Free; + fKeyUpChain.Free; + fMouseDownChain.Free; + fMouseUpChain.Free; + fMouseCursorChain.Free; inherited Destroy; end; @@ -198,24 +180,24 @@ procedure TSynEditKbdHandler.ExecuteKeyDown(Sender: TObject; var Key: Word; Shif var idx: Integer; begin - if FInKeyDown then + if fInKeyDown then Exit; - FInKeyDown := True; + fInKeyDown := True; try - with FKeyDownChain do + with fKeyDownChain do begin for idx := Count - 1 downto 0 do begin TKeyEvent(Items[idx])(Sender, Key, Shift); if (Key = 0) then begin - FInKeyDown := False; + fInKeyDown := False; Exit; end; end; end; finally - FInKeyDown := False; + fInKeyDown := False; end; end; @@ -223,24 +205,24 @@ procedure TSynEditKbdHandler.ExecuteKeyUp(Sender: TObject; var Key: Word; Shift: var idx: Integer; begin - if FInKeyUp then + if fInKeyUp then Exit; - FInKeyUp := True; + fInKeyUp := True; try - with FKeyUpChain do + with fKeyUpChain do begin for idx := Count - 1 downto 0 do begin TKeyEvent(Items[idx])(Sender,Key,Shift); if (Key = 0) then begin - FInKeyUp := False; + fInKeyUp := False; Exit; end; end; end; finally - FInKeyUp := False; + fInKeyUp := False; end; end; @@ -248,24 +230,24 @@ procedure TSynEditKbdHandler.ExecuteKeyPress(Sender: TObject; var Key: WideChar) var idx: Integer; begin - if FInKeyPress then + if fInKeyPress then Exit; - FInKeyPress := True; + fInKeyPress := True; try - with FKeyPressChain do + with fKeyPressChain do begin for idx := Count - 1 downto 0 do begin - TKeyPressWEvent(Items[idx])(Sender, Key); + TKeyPressEvent(Items[idx])(Sender, Key); if (Key = #0) then begin - FInKeyPress := False; + fInKeyPress := False; Exit; end; end; end; finally - FInKeyPress := False; + fInKeyPress := False; end; end; @@ -274,14 +256,14 @@ procedure TSynEditKbdHandler.ExecuteMouseDown(Sender: TObject; Button: TMouseBut var cHandler: Integer; begin - if FInMouseDown then + if fInMouseDown then Exit; - FInMouseDown := True; + fInMouseDown := True; try - for cHandler := FMouseDownChain.Count - 1 downto 0 do - TMouseEvent(FMouseDownChain[cHandler])(Sender, Button, Shift, X, Y); + for cHandler := fMouseDownChain.Count - 1 downto 0 do + TMouseEvent(fMouseDownChain[cHandler])(Sender, Button, Shift, X, Y); finally - FInMouseDown := False; + fInMouseDown := False; end; end; @@ -290,14 +272,14 @@ procedure TSynEditKbdHandler.ExecuteMouseUp(Sender: TObject; Button: TMouseButto var cHandler: Integer; begin - if FInMouseUp then + if fInMouseUp then Exit; - FInMouseUp := True; + fInMouseUp := True; try - for cHandler := FMouseUpChain.Count - 1 downto 0 do - TMouseEvent(FMouseUpChain[cHandler])(Sender, Button, Shift, X, Y); + for cHandler := fMouseUpChain.Count - 1 downto 0 do + TMouseEvent(fMouseUpChain[cHandler])(Sender, Button, Shift, X, Y); finally - FInMouseUp := False; + fInMouseUp := False; end; end; @@ -306,92 +288,90 @@ procedure TSynEditKbdHandler.ExecuteMouseCursor(Sender: TObject; var cHandler: Integer; begin - if FInMouseCursor then + if fInMouseCursor then Exit; - FInMouseCursor := True; + fInMouseCursor := True; try - for cHandler := FMouseCursorChain.Count - 1 downto 0 do - TMouseCursorEvent(FMouseCursorChain[cHandler])(Sender, aLineCharPos, aCursor); + for cHandler := fMouseCursorChain.Count - 1 downto 0 do + TMouseCursorEvent(fMouseCursorChain[cHandler])(Sender, aLineCharPos, aCursor); finally - FInMouseCursor := False; + fInMouseCursor := False; end; end; procedure TSynEditKbdHandler.RemoveKeyDownHandler(aHandler: TKeyEvent); begin - FKeyDownChain.Remove(TMethod(aHandler)); + fKeyDownChain.Remove(TMethod(aHandler)); end; procedure TSynEditKbdHandler.RemoveKeyUpHandler(aHandler: TKeyEvent); begin - FKeyUpChain.Remove(TMethod(aHandler)); + fKeyUpChain.Remove(TMethod(aHandler)); end; -procedure TSynEditKbdHandler.RemoveKeyPressHandler(aHandler: TKeyPressWEvent); +procedure TSynEditKbdHandler.RemoveKeyPressHandler(aHandler: TKeyPressEvent); begin - FKeyPressChain.Remove(TMethod(aHandler)); + fKeyPressChain.Remove(TMethod(aHandler)); end; procedure TSynEditKbdHandler.RemoveMouseDownHandler(aHandler: TMouseEvent); begin - FMouseDownChain.Remove(TMethod(aHandler)); + fMouseDownChain.Remove(TMethod(aHandler)); end; procedure TSynEditKbdHandler.RemoveMouseUpHandler(aHandler: TMouseEvent); begin - FMouseUpChain.Remove(TMethod(aHandler)); + fMouseUpChain.Remove(TMethod(aHandler)); end; procedure TSynEditKbdHandler.RemoveMouseCursorHandler(aHandler: TMouseCursorEvent); begin - FMouseCursorChain.Remove(TMethod(aHandler)); + fMouseCursorChain.Remove(TMethod(aHandler)); end; { TMethodList } procedure TMethodList.Add(aHandler: TMethod); begin - FData.Add(aHandler.Data); - FData.Add(aHandler.Code); + fData.Add(aHandler.Data); + fData.Add(aHandler.Code); end; constructor TMethodList.Create; begin - inherited; - - FData := TList.Create; + inherited Create; + fData := TList.Create; end; destructor TMethodList.Destroy; begin - FData.Free; - - inherited; + fData.Free; + inherited Destroy; end; function TMethodList.GetCount: Integer; begin - Result := FData.Count div 2; + Result := fData.Count div 2; end; function TMethodList.GetItem(Index: Integer): TMethod; begin Index := Index * 2; - Result.Data := FData[Index]; - Result.Code := FData[Index + 1]; + Result.Data := fData[Index]; + Result.Code := fData[Index + 1]; end; procedure TMethodList.Remove(aHandler: TMethod); var cPos: Integer; begin - cPos := FData.Count - 2; + cPos := fData.Count - 2; while cPos >= 0 do begin - if (FData.List[cPos] = aHandler.Data) and (FData.List[cPos + 1] = aHandler.Code) then + if (fData.List[cPos] = aHandler.Data) and (fData.List[cPos + 1] = aHandler.Code) then begin - FData.Delete(cPos); - FData.Delete(cPos); + fData.Delete(cPos); + fData.Delete(cPos); Exit; end; Dec(cPos, 2); diff --git a/Ext/SynEdit/Source/SynEditKeyCmdEditor.dfm b/Ext/SynEdit/Source/SynEditKeyCmdEditor.dfm index 77e5b69..67d5fcc 100644 --- a/Ext/SynEdit/Source/SynEditKeyCmdEditor.dfm +++ b/Ext/SynEdit/Source/SynEditKeyCmdEditor.dfm @@ -11,10 +11,8 @@ object SynEditKeystrokeEditorForm: TSynEditKeystrokeEditorForm Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] - OldCreateOrder = True Position = poScreenCenter OnCreate = FormCreate - OnKeyDown = FormKeyDown OnShow = FormShow PixelsPerInch = 96 TextHeight = 13 @@ -67,12 +65,11 @@ object SynEditKeystrokeEditorForm: TSynEditKeystrokeEditorForm end object cmbCommand: TComboBox Left = 65 - Top = 10 + Top = 14 Width = 186 Height = 21 + Style = csDropDownList TabOrder = 0 - OnExit = cmbCommandExit - OnKeyPress = cmbCommandKeyPress end object btnCancel: TButton Left = 177 diff --git a/Ext/SynEdit/Source/SynEditKeyCmdEditor.pas b/Ext/SynEdit/Source/SynEditKeyCmdEditor.pas index 8c4e88a..d4711a6 100644 --- a/Ext/SynEdit/Source/SynEditKeyCmdEditor.pas +++ b/Ext/SynEdit/Source/SynEditKeyCmdEditor.pas @@ -27,26 +27,16 @@ If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: SynEditKeyCmdEditor.pas,v 1.10.2.1 2004/08/31 12:55:17 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - Known Issues: -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITKEYCMDEDITOR} unit SynEditKeyCmdEditor; -{$ENDIF} {$I SynEdit.inc} interface uses - {$IFDEF SYN_COMPILER_17_UP} - UITypes, - {$ENDIF} Windows, Messages, Graphics, @@ -57,12 +47,12 @@ interface StdCtrls, ComCtrls, ExtCtrls, + SynEditTypes, SynEditKeyCmds, SynEditMiscClasses, SysUtils, Classes; - type TSynEditKeystrokeEditorForm = class(TForm) pnlAlign: TPanel; @@ -76,12 +66,8 @@ TSynEditKeystrokeEditorForm = class(TForm) procedure FormShow(Sender: TObject); procedure bntClearKeyClick(Sender: TObject); - procedure cmbCommandKeyPress(Sender: TObject; var Key: Char); - procedure cmbCommandExit(Sender: TObject); procedure btnOKClick(Sender: TObject); procedure FormCreate(Sender: TObject); - procedure FormKeyDown(Sender: TObject; var Key: Word; - Shift: TShiftState); private FExtended: Boolean; procedure SetCommand(const Value: TSynEditorCommand); @@ -107,6 +93,9 @@ implementation {$R *.dfm} +uses + UITypes; + { TSynEditKeystrokeEditorForm } procedure TSynEditKeystrokeEditorForm.SetCommand(const Value: TSynEditorCommand); @@ -122,15 +111,11 @@ procedure TSynEditKeystrokeEditorForm.SetKeystroke(const Value: TShortcut); end; procedure TSynEditKeystrokeEditorForm.FormShow(Sender: TObject); -Var i : Integer; begin if FExtended then GetEditorCommandExtended(AddEditorCommand) else GetEditorCommandValues(AddEditorCommand); - //Now add the values for quick access - for i := 0 to cmbCommand.Items.Count - 1 do - cmbCommand.Items.Objects[i] := TObject(IndexToEditorCommand(i)); if FExtended then cmbCommand.Sorted := True; end; @@ -141,22 +126,16 @@ procedure TSynEditKeystrokeEditorForm.AddEditorCommand(const S: string); end; function TSynEditKeystrokeEditorForm.GetCommand: TSynEditorCommand; -var - NewCmd: longint; begin - cmbCommand.ItemIndex := cmbCommand.Items.IndexOf(cmbCommand.Text); if cmbCommand.ItemIndex <> -1 then begin - NewCmd := TSynEditorCommand(Integer(cmbCommand.Items.Objects[cmbCommand.ItemIndex])); - end else if not IdentToEditorCommand(cmbCommand.Text, NewCmd) then - begin - try - NewCmd := StrToInt(cmbCommand.Text); - except - NewCmd := ecNone; - end; - end; - Result := NewCmd; + if FExtended then + Result := ConvertExtendedToCommand(cmbCommand.Text) + else + Result := ConvertCodeStringToCommand(cmbCommand.Text); + end + else + Result := ecNone; end; function TSynEditKeystrokeEditorForm.GetKeystroke: TShortcut; @@ -180,39 +159,6 @@ procedure TSynEditKeystrokeEditorForm.SetKeystroke2(const Value: TShortcut); hkKeystroke2.Hotkey := Value; end; -procedure TSynEditKeystrokeEditorForm.cmbCommandKeyPress(Sender: TObject; - var Key: Char); -var WorkStr : String; - i : Integer; -begin -//This would be better if componentized, but oh well... - WorkStr := AnsiUppercase(Copy(cmbCommand.Text, 1, cmbCommand.SelStart) + Key); - i := 0; - while i < cmbCommand.Items.Count do - begin - if pos(WorkStr, AnsiUppercase(cmbCommand.Items[i])) = 1 then - begin - cmbCommand.Text := cmbCommand.Items[i]; - cmbCommand.SelStart := length(WorkStr); - cmbCommand.SelLength := Length(cmbCommand.Text) - cmbCommand.SelStart; - Key := #0; - Break; - end - else - Inc(i); - end; -end; - -procedure TSynEditKeystrokeEditorForm.cmbCommandExit(Sender: TObject); -VAR TmpIndex : Integer; -begin - TmpIndex := cmbCommand.Items.IndexOf(cmbCommand.Text); - if TmpIndex = -1 then - begin - cmbCommand.ItemIndex := cmbCommand.Items.IndexOf(ConvertCodeStringToExtended('ecNone')); - end else cmbCommand.ItemIndex := TmpIndex; //need to force it incase they just typed something in -end; - procedure TSynEditKeystrokeEditorForm.btnOKClick(Sender: TObject); begin if Command = ecNone then @@ -258,12 +204,6 @@ procedure TSynEditKeystrokeEditorForm.FormCreate(Sender: TObject); end; end; -procedure TSynEditKeystrokeEditorForm.FormKeyDown(Sender: TObject; - var Key: Word; Shift: TShiftState); -begin - // if this event is not present CLX will complain -end; - end. diff --git a/Ext/SynEdit/Source/SynEditKeyCmds.pas b/Ext/SynEdit/Source/SynEditKeyCmds.pas index b0f11d0..1e283f1 100644 --- a/Ext/SynEdit/Source/SynEditKeyCmds.pas +++ b/Ext/SynEdit/Source/SynEditKeyCmds.pas @@ -27,34 +27,29 @@ If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: SynEditKeyCmds.pas,v 1.23.2.4 2008/09/14 16:24:58 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} -// TODO: introduce friendly Names for the Commands (EditorCommandStrs is not good enough for end-users) +// TODO: introduce friendly names for the Commands (EditorCommandStrs is not good enough for end-users) -{$IFNDEF QSYNEDITKEYCMDS} unit SynEditKeyCmds; -{$ENDIF} {$I SynEdit.inc} interface uses - Menus, + System.SysUtils, + System.Classes, + System.Generics.Collections, + Vcl.Menus, SynUnicode, - Classes, - SysUtils; + SynEditTypes; const //**************************************************************************** // NOTE! If you add an editor command, you must also update the // EditorCommandStrs constant array in implementation section below, or the // command will not show up in the IDE. + // //**************************************************************************** // "Editor Commands". Key strokes are translated from a table into these @@ -75,8 +70,8 @@ interface ecRight = 2; // Move cursor right one char ecUp = 3; // Move cursor up one line ecDown = 4; // Move cursor down one line - ecWordLeft = 5; // Move cursor left one Word - ecWordRight = 6; // Move cursor right one Word + ecWordLeft = 5; // Move cursor left one word + ecWordRight = 6; // Move cursor right one word ecLineStart = 7; // Move cursor to beginning of line ecLineEnd = 8; // Move cursor to end of line ecPageUp = 9; // Move cursor up one page @@ -89,11 +84,6 @@ interface ecEditorBottom = 16; // Move cursor to absolute end ecGotoXY = 17; // Move cursor to specific coordinates, Data = PPoint -//****************************************************************************** -// Maybe the command processor should just take a Boolean that signifies if -// selection is affected or not? -//****************************************************************************** - ecSelection = 100; // Add this to ecXXX command to get equivalent // command, but with selection enabled. This is not // a command itself. @@ -130,12 +120,13 @@ interface ecOverwriteMode = 222; // Set overwrite mode ecToggleMode = 223; // Toggle ins/ovr mode - ecNormalSelect = 231; // Normal selection mode - ecColumnSelect = 232; // Column selection mode - ecLineSelect = 233; // Line selection mode - ecMatchBracket = 250; // Go to matching bracket - ecCommentBlock = 251; // Comment Block + ecSelMatchBracket = 251; // Select to matching bracket + + ecCommentBlock = 260; // Comment Block + + ecNextChange = 270; // Goto next change. + ecPreviousChange = 271; // Goto previous change. ecGotoMarker0 = 301; // Goto marker ecGotoMarker1 = 302; // Goto marker @@ -158,6 +149,10 @@ interface ecSetMarker8 = 359; // Set marker, Data = PPoint - X, Y Pos ecSetMarker9 = 360; // Set marker, Data = PPoint - X, Y Pos + ecZoomIn = 401; + ecZoomOut = 402; + ecZoomReset = 403; + ecGotFocus = 480; ecLostFocus = 481; @@ -165,8 +160,8 @@ interface ecDeleteLastChar = 501; // Delete last char (i.e. backspace key) ecDeleteChar = 502; // Delete char at cursor (i.e. delete key) - ecDeleteWord = 503; // Delete from cursor to end of Word - ecDeleteLastWord = 504; // Delete from cursor to start of Word + ecDeleteWord = 503; // Delete from cursor to end of word + ecDeleteLastWord = 504; // Delete from cursor to start of word ecDeleteBOL = 505; // Delete from cursor to beginning of line ecDeleteEOL = 506; // Delete from cursor to end of line ecDeleteLine = 507; // Delete current line @@ -187,20 +182,21 @@ interface ecTab = 612; // Tab key ecShiftTab = 613; // Shift+Tab key - ecAutoCompletion = 650; - - ecUpperCase = 620; // apply to the current or previous Word + ecUpperCase = 620; // apply to the current selction or word ecLowerCase = 621; ecToggleCase = 622; ecTitleCase = 623; - ecUpperCaseBlock = 625; // apply to current selection, or current char if no selection - ecLowerCaseBlock = 626; - ecToggleCaseBlock = 627; - ecTitleCaseBlock = 628; ecString = 630; //Insert a whole string - {$IFDEF SYN_CodeFolding} + ecAutoCompletion = 650; + + ecCopyLineUp = 661; + ecCopyLineDown = 662; + ecMoveLineUp = 663; + ecMoveLineDown = 664; + + // CodeFolding ecFoldAll = 701; ecUnfoldAll = 702; ecFoldNearest = 705; @@ -211,44 +207,61 @@ interface ecUnfoldLevel1 = 721; ecUnfoldLevel2 = 722; ecUnfoldLevel3 = 723; - ecFoldRegions = 731; - ecUnfoldRegions = 732; - {$ENDIF} + ecFoldRegions = 731; + ecUnfoldRegions = 732; + + // Multi-caret + ecSelectColumn = 150; + + ecCancelSelections = 800; + ecDeleteSelections = 801; // Internal command + ecSelColumnLeft = ecLeft + ecSelectColumn; + ecSelColumnRight = ecRight + ecSelectColumn; + ecSelColumnUp = ecUp + ecSelectColumn; + ecSelColumnDown = ecDown + ecSelectColumn; + ecSelColumnPageUp = ecPageUp + ecSelectColumn; + ecSelColumnPageDown = ecPageDown + ecSelectColumn; + ecSelMatchingText = 802; + ecCaretsAtLineEnds = 803; ecUserFirst = 1001; // Start of user-defined commands type ESynKeyError = class(Exception); - TSynEditorCommand = type Word; + TSynCommandKind = (ckStandard, ckSingleCaret, ckMultiCaret); + + TSynCommandInfo = record + CommandKind: TSynCommandKind; + StoreMultiCaret: Boolean; + constructor Create(ACommandKind: TSynCommandKind; AStoreMultiCaret: Boolean); + end; TSynEditKeyStroke = class(TCollectionItem) private - FKey: Word; // Virtual keycode, i.e. VK_xxx + FKey: word; // Virtual keycode, i.e. VK_xxx FShift: TShiftState; - FKey2: Word; + FKey2: word; FShift2: TShiftState; FCommand: TSynEditorCommand; function GetShortCut: TShortCut; function GetShortCut2: TShortCut; procedure SetCommand(const Value: TSynEditorCommand); - procedure SetKey(const Value: Word); - procedure SetKey2(const Value: Word); + procedure SetKey(const Value: word); + procedure SetKey2(const Value: word); procedure SetShift(const Value: TShiftState); procedure SetShift2(const Value: TShiftState); procedure SetShortCut(const Value: TShortCut); procedure SetShortCut2(const Value: TShortCut); protected -{$IFDEF SYN_COMPILER_3_UP} function GetDisplayName: string; override; -{$ENDIF} public procedure Assign(Source: TPersistent); override; procedure LoadFromStream(AStream: TStream); procedure SaveToStream(AStream: TStream); // No duplicate checking is done if assignment made via these properties! - property Key: Word read FKey write SetKey; - property Key2: Word read FKey2 write SetKey2; + property Key: word read FKey write SetKey; + property Key2: word read FKey2 write SetKey2; property Shift: TShiftState read FShift write SetShift; property Shift2: TShiftState read FShift2 write SetShift2; published @@ -259,26 +272,20 @@ TSynEditKeyStroke = class(TCollectionItem) default 0; end; - TSynEditKeyStrokes = class(TCollection) + TSynEditKeyStrokes = class(TOwnedCollection) private - FOwner: TPersistent; function GetItem(Index: Integer): TSynEditKeyStroke; procedure SetItem(Index: Integer; Value: TSynEditKeyStroke); - protected -{$IFDEF SYN_COMPILER_3_UP} - function GetOwner: TPersistent; override; -{$ENDIF} public constructor Create(AOwner: TPersistent); function Add: TSynEditKeyStroke; procedure AddKey(const ACmd: TSynEditorCommand; const AKey: word; const AShift: TShiftState; const AKey2: word = 0; const AShift2: TShiftState = []); - procedure Assign(Source: TPersistent); override; function FindCommand(Cmd: TSynEditorCommand): Integer; - function FindKeycode(Code: Word; SS: TShiftState): Integer; - function FindKeycode2(Code1: Word; SS1: TShiftState; - Code2: Word; SS2: TShiftState): Integer; + function FindKeycode(Code: word; SS: TShiftState): Integer; + function FindKeycode2(Code1: word; SS1: TShiftState; + Code2: word; SS2: TShiftState): Integer; function FindShortcut(SC: TShortcut): Integer; function FindShortcut2(SC, SC2: TShortcut): Integer; procedure LoadFromStream(AStream: TStream); @@ -293,40 +300,32 @@ TSynEditKeyStrokes = class(TCollection) // useful elsewhere. function EditorCommandToDescrString(Cmd: TSynEditorCommand): string; function EditorCommandToCodeString(Cmd: TSynEditorCommand): string; +function EditorCommandToExtendedCodeString(Cmd: TSynEditorCommand): string; procedure GetEditorCommandValues(Proc: TGetStrProc); procedure GetEditorCommandExtended(Proc: TGetStrProc); -function IdentToEditorCommand(const Ident: string; var Cmd: longint): Boolean; -function EditorCommandToIdent(Cmd: longint; var Ident: string): Boolean; +function IdentToEditorCommand(const Ident: string; var Cmd: Integer): Boolean; +function EditorCommandToIdent(Cmd: Integer; var Ident: string): Boolean; function ConvertCodeStringToExtended(AString: string): string; function ConvertExtendedToCodeString(AString: string): string; function ConvertExtendedToCommand(AString: string): TSynEditorCommand; function ConvertCodeStringToCommand(AString: string): TSynEditorCommand; function IndexToEditorCommand(const AIndex: Integer): Integer; +// Synedit command information +var + SynCommandsInfo: TDictionary; + implementation uses - Windows, + Winapi.Windows, SynEditKeyConst, SynEditStrConst; { Command mapping routines } -{$IFDEF SYN_COMPILER_2} -// This is defined in D3/C3 and up. -type - TIdentMapEntry = record - Value: TSynEditorCommand; - Name: string; - end; -{$ENDIF} - const -{$IFDEF SYN_CodeFolding} - EditorCommandStrs: array[0..113] of TIdentMapEntry = ( -{$ELSE} - EditorCommandStrs: array[0..101] of TIdentMapEntry = ( -{$ENDIF} + EditorCommandStrs: array[0..124] of TIdentMapEntry = ( (Value: ecNone; Name: 'ecNone'), (Value: ecLeft; Name: 'ecLeft'), (Value: ecRight; Name: 'ecRight'), @@ -393,13 +392,12 @@ TIdentMapEntry = record (Value: ecTab; Name: 'ecTab'), (Value: ecShiftTab; Name: 'ecShiftTab'), (Value: ecMatchBracket; Name: 'ecMatchBracket'), + (Value: ecSelMatchBracket; Name: 'ecSelMatchBracket'), (Value: ecCommentBlock; Name: 'ecCommentBlock'), - (Value: ecNormalSelect; Name: 'ecNormalSelect'), - (Value: ecColumnSelect; Name: 'ecColumnSelect'), - (Value: ecLineSelect; Name: 'ecLineSelect'), (Value: ecAutoCompletion; Name: 'ecAutoCompletion'), - (Value: ecUserFirst; Name: 'ecUserFirst'), (Value: ecContextHelp; Name: 'ecContextHelp'), + (Value: ecNextChange; Name: 'ecNextChange'), + (Value: ecPreviousChange; Name: 'ecPrevChange'), (Value: ecGotoMarker0; Name: 'ecGotoMarker0'), (Value: ecGotoMarker1; Name: 'ecGotoMarker1'), (Value: ecGotoMarker2; Name: 'ecGotoMarker2'), @@ -420,16 +418,19 @@ TIdentMapEntry = record (Value: ecSetMarker7; Name: 'ecSetMarker7'), (Value: ecSetMarker8; Name: 'ecSetMarker8'), (Value: ecSetMarker9; Name: 'ecSetMarker9'), + (Value: ecZoomIn; Name: 'ecZoomIn'), + (Value: ecZoomOut; Name: 'ecZoomOut'), + (Value: ecZoomReset; Name: 'ecZoomReset'), (Value: ecUpperCase; Name: 'ecUpperCase'), (Value: ecLowerCase; Name: 'ecLowerCase'), (Value: ecToggleCase; Name: 'ecToggleCase'), (Value: ecTitleCase; Name: 'ecTitleCase'), - (Value: ecUpperCaseBlock; Name: 'ecUpperCaseBlock'), - (Value: ecLowerCaseBlock; Name: 'ecLowerCaseBlock'), - (Value: ecToggleCaseBlock; Name: 'ecToggleCaseBlock'), - (Value: ecTitleCaseBlock; Name: 'ecTitleCaseBlock'), -{$IFDEF SYN_CodeFolding} + (Value: ecCopyLineUp; Name:'ecCopyLineUp'), + (Value: ecCopyLineDown; Name:'ecCopyLineDown'), + (Value: ecMoveLineUp; Name:'ecMoveLineUp'), + (Value: ecMoveLineDown; Name:'ecMoveLineDown'), (Value: ecString; Name:'ecString'), + // CodeFolding (Value: ecFoldAll; Name:'ecFoldAll'), (Value: ecUnfoldAll; Name:'ecUnfoldAll'), (Value: ecFoldNearest; Name:'ecFoldNearest'), @@ -441,17 +442,31 @@ TIdentMapEntry = record (Value: ecUnfoldLevel2; Name:'ecUnfoldLevel2'), (Value: ecUnfoldLevel3; Name:'ecUnfoldLevel3'), (Value: ecFoldRegions; Name:'ecFoldRanges'), - (Value: ecUnfoldRegions; Name:'ecUnfoldRanges')); -{$ELSE} - (Value: ecString; Name:'ecString')); -{$ENDIF} - + (Value: ecUnfoldRegions; Name:'ecUnfoldRanges'), + // Multi-caret + (Value: ecCancelSelections; Name:'ecCancelSelections'), + (Value: ecSelColumnLeft; Name:'ecSelColumnLeft'), + (Value: ecSelColumnRight; Name:'ecSelColumnRight'), + (Value: ecSelColumnUp; Name:'ecSelColumnUp'), + (Value: ecSelColumnDown; Name:'ecSelColumnDown'), + (Value: ecSelColumnPageUp; Name:'ecSelColumnPageUp'), + (Value: ecSelColumnPageDown; Name:'ecSelColumnPageDown'), + (Value: ecSelMatchingText; Name:'ecSelMatchingText'), + (Value: ecCaretsAtLineEnds; Name:'ecCaretsAtLineEnds') + ); + +// GetEditorCommandValues and GetEditorCommandExtended for editing key assignments procedure GetEditorCommandValues(Proc: TGetStrProc); var i: Integer; begin for i := Low(EditorCommandStrs) to High(EditorCommandStrs) do - Proc(EditorCommandStrs[I].Name); + case EditorCommandStrs[I].Value of + ecNone, ecChar, ecString, ecImeStr, ecGotoXY, ecSelGotoXY: + ;// skip commands that cannot be used by the end-user + else + Proc(EditorCommandStrs[I].Name); + end; end; procedure GetEditorCommandExtended(Proc: TGetStrProc); @@ -459,47 +474,22 @@ procedure GetEditorCommandExtended(Proc: TGetStrProc); i: Integer; begin for i := Low(EditorCommandStrs) to High(EditorCommandStrs) do - Proc(ConvertCodeStringToExtended(EditorCommandStrs[I].Name)); + case EditorCommandStrs[I].Value of + ecNone, ecChar, ecString, ecImeStr, ecGotoXY, ecSelGotoXY: + ;// skip commands that cannot be used by the end-user + else + Proc(ConvertCodeStringToExtended(EditorCommandStrs[I].Name)); + end; end; -function IdentToEditorCommand(const Ident: string; var Cmd: longint): Boolean; -{$IFDEF SYN_COMPILER_2} -var - I: Integer; -{$ENDIF} +function IdentToEditorCommand(const Ident: string; var Cmd: Integer): Boolean; begin -{$IFDEF SYN_COMPILER_2} - Result := FALSE; - for I := Low(EditorCommandStrs) to High(EditorCommandStrs) do - if CompareText(EditorCommandStrs[I].Name, Ident) = 0 then - begin - Result := TRUE; - Cmd := EditorCommandStrs[I].Value; - Break; - end; -{$ELSE} Result := IdentToInt(Ident, Cmd, EditorCommandStrs); -{$ENDIF} end; -function EditorCommandToIdent(Cmd: longint; var Ident: string): Boolean; -{$IFDEF SYN_COMPILER_2} -var - I: Integer; -{$ENDIF} +function EditorCommandToIdent(Cmd: Integer; var Ident: string): Boolean; begin -{$IFDEF SYN_COMPILER_2} - Result := FALSE; - for I := Low(EditorCommandStrs) to High(EditorCommandStrs) do - if EditorCommandStrs[I].Value = Cmd then - begin - Result := TRUE; - Ident := EditorCommandStrs[I].Name; - Break; - end; -{$ELSE} Result := IntToIdent(Cmd, Ident, EditorCommandStrs); -{$ENDIF} end; function EditorCommandToDescrString(Cmd: TSynEditorCommand): string; @@ -514,6 +504,12 @@ function EditorCommandToCodeString(Cmd: TSynEditorCommand): string; Result := IntToStr(Cmd); end; +function EditorCommandToExtendedCodeString(Cmd: TSynEditorCommand): string; +begin + Result := ConvertCodeStringToExtended(EditorCommandToCodeString(Cmd)); +end; + + { TSynEditKeyStroke } procedure TSynEditKeyStroke.Assign(Source: TPersistent); @@ -529,20 +525,18 @@ procedure TSynEditKeyStroke.Assign(Source: TPersistent); inherited Assign(Source); end; -{$IFDEF SYN_COMPILER_3_UP} function TSynEditKeyStroke.GetDisplayName: string; begin Result := EditorCommandToCodeString(Command) + ' - ' + ShortCutToText(ShortCut); - if ShortCut <> 0 then + if ShortCut2 <> 0 then Result := Result + ' ' + ShortCutToText(ShortCut2); if Result = '' then Result := inherited GetDisplayName; end; -{$ENDIF} function TSynEditKeyStroke.GetShortCut: TShortCut; begin - Result := Menus.ShortCut(Key, Shift); + Result := Vcl.Menus.ShortCut(Key, Shift); end; procedure TSynEditKeyStroke.SetCommand(const Value: TSynEditorCommand); @@ -551,7 +545,7 @@ procedure TSynEditKeyStroke.SetCommand(const Value: TSynEditorCommand); FCommand := Value; end; -procedure TSynEditKeyStroke.SetKey(const Value: Word); +procedure TSynEditKeyStroke.SetKey(const Value: word); begin if Value <> FKey then FKey := Value; @@ -568,6 +562,7 @@ procedure TSynEditKeyStroke.SetShortCut(const Value: TShortCut); NewKey: Word; NewShift: TShiftState; Dup: Integer; + CurrCmd, DupCmd: string; begin // Duplicate values of no shortcut are OK. if Value <> 0 then @@ -575,12 +570,16 @@ procedure TSynEditKeyStroke.SetShortCut(const Value: TShortCut); // Check for duplicate shortcut in the collection and disallow if there is. Dup := TSynEditKeyStrokes(Collection).FindShortcut2(Value, ShortCut2); if (Dup <> -1) and (Dup <> Self.Index) then - begin - raise ESynKeyError.Create(SYNS_EDuplicateShortCut); - end; + begin + CurrCmd := EditorCommandToExtendedCodeString(FCommand); + DupCmd := EditorCommandToExtendedCodeString( + TSynEditKeyStrokes(Collection)[Dup].Command); + + raise ESynKeyError.CreateFmt(SYNS_EDuplicateShortCut, [CurrCmd, DupCmd]); + end; end; - Menus.ShortCutToKey(Value, NewKey, NewShift); + Vcl.Menus.ShortCutToKey(Value, NewKey, NewShift); if (NewKey <> Key) or (NewShift <> Shift) then begin @@ -589,7 +588,7 @@ procedure TSynEditKeyStroke.SetShortCut(const Value: TShortCut); end; end; -procedure TSynEditKeyStroke.SetKey2(const Value: Word); +procedure TSynEditKeyStroke.SetKey2(const Value: word); begin if Value <> FKey2 then FKey2 := Value; @@ -606,6 +605,7 @@ procedure TSynEditKeyStroke.SetShortCut2(const Value: TShortCut); NewKey: Word; NewShift: TShiftState; Dup: Integer; + CurrCmd, DupCmd: string; begin // Duplicate values of no shortcut are OK. if Value <> 0 then @@ -613,10 +613,16 @@ procedure TSynEditKeyStroke.SetShortCut2(const Value: TShortCut); // Check for duplicate shortcut in the collection and disallow if there is. Dup := TSynEditKeyStrokes(Collection).FindShortcut2(ShortCut, Value); if (Dup <> -1) and (Dup <> Self.Index) then - raise ESynKeyError.Create(SYNS_EDuplicateShortCut); + begin + CurrCmd := EditorCommandToExtendedCodeString(FCommand); + DupCmd := EditorCommandToExtendedCodeString( + TSynEditKeyStrokes(Collection)[Dup].Command); + + raise ESynKeyError.CreateFmt(SYNS_EDuplicateShortCut, [CurrCmd, DupCmd]); + end; end; - Menus.ShortCutToKey(Value, NewKey, NewShift); + Vcl.Menus.ShortCutToKey(Value, NewKey, NewShift); if (NewKey <> Key2) or (NewShift <> Shift2) then begin Key2 := NewKey; @@ -626,7 +632,7 @@ procedure TSynEditKeyStroke.SetShortCut2(const Value: TShortCut); function TSynEditKeyStroke.GetShortCut2: TShortCut; begin - Result := Menus.ShortCut(Key2, Shift2); + Result := Vcl.Menus.ShortCut(Key2, Shift2); end; procedure TSynEditKeyStroke.LoadFromStream(AStream: TStream); @@ -659,6 +665,7 @@ function TSynEditKeyStrokes.Add: TSynEditKeyStroke; Result := TSynEditKeyStroke(inherited Add); end; +//++ CodeFolding procedure TSynEditKeyStrokes.AddKey(const ACmd: TSynEditorCommand; const AKey: word; const AShift: TShiftState; const AKey2: word; const AShift2: TShiftState); var @@ -676,93 +683,76 @@ procedure TSynEditKeyStrokes.AddKey(const ACmd: TSynEditorCommand; const AKey: w raise; end; end; - -procedure TSynEditKeyStrokes.Assign(Source: TPersistent); -var - x: Integer; -begin - if Source is TSynEditKeyStrokes then - begin - Clear; - for x := 0 to TSynEditKeyStrokes(Source).Count-1 do - begin - with Add do - Assign(TSynEditKeyStrokes(Source)[x]); - end; - end - else - inherited Assign(Source); -end; +//-- CodeFolding constructor TSynEditKeyStrokes.Create(AOwner: TPersistent); begin - inherited Create(TSynEditKeyStroke); - FOwner := AOwner; + inherited Create(AOwner, TSynEditKeyStroke); end; function TSynEditKeyStrokes.FindCommand(Cmd: TSynEditorCommand): Integer; var - x: Integer; + Idx: Integer; begin Result := -1; - for x := 0 to Count-1 do - if Items[x].Command = Cmd then + for Idx := 0 to Count-1 do + if Items[Idx].Command = Cmd then begin - Result := x; + Result := Idx; Break; end; end; -function TSynEditKeyStrokes.FindKeycode(Code: Word; SS: TShiftState): Integer; +function TSynEditKeyStrokes.FindKeycode(Code: word; SS: TShiftState): Integer; var - x: Integer; + Idx: Integer; begin Result := -1; - for x := 0 to Count-1 do - if (Items[x].Key = Code) and (Items[x].Shift = SS) and (Items[x].Key2 = 0) + for Idx := 0 to Count-1 do + if (Items[Idx].Key = Code) and (Items[Idx].Shift = SS) and (Items[Idx].Key2 = 0) then begin - Result := x; + Result := Idx; Break; end; end; -function TSynEditKeyStrokes.FindKeycode2(Code1: Word; SS1: TShiftState; - Code2: Word; SS2: TShiftState): Integer; +function TSynEditKeyStrokes.FindKeycode2(Code1: word; SS1: TShiftState; + Code2: word; SS2: TShiftState): Integer; var - x: Integer; + Idx: Integer; begin Result := -1; - for x := 0 to Count-1 do - if (Items[x].Key = Code1) and (Items[x].Shift = SS1) and - (Items[x].Key2 = Code2) and (Items[x].Shift2 = SS2) then + for Idx := 0 to Count-1 do + if (Items[Idx].Key = Code1) and (Items[Idx].Shift = SS1) and + (Items[Idx].Key2 = Code2) and (Items[Idx].Shift2 = SS2) then begin - Result := x; + Result := Idx; Break; end; end; function TSynEditKeyStrokes.FindShortcut(SC: TShortcut): Integer; var - x: Integer; + Idx: Integer; begin Result := -1; - for x := 0 to Count-1 do - if Items[x].Shortcut = SC then + for Idx := 0 to Count-1 do + if Items[Idx].Shortcut = SC then begin - Result := x; + Result := Idx; Break; end; end; function TSynEditKeyStrokes.FindShortcut2(SC, SC2: TShortcut): Integer; var - x: Integer; + Idx: Integer; begin Result := -1; - for x := 0 to Count-1 do - if (Items[x].Shortcut = SC) and (Items[x].Shortcut2 = SC2) then + for Idx := 0 to Count - 1 do + if (Items[Idx].Shortcut = SC) and (Items[Idx].Shortcut2 = SC2) then begin - Result := x; + Result := Idx; Break; end; end; @@ -772,13 +762,6 @@ function TSynEditKeyStrokes.GetItem(Index: Integer): TSynEditKeyStroke; Result := TSynEditKeyStroke(inherited GetItem(Index)); end; -{$IFDEF SYN_COMPILER_3_UP} -function TSynEditKeyStrokes.GetOwner: TPersistent; -begin - Result := FOwner; -end; -{$ENDIF} - procedure TSynEditKeyStrokes.LoadFromStream(AStream: TStream); var Num: Integer; @@ -810,6 +793,7 @@ procedure TSynEditKeyStrokes.ResetDefaults; AddKey(ecSelRight, SYNEDIT_RIGHT, [ssShift]); AddKey(ecWordRight, SYNEDIT_RIGHT, [ssCtrl]); AddKey(ecSelWordRight, SYNEDIT_RIGHT, [ssShift,ssCtrl]); + AddKey(ecSelWord, Ord('W'), [ssCtrl]); AddKey(ecPageDown, SYNEDIT_NEXT, []); AddKey(ecSelPageDown, SYNEDIT_NEXT, [ssShift]); AddKey(ecPageBottom, SYNEDIT_NEXT, [ssCtrl]); @@ -832,7 +816,7 @@ procedure TSynEditKeyStrokes.ResetDefaults; AddKey(ecPaste, SYNEDIT_INSERT, [ssShift]); AddKey(ecDeleteChar, SYNEDIT_DELETE, []); AddKey(ecDeleteLastChar, SYNEDIT_BACK, []); - AddKey(ecDeleteLastChar, SYNEDIT_BACK, [ssShift]); + AddKey(ecDeleteBOL, SYNEDIT_BACK, [ssShift]); AddKey(ecDeleteLastWord, SYNEDIT_BACK, [ssCtrl]); AddKey(ecUndo, SYNEDIT_BACK, [ssAlt]); AddKey(ecRedo, SYNEDIT_BACK, [ssAlt,ssShift]); @@ -842,55 +826,73 @@ procedure TSynEditKeyStrokes.ResetDefaults; AddKey(ecShiftTab, SYNEDIT_TAB, [ssShift]); AddKey(ecContextHelp, SYNEDIT_F1, []); - AddKey(ecSelectAll, ord('A'), [ssCtrl]); - AddKey(ecCopy, ord('C'), [ssCtrl]); - AddKey(ecPaste, ord('V'), [ssCtrl]); - AddKey(ecCut, ord('X'), [ssCtrl]); - AddKey(ecBlockIndent, ord('I'), [ssCtrl,ssShift]); - AddKey(ecBlockUnindent, ord('U'), [ssCtrl,ssShift]); - AddKey(ecLineBreak, ord('M'), [ssCtrl]); - AddKey(ecInsertLine, ord('N'), [ssCtrl]); - AddKey(ecDeleteWord, ord('T'), [ssCtrl]); - AddKey(ecDeleteLine, ord('Y'), [ssCtrl]); - AddKey(ecDeleteEOL, ord('Y'), [ssCtrl,ssShift]); - AddKey(ecUndo, ord('Z'), [ssCtrl]); - AddKey(ecRedo, ord('Z'), [ssCtrl,ssShift]); - AddKey(ecGotoMarker0, ord('0'), [ssCtrl]); - AddKey(ecGotoMarker1, ord('1'), [ssCtrl]); - AddKey(ecGotoMarker2, ord('2'), [ssCtrl]); - AddKey(ecGotoMarker3, ord('3'), [ssCtrl]); - AddKey(ecGotoMarker4, ord('4'), [ssCtrl]); - AddKey(ecGotoMarker5, ord('5'), [ssCtrl]); - AddKey(ecGotoMarker6, ord('6'), [ssCtrl]); - AddKey(ecGotoMarker7, ord('7'), [ssCtrl]); - AddKey(ecGotoMarker8, ord('8'), [ssCtrl]); - AddKey(ecGotoMarker9, ord('9'), [ssCtrl]); - AddKey(ecSetMarker0, ord('0'), [ssCtrl,ssShift]); - AddKey(ecSetMarker1, ord('1'), [ssCtrl,ssShift]); - AddKey(ecSetMarker2, ord('2'), [ssCtrl,ssShift]); - AddKey(ecSetMarker3, ord('3'), [ssCtrl,ssShift]); - AddKey(ecSetMarker4, ord('4'), [ssCtrl,ssShift]); - AddKey(ecSetMarker5, ord('5'), [ssCtrl,ssShift]); - AddKey(ecSetMarker6, ord('6'), [ssCtrl,ssShift]); - AddKey(ecSetMarker7, ord('7'), [ssCtrl,ssShift]); - AddKey(ecSetMarker8, ord('8'), [ssCtrl,ssShift]); - AddKey(ecSetMarker9, ord('9'), [ssCtrl,ssShift]); - AddKey(ecNormalSelect, ord('N'), [ssCtrl,ssShift]); - AddKey(ecColumnSelect, ord('C'), [ssCtrl,ssShift]); - AddKey(ecLineSelect, ord('L'), [ssCtrl,ssShift]); - AddKey(ecMatchBracket, ord('B'), [ssCtrl,ssShift]); -{$IFDEF SYN_CodeFolding} + AddKey(ecSelectAll, Ord('A'), [ssCtrl]); + AddKey(ecCopy, Ord('C'), [ssCtrl]); + AddKey(ecPaste, Ord('V'), [ssCtrl]); + AddKey(ecCut, Ord('X'), [ssCtrl]); + AddKey(ecBlockIndent, Ord('I'), [ssCtrl,ssShift]); + AddKey(ecBlockUnindent, Ord('U'), [ssCtrl,ssShift]); + AddKey(ecLineBreak, Ord('M'), [ssCtrl]); + AddKey(ecInsertLine, Ord('N'), [ssCtrl]); + AddKey(ecDeleteWord, Ord('T'), [ssCtrl]); + AddKey(ecDeleteLine, Ord('Y'), [ssCtrl]); + AddKey(ecDeleteEOL, Ord('Y'), [ssCtrl,ssShift]); + AddKey(ecUndo, Ord('Z'), [ssCtrl]); + AddKey(ecRedo, Ord('Z'), [ssCtrl,ssShift]); + AddKey(ecNextChange, SYNEDIT_ADD, [ssCtrl,ssShift]); + AddKey(ecPreviousChange, SYNEDIT_SUBTRACT, [ssCtrl,ssShift]); + AddKey(ecGotoMarker0, Ord('0'), [ssCtrl]); + AddKey(ecGotoMarker1, Ord('1'), [ssCtrl]); + AddKey(ecGotoMarker2, Ord('2'), [ssCtrl]); + AddKey(ecGotoMarker3, Ord('3'), [ssCtrl]); + AddKey(ecGotoMarker4, Ord('4'), [ssCtrl]); + AddKey(ecGotoMarker5, Ord('5'), [ssCtrl]); + AddKey(ecGotoMarker6, Ord('6'), [ssCtrl]); + AddKey(ecGotoMarker7, Ord('7'), [ssCtrl]); + AddKey(ecGotoMarker8, Ord('8'), [ssCtrl]); + AddKey(ecGotoMarker9, Ord('9'), [ssCtrl]); + AddKey(ecSetMarker0, Ord('0'), [ssCtrl,ssShift]); + AddKey(ecSetMarker1, Ord('1'), [ssCtrl,ssShift]); + AddKey(ecSetMarker2, Ord('2'), [ssCtrl,ssShift]); + AddKey(ecSetMarker3, Ord('3'), [ssCtrl,ssShift]); + AddKey(ecSetMarker4, Ord('4'), [ssCtrl,ssShift]); + AddKey(ecSetMarker5, Ord('5'), [ssCtrl,ssShift]); + AddKey(ecSetMarker6, Ord('6'), [ssCtrl,ssShift]); + AddKey(ecSetMarker7, Ord('7'), [ssCtrl,ssShift]); + AddKey(ecSetMarker8, Ord('8'), [ssCtrl,ssShift]); + AddKey(ecSetMarker9, Ord('9'), [ssCtrl,ssShift]); + AddKey(ecZoomIn, SYNEDIT_ADD, [ssAlt]); + AddKey(ecZoomOut, SYNEDIT_SUBTRACT, [ssAlt]); + AddKey(ecZoomReset, VK_NUMPAD0, [ssAlt]); + AddKey(ecMatchBracket, VK_OEM_6, [ssCtrl]); // VK_OEM_6 is ']' in US keyboards + AddKey(ecSelMatchBracket, VK_OEM_6, [ssCtrl,ssShift]); + AddKey(ecLowerCase, Ord('K'), [ssCtrl], Ord('L'), [ssCtrl]); + AddKey(ecUpperCase, Ord('K'), [ssCtrl], Ord('U'), [ssCtrl]); + AddKey(ecTitleCase, Ord('K'), [ssCtrl], Ord('T'), [ssCtrl]); + AddKey(ecCopyLineDown, Ord('D'), [ssCtrl]); + AddKey(ecMoveLineUp, SYNEDIT_UP, [ssAlt]); + AddKey(ecMoveLineDown, SYNEDIT_DOWN, [ssAlt]); + // CodeFolding AddKey(ecFoldAll, VK_OEM_MINUS, [ssCtrl, ssShift]); {- _} AddKey(ecUnfoldAll, VK_OEM_PLUS, [ssCtrl, ssShift]); {= +} AddKey(ecFoldNearest, VK_OEM_2, [ssCtrl]); // Divide {'/'} AddKey(ecUnfoldNearest, VK_OEM_2, [ssCtrl, ssShift]); - AddKey(ecFoldLevel1, ord('K'), [ssCtrl], Ord('1'), [ssCtrl]); - AddKey(ecFoldLevel2, ord('K'), [ssCtrl], Ord('2'), [ssCtrl]); - AddKey(ecFoldLevel3, ord('K'), [ssCtrl], Ord('3'), [ssCtrl]); - AddKey(ecUnfoldLevel1, ord('K'), [ssCtrl, ssShift], Ord('1'), [ssCtrl, ssShift]); - AddKey(ecUnfoldLevel2, ord('K'), [ssCtrl, ssShift], Ord('2'), [ssCtrl, ssShift]); - AddKey(ecUnfoldLevel3, ord('K'), [ssCtrl, ssShift], Ord('3'), [ssCtrl, ssShift]); -{$ENDIF} + AddKey(ecFoldLevel1, Ord('K'), [ssCtrl], Ord('1'), [ssCtrl]); + AddKey(ecFoldLevel2, Ord('K'), [ssCtrl], Ord('2'), [ssCtrl]); + AddKey(ecFoldLevel3, Ord('K'), [ssCtrl], Ord('3'), [ssCtrl]); + AddKey(ecUnfoldLevel1, Ord('K'), [ssCtrl, ssShift], Ord('1'), [ssCtrl, ssShift]); + AddKey(ecUnfoldLevel2, Ord('K'), [ssCtrl, ssShift], Ord('2'), [ssCtrl, ssShift]); + AddKey(ecUnfoldLevel3, Ord('K'), [ssCtrl, ssShift], Ord('3'), [ssCtrl, ssShift]); + // Multi-caret + AddKey(ecCancelSelections, SYNEDIT_ESCAPE, []); + AddKey(ecSelColumnLeft, SYNEDIT_LEFT, [ssShift, ssAlt]); + AddKey(ecSelColumnRight, SYNEDIT_RIGHT, [ssShift, ssAlt]); + AddKey(ecSelColumnUp, SYNEDIT_UP, [ssShift, ssAlt]); + AddKey(ecSelColumnDown, SYNEDIT_DOWN, [ssShift, ssAlt]); + AddKey(ecSelColumnPageUp, SYNEDIT_PRIOR, [ssShift, ssAlt]); + AddKey(ecSelColumnPageDown, SYNEDIT_NEXT, [ssShift, ssAlt]); + AddKey(ecSelMatchingText, Ord('W'), [ssShift, ssCtrl]); + AddKey(ecCaretsAtLineEnds, SYNEDIT_END, [ssAlt]); end; procedure TSynEditKeyStrokes.SetItem(Index: Integer; Value: TSynEditKeyStroke); @@ -964,31 +966,31 @@ function ConvertExtendedToCodeString(AString: string): string; WorkStr := AString; - i := pos('Select All', WorkStr); - if i = 0 then + I := pos('Select All', WorkStr); + if I = 0 then begin - i := pos('Select ', WorkStr); - while i <> 0 do + I := pos('Select ', WorkStr); + while I <> 0 do begin - Delete(WorkStr,i,Length('Select ')); - Insert('Sel ',WorkStr,i); - i := pos('Select ', WorkStr); + Delete(WorkStr,I,Length('Select ')); + Insert('Sel ',WorkStr,I); + I := pos('Select ', WorkStr); end; end; - i := pos('Bookmark ', WorkStr); - while i <> 0 do + I := pos('Bookmark ', WorkStr); + while I <> 0 do begin - Delete(WorkStr,i,Length('Bookmark ')); - Insert('Marker ',WorkStr,i); - i := pos('Bookmark ', WorkStr); + Delete(WorkStr,I,Length('Bookmark ')); + Insert('Marker ',WorkStr,I); + I := pos('Bookmark ', WorkStr); end; - i := pos(' ', WorkStr); - while i <> 0 do + I := pos(' ', WorkStr); + while I <> 0 do begin - delete(WorkStr,i,1); - i := pos(' ', WorkStr); + delete(WorkStr,I,1); + I := pos(' ', WorkStr); end; Result := 'ec' + WorkStr; @@ -1011,16 +1013,159 @@ function ConvertCodeStringToCommand(AString: string): TSynEditorCommand; Result := ecNone; AString := Uppercase(AString); - for i := Low(EditorCommandStrs) to High(EditorCommandStrs) do - if Uppercase(EditorCommandStrs[i].Name) = AString then + for I := Low(EditorCommandStrs) to High(EditorCommandStrs) do + if Uppercase(EditorCommandStrs[I].Name) = AString then begin - Result := EditorCommandStrs[i].Value; + Result := EditorCommandStrs[I].Value; Break; end; end; +procedure CreateSysCommandsInfo; +begin + SynCommandsInfo := TDictionary.Create; + SynCommandsInfo.Add(ecLeft, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecRight, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecUp, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecDown, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecWordLeft, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecWordRight, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecLineStart, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecLineEnd, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecPageUp, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecPageDown, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecPageLeft, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecPageRight, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecPageTop, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecPageBottom, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecEditorTop, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecEditorBottom, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecGotoXY, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecSelLeft, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecSelRight, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecSelUp, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecSelDown, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecSelWordLeft, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecSelWordRight, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecSelLineStart, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecSelLineEnd, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecSelPageUp, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecSelPageDown, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecSelPageLeft, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecSelPageRight, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecSelPageTop, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecSelPageBottom, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecSelEditorTop, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecSelEditorBottom, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecSelGotoXY, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecSelWord, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecSelectAll, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecCopy, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecScrollUp, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecScrollDown, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecScrollLeft, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecScrollRight, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecInsertMode, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecOverwriteMode, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecToggleMode, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecMatchBracket, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecSelMatchBracket, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecCommentBlock, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecNextChange, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecPreviousChange, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecGotoMarker0, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecGotoMarker1, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecGotoMarker2, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecGotoMarker3, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecGotoMarker4, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecGotoMarker5, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecGotoMarker6, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecGotoMarker7, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecGotoMarker8, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecGotoMarker9, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSetMarker0, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSetMarker1, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSetMarker2, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSetMarker3, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSetMarker4, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSetMarker5, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSetMarker6, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSetMarker7, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSetMarker8, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSetMarker9, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecZoomIn, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecZoomOut, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecZoomReset, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecGotFocus, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecLostFocus, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecContextHelp, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecDeleteLastChar, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecDeleteChar, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecDeleteWord, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecDeleteLastWord, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecDeleteBOL, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecDeleteEOL, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecDeleteLine, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecClearAll, TSynCommandInfo.Create(ckSingleCaret, True)); + SynCommandsInfo.Add(ecLineBreak, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecInsertLine, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecChar, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecImeStr, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecUndo, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecRedo, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecCut, TSynCommandInfo.Create(ckStandard, True)); + SynCommandsInfo.Add(ecPaste, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecBlockIndent, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecBlockUnindent, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecTab, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecShiftTab, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecUpperCase, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecLowerCase, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecToggleCase, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecTitleCase, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecString, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecAutoCompletion, TSynCommandInfo.Create(ckSingleCaret, False)); + SynCommandsInfo.Add(ecCopyLineUp, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecCopyLineDown, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecMoveLineUp, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecMoveLineDown, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecFoldAll, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecUnfoldAll, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecFoldNearest, TSynCommandInfo.Create(ckMultiCaret, False)); + SynCommandsInfo.Add(ecUnfoldNearest, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecFoldLevel1, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecFoldLevel2, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecFoldLevel3, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecUnfoldLevel1, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecUnfoldLevel2, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecUnfoldLevel3, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecFoldRegions, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecUnfoldRegions, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecCancelSelections, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecDeleteSelections, TSynCommandInfo.Create(ckMultiCaret, True)); + SynCommandsInfo.Add(ecSelColumnLeft, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSelColumnRight, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSelColumnUp, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSelColumnDown, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSelColumnPageUp, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSelColumnPageDown, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecSelMatchingText, TSynCommandInfo.Create(ckStandard, False)); + SynCommandsInfo.Add(ecCaretsAtLineEnds, TSynCommandInfo.Create(ckStandard, False)); +end; + +{ TSynCommandInfo } + +constructor TSynCommandInfo.Create(ACommandKind: TSynCommandKind; + AStoreMultiCaret: Boolean); +begin + Self.CommandKind := ACommandKind; + Self.StoreMultiCaret := AStoreMultiCaret; +end; initialization RegisterIntegerConsts(TypeInfo(TSynEditorCommand), IdentToEditorCommand, EditorCommandToIdent); + CreateSysCommandsInfo; +finalization + SynCommandsInfo.Free; end. diff --git a/Ext/SynEdit/Source/SynEditKeyCmdsEditor.dfm b/Ext/SynEdit/Source/SynEditKeyCmdsEditor.dfm index 101f0a8..6be0ba2 100644 --- a/Ext/SynEdit/Source/SynEditKeyCmdsEditor.dfm +++ b/Ext/SynEdit/Source/SynEditKeyCmdsEditor.dfm @@ -11,11 +11,9 @@ object SynEditKeystrokesEditorForm: TSynEditKeystrokesEditorForm Font.Height = -11 Font.Name = 'MS Sans Serif' Font.Style = [] - OldCreateOrder = True Position = poScreenCenter OnCreate = FormCreate OnResize = FormResize - PixelsPerInch = 96 TextHeight = 13 object pnlBottom: TPanel Left = 8 diff --git a/Ext/SynEdit/Source/SynEditKeyCmdsEditor.pas b/Ext/SynEdit/Source/SynEditKeyCmdsEditor.pas index b11b1c2..599e21f 100644 --- a/Ext/SynEdit/Source/SynEditKeyCmdsEditor.pas +++ b/Ext/SynEdit/Source/SynEditKeyCmdsEditor.pas @@ -26,30 +26,15 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditKeyCmdsEditor.pas,v 1.10.2.2 2004/12/10 15:31:05 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITKEYCMDSEDITOR} unit SynEditKeyCmdsEditor; -{$ENDIF} {$I SynEdit.inc} interface uses - {$IFDEF SYN_COMPILER_15_UP} - Types, - {$ENDIF} - {$IFDEF SYN_COMPILER_17_UP} - UITypes, - {$ENDIF} Windows, Messages, Graphics, @@ -109,6 +94,8 @@ implementation {$R *.dfm} uses + Types, + UITypes, SynEditKeyCmdEditor, SynEditStrConst; @@ -122,7 +109,7 @@ constructor TSynEditKeystrokesEditorForm.Create(AOwner: TComponent); destructor TSynEditKeystrokesEditorForm.Destroy; begin - if Assigned(FKeystrokes) then FKeystrokes.Free; + if Assigned(FKeyStrokes) then FKeystrokes.Free; inherited Destroy; end; @@ -137,26 +124,26 @@ procedure TSynEditKeystrokesEditorForm.SetKeystrokes(const Value: procedure TSynEditKeystrokesEditorForm.UpdateKeystrokesList; var - x: Integer; + I: Integer; begin KeyCmdList.Items.BeginUpdate; try KeyCmdList.Items.Clear; - for x := 0 to FKeystrokes.Count-1 do + for I := 0 to FKeystrokes.Count-1 do begin with KeyCmdList.Items.Add do begin if FExtended then - Caption := ConvertCodeStringToExtended(EditorCommandToCodeString(FKeystrokes[x].Command)) - else Caption := EditorCommandToCodeString(FKeystrokes[x].Command); - if FKeystrokes[x].ShortCut = 0 then + Caption := ConvertCodeStringToExtended(EditorCommandToCodeString(FKeystrokes[I].Command)) + else Caption := EditorCommandToCodeString(FKeystrokes[I].Command); + if FKeystrokes[I].ShortCut = 0 then SubItems.Add(SYNS_ShortCutNone) else - if FKeystrokes[x].ShortCut2 = 0 then - SubItems.Add(Menus.ShortCutToText(FKeystrokes[x].ShortCut)) + if FKeystrokes[I].ShortCut2 = 0 then + SubItems.Add(Menus.ShortCutToText(FKeystrokes[I].ShortCut)) else - SubItems.Add(Menus.ShortCutToText(FKeystrokes[x].ShortCut)+ ' '+ - Menus.ShortCutToText(FKeystrokes[x].ShortCut2)); + SubItems.Add(Menus.ShortCutToText(FKeystrokes[I].ShortCut)+ ' '+ + Menus.ShortCutToText(FKeystrokes[I].ShortCut2)); end; end; finally @@ -192,10 +179,10 @@ procedure TSynEditKeystrokesEditorForm.WMGetMinMaxInfo(var Msg: TWMGetMinMaxInfo Msg.MinMaxInfo.ptMinTrackSize := Point(300, 225); end; -procedure TSynEditKeystrokesEditorForm.btnAddClick(Sender: TObject); //DDH 10/16/01 Begin (reworked proc) +procedure TSynEditKeystrokesEditorForm.btnAddClick(Sender: TObject); var NewStroke: TSynEditKeyStroke; - AForm : TSynEditKeystrokeEditorForm; + AForm: TSynEditKeystrokeEditorForm; function AddKeyStroke: Boolean; var @@ -246,7 +233,6 @@ procedure TSynEditKeystrokesEditorForm.btnAddClick(Sender: TObject); if AddKeyStroke then begin - with KeyCmdList.Items.Add do begin if FExtended then @@ -313,6 +299,21 @@ procedure TSynEditKeystrokesEditorForm.btnEditClick(Sender: TObject); // Some other kind of exception, we don't deal with it... end; end; +(* + if ShowModal = mrOK then + begin + + try + except + on ESynKeyError do + begin + // Shortcut already exists in the collection! + MessageDlg(Format(SYNS_DuplicateShortcutMsg2, + [Menus.ShortCutToText(Keystroke)]), mtError, [mbOK], 0); + end; + // Some other kind of exception, we don't deal with it... + end; +*) end; begin SelItem := KeyCmdList.Selected; @@ -355,7 +356,7 @@ procedure TSynEditKeystrokesEditorForm.btnEditClick(Sender: TObject); finally AForm.Free; end; -end; //DDH 10/16/01 End (reworked procs) +end; procedure TSynEditKeystrokesEditorForm.btnDeleteClick(Sender: TObject); var @@ -385,9 +386,7 @@ procedure TSynEditKeystrokesEditorForm.btnResetClick(Sender: TObject); procedure TSynEditKeystrokesEditorForm.FormCreate(Sender: TObject); begin - {$IFDEF SYN_COMPILER_3_UP} KeyCmdList.RowSelect := True; - {$ENDIF} end; procedure TSynEditKeystrokesEditorForm.btnOKClick(Sender: TObject); diff --git a/Ext/SynEdit/Source/SynEditKeyConst.pas b/Ext/SynEdit/Source/SynEditKeyConst.pas index 13299ac..03995b6 100644 --- a/Ext/SynEdit/Source/SynEditKeyConst.pas +++ b/Ext/SynEdit/Source/SynEditKeyConst.pas @@ -26,18 +26,9 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditKeyConst.pas,v 1.4.2.1 2004/08/31 12:55:17 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITKEYCONST} unit SynEditKeyConst; -{$ENDIF} { This unit provides a translation of DELPHI and CLX key constants to more readable SynEdit constants } diff --git a/Ext/SynEdit/Source/SynEditMiscClasses.pas b/Ext/SynEdit/Source/SynEditMiscClasses.pas index 14fc937..3d31ca5 100644 --- a/Ext/SynEdit/Source/SynEditMiscClasses.pas +++ b/Ext/SynEdit/Source/SynEditMiscClasses.pas @@ -1,104 +1,313 @@ -{------------------------------------------------------------------------------- -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: SynEditMiscClasses.pas, released 2000-04-07. -The Original Code is based on the mwSupportClasses.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Michael Hieke. -Unicode translation by Ma�l H�rz. -All Rights Reserved. - -Contributors to the SynEdit and mwEdit projects are listed in the -Contributors.txt file. - -Alternatively, the contents of this file may be used under the terms of the -GNU General Public License Version 2 or later (the "GPL"), in which case -the provisions of the GPL are applicable instead of those above. -If you wish to allow use of your version of this file only under the terms -of the GPL and not to allow others to use your version of this file -under the MPL, indicate your decision by deleting the provisions above and -replace them with the notice and other provisions required by the GPL. -If you do not delete the provisions above, a recipient may use your version -of this file under either the MPL or the GPL. - -$Id: SynEditMiscClasses.pas,v 1.35.2.9 2008/09/17 13:59:12 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -{$IFNDEF QSYNEDITMISCCLASSES} +{ ------------------------------------------------------------------------------- + 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: SynEditMiscClasses.pas, released 2000-04-07. + The Original Code is based on the mwSupportClasses.pas file from the + mwEdit component suite by Martin Waldenburg and other developers, the Initial + Author of this file is Michael Hieke. + Unicode translation by Maël Hörz. + All Rights Reserved. + + Contributors to the SynEdit and mwEdit projects are listed in the + Contributors.txt file. + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License Version 2 or later (the "GPL"), in which case + the provisions of the GPL are applicable instead of those above. + If you wish to allow use of your version of this file only under the terms + of the GPL and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the GPL. + If you do not delete the provisions above, a recipient may use your version + of this file under either the MPL or the GPL. + ------------------------------------------------------------------------------- } + unit SynEditMiscClasses; -{$ENDIF} {$I SynEdit.inc} interface uses - Consts, - Windows, - Messages, - Graphics, - Controls, - Forms, - StdCtrls, - Menus, - Registry, + System.Types, + System.UITypes, + System.SysUtils, + System.Classes, + System.Math, + System.Generics.Collections, + Winapi.Windows, + Winapi.Messages, + Winapi.D2D1, + Winapi.Wincodec, + Vcl.Consts, + Vcl.Graphics, + Vcl.Controls, + Vcl.Forms, + Vcl.StdCtrls, + Vcl.Menus, + Vcl.ImgList, + Vcl.ExtCtrls, + SynDWrite, SynEditTypes, SynEditKeyConst, - SynUnicode, -{$IFDEF SYN_COMPILER_4_UP} - Math, -{$ENDIF} - Classes, - SysUtils; + SynUnicode; type + {$REGION 'Selected Color'} TSynSelectedColor = class(TPersistent) private FBG: TColor; FFG: TColor; FOnChange: TNotifyEvent; + FOpacity: Byte; + FFillWholeLines: Boolean; procedure SetBG(Value: TColor); procedure SetFG(Value: TColor); + procedure SetOpacity(Value: Byte); + procedure SetFillWholeLines(const Value: Boolean); public constructor Create; procedure Assign(Source: TPersistent); override; + property OnChange: TNotifyEvent read FOnChange write FOnChange; published property Background: TColor read FBG write SetBG default clHighLight; property Foreground: TColor read FFG write SetFG default clHighLightText; + property Opacity: Byte read FOpacity write SetOpacity default 115; + property FillWholeLines: Boolean read FFillWholeLines write SetFillWholeLines + default True; + end; + {$ENDREGION 'Selected Color'} + + {$REGION 'Indentation Guides'} + TSynIdentGuidesStyle = (igsSolid, igsDotted); + + TSynStructureColor = class(TCollectionItem) + private + FColor: TColor; + procedure SetColor(const Value: TColor); + public + procedure Assign(Source: TPersistent); override; + published + property Color: TColor read FColor write SetColor; + end; + + TSynStructureColors = class(TOwnedCollection) + private + function GetColors(Index: Integer): TSynStructureColor; + protected + procedure Update(Item: TCollectionItem); override; + public + property Colors[Index: Integer]: TSynStructureColor read GetColors; default; + end; + + TSynIndentGuides = class(TPersistent) + private + FOwner: TPersistent; + FColor: TColor; + FVisible: Boolean; + FStyle: TSynIdentGuidesStyle; + FOnChange: TNotifyEvent; + FStructureColors: TSynStructureColors; + FStructureHighlight: Boolean; + FUseStructureColors: Boolean; + FStructuredColorsModified: Boolean; + procedure Changed; + procedure SetColor(const Value: TColor); + procedure SetVisible(const Value: Boolean); + procedure SetStyle(const Value: TSynIdentGuidesStyle); + procedure SetStructureColors(const Value: TSynStructureColors); + procedure SetUseStructureColors(const Value: Boolean); + procedure SetStructureHighlight(const Value: Boolean); + protected + function GetOwner: TPersistent; override; + public + constructor Create; overload; + constructor Create(Owner: TPersistent); overload; + destructor Destroy; override; + procedure Assign(Source: TPersistent); override; property OnChange: TNotifyEvent read FOnChange write FOnChange; + published + property Visible: Boolean read FVisible write SetVisible default True; + property Style: TSynIdentGuidesStyle read FStyle write SetStyle + default igsSolid; + property Color: TColor read FColor write SetColor + default clMedGray; + property UseStructureColors: Boolean read FUseStructureColors + write SetUseStructureColors default True; + property StructureHighlight: Boolean read FStructureHighlight + write SetStructureHighlight default True; + property StructureColors: TSynStructureColors read FStructureColors + write SetStructureColors stored FStructuredColorsModified; end; + {$ENDREGION 'Indentation Guides'} + + {$REGION 'Bands'} TSynGutterBorderStyle = (gbsNone, gbsMiddle, gbsRight); + TGutterBandPaintEvent = procedure(RT: ID2D1RenderTarget; ClipR: TRect; + const FirstRow, LastRow: Integer; var DoDefaultPainting: Boolean) of object; + + TGutterBandClickEvent = procedure(Sender: TObject; Button: TMouseButton; + X, Y, Row, Line: Integer) of object; + + TGutterBandContextPopupEvent = procedure(Sender: TObject; MousePos: TPoint; + Row, Line: Integer; var Handled: Boolean) of object; + + TGutterMouseCursorEvent = procedure(Sender: TObject; X, Y, Row, Line: Integer; + var Cursor: TCursor) of object; + + TSynGutter = class; + + { When created TGutter contains four bands (Marks, Line Numbers, + Code Folding and Margin). The order, width and other properties of the + bands can be set at design time through the Bands property of TSynGutter. + Custom bands can also be created. They can be painted using + OnPaintLines event handler. + The width of the Line Numbers and Code Folding band is automatically + calculated and not set at design time } + TSynGutterBandKind = (gbkCustom, gbkMarks, gbkLineNumbers, gbkFold, gbkMargin, + gbkTrackChanges); + TSynGutterBandBackground = (gbbNone, gbbGutter, gbbEditor); + + TSynTrackChanges = class(TPersistent) + private + FOwner: TSynGutter; + FVisible: Boolean; + FSavedColor: TColor; + FModifiedColor: TColor; + FSavedModifiedColor: TColor; + FOriginalColor: TColor; + FWidth: Integer; + procedure SetModifiedColor(const Value: TColor); + procedure SetOriginalColor(const Value: TColor); + procedure SetSavedColor(const Value: TColor); + procedure SetSavedModifiedColor(const Value: TColor); + procedure SetVisible(const Value: Boolean); + procedure SetWidth(const Value: Integer); + protected + function GetOwner: TPersistent; override; + public + constructor Create(Gutter: TSynGutter); + procedure Assign(Source: TPersistent); override; + published + property Width: Integer read FWidth write SetWidth default 4; + property Visible: Boolean read FVisible write SetVisible default False; + property SavedColor: TColor read FSavedColor write SetSavedColor + default $0033AA33; + property ModifiedColor: TColor read FModifiedColor write SetModifiedColor + default $0000DFFF; + property SavedModifiedColor: TColor read FSavedModifiedColor + write SetSavedModifiedColor default clWebOrange; + property OriginalColor: TColor read FOriginalColor write SetOriginalColor + default $FF6633; + end; + + TSynGutterBand = class(TCollectionItem) + public const + MarginX = 2; + private + FKind: TSynGutterBandKind; + FVisible: Boolean; + FWidth: Integer; + FBackground: TSynGutterBandBackground; + FOnPaintLines: TGutterBandPaintEvent; + FOnClick: TGutterBandClickEvent; + FOnContextPopup: TGutterBandContextPopupEvent; + FOnMouseCursor: TGutterMouseCursorEvent; + function GetSynGutter: TSynGutter; + function GetEditor: TComponent; + procedure DoPaintLines(RT: ID2D1RenderTarget; ClipR: TRect; const FirstRow, + LastRow: Integer); + procedure PaintMarks(RT: ID2D1RenderTarget; ClipR: TRect; + const FirstRow, LastRow: Integer); + procedure PaintLineNumbers(RT: ID2D1RenderTarget; ClipR: TRect; + const FirstRow, LastRow: Integer); + procedure PaintFoldShapes(RT: ID2D1RenderTarget; ClipR: TRect; + const FirstRow, LastRow: Integer); + procedure PaintMargin(RT: ID2D1RenderTarget; ClipR: TRect; + const FirstRow, LastRow: Integer); + procedure PaintTrackChanges(RT: ID2D1RenderTarget; ClipR: TRect; + const FirstRow, LastRow: Integer); + procedure SetBackground(const Value: TSynGutterBandBackground); + procedure SetVisible(const Value: Boolean); + procedure SetWidth(const Value: Integer); + procedure SetKind(Kind: TSynGutterBandKind); + procedure SetOnPaintLines(const Value: TGutterBandPaintEvent); + function IsWidthStored: Boolean; + function GetWidth: Integer; + function GetVisible: Boolean; + function GetLeftX: Integer; + function FoldShapeRect(Row, Line: Integer): TRect; + function IsVisibleStored: Boolean; + protected + function GetDisplayName: string; override; + public + constructor Create(Collection: TCollection); override; + procedure Assign(Source: TPersistent); override; + function RealWidth: Integer; + procedure PaintLines(RT: ID2D1RenderTarget; ClipR: TRect; const FirstRow, LastRow: + Integer); + procedure DoClick(Sender: TObject; Button: TMouseButton; + X, Y, Row, Line: Integer); + procedure DoMouseCursor(Sender: TObject; X, Y, Row, Line: Integer; + var Cursor: TCursor); + property LeftX: Integer read GetLeftX; + property Editor: TComponent read GetEditor; + property Gutter: TSynGutter read GetSynGutter; + published + property Kind: TSynGutterBandKind read FKind write SetKind; + property Visible: Boolean read GetVisible write SetVisible + stored IsVisibleStored; + property Width: Integer read GetWidth write SetWidth stored IsWidthStored; + property Background: TSynGutterBandBackground read FBackground + write SetBackground default gbbGutter; + property OnPaintLines: TGutterBandPaintEvent read FOnPaintLines + write SetOnPaintLines; + property OnCLick: TGutterBandClickEvent read FOnClick write FOnClick; + property OnContextPopup: TGutterBandContextPopupEvent + read FOnContextPopup write FOnContextPopup; + property OnMouseCursor: TGutterMouseCursorEvent read FOnMouseCursor + write FOnMouseCursor; + end; + + TSynBandsCollection = class(TOwnedCollection) + private + function GetBands(Index: Integer): TSynGutterBand; + protected + procedure Update(Item: TCollectionItem); override; + public + property Bands[Index: Integer]: TSynGutterBand read GetBands; default; + end; + {$ENDREGION 'Bands'} + + TSynInternalImage = class; + + {$REGION 'TSynGutter'} TSynGutter = class(TPersistent) private + FOwner: TPersistent; // Synedit + FUpdateCount: Integer; + FCurrentPPI: Integer; FFont: TFont; + FCharWidth: Integer; FColor: TColor; FBorderColor: TColor; - FWidth: Integer; - FShowLineNumbers: Boolean; - FShowModification: Boolean; + FWidth: Integer; //Ethea: Backward compatibility FDigitCount: Integer; FLeadingZeros: Boolean; FZeroStart: Boolean; - FLeftOffset: Integer; - FRightOffset: Integer; - FRightMargin: integer; FOnChange: TNotifyEvent; FCursor: TCursor; FVisible: Boolean; + FShowLineNumbers: Boolean; FUseFontStyle: Boolean; FAutoSize: Boolean; FAutoSizeDigitCount: Integer; @@ -108,91 +317,90 @@ TSynGutter = class(TPersistent) FGradientStartColor: TColor; FGradientEndColor: TColor; FGradientSteps: Integer; - FModificationBarWidth: Integer; - FModificationColorModified: TColor; - FModificationColorSaved: TColor; + FInternalImage: TSynInternalImage; + FTrackChanges: TSynTrackChanges; + FBands: TSynBandsCollection; + FTextFormat: TSynTextFormat; procedure SetAutoSize(const Value: Boolean); procedure SetBorderColor(const Value: TColor); procedure SetColor(const Value: TColor); procedure SetDigitCount(Value: Integer); procedure SetLeadingZeros(const Value: Boolean); - procedure SetLeftOffset(Value: Integer); - procedure SetRightOffset(Value: Integer); - procedure SetRightMargin(Value: integer); procedure SetShowLineNumbers(const Value: Boolean); - procedure SetShowModification(const Value: Boolean); procedure SetUseFontStyle(Value: Boolean); procedure SetVisible(Value: Boolean); - procedure SetWidth(Value: Integer); procedure SetZeroStart(const Value: Boolean); procedure SetFont(Value: TFont); - procedure OnFontChange(Sender: TObject); + procedure FontChanged(Sender: TObject); procedure SetBorderStyle(const Value: TSynGutterBorderStyle); procedure SetLineNumberStart(const Value: Integer); procedure SetGradient(const Value: Boolean); procedure SetGradientStartColor(const Value: TColor); procedure SetGradientEndColor(const Value: TColor); procedure SetGradientSteps(const Value: Integer); - function GetWidth: Integer; - procedure SetModificationColorModified(const Value: TColor); - procedure SetModificationColorSaved(const Value: TColor); - procedure SetModificationBarWidth(const Value: Integer); + procedure SetBands(const Value: TSynBandsCollection); + function GetInternalImage: TSynInternalImage; + function GetBandByKind(Kind: TSynGutterBandKind): TSynGutterBand; + procedure Changed; + protected + function GetOwner: TPersistent; override; public - constructor Create; + AssignableBands: Boolean; + constructor Create; overload; + constructor Create(Owner: TPersistent); overload; destructor Destroy; override; procedure Assign(Source: TPersistent); override; - procedure AutoSizeDigitCount(LinesCount: Integer); + procedure BeginUpdate; + procedure EndUpdate; + procedure AutoSizeDigitCount; function FormatLineNumber(Line: Integer): string; - function RealGutterWidth(CharWidth: Integer): Integer; -//++ DPI-Aware + function RealGutterWidth: Integer; + function BandAtX(X: Integer): TSynGutterBand; + // ++ DPI-Aware procedure ChangeScale(M, D: Integer); virtual; -//-- DPI-Aware + // -- DPI-Aware + property InternalImage: TSynInternalImage read GetInternalImage; + // Band returns the first band of a given kind + property Band[Kind: TSynGutterBandKind]: TSynGutterBand read GetBandByKind; published - property AutoSize: Boolean read FAutoSize write SetAutoSize default FALSE; + property AutoSize: Boolean read FAutoSize write SetAutoSize default True; property BorderStyle: TSynGutterBorderStyle read FBorderStyle write SetBorderStyle default gbsMiddle; property Color: TColor read FColor write SetColor default clBtnFace; - property BorderColor: TColor read FBorderColor write SetBorderColor default clWindow; + property BorderColor: TColor read FBorderColor write SetBorderColor + default clWindow; property Cursor: TCursor read FCursor write FCursor default crDefault; - property DigitCount: Integer read FDigitCount write SetDigitCount - default 4; + property DigitCount: Integer read FDigitCount write SetDigitCount default 4; property Font: TFont read FFont write SetFont; - property LeadingZeros: Boolean read FLeadingZeros write SetLeadingZeros - default FALSE; - property LeftOffset: Integer read FLeftOffset write SetLeftOffset - default 16; - property ModificationBarWidth: Integer read FModificationBarWidth - write SetModificationBarWidth default 4; - property ModificationColorModified: TColor read FModificationColorModified - write SetModificationColorModified default clYellow; - property ModificationColorSaved: TColor read FModificationColorSaved - write SetModificationColorSaved default clLime; - property RightOffset: Integer read FRightOffset write SetRightOffset - default 2; - property RightMargin: integer read FRightMargin write SetRightMargin - default 2; property ShowLineNumbers: Boolean read FShowLineNumbers - write SetShowLineNumbers default FALSE; - property ShowModification: Boolean read FShowModification - write SetShowModification default FALSE; + write SetShowLineNumbers default False; + property LeadingZeros: Boolean read FLeadingZeros write SetLeadingZeros + default False; property UseFontStyle: Boolean read FUseFontStyle write SetUseFontStyle default True; - property Visible: Boolean read FVisible write SetVisible default TRUE; - property Width: Integer read GetWidth write SetWidth default 30; + property Visible: Boolean read FVisible write SetVisible default True; + property Width: Integer read FWidth write FWidth; //Ethea: Backward compatibility property ZeroStart: Boolean read FZeroStart write SetZeroStart default False; - property LineNumberStart: Integer read FLineNumberStart write SetLineNumberStart default 1; + property LineNumberStart: Integer read FLineNumberStart + write SetLineNumberStart default 1; property Gradient: Boolean read FGradient write SetGradient default False; - property GradientStartColor: TColor read FGradientStartColor write SetGradientStartColor default clWindow; - property GradientEndColor: TColor read FGradientEndColor write SetGradientEndColor default clBtnFace; - property GradientSteps: Integer read FGradientSteps write SetGradientSteps default 48; - + property GradientStartColor: TColor read FGradientStartColor + write SetGradientStartColor default clWindow; + property GradientEndColor: TColor read FGradientEndColor + write SetGradientEndColor default clBtnFace; + property GradientSteps: Integer read FGradientSteps write SetGradientSteps + default 48; + property TrackChanges: TSynTrackChanges read FTrackChanges + write FTrackChanges; + property Bands: TSynBandsCollection read FBands write SetBands; property OnChange: TNotifyEvent read FOnChange write FOnChange; end; + {$ENDREGION 'TSynGutter'} TSynBookMarkOpt = class(TPersistent) private - FBookmarkImages: TImageList; + FBookmarkImages: TCustomImageList; FDrawBookmarksFirst: Boolean; FEnableKeys: Boolean; FGlyphsVisible: Boolean; @@ -200,7 +408,7 @@ TSynBookMarkOpt = class(TPersistent) FOwner: TComponent; FXoffset: Integer; FOnChange: TNotifyEvent; - procedure SetBookmarkImages(const Value: TImageList); + procedure SetBookmarkImages(const Value: TCustomImageList); procedure SetDrawBookmarksFirst(Value: Boolean); procedure SetGlyphsVisible(Value: Boolean); procedure SetLeftMargin(Value: Integer); @@ -208,58 +416,54 @@ TSynBookMarkOpt = class(TPersistent) public constructor Create(AOwner: TComponent); procedure Assign(Source: TPersistent); override; -//++ DPI-Aware procedure ChangeScale(M, D: Integer); virtual; -//-- DPI-Aware published - property BookmarkImages: TImageList - read FBookmarkImages write SetBookmarkImages; + property BookmarkImages: TCustomImageList read FBookmarkImages + write SetBookmarkImages; property DrawBookmarksFirst: Boolean read FDrawBookmarksFirst write SetDrawBookmarksFirst default True; - property EnableKeys: Boolean - read FEnableKeys write FEnableKeys default True; - property GlyphsVisible: Boolean - read FGlyphsVisible write SetGlyphsVisible default True; + property EnableKeys: Boolean read FEnableKeys write FEnableKeys + default True; + property GlyphsVisible: Boolean read FGlyphsVisible write SetGlyphsVisible + default True; property LeftMargin: Integer read FLeftMargin write SetLeftMargin default 2; - property XOffset: Integer read FXoffset write SetXOffset default 12; - + property Xoffset: Integer read FXoffset write SetXOffset default 12; property OnChange: TNotifyEvent read FOnChange write FOnChange; end; + /// + /// Encapsulates a bitmap that is either loaded from resources or assigned. + /// + /// + /// Used for the word wrap glyph painted in the Gutter. + /// TSynGlyph = class(TPersistent) private FVisible: Boolean; FInternalGlyph, FGlyph: TBitmap; - FInternalMaskColor, FMaskColor: TColor; + FPPI: Cardinal; FOnChange: TNotifyEvent; procedure SetGlyph(Value: TBitmap); - procedure GlyphChange(Sender: TObject); - procedure SetMaskColor(Value: TColor); + procedure Changed; procedure SetVisible(Value: Boolean); - function GetWidth : Integer; - function GetHeight : Integer; + function GetSize: TSize; public - constructor Create(aModule: THandle; const aName: string; aMaskColor: TColor); + constructor Create(aModule: THandle; const aName: string); destructor Destroy; override; procedure Assign(aSource: TPersistent); override; - procedure Draw(aCanvas: TCanvas; aX, aY, aLineHeight: Integer); - property Width : Integer read GetWidth; - property Height : Integer read GetHeight; -//++ DPI-Aware procedure ChangeScale(M, D: Integer); virtual; -//-- DPI-Aware + function D2D1Bitmap(RT: ID2D1RenderTarget): ID2D1Bitmap; published property Glyph: TBitmap read FGlyph write SetGlyph; - property MaskColor: TColor read FMaskColor write SetMaskColor default clNone; property Visible: Boolean read FVisible write SetVisible default True; - + property Size: TSize read GetSize; property OnChange: TNotifyEvent read FOnChange write FOnChange; end; { TSynMethodChain } ESynMethodChain = class(Exception); - TSynExceptionEvent = procedure (Sender: TObject; E: Exception; + TSynExceptionEvent = procedure(Sender: TObject; E: Exception; var DoContinue: Boolean) of object; TSynMethodChain = class(TObject) @@ -296,28 +500,27 @@ TSynNotifyEventChain = class(TSynMethodChain) { TSynInternalImage } + /// + /// Manages a bitmap containing many glyphs and loaded from resources + /// + /// + /// Used for the bookmark images + /// TSynInternalImage = class(TObject) private - FImages : TBitmap; - FWidth : Integer; - FHeight : Integer; - FCount : Integer; - - function CreateBitmapFromInternalList(aModule: THandle; const Name: string): TBitmap; - procedure FreeBitmapFromInternalList; + FImages: TBitmap; + FWidth: Integer; + FHeight: Integer; + FPPI: Integer; + FCount: Integer; public constructor Create(aModule: THandle; const Name: string; Count: Integer); destructor Destroy; override; - - procedure Draw(ACanvas: TCanvas; Number, X, Y, LineHeight: Integer); overload; - procedure DrawTransparent(ACanvas: TCanvas; Number, X, Y, - LineHeight: Integer; TransparentColor: TColor); overload; -//++ DPI-Aware + procedure Draw(RT: ID2D1RenderTarget; Number, X, Y, LineHeight: Integer); procedure ChangeScale(M, D: Integer); virtual; -//-- DPI-Aware end; -{ TSynHotKey } + {$REGION 'TSynHotKey'} const BorderWidth = 0; @@ -327,8 +530,8 @@ TSynInternalImage = class(TObject) THKModifier = (hkShift, hkCtrl, hkAlt); THKModifiers = set of THKModifier; - THKInvalidKey = (hcNone, hcShift, hcCtrl, hcAlt, hcShiftCtrl, - hcShiftAlt, hcCtrlAlt, hcShiftCtrlAlt); + THKInvalidKey = (hcNone, hcShift, hcCtrl, hcAlt, hcShiftCtrl, hcShiftAlt, + hcCtrlAlt, hcShiftCtrlAlt); THKInvalidKeys = set of THKInvalidKey; TSynHotKey = class(TCustomControl) @@ -343,159 +546,434 @@ TSynHotKey = class(TCustomControl) procedure SetInvalidKeys(const Value: THKInvalidKeys); procedure SetModifiers(const Value: THKModifiers); procedure WMGetDlgCode(var Message: TMessage); message WM_GETDLGCODE; - procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS; + procedure WMKillFocus(var Msg: TWMKillFocus); message WM_KILLFOCUS; procedure WMSetFocus(var Msg: TWMSetFocus); message WM_SETFOCUS; protected + procedure CreateParams(var Params: TCreateParams); override; procedure DoExit; override; procedure KeyDown(var Key: Word; Shift: TShiftState); override; procedure KeyUp(var Key: Word; Shift: TShiftState); override; - procedure MouseDown(Button: TMouseButton; Shift: TShiftState; X, Y: Integer); override; + procedure MouseDown(Button: TMouseButton; Shift: TShiftState; + X, Y: Integer); override; procedure Paint; override; - procedure CreateParams(var Params: TCreateParams); override; public constructor Create(AOwner: TComponent); override; published + property Font; + property Color; property BorderStyle: TSynBorderStyle read FBorderStyle write SetBorderStyle default bsSingle; - property HotKey: TShortCut read FHotKey write SetHotKey default $0041; { Alt+A } - property InvalidKeys: THKInvalidKeys read FInvalidKeys write SetInvalidKeys default [hcNone, hcShift]; - property Modifiers: THKModifiers read FModifiers write SetModifiers default [hkAlt]; + property HotKey: TShortCut read FHotKey write SetHotKey + default $0041; { Alt+A } + property InvalidKeys: THKInvalidKeys read FInvalidKeys write SetInvalidKeys + default [hcNone, hcShift]; + property Modifiers: THKModifiers read FModifiers write SetModifiers + default [hkAlt]; end; + {$ENDREGION 'TSynHotKey'} + + {$REGION 'TSynEditSearchCustom'} + + TSynIsWordBreakFunction = function(C: WideChar): Boolean of object; TSynEditSearchCustom = class(TComponent) protected - function GetPattern: UnicodeString; virtual; abstract; - procedure SetPattern(const Value: UnicodeString); virtual; abstract; + FIsWordBreakFunction: TSynIsWordBreakFunction; + function GetPattern: string; virtual; abstract; + procedure SetPattern(const Value: string); virtual; abstract; function GetLength(Index: Integer): Integer; virtual; abstract; function GetResult(Index: Integer): Integer; virtual; abstract; function GetResultCount: Integer; virtual; abstract; procedure SetOptions(const Value: TSynSearchOptions); virtual; abstract; public - function FindAll(const NewText: UnicodeString): Integer; virtual; abstract; - function Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; virtual; abstract; - property Pattern: UnicodeString read GetPattern write SetPattern; + // This is the main public routine of search engines. + // Given a NewText (typically a line) it calculates all matches from + // StartChar to EndChar. The matches are stored left-to right. + // EndChar = 0 is equivalent to EndChar = Length(NewText) + 1 + function FindAll(const NewText: string; StartChar: Integer = 1; + EndChar: Integer = 0): Integer; virtual; abstract; + function PreprocessReplaceExpression(const AReplace: string): string; virtual; + function Replace(const aOccurrence, aReplacement: string): string; + virtual; abstract; + property Pattern: string read GetPattern write SetPattern; property ResultCount: Integer read GetResultCount; property Results[Index: Integer]: Integer read GetResult; property Lengths[Index: Integer]: Integer read GetLength; property Options: TSynSearchOptions write SetOptions; + property IsWordBreakFunction: TSynIsWordBreakFunction write FIsWordBreakFunction; end; - {$IFNDEF SYN_COMPILER_4_UP} - TBetterRegistry = class(TRegistry) - function OpenKeyReadOnly(const Key: string): Boolean; + {$ENDREGION 'TSynEditSearchCustom'} + + {$REGION 'Indicators'} + + TSynIndicatorStyle = (sisTextDecoration, sisSquiggleMicrosoftWord, + sisSquiggleWordPerfect, sisRectangle, sisFilledRectangle, + sisRoundedRectangle, sisRoundedFilledRectangle); + + TSynIndicatorSpec = record + Style: TSynIndicatorStyle; + Foreground, + Background: TD2D1ColorF; + FontStyle: TFontStyles; + constructor Create(AStyle: TSynIndicatorStyle; AForeground, ABackground: TD2D1ColorF; + AFontStyle: TFontStyles); + class function New(AStyle: TSynIndicatorStyle; AForeground, ABackground: TD2D1ColorF; + AFontStyle: TFontStyles): TSynIndicatorSpec; static; end; - {$ELSE} - TBetterRegistry = TRegistry; - {$ENDIF} -//++ DPI-Aware - procedure ResizeBitmap(Bitmap: TBitmap; const NewWidth, - NewHeight: integer); -//-- DPI-Aware + TSynIndicator = record + Id: TGUID; + CharStart, CharEnd: Integer; + Tag: NativeInt; // for storing user data + constructor Create(aId: TGUID; aCharStart, aCharEnd: Integer; aTag: NativeInt = 0); + class function New(aId: TGUID; aCharStart, aCharEnd: Integer; aTag: NativeInt = 0): TSynIndicator; static; + class operator Equal(const A, B: TSynIndicator): Boolean; + end; + TSynIndicators = class + private + FOwner: TCustomControl; + FRegister: TDictionary; + FList: TDictionary>; + procedure InvalidateIndicator(Line: Integer; const Indicator: TSynIndicator); + public + constructor Create(Owner: TCustomControl); + destructor Destroy; override; + procedure RegisterSpec(Id: TGUID; Spec: TSynIndicatorSpec); + function GetSpec(Id: TGUID): TSynIndicatorSpec; + procedure Add(Line: Integer; const Indicator: TSynIndicator; Invalidate: Boolean = True); + // Clears all indicators + procedure Clear; overload; + // Clears all indicators with a given Id + procedure Clear(Id: TGUID; Invalidate: Boolean = True; Line: Integer = -1); + overload; + // Clears just one indicator + procedure Clear(Line: Integer; const Indicator: TSynIndicator); overload; + // Returns the indicators of a given line + function LineIndicators(Line: Integer): TArray; + // Return the indicator at a given buffer or window position + function IndicatorAtPos(Pos: TBufferCoord; const Id: TGUID; var Indicator: + TSynIndicator): Boolean; overload; + function IndicatorAtPos(Pos: TBufferCoord; var Indicator: TSynIndicator): Boolean; overload; + function IndicatorAtMousePos(MousePos: TPoint; const Id: TGUID; var Indicator: TSynIndicator): Boolean; overload; + function IndicatorAtMousePos(MousePos: TPoint; var Indicator: TSynIndicator): Boolean; overload; + // Should only used by Synedit + procedure LinesInserted(FirstLine, Count: Integer); + procedure LinesDeleted(FirstLine, Count: Integer); + procedure LinePut(aIndex: Integer); + class procedure Paint(RT: ID2D1RenderTarget; Spec: TSynIndicatorSpec; const + ClipR: TRect; StartOffset: Integer); + end; + {$ENDREGION 'TSynIndicators'} -implementation + {$REGION 'TSynBracketsHighlight'} -uses - SynEditMiscProcs; + TSynBracketsHighlight = class + public + const MatchingBracketsIndicatorID: TGUID = '{EC19D246-8F03-42FE-BDFB-A11F3E60B00B}'; + const UnbalancedBracketIndicatorID: TGUID = '{259B198E-9963-4BA3-BDC7-34BA12F3CB10}'; + private + FOwner: TPersistent; + public + constructor Create(Owner: TPersistent); + procedure SetFontColorsAndStyle(const MatchingBracketsColor, + UnbalancedBracketColor: TColor; FontStyle: TFontStyles); + // SetIndicatorSpecs provides more painting options + procedure SetIndicatorSpecs(const MatchingBracketsSpec, + UnbalancedBracketSpec: TSynIndicatorSpec); + end; -//++ DPI-Aware -procedure ResizeBitmap(Bitmap: TBitmap; const NewWidth, - NewHeight: integer); -var - buffer: TBitmap; -begin - buffer := TBitmap.Create; - try - {$IFDEF SYN_COMPILER_12_UP} - buffer.SetSize(NewWidth, NewHeight); - {$ELSE} - buffer.Width := NewWidth; - buffer.Height := NewHeight; - {$ENDIF} - buffer.Canvas.StretchDraw(Rect(0, 0, NewWidth, NewHeight), Bitmap); - {$IFDEF SYN_COMPILER_12_UP} - buffer.SetSize(NewWidth, NewHeight); - {$ELSE} - buffer.Width := NewWidth; - buffer.Height := NewHeight; - {$ENDIF} - Bitmap.Canvas.Draw(0, 0, buffer); - finally - buffer.Free; + {$ENDREGION 'TSynBracketsHighlight'} + + {$REGION 'TSynCarets'} + + TSynSelections = class; + + TSynCarets = class + private + FCaretsShown: Boolean; + FBlinkTimer: TTimer; + FCanvas: TCanvas; + procedure Blink(Sender: TObject); + procedure InvertCarets; + public + CaretSize: Integer; // is DPI scaled + Shape: TCaretShape; + CaretRects: TList; + constructor Create(Canvas: TCanvas); + destructor Destroy; override; + procedure HideCarets; + procedure ShowCarets; + end; + + {$ENDREGION 'TSynCarets'} + + {$REGION 'TSynSelections'} + + TSynSelStorage = record + Selections: TArray; + BaseIndex, ActiveIndex :Integer; + procedure Clear; + end; + + // Keeps the selections and is responsible for showing the carets + TSynSelections = class + private + FOwner: TPersistent; + FSelections: TList; + FBaseSelIndex: Integer; + FActiveSelIndex: Integer; + function GetCount: Integer; + function GetActiveSelection: TSynSelection; + function GetBaseSelection: TSynSelection; + procedure SetActiveSelection(const Value: TSynSelection); + procedure SetBaseSelection(const Value: TSynSelection); + function GetSelection(Index: Integer): TSynSelection; + procedure SetActiveSelIndex(const Index: Integer); + procedure CaretsChanged; + function GetIsEmpty: Boolean; + public + type + TKeepSelection = (ksKeepBase, ksKeepActive); + constructor Create(Owner: TPersistent); + destructor Destroy; override; + procedure Clear(KeepSelection: TKeepSelection = ksKeepActive); + function AddCaret(const ACaret: TBufferCoord; IsBase: Boolean = False): Boolean; + procedure DeleteSelection(Index: Integer); + function FindCaret(const ACaret: TBufferCoord): Integer; + function FindSelection(const BC: TBufferCoord; var Index: Integer): Boolean; + procedure MouseSelection(const Sel: TSynSelection); + procedure ColumnSelection(Anchor, ACaret: TBufferCoord; LastPosX: Integer = 0); + procedure Merge; + function PartSelectionsForRow(const RowStart, RowEnd: TBufferCoord): TSynSelectionArray; + function RowHasCaret(ARow, ALine: Integer): Boolean; + // Invalidate + procedure InvalidateSelection(Index: Integer); + procedure InvalidateAll; + //Storing and Restoring + procedure Store(out SelStorage: TSynSelStorage); + procedure Restore(const [Ref] SelStorage: TSynSelStorage); overload; + procedure Restore(const [Ref] Sel: TSynSelection; EnsureVisible: Boolean = True); overload; + // Adjust selections in response to editing events + // Should only used by Synedit + procedure LinesInserted(FirstLine, aCount: Integer); + procedure LinesDeleted(FirstLine, aCount: Integer); + procedure LinePut(aIndex: Integer; const OldLine: string); + // properties + property BaseSelectionIndex: Integer read FBaseSelIndex; + // The last selection entered + // Non-multicursor commands operate on the active selection + property ActiveSelection: TSynSelection read GetActiveSelection write SetActiveSelection; + // The selection that is kept when you clear multiple cursors + // It the first one as in VS Code + property BaseSelection: TSynSelection read GetBaseSelection write SetBaseSelection; + property Count: Integer read GetCount; + property ActiveSelIndex: Integer read FActiveSelIndex write SetActiveSelIndex; + property IsEmpty: Boolean read GetIsEmpty; + property Selection[Index: Integer]: TSynSelection read GetSelection; default; + end; + + {$ENDREGION 'TSynSelections'} + + {$REGION 'Scrollbar Annotations'} + TSynScrollbarAnnType = (sbaCarets, sbaBookmark, sbaTrackChanges, + sbaCustom1, sbaCustom2, sbaCustom3); + + TSynScrollbarAnnPos = (sbpLeft, sbpSecondLeft, sbpMiddle, + sbpSecondRight, sbpRight, sbpFullWidth); + + TScrollbarAnnotationInfoEvent = procedure(Sender: TObject; + AnnType: TSynScrollbarAnnType; var Rows: TArray; + var Colors: TArray) of object; + + TSynScrollbarAnnItem = class(TCollectionItem) + private + FAnnType: TSynScrollbarAnnType; + FAnnPos: TSynScrollbarAnnPos; + FOnGetInfo: TScrollbarAnnotationInfoEvent; + FSelectionColor: TColor; + FBookmarkColor: TColor; + FFullRow: Boolean; + public + constructor Create(Collection: TCollection); override; + procedure Assign(Source: TPersistent); override; + procedure GetInfo(out Rows: TArray; out Colors: TArray); + published + property AnnType: TSynScrollbarAnnType read FAnnType write FAnnType; + property AnnPos: TSynScrollbarAnnPos read FAnnPos write FAnnPos; + property SelectionColor: TColor read FSelectionColor write FSelectionColor + default clDefault; + property BookmarkColor: TColor read FBookmarkColor write FBookmarkColor + default clDefault; + property FullRow: Boolean read FFullRow write FFullRow; + property OnGetInfo: TScrollbarAnnotationInfoEvent read FOnGetInfo + write FOnGetInfo; end; -end; -//-- DPI-Aware -{ TSynSelectedColor } + TSynScrollbarAnnotations = class(TOwnedCollection) + private + function GetAnnotations(Index: Integer): TSynScrollbarAnnItem; + protected + procedure Update(Item: TCollectionItem); override; + public + procedure SetDefaultAnnotations; + property Annotations[Index: Integer]: TSynScrollbarAnnItem + read GetAnnotations; default; + end; + + {$ENDREGION 'Scrollbar Annotations'} + + {$REGION 'TSynDisplayFlowControl'} + + TSynDisplayFlowControl = class(TPersistent) + private + FEnabled: Boolean; + FColor: TColor; + published + constructor Create; + procedure Assign(aSource: TPersistent); override; + property Enabled: Boolean read FEnabled write FEnabled default True; + property Color: TColor read FColor write FColor default $0045FF; //clWebOrangeRed + end; + + {$ENDREGION 'TSynDisplayFlowControl'} + +implementation + +uses + System.Rtti, + System.Generics.Defaults, + Vcl.GraphUtil, + Vcl.Themes, + SynEditMiscProcs, + SynEditCodeFolding, + SynEdit, + SynEditTextBuffer; + +{$REGION 'TSynSelectedColor'} constructor TSynSelectedColor.Create; begin inherited Create; FBG := clHighLight; FFG := clHighLightText; + FFillWholeLines := True; + Opacity := 115; end; procedure TSynSelectedColor.Assign(Source: TPersistent); -var - Src: TSynSelectedColor; begin - if (Source <> nil) and (Source is TSynSelectedColor) then begin - Src := TSynSelectedColor(Source); + if (Source <> nil) and (Source is TSynSelectedColor) then + begin + var Src := TSynSelectedColor(Source); FBG := Src.FBG; FFG := Src.FFG; - if Assigned(FOnChange) then FOnChange(Self); - end else + FOpacity := Src.Opacity; + FFillWholeLines := Src.FillWholeLines; + if Assigned(FOnChange) then + FOnChange(Self); + end + else inherited Assign(Source); end; +procedure TSynSelectedColor.SetOpacity(Value: Byte); +begin + if (FOpacity <> Value) then + begin + FOpacity := Value; + if Assigned(FOnChange) then + FOnChange(Self); + end; +end; + procedure TSynSelectedColor.SetBG(Value: TColor); begin - if (FBG <> Value) then begin + if (FBG <> Value) then + begin FBG := Value; - if Assigned(FOnChange) then FOnChange(Self); + if Assigned(FOnChange) then + FOnChange(Self); end; end; procedure TSynSelectedColor.SetFG(Value: TColor); begin - if (FFG <> Value) then begin + if (FFG <> Value) then + begin FFG := Value; - if Assigned(FOnChange) then FOnChange(Self); + if Assigned(FOnChange) then + FOnChange(Self); end; end; -{ TSynGutter } -//++ DPI-Aware -procedure TSynGutter.ChangeScale(M, D: Integer); +procedure TSynSelectedColor.SetFillWholeLines(const Value: Boolean); +begin + if (FFillWholeLines <> Value) then + begin + FFillWholeLines := Value; + if Assigned(FOnChange) then + FOnChange(Self); + end; +end; + +{$ENDREGION} + + +{$REGION 'TSynGutter'} + +procedure TSynGutter.Changed; begin - fWidth := MulDiv(fWidth, M, D); - fLeftOffset := MulDiv(fLeftOffset, M, D); - fRightOffset := MulDiv(fRightOffset, M, D); - fFont.Height := MulDiv(fFont.Height, M, D); - if Assigned(fOnChange) then fOnChange(Self); + if (FUpdateCount = 0) and Assigned(FOnChange) then + FOnChange(Self); end; -//-- DPI-Aware +procedure TSynGutter.ChangeScale(M, D: Integer); +begin + BeginUpdate; + try + if Assigned(FInternalImage) then + FInternalImage.ChangeScale(M, D); + FCurrentPPI := M; // Vcl does the same + FontChanged(Self); // Do font scaling + finally + EndUpdate; + end; +end; constructor TSynGutter.Create; + procedure AddBand(AKind: TSynGutterBandKind; AWidth: Integer; + IsVisible: Boolean); + begin + with FBands.Add as TSynGutterBand do + begin + FKind := AKind; + FWidth := AWidth; + FVisible := IsVisible; + end; + end; + begin inherited Create; + FCurrentPPI := 96; FFont := TFont.Create; - FFont.Name := 'Courier New'; - FFont.Size := 8; + FFont.Name := DefaultFontName; FFont.Style := []; + FFont.PixelsPerInch := Screen.DefaultPixelsPerInch; + FFont.Size := 8; + {$IF CompilerVersion >= 36} + FFont.IsScreenFont := True; + {$IFEND CompilerVersion >= 36} FUseFontStyle := True; - FFont.OnChange := OnFontChange; + FFont.OnChange := FontChanged; + FontChanged(Self); FColor := clBtnFace; - FVisible := TRUE; - FWidth := 30; - FLeftOffset := 16; + FVisible := True; FDigitCount := 4; FAutoSizeDigitCount := FDigitCount; - FRightOffset := 2; - FRightMargin := 2; + FAutoSize := True; FBorderColor := clWindow; FBorderStyle := gbsMiddle; FLineNumberStart := 1; @@ -505,75 +983,136 @@ constructor TSynGutter.Create; FGradientEndColor := clBtnFace; FGradientSteps := 48; - FShowModification := FALSE; - FModificationBarWidth := 4; - FModificationColorModified := clYellow; - FModificationColorSaved := clLime; + AutoSizeDigitCount; + + FTrackChanges := TSynTrackChanges.Create(Self); + + FBands := TSynBandsCollection.Create(Self, TSynGutterBand); + Bands.BeginUpdate; + try + AddBand(gbkMarks, 13, True); + AddBand(gbkLineNumbers, 0, False); + AddBand(gbkFold, 0, False); + AddBand(gbkTrackChanges, 0, False); + AddBand(gbkMargin, 3, True); + finally + Bands.EndUpdate; + end; + AssignableBands := True; +end; + +constructor TSynGutter.Create(Owner: TPersistent); +begin + FOwner := Owner; + Create; end; destructor TSynGutter.Destroy; begin + FOwner := nil; FFont.Free; + FTrackChanges.Free; + FBands.Free; + FInternalImage.Free; inherited Destroy; end; +procedure TSynGutter.EndUpdate; +begin + Dec(FUpdateCount); + Changed; +end; + procedure TSynGutter.Assign(Source: TPersistent); var Src: TSynGutter; begin - if Assigned(Source) and (Source is TSynGutter) then + if Assigned(Source) and (Source is TSynGutter) then begin - Src := TSynGutter(Source); - FFont.Assign(src.Font); - FUseFontStyle := src.FUseFontStyle; - FColor := Src.FColor; - FVisible := Src.FVisible; - FWidth := Src.FWidth; - FShowLineNumbers := Src.FShowLineNumbers; - FLeadingZeros := Src.FLeadingZeros; - FZeroStart := Src.FZeroStart; - FLeftOffset := Src.FLeftOffset; - FDigitCount := Src.FDigitCount; - FRightOffset := Src.FRightOffset; - FRightMargin := Src.FRightMargin; - FAutoSize := Src.FAutoSize; - FAutoSizeDigitCount := Src.FAutoSizeDigitCount; - FLineNumberStart := Src.FLineNumberStart; - FBorderColor := Src.FBorderColor; - FBorderStyle := Src.FBorderStyle; - FGradient := Src.FGradient; - FGradientStartColor := Src.FGradientStartColor; - FGradientEndColor := Src.FGradientEndColor; - FGradientSteps := Src.FGradientSteps; - if Assigned(FOnChange) then FOnChange(Self); - end + BeginUpdate; + try + Src := TSynGutter(Source); + FFont.Assign(Src.Font); + FUseFontStyle := Src.FUseFontStyle; + FColor := Src.FColor; + FVisible := Src.FVisible; + FLeadingZeros := Src.FLeadingZeros; + FZeroStart := Src.FZeroStart; + FDigitCount := Src.FDigitCount; + FAutoSize := Src.FAutoSize; + FAutoSizeDigitCount := Src.FAutoSizeDigitCount; + FShowLineNumbers := Src.FShowLineNumbers; + FLineNumberStart := Src.FLineNumberStart; + FBorderColor := Src.FBorderColor; + FBorderStyle := Src.FBorderStyle; + FGradient := Src.FGradient; + FGradientStartColor := Src.FGradientStartColor; + FGradientEndColor := Src.FGradientEndColor; + FGradientSteps := Src.FGradientSteps; + if AssignableBands and Src.AssignableBands then + FBands.Assign(Src.FBands); + FTrackChanges.Assign(Src.FTrackChanges); + AutoSizeDigitCount; + finally + EndUpdate; + end; + end else inherited; end; -procedure TSynGutter.AutoSizeDigitCount(LinesCount: Integer); +procedure TSynGutter.AutoSizeDigitCount; var nDigits: Integer; + SynEdit: TCustomSynEdit; + LinesCount: Integer; begin - if FVisible and FAutoSize and FShowLineNumbers then + SynEdit := TCustomSynEdit(FOwner); + if Assigned(SynEdit) and FAutoSize then begin + LinesCount := SynEdit.Lines.Count; if FZeroStart then Dec(LinesCount) else if FLineNumberStart > 1 then Inc(LinesCount, FLineNumberStart - 1); nDigits := Max(Length(IntToStr(LinesCount)), FDigitCount); - if FAutoSizeDigitCount <> nDigits then begin + if FAutoSizeDigitCount <> nDigits then + begin FAutoSizeDigitCount := nDigits; - if Assigned(FOnChange) then FOnChange(Self); + Changed; end; - end else + end + else FAutoSizeDigitCount := FDigitCount; end; +function TSynGutter.BandAtX(X: Integer): TSynGutterBand; +var + I, L: Integer; + Band: TSynGutterBand; +begin + Result := nil; + L := 0; + for I := 0 to Bands.Count - 1 do + begin + Band := Bands[I]; + if not Band.Visible then + Continue; + Inc(L, Band.RealWidth); + if X < L then + Exit(Band); + end; +end; + +procedure TSynGutter.BeginUpdate; +begin + Inc(FUpdateCount); +end; + function TSynGutter.FormatLineNumber(Line: Integer): string; var - i: Integer; + I: Integer; begin if FZeroStart then Dec(Line) @@ -581,157 +1120,137 @@ function TSynGutter.FormatLineNumber(Line: Integer): string; Inc(Line, FLineNumberStart - 1); Result := Format('%*d', [FAutoSizeDigitCount, Line]); if FLeadingZeros then - for i := 1 to FAutoSizeDigitCount - 1 do + for I := 1 to FAutoSizeDigitCount - 1 do begin - if (Result[i] <> ' ') then + if (Result[I] <> ' ') then Break; - Result[i] := '0'; + Result[I] := '0'; end; end; -function TSynGutter.RealGutterWidth(CharWidth: Integer): Integer; +function TSynGutter.RealGutterWidth: Integer; +var + I: Integer; begin - if not FVisible then - Result := 0 - else + Result := 0; + if FVisible and Assigned(FOwner) then begin - if FShowLineNumbers then - Result := FLeftOffset + FRightOffset + FAutoSizeDigitCount * CharWidth + FRightMargin - else if FAutoSize then - Result := FLeftOffset + FRightOffset + FRightMargin - else - Result := FWidth; - - // take modification indicator into account - if FShowModification then - Result := Result + FModificationBarWidth; + for I := 0 to Bands.Count - 1 do + Inc(Result, Bands[I].RealWidth); end; end; procedure TSynGutter.SetAutoSize(const Value: Boolean); begin - if FAutoSize <> Value then begin + if FAutoSize <> Value then + begin FAutoSize := Value; - if Assigned(FOnChange) then FOnChange(Self); + AutoSizeDigitCount; + Changed; end; end; procedure TSynGutter.SetColor(const Value: TColor); begin - if FColor <> Value then begin + if FColor <> Value then + begin FColor := Value; - if Assigned(FOnChange) then FOnChange(Self); + Changed; end; end; procedure TSynGutter.SetFont(Value: TFont); begin + if Screen.Fonts.IndexOf(Font.Name) < 0 then + Font.Name := DefaultFontName; FFont.Assign(Value); end; -procedure TSynGutter.OnFontChange(Sender: TObject); -begin - if Assigned(FOnChange) then FOnChange(Self); +procedure TSynGutter.FontChanged(Sender: TObject); +var + TempFont: TFont; +begin + FFont.OnChange := nil; // avoid recursion + if Assigned(FOwner) then + FFont.Quality := TCustomSynEdit(FOWner).FontQuality; + // revert to default font if not monospaced or invalid + if not IsFontMonospacedAndValid(FFont) then + Font.Name := DefaultFontName; + Font.OnChange := FontChanged; + TempFont := TFont.Create; + try + // scale font height + TempFont.PixelsPerInch := FCurrentPPI; + TempFont.Assign(FFont); + FTextFormat.Create(TempFont, 1, 0, 0); + finally + TempFont.Free; + end; + FCharWidth := FTextFormat.CharWidth; + Changed; end; procedure TSynGutter.SetDigitCount(Value: Integer); begin Value := MinMax(Value, 2, 12); - if FDigitCount <> Value then begin + if FDigitCount <> Value then + begin FDigitCount := Value; - FAutoSizeDigitCount := FDigitCount; - if Assigned(FOnChange) then FOnChange(Self); + AutoSizeDigitCount; + Changed; end; end; procedure TSynGutter.SetLeadingZeros(const Value: Boolean); begin - if FLeadingZeros <> Value then begin + if FLeadingZeros <> Value then + begin FLeadingZeros := Value; - if Assigned(FOnChange) then FOnChange(Self); - end; -end; - -procedure TSynGutter.SetLeftOffset(Value: Integer); -begin - Value := Max(0, Value); - if FLeftOffset <> Value then begin - FLeftOffset := Value; - if Assigned(FOnChange) then FOnChange(Self); - end; -end; - -procedure TSynGutter.SetRightOffset(Value: Integer); -begin - Value := Max(0, Value); - if FRightOffset <> Value then begin - FRightOffset := Value; - if Assigned(FOnChange) then FOnChange(Self); - end; -end; - -procedure TSynGutter.SetRightMargin(Value: integer); -begin - Value := Max(0, Value); - if fRightMargin <> Value then begin - fRightMargin := Value; - if Assigned(fOnChange) then fOnChange(Self); + AutoSizeDigitCount; + Changed; end; end; procedure TSynGutter.SetShowLineNumbers(const Value: Boolean); begin - if FShowLineNumbers <> Value then begin + if FShowLineNumbers <> Value then + begin FShowLineNumbers := Value; - if Assigned(FOnChange) then FOnChange(Self); - end; -end; - -procedure TSynGutter.SetShowModification(const Value: Boolean); -begin - if FShowModification <> Value then begin - FShowModification := Value; - if Assigned(FOnChange) then FOnChange(Self); + Changed; end; end; procedure TSynGutter.SetUseFontStyle(Value: Boolean); begin - if FUseFontStyle <> Value then begin + if FUseFontStyle <> Value then + begin FUseFontStyle := Value; - if Assigned(FOnChange) then FOnChange(Self); + Changed; end; end; procedure TSynGutter.SetVisible(Value: Boolean); begin - if FVisible <> Value then begin + if FVisible <> Value then + begin FVisible := Value; - if Assigned(FOnChange) then FOnChange(Self); - end; -end; - -procedure TSynGutter.SetWidth(Value: Integer); -begin - Value := Max(0, Value); - if FWidth <> Value then begin - FWidth := Value; - if Assigned(FOnChange) then FOnChange(Self); + Changed; end; end; procedure TSynGutter.SetZeroStart(const Value: Boolean); begin - if FZeroStart <> Value then begin + if FZeroStart <> Value then + begin FZeroStart := Value; - if Assigned(FOnChange) then FOnChange(Self); + Changed; end; end; procedure TSynGutter.SetBorderStyle(const Value: TSynGutterBorderStyle); begin FBorderStyle := Value; - if Assigned(FOnChange) then FOnChange(Self); + Changed; end; procedure TSynGutter.SetLineNumberStart(const Value: Integer); @@ -745,35 +1264,14 @@ procedure TSynGutter.SetLineNumberStart(const Value: Integer); FZeroStart := True else FZeroStart := False; - if Assigned(FOnChange) then FOnChange(Self); - end; -end; - -procedure TSynGutter.SetModificationBarWidth(const Value: Integer); -begin - if FModificationBarWidth <> Value then - begin - FModificationBarWidth := Value; - if Assigned(FOnChange) then FOnChange(Self); - end; -end; - -procedure TSynGutter.SetModificationColorModified(const Value: TColor); -begin - if FModificationColorModified <> Value then - begin - FModificationColorModified := Value; - if Assigned(FOnChange) then FOnChange(Self); + AutoSizeDigitCount; + Changed; end; end; -procedure TSynGutter.SetModificationColorSaved(const Value: TColor); +procedure TSynGutter.SetBands(const Value: TSynBandsCollection); begin - if FModificationColorSaved <> Value then - begin - FModificationColorSaved := Value; - if Assigned(FOnChange) then FOnChange(Self); - end; + FBands.Assign(Value); end; procedure TSynGutter.SetBorderColor(const Value: TColor); @@ -781,7 +1279,7 @@ procedure TSynGutter.SetBorderColor(const Value: TColor); if FBorderColor <> Value then begin FBorderColor := Value; - if Assigned(FOnChange) then FOnChange(Self); + Changed; end; end; @@ -790,7 +1288,7 @@ procedure TSynGutter.SetGradient(const Value: Boolean); if Value <> FGradient then begin FGradient := Value; - if Assigned(FOnChange) then FOnChange(Self); + Changed; end; end; @@ -799,7 +1297,7 @@ procedure TSynGutter.SetGradientEndColor(const Value: TColor); if Value <> FGradientEndColor then begin FGradientEndColor := Value; - if Assigned(FOnChange) then FOnChange(Self); + Changed; end; end; @@ -808,7 +1306,7 @@ procedure TSynGutter.SetGradientStartColor(const Value: TColor); if Value <> FGradientStartColor then begin FGradientStartColor := Value; - if Assigned(FOnChange) then FOnChange(Self); + Changed; end; end; @@ -819,35 +1317,53 @@ procedure TSynGutter.SetGradientSteps(const Value: Integer); FGradientSteps := Value; if FGradientSteps < 2 then FGradientSteps := 2; - if Assigned(FOnChange) then FOnChange(Self); + Changed; end; end; -function TSynGutter.GetWidth: Integer; +function TSynGutter.GetBandByKind(Kind: TSynGutterBandKind): TSynGutterBand; +var + I: Integer; begin - if not Visible then - Result := 0 - else - Result := FWidth; + Result := nil; + for I := 0 to Bands.Count - 1 do + if Bands[I].Kind = Kind then + Exit(Bands[I]) +end; + +function TSynGutter.GetInternalImage: TSynInternalImage; +begin + if not Assigned(FInternalImage) then + begin + FInternalImage := TSynInternalImage.Create(HINSTANCE, + 'SynEditInternalImages', 10); + + if Assigned(FOwner) then + FInternalImage.ChangeScale(FCurrentPPI, 96); + end; + Result := FInternalImage; +end; + +function TSynGutter.GetOwner: TPersistent; +begin + Result := FOwner; end; -{ TSynBookMarkOpt } +{$ENDREGION} + + +{$REGION 'TSynBookMarkOpt'} -//++ DPI-Aware procedure TSynBookMarkOpt.ChangeScale(M, D: Integer); -Var - L : Integer; begin - L := (M div D) * D; // Factor multiple of 100% - fLeftMargin := MulDiv(fLeftMargin, L, D); - fXoffset := MulDiv(fXoffset, L, D); + FLeftMargin := MulDiv(FLeftMargin, M, D); + FXoffset := MulDiv(FXoffset, M, D); end; -//-- DPI-Aware constructor TSynBookMarkOpt.Create(AOwner: TComponent); begin inherited Create; - FDrawBookmarksFirst := TRUE; + FDrawBookmarksFirst := True; FEnableKeys := True; FGlyphsVisible := True; FLeftMargin := 2; @@ -859,7 +1375,8 @@ procedure TSynBookMarkOpt.Assign(Source: TPersistent); var Src: TSynBookMarkOpt; begin - if (Source <> nil) and (Source is TSynBookMarkOpt) then begin + if (Source <> nil) and (Source is TSynBookMarkOpt) then + begin Src := TSynBookMarkOpt(Source); FBookmarkImages := Src.FBookmarkImages; FDrawBookmarksFirst := Src.FDrawBookmarksFirst; @@ -867,66 +1384,76 @@ procedure TSynBookMarkOpt.Assign(Source: TPersistent); FGlyphsVisible := Src.FGlyphsVisible; FLeftMargin := Src.FLeftMargin; FXoffset := Src.FXoffset; - if Assigned(FOnChange) then FOnChange(Self); - end else + if Assigned(FOnChange) then + FOnChange(Self); + end + else inherited Assign(Source); end; -procedure TSynBookMarkOpt.SetBookmarkImages(const Value: TImageList); +procedure TSynBookMarkOpt.SetBookmarkImages(const Value: TCustomImageList); begin - if FBookmarkImages <> Value then begin + if FBookmarkImages <> Value then + begin FBookmarkImages := Value; - if Assigned(FBookmarkImages) then FBookmarkImages.FreeNotification(FOwner); - if Assigned(FOnChange) then FOnChange(Self); + if Assigned(FBookmarkImages) then + FBookmarkImages.FreeNotification(FOwner); + if Assigned(FOnChange) then + FOnChange(Self); end; end; procedure TSynBookMarkOpt.SetDrawBookmarksFirst(Value: Boolean); begin - if Value <> FDrawBookmarksFirst then begin + if Value <> FDrawBookmarksFirst then + begin FDrawBookmarksFirst := Value; - if Assigned(FOnChange) then FOnChange(Self); + if Assigned(FOnChange) then + FOnChange(Self); end; end; procedure TSynBookMarkOpt.SetGlyphsVisible(Value: Boolean); begin - if FGlyphsVisible <> Value then begin + if FGlyphsVisible <> Value then + begin FGlyphsVisible := Value; - if Assigned(FOnChange) then FOnChange(Self); + if Assigned(FOnChange) then + FOnChange(Self); end; end; procedure TSynBookMarkOpt.SetLeftMargin(Value: Integer); begin - if FLeftMargin <> Value then begin + if FLeftMargin <> Value then + begin FLeftMargin := Value; - if Assigned(FOnChange) then FOnChange(Self); + if Assigned(FOnChange) then + FOnChange(Self); end; end; procedure TSynBookMarkOpt.SetXOffset(Value: Integer); begin - if FXoffset <> Value then begin + if FXoffset <> Value then + begin FXoffset := Value; - if Assigned(FOnChange) then FOnChange(Self); + if Assigned(FOnChange) then + FOnChange(Self); end; end; -{ TSynGlyph } +{$ENDREGION} + + +{$REGION 'TSynGlyph'} -//++ DPI-Aware procedure TSynGlyph.ChangeScale(M, D: Integer); -Var - L : Integer; begin - L := (M div D) * D; // Factor multiple of 100% - ResizeBitmap(fInternalGlyph, MulDiv(fInternalGlyph.Width, L, D), MulDiv(fInternalGlyph.Height, L, D)); - ResizeBitmap(fGlyph, MulDiv(fGlyph.Width, L, D), MulDiv(fGlyph.Height, L, D)); + FPPI := M; // As Delphi does end; -//-- DPI-Aware -constructor TSynGlyph.Create(aModule: THandle; const aName: string; aMaskColor: TColor); +constructor TSynGlyph.Create(aModule: THandle; const aName: string); begin inherited Create; @@ -934,15 +1461,24 @@ constructor TSynGlyph.Create(aModule: THandle; const aName: string; aMaskColor: begin FInternalGlyph := TBitmap.Create; FInternalGlyph.LoadFromResourceName(aModule, aName); - FInternalMaskColor := aMaskColor; - end - else - FInternalMaskColor := clNone; + FInternalGlyph.AlphaFormat := afDefined; + end; + + FPPI := Screen.DefaultPixelsPerInch; FVisible := True; FGlyph := TBitmap.Create; - FGlyph.OnChange := GlyphChange; - FMaskColor := clNone; +end; + +function TSynGlyph.D2D1Bitmap(RT: ID2D1RenderTarget): ID2D1Bitmap; +var + BM: TBitmap; +begin + if FGlyph.Empty then + BM := FInternalGlyph + else + BM := FGlyph; + Result := D2D1BitmapFromBitmap(BM, RT); end; destructor TSynGlyph.Destroy; @@ -951,80 +1487,47 @@ destructor TSynGlyph.Destroy; FreeAndNil(FInternalGlyph); FGlyph.Free; - inherited Destroy; end; -procedure TSynGlyph.Assign(aSource: TPersistent); +function TSynGlyph.GetSize: TSize; var - vSrc : TSynGlyph; + BM: TBitmap; begin - if Assigned(aSource) and (aSource is TSynGlyph) then - begin - vSrc := TSynGlyph(aSource); - FInternalGlyph := vSrc.FInternalGlyph; - FInternalMaskColor := vSrc.FInternalMaskColor; - FVisible := vSrc.FVisible; - FGlyph := vSrc.FGlyph; - FMaskColor := vSrc.FMaskColor; - if Assigned(FOnChange) then FOnChange(Self); - end + if FGlyph.Empty then + BM := FInternalGlyph else - inherited; + BM := FGlyph; + Result.Create(MulDiv(BM.Width, FPPI, 96), MulDiv(BM.Height, FPPI, 96)); end; -procedure TSynGlyph.Draw(aCanvas: TCanvas; aX, aY, aLineHeight: Integer); +procedure TSynGlyph.Assign(aSource: TPersistent); var - rcSrc, rcDest : TRect; - vGlyph : TBitmap; - vMaskColor : TColor; + vSrc: TSynGlyph; begin - if not FGlyph.Empty then - begin - vGlyph := FGlyph; - vMaskColor := FMaskColor; - end - else if Assigned(FInternalGlyph) then - begin - vGlyph := FInternalGlyph; - vMaskColor := FInternalMaskColor; - end - else - Exit; - - if aLineHeight >= vGlyph.Height then + if Assigned(aSource) and (aSource is TSynGlyph) then begin - rcSrc := Rect(0, 0, vGlyph.Width, vGlyph.Height); - Inc(aY, (aLineHeight - vGlyph.Height) div 2); - rcDest := Rect(aX, aY, aX + vGlyph.Width, aY + vGlyph.Height); + vSrc := TSynGlyph(aSource); + FInternalGlyph.Assign(vSrc.FInternalGlyph); + FVisible := vSrc.FVisible; + FGlyph.Assign(vSrc.FGlyph); end else - begin - rcDest := Rect(aX, aY, aX + vGlyph.Width, aY + aLineHeight); - aY := (vGlyph.Height - aLineHeight) div 2; - rcSrc := Rect(0, aY, vGlyph.Width, aY + aLineHeight); - end; - - aCanvas.BrushCopy(rcDest, vGlyph, rcSrc, vMaskColor); + inherited; + Changed; end; procedure TSynGlyph.SetGlyph(Value: TBitmap); begin FGlyph.Assign(Value); + FGlyph.AlphaFormat := afDefined; + Changed; end; -procedure TSynGlyph.GlyphChange(Sender: TObject); -begin - if Assigned(FOnChange) then FOnChange(Self); -end; - -procedure TSynGlyph.SetMaskColor(Value: TColor); +procedure TSynGlyph.Changed; begin - if FMaskColor <> Value then - begin - FMaskColor := Value; - if Assigned(FOnChange) then FOnChange(Self); - end; + if Assigned(FOnChange) then + FOnChange(Self); end; procedure TSynGlyph.SetVisible(Value: Boolean); @@ -1032,39 +1535,20 @@ procedure TSynGlyph.SetVisible(Value: Boolean); if FVisible <> Value then begin FVisible := Value; - if Assigned(FOnChange) then FOnChange(Self); + Changed; end; end; -function TSynGlyph.GetWidth : Integer; -begin - if not FGlyph.Empty then - Result := FGlyph.Width - else - if Assigned(FInternalGlyph) then - Result := FInternalGlyph.Width - else - Result := 0; -end; +{$ENDREGION} -function TSynGlyph.GetHeight : Integer; -begin - if not FGlyph.Empty then - Result := FGlyph.Height - else - if Assigned(FInternalGlyph) then - Result := FInternalGlyph.Height - else - Result := 0; -end; -{ TSynMethodChain } +{$REGION 'TSynMethodChain'} procedure TSynMethodChain.Add(AEvent: TMethod); begin if not Assigned(@AEvent) then - raise ESynMethodChain.CreateFmt( - '%s.Entry : the parameter `AEvent'' must be specified.', [ClassName]); + raise ESynMethodChain.CreateFmt + ('%s.Entry: the parameter `AEvent'' must be specified.', [ClassName]); with FNotifyProcs, AEvent do begin @@ -1094,8 +1578,8 @@ function TSynMethodChain.DoHandleException(E: Exception): Boolean; Result := True; FExceptionHandler(Self, E, Result); except - raise ESynMethodChain.CreateFmt( - '%s.DoHandleException : MUST NOT occur any kind of exception in '+ + raise ESynMethodChain.CreateFmt + ('%s.DoHandleException: MUST NOT occur any kind of exception in ' + 'ExceptionHandler', [ClassName]); end; end; @@ -1103,55 +1587,58 @@ function TSynMethodChain.DoHandleException(E: Exception): Boolean; procedure TSynMethodChain.Fire; var AMethod: TMethod; - i: Integer; + I: Integer; begin - i := 0; + I := 0; with FNotifyProcs, AMethod do - while i < Count do + while I < Count do try repeat - Code := Items[i]; - Inc(i); - Data := Items[i]; - Inc(i); + Code := Items[I]; + Inc(I); + Data := Items[I]; + Inc(I); DoFire(AMethod) - until i >= Count; + until I >= Count; except on E: Exception do if not DoHandleException(E) then - i := MaxInt; + I := MaxInt; end; end; procedure TSynMethodChain.Remove(AEvent: TMethod); var - i: Integer; + I: Integer; begin if not Assigned(@AEvent) then - raise ESynMethodChain.CreateFmt( - '%s.Remove: the parameter `AEvent'' must be specified.', [ClassName]); + raise ESynMethodChain.CreateFmt + ('%s.Remove: the parameter `AEvent'' must be specified.', [ClassName]); with FNotifyProcs, AEvent do begin - i := Count - 1; - while i > 0 do - if Items[i] <> Data then - Dec(i, 2) + I := Count - 1; + while I > 0 do + if Items[I] <> Data then + Dec(I, 2) else begin - Dec(i); - if Items[i] = Code then + Dec(I); + if Items[I] = Code then begin - Delete(i); - Delete(i); + Delete(I); + Delete(I); end; - Dec(i); + Dec(I); end; end; end; -{ TSynNotifyEventChain } +{$ENDREGION} + + +{$REGION 'TSynNotifyEventChain'} procedure TSynNotifyEventChain.Add(AEvent: TNotifyEvent); begin @@ -1174,37 +1661,32 @@ procedure TSynNotifyEventChain.Remove(AEvent: TNotifyEvent); inherited Remove(TMethod(AEvent)); end; +{$ENDREGION} -{ TSynInternalImage } + +{$REGION 'TSynInternalImage'} type - TInternalResource = class (TObject) - public - UsageCount : Integer; - Name : string; - Bitmap : TBitmap; + TInternalResource = class(TObject) + public + UsageCount: Integer; + Name: string; + Bitmap: TBitmap; end; -var - InternalResources: TList; - -//++ DPI-Aware procedure TSynInternalImage.ChangeScale(M, D: Integer); -Var - L: Integer; begin - L := (M div D) * D; // Factor multiple of 100% - fWidth := MulDiv(fWidth, L, D); - ResizeBitmap(fImages, fWidth * fCount, MulDiv(fImages.Height, L, D)); - fHeight := fImages.Height; + FPPI := M; // As Delphi does end; -//-- DPI-Aware constructor TSynInternalImage.Create(aModule: THandle; const Name: string; Count: Integer); begin inherited Create; - FImages := CreateBitmapFromInternalList(aModule, Name); + FPPI := 96; + FImages := TBitmap.Create; + FImages.LoadFromResourceName(aModule, Name); + FImages.AlphaFormat := afPremultiplied; FWidth := (FImages.Width + Count shr 1) div Count; FHeight := FImages.Height; FCount := Count; @@ -1212,137 +1694,52 @@ constructor TSynInternalImage.Create(aModule: THandle; const Name: string; destructor TSynInternalImage.Destroy; begin - FreeBitmapFromInternalList; - inherited Destroy; -end; - -function TSynInternalImage.CreateBitmapFromInternalList(aModule: THandle; - const Name: string): TBitmap; -var - idx: Integer; - newIntRes: TInternalResource; -begin - { There is no list until now } - if (InternalResources = nil) then - InternalResources := TList.Create; - - { Search the list for the needed resource } - for idx := 0 to InternalResources.Count - 1 do - if (TInternalResource(InternalResources[idx]).Name = UpperCase(Name)) then - with TInternalResource(InternalResources[idx]) do begin - UsageCount := UsageCount + 1; - Result := Bitmap; - Exit; - end; - - { There is no loaded resource in the list so let's create a new one } - Result := TBitmap.Create; - Result.LoadFromResourceName(aModule, Name); - - { Add the new resource to our list } - newIntRes:= TInternalResource.Create; - newIntRes.UsageCount := 1; - newIntRes.Name := UpperCase(Name); - newIntRes.Bitmap := Result; - InternalResources.Add(newIntRes); -end; - -procedure TSynInternalImage.FreeBitmapFromInternalList; -var - idx: Integer; - intRes: TInternalResource; - function FindImageInList: Integer; - begin - for Result := 0 to InternalResources.Count - 1 do - if (TInternalResource (InternalResources[Result]).Bitmap = FImages) then - Exit; - Result := -1; - end; -begin - { Search the index of our resource in the list } - idx := FindImageInList; - - { Ey, what's this ???? } - if (idx = -1) then - Exit; - - { Decrement the usagecount in the object. If there are no more users - remove the object from the list and free it } - intRes := TInternalResource (InternalResources[idx]); - with intRes do begin - UsageCount := UsageCount - 1; - if (UsageCount = 0) then begin - Bitmap.Free; - InternalResources.Delete (idx); - intRes.Free; - end; - end; - - { If there are no more entries in the list free it } - if (InternalResources.Count = 0) then begin - InternalResources.Free; - InternalResources := nil; - end; + FImages.Free; + inherited; end; -procedure TSynInternalImage.Draw(ACanvas: TCanvas; +procedure TSynInternalImage.Draw(RT: ID2D1RenderTarget; Number, X, Y, LineHeight: Integer); var - rcSrc, rcDest: TRect; + ScaledW, ScaledH: Integer; + rcSrc, rcDest: TRectF; + BM: ID2D1Bitmap; begin if (Number >= 0) and (Number < FCount) then begin - if LineHeight >= FHeight then begin - rcSrc := Rect(Number * FWidth, 0, (Number + 1) * FWidth, FHeight); - Inc(Y, (LineHeight - FHeight) div 2); - rcDest := Rect(X, Y, X + FWidth, Y + FHeight); - end else begin - rcDest := Rect(X, Y, X + FWidth, Y + LineHeight); - Y := (FHeight - LineHeight) div 2; - rcSrc := Rect(Number * FWidth, Y, (Number + 1) * FWidth, - Y + LineHeight); - end; - ACanvas.CopyRect(rcDest, FImages.Canvas, rcSrc); - end; -end; + ScaledW := MulDiv(FWidth, FPPI, 96); + ScaledH := MulDiv(FHeight, FPPI, 96); -procedure TSynInternalImage.DrawTransparent(ACanvas: TCanvas; Number, X, Y, - LineHeight: Integer; TransparentColor: TColor); -var - rcSrc, rcDest: TRect; -begin - if (Number >= 0) and (Number < FCount) then - begin - if LineHeight >= FHeight then begin - rcSrc := Rect(Number * FWidth, 0, (Number + 1) * FWidth, FHeight); - Inc(Y, (LineHeight - FHeight) div 2); - rcDest := Rect(X, Y, X + FWidth, Y + FHeight); - end else begin - rcDest := Rect(X, Y, X + FWidth, Y + LineHeight); - Y := (FHeight - LineHeight) div 2; - rcSrc := Rect(Number * FWidth, Y, (Number + 1) * FWidth, - Y + LineHeight); - end; - ACanvas.BrushCopy(rcDest, FImages, rcSrc, TransparentColor); + rcSrc := Rect(Number * FWidth, 0, (Number + 1) * FWidth, FHeight); + rcDest := Rect(0, 0, ScaledW, ScaledH); + rcDest := rcDest.FitInto(Rect(X, Y, X + ScaledW, Y + LineHeight)); + + BM := D2D1BitmapFromBitmap(FImages, RT); + RT.DrawBitmap(BM, @rcDest, 1, D2D1_BITMAP_INTERPOLATION_MODE_LINEAR, @rcSrc); end; end; +{$ENDREGION} + -{ TSynHotKey } +{$REGION 'TSynHotKey'} function KeySameAsShiftState(Key: Word; Shift: TShiftState): Boolean; begin Result := (Key = SYNEDIT_SHIFT) and (ssShift in Shift) or - (Key = SYNEDIT_CONTROL) and (ssCtrl in Shift) or - (Key = SYNEDIT_MENU) and (ssAlt in Shift); + (Key = SYNEDIT_CONTROL) and (ssCtrl in Shift) or (Key = SYNEDIT_MENU) and + (ssAlt in Shift); end; function ModifiersToShiftState(Modifiers: THKModifiers): TShiftState; begin Result := []; - if hkShift in Modifiers then Include(Result, ssShift); - if hkCtrl in Modifiers then Include(Result, ssCtrl); - if hkAlt in Modifiers then Include(Result, ssAlt); + if hkShift in Modifiers then + Include(Result, ssShift); + if hkCtrl in Modifiers then + Include(Result, ssCtrl); + if hkAlt in Modifiers then + Include(Result, ssAlt); end; function ShiftStateToTHKInvalidKey(Shift: TShiftState): THKInvalidKey; @@ -1366,11 +1763,14 @@ function ShiftStateToTHKInvalidKey(Shift: TShiftState): THKInvalidKey; Result := hcNone; end; -function ShortCutToTextEx(Key: Word; Shift: TShiftState): UnicodeString; +function ShortCutToTextEx(Key: Word; Shift: TShiftState): string; begin - if ssCtrl in Shift then Result := SmkcCtrl; - if ssShift in Shift then Result := Result + SmkcShift; - if ssAlt in Shift then Result := Result + SmkcAlt; + if ssCtrl in Shift then + Result := SmkcCtrl; + if ssShift in Shift then + Result := Result + SmkcShift; + if ssAlt in Shift then + Result := Result + SmkcAlt; Result := Result + ShortCutToText(TShortCut(Key)); if Result = '' then @@ -1382,9 +1782,7 @@ constructor TSynHotKey.Create(AOwner: TComponent); inherited; BorderStyle := bsSingle; - {$IFDEF SYN_COMPILER_7_UP} ControlStyle := ControlStyle + [csNeedsBorderPaint]; - {$ENDIF} FInvalidKeys := [hcNone, hcShift]; FModifiers := [hkAlt]; @@ -1397,7 +1795,7 @@ constructor TSynHotKey.Create(AOwner: TComponent); procedure TSynHotKey.CreateParams(var Params: TCreateParams); const - BorderStyles: array[TSynBorderStyle] of DWORD = (0, WS_BORDER); + BorderStyles: array [TSynBorderStyle] of DWORD = (0, WS_BORDER); ClassStylesOff = CS_VREDRAW or CS_HREDRAW; begin inherited CreateParams(Params); @@ -1428,20 +1826,7 @@ procedure TSynHotKey.KeyDown(var Key: Word; Shift: TShiftState); var MaybeInvalidKey: THKInvalidKey; SavedKey: Word; - {$IFDEF SYN_LINUX} - Code: Byte; - {$ENDIF} begin - {$IFDEF SYN_LINUX} - // uniform Keycode: key has the same value wether Shift is pressed or not - if Key <= 255 then - begin - Code := XKeysymToKeycode(Xlib.PDisplay(QtDisplay), Key); - Key := XKeycodeToKeysym(Xlib.PDisplay(QtDisplay), Code, 0); - if AnsiChar(Key) in ['a'..'z'] then Key := Ord(UpCase(AnsiChar(Key))); - end; - {$ENDIF} - SavedKey := Key; FPressedOnlyModifiers := KeySameAsShiftState(Key, Shift); @@ -1463,38 +1848,24 @@ procedure TSynHotKey.KeyDown(var Key: Word; Shift: TShiftState); begin Text := ShortCutToTextEx(Key, Shift); Invalidate; - SetCaretPos(BorderWidth + 1 + TextWidth(Canvas, Text), BorderWidth + 1); + SetCaretPos(BorderWidth + 1 + Canvas.TextWidth(Text), BorderWidth + 1); end; Key := SavedKey; end; procedure TSynHotKey.KeyUp(var Key: Word; Shift: TShiftState); -{$IFDEF SYN_LINUX} -var - Code: Byte; -{$ENDIF} begin - {$IFDEF SYN_LINUX} - // uniform Keycode: key has the same value wether Shift is pressed or not - if Key <= 255 then - begin - Code := XKeysymToKeycode(Xlib.PDisplay(QtDisplay), Key); - Key := XKeycodeToKeysym(Xlib.PDisplay(QtDisplay), Code, 0); - if AnsiChar(Key) in ['a'..'z'] then Key := Ord(UpCase(AnsiChar(Key))); - end; - {$ENDIF} - if FPressedOnlyModifiers then begin Text := srNone; Invalidate; - SetCaretPos(BorderWidth + 1 + TextWidth(Canvas, Text), BorderWidth + 1); + SetCaretPos(BorderWidth + 1 + Canvas.TextWidth(Text), BorderWidth + 1); end; end; -procedure TSynHotKey.MouseDown(Button: TMouseButton; Shift: TShiftState; X, - Y: Integer); +procedure TSynHotKey.MouseDown(Button: TMouseButton; Shift: TShiftState; + X, Y: Integer); begin inherited; SetFocus; @@ -1502,15 +1873,16 @@ procedure TSynHotKey.MouseDown(Button: TMouseButton; Shift: TShiftState; X, procedure TSynHotKey.Paint; var - r: TRect; + R: TRect; begin - r := ClientRect; - + R := ClientRect; + Canvas.Brush.Style := bsSolid; Canvas.Brush.Color := Color; - InflateRect(r, -BorderWidth, -BorderWidth); - Canvas.FillRect(r); - TextRect(Canvas, r, BorderWidth + 1, BorderWidth + 1, Text); + InflateRect(R, -BorderWidth, -BorderWidth); + Canvas.FillRect(R); + Canvas.Font := Font; + Canvas.TextRect(R, BorderWidth + 1, BorderWidth + 1, Text); end; procedure TSynHotKey.SetBorderStyle(const Value: TSynBorderStyle); @@ -1538,7 +1910,7 @@ procedure TSynHotKey.SetHotKey(const Value: TShortCut); Text := ShortCutToTextEx(Key, Shift); Invalidate; if not Visible then - SetCaretPos(BorderWidth + 1 + TextWidth(Canvas, Text), BorderWidth + 1); + SetCaretPos(BorderWidth + 1 + Canvas.TextWidth(Text), BorderWidth + 1); end; procedure TSynHotKey.SetInvalidKeys(const Value: THKInvalidKeys); @@ -1567,43 +1939,2096 @@ procedure TSynHotKey.WMSetFocus(var Msg: TWMSetFocus); begin Canvas.Font := Font; CreateCaret(Handle, 0, 1, -Canvas.Font.Height + 2); - SetCaretPos(BorderWidth + 1 + TextWidth(Canvas, Text), BorderWidth + 1); + SetCaretPos(BorderWidth + 1 + Canvas.TextWidth(Text), BorderWidth + 1); ShowCaret(Handle); end; +{ TSynEditSearchCustom } + +// possibility to preprocess search expression before is send to SynEdit.SearchReplace() +function TSynEditSearchCustom.PreprocessReplaceExpression(const AReplace + : string): string; +begin + Result := AReplace; +end; + +{$ENDREGION} + + +{$REGION 'TSynGutterBand'} + +procedure TSynGutterBand.Assign(Source: TPersistent); +var + Src: TSynGutterBand; +begin + if Assigned(Source) and (Source is TSynGutterBand) then + begin + Src := TSynGutterBand(Source); + FKind := Src.FKind; + FVisible := Src.FVisible; + FBackground := Src.FBackground; + FWidth := Src.FWidth; + Changed(False); + end + else + inherited; +end; + +constructor TSynGutterBand.Create(Collection: TCollection); +begin + inherited Create(Collection); + FVisible := True; + FBackground := gbbGutter; +end; + +procedure TSynGutterBand.DoClick(Sender: TObject; Button: TMouseButton; + X, Y, Row, Line: Integer); +var + SynEdit: TCustomSynEdit; + Index: Integer; + rcFold: TRect; +begin + if Visible and (FKind = gbkFold) then + begin + SynEdit := TCustomSynEdit(Editor); + if SynEdit.AllFoldRanges.FoldStartAtLine(Line, Index) then + begin + rcFold := FoldShapeRect(Row, Line); + // See if we actually clicked on the rectangle... + if not rcFold.IsEmpty and PtInRect(rcFold, Point(X, Y)) then + begin + if SynEdit.AllFoldRanges.Ranges[Index].Collapsed then + SynEdit.Uncollapse(Index) + else + SynEdit.Collapse(Index); + end; + end; + end; + + if Assigned(FOnClick) then + FOnClick(Sender, Button, X, Y, Row, Line); +end; + +procedure TSynGutterBand.DoMouseCursor(Sender: TObject; + X, Y, Row, Line: Integer; var Cursor: TCursor); +var + SynEdit: TCustomSynEdit; + Index: Integer; + rcFold: TRect; +begin + if Visible and (FKind = gbkFold) then + begin + SynEdit := TCustomSynEdit(Editor); + if SynEdit.AllFoldRanges.FoldStartAtLine(Line, Index) then + begin + rcFold := FoldShapeRect(Row, Line); + if not rcFold.IsEmpty and PtInRect(rcFold, Point(X, Y)) then + Cursor := crHandPoint + end; + end; + + if Assigned(FOnMouseCursor) then + FOnMouseCursor(Sender, X, Y, Row, Line, Cursor); +end; + +procedure TSynGutterBand.DoPaintLines(RT: ID2D1RenderTarget; ClipR: TRect; + const FirstRow, LastRow: Integer); +// Drawing of builtin bands +begin + case FKind of + gbkMarks: + PaintMarks(RT, ClipR, FirstRow, LastRow); + gbkLineNumbers: + PaintLineNumbers(RT, ClipR, FirstRow, LastRow); + gbkFold: + PaintFoldShapes(RT, ClipR, FirstRow, LastRow); + gbkTrackChanges: + PaintTrackChanges(RT, ClipR, FirstRow, LastRow); + gbkMargin: + PaintMargin(RT, ClipR, FirstRow, LastRow); + end; +end; + +function TSynGutterBand.FoldShapeRect(Row, Line: Integer): TRect; +// Given that WordWrap and CodeFolding are mutally exclusive Row = Line +// But at some point this could be relaxed +var + SynEdit: TCustomSynEdit; + L, Index: Integer; + ShapeSize: Integer; + Margin: Integer; +begin + Result := TRect.Empty; + if not Visible or (FKind <> gbkFold) then + Exit; + SynEdit := TCustomSynEdit(Editor); + if SynEdit.RowToLine(Row) <> Line then + Exit; + + if SynEdit.AllFoldRanges.FoldStartAtLine(Line, Index) then + begin + ShapeSize := SynEdit.CodeFolding.ScaledGutterShapeSize(Gutter.FCurrentPPI); + L := LeftX; + if L < 0 then + Exit; + Margin := MulDiv(MarginX, Gutter.FCurrentPPI, 96); + Result.TopLeft := Point(L + Margin, (Row - SynEdit.TopLine) * + SynEdit.LineHeight + (SynEdit.LineHeight - ShapeSize) div 2); + Result.BottomRight := Result.TopLeft; + Result.BottomRight.Offset(ShapeSize, ShapeSize); + end; +end; + +function TSynGutterBand.GetDisplayName: string; +begin + Result := Format('%s - kind: %s', + [ClassName, TRttiEnumerationType.GetName(FKind)]) +end; + +function TSynGutterBand.GetEditor: TComponent; +begin + if Assigned(Gutter) then + Result := Gutter.GetOwner as TComponent + else + Result := nil; +end; + +function TSynGutterBand.GetLeftX: Integer; +var + I, L: Integer; + Band: TSynGutterBand; +begin + Result := -1; + L := 0; + if Assigned(Gutter) then + for I := 0 to Gutter.Bands.Count - 1 do + begin + Band := Gutter.Bands[I]; + if not Band.Visible then + Continue; + if Gutter.Bands[I] = Self then + Exit(L); + Inc(L, Band.RealWidth); + end; +end; + +function TSynGutterBand.GetSynGutter: TSynGutter; +begin + if Assigned(Collection) then + Result := Collection.Owner as TSynGutter + else + Result := nil; +end; + +function TSynGutterBand.GetVisible: Boolean; +begin + Result := FVisible; + case FKind of + gbkLineNumbers: + Result := Assigned(Gutter) and Gutter.ShowLineNumbers; + gbkFold: + Result := Assigned(Editor) and TCustomSynEdit(Editor).UseCodeFolding; + gbkTrackChanges: + Result := Assigned(Gutter) and Gutter.TrackChanges.Visible; + end; +end; -{$IFNDEF SYN_COMPILER_4_UP} +function TSynGutterBand.GetWidth: Integer; +begin + case FKind of + gbkLineNumbers, gbkFold, gbkTrackChanges: + Result := 0; + else + Result := FWidth; + end; +end; -{ TBetterRegistry } +function TSynGutterBand.IsVisibleStored: Boolean; +begin + Result := not FVisible and + not(FKind in [gbkLineNumbers, gbkFold, gbkTrackChanges]); +end; -function TBetterRegistry.OpenKeyReadOnly(const Key: string): Boolean; +function TSynGutterBand.IsWidthStored: Boolean; +begin + Result := not(FKind in [gbkLineNumbers, gbkFold, gbkTrackChanges]); +end; - function IsRelative(const Value: string): Boolean; +procedure TSynGutterBand.PaintFoldShapes(RT: ID2D1RenderTarget; ClipR: TRect; + const FirstRow, LastRow: Integer); +var + SynEdit: TCustomSynEdit; + vLine: Integer; + cRow: Integer; + rcFold: TRect; + X, Y: Integer; + FoldRange: TSynFoldRange; + Index: Integer; + Margin: Integer; + PMMargin: Integer; + ShapeSize: Integer; + PPI: Integer; + Brush: ID2D1Brush; +begin + SynEdit := TCustomSynEdit(Editor); + Assert(Assigned(SynEdit)); + Assert(Assigned(Gutter)); + PPI := Gutter.FCurrentPPI; + + // Draw the folding lines and squares + if SynEdit.UseCodeFolding then begin - Result := not ((Value <> '') and (Value[1] = '\')); + Margin := MulDiv(MarginX, PPI, 96); + PMMargin := Margin div 2; + ShapeSize := SynEdit.CodeFolding.ScaledGutterShapeSize(PPI); + + Brush := TSynDWrite.SolidBrush(SynEdit.CodeFolding.FolderBarLinesColor); + + RT.SetAntialiasMode(D2D1_ANTIALIAS_MODE_ALIASED); + for cRow := FirstRow to LastRow do + begin + vLine := SynEdit.RowToLine(cRow); + if (vLine > SynEdit.Lines.Count) { and not (SynEdit.Lines.Count = 0) } + then + Break; + + rcFold.TopLeft := Point(ClipR.Left + Margin, (cRow - SynEdit.TopLine) * + SynEdit.LineHeight + (SynEdit.LineHeight - ShapeSize) div 2); + rcFold.BottomRight := rcFold.TopLeft; + // Direct2D includes both the first and the last point in the rectangle! + rcFold.BottomRight.Offset(ShapeSize - 1, ShapeSize - 1); + + // Any fold ranges beginning on this line? + if SynEdit.AllFoldRanges.FoldStartAtLine(vLine, Index) then + begin + FoldRange := SynEdit.AllFoldRanges.Ranges[Index]; + // Paint the square + RT.DrawRectangle(rcFold, Brush); + + // Paint minus sign + Y := rcFold.Top + ShapeSize div 2; + // DrawLine paints the last pixel as well in Direct2D + RT.DrawLine( + Point(rcFold.Left + PMMargin, Y), + Point(rcFold.Right - PMMargin - 1, Y), Brush); + + // Paint vertical line of plus sign + if FoldRange.Collapsed then + begin + X := rcFold.Left + ShapeSize div 2; + RT.DrawLine( + Point(X, rcFold.Top + PMMargin), + Point(X, rcFold.Bottom - PMMargin - 1), Brush); + end + else + // Draw the bottom part of a line + begin + X := rcFold.Left + ShapeSize div 2; + RT.DrawLine(D2D1PointF(X, rcFold.Bottom), + D2D1PointF(X, (cRow - SynEdit.TopLine + 1) * SynEdit.LineHeight), Brush); + end; + end + else + begin + // Need to paint a line end? + if SynEdit.AllFoldRanges.FoldEndAtLine(vLine, Index) then + begin + X := rcFold.Left + ShapeSize div 2; + Y := rcFold.Top + (rcFold.Bottom - rcFold.Top) div 2; + RT.DrawLine( + D2D1PointF(X, (cRow - SynEdit.TopLine) * SynEdit.LineHeight), + D2D1PointF(X, Y), + Brush); + RT.DrawLine( + D2D1PointF(X, Y), + D2D1PointF(rcFold.Right, Y), + Brush); + end; + // Need to paint a line? + if SynEdit.AllFoldRanges.FoldAroundLine(vLine, Index) then + begin + X := rcFold.Left + ShapeSize div 2; + RT.DrawLine( + D2D1PointF(X, (cRow - SynEdit.TopLine) * SynEdit.LineHeight), + D2D1PointF(X, (cRow - SynEdit.TopLine + 1) * SynEdit.LineHeight), + Brush); + end; + end; + end; + RT.SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); end; +end; +procedure TSynGutterBand.PaintLineNumbers(RT: ID2D1RenderTarget; ClipR: TRect; + const FirstRow, LastRow: Integer); var - TempKey: HKey; + SynEdit: TCustomSynEdit; + Row, Line: Integer; + LineTop: Integer; + LineRect: TRect; + PPI: Integer; S: string; - Relative: Boolean; + TextFormat: TSynTextFormat; + WordWrapGlyph: ID2D1Bitmap; + RectF: TRectF; + FontColor: TColor; begin - S := Key; - Relative := IsRelative(S); + SynEdit := TCustomSynEdit(Editor); + Assert(Assigned(Gutter)); + Assert(Assigned(SynEdit)); + PPI := Gutter.FCurrentPPI; - if not Relative then Delete(S, 1, 1); - TempKey := 0; - Result := RegOpenKeyEx(GetBaseKey(Relative), PChar(S), 0, - KEY_READ, TempKey) = ERROR_SUCCESS; - if Result then + if Gutter.UseFontStyle then + begin + TextFormat := Gutter.FTextFormat; + FontColor := Gutter.Font.Color; + end + else + begin + TextFormat := SynEdit.TextFormat; + FontColor := SynEdit.Font.Color; + end; + TextFormat.IDW.SetTextAlignment(DWRITE_TEXT_ALIGNMENT_TRAILING); + TextFormat.IDW.SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_CENTER); + + if SynEdit.WordWrap and SynEdit.WordWrapGlyph.Visible then + try + WordWrapGlyph := SynEdit.WordWrapGlyph.D2D1Bitmap(RT); + except + WordWrapGlyph := nil; + end; + + for Row := FirstRow to LastRow do + begin + Line := SynEdit.RowToLine(Row); + LineTop := (Row - SynEdit.TopLine) * SynEdit.LineHeight; + LineRect := Rect(ClipR.Left + MulDiv(MarginX, PPI, 96), LineTop, + ClipR.Right, LineTop + SynEdit.LineHeight); + + if SynEdit.WordWrap and SynEdit.WordWrapGlyph.Visible and + (Row <> SynEdit.LineToRow(Line)) and Assigned(WordWrapGlyph) + then + begin + // paint wrapped line glyphs + RectF := LineRect; + RectF := Rect(0, 0, 0, 0); + RectF.Size := SynEdit.WordWrapGlyph.Size; + RectF.Offset(LineRect.Left + LineRect.Width - RectF.Width, + LineRect.Top + (LineRect.Height - RectF.Height) / 2); + if not LineRect.Contains(RectF.Round) then + begin + RectF := RectF.FitInto(LineRect); + RectF.Offset(LineRect.Right - RectF.Right, 0); + end; + RT.DrawBitmap(WordWrapGlyph, @RectF, 1000); + end + else + begin + // paint line numbers + S := Gutter.FormatLineNumber(Line); + if Assigned(SynEdit.OnGutterGetText) then + SynEdit.OnGutterGetText(SynEdit, Line, S); + RT.DrawText(PChar(S), S.Length, TextFormat.IDW, LineRect, + TSynDWrite.SolidBrush(FontColor), + D2D1_DRAW_TEXT_OPTIONS_CLIP + + IfThen(TOSVersion.Check(6,3), D2D1_DRAW_TEXT_OPTIONS_ENABLE_COLOR_FONT, 0), + DWRITE_MEASURING_MODE_GDI_NATURAL); + end; + end; + + if not Gutter.UseFontStyle then begin - if (CurrentKey <> 0) and Relative then S := CurrentPath + '\' + S; - ChangeKey(TempKey, S); + TextFormat.IDW.SetTextAlignment(DWRITE_TEXT_ALIGNMENT_LEADING); + TextFormat.IDW.SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_NEAR); end; -end; { TBetterRegistry.OpenKeyReadOnly } +end; -{$ENDIF SYN_COMPILER_4_UP} +procedure TSynGutterBand.PaintLines(RT: ID2D1RenderTarget; ClipR: TRect; const + FirstRow, LastRow: Integer); +var + DoDefault: Boolean; +begin + DoDefault := True; + if Assigned(FOnPaintLines) then + FOnPaintLines(RT, ClipR, FirstRow, LastRow, DoDefault); + if DoDefault then + DoPaintLines(RT, ClipR, FirstRow, LastRow); +end; +procedure TSynGutterBand.PaintMargin(RT: ID2D1RenderTarget; ClipR: TRect; const + FirstRow, LastRow: Integer); +var + Offset: Integer; begin - InternalResources := nil; + if (Gutter.BorderStyle <> gbsNone) then + begin + RT.SetAntialiasMode(D2D1_ANTIALIAS_MODE_ALIASED); + if Gutter.BorderStyle = gbsMiddle then + Offset := Max(2, (ClipR.Right - ClipR.Left) div 2) + else + Offset := 1; + RT.DrawLine( + Point(ClipR.Right - Offset, ClipR.Top), + Point(ClipR.Right - Offset, ClipR.Bottom), + TSynDWrite.SolidBrush(Gutter.BorderColor)); + RT.SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); + end; +end; + +procedure TSynGutterBand.PaintMarks(RT: ID2D1RenderTarget; ClipR: TRect; const + FirstRow, LastRow: Integer); +var + SynEdit: TCustomSynEdit; + + procedure DrawMark(aMark: TSynEditMark; var aGutterOff: Integer; + aMarkRow: Integer); + begin + if (not aMark.InternalImage) and + Assigned(SynEdit.BookMarkOptions.BookmarkImages) then + begin + if aMark.ImageIndex <= SynEdit.BookMarkOptions.BookmarkImages.Count then + begin + if aMark.IsBookmark = SynEdit.BookMarkOptions.DrawBookmarksFirst then + aGutterOff := 0 + else if aGutterOff = 0 then + aGutterOff := SynEdit.BookMarkOptions.Xoffset; + ImageListDraw(RT, SynEdit.BookMarkOptions.BookmarkImages, + ClipR.Left + SynEdit.BookMarkOptions.LeftMargin + aGutterOff, + (aMarkRow - SynEdit.TopLine) * SynEdit.LineHeight, aMark.ImageIndex); + Inc(aGutterOff, SynEdit.BookMarkOptions.Xoffset); + end; + end + else + begin + if aMark.ImageIndex in [0 .. 9] then + begin + if aGutterOff = 0 then + begin + Gutter.InternalImage.Draw(RT, aMark.ImageIndex, + ClipR.Left + SynEdit.BookMarkOptions.LeftMargin + aGutterOff, + (aMarkRow - SynEdit.TopLine) * SynEdit.LineHeight, + SynEdit.LineHeight); + end; + Inc(aGutterOff, SynEdit.BookMarkOptions.Xoffset); + end; + end; + end; + +var + vFirstLine: Integer; + vLastLine: Integer; + cMark: Integer; + vMarkRow: Integer; + aGutterOffs: TArray; + bHasOtherMarks: Boolean; + Index: Integer; +begin + SynEdit := TCustomSynEdit(Editor); + Assert(Assigned(SynEdit)); + + vFirstLine := SynEdit.RowToLine(FirstRow); + vLastLine := SynEdit.RowToLine(LastRow); + + if SynEdit.BookMarkOptions.GlyphsVisible and (SynEdit.Marks.Count > 0) and + (vLastLine >= vFirstLine) then + begin + SetLength(aGutterOffs, LastRow - FirstRow + 1); + // Instead of making a two pass loop we look while drawing the bookmarks + // whether there is any other mark to be drawn + bHasOtherMarks := False; + for cMark := 0 to SynEdit.Marks.Count - 1 do + with SynEdit.Marks[cMark] do + if Visible and (Line >= vFirstLine) and (Line <= vLastLine) and + (Line <= SynEdit.Lines.Count) and + not(SynEdit.UseCodeFolding and SynEdit.AllFoldRanges.FoldHidesLine + (Line, Index)) then + begin + if IsBookmark <> SynEdit.BookMarkOptions.DrawBookmarksFirst then + bHasOtherMarks := True + else + begin + vMarkRow := SynEdit.LineToRow(Line); + if vMarkRow >= FirstRow then + DrawMark(SynEdit.Marks[cMark], aGutterOffs[vMarkRow - FirstRow], + vMarkRow); + end + end; + if bHasOtherMarks then + for cMark := 0 to SynEdit.Marks.Count - 1 do + with SynEdit.Marks[cMark] do + begin + if Visible and + (IsBookmark <> SynEdit.BookMarkOptions.DrawBookmarksFirst) and + (Line >= vFirstLine) and (Line <= vLastLine) and + (Line <= SynEdit.Lines.Count) and + not(SynEdit.UseCodeFolding and SynEdit.AllFoldRanges.FoldHidesLine + (Line, Index)) then + begin + vMarkRow := SynEdit.LineToRow(Line); + if vMarkRow >= FirstRow then + DrawMark(SynEdit.Marks[cMark], aGutterOffs[vMarkRow - FirstRow], + vMarkRow); + end; + end; + end +end; + +procedure TSynGutterBand.PaintTrackChanges(RT: ID2D1RenderTarget; ClipR: TRect; + const FirstRow, LastRow: Integer); +var + SynEdit: TCustomSynEdit; + Row, Line: Integer; + LineTop: Integer; + LineRect: TRect; + PPI: Integer; + Color: TColor; + Flags: TSynLineChangeFlags; +begin + SynEdit := TCustomSynEdit(Editor); + Assert(Assigned(Gutter)); + Assert(Assigned(SynEdit)); + PPI := Gutter.FCurrentPPI; + + for Row := FirstRow to LastRow do + begin + Line := SynEdit.RowToLine(Row); + if (Line < 1) or (Line > SynEdit.Lines.Count) then Continue; + + LineTop := (Row - SynEdit.TopLine) * SynEdit.LineHeight; + Flags := TSynEditStringList(SynEdit.Lines).ChangeFlags[Line - 1]; + Color := clNone; + if Flags = [sfModified] then + Color := Gutter.TrackChanges.ModifiedColor + else if Flags = [sfSaved, sfAsSaved] then + Color := Gutter.TrackChanges.SavedColor + else if Flags = [sfSaved] then + Color := Gutter.TrackChanges.OriginalColor + else if Flags = [sfSaved, sfModified] then + Color := Gutter.TrackChanges.SavedModifiedColor; + + if Color <> clNone then + begin + LineRect := Rect(ClipR.Left + MulDiv(MarginX, PPI, 96), LineTop, + ClipR.Right, LineTop + SynEdit.LineHeight); + RT.FillRectangle(LineRect, TSynDWrite.SolidBrush(Color)); + end; + end; +end; + +function TSynGutterBand.RealWidth: Integer; +var + PPI: Integer; +begin + Assert(Assigned(Editor)); + Assert(Assigned(Gutter)); + PPI := Gutter.FCurrentPPI; + if Visible then + case FKind of + // A margin of two pixels at the end + gbkLineNumbers: + Result := Gutter.FAutoSizeDigitCount * + IfThen(Gutter.UseFontStyle, Gutter.FCharWidth, TCustomSynEdit(Editor).CharWidth) + + MulDiv(MarginX, PPI, 96); + gbkFold: + Result := TCustomSynEdit(Editor).CodeFolding.ScaledGutterShapeSize(PPI) + + MulDiv(MarginX, PPI, 96); + gbkTrackChanges: + Result := MulDiv(Gutter.TrackChanges.Width + MarginX, PPI, 96); + else + Result := MulDiv(FWidth, PPI, 96); + end + else + Result := 0; +end; + +procedure TSynGutterBand.SetBackground(const Value: TSynGutterBandBackground); +begin + FBackground := Value; + Changed(False); +end; + +procedure TSynGutterBand.SetKind(Kind: TSynGutterBandKind); +begin + FKind := Kind; + Changed(False); +end; + +procedure TSynGutterBand.SetOnPaintLines(const Value: TGutterBandPaintEvent); +begin + FOnPaintLines := Value; + Changed(False); +end; + +procedure TSynGutterBand.SetVisible(const Value: Boolean); +begin + FVisible := Value; + Changed(False); +end; + +procedure TSynGutterBand.SetWidth(const Value: Integer); +begin + if not(FKind in [gbkLineNumbers, gbkFold]) then + begin + FWidth := Value; + Changed(False); + end; +end; + +{$ENDREGION} + + +{$REGION 'TSynBandsCollection'} + +function TSynBandsCollection.GetBands(Index: Integer): TSynGutterBand; +begin + Result := TSynGutterBand(Items[Index]); +end; + +procedure TSynBandsCollection.Update(Item: TCollectionItem); +var + Gutter: TSynGutter; +begin + inherited; + Gutter := TSynGutter(GetOwner); + if Assigned(Gutter) then + Gutter.Changed; +end; + +{$ENDREGION} + + +{$REGION 'TTrackChanges'} + +procedure TSynTrackChanges.Assign(Source: TPersistent); +begin + if Assigned(Source) and (Source is TSynTrackChanges) then + begin + var Src := TSynTrackChanges(Source); + if Assigned(FOwner) then + FOwner.BeginUpdate; + try + FVisible := Src.Visible; + FWidth := Src.Width; + FSavedColor := Src.SavedColor; + FModifiedColor := Src.ModifiedColor; + FSavedModifiedColor := Src.SavedModifiedColor; + FOriginalColor := Src.OriginalColor; + finally + if Assigned(FOwner) then + FOwner.EndUpdate; + end; + end + else + inherited; +end; + +constructor TSynTrackChanges.Create(Gutter: TSynGutter); +begin + inherited Create; + FOwner := Gutter; + FWidth := 4; + FSavedColor := $33AA33; + FModifiedColor := $0000DFFF; + FSavedModifiedColor := clWebOrange; + FOriginalColor := $00FF6633; +end; + +function TSynTrackChanges.GetOwner: TPersistent; +begin + Result := FOwner; +end; + +procedure TSynTrackChanges.SetModifiedColor(const Value: TColor); +begin + if FModifiedColor <> Value then + begin + FModifiedColor := Value; + if FVisible and Assigned(FOwner) then + FOwner.Changed; + end; +end; + +procedure TSynTrackChanges.SetOriginalColor(const Value: TColor); +begin + if FOriginalColor <> Value then + begin + FOriginalColor := Value; + if FVisible and Assigned(FOwner) then + FOwner.Changed; + end; +end; + +procedure TSynTrackChanges.SetSavedColor(const Value: TColor); +begin + if FSavedColor <> Value then + begin + FSavedColor := Value; + if FVisible and Assigned(FOwner) then + FOwner.Changed; + end; +end; + +procedure TSynTrackChanges.SetSavedModifiedColor(const Value: TColor); +begin + if FSavedModifiedColor <> Value then + begin + FSavedModifiedColor := Value; + if FVisible and Assigned(FOwner) then + FOwner.Changed; + end; +end; + +procedure TSynTrackChanges.SetVisible(const Value: Boolean); +begin + if FVisible <> Value then + begin + FVisible := Value; + if Assigned(FOwner) then + FOwner.Changed; + end; +end; + +procedure TSynTrackChanges.SetWidth(const Value: Integer); +begin + if FWidth <> Value then + begin + FWidth := Value; + if FVisible and Assigned(FOwner) then + FOwner.Changed; + end; +end; + +{$ENDREGION} + + +{$REGION 'TSynIndentGuides'} + +{ TSynStructureColor } + +procedure TSynStructureColor.Assign(Source: TPersistent); +begin + if Source is TSynStructureColor then + Self.FColor := TSynStructureColor(Source).Color + else + inherited; +end; + +procedure TSynStructureColor.SetColor(const Value: TColor); +begin + if FColor <> Value then + begin + FColor := Value; + Changed(False); + end; +end; + +{ TSynStructureColors } + +function TSynStructureColors.GetColors(Index: Integer): TSynStructureColor; +begin + Result := TSynStructureColor(Items[Index]); +end; + +{ TSynStructureColors } +procedure TSynIndentGuides.Assign(Source: TPersistent); +var + Src: TSynIndentGuides; +begin + if (Source <> nil) and (Source is TSynIndentGuides) then + begin + Src := TSynIndentGuides(Source); + FVisible := Src.FVisible; + FStyle := Src.FStyle; + FColor := Src.FColor; + FUseStructureColors := Src.UseStructureColors; + FStructureHighlight := Src.StructureHighlight; + FStructureColors.Assign(Src.StructureColors); + if Assigned(FOnChange) then + FOnChange(Self); + end + else + inherited Assign(Source); +end; + +procedure TSynIndentGuides.Changed; +begin + if Assigned(FOnChange) then + FOnChange(Self); +end; + +constructor TSynIndentGuides.Create(Owner: TPersistent); +begin + FOwner := Owner; + Create; +end; + +constructor TSynIndentGuides.Create; +begin + inherited Create; + FVisible := True; + FStyle := igsSolid; + FColor := clMedGray; + FStructureHighlight := True; + FUseStructureColors := True; + FStructureColors := TSynStructureColors.Create(Self, TSynStructureColor); + // Initialize structure colors + FStructureColors.BeginUpdate; + try + with TSynStructureColor(FStructureColors.Add) do Color := $FF901E; // clWebDodgerBlue; + with TSynStructureColor(FStructureColors.Add) do Color := $008CFF; // clWebDarkOrange; + with TSynStructureColor(FStructureColors.Add) do Color := $20A5DA; // clWebGoldenRod; + with TSynStructureColor(FStructureColors.Add) do Color := $008080; // clWebOlive + finally + FStructureColors.EndUpdate; + end; + // So that StructuredColors are not stored unless modified + FStructuredColorsModified := False; +end; + +destructor TSynIndentGuides.Destroy; +begin + FStructureColors.Free; + inherited; +end; + +function TSynIndentGuides.GetOwner: TPersistent; +begin + Result := FOwner; +end; + +procedure TSynIndentGuides.SetColor(const Value: TColor); +begin + if FColor <> Value then + begin + FColor := Value; + Changed; + end; +end; + +procedure TSynIndentGuides.SetStructureColors(const Value: TSynStructureColors); +begin + FStructureColors.Assign(Value); + Changed; +end; + +procedure TSynIndentGuides.SetStructureHighlight(const Value: Boolean); +begin + if FStructureHighlight <> Value then + begin + FStructureHighlight := Value; + Changed; + end; +end; + +procedure TSynIndentGuides.SetStyle(const Value: TSynIdentGuidesStyle); +begin + if FStyle <> Value then + begin + FStyle := Value; + Changed; + end; +end; + +procedure TSynIndentGuides.SetUseStructureColors(const Value: Boolean); +begin + if FUseStructureColors <> Value then + begin + FUseStructureColors := Value; + Changed; + end; +end; + +procedure TSynIndentGuides.SetVisible(const Value: Boolean); +begin + if FVisible <> Value then + begin + FVisible := Value; + Changed; + end; +end; + +{$ENDREGION} + + +{$REGION 'TSynIndicators'} + +procedure TSynIndicators.Add(Line: Integer; const Indicator: TSynIndicator; + Invalidate: Boolean = True); +var + Arr: TArray; +begin + if FList.TryGetValue(Line, Arr) then + FList[Line] := Arr + [Indicator] + else + FList.Add(Line, [Indicator]); + if Invalidate then + InvalidateIndicator(Line, Indicator); +end; + +procedure TSynIndicators.Clear; +begin + FList.Clear; +end; + +procedure TSynIndicators.Clear(Id: TGUID; Invalidate: Boolean = True; Line: Integer = -1); + + procedure ProcessLine(ALine: Integer); + var + Indicators: TArray; + I: Integer; + begin + if FList.TryGetValue(ALine, Indicators) then + begin + for I := Length(Indicators) - 1 downto 0 do + if Indicators[I].Id = Id then + begin + if Invalidate then + InvalidateIndicator(ALine, Indicators[I]); + Delete(Indicators, I, 1); + end; + if Length(Indicators) = 0 then + FList.Remove(ALine) + else + FList[ALine] := Indicators; + end; + end; + +var + ALine: Integer; +begin + if Line < 0 then + for ALine in FList.Keys.ToArray do + ProcessLine(ALine) + else + ProcessLine(Line); +end; + +procedure TSynIndicators.Clear(Line: Integer; const Indicator: TSynIndicator); +var + Indicators: TArray; + I: Integer; +begin + if FList.TryGetValue(Line, Indicators) then + begin + for I := 0 to Length(Indicators) - 1 do + if Indicators[I] = Indicator then + begin + InvalidateIndicator(Line, Indicator); + Delete(Indicators, I, 1); + if Length(Indicators) = 0 then + FList.Remove(Line) + else + FList[Line] := Indicators; + Break; + end; + end; +end; + +constructor TSynIndicators.Create(Owner: TCustomControl); +begin + inherited Create; + FOwner := Owner; + FList := TDictionary>.Create; +end; + +destructor TSynIndicators.Destroy; +begin + FRegister.Free; + FList.Free; + inherited; +end; + +function TSynIndicators.GetSpec(Id: TGUID): TSynIndicatorSpec; +begin + Result := FRegister[Id]; +end; + +function TSynIndicators.IndicatorAtMousePos(MousePos: TPoint; const Id: TGUID; + var Indicator: TSynIndicator): Boolean; +var + DC: TDisplayCoord; + BC: TBufferCoord; + Editor: TCustomSynEdit; +begin + Editor := FOwner as TCustomSynEdit; + DC := Editor.PixelsToRowColumn(MousePos.X, MousePos.Y); + BC := Editor.DisplayToBufferPos(DC); + Result := IndicatorAtPos(BC, Id, Indicator); +end; + +function TSynIndicators.IndicatorAtMousePos(MousePos: TPoint; + var Indicator: TSynIndicator): Boolean; +begin + Result := IndicatorAtMousePos(MousePos, TGUID.Empty, Indicator); +end; + +function TSynIndicators.IndicatorAtPos(Pos: TBufferCoord; + var Indicator: TSynIndicator): Boolean; +begin + Result := IndicatorAtPos(Pos, TGUID.Empty, Indicator); +end; + +function TSynIndicators.IndicatorAtPos(Pos: TBufferCoord; const Id: TGUID; var + Indicator: TSynIndicator): Boolean; +var + LineIndicators: TArray; + LIndicator: TSynIndicator; +begin + Result := False; + if FList.TryGetValue(Pos.Line, LineIndicators) then + begin + for LIndicator in LineIndicators do + if InRange(Pos.Char, LIndicator.CharStart, LIndicator.CharEnd - 1) and + ((Id = TGUID.Empty) or (LIndicator.Id = Id)) then + begin + Indicator := LIndicator; + Exit(True); + end; + end; +end; + +procedure TSynIndicators.InvalidateIndicator(Line: Integer; const Indicator: TSynIndicator); +begin + TCustomSynEdit(FOwner).InvalidateRange(BufferCoord(Indicator.CharStart, Line), + BufferCoord(Indicator.CharEnd, Line)); +end; + +function TSynIndicators.LineIndicators(Line: Integer): TArray; +begin + // Sets Result to [] if not found + FList.TryGetValue(Line, Result); +end; + +procedure TSynIndicators.LinePut(aIndex: Integer); +{ aIndex 0-based Indicator lines 1-based} +begin + FList.Remove(aIndex + 1); +end; + +procedure TSynIndicators.LinesDeleted(FirstLine, Count: Integer); +{ Adjust Indicator lines for deletion - + FirstLine 0-based Indicator lines 1-based} +var + Keys: TArray; + Line: Integer; +begin + Keys := FList.Keys.ToArray; + TArray.Sort(Keys); + for Line in Keys do + begin + if InRange(Line, FirstLine + 1, FirstLine + Count) then + FList.Remove(Line) + else if Line > FirstLine + Count then + begin + FList.Add(Line - Count, FList[Line]); + FList.Remove(Line); + end; + end; +end; + +procedure TSynIndicators.LinesInserted(FirstLine, Count: Integer); +{ Adjust Indicator lines for insertion - + FirstLine 0-based. Indicator lines 1-based.} +var + Keys: TArray; + I, Line: Integer; +begin + Keys := FList.Keys.ToArray; + TArray.Sort(Keys); + for I := Length(Keys) - 1 downto 0 do + begin + Line := Keys[I]; + if Line > FirstLine then + begin + FList.Add(Line + Count, FList[Line]); + FList.Remove(Line); + end; + end; +end; + +class procedure TSynIndicators.Paint(RT: ID2D1RenderTarget; + Spec: TSynIndicatorSpec; const ClipR: TRect; StartOffset: Integer); +var + Geometry: ID2D1PathGeometry; + Sink: ID2D1GeometrySink; + Delta: Integer; + P: TPoint; + R: TRect; +begin + R := ClipR; + Dec(R.Left, StartOffset); + RT.PushAxisAlignedClip(ClipR, D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); + case Spec.Style of + sisTextDecoration: + // Otherwise it is already hanlded + if not SameValue(Spec.Background.a, 0) and + not SameValue(Spec.Background.a, 1) + then + RT.FillRectangle(R, TSynDWrite.SolidBrush(Spec.Background)); + sisSquiggleMicrosoftWord, + sisSquiggleWordPerfect: + begin + Dec(R.Right); + CheckOSError(TSynDWrite.D2DFactory.CreatePathGeometry(Geometry)); + CheckOSError(Geometry.Open(Sink)); + Delta := Round(R.Height / 6); + if Spec.Style = sisSquiggleMicrosoftWord then + begin + P := Point(R.Left, R.Bottom - Delta); + Sink.BeginFigure(P, D2D1_FIGURE_BEGIN_HOLLOW); + while P.X < R.Right do + begin + Inc(P.X, Abs(Delta)); + Inc(P.Y, Delta); + Delta := -Delta; + Sink.AddLine(P); + end; + Sink.EndFigure(D2D1_FIGURE_END_OPEN); + end + else + begin + P := Point(R.Left, R.Bottom); + while P.X < R.Right do + begin + Sink.BeginFigure(P, D2D1_FIGURE_BEGIN_HOLLOW); + P.Offset(Delta, -Delta); + Sink.AddLine(P); + Sink.EndFigure(D2D1_FIGURE_END_OPEN); + P.Offset(Delta - 1, Delta) + end; + end; + CheckOSError(Sink.Close); + + RT.DrawGeometry(Geometry, TSynDWrite.SolidBrush(Spec.Foreground)); + end; + sisRectangle, + sisFilledRectangle: + begin + Dec(R.Right); Dec(R.Bottom); + if Spec.Style = sisFilledRectangle then + RT.FillRectangle(R, TSynDWrite.SolidBrush(Spec.Background)); + if TAlphaColorF(Spec.Foreground) <> TAlphaColorF(clNoneF) then + RT.DrawRectangle(R, TSynDWrite.SolidBrush(Spec.Foreground)); + end; + sisRoundedRectangle, + sisRoundedFilledRectangle: + begin + Dec(R.Right); Dec(R.Bottom); + if Spec.Style = sisRoundedFilledRectangle then + RT.FillRoundedRectangle(D2D1RoundedRect(R, R.Height div 4, R.Height div 4), + TSynDWrite.SolidBrush(Spec.Background)); + RT.DrawRoundedRectangle(D2D1RoundedRect(R, R.Height div 4, R.Height div 4), + TSynDWrite.SolidBrush(Spec.Foreground)); + end; + end; + RT.PopAxisAlignedClip; +end; + +procedure TSynIndicators.RegisterSpec(Id: TGUID; Spec: TSynIndicatorSpec); +begin + if FRegister = nil then + FRegister := TDictionary.Create; + FRegister.AddOrSetValue(Id, Spec); +end; + +procedure TSynStructureColors.Update(Item: TCollectionItem); +var + IndentGuides : TSynIndentGuides; +begin + inherited; + IndentGuides := TSynIndentGuides(GetOwner); + if Assigned(IndentGuides) then + begin + IndentGuides.FStructuredColorsModified := True; + IndentGuides.Changed; + end; +end; + +{ TSynIndicatorSpec } + +constructor TSynIndicatorSpec.Create(AStyle: TSynIndicatorStyle; AForeground, + ABackground: TD2D1ColorF; AFontStyle: TFontStyles); +begin + Self.Style := AStyle; + Self.Foreground := AForeground; + Self.Background := ABackground; + Self.FontStyle := AFontStyle; +end; + +class function TSynIndicatorSpec.New(AStyle: TSynIndicatorStyle; AForeground, + ABackground: TD2D1ColorF; AFontStyle: TFontStyles): TSynIndicatorSpec; +begin + Result.Create(AStyle, AForeground, ABackground, AFontStyle); +end; + +{ TSynIndicator } + +constructor TSynIndicator.Create(aId: TGUID; aCharStart, aCharEnd: Integer; + aTag: NativeInt = 0); +begin + Self.Id := aId; + Self.CharStart := aCharStart; + Self.CharEnd := aCharEnd; + Self.Tag := aTag; +end; + +class operator TSynIndicator.Equal(const A, B: TSynIndicator): Boolean; +begin + Result := (A.Id = B.Id) and (A.CharStart = B.CharStart) + and (A.CharEnd = B.CharEnd); +end; + +class function TSynIndicator.New(aId: TGUID; aCharStart, aCharEnd: Integer; + aTag: NativeInt = 0): TSynIndicator; +begin + Result.Create(aId, aCharStart, aCharEnd, aTag); +end; + +{$ENDREGION} + +{$REGION 'TSynBracketsHighlight'} + +constructor TSynBracketsHighlight.Create(Owner: TPersistent); +begin + inherited Create; + FOwner := Owner; + // Initialize with a blueish color + SetFontColorsAndStyle($FF8800, clRed, [fsBold]); +end; + +procedure TSynBracketsHighlight.SetFontColorsAndStyle( + const MatchingBracketsColor, UnbalancedBracketColor: TColor; + FontStyle: TFontStyles); +begin + SetIndicatorSpecs( + TSynIndicatorSpec.New(sisTextDecoration, D2D1ColorF(MatchingBracketsColor), clNoneF, FontStyle), + TSynIndicatorSpec.New(sisTextDecoration, D2D1ColorF(UnbalancedBracketColor), clNoneF, FontStyle)); +end; + +procedure TSynBracketsHighlight.SetIndicatorSpecs(const MatchingBracketsSpec, + UnbalancedBracketSpec: TSynIndicatorSpec); +begin + if FOwner is TCustomSynEdit then + begin + TCustomSynEdit(FOwner).Indicators.RegisterSpec(MatchingBracketsIndicatorID, MatchingBracketsSpec); + TCustomSynEdit(FOwner).Indicators.RegisterSpec(UnbalancedBracketIndicatorID, UnbalancedBracketSpec); + end; +end; + +{$ENDREGION} + +{$REGION 'TSynSelections'} + +function TSynSelections.AddCaret(const ACaret: TBufferCoord; IsBase: Boolean): Boolean; +// If a selection has the same caret or contains the caret then remove it. +// Otherwise add a new selection +// Returns True if a new selection was added +var + Sel: TSynSelection; + Index: Integer; +begin + Result := False; + if FindSelection(ACaret, Index) then + begin + DeleteSelection(Index); + Restore(FSelections[FActiveSelIndex], False); + end + else if (Index > 0) and (FSelections[Index - 1].Caret = ACaret) then + begin + DeleteSelection(Index - 1); + Restore(FSelections[FActiveSelIndex], False); + end + else + begin + // ACaret is not included in any selection + Sel := TSynSelection.Create(ACaret, ACaret, ACaret); + FSelections.Insert(Index, Sel); + FActiveSelIndex := Index; + if IsBase then + FBaseSelIndex := Index + else if FBaseSelIndex >= Index then + Inc(FBaseSelIndex); + Result := True; + end; +end; + +procedure TSynSelections.CaretsChanged; +begin + TCustomSynEdit(FOwner).StateFlags := + TCustomSynEdit(FOwner).StateFlags + [sfCaretChanged, sfScrollbarChanged]; +end; + +procedure TSynSelections.Clear(KeepSelection: TKeepSelection); +var + Index: Integer; +begin + if FSelections.Count = 1 then Exit; + + if (KeepSelection = ksKeepBase) and (FActiveSelIndex <> FBaseSelIndex) then + Restore(BaseSelection); + + for Index := FSelections.Count - 1 downto 0 do + if not (((KeepSelection = ksKeepBase) and (Index = FBaseSelIndex)) or + ((KeepSelection = ksKeepActive) and (Index = FActiveSelIndex))) + then + DeleteSelection(Index); + + Assert (FSelections.Count = 1); + FBaseSelIndex := 0; + FActiveSelIndex := 0; + CaretsChanged; +end; + +procedure TSynSelections.ColumnSelection(Anchor, ACaret: TBufferCoord; + LastPosX: Integer); + + procedure SetLineSelection(Index, Line, FromChar, ToChar: Integer; ScrollPastEOL: Boolean); + var + LineString: string; + Len: Integer; + begin + LineString := TCustomSynEdit(FOwner).Lines[Line - 1]; + Len := LineString.Length; + if not ScrollPastEOL then + ToChar := EnsureRange(ToChar, 1, Len + 1); + FromChar := EnsureRange(FromChar, 1, Len + 1); + FSelections.List[Index].Caret := BufferCoord(ToChar, Line); + FSelections.List[Index].Start := BufferCoord(FromChar, Line); + FSelections.List[Index].Stop := BufferCoord(Min(ToChar, Len + 1), Line); + FSelections.List[Index].LastPosX := LastPosX; + InvalidateSelection(Index); + end; + + procedure SetRowSelection(Index, Row, FromChar, ToChar: Integer; ScrollPastEOL: Boolean); + var + Len: Integer; + begin + Len := TCustomSynEdit(FOwner).RowLength[Row]; + if not ScrollPastEOL then + ToChar := EnsureRange(ToChar, 1, Len + 1); + FromChar := EnsureRange(FromChar, 1, Len + 1); + FSelections.List[Index].Caret := + TCustomSynEdit(FOwner).DisplayToBufferPos(DisplayCoord(ToChar, Row)); + FSelections.List[Index].Start := + TCustomSynEdit(FOwner).DisplayToBufferPos(DisplayCoord(FromChar, Row)); + FSelections.List[Index].Stop := + TCustomSynEdit(FOwner).DisplayToBufferPos(DisplayCoord(Min(ToChar, Len + 1), Row)); + FSelections.List[Index].LastPosX := LastPosX; + InvalidateSelection(Index); + end; + +var + DC: TDisplayCoord; + FromChar, ToChar: Integer; + FromRow, ToRow: Integer; + Line, Row: Integer; + Index: Integer; + Increment: Integer; + ScrollPastEOL: Boolean; +begin + Clear; + InvalidateSelection(0); + + + ScrollPastEOL := eoScrollPastEol in TCustomSynEdit(FOwner).ScrollOptions; + + if TCustomSynEdit(FOwner).WordWrap then + begin + DC := TCustomSynEdit(FOwner).BufferToDisplayPos(Anchor); + FromChar := DC.Column; + FromRow := DC.Row; + DC := TCustomSynEdit(FOwner).BufferToDisplayPos(ACaret); + ToChar := DC.Column; + ToRow := DC.Row; + + SetRowSelection(0, FromRow, FromChar, ToChar, ScrollPastEOL); + + Increment := Sign(ToRow - FromRow); + + Row := FromRow; + while Row <> ToRow do + begin + Row := Row + Increment; + if Increment > 0 then + Index := FSelections.Add(TSynSelection.Invalid) + else + begin + FSelections.Insert(0, TSynSelection.Invalid); + Index := 0; + end; + SetRowSelection(Index, Row, FromChar, ToChar, ScrollPastEOL); + end; + end + else + begin + FromChar := Anchor.Char; + ToChar := ACaret.Char; + SetLineSelection(0, Anchor.Line, FromChar, ToChar, ScrollPastEOL); + + Increment := Sign(ACaret.Line - Anchor.Line); + + Line := Anchor.Line; + while Line <> ACaret.Line do + begin + Line := Line + Increment; + if Increment > 0 then + Index := FSelections.Add(TSynSelection.Invalid) + else + begin + FSelections.Insert(0, TSynSelection.Invalid); + Index := 0; + end; + SetLineSelection(Index, Line, FromChar, ToChar, ScrollPastEOL); + end; + end; + + if Increment >= 0 then + begin + FBaseSelIndex := 0; + FActiveSelIndex := FSelections.Count - 1 + end + else + begin + FBaseSelIndex := FSelections.Count -1; + FActiveSelIndex := 0; + end; + + Restore(ActiveSelection, False); + CaretsChanged; +end; + +constructor TSynSelections.Create(Owner: TPersistent); +begin + inherited Create; + FOwner := Owner; + FSelections := TList.Create(TComparer.Construct( + function(const L, R: TSynSelection): Integer + begin + if L.Normalized.Start < R.Normalized.Start then + Result := -1 + else if L.Normalized.Start = R.Normalized.Start then + Result := 0 + else + Result := 1; + end)); +end; + +procedure TSynSelections.DeleteSelection(Index: Integer); +var + Sel: TSynSelection; +begin + // Leave at least one selection + if FSelections.Count <= 1 then Exit; + + Sel := FSelections[Index]; + TCustomSynEdit(FOwner).InvalidateSelection(Sel); + FSelections.Delete(Index); + + if Index = FActiveSelIndex then + begin + if Index >= FSelections.Count then + FActiveSelIndex := FSelections.Count - 1; + end + else if FActiveSelIndex > Index then + Dec(FActiveSelIndex); + + if FBaseSelIndex = Index then + // Base becomes the last one as in VS Code + FBaseSelIndex := FSelections.Count - 1 + else if FBaseSelIndex > Index then + Dec(FBaseSelIndex); + + CaretsChanged; +end; + +destructor TSynSelections.Destroy; +begin + FSelections.Free; + inherited; +end; + +function TSynSelections.FindCaret(const ACaret: TBufferCoord): Integer; +var + Index: Integer; +begin + if FSelections.Count = 0 then Exit(-1); + + if FindSelection(ACaret, Index) then + begin + if FSelections[Index].Caret = ACaret then + Result := Index + else + Result := -1; + end + else if (Index > 0) and (FSelections[Index - 1].Caret = ACaret) then + Result := Index - 1 + else + Result := -1; +end; + +function TSynSelections.FindSelection(const BC: TBufferCoord; var Index: Integer): Boolean; +begin + if FSelections.BinarySearch(TSynSelection.Create(BC, BC, BC), Index) then + Exit(True); + + if Index = 0 then + // BC is before the start of the top selection + Exit(False); + + Result := FSelections[Index - 1].Contains(BC); + if Result then + Dec(Index) +end; + +function TSynSelections.GetActiveSelection: TSynSelection; +begin + Result := FSelections[FActiveSelIndex]; +end; + +function TSynSelections.GetBaseSelection: TSynSelection; +begin + Result := FSelections[FBaseSelIndex]; +end; + +function TSynSelections.GetCount: Integer; +begin + Result := FSelections.Count; +end; + +function TSynSelections.GetIsEmpty: Boolean; +var + Index: Integer; +begin + Result := True; + for Index := 0 to FSelections.Count - 1 do + if not FSelections.List[Index].IsEmpty then + Exit(False); +end; + +function TSynSelections.GetSelection(Index: Integer): TSynSelection; +begin + Result := FSelections[Index]; +end; + +procedure TSynSelections.InvalidateAll; +var + Index: Integer; +begin + for Index := 0 to FSelections.Count - 1 do + InvalidateSelection(Index); +end; + +procedure TSynSelections.InvalidateSelection(Index: Integer); +begin + TCustomSynEdit(FOwner).InvalidateSelection(FSelections[Index]); +end; + +procedure TSynSelections.LinePut(aIndex: Integer; const OldLine: string); +var + I: Integer; + Line: string; + OldLen, NewLen: Integer; + StartPos: Integer; + Delta: Integer; +begin + if FSelections.Count <= 1 then Exit; + + Line := TCustomSynEdit(FOwner).Lines[aIndex]; + LineDiff(Line, OldLine, StartPos, OldLen, NewLen); + Delta := NewLen - OldLen; + + for I := FActiveSelIndex + 1 to Count - 1 do + begin + with FSelections.List[I] do + begin + if (Start.Line > aIndex + 1) and (Stop.Line > aIndex + 1) then + Exit; + + if Caret.Line = aIndex + 1 then Inc(Caret.Char, Delta); + if Start.Line = aIndex + 1 then Inc(Start.Char, Delta); + if Stop.Line = aIndex + 1 then Inc(Stop.Char, Delta); + end; + end; +end; + +procedure TSynSelections.LinesDeleted(FirstLine, aCount: Integer); +var + I: Integer; + MinBC: TBufferCoord; +begin + if FSelections.Count <= 1 then Exit; + + for I := FActiveSelIndex + 1 to Count - 1 do + with FSelections.List[I] do + begin + if Caret.Line >= FirstLine + 1 then Dec(Caret.Line, aCount); + if Start.Line >= FirstLine + 1 then Dec(Start.Line, aCount); + if Stop.Line >= FirstLine + 1 then Dec(Stop.Line, aCount); + + if (Start.Line < FirstLine + 1) and (Stop.Line < FirstLine + 1) then + begin + FSelections.List[I] := TSynSelection.Invalid; + Continue; + end; + + MinBC := BufferCoord(FirstLine + 1, 1); + Caret := TBufferCoord.Max(Caret, MinBC); + Start := TBufferCoord.Max(Start, MinBC); + Stop := TBufferCoord.Max(Stop, MinBC); + end; +end; + +procedure TSynSelections.LinesInserted(FirstLine, aCount: Integer); +var + I: Integer; +begin + if FSelections.Count <= 1 then Exit; + + for I := FActiveSelIndex + 1 to Count - 1 do + with FSelections.List[I] do + begin + // FirstLine is 0-based + if Caret.Line >= FirstLine + 1 then Inc(Caret.Line, aCount); + if Start.Line >= FirstLine + 1 then Inc(Start.Line, aCount); + if Stop.Line >= FirstLine + 1 then Inc(Stop.Line, aCount); + end; +end; + +procedure TSynSelections.Merge; +// It is executed after the execution of a multi-selection command +// It removes invalid selections and merges overllapping selections + + function DoMerge(const Sel, NextSel: TSynSelection): TSynSelection; + var + Caret, Start, Stop: TBufferCoord; + begin + Start := TBufferCoord.Min( + TBufferCoord.Min(Sel.Start, Sel.Stop), + TBufferCoord.Min(NextSel.Start, NextSel.Stop)); + Stop := TBufferCoord.Max( + TBufferCoord.Max(Sel.Start, Sel.Stop), + TBufferCoord.Max(NextSel.Start, NextSel.Stop)); + + if NextSel.Caret = TBufferCoord.Min(NextSel.Start, NextSel.Stop) then + Caret := Start + else + Caret := Stop; + + Result := TSynSelection.Create(Caret, Start, Stop); + Result.LastPosX := Sel.LastPosX; + Result.CaretAtEOL := Sel.CaretAtEOL + end; + +var + Sel, NextSel: TSynSelection; + I: Integer; + BC: TBufferCoord; +begin + if FSelections.Count = 1 then Exit; + + // Remove Invalid + for I := Count - 1 downto 0 do + if not FSelections.List[I].IsValid then + DeleteSelection(I); + + // Selections should be sorted in increasing order of the normalized Start. + // Merge is concequtive selections overlap. + + NextSel := FSelections.List[Count - 1]; // last selection + for I := Count - 2 downto 0 do + begin + Sel := FSelections.List[I]; + + if (Sel = NextSel) or Sel.Intersects(NextSel) then + begin + Sel := DoMerge(Sel, NextSel); + FSelections.List[I] := Sel; + DeleteSelection(I + 1); + end; + NextSel := Sel; + end; + + // Process the case of one invalid selection + if (FSelections.Count = 1) and not FSelections.List[0].IsValid then + begin + BC := BufferCoord(1, 1); + FSelections.List[0] := TSynSelection.Create(BC, BC, BC); + end; + + // Activate the current selection + Restore(ActiveSelection, False); +end; + +procedure TSynSelections.MouseSelection(const Sel: TSynSelection); +// Mouse selection works differently than selection with the keyboard +// All other selections overlapping with the active selection get removed +// as in VS Code and Visual Studio. +begin + // Exit if there are no other selections + if FSelections.Count <= 1 then Exit; + + for var Index := FSelections.Count - 1 downto 0 do + begin + // Sel will become the active selection + if Index = FActiveSelIndex then + Continue; + if Sel.Intersects(fSelections.List[Index]) then + DeleteSelection(Index); + end; +end; + +function TSynSelections.PartSelectionsForRow( + const RowStart, RowEnd: TBufferCoord): TSynSelectionArray; +// Provides a list of canditates for partial selection of a Row +var + Sel: TSynSelection; +begin + Result := []; + for var Index := 0 to FSelections.Count - 1 do + begin + Sel := FSelections.List[Index].Normalized; + if Sel.Stop < RowStart then + Continue + else if Sel.Start > RowEnd then + Exit + else if not Sel.IsEmpty then + Result := Result + [Sel]; + end; +end; + +procedure TSynSelections.Restore(const [Ref] SelStorage: TSynSelStorage); +begin + InvalidateAll; + FSelections.Clear; + FSelections.AddRange(SelStorage.Selections); + FActiveSelIndex := SelStorage.ActiveIndex; + FBaseSelIndex := SelStorage.BaseIndex; + InvalidateAll; + Restore(ActiveSelection); + CaretsChanged; +end; + +procedure TSynSelections.Restore(const [Ref] Sel: TSynSelection; + EnsureVisible: Boolean); +var + TrimTrailingActive: Boolean; +begin + TrimTrailingActive := eoTrimTrailingSpaces in TCustomSynEdit(FOwner).Options; + if TrimTrailingActive then + TCustomSynEdit(FOwner).Options := TCustomSynEdit(FOwner).Options - + [eoTrimTrailingSpaces]; + TCustomSynEdit(FOwner).SetCaretAndSelection(Sel, EnsureVisible); + if TrimTrailingActive then + TCustomSynEdit(FOwner).Options := TCustomSynEdit(FOwner).Options + + [eoTrimTrailingSpaces]; +end; + +function TSynSelections.RowHasCaret(ARow, ALine: Integer): Boolean; +// Used in painting the active line + + function IsCaretOnRow(Sel: TSynSelection): Boolean; + begin + if TCustomSynEdit(FOwner).WordWrap then + Result := TCustomSynEdit(FOwner).SelectionToDisplayCoord(Sel).Row = ARow + else + Result := Sel.Caret.Line = ALine; + end; + +var + Sel: TSynSelection; + Index: Integer; +begin + // Find first selection that may contain the caret + FindSelection(BufferCoord(1, ALine), Index); + + Result := False; + while Index < FSelections.Count do + begin + Sel := FSelections[Index].Normalized; + if Sel.Start.Line > ALine then Break; + Result := IsCaretOnRow(Sel); + if Result then Break; + Inc(Index); + end; +end; + +procedure TSynSelections.SetActiveSelection(const Value: TSynSelection); +begin + FSelections[FActiveSelIndex] := Value; +end; + +procedure TSynSelections.SetActiveSelIndex(const Index: Integer); +var + Sel: TSynSelection; +begin + Assert(InRange(Index, 0, Count - 1)); + if Index <> FActiveSelIndex then + begin + FActiveSelIndex := Index; + Sel := ActiveSelection; + if Sel.IsValid then + Restore(ActiveSelection, False); + end; +end; + +procedure TSynSelections.SetBaseSelection(const Value: TSynSelection); +begin + FSelections[FBaseSelIndex] := Value; +end; + +procedure TSynSelections.Store(out SelStorage: TSynSelStorage); +begin + SelStorage.Selections := FSelections.ToArray; + SelStorage.BaseIndex := FBaseSelIndex; + SelStorage.ActiveIndex := FActiveSelIndex; +end; + +{$ENDREGION 'TSynSelections'} + +{$REGION 'TSynCarets'} + +procedure TSynCarets.Blink(Sender: TObject); +begin + InvertCarets; +end; + +constructor TSynCarets.Create(Canvas: TCanvas); +begin + inherited Create; + FCanvas := Canvas; + FBlinkTimer := TTimer.Create(nil); + FBlinkTimer.Interval := GetCaretBlinkTime; + FBlinkTimer.OnTimer := Blink; + FBlinkTimer.Enabled := False; + CaretRects := TList.Create; + CaretSize := 2; +end; + +destructor TSynCarets.Destroy; +begin + FBlinkTimer.Free; + CaretRects.Free; + inherited; +end; + +procedure TSynCarets.HideCarets; +begin + FBlinkTimer.Enabled := False; + + if FCaretsShown then + InvertCarets; +end; + +procedure TSynCarets.InvertCarets; +var + R: TRect; +begin + for R in CaretRects do + InvertRect(FCanvas.Handle, R); + + FCaretsShown := not FCaretsShown; +end; + +procedure TSynCarets.ShowCarets; +begin + Assert(not FCaretsShown); + if CaretRects.Count > 0 then + begin + InvertCarets; // show immediately + FBlinkTimer.Enabled := True; + end; + FCaretsShown := True; +end; + +{$ENDREGION 'TSynCarets'} + +{ TSynSelStorage } + +procedure TSynSelStorage.Clear; +begin + Selections := []; +end; + +{$REGION 'Scrollbar Annotations'} + +{ TSynScrollbarAnnItem } + +procedure TSynScrollbarAnnItem.Assign(Source: TPersistent); +var + Src: TSynScrollbarAnnItem; +begin + if Assigned(Source) and (Source is TSynScrollbarAnnItem) then + begin + Src := TSynScrollbarAnnItem(Source); + FAnnType := Src.AnnType; + FAnnPos := Src.AnnPos; + FOnGetInfo := Src.OnGetInfo; + FSelectionColor := Src.SelectionColor; + FBookmarkColor := Src.BookmarkColor; + FFullRow := Src.FullRow; + end + else + inherited; +end; + +constructor TSynScrollbarAnnItem.Create(Collection: TCollection); +begin + inherited; + FSelectionColor := clDefault; + FBookmarkColor := clDefault; +end; + +procedure TSynScrollbarAnnItem.GetInfo(out Rows: TArray; + out Colors: TArray); +var + Editor: TCustomSynEdit; + I, Line, Row: Integer; + Caret: TBufferCoord; + RowList: TList; + ColorList: TList; + Color: TColor; + Mark: TSynEditMark; + Flags: TSynLineChangeFlags; + RowCount: Integer; +begin + Editor := TCustomSynEdit(Collection.Owner); + + if Assigned(FOnGetInfo) then + FOnGetInfo(Editor, FAnnType, Rows, Colors) + else + begin + RowList := TList.Create; + try + case FAnnType of + sbaCarets: + begin + for I := 0 to Editor.Selections.Count - 1 do + begin + Caret := Editor.Selections[I].Caret; + Row := Editor.BufferToDisplayPos(Caret).Row; + if (I > 0) and (Row = RowList.Last) then Continue; + RowList.Add(Row); + end; + if FSelectionColor <> clDefault then + Color := FSelectionColor + else + Color := StyleServices.GetSystemColor(clHighlight); + Colors := [Color]; + end; + sbaBookmark: + begin + for Mark in Editor.Marks do + if Mark.IsBookmark then + RowList.Add(Editor.LineToRow(Mark.Line)); + if FBookmarkColor <> clDefault then + Color := FBookmarkColor + else + Color := $AAB220; + Colors := [Color]; + end; + sbaTrackChanges: + begin + RowCount := Editor.DisplayRowCount; + RowList.Capacity := RowCount; + ColorList := TList.Create; + ColorList.Capacity := RowCount; + try + for Row := 1 to RowCount do + begin + Line := Editor.RowToLine(Row); + Color := clNone; + Flags := TSynEditStringList(Editor.Lines).ChangeFlags[Line - 1]; + if Flags = [sfModified] then + Color := Editor.Gutter.TrackChanges.ModifiedColor + else if Flags = [sfSaved, sfAsSaved] then + Color := Editor.Gutter.TrackChanges.SavedColor + else if Flags = [sfSaved] then + Color := Editor.Gutter.TrackChanges.OriginalColor + else if Flags = [sfSaved, sfModified] then + Color := Editor.Gutter.TrackChanges.SavedModifiedColor; + + if Color <> clNone then + begin + RowList.Add(Row); + ColorList.Add(Color); + end; + end; + Colors := ColorList.ToArray; + finally + ColorList.Free; + end; + end; + end; + Rows := RowList.ToArray; + finally + RowList.Free; + end; + end; +end; + +{ TScrollbarAnnotations } + +function TSynScrollbarAnnotations.GetAnnotations( + Index: Integer): TSynScrollbarAnnItem; +begin + Result := TSynScrollbarAnnItem(Items[Index]); +end; + +{$ENDREGION 'Scrollbar Annotations'} + +procedure TSynScrollbarAnnotations.SetDefaultAnnotations; +begin + Clear; + with Add as TSynScrollbarAnnItem do + begin + AnnPos := sbpFullWidth; + AnnType := sbaCarets; + end; + with Add as TSynScrollbarAnnItem do + begin + AnnPos := sbpLeft; + AnnType := sbaBookmark; + FullRow := True; + end; + with Add as TSynScrollbarAnnItem do + begin + AnnPos := sbpRight; + AnnType := sbaTrackChanges; + FullRow := True; + end; +end; + +procedure TSynScrollbarAnnotations.Update(Item: TCollectionItem); +begin + inherited; + with TCustomSynEdit(Owner) do + if HandleAllocated then + SendMessage(Handle, WM_NCPAINT, 0, 0); +end; + +{$REGION 'TSynDisplayFlowControl'} + + { TSynDisplayFlowControl } + +procedure TSynDisplayFlowControl.Assign(aSource: TPersistent); +begin + if aSource is TSynDisplayFlowControl then + begin + FEnabled := TSynDisplayFlowControl(aSource).Enabled; + FColor := TSynDisplayFlowControl(aSource).Color; + end + else + inherited; +end; + +constructor TSynDisplayFlowControl.Create; +begin + inherited; + FEnabled := True; + FColor := $0045FF; // clWebOrangeRed +end; + +{$ENDREGION 'TSynDisplayFlowControl'} + + end. diff --git a/Ext/SynEdit/Source/SynEditMiscProcs.pas b/Ext/SynEdit/Source/SynEditMiscProcs.pas index 876ef3d..181320e 100644 --- a/Ext/SynEdit/Source/SynEditMiscProcs.pas +++ b/Ext/SynEdit/Source/SynEditMiscProcs.pas @@ -1,184 +1,167 @@ -{------------------------------------------------------------------------------- -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: SynEditMiscProcs.pas, released 2000-04-07. -The Original Code is based on the mwSupportProcs.pas file from the -mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Michael Hieke. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit and mwEdit projects are listed in the -Contributors.txt file. - -Alternatively, the contents of this file may be used under the terms of the -GNU General Public License Version 2 or later (the "GPL"), in which case -the provisions of the GPL are applicable instead of those above. -If you wish to allow use of your version of this file only under the terms -of the GPL and not to allow others to use your version of this file -under the MPL, indicate your decision by deleting the provisions above and -replace them with the notice and other provisions required by the GPL. -If you do not delete the provisions above, a recipient may use your version -of this file under either the MPL or the GPL. - -$Id: SynEditMiscProcs.pas,v 1.35.2.8 2009/09/28 17:54:20 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} - -{$IFNDEF QSYNEDITMISCPROCS} +{ ------------------------------------------------------------------------------- + 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: SynEditMiscProcs.pas, released 2000-04-07. + The Original Code is based on the mwSupportProcs.pas file from the + mwEdit component suite by Martin Waldenburg and other developers, the Initial + Author of this file is Michael Hieke. + Unicode translation by Maël Hörz. + All Rights Reserved. + + Contributors to the SynEdit and mwEdit projects are listed in the + Contributors.txt file. + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License Version 2 or later (the "GPL"), in which case + the provisions of the GPL are applicable instead of those above. + If you wish to allow use of your version of this file only under the terms + of the GPL and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the GPL. + If you do not delete the provisions above, a recipient may use your version + of this file under either the MPL or the GPL. + ------------------------------------------------------------------------------- } + unit SynEditMiscProcs; -{$ENDIF} {$I SynEdit.inc} interface uses - Windows, - Graphics, + Winapi.Windows, + System.Math, + System.Classes, + System.RegularExpressions, + Vcl.Graphics, SynEditTypes, SynEditHighlighter, - SynUnicode, -{$IFDEF SYN_COMPILER_4_UP} - Math, -{$ENDIF} - Classes; + SynUnicode; const MaxIntArraySize = MaxInt div 16; type PIntArray = ^TIntArray; - TIntArray = array[0..MaxIntArraySize - 1] of Integer; - -{$IFNDEF SYN_COMPILER_4_UP} -function Max(x, y: Integer): Integer; -function Min(x, y: Integer): Integer; -{$ENDIF} + TIntArray = array [0 .. MaxIntArraySize - 1] of Integer; +{ Similar to System.Math.EnsureRange but ma can be less than mi } function MinMax(x, mi, ma: Integer): Integer; procedure SwapInt(var l, r: Integer); -function MaxPoint(const P1, P2: TPoint): TPoint; -function MinPoint(const P1, P2: TPoint): TPoint; - -function GetIntArray(Count: Cardinal; InitialValue: Integer): PIntArray; - -procedure InternalFillRect(dc: HDC; const rcPaint: TRect); - -// Converting tabs to spaces: To use the function several times it's better -// to use a function pointer that is set to the fastest conversion function. -type - TConvertTabsProc = function(const Line: UnicodeString; - TabWidth: Integer): UnicodeString; -function GetBestConvertTabsProc(TabWidth: Integer): TConvertTabsProc; -// This is the slowest conversion function which can handle TabWidth <> 2^n. -function ConvertTabs(const Line: UnicodeString; TabWidth: Integer): UnicodeString; +// Expand tabs to spaces +function ExpandTabs(const Line: string; TabWidth: Integer): string; +function ExpandTabsEx(const Line: string; TabWidth: Integer; + var HasTabs: Boolean): string; +function GetExpandedLength(const aStr: string; aTabWidth: Integer): Integer; +function LeftSpaces(const Line: string; ExpandTabs: Boolean; + TabWidth: Integer = 2): Integer; -type - TConvertTabsProcEx = function(const Line: UnicodeString; TabWidth: Integer; - var HasTabs: Boolean): UnicodeString; - -function GetBestConvertTabsProcEx(TabWidth: Integer): TConvertTabsProcEx; -// This is the slowest conversion function which can handle TabWidth <> 2^n. -function ConvertTabsEx(const Line: UnicodeString; TabWidth: Integer; - var HasTabs: Boolean): UnicodeString; - -function GetExpandedLength(const aStr: UnicodeString; aTabWidth: Integer): Integer; function CharIndex2CaretPos(Index, TabWidth: Integer; - const Line: UnicodeString): Integer; -function CaretPos2CharIndex(Position, TabWidth: Integer; const Line: UnicodeString; + const Line: string): Integer; +function CaretPos2CharIndex(Position, TabWidth: Integer; const Line: string; var InsideTabChar: Boolean): Integer; // search for the first char of set AChars in Line, starting at index Start -function StrScanForCharInCategory(const Line: UnicodeString; Start: Integer; +function StrScanForCharInCategory(const Line: string; Start: Integer; IsOfCategory: TCategoryMethod): Integer; // the same, but searching backwards -function StrRScanForCharInCategory(const Line: UnicodeString; Start: Integer; +function StrRScanForCharInCategory(const Line: string; Start: Integer; IsOfCategory: TCategoryMethod): Integer; -function GetEOL(Line: PWideChar): PWideChar; +function GetEOL(P: PChar): PWideChar; +function CountLines(const S: string): Integer; +function StringToLines(const Value: string): TArray; // Remove all '/' characters from string by changing them into '\.'. // Change all '\' characters into '\\' to allow for unique decoding. -function EncodeString(s: UnicodeString): UnicodeString; +function EncodeString(s: string): string; // Decodes string, encoded with EncodeString. -function DecodeString(s: UnicodeString): UnicodeString; - -{$IFNDEF SYN_COMPILER_5_UP} -procedure FreeAndNil(var Obj); -{$ENDIF} - -{$IFNDEF SYN_COMPILER_3_UP} -procedure Assert(Expr: Boolean); { stub for Delphi 2 } -{$ENDIF} - -{$IFNDEF SYN_COMPILER_3_UP} -function LastDelimiter(const Delimiters, S: UnicodeString): Integer; -{$ENDIF} +function DecodeString(s: string): string; -{$IFNDEF SYN_COMPILER_4_UP} type - TReplaceFlags = set of (rfReplaceAll, rfIgnoreCase); - -function StringReplace(const S, OldPattern, NewPattern: UnicodeString; - Flags: TReplaceFlags): UnicodeString; -{$ENDIF} - -type - THighlighterAttriProc = function (Highlighter: TSynCustomHighlighter; + THighlighterAttriProc = function(Highlighter: TSynCustomHighlighter; Attri: TSynHighlighterAttributes; UniqueAttriName: string; Params: array of Pointer): Boolean of object; -// Enums all child highlighters and their attributes of a TSynMultiSyn through a -// callback function. -// This function also handles nested TSynMultiSyns including their MarkerAttri. + // Enums all child highlighters and their attributes of a TSynMultiSyn through a + // callback function. + // This function also handles nested TSynMultiSyns including their MarkerAttri. function EnumHighlighterAttris(Highlighter: TSynCustomHighlighter; SkipDuplicates: Boolean; HighlighterAttriProc: THighlighterAttriProc; Params: array of Pointer): Boolean; +type + // Procedural type for adding keyword entries when enumerating keyword + // lists using the EnumerateKeywords procedure below. + TEnumerateKeywordEvent = procedure(AKeyword: string; AKind: Integer) + of object; + + // This procedure will call AKeywordProc for all keywords in KeywordList. A + // keyword is considered any number of successive chars that are contained in + // Identifiers, with chars not contained in Identifiers before and after them. + procedure EnumerateKeywords(AKind: Integer; KeywordList: string; + IsIdentChar: TCategoryMethod; AKeywordProc: TEnumerateKeywordEvent); + {$IFDEF SYN_HEREDOC} // Calculates Frame Check Sequence (FCS) 16-bit Checksum (as defined in RFC 1171) function CalcFCS(const ABuf; ABufSize: Cardinal): Word; {$ENDIF} +function DeleteTypePrefixAndSynSuffix(s: string): string; +function CeilOfIntDiv(Dividend, Divisor: Cardinal): Integer; -procedure SynDrawGradient(const ACanvas: TCanvas; const AStartColor, - AEndColor: TColor; ASteps: Integer; const ARect: TRect; - const AHorizontal: Boolean); overload; +// In Windows Vista or later use the Consolas font +function DefaultFontName: string; -function DeleteTypePrefixAndSynSuffix(S: string): string; +function GetCorrectFontWeight(Font: TFont): Integer; -implementation +// Calculates the difference between two lines +// Returns the starting point of the difference and the lengths of the change +procedure LineDiff(const Line, OldLine: string; out StartPos, OldLen, NewLen: + Integer); -uses - SysUtils, - SynHighlighterMulti; +// Tests whether a color is dark +function IsColorDark(AColor: TColor): Boolean; -{$IFNDEF SYN_COMPILER_4_UP} -function Max(x, y: Integer): Integer; -begin - if x > y then Result := x else Result := y; -end; +// Substitutes control characters with Unicode control pictures +procedure SubstituteControlChars(var Input: string); -function Min(x, y: Integer): Integer; -begin - if x < y then Result := x else Result := y; -end; +// Returns a compiled regular expression +function CompiledRegEx(const Pattern: string; Options: TRegExOptions = []): TRegEx; + +// Converts TColor to an HTML color string +function ColorToHTML(Color: TColor): string; + +// Bracket functions (Brackets have the form '()[]{}') +function IsBracket(Chr: Char; const Brackets: string): Boolean; +function IsOpeningBracket(Chr: Char; const Brackets: string): Boolean; +function BracketAtPos(Idx: Integer; const Brackets, Line: string): Boolean; +function MatchingBracket(Bracket: Char; const Brackets: string): Char; + +{$IF CompilerVersion <= 32} +function GrowCollection(OldCapacity, NewCount: Integer): Integer; {$ENDIF} +implementation + +uses + System.UITypes, + System.SysUtils, + System.RegularExpressionsCore, + SynHighlighterMulti, + Winapi.D2D1, + Vcl.Forms, + SynDWrite; + function MinMax(x, mi, ma: Integer): Integer; begin x := Min(x, ma); @@ -194,51 +177,13 @@ procedure SwapInt(var l, r: Integer); l := tmp; end; -function MaxPoint(const P1, P2: TPoint): TPoint; -begin - if (P2.y > P1.y) or ((P2.y = P1.y) and (P2.x > P1.x)) then - Result := P2 - else - Result := P1; -end; - -function MinPoint(const P1, P2: TPoint): TPoint; -begin - if (P2.y < P1.y) or ((P2.y = P1.y) and (P2.x < P1.x)) then - Result := P2 - else - Result := P1; -end; - -function GetIntArray(Count: Cardinal; InitialValue: Integer): PIntArray; -var - p: PInteger; -begin - Result := AllocMem(Count * SizeOf(Integer)); - if Assigned(Result) and (InitialValue <> 0) then - begin - p := PInteger(Result); - while (Count > 0) do - begin - p^ := InitialValue; - Inc(p); - Dec(Count); - end; - end; -end; - -procedure InternalFillRect(dc: HDC; const rcPaint: TRect); -begin - ExtTextOut(dc, 0, 0, ETO_OPAQUE, @rcPaint, nil, 0, nil); -end; - // Please don't change this function; no stack frame and efficient register use. function GetHasTabs(pLine: PWideChar; var CharsBefore: Integer): Boolean; begin CharsBefore := 0; if Assigned(pLine) then begin - while pLine^ <> #0 do + while pLine^ <> #0 do begin if pLine^ = #9 then Break; @@ -251,118 +196,13 @@ function GetHasTabs(pLine: PWideChar; var CharsBefore: Integer): Boolean; Result := False; end; - -function ConvertTabs1Ex(const Line: UnicodeString; TabWidth: Integer; - var HasTabs: Boolean): UnicodeString; -var - pDest: PWideChar; - nBeforeTab: Integer; -begin - Result := Line; // increment reference count only - if GetHasTabs(Pointer(Line), nBeforeTab) then - begin - HasTabs := True; - pDest := @Result[nBeforeTab + 1]; // this will make a copy of Line - // We have at least one tab in the string, and the tab width is 1. - // pDest points to the first tab char. We overwrite all tabs with spaces. - repeat - if (pDest^ = #9) then pDest^ := ' '; - Inc(pDest); - until (pDest^ = #0); - end - else - HasTabs := False; -end; - -function ConvertTabs1(const Line: UnicodeString; TabWidth: Integer): UnicodeString; -var - HasTabs: Boolean; -begin - Result := ConvertTabs1Ex(Line, TabWidth, HasTabs); -end; - -function ConvertTabs2nEx(const Line: UnicodeString; TabWidth: Integer; - var HasTabs: Boolean): UnicodeString; -var - i, DestLen, TabCount, TabMask: Integer; - pSrc, pDest: PWideChar; -begin - Result := Line; // increment reference count only - if GetHasTabs(Pointer(Line), DestLen) then - begin - HasTabs := True; - pSrc := @Line[1 + DestLen]; - // We have at least one tab in the string, and the tab width equals 2^n. - // pSrc points to the first tab char in Line. We get the number of tabs - // and the length of the expanded string now. - TabCount := 0; - TabMask := (TabWidth - 1) xor $7FFFFFFF; - repeat - if pSrc^ = #9 then - begin - DestLen := (DestLen + TabWidth) and TabMask; - Inc(TabCount); - end - else - Inc(DestLen); - Inc(pSrc); - until (pSrc^ = #0); - // Set the length of the expanded string. - SetLength(Result, DestLen); - DestLen := 0; - pSrc := PWideChar(Line); - pDest := PWideChar(Result); - // We use another TabMask here to get the difference to 2^n. - TabMask := TabWidth - 1; - repeat - if pSrc^ = #9 then - begin - i := TabWidth - (DestLen and TabMask); - Inc(DestLen, i); - //This is used for both drawing and other stuff and is meant to be #9 and not #32 - repeat - pDest^ := #9; - Inc(pDest); - Dec(i); - until (i = 0); - Dec(TabCount); - if TabCount = 0 then - begin - repeat - Inc(pSrc); - pDest^ := pSrc^; - Inc(pDest); - until (pSrc^ = #0); - Exit; - end; - end - else - begin - pDest^ := pSrc^; - Inc(pDest); - Inc(DestLen); - end; - Inc(pSrc); - until (pSrc^ = #0); - end - else - HasTabs := False; -end; - -function ConvertTabs2n(const Line: UnicodeString; TabWidth: Integer): UnicodeString; -var - HasTabs: Boolean; -begin - Result := ConvertTabs2nEx(Line, TabWidth, HasTabs); -end; - -function ConvertTabsEx(const Line: UnicodeString; TabWidth: Integer; - var HasTabs: Boolean): UnicodeString; +function ExpandTabsEx(const Line: string; TabWidth: Integer; + var HasTabs: Boolean): string; var i, DestLen, TabCount: Integer; pSrc, pDest: PWideChar; begin - Result := Line; // increment reference count only + Result := Line; // increment reference count only if GetHasTabs(Pointer(Line), DestLen) then begin HasTabs := True; @@ -392,7 +232,7 @@ function ConvertTabsEx(const Line: UnicodeString; TabWidth: Integer; i := TabWidth - (DestLen mod TabWidth); Inc(DestLen, i); repeat - pDest^ := #9; + pDest^ := ' '; Inc(pDest); Dec(i); until (i = 0); @@ -420,45 +260,14 @@ function ConvertTabsEx(const Line: UnicodeString; TabWidth: Integer; HasTabs := False; end; -function ConvertTabs(const Line: UnicodeString; TabWidth: Integer): UnicodeString; +function ExpandTabs(const Line: string; TabWidth: Integer): string; var HasTabs: Boolean; begin - Result := ConvertTabsEx(Line, TabWidth, HasTabs); -end; - -function IsPowerOfTwo(TabWidth: Integer): Boolean; -var - nW: Integer; -begin - nW := 2; - repeat - if (nW >= TabWidth) then - Break; - Inc(nW, nW); - until (nW >= $10000); // we don't want 64 kByte spaces... - Result := (nW = TabWidth); -end; - -function GetBestConvertTabsProc(TabWidth: Integer): TConvertTabsProc; -begin - if (TabWidth < 2) then Result := TConvertTabsProc(@ConvertTabs1) - else if IsPowerOfTwo(TabWidth) then - Result := TConvertTabsProc(@ConvertTabs2n) - else - Result := TConvertTabsProc(@ConvertTabs); + Result := ExpandTabsEx(Line, TabWidth, HasTabs); end; -function GetBestConvertTabsProcEx(TabWidth: Integer): TConvertTabsProcEx; -begin - if (TabWidth < 2) then Result := ConvertTabs1Ex - else if IsPowerOfTwo(TabWidth) then - Result := ConvertTabs2nEx - else - Result := ConvertTabsEx; -end; - -function GetExpandedLength(const aStr: UnicodeString; aTabWidth: Integer): Integer; +function GetExpandedLength(const aStr: string; aTabWidth: Integer): Integer; var iRun: PWideChar; begin @@ -474,13 +283,30 @@ function GetExpandedLength(const aStr: UnicodeString; aTabWidth: Integer): Integ end; end; +function LeftSpaces(const Line: string; ExpandTabs: Boolean; + TabWidth: Integer = 2): Integer; +var + P: PChar; +begin + Result := 0; + P := PChar(Line); + while (P^ >= #1) and ((P^ <= #32) or (P^ = #$00A0)) do + begin + if (P^ = #9) and ExpandTabs then + Inc(Result, TabWidth - (Result mod TabWidth)) + else + Inc(Result); + Inc(P); + end; +end; + function CharIndex2CaretPos(Index, TabWidth: Integer; - const Line: UnicodeString): Integer; + const Line: string): Integer; var iChar: Integer; pNext: PWideChar; begin -// possible sanity check here: Index := Max(Index, Length(Line)); + // possible sanity check here: Index := Max(Index, Length(Line)); if Index > 1 then begin if (TabWidth <= 1) or not GetHasTabs(Pointer(Line), iChar) then @@ -511,8 +337,8 @@ function CharIndex2CaretPos(Index, TabWidth: Integer; Inc(Result, TabWidth); Dec(Result, Result mod TabWidth); end; - else - Inc(Result); + else + Inc(Result); end; Dec(Index); Inc(pNext); @@ -526,7 +352,7 @@ function CharIndex2CaretPos(Index, TabWidth: Integer; Result := 1; end; -function CaretPos2CharIndex(Position, TabWidth: Integer; const Line: UnicodeString; +function CaretPos2CharIndex(Position, TabWidth: Integer; const Line: string; var InsideTabChar: Boolean): Integer; var iPos: Integer; @@ -563,8 +389,8 @@ function CaretPos2CharIndex(Position, TabWidth: Integer; const Line: UnicodeStri Break; end; end; - else - Inc(iPos); + else + Inc(iPos); end; Inc(Result); Inc(pNext); @@ -576,7 +402,7 @@ function CaretPos2CharIndex(Position, TabWidth: Integer; const Line: UnicodeStri Result := Position; end; -function StrScanForCharInCategory(const Line: UnicodeString; Start: Integer; +function StrScanForCharInCategory(const Line: string; Start: Integer; IsOfCategory: TCategoryMethod): Integer; var p: PWideChar; @@ -597,34 +423,85 @@ function StrScanForCharInCategory(const Line: UnicodeString; Start: Integer; Result := 0; end; -function StrRScanForCharInCategory(const Line: UnicodeString; Start: Integer; +function StrRScanForCharInCategory(const Line: string; Start: Integer; IsOfCategory: TCategoryMethod): Integer; var - I: Integer; + i: Integer; begin Result := 0; if (Start > 0) and (Start <= Length(Line)) then begin - for I := Start downto 1 do - if IsOfCategory(Line[I]) then + for i := Start downto 1 do + if IsOfCategory(Line[i]) then begin - Result := I; + Result := i; Exit; end; end; end; -function GetEOL(Line: PWideChar): PWideChar; +function GetEOL(P: PChar): PWideChar; begin - Result := Line; + Result := P; if Assigned(Result) then - while (Result^ <> #0) and (Result^ <> #10) and (Result^ <> #13) do + while (Word(Result^) > 13) or not (Word(Result^) in [0, 10, 13]) do Inc(Result); end; +function CountLines(const S: string): Integer; +// At least one line possibly empty +var + P, PEnd: PChar; +begin + Result := 0; + P := PChar(S); + PEnd := P + Length(S); + while P < PEnd do + begin + // We do it that way instead of checking for $0 as well + // so the we properly deal with strings containing #0 (who knows) + while (P < PEnd) and ((Word(P^) > 13) or not (Word(P^) in [10, 13])) do + Inc(P); + Inc(Result); + if P^ = #13 then Inc(P); + if P^ = #10 then Inc(P); + end; + // Include Empty line at the end? + if (S <> '') and (Word(S[S.Length]) in [10, 13]) then + Inc(Result); +end; + +function StringToLines(const Value: string): TArray; +var + Count: Integer; + P, PStart, PEnd: PChar; + S: string; +begin + P := PChar(Value); + Count := CountLines(Value); + SetLength(Result, Count); + + Count := 0; + PEnd := P + Length(Value); + while P < PEnd do + begin + PStart := P; + // We do it that way instead of checking for $0 as well + // so the we properly deal with strings containing #0 (who knows) + while (P < PEnd) and ((Word(P^) > 13) or not (Word(P^) in [10, 13])) do + Inc(P); + SetString(S, PStart, P - PStart); + Result[Count] := S; + Inc(Count); + if P^ = #13 then Inc(P); + if P^ = #10 then Inc(P); + end; +end; + {$IFOPT R+}{$DEFINE RestoreRangeChecking}{$ELSE}{$UNDEF RestoreRangeChecking}{$ENDIF} {$R-} -function EncodeString(s: UnicodeString): UnicodeString; + +function EncodeString(s: string): string; var i, j: Integer; begin @@ -647,11 +524,11 @@ function EncodeString(s: UnicodeString): UnicodeString; end else Result[j] := s[i]; - end; //for + end; // for SetLength(Result, j); end; { EncodeString } -function DecodeString(s: UnicodeString): UnicodeString; +function DecodeString(s: string): string; var i, j: Integer; begin @@ -672,87 +549,16 @@ function DecodeString(s: UnicodeString): UnicodeString; else Result[j] := s[i]; Inc(i); - end; //for - SetLength(Result,j); + end; // for + SetLength(Result, j); end; { DecodeString } {$IFDEF RestoreRangeChecking}{$R+}{$ENDIF} -{$IFNDEF SYN_COMPILER_5_UP} -procedure FreeAndNil(var Obj); -var - P: TObject; -begin - P := TObject(Obj); - TObject(Obj) := nil; - P.Free; -end; -{$ENDIF} - -{$IFNDEF SYN_COMPILER_3_UP} -procedure Assert(Expr: Boolean); { stub for Delphi 2 } -begin -end; -{$ENDIF} - -{$IFNDEF SYN_COMPILER_3_UP} -function LastDelimiter(const Delimiters, S: UnicodeString): Integer; -var - P: PWideChar; -begin - Result := Length(S); - P := PWideChar(Delimiters); - while Result > 0 do - begin - if (S[Result] <> #0) and (StrScan(P, S[Result]) <> nil) then - Exit; - Dec(Result); - end; -end; -{$ENDIF} - -{$IFNDEF SYN_COMPILER_4_UP} -function StringReplace(const S, OldPattern, NewPattern: UnicodeString; - Flags: TReplaceFlags): UnicodeString; -var - SearchStr, Patt, NewStr: UnicodeString; - Offset: Integer; +function DeleteTypePrefixAndSynSuffix(s: string): string; begin - if rfIgnoreCase in Flags then - begin - SearchStr := SynWideUpperCase(S); - Patt := SynWideUpperCase(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; -{$ENDIF} - -function DeleteTypePrefixAndSynSuffix(S: string): string; -begin - Result := S; - if CharInSet(Result[1], ['T', 't']) then //ClassName is never empty so no AV possible + Result := s; + if CharInSet(Result[1], ['T', 't']) then + // ClassName is never empty so no AV possible if Pos('tsyn', LowerCase(Result)) = 1 then Delete(Result, 1, 4) else @@ -771,7 +577,8 @@ function GetHighlighterIndex(Highlighter: TSynCustomHighlighter; for i := 0 to HighlighterList.Count - 1 do if HighlighterList[i] = Highlighter then Exit - else if Assigned(HighlighterList[i]) and (TObject(HighlighterList[i]).ClassType = Highlighter.ClassType) then + else if Assigned(HighlighterList[i]) and + (TObject(HighlighterList[i]).ClassType = Highlighter.ClassType) then Inc(Result); end; @@ -786,7 +593,8 @@ function InternalEnumHighlighterAttris(Highlighter: TSynCustomHighlighter; if (HighlighterList.IndexOf(Highlighter) >= 0) then begin - if SkipDuplicates then Exit; + if SkipDuplicates then + Exit; end else HighlighterList.Add(Highlighter); @@ -794,9 +602,10 @@ function InternalEnumHighlighterAttris(Highlighter: TSynCustomHighlighter; if Highlighter is TSynMultiSyn then with TSynMultiSyn(Highlighter) do begin - Result := InternalEnumHighlighterAttris(DefaultHighlighter, SkipDuplicates, - HighlighterAttriProc, Params, HighlighterList); - if not Result then Exit; + Result := InternalEnumHighlighterAttris(DefaultHighlighter, + SkipDuplicates, HighlighterAttriProc, Params, HighlighterList); + if not Result then + Exit; for i := 0 to Schemes.Count - 1 do begin @@ -806,11 +615,13 @@ function InternalEnumHighlighterAttris(Highlighter: TSynCustomHighlighter; Result := HighlighterAttriProc(Highlighter, Schemes[i].MarkerAttri, UniqueAttriName, Params); - if not Result then Exit; + if not Result then + Exit; Result := InternalEnumHighlighterAttris(Schemes[i].Highlighter, SkipDuplicates, HighlighterAttriProc, Params, HighlighterList); - if not Result then Exit + if not Result then + Exit end end else if Assigned(Highlighter) then @@ -822,7 +633,8 @@ function InternalEnumHighlighterAttris(Highlighter: TSynCustomHighlighter; Result := HighlighterAttriProc(Highlighter, Highlighter.Attribute[i], UniqueAttriName, Params); - if not Result then Exit + if not Result then + Exit end end; @@ -847,117 +659,250 @@ function EnumHighlighterAttris(Highlighter: TSynCustomHighlighter; end end; +procedure EnumerateKeywords(AKind: Integer; KeywordList: string; + IsIdentChar: TCategoryMethod; AKeywordProc: TEnumerateKeywordEvent); +var + pStart, pEnd: PWideChar; + Keyword: string; +begin + if Assigned(AKeywordProc) and (KeywordList <> '') then + begin + pEnd := PWideChar(KeywordList); + pStart := pEnd; + repeat + // skip over chars that are not in Identifiers + while (pStart^ <> #0) and not IsIdentChar(pStart^) do + Inc(pStart); + if pStart^ = #0 then Break; + // find the last char that is in Identifiers + pEnd := pStart + 1; + while (pEnd^ <> #0) and IsIdentChar(pEnd^) do + Inc(pEnd); + // call the AKeywordProc with the keyword + SetString(Keyword, pStart, pEnd - pStart); + AKeywordProc(Keyword, AKind); + Keyword := ''; + // pEnd points to a char not in Identifiers, restart after that + if pEnd^ <> #0 then + pStart := pEnd + 1; + until (pStart^ = #0) or (pEnd^ = #0); + end; +end; + {$IFDEF SYN_HEREDOC} // Fast Frame Check Sequence (FCS) Implementation // Translated from sample code given with RFC 1171 by Marko Njezic const - fcstab : array[Byte] of Word = ( - $0000, $1189, $2312, $329b, $4624, $57ad, $6536, $74bf, - $8c48, $9dc1, $af5a, $bed3, $ca6c, $dbe5, $e97e, $f8f7, - $1081, $0108, $3393, $221a, $56a5, $472c, $75b7, $643e, - $9cc9, $8d40, $bfdb, $ae52, $daed, $cb64, $f9ff, $e876, - $2102, $308b, $0210, $1399, $6726, $76af, $4434, $55bd, - $ad4a, $bcc3, $8e58, $9fd1, $eb6e, $fae7, $c87c, $d9f5, - $3183, $200a, $1291, $0318, $77a7, $662e, $54b5, $453c, - $bdcb, $ac42, $9ed9, $8f50, $fbef, $ea66, $d8fd, $c974, - $4204, $538d, $6116, $709f, $0420, $15a9, $2732, $36bb, - $ce4c, $dfc5, $ed5e, $fcd7, $8868, $99e1, $ab7a, $baf3, - $5285, $430c, $7197, $601e, $14a1, $0528, $37b3, $263a, - $decd, $cf44, $fddf, $ec56, $98e9, $8960, $bbfb, $aa72, - $6306, $728f, $4014, $519d, $2522, $34ab, $0630, $17b9, - $ef4e, $fec7, $cc5c, $ddd5, $a96a, $b8e3, $8a78, $9bf1, - $7387, $620e, $5095, $411c, $35a3, $242a, $16b1, $0738, - $ffcf, $ee46, $dcdd, $cd54, $b9eb, $a862, $9af9, $8b70, - $8408, $9581, $a71a, $b693, $c22c, $d3a5, $e13e, $f0b7, - $0840, $19c9, $2b52, $3adb, $4e64, $5fed, $6d76, $7cff, - $9489, $8500, $b79b, $a612, $d2ad, $c324, $f1bf, $e036, - $18c1, $0948, $3bd3, $2a5a, $5ee5, $4f6c, $7df7, $6c7e, - $a50a, $b483, $8618, $9791, $e32e, $f2a7, $c03c, $d1b5, - $2942, $38cb, $0a50, $1bd9, $6f66, $7eef, $4c74, $5dfd, - $b58b, $a402, $9699, $8710, $f3af, $e226, $d0bd, $c134, - $39c3, $284a, $1ad1, $0b58, $7fe7, $6e6e, $5cf5, $4d7c, - $c60c, $d785, $e51e, $f497, $8028, $91a1, $a33a, $b2b3, - $4a44, $5bcd, $6956, $78df, $0c60, $1de9, $2f72, $3efb, - $d68d, $c704, $f59f, $e416, $90a9, $8120, $b3bb, $a232, - $5ac5, $4b4c, $79d7, $685e, $1ce1, $0d68, $3ff3, $2e7a, - $e70e, $f687, $c41c, $d595, $a12a, $b0a3, $8238, $93b1, - $6b46, $7acf, $4854, $59dd, $2d62, $3ceb, $0e70, $1ff9, - $f78f, $e606, $d49d, $c514, $b1ab, $a022, $92b9, $8330, - $7bc7, $6a4e, $58d5, $495c, $3de3, $2c6a, $1ef1, $0f78 - ); + fcstab: array [Byte] of Word = ($0000, $1189, $2312, $329B, $4624, $57AD, + $6536, $74BF, $8C48, $9DC1, $AF5A, $BED3, $CA6C, $DBE5, $E97E, $F8F7, $1081, + $0108, $3393, $221A, $56A5, $472C, $75B7, $643E, $9CC9, $8D40, $BFDB, $AE52, + $DAED, $CB64, $F9FF, $E876, $2102, $308B, $0210, $1399, $6726, $76AF, $4434, + $55BD, $AD4A, $BCC3, $8E58, $9FD1, $EB6E, $FAE7, $C87C, $D9F5, $3183, $200A, + $1291, $0318, $77A7, $662E, $54B5, $453C, $BDCB, $AC42, $9ED9, $8F50, $FBEF, + $EA66, $D8FD, $C974, $4204, $538D, $6116, $709F, $0420, $15A9, $2732, $36BB, + $CE4C, $DFC5, $ED5E, $FCD7, $8868, $99E1, $AB7A, $BAF3, $5285, $430C, $7197, + $601E, $14A1, $0528, $37B3, $263A, $DECD, $CF44, $FDDF, $EC56, $98E9, $8960, + $BBFB, $AA72, $6306, $728F, $4014, $519D, $2522, $34AB, $0630, $17B9, $EF4E, + $FEC7, $CC5C, $DDD5, $A96A, $B8E3, $8A78, $9BF1, $7387, $620E, $5095, $411C, + $35A3, $242A, $16B1, $0738, $FFCF, $EE46, $DCDD, $CD54, $B9EB, $A862, $9AF9, + $8B70, $8408, $9581, $A71A, $B693, $C22C, $D3A5, $E13E, $F0B7, $0840, $19C9, + $2B52, $3ADB, $4E64, $5FED, $6D76, $7CFF, $9489, $8500, $B79B, $A612, $D2AD, + $C324, $F1BF, $E036, $18C1, $0948, $3BD3, $2A5A, $5EE5, $4F6C, $7DF7, $6C7E, + $A50A, $B483, $8618, $9791, $E32E, $F2A7, $C03C, $D1B5, $2942, $38CB, $0A50, + $1BD9, $6F66, $7EEF, $4C74, $5DFD, $B58B, $A402, $9699, $8710, $F3AF, $E226, + $D0BD, $C134, $39C3, $284A, $1AD1, $0B58, $7FE7, $6E6E, $5CF5, $4D7C, $C60C, + $D785, $E51E, $F497, $8028, $91A1, $A33A, $B2B3, $4A44, $5BCD, $6956, $78DF, + $0C60, $1DE9, $2F72, $3EFB, $D68D, $C704, $F59F, $E416, $90A9, $8120, $B3BB, + $A232, $5AC5, $4B4C, $79D7, $685E, $1CE1, $0D68, $3FF3, $2E7A, $E70E, $F687, + $C41C, $D595, $A12A, $B0A3, $8238, $93B1, $6B46, $7ACF, $4854, $59DD, $2D62, + $3CEB, $0E70, $1FF9, $F78F, $E606, $D49D, $C514, $B1AB, $A022, $92B9, $8330, + $7BC7, $6A4E, $58D5, $495C, $3DE3, $2C6A, $1EF1, $0F78); function CalcFCS(const ABuf; ABufSize: Cardinal): Word; var CurFCS: Word; - P: ^Byte; + p: ^Byte; begin - CurFCS := $ffff; - P := @ABuf; + CurFCS := $FFFF; + p := @ABuf; while ABufSize <> 0 do begin - CurFCS := (CurFCS shr 8) xor fcstab[(CurFCS xor P^) and $ff]; + CurFCS := (CurFCS shr 8) xor fcstab[(CurFCS xor p^) and $FF]; Dec(ABufSize); - Inc(P); + Inc(p); end; Result := CurFCS; end; {$ENDIF} -procedure SynDrawGradient(const ACanvas: TCanvas; const AStartColor, AEndColor: TColor; - ASteps: Integer; const ARect: TRect; const AHorizontal: Boolean); +function CeilOfIntDiv(Dividend, Divisor: Cardinal): Integer; var - StartColorR, StartColorG, StartColorB: Byte; - DiffColorR, DiffColorG, DiffColorB: Integer; - i, Size: Integer; - PaintRect: TRect; + Res: UInt64; + Remainder: UInt64; begin - StartColorR := GetRValue(ColorToRGB(AStartColor)); - StartColorG := GetGValue(ColorToRGB(AStartColor)); - StartColorB := GetBValue(ColorToRGB(AStartColor)); - - DiffColorR := GetRValue(ColorToRGB(AEndColor)) - StartColorR; - DiffColorG := GetGValue(ColorToRGB(AEndColor)) - StartColorG; - DiffColorB := GetBValue(ColorToRGB(AEndColor)) - StartColorB; - - ASteps := MinMax(ASteps, 2, 256); + DivMod(Dividend, Divisor, Res, Remainder); + if Remainder > 0 then + Inc(Res); + Result := Integer(Res); +end; - if AHorizontal then +function DefaultFontName: string; +begin + if CheckWin32Version(6) then begin - Size := ARect.Right - ARect.Left; - PaintRect.Top := ARect.Top; - PaintRect.Bottom := ARect.Bottom; + Result := 'Consolas'; + if Screen.Fonts.IndexOf(Result) >= 0 then + Exit; + end; - for i := 0 to ASteps - 1 do - begin - PaintRect.Left := ARect.Left + MulDiv(i, Size, ASteps); - PaintRect.Right := ARect.Left + MulDiv(i + 1, Size, ASteps); + Result := 'Lucida Console'; + if Screen.Fonts.IndexOf(Result) >= 0 then + Exit; - ACanvas.Brush.Color := RGB(StartColorR + MulDiv(i, DiffColorR, ASteps - 1), - StartColorG + MulDiv(i, DiffColorG, ASteps - 1), - StartColorB + MulDiv(i, DiffColorB, ASteps - 1)); + Result := 'Courier New'; + if Screen.Fonts.IndexOf(Result) < 0 then + Result := 'Courier'; +end; - ACanvas.FillRect(PaintRect); - end; - end +function WeightEnumFontsProc(EnumLogFontExDV: PEnumLogFontExDV; + EnumTextMetric: PEnumTextMetric; + FontType: DWORD; LParam: LPARAM): Integer; stdcall; +begin; + PInteger(LPARAM)^ := EnumLogFontExDV.elfEnumLogfontEx.elfLogFont.lfWeight; + Result := 0; +end; + +function GetCorrectFontWeight(Font: TFont): Integer; +var + DC: HDC; + LogFont: TLogFont; +begin + if TFontStyle.fsBold in Font.Style then + Result := FW_BOLD else begin - Size := ARect.Bottom - ARect.Top; - PaintRect.Left := ARect.Left; - PaintRect.Right := ARect.Right; + Result := FW_NORMAL; + DC := GetDC(0); + FillChar(LogFont, SizeOf(LogFont), 0); + LogFont.lfCharSet := DEFAULT_CHARSET; + StrPLCopy(LogFont.lfFaceName, Font.Name, Length(LogFont.lfFaceName) - 1); + EnumFontFamiliesEx(DC, LogFont, @WeightEnumFontsProc, LPARAM(@Result), 0); + ReleaseDC(0, DC); + end; +end; - for i := 0 to ASteps - 1 do - begin - PaintRect.Top := ARect.Top + MulDiv(i, Size, ASteps); - PaintRect.Bottom := ARect.Top + MulDiv(i + 1, Size, ASteps); +{$IF CompilerVersion <= 32} +function GrowCollection(OldCapacity, NewCount: Integer): Integer; +begin + Result := OldCapacity; + repeat + if Result > 64 then + Result := (Result * 3) div 2 + else + if Result > 8 then + Result := Result + 16 + else + Result := Result + 4; + if Result < 0 then + OutOfMemoryError; + until Result >= NewCount; +end; +{$ENDIF} + +procedure LineDiff(const Line, OldLine: string; out StartPos, OldLen, NewLen: Integer); +begin + OldLen := OldLine.Length; + NewLen := Line.Length; + // Compare from start + StartPos := 1; + while (OldLen > 0) and (NewLen > 0) and (OldLine[StartPos] = Line[StartPos]) do + begin + Dec(OldLen); + Dec(NewLen); + Inc(StartPos); + end; + // Compare from end + while (OldLen > 0) and (NewLen > 0) and + (OldLine[OldLen + StartPos - 1] = Line[NewLen + StartPos - 1]) do + begin + Dec(OldLen); + Dec(NewLen); + end; +end; - ACanvas.Brush.Color := RGB(StartColorR + MulDiv(i, DiffColorR, ASteps - 1), - StartColorG + MulDiv(i, DiffColorG, ASteps - 1), - StartColorB + MulDiv(i, DiffColorB, ASteps - 1)); +function IsColorDark(AColor: TColor): Boolean; +var + ACol: Longint; +begin + ACol := ColorToRGB(AColor) and $00FFFFFF; + Result := ((2.99 * GetRValue(ACol) + 5.87 * GetGValue(ACol) + + 1.14 * GetBValue(ACol)) < $400); +end; - ACanvas.FillRect(PaintRect); +procedure SubstituteControlChars(var Input: string); +const + ControlChars: set of Byte = [1..31, 127]; + GraphicChars: array[1..31] of Char = ( + #$02401, #$02402, #$02403, #$02404, #$02405, #$02406, #$02407, #$02408, + #$02409, #$0240A, #$0240B, #$0240C, #$0240D, #$0240E, #$0240F, #$02410, + #$02411, #$02412, #$02413, #$02414, #$02415, #$02416, #$02417, #$02418, + #$02419, #$0241A, #$0241B, #$0241C, #$0241D, #$0241E, #$0241F); + DeleteChar = #$02421; +var + I: Integer; +begin + UniqueString(Input); + for I := 1 to Input.Length do + case Ord(Input[I]) of + 1..8, 10..31: Input[I] := GraphicChars[Byte(Ord(Input[I]))]; + 127: Input[I] := DeleteChar; end; - end; +end; + +function CompiledRegEx(const Pattern: string; Options: TRegExOptions): TRegEx; +begin + Result := TRegEx.Create(Pattern, Options + [roCompiled]); + {$IF (CompilerVersion > 35) or Declared(RTLVersion112)} + Result.Study([preJIT]); + {$ENDIF} +end; + +function ColorToHTML(Color: TColor): string; +var + R: TColorRef; +begin + R := ColorToRGB(Color); + Result := Format('#%.2x%.2x%.2x', [GetRValue(R), GetGValue(R), GetBValue(R)]); +end; + +function IsBracket(Chr: Char; const Brackets: string): Boolean; +begin + Result := Brackets.IndexOf(Chr) >= 0; +end; + +function IsOpeningBracket(Chr: Char; const Brackets: string): Boolean; +var + Idx: Integer; +begin + Idx := Brackets.IndexOf(Chr); + Result := (Idx >= 0) and not Odd(Idx); +end; + +function BracketAtPos(Idx: Integer; const Brackets, Line: string): Boolean; +begin + Result := InRange(Idx, 1, Line.Length) and IsBracket(Line[Idx], Brackets); +end; + +function MatchingBracket(Bracket: Char; const Brackets: string): Char; +var + Idx: Integer; // zero based char index +begin + Idx := Brackets.IndexOf(Bracket); + if Idx < 0 then + Result := #0 + else + Result := Brackets.Chars[Idx xor 1]; end; end. diff --git a/Ext/SynEdit/Source/SynEditOptionsDialog.dfm b/Ext/SynEdit/Source/SynEditOptionsDialog.dfm index 0743e9a..f692407 100644 --- a/Ext/SynEdit/Source/SynEditOptionsDialog.dfm +++ b/Ext/SynEdit/Source/SynEditOptionsDialog.dfm @@ -3,118 +3,45 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog Top = 154 BorderStyle = bsDialog Caption = 'Editor Options' - ClientHeight = 394 - ClientWidth = 369 + ClientHeight = 415 + ClientWidth = 388 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' + Font.Height = -12 + Font.Name = 'Segoe UI' Font.Style = [] - OldCreateOrder = True - Position = poScreenCenter + Position = poMainFormCenter OnCreate = FormCreate OnShow = FormShow - PixelsPerInch = 96 - TextHeight = 13 - object PageControl: TPageControl + DesignSize = ( + 388 + 415) + TextHeight = 15 + object PageControl1: TPageControl Left = 6 Top = 8 - Width = 355 - Height = 345 + Width = 380 + Height = 363 ActivePage = Display + Anchors = [akLeft, akTop, akRight, akBottom] TabOrder = 0 object Display: TTabSheet + BorderWidth = 6 Caption = 'Display' - ExplicitLeft = 0 - ExplicitTop = 0 - ExplicitWidth = 0 - ExplicitHeight = 0 - object gbRightEdge: TGroupBox - Left = 8 - Top = 136 - Width = 159 - Height = 88 - Caption = 'Right Edge' - TabOrder = 1 - object lblEdgeColor: TLabel - Left = 9 - Top = 56 - Width = 54 - Height = 13 - Caption = 'Edge color:' - end - object lblEdgeColumn: TLabel - Left = 9 - Top = 26 - Width = 66 - Height = 13 - Caption = 'Edge Column:' - end - object pnlRightEdgeBack: TPanel - Left = 80 - Top = 54 - Width = 52 - Height = 21 - BorderWidth = 1 - TabOrder = 1 - object pnlRightEdgeColor: TPanel - Left = 2 - Top = 2 - Width = 38 - Height = 17 - Align = alClient - BevelOuter = bvLowered - Color = clGray - TabOrder = 0 - OnClick = pnlRightEdgeColorClick - end - object btnRightEdge: TPanel - Left = 40 - Top = 2 - Width = 10 - Height = 17 - Align = alRight - BevelOuter = bvNone - TabOrder = 1 - OnMouseDown = btnRightEdgeMouseDown - object Image1: TImage - Left = 3 - Top = 6 - Width = 5 - Height = 5 - Picture.Data = { - 07544269746D61708A000000424D8A0000000000000076000000280000000500 - 0000050000000100040000000000140000000000000000000000100000001000 - 0000000000000000800000800000008080008000000080008000808000008080 - 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF - FF00DDDDD000DD0DD000D000D00000000000DDDDD000} - Transparent = True - OnMouseDown = btnRightEdgeMouseDown - end - end - end - object eRightEdge: TEdit - Left = 80 - Top = 23 - Width = 51 - Height = 21 - TabOrder = 0 - Text = '0' - end - end object gbGutter: TGroupBox - Left = 8 - Top = 8 - Width = 330 + Left = 0 + Top = 0 + Width = 360 Height = 121 + Align = alTop Caption = 'Gutter' TabOrder = 0 - object lblGutterColor: TLabel + object Label1: TLabel Left = 176 - Top = 89 - Width = 58 - Height = 13 + Top = 96 + Width = 66 + Height = 15 Caption = 'Gutter color:' end object ckGutterAutosize: TCheckBox @@ -169,22 +96,22 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog OnClick = cbGutterFontClick end object btnGutterFont: TButton - Left = 282 - Top = 13 + Left = 292 + Top = 14 Width = 40 Height = 25 Caption = 'Font' TabOrder = 6 OnClick = btnGutterFontClick end - object pnlGutterBack: TPanel - Left = 252 - Top = 85 + object pGutterBack: TPanel + Left = 261 + Top = 92 Width = 52 Height = 21 BorderWidth = 1 TabOrder = 8 - object pnlGutterColor: TPanel + object pGutterColor: TPanel Left = 2 Top = 2 Width = 38 @@ -193,7 +120,7 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog BevelOuter = bvLowered Color = clGray TabOrder = 0 - OnClick = pnlGutterColorClick + OnClick = pGutterColorClick end object btnGutterColor: TPanel Left = 40 @@ -223,15 +150,18 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog object pnlGutterFontDisplay: TPanel Left = 176 Top = 40 - Width = 145 + Width = 156 Height = 33 BevelOuter = bvNone TabOrder = 7 object lblGutterFont: TLabel - Left = 19 - Top = 9 - Width = 105 - Height = 14 + Left = 0 + Top = 0 + Width = 156 + Height = 33 + Align = alClient + Alignment = taCenter + AutoSize = False Caption = 'Courier New 8pt' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText @@ -242,124 +172,216 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog end end end - object gbBookmarks: TGroupBox - Left = 8 - Top = 232 - Width = 159 - Height = 79 - Caption = 'Bookmarks' - TabOrder = 3 - object ckBookmarkKeys: TCheckBox - Left = 9 - Top = 24 - Width = 97 - Height = 17 - Caption = 'Bookmark keys' - TabOrder = 0 - end - object ckBookmarkVisible: TCheckBox - Left = 9 - Top = 48 - Width = 121 - Height = 17 - Caption = 'Bookmarks visible' - TabOrder = 1 - end - end - object gbEditorFont: TGroupBox - Left = 180 - Top = 232 - Width = 159 - Height = 79 - Caption = 'Editor Font' - TabOrder = 4 - object btnFont: TButton - Left = 64 - Top = 49 - Width = 84 - Height = 25 - Caption = 'Font' + object Panel2: TPanel + Left = 0 + Top = 121 + Width = 360 + Height = 96 + Align = alTop + BevelOuter = bvNone + TabOrder = 1 + object gbRightEdge: TGroupBox + Left = 0 + Top = 4 + Width = 172 + Height = 88 + Caption = 'Right Edge' TabOrder = 0 - OnClick = btnFontClick + object Label3: TLabel + Left = 9 + Top = 56 + Width = 59 + Height = 15 + Caption = 'Edge color:' + end + object Label10: TLabel + Left = 9 + Top = 26 + Width = 75 + Height = 15 + Caption = 'Edge Column:' + end + object pRightEdgeBack: TPanel + Left = 97 + Top = 54 + Width = 52 + Height = 21 + BorderWidth = 1 + TabOrder = 1 + object pRightEdgeColor: TPanel + Left = 2 + Top = 2 + Width = 38 + Height = 17 + Align = alClient + BevelOuter = bvLowered + Color = clGray + TabOrder = 0 + OnClick = pRightEdgeColorClick + end + object btnRightEdge: TPanel + Left = 40 + Top = 2 + Width = 10 + Height = 17 + Align = alRight + BevelOuter = bvNone + TabOrder = 1 + OnMouseDown = btnRightEdgeMouseDown + object Image1: TImage + Left = 3 + Top = 6 + Width = 5 + Height = 5 + Picture.Data = { + 07544269746D61708A000000424D8A0000000000000076000000280000000500 + 0000050000000100040000000000140000000000000000000000100000001000 + 0000000000000000800000800000008080008000000080008000808000008080 + 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF + FF00DDDDD000DD0DD000D000D00000000000DDDDD000} + Transparent = True + OnMouseDown = btnRightEdgeMouseDown + end + end + end + object eRightEdge: TEdit + Left = 98 + Top = 23 + Width = 51 + Height = 23 + TabOrder = 0 + Text = '0' + end end - object pnlEditorFont: TPanel - Left = 8 - Top = 19 - Width = 143 - Height = 30 - BevelOuter = bvNone + object gbLineSpacing: TGroupBox + Left = 186 + Top = 5 + Width = 174 + Height = 88 + Caption = 'Line spacing / Tab spacing' TabOrder = 1 - object lblFont: TLabel - Left = 2 - Top = 1 - Width = 128 - Height = 16 - Caption = 'Courier New 10pt' - Font.Charset = DEFAULT_CHARSET - Font.Color = clWindowText - Font.Height = -13 - Font.Name = 'Courier New' - Font.Style = [] - ParentFont = False + object Label8: TLabel + Left = 9 + Top = 27 + Width = 59 + Height = 15 + Caption = 'Extra Lines:' + end + object Label9: TLabel + Left = 9 + Top = 56 + Width = 56 + Height = 15 + Caption = 'Tab Width:' + end + object eLineSpacing: TEdit + Left = 80 + Top = 23 + Width = 52 + Height = 23 + TabOrder = 0 + Text = '0' + end + object eTabWidth: TEdit + Left = 80 + Top = 53 + Width = 52 + Height = 23 + TabOrder = 1 + Text = '8' end end end - object gbLineSpacing: TGroupBox - Left = 180 - Top = 136 - Width = 159 + object Panel4: TPanel + Left = 0 + Top = 217 + Width = 360 Height = 88 - Caption = 'Line spacing / Tab spacing' + Align = alTop + BevelOuter = bvNone TabOrder = 2 - object lblExtraLines: TLabel - Left = 9 - Top = 27 - Width = 55 - Height = 13 - Caption = 'Extra Lines:' - end - object lblTabWidth: TLabel - Left = 9 - Top = 56 - Width = 53 - Height = 13 - Caption = 'Tab Width:' - end - object eLineSpacing: TEdit - Left = 80 - Top = 23 - Width = 52 - Height = 21 + object gbBookmarks: TGroupBox + Left = 0 + Top = 4 + Width = 170 + Height = 79 + Caption = 'Bookmarks' TabOrder = 0 - Text = '0' + object ckBookmarkKeys: TCheckBox + Left = 9 + Top = 25 + Width = 101 + Height = 17 + Caption = 'Bookmark keys' + TabOrder = 0 + end + object ckBookmarkVisible: TCheckBox + Left = 9 + Top = 51 + Width = 121 + Height = 17 + Caption = 'Bookmarks visible' + TabOrder = 1 + end end - object eTabWidth: TEdit - Left = 80 - Top = 53 - Width = 52 - Height = 21 + object gbEditorFont: TGroupBox + Left = 186 + Top = 5 + Width = 174 + Height = 79 + Caption = 'Editor Font' TabOrder = 1 - Text = '8' + object btnFont: TButton + Left = 67 + Top = 47 + Width = 84 + Height = 25 + Caption = 'Font' + TabOrder = 0 + OnClick = btnFontClick + end + object Panel3: TPanel + Left = 8 + Top = 19 + Width = 143 + Height = 30 + BevelOuter = bvNone + TabOrder = 1 + object labFont: TLabel + Left = 0 + Top = 0 + Width = 143 + Height = 30 + Align = alClient + Alignment = taCenter + AutoSize = False + Caption = 'Courier New 10pt' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + ParentFont = False + end + end end end end object Options: TTabSheet + BorderWidth = 6 Caption = 'Options' - ExplicitLeft = 0 - ExplicitTop = 0 - ExplicitWidth = 0 - ExplicitHeight = 0 object gbOptions: TGroupBox - Left = 8 + Left = 0 Top = 0 - Width = 330 - Height = 247 + Width = 360 + Height = 250 + Align = alClient Caption = 'Options' TabOrder = 0 object ckAutoIndent: TCheckBox Left = 9 Top = 15 - Width = 130 + Width = 170 Height = 17 Hint = 'Will indent the caret on new lines with the same amount of leadi' + @@ -369,265 +391,268 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog end object ckDragAndDropEditing: TCheckBox Left = 9 - Top = 53 - Width = 130 + Top = 34 + Width = 170 Height = 17 Hint = 'Allows you to select a block of text and drag it within the docu' + 'ment to another location' Caption = 'Drag and drop editing' - TabOrder = 2 - end - object ckAutoSizeMaxWidth: TCheckBox - Left = 9 - Top = 34 - Width = 130 - Height = 17 - Hint = 'Allows the editor accept OLE file drops' - Caption = 'Auto size scroll width' TabOrder = 1 end object ckHalfPageScroll: TCheckBox - Left = 176 + Left = 182 Top = 15 - Width = 130 + Width = 170 Height = 17 Hint = 'When scrolling with page-up and page-down commands, only scroll ' + 'a half page at a time' Caption = 'Half page scroll' - TabOrder = 12 + TabOrder = 11 end object ckEnhanceEndKey: TCheckBox Left = 9 - Top = 186 - Width = 130 + Top = 167 + Width = 170 Height = 17 Hint = 'Makes it so the caret is never visible' Caption = 'Enhance End Key' - TabOrder = 9 + TabOrder = 8 end object ckScrollByOneLess: TCheckBox - Left = 176 + Left = 182 Top = 34 - Width = 130 + Width = 170 Height = 17 Hint = 'Forces scrolling to be one less' Caption = 'Scroll by one less' - TabOrder = 13 + TabOrder = 12 end object ckScrollPastEOF: TCheckBox - Left = 176 + Left = 182 Top = 53 - Width = 130 + Width = 170 Height = 17 Hint = 'Allows the cursor to go past the end of file marker' Caption = 'Scroll past end of file' - TabOrder = 14 + TabOrder = 13 end object ckScrollPastEOL: TCheckBox - Left = 176 + Left = 182 Top = 72 - Width = 130 + Width = 170 Height = 17 Hint = 'Allows the cursor to go past the last character into the white s' + 'pace at the end of a line' Caption = 'Scroll past end of line' - TabOrder = 15 + TabOrder = 14 end object ckShowScrollHint: TCheckBox - Left = 176 + Left = 182 Top = 91 - Width = 130 + Width = 170 Height = 17 Hint = 'Shows a hint of the visible line numbers when scrolling vertical' + 'ly' Caption = 'Show scroll hint' - TabOrder = 16 + TabOrder = 15 end object ckSmartTabs: TCheckBox Left = 9 - Top = 129 - Width = 130 + Top = 110 + Width = 170 Height = 17 Hint = 'When tabbing, the cursor will go to the next non-white space cha' + 'racter of the previous line' Caption = 'Smart tabs' - TabOrder = 6 + TabOrder = 5 end object ckTabsToSpaces: TCheckBox - Left = 176 - Top = 148 - Width = 130 + Left = 182 + Top = 129 + Width = 170 Height = 17 Hint = 'Converts a tab character to the number of spaces in Tab Width' Caption = 'Tabs to spaces' - TabOrder = 18 + TabOrder = 17 end object ckTrimTrailingSpaces: TCheckBox - Left = 176 - Top = 167 - Width = 130 + Left = 182 + Top = 148 + Width = 170 Height = 17 Hint = 'Spaces at the end of lines will be trimmed and not saved' Caption = 'Trim trailing spaces' - TabOrder = 19 + TabOrder = 18 end object ckWantTabs: TCheckBox Left = 9 - Top = 110 - Width = 130 + Top = 91 + Width = 170 Height = 17 Hint = 'Let the editor accept tab characters instead of going to the nex' + 't control' Caption = 'Want tabs' - TabOrder = 5 + TabOrder = 4 end - object ckAltSetsColumnMode: TCheckBox + object ckBracketsHiglight: TCheckBox Left = 9 - Top = 72 - Width = 130 + Top = 53 + Width = 170 Height = 17 - Hint = - 'Holding down the Alt Key will put the selection mode into column' + - 'ar format' - Caption = 'Alt sets column mode' - TabOrder = 3 + Hint = 'When the cursor moves to a bracket highlight the matching one' + Caption = 'Higlight matching brackets' + TabOrder = 2 end object ckKeepCaretX: TCheckBox Left = 9 - Top = 91 - Width = 130 + Top = 72 + Width = 170 Height = 17 Hint = 'When moving through lines the X position will always stay the sa' + 'me' Caption = 'Maintain caret column' - TabOrder = 4 + TabOrder = 3 end object ckScrollHintFollows: TCheckBox - Left = 176 + Left = 182 Top = 110 - Width = 152 + Width = 170 Height = 17 Hint = 'The scroll hint follows the mouse when scrolling vertically' Caption = 'Scroll hint follows mouse' - TabOrder = 17 + TabOrder = 16 end object ckGroupUndo: TCheckBox - Left = 176 - Top = 186 - Width = 130 + Left = 182 + Top = 167 + Width = 170 Height = 17 Hint = 'When undoing/redoing actions, handle all continous changes of th' + 'e same kind in one call instead undoing/redoing each command sep' + 'arately' Caption = 'Group undo' - TabOrder = 20 + TabOrder = 19 end object ckSmartTabDelete: TCheckBox Left = 9 - Top = 148 - Width = 130 + Top = 129 + Width = 170 Height = 17 Hint = 'similar to Smart Tabs, but when you delete characters' Caption = 'Smart tab delete' - TabOrder = 7 + TabOrder = 6 end object ckRightMouseMoves: TCheckBox - Left = 176 - Top = 205 - Width = 146 + Left = 182 + Top = 186 + Width = 170 Height = 17 Hint = 'When clicking with the right mouse for a popup menu, move the cu' + 'rsor to that location' Caption = 'Right mouse moves cursor' - TabOrder = 21 + TabOrder = 20 end object ckEnhanceHomeKey: TCheckBox Left = 9 - Top = 167 - Width = 146 + Top = 148 + Width = 170 Height = 17 Hint = 'enhances home key positioning, similar to visual studio' Caption = 'Enhance Home Key' - TabOrder = 8 + TabOrder = 7 end object ckHideShowScrollbars: TCheckBox Left = 9 - Top = 205 - Width = 156 + Top = 186 + Width = 170 Height = 17 Hint = 'if enabled, then the scrollbars will only show when necessary. ' + 'If you have ScrollPastEOL, then it the horizontal bar will alway' + 's be there (it uses MaxLength instead)' Caption = 'Hide scrollbars as necessary' - TabOrder = 10 + TabOrder = 9 end object ckDisableScrollArrows: TCheckBox Left = 9 - Top = 224 - Width = 130 + Top = 205 + Width = 170 Height = 17 Hint = 'Disables the scroll bar arrow buttons when you can'#39't scroll in t' + 'hat direction any more' Caption = 'Disable scroll arrows' - TabOrder = 11 + TabOrder = 10 end object ckShowSpecialChars: TCheckBox - Left = 176 - Top = 224 - Width = 130 + Left = 182 + Top = 205 + Width = 170 Height = 17 Hint = 'Shows linebreaks, spaces and tabs using special symbols' Caption = 'Show special chars' + TabOrder = 21 + end + object ckCompleteBrackets: TCheckBox + Left = 9 + Top = 224 + Width = 170 + Height = 17 + Hint = 'Auto complete brackets' + Caption = 'Complete brackets' TabOrder = 22 end - object ckTabIndent: TCheckBox - Left = 176 - Top = 129 - Width = 130 + object ckCompleteQuotes: TCheckBox + Left = 182 + Top = 224 + Width = 170 Height = 17 - Hint = 'Use tab for indention' - Caption = 'Tab indent' + Hint = 'Auto complete quotes' + Caption = 'Complete quotes' TabOrder = 23 end end object gbCaret: TGroupBox - Left = 8 - Top = 249 - Width = 330 - Height = 62 + Left = 0 + Top = 250 + Width = 360 + Height = 71 + Align = alBottom Caption = 'Caret' TabOrder = 1 - object lblInsertCaret: TLabel + DesignSize = ( + 360 + 71) + object Label2: TLabel Left = 16 - Top = 17 - Width = 56 - Height = 13 + Top = 18 + Width = 61 + Height = 15 Caption = 'Insert caret:' end - object lblOverwriteCaret: TLabel + object Label4: TLabel Left = 16 - Top = 41 - Width = 75 - Height = 13 + Top = 45 + Width = 83 + Height = 15 Caption = 'Overwrite caret:' end object cInsertCaret: TComboBox Left = 120 - Top = 13 - Width = 186 - Height = 21 + Top = 14 + Width = 219 + Height = 23 Style = csDropDownList + Anchors = [akLeft, akTop, akRight] TabOrder = 0 Items.Strings = ( 'Vertical Line' @@ -637,10 +662,11 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog end object cOverwriteCaret: TComboBox Left = 120 - Top = 37 - Width = 186 - Height = 21 + Top = 41 + Width = 219 + Height = 23 Style = csDropDownList + Anchors = [akLeft, akTop, akRight] TabOrder = 1 Items.Strings = ( 'Vertical Line' @@ -651,82 +677,53 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog end end object Keystrokes: TTabSheet + BorderWidth = 6 Caption = 'Keystrokes' - ExplicitLeft = 0 - ExplicitTop = 0 - ExplicitWidth = 0 - ExplicitHeight = 0 - object btnAddKey: TButton - Left = 96 - Top = 152 - Width = 75 - Height = 25 - Caption = '&Add' - TabOrder = 2 - OnClick = btnAddKeyClick - end - object btnRemKey: TButton - Left = 176 - Top = 152 - Width = 75 - Height = 25 - Caption = '&Remove' - TabOrder = 3 - OnClick = btnRemKeyClick - end object gbKeyStrokes: TGroupBox - Left = 8 - Top = 192 - Width = 330 - Height = 119 + Left = 0 + Top = 203 + Width = 360 + Height = 118 + Align = alBottom Caption = 'Keystroke Options' - TabOrder = 4 - object lblCommand: TLabel + TabOrder = 1 + object Label5: TLabel Left = 16 Top = 28 - Width = 50 - Height = 13 + Width = 60 + Height = 15 Caption = 'Command:' end - object lblKeystroke2: TLabel + object Label6: TLabel Left = 16 Top = 91 - Width = 50 - Height = 13 + Width = 54 + Height = 15 Caption = 'Keystroke:' end - object lblKeystroke: TLabel + object Label7: TLabel Left = 16 Top = 59 - Width = 50 - Height = 13 + Width = 54 + Height = 15 Caption = 'Keystroke:' end object cKeyCommand: TComboBox Left = 120 Top = 23 Width = 186 - Height = 21 + Height = 23 + Style = csDropDownList TabOrder = 0 - OnExit = cKeyCommandExit - OnKeyPress = cKeyCommandKeyPress OnKeyUp = cKeyCommandKeyUp end end - object btnUpdateKey: TButton - Left = 16 - Top = 152 - Width = 75 - Height = 25 - Caption = '&Update' - TabOrder = 1 - OnClick = btnUpdateKeyClick - end object pnlCommands: TPanel - Left = 8 - Top = 13 - Width = 330 - Height = 132 + Left = 0 + Top = 0 + Width = 360 + Height = 159 + Align = alClient BevelInner = bvRaised BevelOuter = bvLowered Caption = 'pnlCommands' @@ -734,8 +731,8 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog object KeyList: TListView Left = 2 Top = 2 - Width = 326 - Height = 128 + Width = 356 + Height = 155 Align = alClient BorderStyle = bsNone Columns = < @@ -756,167 +753,207 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog OnChanging = KeyListChanging end end + object Panel1: TPanel + Left = 0 + Top = 159 + Width = 360 + Height = 44 + Align = alBottom + BevelOuter = bvNone + TabOrder = 2 + object btnRemKey: TButton + Left = 162 + Top = 5 + Width = 75 + Height = 25 + Caption = '&Remove' + TabOrder = 0 + OnClick = btnRemKeyClick + end + object btnAddKey: TButton + Left = 81 + Top = 5 + Width = 75 + Height = 25 + Caption = '&Add' + TabOrder = 1 + OnClick = btnAddKeyClick + end + object btnUpdateKey: TButton + Left = 0 + Top = 5 + Width = 75 + Height = 25 + Caption = '&Update' + TabOrder = 2 + OnClick = btnUpdateKeyClick + end + end end end object btnOk: TButton - Left = 200 - Top = 362 + Left = 226 + Top = 380 Width = 75 Height = 25 + Anchors = [akRight, akBottom] Caption = '&OK' + Default = True ModalResult = 1 TabOrder = 1 OnClick = btnOkClick end object btnCancel: TButton - Left = 280 - Top = 362 + Left = 306 + Top = 380 Width = 75 Height = 25 + Anchors = [akRight, akBottom] + Cancel = True Caption = '&Cancel' ModalResult = 2 TabOrder = 2 end object ColorDialog: TColorDialog - Left = 8 - Top = 368 + Left = 24 + Top = 369 end object ColorPopup: TPopupMenu - Left = 40 - Top = 368 - object mnuNone: TMenuItem + Left = 56 + Top = 369 + object None1: TMenuItem Tag = -1 Caption = 'None' OnClick = PopupMenuClick end - object mnuScrollBar: TMenuItem + object Scrollbar1: TMenuItem Caption = 'Scrollbar' OnClick = PopupMenuClick end - object mnuBackground: TMenuItem + object Background1: TMenuItem Tag = 1 Caption = 'Background' OnClick = PopupMenuClick end - object mnuActiveCaption: TMenuItem + object ActiveCaption1: TMenuItem Tag = 2 Caption = 'Active Caption' OnClick = PopupMenuClick end - object mnuInactiveCaption: TMenuItem + object InactiveCaption1: TMenuItem Tag = 3 Caption = 'Inactive Caption' OnClick = PopupMenuClick end - object mnuMenu: TMenuItem + object Menu1: TMenuItem Tag = 4 Caption = 'Menu' OnClick = PopupMenuClick end - object mnuWindow: TMenuItem + object Window1: TMenuItem Tag = 5 Caption = 'Window' OnClick = PopupMenuClick end - object mnuWindowFrame: TMenuItem + object WindowFrame1: TMenuItem Tag = 6 Caption = 'Window Frame' OnClick = PopupMenuClick end - object Menu2: TMenuItem + object MEnu2: TMenuItem Tag = 7 Caption = 'Menu Text' OnClick = PopupMenuClick end - object mnuWindowText: TMenuItem + object WindowText1: TMenuItem Tag = 8 Caption = 'Window Text' OnClick = PopupMenuClick end - object mnuCaptionText: TMenuItem + object CaptionText1: TMenuItem Tag = 9 Caption = 'Caption Text' OnClick = PopupMenuClick end - object mnuActiveBorder: TMenuItem + object ActiveBorder1: TMenuItem Tag = 10 Caption = 'Active Border' OnClick = PopupMenuClick end - object mnuInactiveBorder: TMenuItem + object InactiveBorder1: TMenuItem Tag = 11 Caption = 'Inactive Border' OnClick = PopupMenuClick end - object mnuApplicationWorkspace: TMenuItem + object ApplicationWorkspace1: TMenuItem Tag = 12 Caption = 'Application Workspace' OnClick = PopupMenuClick end - object mnuHighlight: TMenuItem + object Highlight1: TMenuItem Tag = 13 Caption = 'Highlight' OnClick = PopupMenuClick end - object mnuHighlightText: TMenuItem + object HighlightText1: TMenuItem Tag = 14 Caption = 'Highlight Text' OnClick = PopupMenuClick end - object mnuButtonFace: TMenuItem + object ButtonFace1: TMenuItem Tag = 15 Caption = 'Button Face' OnClick = PopupMenuClick end - object mnuButtonShadow: TMenuItem + object ButtonShadow1: TMenuItem Tag = 16 Caption = 'Button Shadow' OnClick = PopupMenuClick end - object mnuGrayText: TMenuItem + object GrayText1: TMenuItem Tag = 17 Caption = 'Gray Text' OnClick = PopupMenuClick end - object mnuButtonText: TMenuItem + object ButtonText1: TMenuItem Tag = 18 Caption = 'Button Text' OnClick = PopupMenuClick end - object mnuInactiveCaptionText: TMenuItem + object InactiveCaptionText1: TMenuItem Tag = 19 Caption = 'Inactive Caption Text' OnClick = PopupMenuClick end - object mnuHighlight2: TMenuItem + object Highlight2: TMenuItem Tag = 20 Caption = 'Highlight' OnClick = PopupMenuClick end - object mnu3dDarkShadow: TMenuItem + object N3dDarkShadow1: TMenuItem Tag = 21 Caption = '3D Dark Shadow' OnClick = PopupMenuClick end - object mnu3DLight: TMenuItem + object N3DLight1: TMenuItem Tag = 22 Caption = '3D Light' OnClick = PopupMenuClick end - object mnuInfoTipText: TMenuItem + object InfoTipText1: TMenuItem Tag = 23 Caption = 'Info Tip Text' OnClick = PopupMenuClick end - object mnuInfoTipBackground: TMenuItem + object InfoTipBackground1: TMenuItem Tag = 24 Caption = 'Info Tip Background' OnClick = PopupMenuClick end end - object ImageList: TImageList - Left = 72 - Top = 368 + object ImageList1: TImageList + Left = 88 + Top = 369 end object FontDialog: TFontDialog Font.Charset = DEFAULT_CHARSET @@ -925,7 +962,7 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog Font.Name = 'MS Sans Serif' Font.Style = [] Options = [fdEffects, fdFixedPitchOnly] - Left = 104 - Top = 368 + Left = 120 + Top = 369 end end diff --git a/Ext/SynEdit/Source/SynEditOptionsDialog.pas b/Ext/SynEdit/Source/SynEditOptionsDialog.pas index 658e597..e37aa67 100644 --- a/Ext/SynEdit/Source/SynEditOptionsDialog.pas +++ b/Ext/SynEdit/Source/SynEditOptionsDialog.pas @@ -26,28 +26,15 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditOptionsDialog.pas,v 1.21.2.5 2005/07/20 13:37:18 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: - -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITOPTIONSDIALOG} unit SynEditOptionsDialog; -{$ENDIF} {$I SynEdit.inc} interface uses - {$IFDEF SYN_COMPILER_17_UP} - Types, - {$ENDIF} Windows, Messages, Graphics, @@ -60,23 +47,16 @@ interface Registry, ExtCtrls, Buttons, - {$IFDEF SYN_DELPHI_4_UP} ImgList, - {$ENDIF} Menus, SynEdit, SynEditHighlighter, SynEditMiscClasses, SynEditKeyCmds, Classes, - SysUtils; + SysUtils, System.ImageList; type -{$IFNDEF SYN_DELPHI_4_UP} - TLVSelectItemEvent = procedure(Sender: TObject; Item: TListItem; - Selected: Boolean) of object; -{$ENDIF} - TColorPopup = (cpGutter, cpRightEdge); TSynEditorOptionsUserCommand = procedure(AUserCommand: Integer; @@ -95,121 +75,124 @@ interface TSynEditorOptionsContainer = class; TfmEditorOptionsDialog = class(TForm) - btnAddKey: TButton; - btnCancel: TButton; - btnFont: TButton; - btnGutterColor: TPanel; - btnGutterFont: TButton; + PageControl1: TPageControl; btnOk: TButton; - btnRemKey: TButton; - btnRightEdge: TPanel; - btnUpdateKey: TButton; - cbGutterFont: TCheckBox; - cInsertCaret: TComboBox; - ckAltSetsColumnMode: TCheckBox; - ckAutoIndent: TCheckBox; - ckAutoSizeMaxWidth: TCheckBox; - ckBookmarkKeys: TCheckBox; - ckBookmarkVisible: TCheckBox; - ckDisableScrollArrows: TCheckBox; - ckDragAndDropEditing: TCheckBox; - ckEnhanceEndKey: TCheckBox; - ckEnhanceHomeKey: TCheckBox; - cKeyCommand: TComboBox; - ckGroupUndo: TCheckBox; + btnCancel: TButton; + Display: TTabSheet; + ColorDialog: TColorDialog; + ColorPopup: TPopupMenu; + None1: TMenuItem; + Scrollbar1: TMenuItem; + ActiveCaption1: TMenuItem; + Background1: TMenuItem; + InactiveCaption1: TMenuItem; + Menu1: TMenuItem; + Window1: TMenuItem; + WindowFrame1: TMenuItem; + MEnu2: TMenuItem; + WindowText1: TMenuItem; + CaptionText1: TMenuItem; + ActiveBorder1: TMenuItem; + InactiveBorder1: TMenuItem; + ApplicationWorkspace1: TMenuItem; + Highlight1: TMenuItem; + HighlightText1: TMenuItem; + ButtonFace1: TMenuItem; + ButtonShadow1: TMenuItem; + GrayText1: TMenuItem; + ButtonText1: TMenuItem; + InactiveCaptionText1: TMenuItem; + Highlight2: TMenuItem; + N3dDarkShadow1: TMenuItem; + N3DLight1: TMenuItem; + InfoTipText1: TMenuItem; + InfoTipBackground1: TMenuItem; + ImageList1: TImageList; + Options: TTabSheet; + Keystrokes: TTabSheet; + gbGutter: TGroupBox; + Label1: TLabel; ckGutterAutosize: TCheckBox; - ckGutterShowLeaderZeros: TCheckBox; ckGutterShowLineNumbers: TCheckBox; + ckGutterShowLeaderZeros: TCheckBox; ckGutterStartAtZero: TCheckBox; ckGutterVisible: TCheckBox; + gbOptions: TGroupBox; + ckAutoIndent: TCheckBox; + ckDragAndDropEditing: TCheckBox; ckHalfPageScroll: TCheckBox; - ckHideShowScrollbars: TCheckBox; - ckKeepCaretX: TCheckBox; - ckRightMouseMoves: TCheckBox; + ckEnhanceEndKey: TCheckBox; ckScrollByOneLess: TCheckBox; - ckScrollHintFollows: TCheckBox; ckScrollPastEOF: TCheckBox; ckScrollPastEOL: TCheckBox; ckShowScrollHint: TCheckBox; - ckShowSpecialChars: TCheckBox; - ckSmartTabDelete: TCheckBox; ckSmartTabs: TCheckBox; - ckTabIndent: TCheckBox; ckTabsToSpaces: TCheckBox; ckTrimTrailingSpaces: TCheckBox; ckWantTabs: TCheckBox; - ColorDialog: TColorDialog; - ColorPopup: TPopupMenu; + gbCaret: TGroupBox; + cInsertCaret: TComboBox; + Label2: TLabel; + Label4: TLabel; cOverwriteCaret: TComboBox; - Display: TTabSheet; - eLineSpacing: TEdit; - eRightEdge: TEdit; - eTabWidth: TEdit; FontDialog: TFontDialog; - gbBookmarks: TGroupBox; - gbCaret: TGroupBox; - gbEditorFont: TGroupBox; - gbGutter: TGroupBox; gbKeyStrokes: TGroupBox; - gbLineSpacing: TGroupBox; - gbOptions: TGroupBox; - gbRightEdge: TGroupBox; - Image1: TImage; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + cKeyCommand: TComboBox; + ckBracketsHiglight: TCheckBox; + ckKeepCaretX: TCheckBox; + cbGutterFont: TCheckBox; + btnGutterFont: TButton; + pGutterBack: TPanel; + pGutterColor: TPanel; + btnGutterColor: TPanel; Image2: TImage; - ImageList: TImageList; - KeyList: TListView; - Keystrokes: TTabSheet; - lblCommand: TLabel; - lblEdgeColor: TLabel; - lblEdgeColumn: TLabel; - lblExtraLines: TLabel; - lblFont: TLabel; - lblGutterColor: TLabel; + ckScrollHintFollows: TCheckBox; + ckGroupUndo: TCheckBox; + ckSmartTabDelete: TCheckBox; + ckRightMouseMoves: TCheckBox; + pnlGutterFontDisplay: TPanel; lblGutterFont: TLabel; - lblInsertCaret: TLabel; - lblKeystroke: TLabel; - lblKeystroke2: TLabel; - lblOverwriteCaret: TLabel; - lblTabWidth: TLabel; - Menu2: TMenuItem; - mnu3dDarkShadow: TMenuItem; - mnu3DLight: TMenuItem; - mnuActiveBorder: TMenuItem; - mnuActiveCaption: TMenuItem; - mnuApplicationWorkspace: TMenuItem; - mnuBackground: TMenuItem; - mnuButtonFace: TMenuItem; - mnuButtonShadow: TMenuItem; - mnuButtonText: TMenuItem; - mnuCaptionText: TMenuItem; - mnuGrayText: TMenuItem; - mnuHighlight: TMenuItem; - mnuHighlight2: TMenuItem; - mnuHighlightText: TMenuItem; - mnuInactiveBorder: TMenuItem; - mnuInactiveCaption: TMenuItem; - mnuInactiveCaptionText: TMenuItem; - mnuInfoTipBackground: TMenuItem; - mnuInfoTipText: TMenuItem; - mnuMenu: TMenuItem; - mnuNone: TMenuItem; - mnuScrollBar: TMenuItem; - mnuWindow: TMenuItem; - mnuWindowFrame: TMenuItem; - mnuWindowText: TMenuItem; - Options: TTabSheet; - PageControl: TPageControl; - pnlGutterBack: TPanel; - pnlGutterColor: TPanel; + ckEnhanceHomeKey: TCheckBox; pnlCommands: TPanel; - pnlEditorFont: TPanel; - pnlGutterFontDisplay: TPanel; - pnlRightEdgeBack: TPanel; - pnlRightEdgeColor: TPanel; + KeyList: TListView; + ckHideShowScrollbars: TCheckBox; + ckDisableScrollArrows: TCheckBox; + ckShowSpecialChars: TCheckBox; + Panel1: TPanel; + btnRemKey: TButton; + btnAddKey: TButton; + btnUpdateKey: TButton; + Panel2: TPanel; + gbRightEdge: TGroupBox; + Label3: TLabel; + Label10: TLabel; + pRightEdgeBack: TPanel; + pRightEdgeColor: TPanel; + btnRightEdge: TPanel; + Image1: TImage; + eRightEdge: TEdit; + gbLineSpacing: TGroupBox; + Label8: TLabel; + Label9: TLabel; + eLineSpacing: TEdit; + eTabWidth: TEdit; + Panel4: TPanel; + gbBookmarks: TGroupBox; + ckBookmarkKeys: TCheckBox; + ckBookmarkVisible: TCheckBox; + gbEditorFont: TGroupBox; + btnFont: TButton; + Panel3: TPanel; + labFont: TLabel; + ckCompleteBrackets: TCheckBox; + ckCompleteQuotes: TCheckBox; procedure PopupMenuClick(Sender: TObject); procedure FormCreate(Sender: TObject); - procedure pnlGutterColorClick(Sender: TObject); - procedure pnlRightEdgeColorClick(Sender: TObject); + procedure pGutterColorClick(Sender: TObject); + procedure pRightEdgeColorClick(Sender: TObject); procedure btnFontClick(Sender: TObject); procedure KeyListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean); @@ -226,28 +209,21 @@ TfmEditorOptionsDialog = class(TForm) Shift: TShiftState; X, Y: Integer); procedure btnGutterColorMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); - procedure cKeyCommandExit(Sender: TObject); - procedure cKeyCommandKeyPress(Sender: TObject; var Key: Char); procedure cKeyCommandKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); procedure KeyListChanging(Sender: TObject; Item: TListItem; Change: TItemChange; var AllowChange: Boolean); private FSynEdit: TSynEditorOptionsContainer; - FPoppedFrom : TColorPopup; + FPoppedFrom: TColorPopup; FUserCommand: TSynEditorOptionsUserCommand; FAllUserCommands: TSynEditorOptionsAllUserCommands; - FOldSelected: TListItem; - FInChanging: Boolean; + OldSelected: TListItem; + InChanging: Boolean; FExtended: Boolean; - {$IFNDEF SYN_COMPILER_4_UP} - FOldWndProc: TWndMethod; - procedure OverridingWndProc(var Message: TMessage); - {$ENDIF} - - function GetColor(Item : TMenuItem) : TColor; + function GetColor(Item: TMenuItem): TColor; procedure GetData; procedure PutData; procedure EditStrCallback(const S: string); @@ -255,11 +231,8 @@ TfmEditorOptionsDialog = class(TForm) public eKeyShort2: TSynHotKey; eKeyShort1: TSynHotKey; - {$IFNDEF SYN_DELPHI_4_UP} - FOnSelectItem: TLVSelectItemEvent; - {$ENDIF} - function Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; + function Execute(EditOptions: TSynEditorOptionsContainer): Boolean; property GetUserCommandNames: TSynEditorOptionsUserCommand read FUserCommand write FUserCommand; property GetAllUserCommands: TSynEditorOptionsAllUserCommands @@ -282,7 +255,7 @@ TSynEditOptionsDialog = class(TComponent) public constructor Create(AOwner: TComponent); override; destructor Destroy; override; - function Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; + function Execute(EditOptions: TSynEditorOptionsContainer): Boolean; property Form: TfmEditorOptionsDialog read FForm; published property GetUserCommand: TSynEditorOptionsUserCommand @@ -299,12 +272,14 @@ TSynEditorOptionsContainer = class(TComponent) private FHideSelection: Boolean; FWantTabs: Boolean; + FWordWrap: Boolean; FMaxUndo: Integer; FExtraLineSpacing: Integer; FTabWidth: Integer; - FMaxScrollWidth: Integer; FRightEdge: Integer; FSelectedColor: TSynSelectedColor; + FIndentGuides: TSynIndentGuides; + FDisplayFlowControl: TSynDisplayFlowControl; FRightEdgeColor: TColor; FFont: TFont; FBookmarks: TSynBookMarkOpt; @@ -312,36 +287,53 @@ TSynEditorOptionsContainer = class(TComponent) FInsertCaret: TSynEditCaretType; FKeystrokes: TSynEditKeyStrokes; FOptions: TSynEditorOptions; + FScrollOptions: TSynEditorScrollOptions; FSynGutter: TSynGutter; FColor: TColor; + FActiveLineColor: TColor; + FVisibleSpecialChars: TSynVisibleSpecialChars; procedure SetBookMarks(const Value: TSynBookMarkOpt); procedure SetFont(const Value: TFont); procedure SetKeystrokes(const Value: TSynEditKeyStrokes); - procedure SetOptions(const Value: TSynEditorOptions); procedure SetSynGutter(const Value: TSynGutter); public constructor Create(AOwner: TComponent); override; destructor Destroy; override; - procedure Assign(Source : TPersistent); override; - procedure AssignTo(Dest : TPersistent); override; + procedure Assign(Source: TPersistent); override; + procedure AssignTo(Dest: TPersistent); override; published - property Options : TSynEditorOptions read FOptions write SetOptions; - property BookMarkOptions : TSynBookMarkOpt read FBookmarks write SetBookMarks; - property Color : TColor read FColor write FColor; - property Font : TFont read FFont write SetFont; - property ExtraLineSpacing : Integer read FExtraLineSpacing write FExtraLineSpacing; - property Gutter : TSynGutter read FSynGutter write SetSynGutter; - property RightEdge : Integer read FRightEdge write FRightEdge; - property RightEdgeColor : TColor read FRightEdgeColor write FRightEdgeColor; - property WantTabs : Boolean read FWantTabs write FWantTabs; - property InsertCaret : TSynEditCaretType read FInsertCaret write FInsertCaret; - property OverwriteCaret : TSynEditCaretType read FOverwriteCaret write FOverwriteCaret; - property HideSelection : Boolean read FHideSelection write FHideSelection; - property MaxScrollWidth : Integer read FMaxScrollWidth write FMaxScrollWidth; - property MaxUndo : Integer read FMaxUndo write FMaxUndo; - property SelectedColor : TSynSelectedColor read FSelectedColor write FSelectedColor; - property TabWidth : Integer read FTabWidth write FTabWidth; - property Keystrokes : TSynEditKeyStrokes read FKeystrokes write SetKeystrokes; + property Options: TSynEditorOptions read FOptions write FOptions + default SYNEDIT_DEFAULT_OPTIONS; + property ScrollOptions: TSynEditorScrollOptions read FScrollOptions + write FScrollOptions default SYNEDIT_DEFAULT_SCROLLOPTIONS; + property BookMarkOptions: TSynBookMarkOpt read FBookmarks write SetBookMarks; + property Color: TColor read FColor write FColor default clWindow; + property Font: TFont read FFont write SetFont; + property ExtraLineSpacing: Integer read FExtraLineSpacing + write FExtraLineSpacing default 2; + property Gutter: TSynGutter read FSynGutter write SetSynGutter; + property RightEdge: Integer read FRightEdge write FRightEdge + default 80; + property RightEdgeColor: TColor read FRightEdgeColor write FRightEdgeColor + default clSilver; + property WantTabs: Boolean read FWantTabs write FWantTabs default True; + property WordWrap: Boolean read FWordWrap write FWordWrap default False; + property InsertCaret: TSynEditCaretType read FInsertCaret + write FInsertCaret default ctVerticalLine; + property OverwriteCaret: TSynEditCaretType read FOverwriteCaret + write FOverwriteCaret default ctBlock; + property HideSelection: Boolean read FHideSelection write FHideSelection + default False; + property MaxUndo: Integer read FMaxUndo write FMaxUndo default 0; + property SelectedColor: TSynSelectedColor read FSelectedColor; + property IndentGuides: TSynIndentGuides read FIndentGuides; + property DisplayFlowControl: TSynDisplayFlowControl read FDisplayFlowControl; + property TabWidth: Integer read FTabWidth write FTabWidth default 8; + property Keystrokes: TSynEditKeyStrokes read FKeystrokes write SetKeystrokes; + property ActiveLineColor: TColor read FActiveLineColor + write FActiveLineColor default clNone; + property VisibleSpecialChars: TSynVisibleSpecialChars + read FVisibleSpecialChars write FVisibleSpecialChars default []; end; implementation @@ -349,25 +341,27 @@ implementation {$R *.dfm} uses - SynEditKeyConst; + Types, + SynEditKeyConst, + SynEditMiscProcs; { TSynEditOptionsDialog } constructor TSynEditOptionsDialog.create(AOwner: TComponent); begin inherited; - FForm := TfmEditorOptionsDialog.Create(Self); + FForm:= TfmEditorOptionsDialog.Create(Self); end; -destructor TSynEditOptionsDialog.destroy; +destructor TSynEditOptionsDialog.Destroy; begin FForm.Free; inherited; end; -function TSynEditOptionsDialog.Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; +function TSynEditOptionsDialog.Execute(EditOptions: TSynEditorOptionsContainer): Boolean; begin - Result := FForm.Execute(EditOptions); + Result:= FForm.Execute(EditOptions); end; function TSynEditOptionsDialog.GetUserCommands: TSynEditorOptionsAllUserCommands; @@ -405,91 +399,148 @@ procedure TSynEditOptionsDialog.SetExtended(const Value: Boolean); { TSynEditorOptionsContainer } procedure TSynEditorOptionsContainer.Assign(Source: TPersistent); +var + PPI: Integer; begin - if Assigned(Source) and (Source is TCustomSynEdit) then + if Source is TCustomSynEdit then begin Self.Font.Assign(TCustomSynEdit(Source).Font); Self.BookmarkOptions.Assign(TCustomSynEdit(Source).BookmarkOptions); Self.Gutter.Assign(TCustomSynEdit(Source).Gutter); Self.Keystrokes.Assign(TCustomSynEdit(Source).Keystrokes); Self.SelectedColor.Assign(TCustomSynEdit(Source).SelectedColor); + Self.IndentGuides.Assign(TCustomSynEdit(Source).IndentGuides); + Self.DisplayFlowControl.Assign(TCustomSynEdit(Source).DisplayFlowControl); Self.Color := TCustomSynEdit(Source).Color; Self.Options := TCustomSynEdit(Source).Options; + Self.ScrollOptions := TCustomSynEdit(Source).ScrollOptions; Self.ExtraLineSpacing := TCustomSynEdit(Source).ExtraLineSpacing; Self.HideSelection := TCustomSynEdit(Source).HideSelection; Self.InsertCaret := TCustomSynEdit(Source).InsertCaret; Self.OverwriteCaret := TCustomSynEdit(Source).OverwriteCaret; - Self.MaxScrollWidth := TCustomSynEdit(Source).MaxScrollWidth; Self.MaxUndo := TCustomSynEdit(Source).MaxUndo; Self.RightEdge := TCustomSynEdit(Source).RightEdge; Self.RightEdgeColor := TCustomSynEdit(Source).RightEdgeColor; Self.TabWidth := TCustomSynEdit(Source).TabWidth; Self.WantTabs := TCustomSynEdit(Source).WantTabs; + Self.WordWrap := TCustomSynEdit(Source).WordWrap; + Self.ActiveLineColor := TCustomSynEdit(Source).ActiveLineColor; + Self.VisibleSpecialChars := TCustomSynEdit(Source).VisibleSpecialChars; + // store unscaled + PPI := TCustomSynEdit(Source).CurrentPPI; + Self.BookMarkOptions.ChangeScale(96, PPI); + Self.ExtraLineSpacing := MulDiv(Self.ExtraLineSpacing, 96, PPI); + end else if Source is TSynEditorOptionsContainer then + begin + Self.Font.Assign(TSynEditorOptionsContainer(Source).Font); + Self.BookmarkOptions.Assign(TSynEditorOptionsContainer(Source).BookmarkOptions); + Self.Gutter.Assign(TSynEditorOptionsContainer(Source).Gutter); + Self.Keystrokes.Assign(TSynEditorOptionsContainer(Source).Keystrokes); + Self.SelectedColor.Assign(TSynEditorOptionsContainer(Source).SelectedColor); + Self.IndentGuides.Assign(TSynEditorOptionsContainer(Source).IndentGuides); + Self.DisplayFlowControl.Assign(TSynEditorOptionsContainer(Source).DisplayFlowControl); + Self.Color := TSynEditorOptionsContainer(Source).Color; + Self.Options := TSynEditorOptionsContainer(Source).Options; + Self.ScrollOptions := TSynEditorOptionsContainer(Source).ScrollOptions; + Self.ExtraLineSpacing := TSynEditorOptionsContainer(Source).ExtraLineSpacing; + Self.HideSelection := TSynEditorOptionsContainer(Source).HideSelection; + Self.InsertCaret := TSynEditorOptionsContainer(Source).InsertCaret; + Self.OverwriteCaret := TSynEditorOptionsContainer(Source).OverwriteCaret; + Self.MaxUndo := TSynEditorOptionsContainer(Source).MaxUndo; + Self.RightEdge := TSynEditorOptionsContainer(Source).RightEdge; + Self.RightEdgeColor := TSynEditorOptionsContainer(Source).RightEdgeColor; + Self.TabWidth := TSynEditorOptionsContainer(Source).TabWidth; + Self.WantTabs := TSynEditorOptionsContainer(Source).WantTabs; + Self.WordWrap := TSynEditorOptionsContainer(Source).WordWrap; + Self.ActiveLineColor := TSynEditorOptionsContainer(Source).ActiveLineColor; + Self.VisibleSpecialChars := TSynEditorOptionsContainer(Source).VisibleSpecialChars; end else inherited; end; procedure TSynEditorOptionsContainer.AssignTo(Dest: TPersistent); +var + PPI: Integer; begin - if Assigned(Dest) and (Dest is TCustomSynEdit) then + if Dest is TCustomSynEdit then begin - TCustomSynEdit(Dest).Font.Assign(Self.Font); - TCustomSynEdit(Dest).BookmarkOptions.Assign(Self.BookmarkOptions); - TCustomSynEdit(Dest).Gutter.Assign(Self.Gutter); - TCustomSynEdit(Dest).Keystrokes.Assign(Self.Keystrokes); - TCustomSynEdit(Dest).SelectedColor.Assign(Self.SelectedColor); - - TCustomSynEdit(Dest).Color := Self.Color; - TCustomSynEdit(Dest).Options := Self.Options; - TCustomSynEdit(Dest).ExtraLineSpacing := Self.ExtraLineSpacing; - TCustomSynEdit(Dest).HideSelection := Self.HideSelection; - TCustomSynEdit(Dest).InsertCaret := Self.InsertCaret; - TCustomSynEdit(Dest).OverwriteCaret := Self.OverwriteCaret; - TCustomSynEdit(Dest).MaxScrollWidth := Self.MaxScrollWidth; - TCustomSynEdit(Dest).MaxUndo := Self.MaxUndo; - TCustomSynEdit(Dest).RightEdge := Self.RightEdge; - TCustomSynEdit(Dest).RightEdgeColor := Self.RightEdgeColor; - TCustomSynEdit(Dest).TabWidth := Self.TabWidth; - TCustomSynEdit(Dest).WantTabs := Self.WantTabs; + TCustomSynEdit(Dest).BeginUpdate; + try + TCustomSynEdit(Dest).Font := Self.Font; + TCustomSynEdit(Dest).BookmarkOptions.Assign(Self.BookmarkOptions); + TCustomSynEdit(Dest).Gutter.Assign(Self.Gutter); + TCustomSynEdit(Dest).Keystrokes.Assign(Self.Keystrokes); + TCustomSynEdit(Dest).SelectedColor.Assign(Self.SelectedColor); + TCustomSynEdit(Dest).IndentGuides.Assign(Self.IndentGuides); + TCustomSynEdit(Dest).DisplayFlowControl.Assign(Self.DisplayFlowControl); + TCustomSynEdit(Dest).Color := Self.Color; + TCustomSynEdit(Dest).Options := Self.Options; + TCustomSynEdit(Dest).ScrollOptions := Self.ScrollOptions; + TCustomSynEdit(Dest).ExtraLineSpacing := Self.ExtraLineSpacing; + TCustomSynEdit(Dest).HideSelection := Self.HideSelection; + TCustomSynEdit(Dest).InsertCaret := Self.InsertCaret; + TCustomSynEdit(Dest).OverwriteCaret := Self.OverwriteCaret; + TCustomSynEdit(Dest).MaxUndo := Self.MaxUndo; + TCustomSynEdit(Dest).RightEdge := Self.RightEdge; + TCustomSynEdit(Dest).RightEdgeColor := Self.RightEdgeColor; + TCustomSynEdit(Dest).TabWidth := Self.TabWidth; + TCustomSynEdit(Dest).WantTabs := Self.WantTabs; + TCustomSynEdit(Dest).WordWrap := Self.WordWrap; + TCustomSynEdit(Dest).ActiveLineColor := Self.ActiveLineColor; + TCustomSynEdit(Dest).VisibleSpecialChars := Self.VisibleSpecialChars; + // scale for editor PPI + PPI := TCustomSynEdit(Dest).CurrentPPI; + TCustomSynEdit(Dest).BookMarkOptions.ChangeScale(PPI, 96); + TCustomSynEdit(Dest).ExtraLineSpacing := + MulDiv(TCustomSynEdit(Dest).ExtraLineSpacing, PPI, 96); + finally + TCustomSynEdit(Dest).EndUpdate; + end; end else inherited; end; -constructor TSynEditorOptionsContainer.create(AOwner: TComponent); + +constructor TSynEditorOptionsContainer.Create(AOwner: TComponent); begin inherited; FBookmarks := TSynBookMarkOpt.Create(Self); FKeystrokes := TSynEditKeyStrokes.Create(Self); FSynGutter := TSynGutter.Create; + FSynGutter.AssignableBands := False; FSelectedColor := TSynSelectedColor.Create; - FSelectedColor.Foreground := clHighlightText; - FSelectedColor.Background := clHighlight; + FIndentGuides := TSynIndentGuides.Create; + FDisplayFlowControl := TSynDisplayFlowControl.Create; FFont := TFont.Create; - FFont.Name := 'Courier New'; - FFont.Size := 8; - Color := clWindow; - Keystrokes.ResetDefaults; - Options := [eoAutoIndent,eoDragDropEditing,eoDropFiles,eoScrollPastEol, - eoShowScrollHint,eoSmartTabs,eoAltSetsColumnMode, eoTabsToSpaces,eoTrimTrailingSpaces, eoKeepCaretX]; - ExtraLineSpacing := 0; - HideSelection := False; - InsertCaret := ctVerticalLine; - OverwriteCaret := ctBlock; - MaxScrollWidth := 1024; - MaxUndo := 1024; - RightEdge := 80; - RightEdgeColor := clSilver; - TabWidth := 8; - WantTabs := True; + FFont.Name := DefaultFontName; + FFont.Size := 10; + {$if CompilerVersion >= 36} + FFont.IsScreenFont := True; + {$endif} + FColor:= clWindow; + FKeystrokes.ResetDefaults; + FOptions := SYNEDIT_DEFAULT_OPTIONS; + FScrollOptions := SYNEDIT_DEFAULT_SCROLLOPTIONS; + FExtraLineSpacing := 2; + FHideSelection := False; + FInsertCaret := ctVerticalLine; + FOverwriteCaret := ctBlock; + FMaxUndo := 0; + FRightEdge := 80; + FRightEdgeColor := clSilver; + FTabWidth := 8; + FWantTabs := True; end; -destructor TSynEditorOptionsContainer.destroy; +destructor TSynEditorOptionsContainer.Destroy; begin FBookMarks.Free; FKeyStrokes.Free; FSynGutter.Free; FSelectedColor.Free; + FIndentGuides.Free; + FDisplayFlowControl.Free; FFont.Free; inherited; end; @@ -511,12 +562,6 @@ procedure TSynEditorOptionsContainer.SetKeystrokes( FKeystrokes.Assign(Value); end; -procedure TSynEditorOptionsContainer.SetOptions( - const Value: TSynEditorOptions); -begin - FOptions := Value; -end; - procedure TSynEditorOptionsContainer.SetSynGutter(const Value: TSynGutter); begin FSynGutter.Assign(Value); @@ -524,90 +569,89 @@ procedure TSynEditorOptionsContainer.SetSynGutter(const Value: TSynGutter); { TfmEditorOptionsDialog } -function TfmEditorOptionsDialog.Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; +function TfmEditorOptionsDialog.Execute(EditOptions: TSynEditorOptionsContainer): Boolean; begin if (EditOptions = nil) then begin - Result := False; + Result:= False; Exit; end; //Assign the Containers - FSynEdit := EditOptions; + FSynEdit:= EditOptions; //Get Data GetData; //Show the form - Result := Showmodal = mrOk; + Result:= Showmodal = mrOk; //PutData if Result then PutData; end; procedure TfmEditorOptionsDialog.GetData; -var I : Integer; - Item : TListItem; +var I: Integer; + Item: TListItem; begin //Gutter - ckGutterVisible.Checked := FSynEdit.Gutter.Visible; - ckGutterAutosize.Checked := FSynEdit.Gutter.AutoSize; - ckGutterShowLineNumbers.Checked := FSynEdit.Gutter.ShowLineNumbers; - ckGutterShowLeaderZeros.Checked := FSynEdit.Gutter.LeadingZeros; - ckGutterStartAtZero.Checked := FSynEdit.Gutter.ZeroStart; + ckGutterVisible.Checked:= FSynEdit.Gutter.Visible; + ckGutterAutosize.Checked:= FSynEdit.Gutter.AutoSize; + ckGutterShowLineNumbers.Checked:= FSynEdit.Gutter.ShowLineNumbers; + ckGutterShowLeaderZeros.Checked:= FSynEdit.Gutter.LeadingZeros; + ckGutterStartAtZero.Checked:= FSynEdit.Gutter.ZeroStart; cbGutterFont.Checked := FSynEdit.Gutter.UseFontStyle; - pnlGutterColor.Color := FSynEdit.Gutter.Color; + pGutterColor.Color:= FSynEdit.Gutter.Color; lblGutterFont.Font.Assign(FSynEdit.Gutter.Font); - lblGutterFont.Caption := lblGutterFont.Font.Name + ' ' + IntToStr(lblGutterFont.Font.Size) + 'pt'; + lblGutterFont.Caption:= lblGutterFont.Font.Name + ' ' + IntToStr(lblGutterFont.Font.Size) + 'pt'; //Right Edge - eRightEdge.Text := IntToStr(FSynEdit.RightEdge); - pnlRightEdgeColor.Color := FSynEdit.RightEdgeColor; + eRightEdge.Text:= IntToStr(FSynEdit.RightEdge); + pRightEdgeColor.Color:= FSynEdit.RightEdgeColor; //Line Spacing - eLineSpacing.Text := IntToStr(FSynEdit.ExtraLineSpacing); - eTabWidth.Text := IntToStr(FSynEdit.TabWidth); + eLineSpacing.Text:= IntToStr(FSynEdit.ExtraLineSpacing); + eTabWidth.Text:= IntToStr(FSynEdit.TabWidth); //Bookmarks - ckBookmarkKeys.Checked := FSynEdit.BookMarkOptions.EnableKeys; - ckBookmarkVisible.Checked := FSynEdit.BookMarkOptions.GlyphsVisible; + ckBookmarkKeys.Checked:= FSynEdit.BookMarkOptions.EnableKeys; + ckBookmarkVisible.Checked:= FSynEdit.BookMarkOptions.GlyphsVisible; //Font - lblFont.Font.Assign(FSynEdit.Font); - lblFont.Caption := lblFont.Font.Name + ' ' + IntToStr(lblFont.Font.Size) + 'pt'; + labFont.Font.Assign(FSynEdit.Font); + labFont.Caption:= labFont.Font.Name + ' ' + IntToStr(labFont.Font.Size) + 'pt'; //Options - ckAutoIndent.Checked := eoAutoIndent in FSynEdit.Options; - ckAutoSizeMaxWidth.Checked := eoAutoSizeMaxScrollWidth in FSynEdit.Options; - ckDragAndDropEditing.Checked := eoDragDropEditing in FSynEdit.Options; - ckWantTabs.Checked := FSynEdit.WantTabs; - ckSmartTabs.Checked := eoSmartTabs in FSynEdit.Options; - ckAltSetsColumnMode.Checked := eoAltSetsColumnMode in FSynEdit.Options; - ckHalfPageScroll.Checked := eoHalfPageScroll in FSynEdit.Options; - ckScrollByOneLess.Checked := eoScrollByOneLess in FSynEdit.Options; - ckScrollPastEOF.Checked := eoScrollPastEof in FSynEdit.Options; - ckScrollPastEOL.Checked := eoScrollPastEol in FSynEdit.Options; - ckShowScrollHint.Checked := eoShowScrollHint in FSynEdit.Options; - ckTabsToSpaces.Checked := eoTabsToSpaces in FSynEdit.Options; - ckTrimTrailingSpaces.Checked := eoTrimTrailingSpaces in FSynEdit.Options; - ckKeepCaretX.Checked := eoKeepCaretX in FSynEdit.Options; + ckAutoIndent.Checked:= eoAutoIndent in FSynEdit.Options; + ckDragAndDropEditing.Checked:= eoDragDropEditing in FSynEdit.Options; + ckWantTabs.Checked:= FSynEdit.WantTabs; + ckSmartTabs.Checked:= eoSmartTabs in FSynEdit.Options; + ckBracketsHiglight.Checked:= eoBracketsHighlight in FSynEdit.Options; + ckHalfPageScroll.Checked:= eoHalfPageScroll in FSynEdit.ScrollOptions; + ckScrollByOneLess.Checked:= eoScrollByOneLess in FSynEdit.ScrollOptions; + ckScrollPastEOF.Checked:= eoScrollPastEof in FSynEdit.ScrollOptions; + ckScrollPastEOL.Checked:= eoScrollPastEol in FSynEdit.ScrollOptions; + ckShowScrollHint.Checked:= eoShowScrollHint in FSynEdit.ScrollOptions; + ckTabsToSpaces.Checked:= eoTabsToSpaces in FSynEdit.Options; + ckTrimTrailingSpaces.Checked:= eoTrimTrailingSpaces in FSynEdit.Options; + ckKeepCaretX.Checked:= eoKeepCaretX in FSynEdit.Options; ckSmartTabDelete.Checked := eoSmartTabDelete in FSynEdit.Options; ckRightMouseMoves.Checked := eoRightMouseMovesCursor in FSynEdit.Options; ckEnhanceHomeKey.Checked := eoEnhanceHomeKey in FSynEdit.Options; ckEnhanceEndKey.Checked := eoEnhanceEndKey in FSynEdit.Options; ckGroupUndo.Checked := eoGroupUndo in FSynEdit.Options; - ckTabIndent.Checked := eoTabIndent in FSynEdit.Options; - ckDisableScrollArrows.Checked := eoDisableScrollArrows in FSynEdit.Options; - ckHideShowScrollbars.Checked := eoHideShowScrollbars in FSynEdit.Options; - ckShowSpecialChars.Checked := eoShowSpecialChars in FSynEdit.Options; - + ckDisableScrollArrows.Checked := eoDisableScrollArrows in FSynEdit.ScrollOptions; + ckHideShowScrollbars.Checked := eoHideShowScrollbars in FSynEdit.ScrollOptions; + ckShowSpecialChars.Checked := FSynEdit.VisibleSpecialChars <> []; + ckCompleteBrackets.checked := eoCompleteBrackets in FSynEdit.Options; + ckCompleteQuotes.checked := eoCompleteQuotes in FSynEdit.Options; //Caret - cInsertCaret.ItemIndex := ord(FSynEdit.InsertCaret); - cOverwriteCaret.ItemIndex := ord(FSynEdit.OverwriteCaret); + cInsertCaret.ItemIndex:= ord(FSynEdit.InsertCaret); + cOverwriteCaret.ItemIndex:= ord(FSynEdit.OverwriteCaret); KeyList.Items.BeginUpdate; try KeyList.Items.Clear; - for I := 0 to FSynEdit.Keystrokes.Count-1 do + for I:= 0 to FSynEdit.Keystrokes.Count-1 do begin - Item := KeyList.Items.Add; + Item:= KeyList.Items.Add; FillInKeystrokeInfo(FSynEdit.Keystrokes.Items[I], Item); - Item.Data := FSynEdit.Keystrokes.Items[I]; + Item.Data:= FSynEdit.Keystrokes.Items[I]; end; - if (KeyList.Items.Count > 0) then KeyList.Items[0].Selected := True; + if (KeyList.Items.Count > 0) then KeyList.Items[0].Selected:= True; finally KeyList.Items.EndUpdate; end; @@ -615,51 +659,53 @@ procedure TfmEditorOptionsDialog.GetData; procedure TfmEditorOptionsDialog.PutData; var - vOptions: TSynEditorOptions; + EdOptions: TSynEditorOptions; + EdScrollOptions: TSynEditorScrollOptions; - procedure SetFlag(aOption: TSynEditorOption; aValue: Boolean); + procedure SetFlag(Option: TSynEditorOption; Value: Boolean); begin - if aValue then - Include(vOptions, aOption) + if Value then + Include(EdOptions, Option) else - Exclude(vOptions, aOption); + Exclude(EdOptions, Option); + end; + + procedure SetScrollFlag(Option: TSynEditorScrollOption; Value: Boolean); + begin + if Value then + Include(EdScrollOptions, Option) + else + Exclude(EdScrollOptions, Option); end; begin //Gutter - FSynEdit.Gutter.Visible := ckGutterVisible.Checked; + FSynEdit.Gutter.Visible:= ckGutterVisible.Checked; FSynEdit.Gutter.AutoSize := ckGutterAutosize.Checked; - FSynEdit.Gutter.ShowLineNumbers := ckGutterShowLineNumbers.Checked; - FSynEdit.Gutter.LeadingZeros := ckGutterShowLeaderZeros.Checked; - FSynEdit.Gutter.ZeroStart := ckGutterStartAtZero.Checked; - FSynEdit.Gutter.Color := pnlGutterColor.Color; + FSynEdit.Gutter.ShowLineNumbers:= ckGutterShowLineNumbers.Checked; + FSynEdit.Gutter.LeadingZeros:= ckGutterShowLeaderZeros.Checked; + FSynEdit.Gutter.ZeroStart:= ckGutterStartAtZero.Checked; + FSynEdit.Gutter.Color:= pGutterColor.Color; FSynEdit.Gutter.UseFontStyle := cbGutterFont.Checked; FSynEdit.Gutter.Font.Assign(lblGutterFont.Font); //Right Edge - FSynEdit.RightEdge := StrToIntDef(eRightEdge.Text, 80); - FSynEdit.RightEdgeColor := pnlRightEdgeColor.Color; + FSynEdit.RightEdge:= StrToIntDef(eRightEdge.Text, 80); + FSynEdit.RightEdgeColor:= pRightEdgeColor.Color; //Line Spacing - FSynEdit.ExtraLineSpacing := StrToIntDef(eLineSpacing.Text, 0); - FSynEdit.TabWidth := StrToIntDef(eTabWidth.Text, 8); + FSynEdit.ExtraLineSpacing:= StrToIntDef(eLineSpacing.Text, 0); + FSynEdit.TabWidth:= StrToIntDef(eTabWidth.Text, 8); //Bookmarks - FSynEdit.BookMarkOptions.EnableKeys := ckBookmarkKeys.Checked; - FSynEdit.BookMarkOptions.GlyphsVisible := ckBookmarkVisible.Checked; + FSynEdit.BookMarkOptions.EnableKeys:= ckBookmarkKeys.Checked; + FSynEdit.BookMarkOptions.GlyphsVisible:= ckBookmarkVisible.Checked; //Font - FSynEdit.Font.Assign(lblFont.Font); + FSynEdit.Font.Assign(labFont.Font); //Options - FSynEdit.WantTabs := ckWantTabs.Checked; - vOptions := FSynEdit.Options; //Keep old values for unsupported options + FSynEdit.WantTabs:= ckWantTabs.Checked; + EdOptions := FSynEdit.Options; //Keep old values for unsupported options SetFlag(eoAutoIndent, ckAutoIndent.Checked); - SetFlag(eoAutoSizeMaxScrollWidth, ckAutoSizeMaxWidth.Checked); SetFlag(eoDragDropEditing, ckDragAndDropEditing.Checked); SetFlag(eoSmartTabs, ckSmartTabs.Checked); - SetFlag(eoAltSetsColumnMode, ckAltSetsColumnMode.Checked); - SetFlag(eoHalfPageScroll, ckHalfPageScroll.Checked); - SetFlag(eoScrollByOneLess, ckScrollByOneLess.Checked); - SetFlag(eoScrollPastEof, ckScrollPastEOF.Checked); - SetFlag(eoScrollPastEol, ckScrollPastEOL.Checked); - SetFlag(eoShowScrollHint, ckShowScrollHint.Checked); - SetFlag(eoTabIndent, ckTabIndent.Checked); + SetFlag(eoBracketsHighlight, ckBracketsHiglight.Checked); SetFlag(eoTabsToSpaces, ckTabsToSpaces.Checked); SetFlag(eoTrimTrailingSpaces, ckTrimTrailingSpaces.Checked); SetFlag(eoKeepCaretX, ckKeepCaretX.Checked); @@ -668,93 +714,96 @@ procedure TfmEditorOptionsDialog.PutData; SetFlag(eoEnhanceHomeKey, ckEnhanceHomeKey.Checked); SetFlag(eoEnhanceEndKey, ckEnhanceEndKey.Checked); SetFlag(eoGroupUndo, ckGroupUndo.Checked); - SetFlag(eoDisableScrollArrows, ckDisableScrollArrows.Checked); - SetFlag(eoHideShowScrollbars, ckHideShowScrollbars.Checked); - SetFlag(eoShowSpecialChars, ckShowSpecialChars.Checked); - FSynEdit.Options := vOptions; + SetFlag(eoCompleteBrackets, ckCompleteBrackets.checked); + SetFlag(eoCompleteQuotes, ckCompleteQuotes.checked); + FSynEdit.Options := EdOptions; + SetScrollFlag(eoHalfPageScroll, ckHalfPageScroll.Checked); + SetScrollFlag(eoScrollByOneLess, ckScrollByOneLess.Checked); + SetScrollFlag(eoScrollPastEof, ckScrollPastEOF.Checked); + SetScrollFlag(eoScrollPastEol, ckScrollPastEOL.Checked); + SetScrollFlag(eoShowScrollHint, ckShowScrollHint.Checked); + SetScrollFlag(eoDisableScrollArrows, ckDisableScrollArrows.Checked); + SetScrollFlag(eoHideShowScrollbars, ckHideShowScrollbars.Checked); + FSynEdit.ScrollOptions := EdScrollOptions; + if ckShowSpecialChars.Checked then + FSynEdit.VisibleSpecialChars := [scWhitespace, scControlChars, scEOL] + else + FSynEdit.VisibleSpecialChars := []; //Caret - FSynEdit.InsertCaret := TSynEditCaretType(cInsertCaret.ItemIndex); - FSynEdit.OverwriteCaret := TSynEditCaretType(cOverwriteCaret.ItemIndex); + FSynEdit.InsertCaret:= TSynEditCaretType(cInsertCaret.ItemIndex); + FSynEdit.OverwriteCaret:= TSynEditCaretType(cOverwriteCaret.ItemIndex); end; function TfmEditorOptionsDialog.GetColor(Item: TMenuItem): TColor; begin if (Item.Tag = -1) or (Item.Tag > 24) then - Result := clNone + Result:= clNone else - Result := TColor(Byte(Item.Tag) or $80000000); + Result:= TColor(Byte(Item.Tag) or $80000000); end; procedure TfmEditorOptionsDialog.PopupMenuClick(Sender: TObject); -var C : TColor; +var C: TColor; begin - C := GetColor(TMenuItem(Sender)); + C:= GetColor(TMenuItem(Sender)); //Set the color based on where it was "popped from" if (FPoppedFrom = cpGutter) then - pnlGutterColor.Color := C + pGutterColor.Color:= C else if (FPoppedFrom = cpRightEdge) then - pnlRightEdgeColor.Color := C; + pRightEdgeColor.Color:= C; end; procedure TfmEditorOptionsDialog.FormCreate(Sender: TObject); -var I : Integer; - C : TColor; - B : TBitmap; +var I: Integer; + C: TColor; + B: TBitmap; begin - {$IFDEF SYN_COMPILER_4_UP} KeyList.OnSelectItem := KeyListSelectItem; - {$ELSE} - FOldWndProc := KeyList.WindowProc; - KeyList.WindowProc := OverridingWndProc; - FOnSelectItem := KeyListSelectItem; - {$ENDIF} - FInChanging := False; - B := TBitmap.Create; + InChanging := False; + B:= TBitmap.Create; try - B.Width := 16; - B.Height := 16; + B.Width:= 16; + B.Height:= 16; //Loop through and create colored images - for I := 0 to ColorPopup.Items.Count-1 do + for I:= 0 to ColorPopup.Items.Count-1 do begin if ColorPopup.Items[I].Tag = -1 then Continue; - C := GetColor(ColorPopup.Items[I]); - B.Canvas.Brush.Color := C; - B.Canvas.Brush.Style := bsSolid; - B.Canvas.Pen.Style := psSolid; - B.Canvas.Pen.Color := clBlack; + C:= GetColor(ColorPopup.Items[I]); + B.Canvas.Brush.Color:= C; + B.Canvas.Brush.Style:= bsSolid; + B.Canvas.Pen.Style:= psSolid; + B.Canvas.Pen.Color:= clBlack; B.Canvas.Rectangle(0,0,16,16); - ImageList.Add(B, nil); -{$IFDEF SYN_COMPILER_4_UP} - ColorPopup.Items[I].ImageIndex := ColorPopup.Items[I].Tag; -{$ENDIF} + ImageList1.Add(B, nil); + ColorPopup.Items[I].ImageIndex:= ColorPopup.Items[I].Tag; end; finally B.Free; end; - eKeyShort1 := TSynHotKey.Create(Self); + eKeyShort1:= TSynHotKey.Create(Self); with eKeyShort1 do begin Parent := gbKeystrokes; - Left := 120; - Top := 55; - Width := 185; - Height := 21; + Left := Muldiv(120, FCurrentPPI, Screen.DefaultPixelsPerInch); + Top := Muldiv(55, FCurrentPPI, Screen.DefaultPixelsPerInch); + Width := Muldiv(185, FCurrentPPI, Screen.DefaultPixelsPerInch); + Height := Muldiv(21, FCurrentPPI, Screen.DefaultPixelsPerInch); HotKey := 0; InvalidKeys := []; Modifiers := []; TabOrder := 1; end; - eKeyShort2 := TSynHotKey.Create(Self); + eKeyShort2:= TSynHotKey.Create(Self); with eKeyShort2 do begin Parent := gbKeystrokes; - Left := 120; - Top := 87; - Width := 185; - Height := 21; + Left := Muldiv(120, FCurrentPPI, Screen.DefaultPixelsPerInch); + Top := Muldiv(87, FCurrentPPI, Screen.DefaultPixelsPerInch); + Width := Muldiv(185, FCurrentPPI, Screen.DefaultPixelsPerInch); + Height := Muldiv(21, FCurrentPPI, Screen.DefaultPixelsPerInch); HotKey := 0; InvalidKeys := []; Modifiers := []; @@ -762,29 +811,42 @@ procedure TfmEditorOptionsDialog.FormCreate(Sender: TObject); end; end; -procedure TfmEditorOptionsDialog.pnlGutterColorClick(Sender: TObject); +procedure TfmEditorOptionsDialog.pGutterColorClick(Sender: TObject); begin - ColorDialog.Color := pnlGutterColor.Color; + ColorDialog.Color:= pGutterColor.Color; if (ColorDialog.Execute) then - pnlGutterColor.Color := ColorDialog.Color; + begin + pGutterColor.Color:= ColorDialog.Color; + end; end; -procedure TfmEditorOptionsDialog.pnlRightEdgeColorClick(Sender: TObject); +procedure TfmEditorOptionsDialog.pRightEdgeColorClick(Sender: TObject); begin - ColorDialog.Color := pnlRightEdgeColor.Color; + ColorDialog.Color:= pRightEdgeColor.Color; if (ColorDialog.Execute) then - pnlRightEdgeColor.Color := ColorDialog.Color; + begin + pRightEdgeColor.Color:= ColorDialog.Color; + end; end; procedure TfmEditorOptionsDialog.btnFontClick(Sender: TObject); begin - FontDialog.Font.Assign(lblFont.Font); + labFont.Font.PixelsPerInch := FCurrentPPI; + FontDialog.Font.Assign(labFont.Font); + {$IF CompilerVersion >= 36} + // See https://quality.embarcadero.com/browse/RSP-43261 + FontDialog.Font.IsScreenFont := True; + FontDialog.Font.ScaleForDPI(Screen.PixelsPerInch); + {$IFEND CompilerVersion >= 36} if FontDialog.Execute then begin - lblFont.Font.Assign(FontDialog.Font); - lblFont.Caption := lblFont.Font.Name; - lblFont.Caption := lblFont.Font.Name + ' ' + IntToStr(lblFont.Font.Size) + 'pt'; + labFont.Font.Assign(FontDialog.Font); + labFont.Caption:= labFont.Font.Name; + labFont.Caption:= labFont.Font.Name + ' ' + IntToStr(labFont.Font.Size) + 'pt'; end; + {$IF CompilerVersion < 36} + labFont.Font.PixelsPerInch := Screen.PixelsPerInch; + {$ENDIF} end; procedure TfmEditorOptionsDialog.KeyListSelectItem(Sender: TObject; @@ -795,16 +857,12 @@ procedure TfmEditorOptionsDialog.KeyListSelectItem(Sender: TObject; cKeyCommand.ItemIndex := cKeyCommand.Items.IndexOf(KeyList.Selected.Caption); eKeyShort1.HotKey := TSynEditKeyStroke(KeyList.Selected.Data).ShortCut; eKeyShort2.HotKey := TSynEditKeyStroke(KeyList.Selected.Data).ShortCut2; - FOldSelected := Item; + OldSelected := Item; end; procedure TfmEditorOptionsDialog.btnUpdateKeyClick(Sender: TObject); -var Cmd : Integer; -{ KeyLoc : Integer; - TmpCommand : string; - OldShortcut : TShortcut; - OldShortcut2 : TShortcut; -} +var + Cmd: Integer; begin if (KeyList.Selected = nil) and (Sender <> btnAddKey) then begin @@ -817,23 +875,24 @@ procedure TfmEditorOptionsDialog.btnUpdateKeyClick(Sender: TObject); Cmd := Integer(cKeyCommand.Items.Objects[cKeyCommand.ItemIndex]); - TSynEditKeyStroke(FOldSelected.Data).Command := Cmd; + TSynEditKeyStroke(OldSelected.Data).Command:= Cmd; if eKeyShort1.HotKey <> 0 then - TSynEditKeyStroke(FOldSelected.Data).ShortCut := eKeyShort1.HotKey; + TSynEditKeyStroke(OldSelected.Data).ShortCut := eKeyShort1.HotKey; if eKeyShort2.HotKey <> 0 then - TSynEditKeyStroke(FOldSelected.Data).ShortCut2 := eKeyShort2.HotKey; + TSynEditKeyStroke(OldSelected.Data).ShortCut2:= eKeyShort2.HotKey; - FillInKeystrokeInfo(TSynEditKeyStroke(FOldSelected.Data), KeyList.Selected); + FillInKeystrokeInfo(TSynEditKeyStroke(OldSelected.Data), KeyList.Selected); end; procedure TfmEditorOptionsDialog.btnAddKeyClick(Sender: TObject); -var Item : TListItem; +var Item: TListItem; begin - Item := KeyList.Items.Add; - Item.Data := FSynEdit.Keystrokes.Add; - Item.Selected := True; + if cKeyCommand.ItemIndex < 0 then Exit; + Item:= KeyList.Items.Add; + Item.Data:= FSynEdit.Keystrokes.Add; + Item.Selected:= True; btnUpdateKeyClick(btnAddKey); end; @@ -853,8 +912,9 @@ procedure TfmEditorOptionsDialog.EditStrCallback(const S: string); end; procedure TfmEditorOptionsDialog.FormShow(Sender: TObject); -var Commands: TStringList; - i : Integer; +var + Commands: TStringList; + I: Integer; begin //We need to do this now because it will not have been assigned when //create occurs @@ -870,38 +930,46 @@ procedure TfmEditorOptionsDialog.FormShow(Sender: TObject); Commands := TStringList.Create; try FAllUserCommands(Commands); - for i := 0 to Commands.Count - 1 do - if Commands.Objects[i] <> nil then - cKeyCommand.Items.AddObject(Commands[i], Commands.Objects[i]); + for I := 0 to Commands.Count - 1 do + if Commands.Objects[I] <> nil then + cKeyCommand.Items.AddObject(Commands[I], Commands.Objects[I]); finally Commands.Free; end; end; - PageControl.ActivePage := PageControl.Pages[0]; + PageControl1.ActivePage := PageControl1.Pages[0]; end; procedure TfmEditorOptionsDialog.KeyListEditing(Sender: TObject; Item: TListItem; var AllowEdit: Boolean); begin - AllowEdit := False; + AllowEdit:= False; end; procedure TfmEditorOptionsDialog.btnOkClick(Sender: TObject); begin btnUpdateKey.Click; - ModalResult := mrOk; + ModalResult:= mrOk; end; procedure TfmEditorOptionsDialog.btnGutterFontClick(Sender: TObject); begin + lblGutterFont.Font.PixelsPerInch := FCurrentPPI; FontDialog.Font.Assign(lblGutterFont.Font); + {$IF CompilerVersion >= 36} + FontDialog.Font.IsScreenFont := True; + FontDialog.Font.ScaleForDPI(Screen.PixelsPerInch); + {$IFEND CompilerVersion >= 36} if FontDialog.Execute then begin lblGutterFont.Font.Assign(FontDialog.Font); - lblGutterFont.Caption := lblGutterFont.Font.Name + ' ' + IntToStr(lblGutterFont.Font.Size) + 'pt'; + lblGutterFont.Caption:= lblGutterFont.Font.Name + ' ' + IntToStr(lblGutterFont.Font.Size) + 'pt'; end; + {$IF CompilerVersion < 36} + lblGutterFont.Font.PixelsPerInch := Screen.PixelsPerInch; + {$ENDIF} end; procedure TfmEditorOptionsDialog.cbGutterFontClick(Sender: TObject); @@ -912,10 +980,10 @@ procedure TfmEditorOptionsDialog.cbGutterFontClick(Sender: TObject); procedure TfmEditorOptionsDialog.btnRightEdgeMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); -var P : TPoint; +var P: TPoint; begin - FPoppedFrom := cpRightEdge; - P := pnlRightEdgeColor.ClientToScreen(Point(-1, pnlRightEdgeColor.Height - 1)); + FPoppedFrom:= cpRightEdge; + P:= pRightEdgeColor.ClientToScreen(Point(-1, pRightEdgeColor.Height-1)); btnRightEdge.BevelOuter := bvLowered; ColorPopup.Popup(P.X, P.Y); btnRightEdge.BevelOuter := bvNone; @@ -923,10 +991,10 @@ procedure TfmEditorOptionsDialog.btnRightEdgeMouseDown(Sender: TObject; procedure TfmEditorOptionsDialog.btnGutterColorMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); -var P : TPoint; +var P: TPoint; begin - FPoppedFrom := cpGutter; - P := pnlGutterColor.ClientToScreen(Point(-1, pnlGutterColor.Height - 1)); + FPoppedFrom:= cpGutter; + P:= pGutterColor.ClientToScreen(Point(-1, pGutterColor.Height-1)); btnGutterColor.BevelOuter := bvLowered; ColorPopup.Popup(P.X, P.Y); btnGutterColor.BevelOuter := bvNone; @@ -934,7 +1002,7 @@ procedure TfmEditorOptionsDialog.btnGutterColorMouseDown(Sender: TObject; procedure TfmEditorOptionsDialog.FillInKeystrokeInfo( AKey: TSynEditKeystroke; AItem: TListItem); -var TmpString: String; +var TmpString: string; begin with AKey do begin @@ -949,7 +1017,7 @@ procedure TfmEditorOptionsDialog.FillInKeystrokeInfo( else TmpString := EditorCommandToCodeString(Command); end; - AItem.Caption := TmpString; + AItem.Caption:= TmpString; AItem.SubItems.Clear; TmpString := ''; @@ -960,46 +1028,7 @@ procedure TfmEditorOptionsDialog.FillInKeystrokeInfo( TmpString := TmpString + ' ' + ShortCutToText(ShortCut2); AItem.SubItems.Add(TmpString); - end; - -end; - -procedure TfmEditorOptionsDialog.cKeyCommandExit(Sender: TObject); -VAR TmpIndex : Integer; -begin - TmpIndex := cKeyCommand.Items.IndexOf(cKeyCommand.Text); - if TmpIndex = -1 then - begin - if FExtended then - cKeyCommand.ItemIndex := cKeyCommand.Items.IndexOf(ConvertCodeStringToExtended('ecNone')) - else cKeyCommand.ItemIndex := cKeyCommand.Items.IndexOf('ecNone'); - end else cKeyCommand.ItemIndex := TmpIndex; //need to force it incase they just typed something in - -end; - -procedure TfmEditorOptionsDialog.cKeyCommandKeyPress(Sender: TObject; - var Key: Char); -var WorkStr : string; - i : Integer; -begin -//This would be better if componentized, but oh well... - WorkStr := Uppercase(Copy(cKeyCommand.Text, 1, cKeyCommand.SelStart) + Key); - i := 0; - while i < cKeyCommand.Items.Count do - begin - if pos(WorkStr, Uppercase(cKeyCommand.Items[i])) = 1 then - begin - cKeyCommand.Text := cKeyCommand.Items[i]; - cKeyCommand.SelStart := length(WorkStr); - cKeyCommand.SelLength := Length(cKeyCommand.Text) - cKeyCommand.SelStart; - Key := #0; - Break; - end - else - Inc(i); - end; - end; procedure TfmEditorOptionsDialog.cKeyCommandKeyUp(Sender: TObject; @@ -1012,11 +1041,11 @@ procedure TfmEditorOptionsDialog.KeyListChanging(Sender: TObject; Item: TListItem; Change: TItemChange; var AllowChange: Boolean); begin //make sure that it's saved. - if FInChanging then Exit; - FInChanging := True; + if InChanging then Exit; + InChanging := True; if Visible then begin - if (Item = FOldSelected) and + if (Item = OldSelected) and ((Item.Caption <> cKeyCommand.Text) or (TSynEditKeystroke(Item.Data).ShortCut <> eKeyShort1.HotKey) or (TSynEditKeystroke(Item.Data).ShortCut2 <> eKeyShort2.HotKey)) then @@ -1024,33 +1053,7 @@ procedure TfmEditorOptionsDialog.KeyListChanging(Sender: TObject; btnUpdateKeyClick(btnUpdateKey); end; end; - FInChanging := False; -end; - -{$IFNDEF SYN_COMPILER_4_UP} -procedure TfmEditorOptionsDialog.OverridingWndProc(var Message: TMessage); -var - Item: TListItem; -begin - FOldWndProc(Message); - - if Message.Msg = CN_NOTIFY then - with TWMNotify(Message) do - if NMHdr.code = LVN_ITEMCHANGED then - with PNMListView(NMHdr)^ do - begin - Item := KeyList.Items[iItem]; - if Assigned(FOnSelectItem) and (uChanged = LVIF_STATE) then - begin - if (uOldState and LVIS_SELECTED <> 0) and - (uNewState and LVIS_SELECTED = 0) then - FOnSelectItem(Self, Item, False) - else if (uOldState and LVIS_SELECTED = 0) and - (uNewState and LVIS_SELECTED <> 0) then - FOnSelectItem(Self, Item, True); - end; - end; + InChanging := False; end; -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynEditPlugins.pas b/Ext/SynEdit/Source/SynEditPlugins.pas index 7415332..13edcb6 100644 --- a/Ext/SynEdit/Source/SynEditPlugins.pas +++ b/Ext/SynEdit/Source/SynEditPlugins.pas @@ -26,30 +26,19 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditPlugins.pas,v 1.8.2.2 2008/09/14 16:24:58 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITPLUGINS} unit SynEditPlugins; -{$ENDIF} {$I SynEdit.inc} interface uses - {$IFDEF SYN_COMPILER_17_UP} - Types, - {$ENDIF} Windows, Menus, SynEdit, + SynEditTypes, SynEditKeyCmds, SynUnicode, Classes; @@ -62,7 +51,7 @@ TAbstractSynPlugin = class(TComponent) function GetEditor: TCustomSynEdit; function GetEditorCount: Integer; protected - FEditors: TList; + fEditors: TList; procedure Notification(aComponent: TComponent; aOperation: TOperation); override; procedure DoAddEditor(aEditor: TCustomSynEdit); virtual; @@ -85,7 +74,7 @@ TAbstractSynHookerPlugin = class(TAbstractSynPlugin) aCommandID: TSynEditorCommand; aShortCut: TShortCut); procedure OnCommand(Sender: TObject; AfterProcessing: Boolean; var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; - Data: Pointer; HandlerData: Pointer); virtual; abstract; + Data: pointer; HandlerData: pointer); virtual; abstract; end; TPluginState = (psNone, psExecuting, psAccepting, psCancelling); @@ -96,9 +85,9 @@ TAbstractSynSingleHookPlugin = class(TAbstractSynHookerPlugin) function IsShortCutStored: Boolean; procedure SetShortCut(const Value: TShortCut); protected - FState: TPluginState; + fState: TPluginState; fCurrentEditor: TCustomSynEdit; - FShortCut: TShortCut; + fShortCut: TShortCut; class function DefaultShortCut: TShortCut; virtual; procedure DoAddEditor(aEditor: TCustomSynEdit); override; procedure DoRemoveEditor(aEditor: TCustomSynEdit); override; @@ -116,7 +105,7 @@ TAbstractSynSingleHookPlugin = class(TAbstractSynHookerPlugin) procedure Accept; procedure Cancel; published - property ShortCut: TShortCut read FShortCut write SetShortCut + property ShortCut: TShortCut read fShortCut write SetShortCut stored IsShortCutStored; end; @@ -124,19 +113,19 @@ TAbstractSynSingleHookPlugin = class(TAbstractSynHookerPlugin) TAbstractSynCompletion = class(TAbstractSynSingleHookPlugin) protected - fCurrentString: UnicodeString; + fCurrentString: string; protected - procedure SetCurrentString(const Value: UnicodeString); virtual; + procedure SetCurrentString(const Value: string); virtual; procedure OnCommand(Sender: TObject; AfterProcessing: Boolean; var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; - Data, HandlerData: Pointer); override; + Data: pointer; HandlerData: pointer); override; procedure DoExecute; override; procedure DoAccept; override; procedure DoCancel; override; - function GetCurrentEditorString: UnicodeString; virtual; + function GetCurrentEditorString: string; virtual; public procedure AddEditor(aEditor: TCustomSynEdit); - property CurrentString: UnicodeString read fCurrentString write SetCurrentString; + property CurrentString: string read fCurrentString write SetCurrentString; end; function NewPluginCommand: TSynEditorCommand; @@ -145,8 +134,8 @@ procedure ReleasePluginCommand(aCmd: TSynEditorCommand); implementation uses + Types, Forms, - SynEditTypes, SynEditMiscProcs, SynEditStrConst, SysUtils; @@ -173,25 +162,25 @@ procedure ReleasePluginCommand(aCmd: TSynEditorCommand); function TAbstractSynPlugin.AddEditor(aEditor: TCustomSynEdit): Integer; begin - if FEditors = nil then + if fEditors = nil then begin - FEditors := TList.Create; + fEditors := TList.Create; end else - if FEditors.IndexOf(aEditor) >= 0 then + if fEditors.IndexOf(aEditor) >= 0 then begin Result := -1; Exit; end; aEditor.FreeNotification(Self); - Result := FEditors.Add(aEditor); + Result := fEditors.Add(aEditor); DoAddEditor(aEditor); end; destructor TAbstractSynPlugin.Destroy; begin - { RemoveEditor will free FEditors when it reaches count = 0} - while Assigned(FEditors) do + { RemoveEditor will free fEditors when it reaches count = 0} + while Assigned(fEditors) do RemoveEditor(Editors[0]); inherited; end; @@ -219,17 +208,17 @@ procedure TAbstractSynPlugin.DoRemoveEditor(aEditor: TCustomSynEdit); function TAbstractSynPlugin.RemoveEditor(aEditor: TCustomSynEdit): Integer; begin - if FEditors = nil then + if fEditors = nil then begin Result := -1; Exit; end; - Result := FEditors.Remove(aEditor); + Result := fEditors.Remove(aEditor); //aEditor.RemoveFreeNotification(Self); - if FEditors.Count = 0 then + if fEditors.Count = 0 then begin - FEditors.Free; - FEditors := nil; + fEditors.Free; + fEditors := nil; end; if Result >= 0 then DoRemoveEditor(aEditor); @@ -242,7 +231,7 @@ procedure TAbstractSynPlugin.SetEditor(const Value: TCustomSynEdit); iEditor := Editor; if iEditor <> Value then try - if (iEditor <> nil) and (FEditors.Count = 1) then + if (iEditor <> nil) and (fEditors.Count = 1) then RemoveEditor(iEditor); if Value <> nil then AddEditor(Value); @@ -256,21 +245,21 @@ procedure TAbstractSynPlugin.SetEditor(const Value: TCustomSynEdit); function TAbstractSynPlugin.GetEditors(aIndex: Integer): TCustomSynEdit; begin - Result := TCustomSynEdit(FEditors[aIndex]); + Result := TCustomSynEdit(fEditors[aIndex]); end; function TAbstractSynPlugin.GetEditor: TCustomSynEdit; begin - if FEditors <> nil then - Result := FEditors[0] + if fEditors <> nil then + Result := fEditors[0] else Result := nil; end; function TAbstractSynPlugin.GetEditorCount: Integer; begin - if FEditors <> nil then - Result := FEditors.Count + if fEditors <> nil then + Result := fEditors.Count else Result := 0; end; @@ -282,13 +271,20 @@ procedure TAbstractSynHookerPlugin.HookEditor(aEditor: TCustomSynEdit; var iIndex: Integer; iKeystroke: TSynEditKeyStroke; + Dup: Integer; + DupCmd: string; begin Assert(aNewShortCut <> 0); { shortcurts aren't created while in design-time } if [csDesigning] * ComponentState = [csDesigning] then begin - if TSynEdit(aEditor).Keystrokes.FindShortcut(aNewShortCut) >= 0 then - raise ESynKeyError.Create(SYNS_EDuplicateShortCut) + Dup := TSynEdit(aEditor).Keystrokes.FindShortcut(aNewShortCut); + if Dup >= 0 then + begin + DupCmd := EditorCommandToExtendedCodeString( + TSynEdit(aEditor).Keystrokes[Dup].Command); + raise ESynKeyError.CreateFmt(SYNS_EDuplicateShortCut, ['Plugin', DupCmd]) + end else Exit; end; @@ -334,23 +330,23 @@ procedure TAbstractSynHookerPlugin.UnHookEditor(aEditor: TCustomSynEdit; procedure TAbstractSynSingleHookPlugin.Accept; begin - FState := psAccepting; + fState := psAccepting; try DoAccept; finally fCurrentEditor := nil; - FState := psNone; + fState := psNone; end; end; procedure TAbstractSynSingleHookPlugin.Cancel; begin - FState := psCancelling; + fState := psCancelling; try DoCancel; finally fCurrentEditor := nil; - FState := psNone; + fState := psNone; end; end; @@ -358,7 +354,7 @@ constructor TAbstractSynSingleHookPlugin.Create(aOwner: TComponent); begin inherited; fCommandID := NewPluginCommand; - FShortCut := DefaultShortCut; + fShortCut := DefaultShortCut; end; class function TAbstractSynSingleHookPlugin.DefaultShortCut: TShortCut; @@ -387,8 +383,8 @@ procedure TAbstractSynSingleHookPlugin.Execute(aEditor: TCustomSynEdit); Cancel; Assert(fCurrentEditor = nil); fCurrentEditor := aEditor; - Assert(FState = psNone); - FState := psExecuting; + Assert(fState = psNone); + fState := psExecuting; try DoExecute; except @@ -399,12 +395,12 @@ procedure TAbstractSynSingleHookPlugin.Execute(aEditor: TCustomSynEdit); function TAbstractSynSingleHookPlugin.Executing: Boolean; begin - Result := FState = psExecuting; + Result := fState = psExecuting; end; function TAbstractSynSingleHookPlugin.IsShortCutStored: Boolean; begin - Result := FShortCut <> DefaultShortCut; + Result := fShortCut <> DefaultShortCut; end; procedure TAbstractSynSingleHookPlugin.DoRemoveEditor(aEditor: TCustomSynEdit); @@ -419,28 +415,28 @@ procedure TAbstractSynSingleHookPlugin.SetShortCut(const Value: TShortCut); var cEditor: Integer; begin - if FShortCut <> Value then + if fShortCut <> Value then begin - if Assigned(FEditors) then + if Assigned(fEditors) then if Value <> 0 then begin - for cEditor := 0 to FEditors.Count -1 do - HookEditor(Editors[cEditor], CommandID, FShortCut, Value); + for cEditor := 0 to fEditors.Count -1 do + HookEditor(Editors[cEditor], CommandID, fShortCut, Value); end else begin - for cEditor := 0 to FEditors.Count -1 do - UnHookEditor(Editors[cEditor], CommandID, FShortCut); + for cEditor := 0 to fEditors.Count -1 do + UnHookEditor(Editors[cEditor], CommandID, fShortCut); end; - FShortCut := Value; + fShortCut := Value; end; end; { TAbstractSynCompletion } -function TAbstractSynCompletion.GetCurrentEditorString: UnicodeString; +function TAbstractSynCompletion.GetCurrentEditorString: string; var - S: UnicodeString; + S: string; Col: Integer; begin S := CurrentEditor.LineText; @@ -474,7 +470,7 @@ procedure TAbstractSynCompletion.OnCommand(Sender: TObject; var Command: TSynEditorCommand; var AChar: WideChar; Data, HandlerData: Pointer); var - S: UnicodeString; + S: string; begin if not Executing then begin @@ -546,7 +542,7 @@ procedure TAbstractSynCompletion.OnCommand(Sender: TObject; end; {endif Sender = CurrentEditor} end; -procedure TAbstractSynCompletion.SetCurrentString(const Value: UnicodeString); +procedure TAbstractSynCompletion.SetCurrentString(const Value: string); begin fCurrentString := Value; end; diff --git a/Ext/SynEdit/Source/SynEditPrint.pas b/Ext/SynEdit/Source/SynEditPrint.pas index 5928b94..83b32a4 100644 --- a/Ext/SynEdit/Source/SynEditPrint.pas +++ b/Ext/SynEdit/Source/SynEditPrint.pas @@ -1,4 +1,4 @@ -{------------------------------------------------------------------------------- +{------------------------------------------------------------------------------- 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 @@ -12,7 +12,7 @@ The Initial Author of the Original Code is Morten J. Skovrup. Portions written by Morten J. Skovrup are copyright 2000 Morten J. Skovrup. -Unicode translation by Maël Hörz. +Unicode translation by Maël Hörz. All Rights Reserved. Contributors to the SynEdit project are listed in the Contributors.txt file. @@ -26,14 +26,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditPrint.pas,v 1.34.2.12 2008/09/23 14:02:08 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: - Wrapping across page boundaries is not supported -------------------------------------------------------------------------------} {------------------------------------------------------------------------------- @@ -64,7 +56,7 @@ OnPrintStatus : Fired at Beginning, End and when a new page is started Highlighter : The highlighter used for highlighting the text (see also the SynEdit property below) - LineNumbersInMargin : If true line numbers are printed in the left margin, + LineNumbersInMargin : If True line numbers are printed in the left margin, else left margin is increased by width of line number text. SelectedOnly : Print only the selected Area @@ -76,15 +68,13 @@ properties Lines, Font and Highlighter are automatically set to the corresponding values of the TSynEdit component Run-time methods: - UpdatePages : Used internally by the TSynEditPrintPreview component - PrintToCanvas : Used internally by the TSynEditPrintPreview component + InitPrint : Used internally by the TSynEditPrintPreview component + PaintPreview : Used internally by the TSynEditPrintPreview component Print : Prints the contents of the Lines property PrintRange(StartPage,EndPage) : Prints the specified page-range (both inclusive) -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITPRINT} unit SynEditPrint; -{$ENDIF} {$M+} {$I SynEdit.inc} @@ -92,12 +82,14 @@ interface uses - {$IFDEF SYN_COMPILER_17_UP} - UITypes, - {$ENDIF} - Windows, - Graphics, - Printers, + Winapi.Windows, + Winapi.D2D1, + System.Types, + System.SysUtils, + System.Classes, + System.Generics.Collections, + Vcl.Graphics, + Vcl.Printers, SynEdit, SynEditTypes, SynEditPrintTypes, @@ -107,96 +99,84 @@ interface SynEditMiscProcs, SynEditHighlighter, SynUnicode, - SysUtils, - Classes; + SynDWrite; type TPageLine = class public FirstLine: Integer; + FirstRow: Integer; + LastLine: Integer; + LastRow: Integer; end; + //The actual print controller object TSynEditPrint = class(TComponent) private - FCopies: Integer; + FCopies: Integer; FFooter: TFooter; FHeader: THeader; - FLines: TUnicodeStrings; + FLines: TStrings; FMargins: TSynEditPrintMargins; - FPageCount: Integer; FFont: TFont; - FTitle: UnicodeString; - FDocTitle: UnicodeString; + FTitle: string; + FDocTitle: string; FPrinterInfo: TSynEditPrinterInfo; - FPages: TList; - FCanvas: TCanvas; - FCharWidth: Integer; + FPages: TObjectList; FMaxLeftChar: Integer; FWrap: Boolean; FOnPrintLine: TPrintLineEvent; FOnPrintStatus: TPrintStatusEvent; - FYPos: Integer; FLineHeight: Integer; FHighlight: Boolean; FColors: Boolean; FHighlighter: TSynCustomHighlighter; - FOldFont: TFont; FSynOK: Boolean; FLineNumbers: Boolean; - FLineNumber: Integer; FLineOffset: Integer; FAbort: Boolean; FPrinting: Boolean; FDefaultBG: TColor; FPageOffset: Integer; FRangesOK: Boolean; + FMaxRowCount: Integer; FMaxWidth: Integer; - FMaxCol: Integer; FPagesCounted: Boolean; FLineNumbersInMargin: Boolean; FTabWidth: Integer; - FFontColor: TColor; FSelectedOnly: Boolean; FSelAvail: Boolean; - FSelMode: TSynSelectionMode; FBlockBegin: TBufferCoord; FBlockEnd: TBufferCoord; - FETODist: PIntArray; + FSynTextFormat: TSynTextFormat; procedure CalcPages; - procedure PrintPage(Num: Integer); - procedure WriteLine(const Text: UnicodeString); - procedure WriteLineNumber; - procedure HandleWrap(const Text: UnicodeString; MaxWidth: Integer); - procedure TextOut(const Text: UnicodeString; AList: TList); - procedure RestoreCurrentFont; - procedure SaveCurrentFont; + procedure SetLines(const Value: TStrings); + procedure SetFont(const Value: TFont); + procedure SetMaxLeftChar(const Value: Integer); + procedure PrintPage(RT: ID2D1RenderTarget; Num: Integer; const ClipR: TRect); + procedure WriteLineNumber(RT: ID2D1RenderTarget; const LineNumber, YPos: + Integer; FontColor: TColor); + procedure SetHighlighter(const Value: TSynCustomHighlighter); procedure SetPixelsPrInch; - procedure InitPrint; procedure InitRanges; function GetPageCount: Integer; procedure SetSynEdit(const Value: TCustomSynEdit); procedure SetFooter(const Value: TFooter); procedure SetHeader(const Value: THeader); procedure SetMargins(const Value: TSynEditPrintMargins); - procedure SetHighlighter(const Value: TSynCustomHighlighter); - procedure SetLines(const Value: TUnicodeStrings); - procedure SetFont(const Value: TFont); - procedure SetCharWidth(const Value: Integer); - procedure SetMaxLeftChar(const Value: Integer); - function ClipLineToRect(S: UnicodeString; R: TRect): UnicodeString; - function ExpandAtWideGlyphs(const S: UnicodeString): UnicodeString; + function GetTextLayout(const Line: Integer): TSynTextLayout; protected procedure DefineProperties(Filer: TFiler); override; property MaxLeftChar: Integer read FMaxLeftChar write SetMaxLeftChar; - property CharWidth: Integer read FCharWidth write SetCharWidth; - procedure PrintStatus(Status: TSynPrintStatus; PageNumber: Integer; + procedure DoPrintStatus(Status: TSynPrintStatus; PageNumber: Integer; var Abort: Boolean); virtual; - procedure PrintLine(LineNumber, PageNumber: Integer); virtual; + procedure DoPrintLine(LineNumber, PageNumber: Integer); virtual; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; - procedure UpdatePages(ACanvas: TCanvas); - procedure PrintToCanvas(ACanvas: TCanvas; PageNumber: Integer); + procedure InitPrint; + procedure PrintToCanvas(ACanvas: TCanvas; const RenderRect, ClipRect: TRect; + PageNo: Integer); procedure Print; procedure PrintRange(StartPage, EndPage: Integer); property PrinterInfo: TSynEditPrinterInfo read FPrinterInfo; @@ -210,10 +190,10 @@ TSynEditPrint = class(TComponent) property Header: THeader read FHeader write SetHeader; property Footer: TFooter read FFooter write SetFooter; property Margins: TSynEditPrintMargins read FMargins write SetMargins; - property Lines: TUnicodeStrings read FLines write SetLines; + property Lines: TStrings read FLines write SetLines; property Font: TFont read FFont write SetFont; - property Title: UnicodeString read FTitle write FTitle; - property DocTitle: UnicodeString read FDocTitle write FDocTitle; + property Title: string read FTitle write FTitle; + property DocTitle: string read FDocTitle write FDocTitle; property Wrap: Boolean read FWrap write FWrap default True; property Highlight: Boolean read FHighlight write FHighlight default True; property SelectedOnly: Boolean read FSelectedOnly write FSelectedOnly @@ -231,13 +211,18 @@ TSynEditPrint = class(TComponent) property LineNumbersInMargin: Boolean read FLineNumbersInMargin write FLineNumbersInMargin default False; property TabWidth: Integer read fTabWidth write fTabWidth; - property Color: TColor read fDefaultBG write fDefaultBG; + property Color: TColor read fDefaultBG write fDefaultBG; end; implementation uses - Math; + Winapi.MultiMon, + System.Math, + System.UITypes; + +resourcestring + SYNS_NoPrinter = 'No printer available'; { TSynEditPrint } @@ -247,11 +232,13 @@ constructor TSynEditPrint.Create(AOwner: TComponent); FCopies := 1; FFooter := TFooter.Create; FHeader := THeader.Create; - FLines := TUnicodeStringList.Create; + FLines := TStringList.Create; FMargins := TSynEditPrintMargins.Create; FPrinterInfo := TSynEditPrinterInfo.Create; FFont := TFont.Create; - FOldFont := TFont.Create; + FFont.Name := DefaultFontName; + FFont.PixelsPerInch := 96; + FFont.Size := 10; MaxLeftChar := 1024; FWrap := True; FHighlight := True; @@ -260,14 +247,12 @@ constructor TSynEditPrint.Create(AOwner: TComponent); FLineOffset := 0; FPageOffset := 0; FLineNumbersInMargin := False; - FPages := TList.Create; - FTabWidth := 8; - FDefaultBG := clWhite; + FPages := TObjectList.Create; + FTabWidth := 8; + FDefaultBG := clWhite; end; destructor TSynEditPrint.Destroy; -var - i: Integer; begin FFooter.Free; FHeader.Free; @@ -275,49 +260,19 @@ destructor TSynEditPrint.Destroy; FMargins.Free; FPrinterInfo.Free; FFont.Free; - FOldFont.Free; - for i := 0 to FPages.Count - 1 do - TPageLine(FPages[i]).Free; FPages.Free; - FreeMem(FETODist); inherited; end; procedure TSynEditPrint.DefineProperties(Filer: TFiler); begin inherited; -{$IFNDEF UNICODE} - UnicodeDefineProperties(Filer, Self); -{$ENDIF} end; -procedure TSynEditPrint.SetLines(const Value: TUnicodeStrings); -var - i, j: Integer; - ConvertTabsProc: TConvertTabsProc; - TmpString: UnicodeString; +procedure TSynEditPrint.SetLines(const Value: TStrings); begin - ConvertTabsProc := GetBestConvertTabsProc(FTabWidth); - with FLines do - begin - BeginUpdate; - try - Clear; - for i := 0 to Value.Count - 1 do - begin - TmpString := ConvertTabsProc(Value[i], FTabWidth); - j := Pos(#9, TmpString); - while j > 0 do - begin - TmpString[j] := ' '; - j := Pos(#9, TmpString); - end; - Add(TmpString); - end; - finally - EndUpdate; - end; - end; + FLines.Clear; + FLines.AddStrings(Value); FRangesOK := False; FPagesCounted := False; end; @@ -328,11 +283,6 @@ procedure TSynEditPrint.SetFont(const Value: TFont); FPagesCounted := False; end; -procedure TSynEditPrint.SetCharWidth(const Value: Integer); -begin - FCharWidth := Value; -end; - procedure TSynEditPrint.SetMaxLeftChar(const Value: Integer); begin FMaxLeftChar := Value; @@ -345,82 +295,32 @@ procedure TSynEditPrint.SetHighlighter(const Value: TSynCustomHighlighter); FPagesCounted := False; end; -// Inserts filling chars into a string containing chars that display as glyphs -// wider than an average glyph. (This is often the case with Asian glyphs, which -// are usually wider than latin glpyhs) -// This is only to simplify paint-operations and has nothing to do with -// multi-byte chars. -function TSynEditPrint.ExpandAtWideGlyphs(const S: UnicodeString): UnicodeString; -var - i, j, CountOfAvgGlyphs: Integer; -begin - FCanvas.Font := Font; - - j := 0; - SetLength(Result, Length(S) * 2); // speed improvement - for i := 1 to Length(S) do - begin - Inc(j); - CountOfAvgGlyphs := Ceil(TextWidth(FCanvas, S[i]) / fCharWidth); - - if j + CountOfAvgGlyphs > Length(Result) then - SetLength(Result, Length(Result) + 128); - - // insert CountOfAvgGlyphs filling chars - while CountOfAvgGlyphs > 1 do - begin - Result[j] := FillerChar; - Inc(j); - Dec(CountOfAvgGlyphs); - end; - - Result[j] := S[i]; - end; - - SetLength(Result, j); -end; - procedure TSynEditPrint.InitPrint; { Initialize Font.PixelsPerInch, Character widths, Margins, Total Page count, headers and footers} -var - TmpSize: Integer; - TmpTextMetrics: TTextMetric; begin -// FDefaultBG := FCanvas.Brush.Color; - FFontColor := FFont.Color; - FCanvas.Font.Assign(FFont); - if not FPrinting then - begin - SetPixelsPrInch; - TmpSize := FCanvas.Font.Size; - FCanvas.Font.PixelsPerInch := FFont.PixelsPerInch; - FCanvas.Font.Size := TmpSize; - end; - // Calculate TextMetrics with the (probably) most wider text styles so text is - // never clipped (although potentially wasting space) - FCanvas.Font.Style := [fsBold, fsItalic, fsUnderline, fsStrikeOut]; - GetTextMetrics(FCanvas.Handle, TmpTextMetrics); - CharWidth := TmpTextMetrics.tmAveCharWidth; - FLineHeight := TmpTextMetrics.tmHeight + TmpTextMetrics.tmExternalLeading; - FCanvas.Font.Style := FFont.Style; - FMargins.InitPage(FCanvas, 1, FPrinterInfo, FLineNumbers, FLineNumbersInMargin, - FLines.Count - 1 + FLineOffset); + FPrinterInfo.UpdatePrinter; + SetPixelsPrInch; + FSynTextFormat := TSynTextFormat.Create(FFont, FTabWidth, 0, 0); + FLineHeight := FSynTextFormat.LineHeight; + FMargins.InitPage(FSynTextFormat, 1, FPrinterInfo, FLineNumbers, + FLineNumbersInMargin, FLines.Count - 1 + FLineOffset); + FSynOK := Highlight and Assigned(FHighLighter) and (FLines.Count > 0); CalcPages; - FHeader.InitPrint(FCanvas, FPageCount, FTitle, FMargins); - FFooter.InitPrint(FCanvas, FPageCount, FTitle, FMargins); - FSynOK := Highlight and Assigned(FHighlighter) and (FLines.Count > 0); + FHeader.InitPrint(FPages.Count, FTitle, FMargins); + FFooter.InitPrint(FPages.Count, FTitle, FMargins); end; procedure TSynEditPrint.SetPixelsPrInch; +// Scale fonts for 96 PPI var TmpSize: Integer; begin - FHeader.SetPixPrInch(FPrinterInfo.YPixPrInch); - FFooter.SetPixPrInch(FPrinterInfo.YPixPrInch); - //This should be necessary - else size would be changed... + FHeader.SetPixPrInch(96); + FFooter.SetPixPrInch(96); + TmpSize := FFont.Size; - FFont.PixelsPerInch := FPrinterInfo.YPixPrInch; + FFont.PixelsPerInch := 96; FFont.Size := TmpSize; end; @@ -432,7 +332,7 @@ procedure TSynEditPrint.InitRanges; if not FRangesOK and Assigned(FHighlighter) and (Lines.Count > 0) then begin FHighlighter.ResetRange; - FLines.Objects[0] := FHighlighter.GetRange; + FLines.Objects[0] := fHighlighter.GetRange; i := 1; while i < Lines.Count do begin @@ -448,115 +348,71 @@ procedure TSynEditPrint.InitRanges; // Calculates the total number of pages procedure TSynEditPrint.CalcPages; var - AStr, Text: UnicodeString; - StrWidth: Integer; - i, j: Integer; - AList: TList; - YPos: Integer; + I: Integer; PageLine: TPageLine; - - //Counts the number of lines a line is wrapped to - procedure CountWrapped; - var - j: Integer; - begin - for j := 0 to AList.Count - 1 do - YPos := YPos + FLineHeight; - end; - -var + TextLayout: TSynTextLayout; + LineMetrics: TDwriteLineMetrics; + ActualLineCount: Cardinal; + LayoutRowCount: Integer; + RowCount: Integer; iStartLine, iEndLine: Integer; - iSelStart, iSelLen: Integer; begin InitRanges; - for i := 0 to FPages.Count - 1 do - TPageLine(FPages[i]).Free; FPages.Clear; FMaxWidth := FMargins.PRight - FMargins.PLeft; - AStr := ''; - FMaxCol := 0; - while TextWidth(FCanvas, AStr) < FMaxWidth do - begin - AStr := AStr + 'W'; - FMaxCol := FMaxCol + 1; - end; - FMaxCol := FMaxCol - 1; - {FTestString is used to Calculate MaxWidth when prewiewing and printing - - else the length is not calculated correctly when prewiewing and the - zoom is different from 0.25,0.5,1,2,4 (as for example 1.20) - WHY???} -// fTestString := UnicodeStringOfChar('W', FMaxCol); - AStr := UnicodeStringOfChar('W', FMaxCol); - FMaxWidth := TextWidth(FCanvas, AStr); - FPageCount := 1; - PageLine := TPageLine.Create; - PageLine.FirstLine := 0; - FPages.Add(PageLine); - YPos := FMargins.PTop; if SelectedOnly then begin - iStartLine := FBlockBegin.Line -1; - iEndLine := FBlockEnd.Line -1; + iStartLine := fBlockBegin.Line -1; + iEndLine := fBlockEnd.Line -1; end else begin iStartLine := 0; iEndLine := Lines.Count -1; end; - for i := iStartLine to iEndLine do + PageLine := TPageLine.Create; + PageLine.FirstLine := iStartLine; + PageLine.FirstRow := 1; + PageLine.LastLine := -1; + FPages.Add(PageLine); + FMaxRowCount := (FMargins.PBottom - FMargins.PTop) div FLineHeight; + Assert(FMaxRowCount > 1); + RowCount := 0; + for I := iStartLine to iEndLine do begin - if not FSelectedOnly or (FSelMode = smLine) then - Text := Lines[i] + if FLines[I] = '' then + begin + Inc(RowCount); + LayoutRowCount := 1; + end else begin - if (FSelMode = smColumn) or (i = FBlockBegin.Line -1) then - iSelStart := FBlockBegin.Char - else - iSelStart := 1; - if (FSelMode = smColumn) or (i = FBlockEnd.Line -1) then - iSelLen := FBlockEnd.Char - iSelStart - else - iSelLen := MaxInt; - Text := Copy( Lines[i], iSelStart, iSelLen ); + TextLayout := GetTextLayout(i); + TextLayout.IDW.GetLineMetrics(@LineMetrics, 1, ActualLineCount); + LayoutRowCount := ActualLineCount; // to avoid warnings + Inc(RowCount, LayoutRowCount); end; - {if new page then increase FPageCount and save the top-line number in - FPages} - if YPos + FLineHeight > FMargins.PBottom then + + // Add new page(s) if needed (word wrap) + while RowCount >= FMaxRowCount do begin - YPos := FMargins.PTop; - FPageCount := FPageCount + 1; + PageLine.LastLine := I; + PageLine.LastRow := LayoutRowCount - (RowCount - FMaxRowCount); + + if (RowCount = FMaxRowCount) and (I = iEndLine) then Break; + PageLine := TPageLine.Create; - PageLine.FirstLine := i; + PageLine.FirstLine := IfThen(RowCount = FMaxRowCount, I + 1, I); + PageLine.FirstRow := IfThen(RowCount = FMaxRowCount, 1, + LayoutRowCount - RowCount + FMaxRowCount + 1); FPages.Add(PageLine); + RowCount := RowCount - FMaxRowCount; end; - StrWidth := TextWidth(FCanvas, Text); - {Check for wrap} - if Wrap and (StrWidth > FMaxWidth) then begin - AList := TList.Create; - if WrapTextEx(Text, [' ', '-', #9, ','], FMaxCol, AList) then - CountWrapped - else - begin - {If WrapTextToList didn't succed with the first set of breakchars - then try this one:} - if WrapTextEx(Text, [';', ')', '.'], FMaxCol, AList) then - CountWrapped - else - begin - {If WrapTextToList didn't succed at all, then do it the - primitive way} - while Length(Text) > 0 do - begin - AStr := Copy(Text, 1, FMaxCol); - Delete(Text, 1, FMaxCol); - if Length(Text) > 0 then - YPos := YPos + FLineHeight; - end; - end; - end; - for j := 0 to AList.Count - 1 do - TWrapPos(AList[j]).Free; - AList.Free; + + if I = iEndLine then + begin + PageLine.LastLine := I; + PageLine.LastRow := LayoutRowCount; end; - YPos := YPos + FLineHeight; end; FPagesCounted := True; end; @@ -564,338 +420,225 @@ procedure TSynEditPrint.CalcPages; { Writes the line number. FMargins. PLeft is the position of the left margin (which is automatically incremented by the length of the linenumber text, if the linenumbers should not be placed in the margin) } -procedure TSynEditPrint.WriteLineNumber; +procedure TSynEditPrint.WriteLineNumber(RT: ID2D1RenderTarget; const LineNumber, YPos: Integer; + FontColor: TColor); var - AStr: UnicodeString; + AStr: string; + Layout: TSynTextLayout; begin - SaveCurrentFont; - AStr := IntToStr(FLineNumber + FLineOffset) + ': '; - FCanvas.Brush.Color := FDefaultBG; - FCanvas.Font.Style := []; - FCanvas.Font.Color := clBlack; - SynUnicode.TextOut(FCanvas, FMargins.PLeft - TextWidth(FCanvas, AStr), FYPos, AStr); - RestoreCurrentFont; + AStr := IntToStr(LineNumber + FLineOffset) + ': '; + Layout := TSynTextLayout.Create(FSynTextFormat, PChar(AStr), AStr.Length); + Layout.Draw(RT, FMargins.PLeft - + Round(Layout.TextMetrics.widthIncludingTrailingWhitespace), YPos, FontColor); end; -procedure TSynEditPrint.HandleWrap(const Text: UnicodeString; MaxWidth: Integer); +procedure TSynEditPrint.PrintPage(RT: ID2D1RenderTarget; Num: Integer; const ClipR: TRect); +// Prints a page to a RenderTarget +// ** The RenderTarget assumes a PPI of 96 ** +// The ClipR(ect) serves the purpose of reducing painting when previewing var - AStr: UnicodeString; - AList: TList; - j: Integer; - - procedure WrapPrimitive; - var - i: Integer; - WrapPos: TWrapPos; - begin - i := 1; - while i <= Length(Text) do - begin - AStr := ''; - while (Length(AStr) < FMaxCol) and (i <= Length(Text)) do - begin - AStr := AStr + Text[i]; - i := i + 1; - end; - WrapPos := TWrapPos.Create; - WrapPos.Index := i - 1; - AList.Add(WrapPos); - if (Length(AStr) - i) <= FMaxCol then - Break; - end; - end; - + I: Integer; + LineText: string; + YPos: Integer; + iSelStart, iSelLen: Integer; + TextLayout: TSynTextLayout; + LineMetrics: TDwriteLineMetrics; + ActualLineCount: Cardinal; + LayoutRowCount: Integer; + Token: string; + TokenPos, TokenEnd: Integer; + Attr: TSynHighlighterAttributes; + BkgColor, FontColor, AColor: TColor; + HitMetrics: TDwriteHitTestMetrics; + X1, X2, Y1, Y2: Single; begin - AStr := ''; - //First try to break the string at the following chars: - AList := TList.Create; - if WrapTextEx(Text, [' ', '-', #9, ','], FMaxCol, AList) then - TextOut(Text, AList) - else + DoPrintStatus(psNewPage, Num, FAbort); + if not FAbort then begin - //Then try to break the string at the following chars: - if WrapTextEx(Text, [';', ')', '.'], FMaxCol, AList) then - TextOut(Text, AList) - else + if FPages.Count >= Num then begin - WrapPrimitive; - TextOut(Text, AList) - end; - end; - for j := 0 to AList.Count - 1 do - TWrapPos(Alist[j]).Free; - AList.Free; -end; + RT.SetTextAntialiasMode(D2D1_TEXT_ANTIALIAS_MODE_CLEARTYPE); + RT.SetAntialiasMode(D2D1_ANTIALIAS_MODE_PER_PRIMITIVE); -procedure TSynEditPrint.SaveCurrentFont; -begin - FOldFont.Assign(FCanvas.Font); -end; + if FColors and FSynOK then + BkgColor := FHighlighter.WhitespaceAttribute.Background + else + BkgColor := Color; -procedure TSynEditPrint.RestoreCurrentFont; -begin - FCanvas.Font.Assign(FOldFont); -end; + if IsColorDark(BkgColor) then + FontColor := clWhite + else + FontColor := Font.Color; -function TSynEditPrint.ClipLineToRect(S: UnicodeString; R: TRect): UnicodeString; -begin - while TextWidth(FCanvas, S) > FMaxWidth do - SetLength(S, Length(S) - 1); + RT.Clear(D2D1ColorF(BkgColor)); - Result := S; -end; + if FMargins.PTop >= ClipR.Top then + FHeader.Print(RT, Num + FPageOffset); -//Does the actual printing -procedure TSynEditPrint.TextOut(const Text: UnicodeString; AList: TList); -var - Token: UnicodeString; - TokenPos: Integer; - Attr: TSynHighlighterAttributes; - AColor: TColor; - TokenStart: Integer; - LCount: Integer; - Handled: Boolean; - aStr: UnicodeString; - i, WrapPos, OldWrapPos: Integer; - Lines: TUnicodeStringList; - ClipRect: TRect; - sLine, sLineExpandedAtWideGlyphs: UnicodeString; - ExpandedPos: Integer; - - procedure InitETODist(CharWidth: Integer; const Text: UnicodeString); - var - Size: TSize; - i: Integer; - begin - ReallocMem(FETODist, Length(Text) * SizeOf(Integer)); - for i := 0 to Length(Text) - 1 do - begin - Size := GetTextSize(FCanvas.Handle, @Text[i + 1], 1); - FETODist[i] := Ceil(Size.cx / CharWidth) * CharWidth; - end; - end; - - procedure ClippedTextOut(X, Y: Integer; Text: UnicodeString); - begin - Text := ClipLineToRect(Text, ClipRect); - InitETODist(FCharWidth, Text); - Windows.ExtTextOutW(FCanvas.Handle, X, Y, 0, nil, PWideChar(Text), - Length(Text), PInteger(FETODist)); - end; + // TODO multicaret + YPos := FMargins.PTop; + for i := FPages[Num - 1].FirstLine to FPages[Num - 1].LastLine do + begin + if FLineNumbers and (YPos + FLineHeight >= ClipR.Top) then + WriteLineNumber(RT, i + 1, YPos, FontColor); - procedure SplitToken; - var - AStr: UnicodeString; - Last: Integer; - FirstPos: Integer; - TokenEnd: Integer; - begin - Last := TokenPos; - FirstPos := TokenPos; - TokenEnd := TokenPos + Length(Token); - while (LCount < AList.Count) and (TokenEnd > TWrapPos(AList[LCount]).Index) do - begin - AStr := Copy(Text, Last + 1, TWrapPos(AList[LCount]).Index - Last); - Last := TWrapPos(AList[LCount]).Index; - ExpandedPos := FHighlighter.PosToExpandedPos(FirstPos); - ClippedTextOut(FMargins.PLeft + ExpandedPos * FCharWidth, FYPos, AStr); - FirstPos := 0; - LCount := LCount + 1; - FYPos := FYPos + FLineHeight; - end; - AStr := Copy(Text, Last + 1, TokenEnd - Last); - ExpandedPos := FHighlighter.PosToExpandedPos(FirstPos); - ClippedTextOut(FMargins.PLeft + ExpandedPos * FCharWidth, FYPos, AStr); - //Ready for next token: - TokenStart := TokenPos + Length(Token) - Length(AStr); - end; -begin - with FMargins do - ClipRect := Rect(PLeft, PTop, PRight, PBottom); + LineText := FLines[I]; - if FSynOK then - begin - SaveCurrentFont; - FHighlighter.SetRange(FLines.Objects[FLineNumber - 1]); - sLine := Text; - sLineExpandedAtWideGlyphs := ExpandAtWideGlyphs(sLine); - FHighlighter.SetLineExpandedAtWideGlyphs(sLine, sLineExpandedAtWideGlyphs, FLineNumber); - - Token := ''; - TokenStart := 0; - LCount := 0; - while not FHighlighter.GetEol do - begin - Token := FHighlighter.GetToken; - TokenPos := FHighlighter.GetTokenPos; - Attr := FHighlighter.GetTokenAttribute; - if Assigned(Attr) then - begin - FCanvas.Font.Style := Attr.Style; - if FColors then - begin - AColor := Attr.Foreground; - if AColor = clNone then - AColor := FFont.Color; - FCanvas.Font.Color := AColor; - AColor := Attr.Background; - if AColor = clNone then - AColor := FDefaultBG; - FCanvas.Brush.Color := AColor; - end + if LineText = '' then + LayoutRowCount := 1 else begin - FCanvas.Font.Color := FFontColor; - FCanvas.Brush.Color := FDefaultBG; - end; - end - else - begin - FCanvas.Font.Color := FFontColor; - FCanvas.Brush.Color := FDefaultBG; - end; - Handled := False; - if Assigned(AList) then - begin - if (LCount < AList.Count) then - begin - //Split between tokens: - if (TokenPos >= TWrapPos(AList[LCount]).Index) then + if not fSelectedOnly then begin - LCount := LCount + 1; - TokenStart := TokenPos; - FYPos := FYPos + FLineHeight; + iSelStart := 1; + iSelLen := LineText.Length; end else begin - //Split in the middle of a token: - if (TokenPos + Length(Token) > TWrapPos(AList[LCount]).Index) then begin - Handled := True; - SplitToken; - end; + if i = fBlockBegin.Line -1 then + iSelStart := fBlockBegin.Char + else + iSelStart := 1; + if i = fBlockEnd.Line -1 then + iSelLen := fBlockEnd.Char - iSelStart + else + iSelLen := MaxInt; end; - end; - end; - if not Handled then - begin - ExpandedPos := FHighlighter.PosToExpandedPos(TokenPos - TokenStart); - ClippedTextOut(FMargins.PLeft + ExpandedPos * FCharWidth, FYPos, Token); - end; - FHighlighter.Next; - end; - RestoreCurrentFont; - end - else - begin - Lines := TUnicodeStringList.Create; - try - OldWrapPos := 0; - if Assigned(AList) then - for i := 0 to AList.Count - 1 do - begin - WrapPos := TWrapPos(AList[i]).Index; - if i = 0 then - AStr := Copy(Text, 1, WrapPos) - else - AStr := Copy(Text, OldWrapPos + 1, WrapPos - OldWrapPos); - Lines.Add(AStr); - OldWrapPos := WrapPos; - end; - if Length(Text) > 0 then - Lines.Add(Copy(Text, OldWrapPos + 1, MaxInt)); - for i := 0 to Lines.Count - 1 do - begin - ClippedTextOut(FMargins.PLeft, FYPos, Lines[i]); - if i < Lines.Count - 1 then - FYPos := FYPos + FLineHeight; - end; - finally - Lines.Free; - end - end -end; + TextLayout := GetTextLayout(i); -procedure TSynEditPrint.WriteLine(const Text: UnicodeString); -var - StrWidth: Integer; -begin - if FLineNumbers then WriteLineNumber; - StrWidth := TextWidth(FCanvas, Text); - {Note that MaxWidth is calculated, using FTestString found in CalcPages - - else the length is not calculated correctly when prewiewing and the - zoom is different from 0.25,0.5,1,2,4 (as for example 1.20) - WHY??? - } - if Wrap and (StrWidth > FMaxWidth) then - HandleWrap(Text, FMaxWidth) - else - TextOut(Text, nil); - FYPos := FYPos + FLineHeight; -end; + if FSynOK then + begin + FHighlighter.SetRange(FLines.Objects[i]); + FHighlighter.SetLine(LineText, i + 1); + + while not FHighLighter.GetEol do + begin + Token := FHighLighter.GetToken; + TokenPos := FHighLighter.GetTokenPos; + if TokenPos - iSelStart >= iSelLen then Break; + + // Adjust for iSelStart + TokenPos := TokenPos - iSelStart + 2; // TokenPos is zero based + TokenEnd := TokenPos + Token.Length; + + Attr := FHighLighter.GetTokenAttribute; + if (TokenEnd > 1) and Assigned(Attr) then + begin + TokenPos := Max(TokenPos, 1); + TextLayout.SetFontStyle(Attr.Style, TokenPos, TokenEnd - TokenPos); + if FColors then + begin + AColor := Attr.Foreground; + if AColor <> clNone then + TextLayout.SetFontColor(AColor, TokenPos, TokenEnd - TokenPos); + AColor := Attr.Background; + if (AColor <> clNone) and (AColor <> BkgColor) then + begin + TextLayout.IDW.HitTestTextPosition(TokenPos - 1, False, X1, Y1, HitMetrics); + TextLayout.IDW.HitTestTextPosition(TokenEnd - 2, True, X2, Y2, HitMetrics); + + // Word wrap complications - line continues from previous page + if (I = FPages[Num - 1].FirstLine) and (FPages[Num - 1].FirstRow > 1) then + begin + Y1 := Y1 - (FPages[Num - 1].FirstRow - 1) * FLineHeight; + Y2 := Y2 - (FPages[Num - 1].FirstRow - 1) * FLineHeight; + end; + + if Y2 >= 0 then + begin + if YPos + Round(Y1) >= FMargins.PTop + FMaxRowCount * FLineHeight + then + Break; + + RT.FillRectangle(Rect(Round(X1) + FMargins.PLeft, YPos + Round(Y1), + Round(X2) + FMargins.PLeft, YPos + Round(Y2) + FLineHeight), + TSynDWrite.SolidBrush(AColor)); + end; + end; + end; + end; + FHighLighter.Next; + end; + end; -procedure TSynEditPrint.PrintPage(Num: Integer); -//Prints a page -var - i, iEnd: Integer; - iSelStart, iSelLen: Integer; -begin - PrintStatus(psNewPage, Num, FAbort); - if not FAbort then - begin - FCanvas.Brush.Color := Color; - with FMargins do - FCanvas.FillRect(Rect(PLeft, PTop, PRight, PBottom)); - FMargins.InitPage(FCanvas, Num, FPrinterInfo, FLineNumbers, - FLineNumbersInMargin, FLines.Count - 1 + FLineOffset); - FHeader.Print(FCanvas, Num + FPageOffset); - if FPages.Count > 0 then - begin - FYPos := FMargins.PTop; - if Num = FPageCount then - iEnd := FLines.Count - 1 - else - iEnd := TPageLine(FPages[Num]).FirstLine - 1; - for i := TPageLine(FPages[Num - 1]).FirstLine to iEnd do - begin - FLineNumber := i + 1; - if (not FSelectedOnly or ((i >= FBlockBegin.Line - 1) and (i <= FBlockEnd.Line - 1))) then begin - if (not FSelectedOnly or (FSelMode = smLine)) then - WriteLine(Lines[i]) - else + TextLayout.IDW.GetLineMetrics(@LineMetrics, 1, ActualLineCount); + LayoutRowCount := ActualLineCount; // to avoid warnings + + if YPos + LayoutRowCount * FLineHeight >= ClipR.Top then begin - if (FSelMode = smColumn) or (i = FBlockBegin.Line -1) then - iSelStart := FBlockBegin.Char - else - iSelStart := 1; - if (FSelMode = smColumn) or (i = FBlockEnd.Line -1) then - iSelLen := FBlockEnd.Char - iSelStart + if (I = FPages[Num - 1].FirstLine) and (FPages[Num - 1].FirstRow > 1) then + begin + TextLayout.DrawClipped(RT, FMargins.PLeft, + YPos - Pred(FPages[Num - 1].FirstRow) * FLineHeight, + Rect(FMargins.PLeft, YPos, FMargins.PRight, + FMargins.PTop + FMaxRowCount * FLineHeight), FFont.Color); + LayoutRowCount := LayoutRowCount - FPages[Num - 1].FirstRow + 1; + end else if (I = FPages[Num - 1].LastLine) and + (FPages[Num - 1].LastRow < LayoutRowCount) + then + TextLayout.DrawClipped(RT, FMargins.PLeft, YPos, + Rect(FMargins.PLeft, YPos, FMargins.PRight, + YPos + FPages[Num - 1].LastRow * FLineHeight), FFont.Color) else - iSelLen := MaxInt; - WriteLine( Copy( Lines[i], iSelStart, iSelLen ) ); + TextLayout.Draw(RT, FMargins.PLeft, YPos, FFont.Color); end; - PrintLine(i + 1, Num); end; + DoPrintLine(I + 1, Num); + + Inc(YPos, LayoutRowCount * FLineHeight); + // Optimization do not print anything below ClipR + if YPos > ClipR.Bottom then Exit; end; + + FFooter.Print(RT, Num + FPageOffset); end; - FFooter.Print(FCanvas, Num + FPageOffset); end; end; -procedure TSynEditPrint.UpdatePages(ACanvas: TCanvas); -//Update pages (called explicitly by preview component) -begin - FCanvas := ACanvas; - FPrinterInfo.UpdatePrinter; - InitPrint; -end; - -procedure TSynEditPrint.PrintToCanvas(ACanvas: TCanvas; PageNumber: Integer); -//Print to specified canvas. Used by preview component +procedure TSynEditPrint.PrintToCanvas(ACanvas: TCanvas; const RenderRect, + ClipRect: TRect; PageNo: Integer); +// Used by preview component +var + RT: ID2D1DCRenderTarget; + ScaleX, ScaleY: Single; + ClipR: TRect; begin FAbort := False; FPrinting := False; - FCanvas := ACanvas; - PrintPage(PageNumber); + + with PrinterInfo do + begin + // The RenderTarget expects a PPI of 96 + ScaleX := RenderRect.Width / (PhysicalWidth * 96 / XPixPrInch) ; + ScaleY := RenderRect.Height / (PhysicalHeight * 96 / YPixPrInch); + end; + + ClipR := ClipRect; + // Transform ClipR to the Coordinate system of RenderTarget + ClipR.Offset(-RenderRect.Left, -RenderRect.Top); + ClipR := TRect.Create( + ScalePoint(ClipR.TopLeft, 1 / ScaleX, 1 / ScaleY), + ScalePoint(ClipR.BottomRight, 1 / ScaleX, 1 / ScaleY)); + + // Reset so that rendering for printing is not mixed up with Synedit rendering + TSynDWrite.ResetRenderTarget; + RT := TSynDWrite.RenderTarget; + try + RT.BindDC(ACanvas.Handle, RenderRect); + RT.BeginDraw; + try + RT.SetTransform( + TD2DMatrix3X2F.Scale(ScaleX, ScaleY, Point(0, 0))); + + PrintPage(RT, PageNo, ClipR); + finally + RT.EndDraw; + end; + finally + // Reset so that it does not mess up the SynEdit drawing + TSynDWrite.ResetRenderTarget; + end; end; procedure TSynEditPrint.Print; @@ -904,105 +647,159 @@ procedure TSynEditPrint.Print; end; procedure TSynEditPrint.PrintRange(StartPage, EndPage: Integer); -//Prints the pages in the specified range +// Prints the pages in the specified range. It uses as guide the sample app +// https://github.com/microsoft/Windows-classic-samples/tree/main/Samples/D2DPrintingFromDesktopApps var - i, ii: Integer; -begin - if FSelectedOnly and not FSelAvail then + Page, Copy: Integer; + Title, PrinterName: string; + PrintDocumentPackageTarget: IPrintDocumentPackageTarget; + Device: ID2D1Device; + DeviceContext: ID2D1DeviceContext; + PrintControl: ID2D1PrintControl; + CommandList: ID2D1CommandList; + ClipR: TRect; +begin + if fSelectedOnly and not fSelAvail then Exit; FPrinting := True; FAbort := False; - // The next part sets the document title that is used by the printer queue. + // Set the print job title if FDocTitle <> '' then - Printer.Title := FDocTitle + Title := FDocTitle else - Printer.Title := FTitle; - Printer.BeginDoc; - PrintStatus(psBegin, StartPage, FAbort); - UpdatePages(Printer.Canvas); + Title := FTitle; + if Title = '' then + Title := 'SynEdit document'; - for ii:=1 to Copies do - begin - i := StartPage; - if EndPage < 0 then - EndPage := FPageCount; - while (i <= EndPage) and (not FAbort) do begin - PrintPage(i); - if ((i < EndPage) or (ii no clipping + ClipR := Rect(0, 0, + MulDiv(FPrinterInfo.PhysicalWidth, 96, FPrinterInfo.XPixPrInch), + MulDiv(FPrinterInfo.PhysicalHeight, 96, FPrinterInfo.YPixPrInch)); + + CheckOSError(TSynDWrite.PrintDocumentPackageTargetFactory.CreateDocumentPackageTargetForPrintJob( + PChar(PrinterName), // printer name + PChar(Title), // job name + nil, // job output stream; when nullptr, send to printer + nil, // job print ticket + PrintDocumentPackageTarget // result IPrintDocumentPackageTarget object + )); + + // Reset so that rendering for printing is not mixed up with Synedit rendering + TSynDWrite.ResetRenderTarget; + try + CheckOSError(TSynDWrite.RenderTarget.BindDC(GetDC(0), TRect.Empty)); + DeviceContext := TSynDWrite.RenderTarget as ID2D1DeviceContext; + + DeviceContext.GetDevice(Device); + CheckOSError(Device.CreatePrintControl( + TSynDWrite.ImagingFactory, + PrintDocumentPackageTarget, + nil, + PrintControl)); + + for Copy := 1 to Copies do + begin + Page := StartPage; + if EndPage < 0 then + EndPage := FPages.Count; + while (Page <= EndPage) and (not FAbort) do begin + CheckOSError(DeviceContext.CreateCommandList(CommandList)); + DeviceContext.SetTarget(CommandList); + DeviceContext.BeginDraw; + try + PrintPage(DeviceContext, Page, ClipR); + finally + DeviceContext.EndDraw; + end; + CheckOSError(CommandList.Close); + + // We have rendered at 96 PPI. The D2D printing system scales + // appropriately for the selected printer + CheckOSError(PrintControl.AddPage(commandList, + D2D1SizeF(ClipR.Width, ClipR.Height), nil)); + Page := Page + 1; + end; end; + if not FAbort then + DoPrintStatus(psEnd, EndPage, FAbort); + PrintControl.Close; + FPrinting := False; + finally + // Reset so that it does not mess up the SynEdit drawing + TSynDWrite.ResetRenderTarget; end; - if not FAbort then - PrintStatus(psEnd, EndPage, FAbort); - Printer.EndDoc; - FPrinting := False; end; -procedure TSynEditPrint.PrintLine(LineNumber, PageNumber: Integer); +procedure TSynEditPrint.DoPrintLine(LineNumber, PageNumber: Integer); //Fires the OnPrintLine event begin if Assigned(FOnPrintLine) then FOnPrintLine(Self, LineNumber, PageNumber); end; -procedure TSynEditPrint.PrintStatus(Status: TSynPrintStatus; +procedure TSynEditPrint.DoPrintStatus(Status: TSynPrintStatus; PageNumber: Integer; var Abort: Boolean); //Fires the OnPrintStatus event begin Abort := False; - if Assigned(FOnPrintStatus) then + if FPrinting and Assigned(FOnPrintStatus) then FOnPrintStatus(Self, Status, PageNumber, Abort); - if Abort then begin - if FPrinting then - Printer.Abort; - end; + // if Abort then printing will stop at the earliest opportunity end; function TSynEditPrint.GetPageCount: Integer; {Returns total page count. If pages hasn't been counted before, - then a UpdatePages is called with a temporary canvas} -var - TmpCanvas: TCanvas; - DC: HDC; + then InitPrint is called which calculates pages} begin - Result := 0; if FPagesCounted then - Result := FPageCount + Result := FPages.Count else begin - TmpCanvas := TCanvas.Create; - try - DC := GetDC(0); - try - if DC <> 0 then - begin - TmpCanvas.Handle := DC; - UpdatePages(TmpCanvas); - TmpCanvas.Handle := 0; - Result := FPageCount; - FPagesCounted := True; - end; - finally - ReleaseDC(0, DC); - end; - finally - TmpCanvas.Free; - end; + InitPrint; // Calls CalcPages; + Result := FPages.Count; + end; +end; + +function TSynEditPrint.GetTextLayout(const Line: Integer): TSynTextLayout; +// TODO multicaret +var + iSelStart, iSelLen: Integer; + S: string; +begin + if not fSelectedOnly then + S := Lines[Line] + else + begin + if Line = fBlockBegin.Line -1 then + iSelStart := fBlockBegin.Char + else + iSelStart := 1; + if Line = fBlockEnd.Line -1 then + iSelLen := fBlockEnd.Char - iSelStart + else + iSelLen := MaxInt; + S := Copy(Lines[Line], iSelStart, iSelLen); end; + Result.Create(FSynTextFormat, PChar(S), S.Length, FMaxWidth, MaxInt, Wrap, 1); end; procedure TSynEditPrint.SetSynEdit(const Value: TCustomSynEdit); begin -// Lines := Value.Lines; HighLighter := Value.Highlighter; Font := Value.Font; FTabWidth := Value.TabWidth; Lines := Value.Lines; - FSelAvail := Value.SelAvail; - FBlockBegin := Value.BlockBegin; - FBlockEnd := Value.BlockEnd; - FSelMode := Value.SelectionMode; + fSelAvail := Value.SelAvail; + fBlockBegin := Value.BlockBegin; + fBlockEnd := Value.BlockEnd; end; procedure TSynEditPrint.LoadFromStream(AStream: TStream); diff --git a/Ext/SynEdit/Source/SynEditPrintHeaderFooter.pas b/Ext/SynEdit/Source/SynEditPrintHeaderFooter.pas index 42c669e..2d81a40 100644 --- a/Ext/SynEdit/Source/SynEditPrintHeaderFooter.pas +++ b/Ext/SynEdit/Source/SynEditPrintHeaderFooter.pas @@ -27,13 +27,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditPrintHeaderFooter.pas,v 1.10.2.7 2008/09/23 14:02:08 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} @@ -61,7 +54,7 @@ MirrorPosition : Mirror position of left/right aligned THeaderFooterItem's Can be used when printing 2-sided. Run-time methods: - function Add(Text: UnicodeString; Font: TFont; + function Add(Text: string; Font: TFont; Alignment: TAlignment; LineNumber: Integer) : Integer; Add a THeaderFooterItem. If Font is nil or not specified then DefaultFont @@ -74,29 +67,26 @@ $TIME$ : Print the time $DATETIME$ : Print the date and then the time $TIMEDATE$ : Print the time and then the date - procedure Delete(Index : Integer); + procedure Delete(Index: Integer); Delete THeaderFooterItem with index Index. procedure Clear; Clear all THeaderFooterItems. - function Count : Integer; + function Count: Integer; Returns number of THeaderFooterItems. - function Get(Index : Integer) : THeaderFooterItem; + function Get(Index: Integer): THeaderFooterItem; Returns THeaderFooterItem with Index. - procedure SetPixPrInch(Value : Integer); + procedure SetPixPrInch(Value: Integer); Corrects the PixPerInch property of fonts. Used internally by TSynEditPrint. - procedure InitPrint(ACanvas : TCanvas;NumPages : Integer; Title : UnicodeString; - Margins : TSynEditPrintMargins); + procedure InitPrint Prepares the header or footer for printing. Used internally by TSynEditPrint. - procedure Print(ACanvas : TCanvas; PageNum : Integer = 0); + procedure Print Prints the header or footer. Used internally by TSynEditPrint. -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITPRINTHEADERFOOTER} unit SynEditPrintHeaderFooter; -{$ENDIF} {$M+} {$I SynEdit.inc} @@ -104,16 +94,14 @@ interface uses - {$IFDEF SYN_COMPILER_17_UP} - UITypes, - {$ENDIF} - Windows, + Winapi.Windows, + Winapi.D2D1, + Vcl.Graphics, SynEditPrintTypes, SynEditPrintMargins, SynUnicode, - Graphics, - Classes, - SysUtils; + System.Classes, + System.SysUtils; type //An item in a header or footer. An item has a text,Font,LineNumber and @@ -121,41 +109,33 @@ interface //fonts). THeaderFooterItem = class private - FText: UnicodeString; + FText: string; FFont: TFont; FLineNumber: Integer; FAlignment: TAlignment; {Used to store the original Index when the item was added - the index might change when the list is sorted} FIndex: Integer; - function GetAsString: UnicodeString; - procedure SetAsString(const Value: UnicodeString); + function GetAsString: string; + procedure SetAsString(const Value: string); procedure SetFont(const Value: TFont); public constructor Create; destructor Destroy; override; function GetText(NumPages, PageNum: Integer; Roman: Boolean; - Title, ATime, ADate: UnicodeString): UnicodeString; + Title, ATime, ADate: string): string; procedure LoadFromStream(AStream: TStream); procedure SaveToStream(AStream: TStream); public property Alignment: TAlignment read FAlignment write FAlignment; - property AsString: UnicodeString read GetAsString write SetAsString; + property AsString: string read GetAsString write SetAsString; property Font: TFont read FFont write SetFont; property LineNumber: Integer read FLineNumber write FLineNumber; - property Text: UnicodeString read FText write FText; + property Text: string read FText write FText; end; THeaderFooterType = (hftHeader, hftFooter); - //Used internally to calculate line height and font-base-line for header and - //footer - TLineInfo = class - public - LineHeight: Integer; - MaxBaseDist: Integer; - end; - //The header/footer class THeaderFooter = class(TPersistent) private @@ -165,41 +145,37 @@ THeaderFooter = class(TPersistent) FLineColor: TColor; FItems: TList; FDefaultFont: TFont; - FDate, FTime: UnicodeString; + FDate, FTime: string; FNumPages: Integer; - FTitle: UnicodeString; + FTitle: string; FMargins: TSynEditPrintMargins; FFrameHeight: Integer; - FOldPen: TPen; - FOldBrush: TBrush; - FOldFont: TFont; FRomanNumbers: Boolean; - FLineInfo: TList; + FLineHeights: TArray; FLineCount: Integer; FMirrorPosition: Boolean; + FPPI: Integer; procedure SetDefaultFont(const Value: TFont); - procedure DrawFrame(ACanvas: TCanvas); - procedure CalcHeight(ACanvas: TCanvas); - procedure SaveFontPenBrush(ACanvas: TCanvas); - procedure RestoreFontPenBrush(ACanvas: TCanvas); - function GetAsString: UnicodeString; - procedure SetAsString(const Value: UnicodeString); + procedure DrawFrame(RT: ID2D1RenderTarget); + procedure CalcHeight; + function GetAsString: string; + procedure SetAsString(const Value: string); public constructor Create; destructor Destroy; override; - function Add(Text: UnicodeString; Font: TFont; Alignment: TAlignment; + function Add(Text: string; Font: TFont; Alignment: TAlignment; LineNumber: Integer): Integer; procedure Delete(Index: Integer); procedure Clear; function Count: Integer; function Get(Index: Integer): THeaderFooterItem; procedure SetPixPrInch(Value: Integer); - procedure InitPrint(ACanvas: TCanvas; NumPages: Integer; Title: UnicodeString; - Margins: TSynEditPrintMargins); - procedure Print(ACanvas: TCanvas; PageNum: Integer); + procedure InitPrint(NumPages: Integer; Title: string; Margins: + TSynEditPrintMargins); + procedure Print(RT: ID2D1RenderTarget; PageNum: Integer); procedure Assign(Source: TPersistent); override; procedure FixLines; - property AsString: UnicodeString read GetAsString write SetAsString; + property AsString: string read GetAsString write SetAsString; procedure LoadFromStream(AStream: TStream); procedure SaveToStream(AStream: TStream); published @@ -227,20 +203,17 @@ TFooter = class(THeaderFooter) constructor Create; end; - {$IFNDEF SYN_COMPILER_3_UP} - TFontCharSet = 0..255; - {$ENDIF} - implementation uses -{$IFDEF SYN_COMPILER_4_UP} - Math, -{$ENDIF} + System.Types, + System.UITypes, + System.Math, + SynDWrite, SynEditMiscProcs; // Helper routine for AsString processing. -function GetFirstEl(var Value: UnicodeString; Delim: WideChar): UnicodeString; +function GetFirstEl(var Value: string; Delim: WideChar): string; var p: Integer; begin @@ -258,6 +231,7 @@ constructor THeaderFooterItem.Create; begin inherited; FFont := TFont.Create; + FFont.PixelsPerInch := 96; end; destructor THeaderFooterItem.Destroy; @@ -268,15 +242,11 @@ destructor THeaderFooterItem.Destroy; // Returns string representation of THeaderFooterItem to alleviate storing // items into external storage (registry, ini file). -function THeaderFooterItem.GetAsString: UnicodeString; +function THeaderFooterItem.GetAsString: string; begin Result := EncodeString(FText) + '/' + -{$IFDEF SYN_COMPILER_3_UP} IntToStr(FFont.Charset) + '/' + -{$ELSE} - IntToStr(DEFAULT_CHARSET)+'/' + -{$ENDIF} IntToStr(FFont.Color) + '/' + IntToStr(FFont.Height) + '/' + EncodeString(FFont.Name) + '/' + @@ -292,12 +262,12 @@ function THeaderFooterItem.GetAsString: UnicodeString; { This is basically copied from original SynEditPrint.pas. Returns the header/footer text with macros expanded } function THeaderFooterItem.GetText(NumPages, PageNum: Integer; - Roman: Boolean; Title, ATime, ADate: UnicodeString): UnicodeString; + Roman: Boolean; Title, ATime, ADate: string): string; var Len, Start, Run: Integer; - AStr: UnicodeString; + AStr: string; - procedure DoAppend(AText: UnicodeString); + procedure DoAppend(AText: string); begin Result := Result + AText; end; @@ -311,10 +281,10 @@ function THeaderFooterItem.GetText(NumPages, PageNum: Integer; end; function TryExecuteMacro: Boolean; var - Macro: UnicodeString; + Macro: string; begin Result := True; - Macro := SynWideUpperCase(Copy(FText, Start, Run - Start + 1)); + Macro := System.SysUtils.AnsiUpperCase(Copy(FText, Start, Run - Start + 1)); if Macro = '$PAGENUM$' then begin if Roman then @@ -362,7 +332,7 @@ function THeaderFooterItem.GetText(NumPages, PageNum: Integer; begin Result := ''; AStr := FText; - if WideTrim(AStr) = '' then + if Trim(AStr) = '' then Exit; // parse the line Len := Length(AStr); @@ -448,9 +418,7 @@ procedure THeaderFooterItem.LoadFromStream(AStream: TStream); Read(aPitch, sizeof(aPitch)); Read(aSize, sizeof(aSize)); Read(aStyle, sizeof(aStyle)); - {$IFDEF SYN_COMPILER_3_UP} FFont.Charset := aCharset; - {$ENDIF} FFont.Color := aColor; FFont.Height := aHeight; FFont.Name := aName; @@ -479,11 +447,7 @@ procedure THeaderFooterItem.SaveToStream(AStream: TStream); Write(PWideChar(FText)^, aLen * sizeof(WideChar)); Write(FLineNumber, sizeof(FLineNumber)); // font - {$IFDEF SYN_COMPILER_3_UP} aCharset := FFont.Charset; - {$ELSE} - aCharset := DEFAULT_CHARSET; - {$ENDIF} aColor := FFont.Color; aHeight := FFont.Height; aName := FFont.Name; @@ -495,11 +459,7 @@ procedure THeaderFooterItem.SaveToStream(AStream: TStream); Write(aHeight, SizeOf(aHeight)); aLen := Length(aName); Write(aLen, SizeOf(aLen)); - {$IFDEF SYN_COMPILER_2} // In D2 TFontName is a ShortString - Write(PAnsiChar(@aName[1])^, aLen); // D2 cannot convert ShortStrings to PAnsiChar - {$ELSE} Write(PAnsiChar(AnsiString(aName))^, aLen); - {$ENDIF} Write(aPitch, SizeOf(aPitch)); Write(aSize, SizeOf(aSize)); Write(aStyle, SizeOf(aStyle)); @@ -507,18 +467,14 @@ procedure THeaderFooterItem.SaveToStream(AStream: TStream); end; end; -procedure THeaderFooterItem.SetAsString(const Value: UnicodeString); +procedure THeaderFooterItem.SetAsString(const Value: string); var - s: UnicodeString; + s: string; sty: TFontStyles; begin s := Value; FText := DecodeString(GetFirstEl(s, '/')); -{$IFDEF SYN_COMPILER_3_UP} FFont.Charset := StrToIntDef(GetFirstEl(s, '/'), 0); -{$ELSE} - GetFirstEl(s, '/'); -{$ENDIF} FFont.Color := StrToIntDef(GetFirstEl(s, '/'), 0); FFont.Height := StrToIntDef(GetFirstEl(s, '/'), 0); FFont.Name := DecodeString(GetFirstEl(s, '/')); @@ -546,37 +502,27 @@ constructor THeaderFooter.Create; FLineColor := clBlack; FItems := TList.Create; FDefaultFont := TFont.Create; - FOldPen := TPen.Create; - FOldBrush := TBrush.Create; - FOldFont := TFont.Create; FRomanNumbers := False; FMirrorPosition := False; - FLineInfo := TList.Create; + FPPI := 96; with FDefaultFont do begin Name := 'Arial'; - Size := 10; Color := clBlack; + PixelsPerInch := 96; + Size := 10; end; end; destructor THeaderFooter.Destroy; -var - i: Integer; begin Clear; FItems.Free; FDefaultFont.Free; - FOldPen.Free; - FOldBrush.Free; - FOldFont.Free; - for i := 0 to FLineInfo.Count - 1 do - TLineInfo(FLineInfo[i]).Free; - FLineInfo.Free; inherited; end; -function THeaderFooter.Add(Text: UnicodeString; Font: TFont; +function THeaderFooter.Add(Text: string; Font: TFont; Alignment: TAlignment; LineNumber: Integer): Integer; var AItem: THeaderFooterItem; @@ -626,11 +572,8 @@ procedure THeaderFooter.SetDefaultFont(const Value: TFont); procedure THeaderFooter.FixLines; var i, CurLine: Integer; - LineInfo: TLineInfo; begin - for i := 0 to FLineInfo.Count - 1 do - TLineInfo(FLineInfo[i]).Free; - FLineInfo.Clear; + SetLength(FLineHeights, 0); CurLine := 0; FLineCount := 0; for i := 0 to FItems.Count - 1 do @@ -638,22 +581,21 @@ procedure THeaderFooter.FixLines; if THeaderFooterItem(FItems[i]).LineNumber <> CurLine then begin CurLine := THeaderFooterItem(FItems[i]).LineNumber; - FLineCount := FLineCount + 1; - LineInfo := TLineInfo.Create; - FLineInfo.Add(LineInfo); + Inc(FLineCount); end; THeaderFooterItem(FItems[i]).LineNumber := FLineCount; end; + SetLength(FLineHeights, FLineCount); end; -{ Calculates the hight of the header/footer, finds the line height for each line +{ Calculates the height of the header/footer, finds the line height for each line and calculates the font baseline where text is to be written } -procedure THeaderFooter.CalcHeight(ACanvas: TCanvas); +procedure THeaderFooter.CalcHeight; var - i, CurLine: Integer; + I, CurLine: Integer; AItem: THeaderFooterItem; FOrgHeight: Integer; - TextMetric: TTextMetric; + TextFormat: TSynTextFormat; begin FFrameHeight := -1; if FItems.Count <= 0 then Exit; @@ -661,22 +603,18 @@ procedure THeaderFooter.CalcHeight(ACanvas: TCanvas); CurLine := 1; FFrameHeight := 0; FOrgHeight := FFrameHeight; - for i := 0 to FItems.Count - 1 do + for I := 0 to FItems.Count - 1 do begin - AItem := THeaderFooterItem(FItems[i]); + AItem := THeaderFooterItem(FItems[I]); if AItem.LineNumber <> CurLine then begin CurLine := AItem.LineNumber; FOrgHeight := FFrameHeight; end; - ACanvas.Font.Assign(AItem.Font); - GetTextMetrics(ACanvas.Handle, TextMetric); - with TLineInfo(FLineInfo[CurLine - 1]), TextMetric do - begin - LineHeight := Max(LineHeight, TextHeight(ACanvas, 'W')); - MaxBaseDist := Max(MaxBaseDist, tmHeight - tmDescent); - end; - FFrameHeight := Max(FFrameHeight, FOrgHeight + TextHeight(ACanvas, 'W')); + + TextFormat:= TSynTextFormat.Create(AItem.Font); + FLineHeights[CurLine - 1] := Max(FLineHeights[CurLine - 1], TextFormat.LineHeight); + FFrameHeight := Max(FFrameHeight, FOrgHeight + FLineHeights[CurLine - 1]); end; FFrameHeight := FFrameHeight + 2 * FMargins.PHFInternalMargin; end; @@ -694,6 +632,7 @@ procedure THeaderFooter.SetPixPrInch(Value: Integer); i, TmpSize: Integer; AFont: TFont; begin + FPPI := Value; for i := 0 to FItems.Count - 1 do begin AFont := THeaderFooterItem(FItems[i]).Font; @@ -703,10 +642,9 @@ procedure THeaderFooter.SetPixPrInch(Value: Integer); end; end; -procedure THeaderFooter.InitPrint(ACanvas: TCanvas; NumPages: Integer; Title: UnicodeString; +procedure THeaderFooter.InitPrint(NumPages: Integer; Title: string; Margins: TSynEditPrintMargins); begin - SaveFontPenBrush(ACanvas); FDate := DateToStr(Now); FTime := TimeToStr(Now); FNumPages := NumPages; @@ -714,71 +652,52 @@ procedure THeaderFooter.InitPrint(ACanvas: TCanvas; NumPages: Integer; Title: Un FTitle := Title; FItems.Sort(CompareItems); FixLines; - CalcHeight(ACanvas); - RestoreFontPenBrush(ACanvas); -end; - -procedure THeaderFooter.SaveFontPenBrush(ACanvas: TCanvas); -begin - FOldFont.Assign(ACanvas.Font); - FOldPen.Assign(ACanvas.Pen); - FOldBrush.Assign(ACanvas.Brush); -end; - -procedure THeaderFooter.RestoreFontPenBrush(ACanvas: TCanvas); -begin - ACanvas.Font.Assign(FOldFont); - ACanvas.Pen.Assign(FOldPen); - ACanvas.Brush.Assign(FOldBrush); + CalcHeight; end; -procedure THeaderFooter.DrawFrame(ACanvas: TCanvas); +procedure THeaderFooter.DrawFrame(RT: ID2D1RenderTarget); //Draws frame around header/footer +var + BoxRect: TD2D1RectF; begin if (FrameTypes = []) then Exit; - with ACanvas, FMargins do begin - Pen.Color := LineColor; - Brush.Color := ShadedColor; - if ftShaded in FrameTypes then - Brush.Style := bsSolid + with FMargins do begin + if FType = hftHeader then + BoxRect := Rect(PLeft, PHeader - FFrameHeight, PRight, PHeader) else - Brush.Style := bsClear; + BoxRect := Rect(PLeft, PFooter, PRight, PFooter + FFrameHeight); + + if ftShaded in FrameTypes then + RT.FillRectangle(BoxRect, TSynDWrite.SolidBrush(ShadedColor)); if ftBox in FrameTypes then - Pen.Style := psSolid - else - Pen.Style := psClear; - if FrameTypes * [ftBox, ftShaded] <> [] then begin + RT.DrawRectangle(BoxRect, TSynDWrite.SolidBrush(LineColor), FPPI/96); + if ftLine in FrameTypes then begin if FType = hftHeader then - Rectangle(PLeft, PHeader - FFrameHeight, PRight, PHeader) + RT.DrawLine(Point(PLeft, PHeader), Point(PRight, PHeader), + TSynDWrite.SolidBrush(LineColor), FPPI/96) else - Rectangle(PLeft, PFooter, PRight, PFooter + FFrameHeight); - end; - if ftLine in FrameTypes then begin - Pen.Style := psSolid; - if FType = hftHeader then begin - MoveTo(PLeft, PHeader); - LineTo(PRight, PHeader); - end - else begin - MoveTo(PLeft, PFooter); - LineTo(PRight, PFooter); - end + RT.DrawLine(Point(PLeft, PFooter), Point(PRight, PFooter), + TSynDWrite.SolidBrush(LineColor), FPPI/96); end; end; end; -procedure THeaderFooter.Print(ACanvas: TCanvas; PageNum: Integer); +procedure THeaderFooter.Print(RT: ID2D1RenderTarget; PageNum: Integer); +const + DWriteTextAlignment: array[TAlignment] of DWRITE_TEXT_ALIGNMENT = + (DWRITE_TEXT_ALIGNMENT_LEADING, DWRITE_TEXT_ALIGNMENT_TRAILING, DWRITE_TEXT_ALIGNMENT_CENTER); var - i, X, Y, CurLine: Integer; - AStr: UnicodeString; + I, Y, CurLine: Integer; + AStr: string; AItem: THeaderFooterItem; - OldAlign: UINT; TheAlignment: TAlignment; + TextFormat: TSynTextFormat; + Layout: TSynTextLayout; begin if (FFrameHeight <= 0) then Exit; // No header/footer - SaveFontPenBrush(ACanvas); - DrawFrame(ACanvas); - ACanvas.Brush.Style := bsClear; + + DrawFrame(RT); + if FType = hftHeader then Y := FMargins.PHeader - FFrameHeight else @@ -786,17 +705,24 @@ procedure THeaderFooter.Print(ACanvas: TCanvas; PageNum: Integer); Y := Y + FMargins.PHFInternalMargin; // Add the specified internal margin CurLine := 1; - for i := 0 to FItems.Count - 1 do + for I := 0 to FItems.Count - 1 do begin - AItem := THeaderFooterItem(FItems[i]); - ACanvas.Font := AItem.Font; + AItem := THeaderFooterItem(FItems[I]); + + TextFormat := TSynTextFormat.Create(AItem.Font); if AItem.LineNumber <> CurLine then begin - Y := Y + TLineInfo(FLineInfo[CurLine - 1]).LineHeight; + Y := Y + FLineHeights[CurLine - 1]; CurLine := AItem.LineNumber; end; + AStr := AItem.GetText(FNumPages, PageNum, FRomanNumbers, FTitle, FTime, FDate); - //Find the alignment of the header/footer item - check for MirrorPosition + + Layout := TSynTextLayout.Create(TextFormat, PChar(AStr), AStr.Length, + FMargins.PRightHFTextIndent - FMargins.PLeftHFTextIndent, + FLineHeights[CurLine - 1]); + Layout.SetParagraphAlignment(DWRITE_PARAGRAPH_ALIGNMENT_FAR); + //Find the alignment of the header/footer item - check for MirrorPosition TheAlignment := AItem.Alignment; if MirrorPosition and ((PageNum mod 2) = 0) then begin @@ -805,21 +731,10 @@ procedure THeaderFooter.Print(ACanvas: TCanvas; PageNum: Integer); taLeftJustify: TheAlignment := taRightJustify; end; end; - //Find X-position of text - with FMargins do begin - X := PLeftHFTextIndent; - case TheAlignment of - taRightJustify: X := PRightHFTextIndent - TextWidth(ACanvas, AStr); - taCenter: X := (PLeftHFTextIndent + PRightHFTextIndent - TextWidth(ACanvas, AStr)) div 2; - end; - end; - {Aligning at base line - Fonts can have different size in headers and footers} - OldAlign := SetTextAlign(ACanvas.Handle, TA_BASELINE); - ExtTextOutW(ACanvas.Handle, X, Y + TLineInfo(FLineInfo[CurLine - 1]).MaxBaseDist, - 0, nil, PWideChar(AStr), Length(AStr), nil); - SetTextAlign(ACanvas.Handle, OldAlign); + Layout.SetTextAlignment(DWriteTextAlignment[TheAlignment]); + + Layout.Draw(RT, FMargins.PLeftHFTextIndent, Y, AItem.Font.Color); end; - RestoreFontPenBrush(ACanvas); end; procedure THeaderFooter.Assign(Source: TPersistent); @@ -855,22 +770,22 @@ function THeaderFooter.Get(Index: Integer): THeaderFooterItem; Result := THeaderFooterItem(FItems[Index]); end; -function THeaderFooter.GetAsString: UnicodeString; +function THeaderFooter.GetAsString: string; var - i: Integer; + I: Integer; begin FixLines; Result := ''; - for i := 0 to FItems.Count - 1 do begin + for I := 0 to FItems.Count - 1 do begin if Result <> '' then Result := Result + '/'; - Result := Result + EncodeString(THeaderFooterItem(FItems[i]).AsString); + Result := Result + EncodeString(THeaderFooterItem(FItems[I]).AsString); end; //for end; -procedure THeaderFooter.SetAsString(const Value: UnicodeString); +procedure THeaderFooter.SetAsString(const Value: string); var item: THeaderFooterItem; - s: UnicodeString; + s: string; begin Clear; item := THeaderFooterItem.Create; @@ -888,7 +803,7 @@ procedure THeaderFooter.SetAsString(const Value: UnicodeString); procedure THeaderFooter.LoadFromStream(AStream: TStream); var - Num, i: Integer; + Num, I: Integer; aCharset: TFontCharset; aColor: TColor; aHeight: Integer; @@ -922,9 +837,7 @@ procedure THeaderFooter.LoadFromStream(AStream: TStream); Read(aPitch, SizeOf(aPitch)); Read(aSize, SizeOf(aSize)); Read(aStyle, SizeOf(aStyle)); - {$IFDEF SYN_COMPILER_3_UP} FDefaultFont.Charset := aCharset; - {$ENDIF} FDefaultFont.Color := aColor; FDefaultFont.Height := aHeight; FDefaultFont.Name := aName; @@ -936,8 +849,8 @@ procedure THeaderFooter.LoadFromStream(AStream: TStream); while Num > 0 do begin // load headerfooter items from stream - i := Add('', nil, taLeftJustify, 1); - Get(i).LoadFromStream(AStream); + I := Add('', nil, taLeftJustify, 1); + Get(I).LoadFromStream(AStream); Dec(Num); end; end; @@ -945,7 +858,7 @@ procedure THeaderFooter.LoadFromStream(AStream: TStream); procedure THeaderFooter.SaveToStream(AStream: TStream); var - i, Num: Integer; + I, Num: Integer; aCharset: TFontCharset; aColor: TColor; aHeight: Integer; @@ -953,7 +866,7 @@ procedure THeaderFooter.SaveToStream(AStream: TStream); aPitch: TFontPitch; aSize: Integer; aStyle: TFontStyles; - aLen : Integer; + aLen: Integer; begin with AStream do begin // write the header/footer properties first @@ -963,11 +876,7 @@ procedure THeaderFooter.SaveToStream(AStream: TStream); Write(FRomanNumbers, SizeOf(FRomanNumbers)); Write(FMirrorPosition, SizeOf(FMirrorPosition)); // font - {$IFDEF SYN_COMPILER_3_UP} aCharset := FDefaultFont.Charset; - {$ELSE} - aCharSet := DEFAULT_CHARSET; - {$ENDIF} aColor := FDefaultFont.Color; aHeight := FDefaultFont.Height; aName := FDefaultFont.Name; @@ -979,11 +888,7 @@ procedure THeaderFooter.SaveToStream(AStream: TStream); Write(aHeight, SizeOf(aHeight)); aLen := Length(aName); Write(aLen, SizeOf(aLen)); - {$IFDEF SYN_COMPILER_2} // In D2 TFontName is a ShortString - Write(PAnsiChar(@aName[1])^, Length(aName)); // D2 cannot convert ShortStrings to PAnsiChar - {$ELSE} Write(PAnsiChar(AnsiString(aName))^, Length(aName)); - {$ENDIF} Write(aPitch, SizeOf(aPitch)); Write(aSize, SizeOf(aSize)); Write(aStyle, SizeOf(aStyle)); @@ -991,8 +896,8 @@ procedure THeaderFooter.SaveToStream(AStream: TStream); // now write the items Num := Count; Write(Num, SizeOf(Num)); - for i := 0 to Num - 1 do - Get(i).SaveToStream(AStream); + for I := 0 to Num - 1 do + Get(I).SaveToStream(AStream); end; end; diff --git a/Ext/SynEdit/Source/SynEditPrintMargins.pas b/Ext/SynEdit/Source/SynEditPrintMargins.pas index 0e8faaa..05ce81f 100644 --- a/Ext/SynEdit/Source/SynEditPrintMargins.pas +++ b/Ext/SynEdit/Source/SynEditPrintMargins.pas @@ -25,13 +25,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditPrintMargins.pas,v 1.5.2.2 2006/05/21 11:59:34 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} @@ -82,9 +75,7 @@ -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITPRINTMARGINS} unit SynEditPrintMargins; -{$ENDIF} {$M+} {$I SynEdit.inc } @@ -92,12 +83,14 @@ interface uses - Graphics, + Winapi.Windows, + Vcl.Graphics, SynEditPrintTypes, SynEditPrinterInfo, SynUnicode, - Classes, - SysUtils; + SynDWrite, + System.Classes, + System.SysUtils; type //Margins class - sorting out dimensions of printable area @@ -165,9 +158,9 @@ TSynEditPrintMargins = class(TPersistent) PHFInternalMargin: Integer; // Internal margin in device units (pixels) PGutter: Integer; // Binding gutter in device units (pixels) constructor Create; - procedure InitPage(ACanvas: TCanvas; PageNum: Integer; - PrinterInfo: TSynEditPrinterInfo; LineNumbers, - LineNumbersInMargin: Boolean; MaxLineNum: Integer); + procedure InitPage(TextFormat: TSynTextFormat; PageNum: Integer; PrinterInfo: + TSynEditPrinterInfo; LineNumbers, LineNumbersInMargin: Boolean; MaxLineNum: + Integer); procedure Assign(Source: TPersistent); override; procedure LoadFromStream(AStream: TStream); procedure SaveToStream(AStream: TStream); @@ -340,30 +333,38 @@ procedure TSynEditPrintMargins.SetHFInternalMargin(const Value: Double); // ----------------------------------------------------------------------------- // Called by TSynEditPrint class to initialize margins -procedure TSynEditPrintMargins.InitPage(ACanvas: TCanvas; PageNum: Integer; +procedure TSynEditPrintMargins.InitPage(TextFormat: TSynTextFormat; PageNum: Integer; PrinterInfo: TSynEditPrinterInfo; LineNumbers, LineNumbersInMargin: Boolean; MaxLineNum: Integer); -//Calculate the P... values +// Calculate the P... values +// Values correspond to 96 PPI, since we rendering at that resoultion +var + Layout: TSynTextLayout; + Str: string; begin if FMirrorMargins and ((PageNum mod 2) = 0) then begin - PLeft := PrinterInfo.PixFromLeft(FRight); - PRight := PrinterInfo.PrintableWidth - PrinterInfo.PixFromRight(FLeft + FGutter); + PLeft := MulDiv(PrinterInfo.PixFromLeft(FRight), 96, PrinterInfo.XPixPrInch); + PRight := MulDiv(PrinterInfo.PrintableWidth - PrinterInfo.PixFromRight(FLeft + FGutter), 96, PrinterInfo.XPixPrInch); end else begin - PLeft := PrinterInfo.PixFromLeft(FLeft + FGutter); - PRight := PrinterInfo.PrintableWidth - PrinterInfo.PixFromRight(FRight); + PLeft := MulDiv(PrinterInfo.PixFromLeft(FLeft + FGutter), 96, PrinterInfo.XPixPrInch); + PRight := MulDiv(PrinterInfo.PrintableWidth - PrinterInfo.PixFromRight(FRight), 96, PrinterInfo.XPixPrInch); end; if LineNumbers and (not LineNumbersInMargin) then - PLeft := PLeft + TextWidth(ACanvas, IntToStr(MaxLineNum) + ': '); - PTop := PrinterInfo.PixFromTop(FTop); - PBottom := PrinterInfo.PrintableHeight - PrinterInfo.PixFromBottom(FBottom); - PHeader := PrinterInfo.PixFromTop(FHeader); - PFooter := PrinterInfo.PrintableHeight - PrinterInfo.PixFromBottom(FFooter); - PHFInternalMargin := Round(PrinterInfo.YPixPrmm * FHFInternalMargin); - PGutter := Round(PrinterInfo.XPixPrmm * FGutter); - PRightHFTextIndent := PRight - Round(PrinterInfo.XPixPrmm * FRightHFTextIndent); - PLeftHFTextIndent := PLeft + Round(PrinterInfo.XPixPrmm * FLeftHFTextIndent); + begin + Str:= IntToStr(MaxLineNum) + ': '; + Layout := TSynTextLayout.Create(TextFormat, PChar(Str), Str.Length); + PLeft := PLeft + Round(Layout.TextMetrics.widthIncludingTrailingWhitespace); + end; + PTop := MulDiv(PrinterInfo.PixFromTop(FTop), 96, PrinterInfo.YPixPrInch); + PBottom := MulDiv(PrinterInfo.PrintableHeight - PrinterInfo.PixFromBottom(FBottom), 96, PrinterInfo.YPixPrInch); + PHeader := MulDiv(PrinterInfo.PixFromTop(FHeader), 96, PrinterInfo.YPixPrInch); + PFooter := MulDiv(PrinterInfo.PrintableHeight - PrinterInfo.PixFromBottom(FFooter), 96, PrinterInfo.YPixPrInch); + PHFInternalMargin := MulDiv(Round(PrinterInfo.YPixPrmm * FHFInternalMargin), 96, PrinterInfo.XPixPrInch); + PGutter := MulDiv(Round(PrinterInfo.XPixPrmm * FGutter), 96, PrinterInfo.XPixPrInch); + PRightHFTextIndent := PRight - MulDiv(Round(PrinterInfo.XPixPrmm * FRightHFTextIndent), 96, PrinterInfo.XPixPrInch); + PLeftHFTextIndent := PLeft + MulDiv(Round(PrinterInfo.XPixPrmm * FLeftHFTextIndent), 96, PrinterInfo.XPixPrInch); end; // ----------------------------------------------------------------------------- diff --git a/Ext/SynEdit/Source/SynEditPrintMarginsDialog.dfm b/Ext/SynEdit/Source/SynEditPrintMarginsDialog.dfm index d1ba4c2..b2636fc 100644 --- a/Ext/SynEdit/Source/SynEditPrintMarginsDialog.dfm +++ b/Ext/SynEdit/Source/SynEditPrintMarginsDialog.dfm @@ -8,12 +8,10 @@ object SynEditPrintMarginsDlg: TSynEditPrintMarginsDlg ClientWidth = 506 Color = clBtnFace ParentFont = True - OldCreateOrder = True Position = poScreenCenter OnCreate = FormCreate OnDestroy = FormDestroy - PixelsPerInch = 96 - TextHeight = 13 + TextHeight = 15 object Image1: TImage Left = 275 Top = 10 @@ -1049,82 +1047,82 @@ object SynEditPrintMarginsDlg: TSynEditPrintMarginsDlg FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF FFF0} end - object LabelLeft: TLabel + object Label1: TLabel Left = 10 Top = 44 Width = 23 - Height = 13 + Height = 15 Caption = 'Left:' end - object LabelRight: TLabel + object Label2: TLabel Left = 10 Top = 69 - Width = 29 - Height = 13 + Width = 31 + Height = 15 Caption = 'Right:' end - object LabelTop: TLabel + object Label3: TLabel Left = 10 Top = 94 Width = 22 - Height = 13 + Height = 15 Caption = 'Top:' end - object LabelBottom: TLabel + object Label4: TLabel Left = 10 Top = 119 - Width = 38 - Height = 13 + Width = 43 + Height = 15 Caption = 'Bottom:' end - object LabelUnits: TLabel + object Label5: TLabel Left = 10 Top = 14 - Width = 28 - Height = 13 + Width = 30 + Height = 15 Caption = 'Units:' end - object LabelHeader: TLabel + object Label6: TLabel Left = 10 Top = 174 - Width = 39 - Height = 13 + Width = 41 + Height = 15 Caption = 'Header:' end - object LabelFooter: TLabel + object Label7: TLabel Left = 10 Top = 199 - Width = 36 - Height = 13 + Width = 37 + Height = 15 Caption = 'Footer:' end - object LabelInternalMargin: TLabel + object Label8: TLabel Left = 10 Top = 224 - Width = 87 - Height = 13 + Width = 96 + Height = 15 Caption = 'HFInternalMargin:' end - object LabelLeftIndent: TLabel + object Label9: TLabel Left = 10 Top = 249 - Width = 90 - Height = 13 + Width = 93 + Height = 15 Caption = 'LeftHFTextIndent:' end - object LabelRightIndent: TLabel + object Label10: TLabel Left = 10 Top = 274 - Width = 96 - Height = 13 + Width = 101 + Height = 15 Caption = 'RightHFTextIndent:' end - object LabelGutter: TLabel + object Label11: TLabel Left = 10 Top = 144 - Width = 31 - Height = 13 - Caption = 'Gutter' + Width = 36 + Height = 15 + Caption = 'Gutter:' end object OKBtn: TButton Left = 344 @@ -1158,77 +1156,77 @@ object SynEditPrintMarginsDlg: TSynEditPrintMarginsDlg Left = 110 Top = 40 Width = 151 - Height = 21 + Height = 23 TabOrder = 1 end object EditRight: TEdit Left = 110 Top = 65 Width = 151 - Height = 21 + Height = 23 TabOrder = 2 end object EditTop: TEdit Left = 110 Top = 90 Width = 151 - Height = 21 + Height = 23 TabOrder = 3 end object EditBottom: TEdit Left = 110 Top = 115 Width = 151 - Height = 21 + Height = 23 TabOrder = 4 end object EditGutter: TEdit Left = 110 Top = 140 Width = 151 - Height = 21 + Height = 23 TabOrder = 5 end object EditHeader: TEdit Left = 110 Top = 170 Width = 151 - Height = 21 + Height = 23 TabOrder = 6 end object EditFooter: TEdit Left = 110 Top = 195 Width = 151 - Height = 21 + Height = 23 TabOrder = 7 end object EditHFInternalMargin: TEdit Left = 110 Top = 220 Width = 151 - Height = 21 + Height = 23 TabOrder = 8 end object EditLeftHFTextIndent: TEdit Left = 110 Top = 245 Width = 151 - Height = 21 + Height = 23 TabOrder = 9 end object EditRightHFTextIndent: TEdit Left = 110 Top = 270 Width = 151 - Height = 21 + Height = 23 TabOrder = 10 end object CBUnits: TComboBox Left = 110 Top = 10 Width = 151 - Height = 21 + Height = 23 Style = csDropDownList TabOrder = 0 OnChange = CBUnitsChange diff --git a/Ext/SynEdit/Source/SynEditPrintMarginsDialog.pas b/Ext/SynEdit/Source/SynEditPrintMarginsDialog.pas index 6ac7953..831027f 100644 --- a/Ext/SynEdit/Source/SynEditPrintMarginsDialog.pas +++ b/Ext/SynEdit/Source/SynEditPrintMarginsDialog.pas @@ -25,13 +25,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditPrintMarginsDialog.pas,v 1.5.2.1 2004/08/31 12:55:18 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} @@ -41,18 +34,13 @@ a picture that can help with understanding the different values. -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITPRINTMARGINSDIALOG} unit SynEditPrintMarginsDialog; -{$ENDIF} {$I SynEdit.inc} interface uses - {$IFDEF SYN_COMPILER_17_UP} - UITypes, - {$ENDIF} Windows, Graphics, Forms, @@ -72,18 +60,18 @@ TSynEditPrintMarginsDlg = class(TForm) OKBtn: TButton; CancelBtn: TButton; Image1: TImage; - LabelLeft: TLabel; - LabelRight: TLabel; - LabelTop: TLabel; - LabelBottom: TLabel; - LabelUnits: TLabel; - LabelHeader: TLabel; - LabelFooter: TLabel; - LabelInternalMargin: TLabel; - LabelLeftIndent: TLabel; + Label1: TLabel; + Label2: TLabel; + Label3: TLabel; + Label4: TLabel; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + Label8: TLabel; + Label9: TLabel; CBMirrorMargins: TCheckBox; - LabelRightIndent: TLabel; - LabelGutter: TLabel; + Label10: TLabel; + Label11: TLabel; EditLeft: TEdit; EditRight: TEdit; EditTop: TEdit; @@ -112,6 +100,9 @@ implementation {$R *.dfm} +uses + UITypes; + { TSynEditPrintMarginsDlg } procedure TSynEditPrintMarginsDlg.FormCreate(Sender: TObject); @@ -186,3 +177,4 @@ procedure TSynEditPrintMarginsDlg.CBUnitsChange(Sender: TObject); end; end. + diff --git a/Ext/SynEdit/Source/SynEditPrintPreview.pas b/Ext/SynEdit/Source/SynEditPrintPreview.pas index 78b8c3c..f9bb779 100644 --- a/Ext/SynEdit/Source/SynEditPrintPreview.pas +++ b/Ext/SynEdit/Source/SynEditPrintPreview.pas @@ -28,11 +28,6 @@ If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: SynEditPrintPreview.pas,v 1.18.2.2 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - Known Issues: -------------------------------------------------------------------------------} @@ -44,9 +39,7 @@ before the preview is shown, and when the printer is changed) -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITPRINTPREVIEW} unit SynEditPrintPreview; -{$ENDIF} {$I SynEdit.inc} @@ -54,58 +47,46 @@ interface uses - {$IFDEF SYN_COMPILER_7} - Themes, - {$ENDIF} - {$IFDEF SYN_COMPILER_17_UP} - Types, - {$ENDIF} - Windows, - Controls, - Messages, - Graphics, - Forms, - SynEditPrint, - Classes, - SysUtils; + Winapi.Windows, + Winapi.Messages, + System.Types, + System.Classes, + System.SysUtils, + Vcl.Themes, + Vcl.Controls, + Vcl.Graphics, + Vcl.Forms, + SynEditPrint; type //Event raised when page is changed in preview TPreviewPageEvent = procedure(Sender: TObject; PageNumber: Integer) of object; TSynPreviewScale = (pscWholePage, pscPageWidth, pscUserScaled); - {$IFNDEF SYN_COMPILER_4_UP} - TWMMouseWheel = record - Msg: Cardinal; - Keys: SmallInt; - WheelDelta: SmallInt; - case Integer of - 0: ( - XPos: Smallint; - YPos: Smallint); - 1: ( - Pos: TSmallPoint; - Result: Longint); - end; - {$ENDIF} - TSynEditPrintPreview = class(TCustomControl) + private + FPaperRect: TRect; protected FBorderStyle: TBorderStyle; FSynEditPrint: TSynEditPrint; FScaleMode: TSynPreviewScale; FScalePercent: Integer; - // these are in pixels ( = screen device units) - FVirtualSize: TPoint; + // these are in pixels ( = screen device units) + FVirtualSize: TSize; FVirtualOffset: TPoint; - FPageSize: TPoint; + FPageSize: TSize; FScrollPosition: TPoint; FPageBG: TColor; FPageNumber: Integer; FShowScrollHint: Boolean; FOnPreviewPage: TPreviewPageEvent; - FOnScaleChange: TNotifyEvent; // JD 2002-01-9 - FWheelAccumulator: Integer; + FOnScaleChange: TNotifyEvent; + FWheelVAccumulator: Integer; + FWheelHAccumulator: Integer; + FMargin_X: Integer; + FMargin_Y: Integer; + FShadow_Size: Integer; + procedure SetBorderStyle(Value: TBorderStyle); procedure SetPageBG(Value: TColor); procedure SetSynEditPrint(Value: TSynEditPrint); @@ -116,8 +97,8 @@ TSynEditPrintPreview = class(TCustomControl) procedure WMHScroll(var Msg: TWMHScroll); message WM_HSCROLL; procedure WMSize(var Msg: TWMSize); message WM_SIZE; procedure WMVScroll(var Msg: TWMVScroll); message WM_VSCROLL; - procedure WMMouseWheel(var Message: TWMMouseWheel); message - {$IFDEF SYN_COMPILER_3_UP} WM_MOUSEWHEEL {$ELSE} $020A {$ENDIF}; + procedure WMMouseWheel(var Message: TWMMouseWheel); message WM_MOUSEWHEEL; + procedure WMMouseHWheel(var Message: TWMMouseWheel); message WM_MOUSEHWHEEL; procedure PaintPaper; function GetPageCount: Integer; protected @@ -133,6 +114,8 @@ TSynEditPrintPreview = class(TCustomControl) procedure ScrollVertTo(Value: Integer); virtual; procedure UpdateScrollbars; virtual; procedure SizeChanged; virtual; + procedure ChangeScale(M, D: Integer; isDpiChange: Boolean); override; + function DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; override; public constructor Create(AOwner: TComponent); override; procedure Paint; override; @@ -151,7 +134,7 @@ TSynEditPrintPreview = class(TCustomControl) property Color default clAppWorkspace; property Cursor; property PageBGColor: TColor read FPageBG write SetPageBG default clWhite; - property PopupMenu; // JD 2002-01-9 + property PopupMenu; property SynEditPrint: TSynEditPrint read FSynEditPrint write SetSynEditPrint; property ScaleMode: TSynPreviewScale read FScaleMode write SetScaleMode @@ -166,13 +149,15 @@ TSynEditPrintPreview = class(TCustomControl) property OnMouseUp; property OnPreviewPage: TPreviewPageEvent read FOnPreviewPage write FOnPreviewPage; - property OnScaleChange: TNotifyEvent read FOnScaleChange // JD 2002-01-9 - write FOnScaleChange; // JD 2002-01-9 + property OnScaleChange: TNotifyEvent read FOnScaleChange + write FOnScaleChange; end; implementation uses + Winapi.D2D1, + SynDWrite, SynEditStrConst; const @@ -182,12 +167,21 @@ implementation { TSynEditPrintPreview } +procedure TSynEditPrintPreview.ChangeScale(M, D: Integer; isDpiChange: Boolean); +begin + if isDpiChange then + begin + FMargin_X := MulDiv(FMargin_X, M, D); + FMargin_Y := MulDiv(FMargin_Y, M, D); + FShadow_Size := MulDiv(FShadow_Size, M, D); + end; + inherited ChangeScale(M, D, isDpiChange); +end; + constructor TSynEditPrintPreview.Create(AOwner: TComponent); begin inherited; -{$IFDEF SYN_COMPILER_7_UP} - ControlStyle := ControlStyle + [csNeedsBorderPaint]; -{$ENDIF} + ControlStyle := ControlStyle + [csOpaque, csNeedsBorderPaint]; FBorderStyle := bsSingle; FScaleMode := pscUserScaled; FScalePercent := 100; @@ -200,7 +194,11 @@ constructor TSynEditPrintPreview.Create(AOwner: TComponent); FPageNumber := 1; FShowScrollHint := True; Align := alClient; - FWheelAccumulator := 0; + FWheelVAccumulator := 0; + FWheelHAccumulator := 0; + FMargin_X:= MARGIN_X; + FMargin_Y:= MARGIN_Y; + FShadow_Size:= SHADOW_SIZE; end; procedure TSynEditPrintPreview.CreateParams(var Params: TCreateParams); @@ -239,31 +237,19 @@ function TSynEditPrintPreview.GetPageWidthFromHeight(AHeight: Integer): Integer; end; function TSynEditPrintPreview.GetPageHeight100Percent: Integer; -var - DC: HDC; - ScreenDPI: Integer; begin Result := 0; - DC := GetDC(0); - ScreenDPI := GetDeviceCaps(DC, LogPixelsY); - ReleaseDC(0, DC); if Assigned(FSynEditPrint) then with FSynEditPrint.PrinterInfo do - Result := MulDiv(PhysicalHeight, ScreenDPI, YPixPrInch); + Result := MulDiv(PhysicalHeight, Screen.PixelsPerInch, YPixPrInch); end; function TSynEditPrintPreview.GetPageWidth100Percent: Integer; -var - DC: HDC; - ScreenDPI: Integer; begin Result := 0; - DC := GetDC(0); - ScreenDPI := GetDeviceCaps(DC, LogPixelsX); - ReleaseDC(0, DC); if Assigned(FSynEditPrint) then with FSynEditPrint.PrinterInfo do - Result := MulDiv(PhysicalWidth, ScreenDPI, XPixPrInch); + Result := MulDiv(PhysicalWidth, Screen.PixelsPerInch, XPixPrInch); end; procedure TSynEditPrintPreview.Notification(AComponent: TComponent; @@ -276,7 +262,7 @@ procedure TSynEditPrintPreview.Notification(AComponent: TComponent; procedure TSynEditPrintPreview.PaintPaper; var - rcClip, rcPaper: TRect; + rcClip: TRect; rgnPaper: HRGN; i: Integer; begin @@ -292,70 +278,42 @@ procedure TSynEditPrintPreview.PaintPaper; if (csDesigning in ComponentState) or (not Assigned(FSynEditPrint)) then begin FillRect(rcClip); Brush.Color := FPageBG; - Rectangle(MARGIN_X, MARGIN_Y, MARGIN_X + 30, MARGIN_Y + 43); + Rectangle(FMargin_X, FMargin_Y, FMargin_X + 30, FMargin_Y + 43); Exit; end; // fill background around paper - with rcPaper do begin + with FPaperRect do begin Left := FVirtualOffset.X + FScrollPosition.X; if ScaleMode = pscWholePage then Top := FVirtualOffset.Y else Top := FVirtualOffset.Y + FScrollPosition.Y; - Right := Left + FPageSize.X; - Bottom := Top + FPageSize.Y; - rgnPaper := CreateRectRgn(Left, Top, Right + 1, Bottom + 1); + Right := Left + FPageSize.Width; + Bottom := Top + FPageSize.Height; + rgnPaper := CreateRectRgn(Left, Top, Right, Bottom); end; if (NULLREGION <> ExtSelectClipRgn(Handle, rgnPaper, RGN_DIFF)) then FillRect(rcClip); - - // paper shadow + // paper shadow Brush.Color := clDkGray; - with rcPaper do begin - for i := 1 to SHADOW_SIZE do + with FPaperRect do begin + for i := 1 to FShadow_Size do PolyLine([Point(Left + i, Bottom + i), Point(Right + i, Bottom + i), Point(Right + i, Top + i)]); end; // paint paper background - SelectClipRgn(Handle, rgnPaper); - Brush.Color := FPageBG; - with rcPaper do - Rectangle(Left, Top, Right + 1, Bottom + 1); DeleteObject(rgnPaper); end; end; procedure TSynEditPrintPreview.Paint; -var - ptOrgScreen: TPoint; begin - with Canvas do begin - PaintPaper; - if (csDesigning in ComponentState) or (not Assigned(FSynEditPrint)) then - Exit; - // paint the contents, clipped to the area inside of the print margins - // correct scaling for output: + PaintPaper; + if (csDesigning in ComponentState) or (not Assigned(FSynEditPrint)) then + Exit; - SetMapMode(Handle, MM_ANISOTROPIC); - // compute the logical point (0, 0) in screen pixels - with FSynEditPrint.PrinterInfo do - begin - SetWindowExtEx(Handle, PhysicalWidth, PhysicalHeight, nil); - SetViewPortExtEx(Handle, FPageSize.X, FPageSize.Y, nil); - ptOrgScreen.X := MulDiv(LeftGutter, FPageSize.X, PhysicalWidth); - ptOrgScreen.Y := MulDiv(TopGutter, FPageSize.Y, PhysicalHeight); - Inc(ptOrgScreen.X, FVirtualOffset.X + FScrollPosition.X); - if ScaleMode = pscWholePage then - Inc(ptOrgScreen.Y, FVirtualOffset.Y) - else - Inc(ptOrgScreen.Y, FVirtualOffset.Y + FScrollPosition.Y); - SetViewPortOrgEx(Handle, ptOrgScreen.X, ptOrgScreen.Y, nil); - // clip the output to the print margins - IntersectClipRect(Handle, 0, 0, PrintableWidth, PrintableHeight); - end; - FSynEditPrint.PrintToCanvas(Canvas, FPageNumber); - end; + FSynEditPrint.PrintToCanvas(Canvas, FPaperRect, Canvas.ClipRect, FPageNumber); end; procedure TSynEditPrintPreview.ScrollHorzFor(Value: Integer); @@ -368,7 +326,7 @@ procedure TSynEditPrintPreview.ScrollHorzTo(Value: Integer); nW, n: Integer; begin nW := ClientWidth; - n := nW - FVirtualSize.X; + n := nW - FVirtualSize.Width; if (Value < n) then Value := n; if (Value > 0) then Value := 0; if (Value <> FScrollPosition.X) then @@ -396,7 +354,7 @@ procedure TSynEditPrintPreview.ScrollVertTo(Value: Integer); nH, n: Integer; begin nH := ClientHeight; - n := nH - FVirtualSize.Y; + n := nH - FVirtualSize.Height; if (Value < n) then Value := n; if (Value > 0) then Value := 0; if (Value <> FScrollPosition.Y) then @@ -422,31 +380,31 @@ procedure TSynEditPrintPreview.SizeChanged; // compute paper size case fScaleMode of pscWholePage: begin - FPageSize.X := ClientWidth - 2 * MARGIN_X - SHADOW_SIZE; - FPageSize.Y := ClientHeight - 2 * MARGIN_Y - SHADOW_SIZE; - nWDef := GetPageWidthFromHeight(FPageSize.Y); - if (nWDef < FPageSize.X) then - FPageSize.X := nWDef + FPageSize.Width := ClientWidth - 2 * FMargin_X - FShadow_Size; + FPageSize.Height := ClientHeight - 2 * FMargin_Y - FShadow_Size; + nWDef := GetPageWidthFromHeight(FPageSize.Height); + if (nWDef < FPageSize.Width) then + FPageSize.Width := nWDef else - FPageSize.Y := GetPageHeightFromWidth(FPageSize.X); + FPageSize.Height := GetPageHeightFromWidth(FPageSize.Width); end; pscPageWidth: begin - FPageSize.X := ClientWidth - 2 * MARGIN_X - SHADOW_SIZE; - FPageSize.Y := GetPageHeightFromWidth(FPageSize.X); + FPageSize.Width := ClientWidth - 2 * FMargin_X - FShadow_Size; + FPageSize.Height := GetPageHeightFromWidth(FPageSize.Width); end; pscUserScaled: begin - FPageSize.X := MulDiv(GetPageWidth100Percent, fScalePercent, 100); - FPageSize.Y := MulDiv(GetPageHeight100Percent, fScalePercent, 100); + FPageSize.Width := MulDiv(GetPageWidth100Percent, fScalePercent, 100); + FPageSize.Height := MulDiv(GetPageHeight100Percent, fScalePercent, 100); end; end; - FVirtualSize.X := FPageSize.X + 2 * MARGIN_X + SHADOW_SIZE; - FVirtualSize.Y := FPageSize.Y + 2 * MARGIN_Y + SHADOW_SIZE; - FVirtualOffset.X := MARGIN_X; - if (FVirtualSize.X < ClientWidth) then - Inc(FVirtualOffset.X, (ClientWidth - FVirtualSize.X) div 2); - FVirtualOffset.Y := MARGIN_Y; - if (FVirtualSize.Y < ClientHeight) then - Inc(FVirtualOffset.Y, (ClientHeight - FVirtualSize.Y) div 2); + FVirtualSize.Width := FPageSize.Width + 2 * FMargin_X + FShadow_Size; + FVirtualSize.Height := FPageSize.Height + 2 * FMargin_Y + FShadow_Size; + FVirtualOffset.X := FMargin_X; + if (FVirtualSize.Width < ClientWidth) then + Inc(FVirtualOffset.X, (ClientWidth - FVirtualSize.Width) div 2); + FVirtualOffset.Y := FMargin_Y; + if (FVirtualSize.Height < ClientHeight) then + Inc(FVirtualOffset.Y, (ClientHeight - FVirtualSize.Height) div 2); UpdateScrollbars; // TODO FScrollPosition.X := 0; @@ -484,7 +442,7 @@ procedure TSynEditPrintPreview.UpdateScrollbars; ShowScrollbar(Handle, SB_HORZ, False); // show vertical scrollbar si.fMask := si.fMask or SIF_DISABLENOSCROLL; - si.nMax := FVirtualSize.Y; + si.nMax := FVirtualSize.Height; si.nPos := -FScrollPosition.Y; si.nPage := ClientHeight; SetScrollInfo(Handle, SB_VERT, si, True); @@ -494,12 +452,12 @@ procedure TSynEditPrintPreview.UpdateScrollbars; ShowScrollbar(Handle, SB_VERT, True); si.fMask := si.fMask or SIF_DISABLENOSCROLL; // show horizontal scrollbar - si.nMax := FVirtualSize.X; + si.nMax := FVirtualSize.Width; si.nPos := -FScrollPosition.X; si.nPage := ClientWidth; SetScrollInfo(Handle, SB_HORZ, si, True); // show vertical scrollbar - si.nMax := FVirtualSize.Y; + si.nMax := FVirtualSize.Height; si.nPos := -FScrollPosition.Y; si.nPage := ClientHeight; SetScrollInfo(Handle, SB_VERT, si, True); @@ -574,7 +532,7 @@ procedure TSynEditPrintPreview.WMHScroll(var Msg: TWMHScroll); nW := ClientWidth; case Msg.ScrollCode of SB_TOP: ScrollHorzTo(0); - SB_BOTTOM: ScrollHorzTo(-FVirtualSize.X); + SB_BOTTOM: ScrollHorzTo(-FVirtualSize.Width); SB_LINEDOWN: ScrollHorzFor(-(nW div 10)); SB_LINEUP: ScrollHorzFor(nW div 10); SB_PAGEDOWN: ScrollHorzFor(-(nW div 2)); @@ -597,7 +555,7 @@ function GetScrollHint: THintWindow; begin if ScrollHintWnd = nil then begin ScrollHintWnd := HintWindowClass.Create(Application); - ScrollHintWnd.Visible := FALSE; + ScrollHintWnd.Visible := False; end; Result := ScrollHintWnd; end; @@ -632,24 +590,14 @@ procedure TSynEditPrintPreview.WMVScroll(var Msg: TWMVScroll); ScrollHint := GetScrollHint; if not ScrollHint.Visible then begin ScrollHint.Color := Application.HintColor; - ScrollHint.Visible := TRUE; + ScrollHint.Visible := True; end; s := Format(SYNS_PreviewScrollInfoFmt, [FPageNumber]); -{$IFDEF SYN_COMPILER_3_UP} rc := ScrollHint.CalcHintRect(200, s, nil); -{$ELSE} - rc := Rect(0, 0, TextWidth(ScrollHint.Canvas, s) + 6, - TextHeight(ScrollHint.Canvas, s) + 4); -{$ENDIF} pt := ClientToScreen(Point(ClientWidth - rc.Right - 4, 10)); OffsetRect(rc, pt.x, pt.y); ScrollHint.ActivateHint(rc, s); -{$IFDEF SYN_COMPILER_3} SendMessage(ScrollHint.Handle, WM_NCPAINT, 1, 0); -{$ENDIF} -{$IFNDEF SYN_COMPILER_3_UP} - ScrollHint.Invalidate; -{$ENDIF} ScrollHint.Update; end; end; @@ -673,7 +621,7 @@ procedure TSynEditPrintPreview.WMVScroll(var Msg: TWMVScroll); nH := ClientHeight; case Msg.ScrollCode of SB_TOP: ScrollVertTo(0); - SB_BOTTOM: ScrollVertTo(-FVirtualSize.Y); + SB_BOTTOM: ScrollVertTo(-FVirtualSize.Height); SB_LINEDOWN: ScrollVertFor(-(nH div 10)); SB_LINEUP: ScrollVertFor(nH div 10); SB_PAGEDOWN: ScrollVertFor(-(nH div 2)); @@ -683,56 +631,111 @@ procedure TSynEditPrintPreview.WMVScroll(var Msg: TWMVScroll); end; end; -procedure TSynEditPrintPreview.WMMouseWheel(var Message: TWMMouseWheel); -{$IFNDEF SYN_COMPILER_3_UP} -const - WHEEL_DELTA = 120; -{$ENDIF} -var - bCtrl: Boolean; - - procedure MouseWheelUp; - begin - if bCtrl and (fPageNumber > 1) then - PreviousPage - else - ScrollVertFor(WHEEL_DELTA); - end; - - procedure MouseWheelDown; - begin - if bCtrl and (fPageNumber < PageCount) then - NextPage - else - ScrollVertFor(-WHEEL_DELTA); - end; - +// Shared mousewheel function called by both vertical and horizontal wheel message handlers. +function TSynEditPrintPreview.DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; MousePos: TPoint): Boolean; var - MousePos: TPoint; IsNeg: Boolean; begin - { Find modifiers } - bCtrl := GetKeyState(VK_CONTROL) < 0; - - { Find mouse pos and increment accumulator } - MousePos:= SmallPointToPoint(Message.Pos); - Inc(FWheelAccumulator, Message.WheelDelta); - - { Do actions while accumulated is bigger than delta } - while Abs(FWheelAccumulator) >= WHEEL_DELTA do + // Note that we do not call inherited as we do all handling here. + Result := False; + if Assigned(OnMouseWheel) then + OnMouseWheel(Self, Shift, WheelDelta, MousePos, Result); + if not Result then begin - IsNeg := FWheelAccumulator < 0; - FWheelAccumulator := Abs(FWheelAccumulator) - WHEEL_DELTA; - if IsNeg then + if not (ssHorizontal in Shift) then begin - if FWheelAccumulator <> 0 then FWheelAccumulator := -FWheelAccumulator; - MouseWheelDown; + // Vertical Mouse Wheel + Inc(FWheelVAccumulator, WheelDelta); + while Abs(FWheelVAccumulator) >= WHEEL_DELTA do + begin + IsNeg := FWheelVAccumulator < 0; + FWheelVAccumulator := Abs(FWheelVAccumulator) - WHEEL_DELTA; + if IsNeg then + begin + // Vertical Mouse Wheel Down; + if FWheelVAccumulator <> 0 then FWheelVAccumulator := -FWheelVAccumulator; + Result := DoMouseWheelDown(Shift, MousePos); + if not Result then + begin + if (ssCtrl in Shift) and (fPageNumber < PageCount) then + NextPage + else + ScrollVertFor(-WHEEL_DELTA); + Result := True; + end; + end + else + begin + // Vertical Mouse Wheel Up; + Result := DoMouseWheelUp(Shift, MousePos); + if not Result then + begin + if (ssCtrl in Shift) and (fPageNumber > 1) then + PreviousPage + else + ScrollVertFor(WHEEL_DELTA); + Result := True; + end; + end; + end; end else - MouseWheelUp; + begin + // Horizontal Mouse Wheel + Inc(FWheelHAccumulator, WheelDelta); + while Abs(FWheelHAccumulator) >= WHEEL_DELTA do + begin + IsNeg := FWheelHAccumulator < 0; + FWheelHAccumulator := Abs(FWheelHAccumulator) - WHEEL_DELTA; + if IsNeg then + begin + // Horizontal Mouse Wheel Down/Right; + if FWheelHAccumulator <> 0 then FWheelHAccumulator := -FWheelHAccumulator; + ScrollHorzFor(-WHEEL_DELTA); + end + else + begin + // Horizontal Mouse Wheel Up/Left; + ScrollHorzFor(WHEEL_DELTA); + end; + Result := True; + end; + end; end; end; +procedure TSynEditPrintPreview.WMMouseWheel(var Message: TWMMouseWheel); +var + Shift: TShiftState; + WheelDelta: SmallInt; + MousePos: TSmallPoint; +begin + Shift := KeysToShiftState(Message.Keys); + // Shift-MouseWheel causes horizonal scrolling. This is a semi-standard + // used in several products including VsCode and Edge. + if ssShift in Shift then + Include(Shift, System.Classes.ssHorizontal); + WheelDelta := Message.WheelDelta; + MousePos := Message.Pos; + if DoMouseWheel(Shift, WheelDelta, MousePos) then + Message.Result := 1; +end; + +procedure TSynEditPrintPreview.WMMouseHWheel(var Message: TWMMouseWheel); +var + Shift: TShiftState; + WheelDelta: SmallInt; + MousePos: TSmallPoint; +begin + Shift := KeysToShiftState(Message.Keys); + Include(Shift, System.Classes.ssHorizontal); + // HWheel directions are reversed from Wheel - retest + WheelDelta := - Message.WheelDelta; + MousePos := Message.Pos; + if DoMouseWheel(Shift, WheelDelta, MousePos) then + Message.Result := 1; +end; + procedure TSynEditPrintPreview.UpdatePreview; var OldScale: Integer; @@ -742,7 +745,7 @@ procedure TSynEditPrintPreview.UpdatePreview; OldMode := ScaleMode; ScalePercent := 100; if Assigned(FSynEditPrint) then - FSynEditPrint.UpdatePages(Canvas); + FSynEditPrint.InitPrint; SizeChanged; Invalidate; ScaleMode := OldMode; @@ -802,4 +805,10 @@ function TSynEditPrintPreview.GetPageCount: Integer; Result := SynEditPrint.PageCount; end; +initialization + TCustomStyleEngine.RegisterStyleHook(TSynEditPrintPreview, TScrollingStyleHook); + +finalization + TCustomStyleEngine.UnRegisterStyleHook(TSynEditPrintPreview, TScrollingStyleHook); + end. diff --git a/Ext/SynEdit/Source/SynEditPrintTypes.pas b/Ext/SynEdit/Source/SynEditPrintTypes.pas index 82cbbd9..44dfb62 100644 --- a/Ext/SynEdit/Source/SynEditPrintTypes.pas +++ b/Ext/SynEdit/Source/SynEditPrintTypes.pas @@ -27,11 +27,6 @@ If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: SynEditPrintTypes.pas,v 1.4.2.3 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - Known Issues: Wrapping across page boundaries is not supported -------------------------------------------------------------------------------} @@ -43,15 +38,12 @@ -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITPRINTTYPES} unit SynEditPrintTypes; -{$ENDIF} interface uses - SynUnicode, - Classes, SysUtils; + SynUnicode, Classes, SysUtils; const DefLeft = 25; //Default left margin [mm] @@ -76,63 +68,11 @@ interface PageNumber: Integer; var Abort: Boolean) of object; //Event raised when a line is printed (can be used to generate Table of Contents) TPrintLineEvent = procedure(Sender: TObject; LineNumber, PageNumber: Integer) of object; -type - TWrapPos = class - public - Index: Integer; - end; function IntToRoman(Value: Integer): string; -// TODO: BreakChars is ANSI only but SynEditPrint only uses Ansi chars and should be rewritten to use WordWrap of SynEdit anyway -function WrapTextEx(const Line: UnicodeString; BreakChars: TSysCharSet; - MaxCol: Integer; AList: TList): Boolean; - implementation -//Returns wrapping positions in AList. -function WrapTextEx(const Line: UnicodeString; BreakChars: TSysCharSet; - MaxCol: Integer; AList: TList): Boolean; -var - WrapPos: TWrapPos; - Pos, PreviousPos: Integer; - Found: Boolean; -begin - if Length(Line) <= MaxCol then - begin - Result := True; - Exit; - end; - - Result := False; - Pos := 1; - PreviousPos := 0; - WrapPos := TWrapPos.Create; - while Pos <= Length(Line) do - begin - Found := (Pos - PreviousPos > MaxCol) and (WrapPos.Index <> 0); - if not Found and (Line[Pos] <= High(Char)) and CharInSet(Char(Line[Pos]), BreakChars) then // We found a possible break - WrapPos.Index := Pos; - - if Found then - begin - Result := True; - AList.Add(WrapPos); - PreviousPos := WrapPos.Index; - - // If more wraps needed and not end of line then a new wrap is created - if ((Length(Line) - PreviousPos) > MaxCol) and (Pos < Length(Line)) then - WrapPos := TWrapPos.Create - else - Break; - end; - Pos := Pos + 1; - end; - - if (AList.Count = 0) or (AList.Last <> WrapPos) then - WrapPos.Free; -end; - //Integer to Roman - copied from SWAG function IntToRoman(Value: Integer): string; begin diff --git a/Ext/SynEdit/Source/SynEditPrinterInfo.pas b/Ext/SynEdit/Source/SynEditPrinterInfo.pas index ea4be2c..90ecc3a 100644 --- a/Ext/SynEdit/Source/SynEditPrinterInfo.pas +++ b/Ext/SynEdit/Source/SynEditPrinterInfo.pas @@ -25,13 +25,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditPrinterInfo.pas,v 1.4.2.2 2005/10/18 01:43:23 etrusco Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} @@ -40,9 +33,7 @@ Class retrieving info about selected printer and paper size. -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITPRINTERINFO} unit SynEditPrinterInfo; -{$ENDIF} {$I SynEdit.inc} diff --git a/Ext/SynEdit/Source/SynEditPropertyReg.pas b/Ext/SynEdit/Source/SynEditPropertyReg.pas index b793630..fb54600 100644 --- a/Ext/SynEdit/Source/SynEditPropertyReg.pas +++ b/Ext/SynEdit/Source/SynEditPropertyReg.pas @@ -26,61 +26,21 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditPropertyReg.pas,v 1.17.2.6 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITPROPERTYREG} unit SynEditPropertyReg; -{$ENDIF} {$I SynEdit.inc} interface uses -{$IFDEF SYN_COMPILER_6_UP} DesignIntf, DesignEditors, VCLEditors, - StrEdit, -{$ELSE} - DsgnIntf, - StrEdit, -{$ENDIF} - SynUnicode, -{$IFDEF USE_TNT_DESIGNTIME_SUPPORT} - TntClasses, - TntStrEdit_Design, -{$ENDIF} - Classes; + System.Classes; type -{$IFDEF USE_TNT_DESIGNTIME_SUPPORT} - // Wrapper around TUnicodeStringListProperty to enable the TNT property editor to - // handle TUnicodeStrings - TSynUnicodeStringListProperty = class(TWideStringListProperty) - private - FUnicodeStrings: TUnicodeStrings; - FTntStrings: TTntStrings; - protected - function GetStrings: TTntStrings; override; - procedure SetStrings(const Value: TTntStrings); override; - public -{$IFDEF SYN_COMPILER_6_UP} - constructor Create(const ADesigner: IDesigner; APropCount: Integer); override; -{$ELSE} - constructor Create(const ADesigner: IFormDesigner; APropCount: Integer); override; -{$ENDIF} - destructor Destroy; override; - end; -{$ENDIF} - TSynEditFontProperty = class(TFontProperty) public procedure Edit; override; @@ -111,7 +71,7 @@ TAutoCorrectionProperty = class(TPropertyEditor) public procedure Edit; override; function GetAttributes: TPropertyAttributes; override; - function GetValue: string; override; + function GetValue:string; override; end; TSynAutoCorrectComponentEditor = class(TDefaultEditor) @@ -121,15 +81,23 @@ TSynAutoCorrectComponentEditor = class(TDefaultEditor) function GetVerbCount: Integer; override; end; + TSynOmniSynComponentEditor = class(TDefaultEditor) + procedure Edit; override; + procedure ExecuteVerb(Index: Integer); override; + function GetVerb(Index: Integer): string; override; + function GetVerbCount: Integer; override; + end; + procedure Register; implementation uses - Dialogs, - Forms, - Graphics, - Controls, + Vcl.Dialogs, + Vcl.Forms, + Vcl.Graphics, + Vcl.Controls, + SynEditTypes, SynEditKeyCmds, SynEditKeyCmdsEditor, SynEdit, @@ -140,64 +108,9 @@ implementation SynMacroRecorder, SynAutoCorrect, SynAutoCorrectEditor, - SysUtils; - -{$IFDEF USE_TNT_DESIGNTIME_SUPPORT} - -{ TSynUnicodeStringListProperty } - -{$IFDEF SYN_COMPILER_6_UP} -constructor TSynUnicodeStringListProperty.Create(const ADesigner: IDesigner; APropCount: Integer); -{$ELSE} -constructor TSynUnicodeStringListProperty.Create(const ADesigner: IFormDesigner; APropCount: Integer); -{$ENDIF} -begin - inherited; - FUnicodeStrings := TUnicodeStringList.Create; - FTntStrings := TTntStringList.Create; -end; - -destructor TSynUnicodeStringListProperty.Destroy; -begin - FTntStrings.Free; - FUnicodeStrings.Free; - inherited; -end; - -function TSynUnicodeStringListProperty.GetStrings: TTntStrings; -var - UnicodeStrings: TUnicodeStrings; - i: Integer; -begin - UnicodeStrings := TUnicodeStrings(GetOrdValue); - - FTntStrings.Clear; - FTntStrings.BeginUpdate; - try - for i := 0 to UnicodeStrings.Count - 1 do - FTntStrings.AddObject(UnicodeStrings[i], UnicodeStrings.Objects[i]); - finally - FTntStrings.EndUpdate; - end; - Result := FTntStrings; -end; - -procedure TSynUnicodeStringListProperty.SetStrings(const Value: TTntStrings); -var - i: Integer; -begin - FUnicodeStrings.Clear; - FUnicodeStrings.BeginUpdate; - try - for i := 0 to Value.Count - 1 do - FUnicodeStrings.AddObject(Value[I], Value.Objects[I]); - finally - FUnicodeStrings.EndUpdate; - end; - SetOrdValue(Longint(FUnicodeStrings)); -end; -{$ENDIF} - + SynHighlighterOmni, + SynOmniSetupDialog, + System.SysUtils; { TSynEditFontProperty } @@ -215,7 +128,7 @@ procedure TSynEditFontProperty.Edit; FontDialog.Options := FontDialog.Options + [fdShowHelp, fdForceFontExist, fdFixedPitchOnly]; if FontDialog.Execute then - SetOrdValue(Longint(FontDialog.Font)); + SetOrdValue(NativeInt(FontDialog.Font)); finally FontDialog.Free; end; @@ -246,7 +159,7 @@ procedure TSynEditCommandProperty.GetValues(Proc: TGetStrProc); procedure TSynEditCommandProperty.SetValue(const Value: string); var - NewValue: longint; + NewValue: Integer; begin if IdentToEditorCommand(Value, NewValue) then SetOrdValue(NewValue) @@ -266,8 +179,8 @@ procedure TSynEditKeystrokesProperty.Edit; Dlg.Keystrokes := TSynEditKeystrokes(GetOrdValue); if Dlg.ShowModal = mrOk then begin - { SetOrdValue will operate on all selected propertiy values } - SetOrdValue(Longint(Dlg.Keystrokes)); + { SetOrdValue will operate on all selected property values } + SetOrdValue(NativeInt(Dlg.Keystrokes)); Modified; end; finally @@ -358,27 +271,35 @@ function TAutoCorrectionProperty.GetValue: string; GetValue := '(AutoCorrections)'; end; +procedure TSynOmniSynComponentEditor.Edit; +begin + if EditOmniHighlighter(TSynOmniSyn(Component)) then + Designer.Modified; +end; + +procedure TSynOmniSynComponentEditor.ExecuteVerb(Index: Integer); +begin + case Index of + 0: Edit; + end; +end; + +function TSynOmniSynComponentEditor.GetVerb(Index: Integer): string; +begin + case Index of + 0: Result := '&Edit Omni Highlighter...'; + end; +end; + +function TSynOmniSynComponentEditor.GetVerbCount: Integer; +begin + Result := 1; +end; { Register } procedure Register; begin -// TODO: Delphi 2005 has native Unicode property editors, we should use them (but I don't have D2005 to test) -{$IFDEF USE_TNT_DESIGNTIME_SUPPORT} - // Troy Wolbrink added my (Maël Hörz) WideChar property editor to - // TntUnicodeStringProperty_Design.pas. - // As it is registered there, no need to do it a second time here. - // However as he uses TTntStrings and we use TUnicodeStrings, we need - // a wrapper to do the "translation". - RegisterPropertyEditor(TypeInfo(TUnicodeStrings), nil, - '', TSynUnicodeStringListProperty); -{$ELSE} - RegisterPropertyEditor(TypeInfo(WideChar), nil, - '', TCharProperty); - RegisterPropertyEditor(TypeInfo(TUnicodeStrings), nil, - '', TStringListProperty); -{$ENDIF} - RegisterPropertyEditor(TypeInfo(TFont), TCustomSynEdit, 'Font', TSynEditFontProperty); RegisterPropertyEditor(TypeInfo(TSynEditorCommand), nil, @@ -389,15 +310,16 @@ procedure Register; '', TSynEditPrintMarginsProperty); RegisterPropertyEditor(TypeInfo(TStrings), TSynAutoCorrect, 'Items', TAutoCorrectionProperty); - RegisterComponentEditor(TSynAutoCorrect, TSynAutoCorrectComponentEditor); - {$IFDEF SYN_DELPHI_6_UP} // TODO: shouldn't that be COMPILER_6_UP instead? RegisterPropertyEditor(TypeInfo(TShortCut), TSynCompletionProposal, '', TShortCutProperty); RegisterPropertyEditor(TypeInfo(TShortCut), TSynAutoComplete, '', TShortCutProperty); RegisterPropertyEditor(TypeInfo(TShortCut), TSynMacroRecorder, '', TShortCutProperty); - {$ENDIF} + + RegisterComponentEditor(TSynAutoCorrect, TSynAutoCorrectComponentEditor); + RegisterComponentEditor(TSynOmniSyn, TSynOmniSynComponentEditor); + end; end. diff --git a/Ext/SynEdit/Source/SynEditPythonBehaviour.pas b/Ext/SynEdit/Source/SynEditPythonBehaviour.pas index 4559261..bc93f1a 100644 --- a/Ext/SynEdit/Source/SynEditPythonBehaviour.pas +++ b/Ext/SynEdit/Source/SynEditPythonBehaviour.pas @@ -25,13 +25,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditPythonBehaviour.pas,v 1.5.2.3 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a component which implements editing rules to apply to a Python source file) @@ -39,24 +32,18 @@ @created(1999-10-17) @lastmod(May 19, 2000) The SynEditPythonBehaviour unit provides a simple component implements editing rules to apply -to a python source file. Python has a unusual way to mark blocks (like begin/end in pascal) : it +to a python source file. Python has a unusual way to mark blocks (like begin/end in pascal): it uses indentation. So the rule is after a ":" and a line break, we have to indent once. } -{$IFNDEF QSYNEDITPYTHONBEHAVIOUR} unit SynEditPythonBehaviour; -{$ENDIF} {$I SynEdit.inc} interface uses - Windows, Messages, Graphics, Controls, Forms, Dialogs, - SynEdit, - SynEditKeyCmds, - SynUnicode, - SysUtils, - Classes; + Windows, Messages, Graphics, Controls, Forms, Dialogs, SynEdit, SynEditKeyCmds, + SynUnicode, SysUtils, Classes, SynEditTypes; type TSynEditPythonBehaviour = class(TComponent) @@ -96,10 +83,10 @@ procedure TSynEditPythonBehaviour.SetEditor(Value: TSynEdit); procedure TSynEditPythonBehaviour.doProcessUserCommand(Sender: TObject; AfterProcessing: Boolean; var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; Data: Pointer; - HandlerData: Pointer); + HandlerData: pointer); var iEditor: TCustomSynEdit; - iPrevLine: UnicodeString; + iPrevLine: string; cSpace: Integer; begin if (Command = ecLineBreak) and AfterProcessing then @@ -107,15 +94,15 @@ procedure TSynEditPythonBehaviour.doProcessUserCommand(Sender: TObject; iEditor := Sender as TCustomSynEdit; { CaretY should never be lesser than 2 right after ecLineBreak, so there's no need for a check } - iPrevLine := WideTrimRight(iEditor.Lines[iEditor.CaretY - 2]); + iPrevLine := TrimRight(iEditor.Lines[iEditor.CaretY - 2]); if (iPrevLine <> '') and (iPrevLine[Length(iPrevLine)] = ':') then begin - iEditor.UndoList.BeginBlock; + iEditor.BeginUndoBlock; try for cSpace := 1 to Indent do iEditor.ExecuteCommand(ecChar, #32, nil); finally - iEditor.UndoList.EndBlock; + iEditor.EndUndoBlock; end; end; end; @@ -128,3 +115,4 @@ constructor TSynEditPythonBehaviour.Create(aOwner: TComponent); end; end. + diff --git a/Ext/SynEdit/Source/SynEditReg.dcr b/Ext/SynEdit/Source/SynEditReg.dcr index 71104456daccacbec72ed682af216128ff4c532a..7946bfcfba84f269b05b26f2ff40d2c4a84d90ed 100644 GIT binary patch delta 8155 zcmc&&2{=`2+g@vL8MiTWGKUVRl` zGgEwJKMx3^36+$LAf6nVyl?V=_{U_4`{$eS)Z`zLXa*|$7L6Cdg+k{?@ZBG~!yw+9 zCJGKT;r7A5q^H3z2+-j<0_gBdfeQF;)B>E1&jQXiL>IZAm>k4AGTebpdzFJAp2$v( z=V!`+51X0x6M9*}2_snGgoH1g@GucJco@EtGMk{wj@-MVy$TbEx8qFO57-;>=L-{# z9p>8$G~uoX5oiVi9d9s*e@R1z7ZZ?&XTb{3A`ZVSz)qkNJOsiHa=aaV27!2lYj4n) zQ2k!YN=jb>?NQY|)5|J@Fe}RR!|cU(iVeYGcf>n>g!vK1kIDXS#!2p(gl4I-z1=G_ z`1a#vVtzNJ<@U@i!y&V;Zr*p`MJ(Ujo(f@6XpJumvdZ)qM{LukZ{(FffAlP`Y0)`O9IjSxE^m`deEGJb9?q zUb@gdP{0$0p{W>V3zdTaa2x;t5{Vi(1(*SrfFYm-Xac(Mkt84s*a60{=Oi5QW7}Kn z-?vy}!;`esoYe3!t*(xyDZJl1%RosE|MRSn>;VAu*VR-%6*%JfsBCCvEjQer35jgs zA%6|f2p~1M@47>6MTb!FVl~mD4Yv6F(Hie8krt9_v^u$s!rRH>s}G3}9eh@ycG4`0 z#6cF+SXJPbyYTJc*&7CJMP2f=fZiH<$N6b*=XVlw`G`UnX+f10v*V;&a<j-oP^hpao6OAR9#LbVK8ZKhAxI}9ONL)#T3%6vv0KSK>0|`3J(o3ourBV{?a>O zvA(Qjvk97(c{ia-E|=~!_HnVEJw0z5Le*nyavStb#TbyrDEVnelwMNkhqySukJl61 zlEm*mq!Ez?ln)m?P5#(c$oQdfN}Ni(9!GARmVq1Qh=K490Qwg~L=^_OXVrIWUi%dW zt_7g0WvKb^1TF&5Lj1AZ(9iXj0;K=ldb7jH+4t-HE!+m7CWa^RL4b>{(8~yemGCGUuFtD91w~u#U2+d7 ztiFN{AOqLuW&PH|p(;-nVH%|lPF^!GrU`?QYUOfSuMZzYl+I%(wY*ae`8z2rDd~&fVrEY}7KMdtnLXw?((yq( z$*|?heb%RMGmrBOh0z{}+wUi(L9zIRyM5RONY>?(W+>9-_C z+IM$%D}cGPfeh>Qn#94u#y!96zG`h;ze$4e z+!NaqUL1ldW;_Sp!EJ8Led?Irv7gYexF$u~zSo%eg+#h=2yc~Ok`h+|HbEOQ8zgoP z^BO_vx#SdV=-lA1CoNE@2+h1&lU9S8oR&{{;e;?N+&eKfdTL*Qnlqi-DeN;5_RXqm z`p{IcunZ+jNC0}TkvP!33|pYbBcjIA7fu&tvB|LX^5HN75Pe{y#$@vt#>P)D1ORvB zJ`kaQ_~5|+QvWUxdExZD`#|&w4qgQSr1TFUF5a@!VOHnrfCy!U@025B8`;B6lQL(5 zPWWDIuqnL^IiKQGe{-8U2}gGFLu_$YzzoZfM&c@Oz)nz%nAv&_vbt08GI}MXj-NVL zwA=JDgMQE0d~GVOXwI*H_^K+qzyG@2%1(E;2c)C{xU-RXPwXDAv=ge}euhI`GZC`# zD~_H})@Sy*aB)gsK9Y^|P+^>)Lh1?0Bc2B-kA9W?0C_}f$d68`P^OIYGt)7;ry3gq z5&aDEGHJzrS?1K{F_A?oq2&qK?nmPh+eZudxV0 z8fQ_KFj?qAYqKjKl9{EtqD9xl(vX}w9D(?Sw6){5)p)e2U_o9Q1{of?>LSJ$H|XWruSS; z71L?aOp{5m4}L3Tja9AP5jo&3rN4Skv~kC#okFw^IqUAsEkU(xD7JzOPdPBM8yPVx z&5UsvtB$%uwcg8m6X?Y#^l^l;Cyv=hH(Eh$o79d@hijTX$c}tu0lFnwIBSg#N)uy> zHKQRy<|?7_ICJjO!lvZZr$B`Wt!K~j^Ac{HUTl4%SQs$Cb+Wk&!*poWvOOW1j3NHL zdEkJdw(cRPwD>i}#|b{Y3Kl&o3!NWjhx@^%B2`^YeGc**nq%7Cv{ub7H0kNPRBGy& zTs;B%cAt2tF55#5xY{+M1Fne;FbF7B=bAxs&&rpSWTwIt&J4W=Df`8#agT~aDb9S) z@!gRL^BfXYQwuB3wu;_rnZYT(@TQl3e~Le9vf_fT4oqgAd(m!gq zqJ(6M*@BKWixT6IWFz$N=%b?wbV}@==c|M8A$zur@QGKqIM|tPtUV-oP@Ud(sez`V z%?hOgj&~@;(nh0m4!6(VoU;QvevvNQy0caEr=Hb^Umj|(?`N)H1Q@{lK=(K1@K?t0 zPxu1#XTpGB`g_9gALa|tze^bY!+ZhycL~G)$`?+FaeX1oRuB8GVk9qsEn$5s?S0{; zU&;GOq>IEvv2zZa!o=*+doNeM~ej0N*43HAp&tJ%rJ$c%!rL?k7*>9>0} z1H?xm46uFAVlCjAr)-AluUHbj<9TiM@4Mmg%@f^*fPqnmnxU{mhtU z?nG187Sgkt8!O++C zRf9F-yY)j1VXx0ts$nnB*tepYejUtHxwF_Ofl4I@%gC6CSHGa_~rnqW9@R^TJPG=K_w$d7SFTwuPR+-MwS~wIH8dUxuIZqJ3UZ>T^hB z$ZUiI%{!fMa8%D!uGFJssz$PPQ{rw7Heg~oQ8JNc^Q&92P@@np@#2NdZw8@|-%h8m zq1jD0f6*Flj8eI92T}! z640D%4mLa~(7Cq$DG)pQ(#;rDroh)mMRu#)owUBU!>;CrWqvCYF2C5fJS;_}TE<B&SxA-&sNQx`sFjy^w4!xadg zyL++B6~YCDMXmGVL=SK9_&hOdp?UM+-t*J^es+?y^?dLwJZ8E$84(Eu`Omo4Ue zR8Z1#wq!vkRv&vd*CL!k;@fM}y%P40JYD4RmnWq|jMEfjypom?l9t`F z&)(IEOBtYFX=

)k$Y;GKjA8TrKhsc+_eoGAOnA(&cYImW+>q7N0Z*Cb9m7uQ6)+Spizr zdW`%}wa4m9uh4cv7bBFqRJ$nEyh3?-&TKm;kGHaO3n!Y}*uJS^U3+S!m<|HxSkNCb zp5{!I7@}=eGR>CFt9!?6+L}@y4a_;;d3gS0$E5!aNhO5D5u*%n$eIo!DP2H5wppA? ze7=kn&oOF|r7pNC(Eg#>%v-B_{sOyzMzZPfka$py96!1bTBC#5fX@PsSq#@qs)E(b zr)lhLUT=qvNTMr0ZEBp0S3htRN{))ScQ0Ue{NO|WBeI26^NbN2w=YzLbbur#D?(E{);@quGsKvigR?sp!qkUjd?8^Lf8De{8B7}+I^KFN%nFznjVou!#p$WD)8kLZ` z?c<$Q72e&!*@!Bop{chY-;OSew{?mOlA?OY-gJT@9d2IVpWRFWf2FuLkZ555RhQqs zZ8s7uSUDX~8kBiY&s^}T{j2m9pm3ms;5X{yccX<>Zd-C6U{02K8n9>OxoQclO@dWvJ<9HU97@n zch<_a_<+cY^nwH6S}v%Q!M$0D#PMv!G)#i>4)V~7{*&XQC+VLU0W{e>gc9~+Z@Nfk04qK}q)`S$yLB$^{~ zT*dWZlO7}a`m@oQB<;_PrUTkJL-LHChOQKct3N$=l}l_Nn~N`c5z#p;`y}iX77(1p zyT1SkXLpr=!JP~KV?4!A@gX^QBX5j-`Zz?#mfX9d3Z%4>J!#hwcKyTi4FFbPbxa5L z{mgjHU`0#|z`{Qb_?#B}um68n%AlX5vM2wq%=ZWJh5mJ^>_5zWe-K~jUzf^SW{kdP zT)*XFzN9YsLo6hOa zh5rFTJ@6OP-{J@Q4M2b8sQ~b&SLL7Ilz$dNLexX+E5H z;AF{puxc`%#K8)fF(Lfyr>C(~IIjn5&(Gbjp}zHrdh04C@7%{SFR2eHa4klyE#ykUWC>ad?Qz;U4r zHDL^O&mVdN0A3;i=XVKAjt=t4gu1M}{CGWAC7e z-@hw=cvqXi#34aPzq>{j80=tvWgK$Sf0%fJ>g|CO$?oT#z`U^|Lu@Pj_2tNCV1CcR zDoP@YbzM%N_nKD_LMv8G3o&A&u1{(6Y>M-#E%J^+O;y1hH)9N@nhbGxC!zr(a^$Q? zmHFphJzKuRY)mSFYHCB&%!=8gj$H30RaCh*9t3BclT0b6klm^@2HkS(ARlrD|6FTCo(JO;<_oCQSFWZG*U#?t5yHGr$XbsZF zDRR{=eZ*fJf49c#%fj8~CMWS+)RRTx77NYl2S@%=!E2M_SFDfPR6=1W3f-!NL6^+! zvla*ov6nqswyjG$6NTC?_u5}u6O6y-+k$#FCu6&xEA9%*GmW~HpQQ{jK{%H4OFm&b z+3T4`>^uj^?dht{_fdFzfi$Yh?*!G_4?e|Ph4hFG}gl+@b| om$eD{VsHDefj4_wCk`IQ*|bjxCCov9U5{T`Oj(rV&(Dbe0eXnLO#lD@ delta 920 zcmZuwUr19?7{A}P=GDo(Tcu(;z3Y!grK~8mp=D$$iOmKrn{B8>N?0x%p+u>alnA-L z9<)aGhYAX`%XtaxAz$)EntO=s!H0oR$R4t%D8asSZc;?|<^0Zfe&6qW-|u|)4Ks}P z8%AnD!D;)j_8}iYVVZ0MG#l>-m=E~cG$PKYG0nVWRFqWwX$i6RlvO?D6J@q(omD5tS;NgZ&clOz+g^95O~VJ7qgN)l@l8sQ(%xJW-aIi>@u3L z%cEdal_LjbI@M$cpnuzGoU@p4SS_ReGO52I^fL9+F;=i8m&;Xbo#K~i z@+H<;cz{EfZ;Tz;Zr5Q9i+0Qt4R+4xv@okI-nRyqN;qVy>m^?z9%?MP=jIx`yO%>v zCTljAK3#*cvL0TttwuT~d8H<)LDD~k#akU^n0`5iLaBm7e9@g@PLZ 0) and (EndChar < NewText.Length + 1) then + // Exclude results beyond EndChar + while (Result > 0) and ((fMatchCollection[Result - 1].Index + fMatchCollection[Result - 1].Length) > EndChar) do + Dec(Result); + fResultCount := Result; +end; +// replace new line and tab symbol to real chars +function TSynEditRegexSearch.PreprocessReplaceExpression( + const AReplace: string): string; begin - FPositions.Clear; - fLengths.Clear; - if FRegex.Exec(NewText) then - begin - AddResult(FRegex.MatchPos[0], FRegex.MatchLen[0]); - Result := 1; - while FRegex.ExecNext do - begin - AddResult(FRegex.MatchPos[0], FRegex.MatchLen[0]); - Inc(Result); - end; - end - else - Result := 0; + Result := StringReplace(AReplace, '\n', WideCRLF, [rfReplaceAll]); + Result := StringReplace(Result, '\t', #9, [rfReplaceAll]); end; -function TSynEditRegexSearch.Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; +function TSynEditRegexSearch.Replace(const aOccurrence, aReplacement: string): string; begin - Result := FRegex.Replace(aOccurrence, aReplacement, True); -end; + Result := RegEx.Replace(aOccurrence, aReplacement); +end; function TSynEditRegexSearch.GetLength(Index: Integer): Integer; begin - Result := Integer(fLengths[Index]); + Result := fMatchCollection[Index].Length; end; -function TSynEditRegexSearch.GetPattern: UnicodeString; +function TSynEditRegexSearch.GetPattern: string; begin - Result := FRegex.Expression; + Result := fPattern; end; function TSynEditRegexSearch.GetResult(Index: Integer): Integer; begin - Result := Integer(FPositions[Index]); + Result := fMatchCollection[Index].Index; end; function TSynEditRegexSearch.GetResultCount: Integer; begin - Result := FPositions.Count; + Result := fResultCount; end; procedure TSynEditRegexSearch.SetOptions(const Value: TSynSearchOptions); begin - FRegex.ModifierI := not(ssoMatchCase in Value); + if ssoMatchCase in Value then + fOptions := [] + else + fOptions := [roIgnoreCase]; + RegEx := TRegEx.Create(fPattern, fOptions); + RegEx.AddRawOptions(PCRE_UCP); end; -procedure TSynEditRegexSearch.SetPattern(const Value: UnicodeString); +procedure TSynEditRegexSearch.SetPattern(const Value: string); begin - FRegex.Expression := Value; + fPattern := Value; + RegEx := TRegEx.Create(fPattern, fOptions); + RegEx.AddRawOptions(PCRE_UCP); end; end. diff --git a/Ext/SynEdit/Source/SynEditScrollBars.pas b/Ext/SynEdit/Source/SynEditScrollBars.pas new file mode 100644 index 0000000..cb6d6a4 --- /dev/null +++ b/Ext/SynEdit/Source/SynEditScrollBars.pas @@ -0,0 +1,789 @@ +{ ------------------------------------------------------------------------------ + 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. + + Contributors to the SynEdit and mwEdit projects are listed in the + Contributors.txt file. + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License Version 2 or later (the "GPL"), in which case + the provisions of the GPL are applicable instead of those above. + If you wish to allow use of your version of this file only under the terms + of the GPL and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the GPL. + If you do not delete the provisions above, a recipient may use your version + of this file under either the MPL or the GPL. + ---------------------------------------------------------------------------- } + +unit SynEditScrollBars; + +{$I SynEdit.inc} + +interface + +uses + Winapi.Windows, + Winapi.Messages, + System.SysUtils, + System.UITypes, + Vcl.Controls, + Vcl.Forms, + SynEditTypes; + +{ Factory Method } +function CreateSynEditScrollBars(Editor: TCustomControl): ISynEditScrollBars; + +// Scrolling style hook +type + TSynScrollingStyleHook = class(TScrollingStyleHook) + strict protected + procedure WMMouseMove(var Msg: TWMMouse); message WM_MOUSEMOVE; + procedure WMKeyDown(var Msg: TMessage); message WM_KEYDOWN; + procedure WMKeyUp(var Msg: TMessage); message WM_KEYUP; + procedure DrawHorzScroll(DC: HDC); override; + procedure DrawVertScroll(DC: HDC); override; + end; + + +implementation + +uses + System.Classes, + System.Types, + System.Math, + Vcl.Themes, + Vcl.Graphics, + Vcl.GraphUtil, + SynEdit, + SynEditTextBuffer, + SynEditMiscProcs, + SynEditMiscClasses, + SynEditStrConst, + SynEditKeyConst; + +function GetBarScrollInfo(Handle: THandle; AKind: TScrollBarKind): TScrollInfo; +begin + FillChar(Result, SizeOf(Result), 0); + Result.cbSize := SizeOf(Result); + Result.fMask := SIF_ALL; + if AKind = sbHorizontal then + GetScrollInfo(Handle, SB_HORZ, Result) + else + GetScrollInfo(Handle, SB_VERT, Result); +end; + +type + TSynScrollBarState = record + Kind: TScrollBarKind; + Active: Boolean; + nMin: Integer; + nMax: Integer; + nPage: Integer; // Note: Struct define is UINT + nPos: Integer; + class operator Equal(a, b: TSynScrollBarState): Boolean; + class operator NotEqual(a, b: TSynScrollBarState): Boolean; + end; + + TSynEditScrollBars = class(TInterfacedObject, ISynEditScrollBars) + private + FOwner: TCustomSynEdit; + FIsScrolling: Boolean; + FMouseWheelVertAccumulator: Integer; + FMouseWheelHorzAccumulator: Integer; + FPrevHorzSBState: TSynScrollBarState; // Last applied horizontal scrollbar state + FPrevVertSBState: TSynScrollBarState; // Last applied vertical scrollbar state + FNewHorzSBState: TSynScrollBarState; // New Horizontal ScrollBar state + FNewVertSBState: TSynScrollBarState; // New Vertical ScrollBar state + function GetIsScrolling: Boolean; + function GetHorzPageInChars: Integer; + procedure SetScrollBarFromState(const AState: TSynScrollBarState); + procedure SetScrollBarPos(AKind: TScrollBarKind; APos: Integer; ARefresh: Boolean); + procedure ApplyButtonState(const AState: TSynScrollBarState); + procedure UpdateScrollBarsState; + public + constructor Create(AOwner: TCustomSynEdit); + destructor Destroy; override; + function UpdateScrollBars: Boolean; + procedure WMHScroll(var AMsg: TWMScroll); + procedure WMVScroll(var AMsg: TWMScroll); + procedure DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; + MousePos: TPoint); + end; + +{ TSynEditScrollBars } + +constructor TSynEditScrollBars.Create(AOwner: TCustomSynEdit); +begin + inherited Create; + FOwner := AOwner; + FPrevHorzSBState.Kind := sbHorizontal; + FPrevVertSBState.Kind := sbVertical; + FNewHorzSBState.Kind := sbHorizontal; + FNewVertSBState.Kind := sbVertical; +end; + +destructor TSynEditScrollBars.Destroy; +begin + inherited; +end; + +function TSynEditScrollBars.GetHorzPageInChars: Integer; +begin + Result := FOwner.TextAreaWidth div FOwner.CharWidth; +end; + +function TSynEditScrollBars.GetIsScrolling: Boolean; +begin + Result := FIsScrolling; +end; + +procedure TSynEditScrollBars.ApplyButtonState(const AState: TSynScrollBarState); +var + BarKind: Integer; + Btn1Enabled: Boolean; + Btn2Enabled: Boolean; +begin + if AState.Kind = sbHorizontal then + BarKind := SB_HORZ + else + BarKind := SB_VERT; + Btn1Enabled := True; + Btn2Enabled := True; + if (eoDisableScrollArrows in FOwner.ScrollOptions) then + begin + Btn1Enabled := (AState.nPos > AState.nMin); + Btn2Enabled := ((AState.nPos + AState.nPage - AState.nMin) < AState.nMax); + end; + if not Btn1Enabled and not Btn2Enabled then + EnableScrollBar(FOwner.Handle, BarKind, ESB_DISABLE_BOTH) + else + begin + EnableScrollBar(FOwner.Handle, BarKind, ESB_ENABLE_BOTH); + if not Btn1Enabled then + EnableScrollBar(FOwner.Handle, BarKind, ESB_DISABLE_LTUP); + if not Btn2Enabled then + EnableScrollBar(FOwner.Handle, BarKind, ESB_DISABLE_RTDN); + end; +end; + +procedure TSynEditScrollBars.SetScrollBarPos(AKind: TScrollBarKind; + APos: Integer; ARefresh: Boolean); +var + BarKind: Integer; + ScrollInfo: TScrollInfo; +begin + if AKind = sbHorizontal then + BarKind := SB_HORZ + else + BarKind := SB_VERT; + FillChar(ScrollInfo, SizeOf(ScrollInfo), 0); + ScrollInfo.cbSize := SizeOf(ScrollInfo); + ScrollInfo.fMask := SIF_POS; + ScrollInfo.nPos := APos; + SetScrollInfo(FOwner.Handle, BarKind, ScrollInfo, ARefresh); +end; + +procedure TSynEditScrollBars.SetScrollBarFromState(const AState: TSynScrollBarState); +var + WindowStyle: NativeInt; + ScrollInfo: TScrollInfo; + AutoVis: Boolean; + BarKind: Integer; + BarWSCode: Integer; + ScrollbarVisible: Boolean; + HideEnabled: Boolean; +begin + WindowStyle := GetWindowLong(FOwner.Handle, GWL_STYLE); + HideEnabled := (eoHideShowScrollbars in FOwner.ScrollOptions); + if AState.Kind = sbHorizontal then + begin + BarKind := SB_HORZ; + BarWSCode := WS_HSCROLL; + end + else + begin + BarKind := SB_VERT; + BarWSCode := WS_VSCROLL; + end; + ScrollbarVisible := (WindowStyle and BarWSCode <> 0); + FillChar(ScrollInfo, SizeOf(ScrollInfo), 0); + ScrollInfo.cbSize := SizeOf(ScrollInfo); + ScrollInfo.fMask := SIF_ALL; + if AState.Active then + begin + if not HideEnabled then + ScrollInfo.fMask := ScrollInfo.fMask or SIF_DISABLENOSCROLL; + + ScrollInfo.nMin := AState.nMin; + ScrollInfo.nMax := AState.nMax; + ScrollInfo.nPage := AState.nPage; + ScrollInfo.nPos := AState.nPos; + AutoVis := (AState.nMax > AState.nMin) and + (AState.nPage <= (AState.nMax - AState.nMin + 1)); + + if not HideEnabled then + if not ScrollbarVisible then + ShowScrollBar(FOwner.Handle, BarKind, True); + + // Avoid flicker when using HideEnabled option + if HideEnabled and AutoVis then + ApplyButtonState(AState); + + SetScrollInfo(FOwner.Handle, BarKind, ScrollInfo, True); + + // With not HideEnabled option enabling must happen after SetScrollInfo + if not HideEnabled and AutoVis then + ApplyButtonState(AState); + end + else + begin + // Clear the scroll info before hiding + SetScrollInfo(FOwner.Handle, BarKind, ScrollInfo, True); + ShowScrollBar(FOwner.Handle, BarKind, False); + end; +end; + +procedure TSynEditScrollBars.UpdateScrollBarsState; +var + MaxScroll: Integer; +begin + // Do Horz First + FNewHorzSBState.Active := + (FOwner.ScrollBars in [TScrollStyle.ssBoth, TScrollStyle.ssHorizontal]) and + (not FOwner.WordWrap or + (FOwner.WordWrap and (eoWrapWithRightEdge in FOwner.Options) and + (FOwner.WrapAreaWidth > FOwner.TextAreaWidth))); + if FNewHorzSBState.Active then + begin + if FOwner.WordWrap and (eoWrapWithRightEdge in FOwner.Options) then + begin + MaxScroll := (FOwner.WrapAreaWidth div FOwner.CharWidth + 1); + end + else + begin + MaxScroll := (CeilOfIntDiv(TSynEditStringList(FOwner.Lines).MaxWidth, + FOwner.CharWidth) + 1); + if eoScrollPastEol in FOwner.ScrollOptions then + MaxScroll := Max(MaxScroll + 1, + FOwner.LeftChar - 1 + GetHorzPageInChars); // PastEOL adds 1 to MaxScroll. + end; + FNewHorzSBState.nMin := 1; + FNewHorzSBState.nMax := MaxScroll; + FNewHorzSBState.nPage := Max(1, GetHorzPageInChars); + FNewHorzSBState.nPos := FOwner.LeftChar; + end; + + // Now do Vert + FNewVertSBState.Active := FOwner.ScrollBars in [TScrollStyle.ssBoth, TScrollStyle.ssVertical]; + if FNewVertSBState.Active then + begin + MaxScroll := FOwner.DisplayRowCount; + if (eoScrollPastEof in FOwner.ScrollOptions) then + Inc(MaxScroll, FOwner.LinesInWindow - 1); + FNewVertSBState.nMin := 1; + FNewVertSBState.nMax := Max(1, MaxScroll); + FNewVertSBState.nPage := FOwner.LinesInWindow; + FNewVertSBState.nPos := FOwner.TopLine; + end; +end; + +function TSynEditScrollBars.UpdateScrollBars: Boolean; +begin + // Update the scrollbars from the new state info but only if changed. + if FIsScrolling then Exit(False); + + Result := False; + if FOwner.ScrollBars = TScrollStyle.ssNone then + begin + ShowScrollBar(FOwner.Handle, SB_BOTH, False); + Exit; + end; + UpdateScrollBarsState; + if FNewHorzSBState <> FPrevHorzSBState then + begin + SetScrollBarFromState(FNewHorzSBState); + FPrevHorzSBState := FNewHorzSBState; + Result := True; + end; + if FNewVertSBState <> FPrevVertSBState then + begin + SetScrollBarFromState(FNewVertSBState); + FPrevVertSBState := FNewVertSBState; + Result := True; + end; + if Result then + SendMessage(FOwner.Handle, WM_NCPAINT, 0, 0); +end; + +procedure TSynEditScrollBars.WMHScroll(var AMsg: TWMScroll); +var + ScrollInfo: TScrollInfo; +begin + AMsg.Result := 0; + case AMsg.ScrollCode of + // Scrolls to start / end of the line + SB_LEFT: FOwner.LeftChar := 1; + SB_RIGHT: + // Simply set LeftChar property to MaxWidth/FCharWidth + // it would do the range checking and constrain the value if necessary + FOwner.LeftChar := CeilOfIntDiv(TSynEditStringList(FOwner.Lines).MaxWidth, FOwner.CharWidth); + // Scrolls one char left / right + SB_LINERIGHT: FOwner.LeftChar := FOwner.LeftChar + 1; + SB_LINELEFT: FOwner.LeftChar := FOwner.LeftChar - 1; + // Scrolls one page of chars left / right + SB_PAGERIGHT: FOwner.LeftChar := FOwner.LeftChar + + (GetHorzPageInChars - Ord(eoScrollByOneLess in FOwner.ScrollOptions)); + SB_PAGELEFT: FOwner.LeftChar := FOwner.LeftChar + - (GetHorzPageInChars - Ord(eoScrollByOneLess in FOwner.ScrollOptions)); + // Scrolls to the current scroll bar position + SB_THUMBPOSITION, + SB_THUMBTRACK: + begin + FIsScrolling := True; + ScrollInfo := GetBarScrollInfo(FOwner.Handle, sbHorizontal); + FOwner.LeftChar := ScrollInfo.nTrackPos; + SetScrollBarPos(sbHorizontal, ScrollInfo.nTrackPos, False); + end; + SB_ENDSCROLL: + begin + FIsScrolling := False; + UpdateScrollBars; + end; + end; + if Assigned(FOwner.OnScroll) then FOwner.OnScroll(Self, sbHorizontal); +end; + +var + ScrollHintWnd: THintWindow; + +function GetScrollHint: THintWindow; +begin + if ScrollHintWnd = nil then + ScrollHintWnd := HintWindowClass.Create(Application); + Result := ScrollHintWnd; +end; + +procedure TSynEditScrollBars.WMVScroll(var AMsg: TWMScroll); +var + s: string; + rc: TRect; + pt: TPoint; + ScrollHint: THintWindow; + ButtonH: Integer; + ScrollInfo: TScrollInfo; +begin + AMsg.Result := 0; + case AMsg.ScrollCode of + // Scrolls to start / end of the text + SB_TOP: FOwner.TopLine := 1; + SB_BOTTOM: FOwner.TopLine := FOwner.DisplayRowCount; + // Scrolls one line up / down + SB_LINEDOWN: FOwner.TopLine := FOwner.TopLine + 1; + SB_LINEUP: FOwner.TopLine := FOwner.TopLine - 1; + // Scrolls one page of lines up / down + SB_PAGEDOWN: FOwner.TopLine := FOwner.TopLine + + (FOwner.LinesInWindow - Ord(eoScrollByOneLess in FOwner.ScrollOptions)); + SB_PAGEUP: FOwner.TopLine := FOwner.TopLine + - (FOwner.LinesInWindow - Ord(eoScrollByOneLess in FOwner.ScrollOptions)); + // Scrolls to the current scroll bar position + SB_THUMBPOSITION, + SB_THUMBTRACK: + begin + FIsScrolling := True; + ScrollInfo := GetBarScrollInfo(FOwner.Handle, sbVertical); + FOwner.TopLine := ScrollInfo.nTrackPos; + if eoShowScrollHint in FOwner.ScrollOptions then + begin + ScrollHint := GetScrollHint; + ScrollHint.Color := FOwner.ScrollHintColor; + case FOwner.ScrollHintFormat of + shfTopLineOnly: + s := Format(SYNS_ScrollInfoFmtTop, [FOwner.RowToLine(FOwner.TopLine)]); + else + s := Format(SYNS_ScrollInfoFmt, [FOwner.RowToLine(FOwner.TopLine), + FOwner.RowToLine(FOwner.TopLine + Min(FOwner.LinesInWindow, FOwner.DisplayRowCount - FOwner.TopLine))]); + end; + + rc := ScrollHint.CalcHintRect(200, s, nil); + if eoScrollHintFollows in FOwner.ScrollOptions then + begin + ButtonH := GetSystemMetrics(SM_CYVSCROLL); + pt := FOwner.ClientToScreen(Point(FOwner.ClientWidth - rc.Right - 4, + ((rc.Bottom - rc.Top) shr 1) + //half the size of the hint window + Round((ScrollInfo.nTrackPos / ScrollInfo.nMax) * //The percentage of the page that has been scrolled + (FOwner.ClientHeight - (ButtonH * 2))) //The height minus the arrow buttons + + ButtonH)); //The height of the top button + end + else + pt := FOwner.ClientToScreen(Point(FOwner.ClientWidth - rc.Right - 4, 10)); + + OffsetRect(rc, pt.x, pt.y); + ScrollHint.ActivateHint(rc, s); + ScrollHint.Update; + end; + SetScrollBarPos(sbVertical, ScrollInfo.nTrackPos, False); + end; + // Ends scrolling + SB_ENDSCROLL: + begin + FIsScrolling := False; + if eoShowScrollHint in FOwner.ScrollOptions then + ShowWindow(GetScrollHint.Handle, SW_HIDE); + UpdateScrollBars; + end; + end; + if Assigned(FOwner.OnScroll) then FOwner.OnScroll(Self,sbVertical); +end; + +procedure TSynEditScrollBars.DoMouseWheel(Shift: TShiftState; + WheelDelta: Integer; MousePos: TPoint); +var + WheelClicks: Integer; + LinesToScroll: Integer; + CharsToScroll: Integer; +begin + if [ssCtrl, ssAlt, ssShift, ssHorizontal] * Shift = [ssCtrl] then + begin + FMouseWheelVertAccumulator := 0; + FOwner.Zoom(Sign(WheelDelta)); + end + else if ([ssShift, ssCtrl] * Shift <> [ssShift]) and not (ssHorizontal in Shift) then + begin + // Vertical wheel scrolling + LinesToScroll := Mouse.WheelScrollLines; + if [ssShift, ssCtrl] * Shift = [ssShift, ssCtrl] then + LinesToScroll := FOwner.LinesInWindow div 2; + Inc(FMouseWheelVertAccumulator, WheelDelta); + WheelClicks := FMouseWheelVertAccumulator div WHEEL_DELTA; + FMouseWheelVertAccumulator := FMouseWheelVertAccumulator mod WHEEL_DELTA; + FOwner.TopLine := FOwner.TopLine - WheelClicks * LinesToScroll; + if Assigned(FOwner.OnScroll) then FOwner.OnScroll(Self, sbVertical); + end + else + begin + // Horizontal wheel or tilt scrolling + SystemParametersInfo(SPI_GETWHEELSCROLLCHARS, 0, CharsToScroll, 0); + if [ssShift, ssCtrl] * Shift = [ssShift, ssCtrl] then + CharsToScroll := GetHorzPageInChars div 2; + Inc(FMouseWheelHorzAccumulator, WheelDelta); + WheelClicks := FMouseWheelHorzAccumulator div WHEEL_DELTA; + FMouseWheelHorzAccumulator := FMouseWheelHorzAccumulator mod WHEEL_DELTA; + FOwner.LeftChar := FOwner.LeftChar - WheelClicks * CharsToScroll; + if Assigned(FOwner.OnScroll) then FOwner.OnScroll(Self, sbHorizontal); + end; +end; + +{ TSynScrollBarState } + +class operator TSynScrollBarState.Equal(a, b: TSynScrollBarState): Boolean; +begin + Result := + (a.Kind = b.Kind) and + (a.Active = b.Active) and + (a.nMin = b.nMin) and + (a.nMax = b.nMax) and + (a.nPage = b.nPage) and + (a.nPos = b.nPos); +end; + +class operator TSynScrollBarState.NotEqual(a, b: TSynScrollBarState): Boolean; +begin + Result := not (a = b); +end; + +{ Factory Method} + +function CreateSynEditScrollBars(Editor: TCustomControl): ISynEditScrollBars; +begin + if (Editor is TCustomSynEdit) then + Result := TSynEditScrollBars.Create(TCustomSynEdit(Editor)) + else + raise Exception.Create('SynEditScrollBars will only work with SynEdit.'); +end; + +{$REGION 'TSynScrollingStyleHook'} + +{ TSynScrollingStyleHook } + +procedure TSynScrollingStyleHook.DrawHorzScroll(DC: HDC); +var + LBitmap: TBitmap; + Details: TThemedElementDetails; + R, LHorzScrollRect: TRect; + LPPI: Integer; + LStyle: TCustomStyleServices; + BtnEnabled: Boolean; + ScrollInfo: TScrollInfo; +begin + if Handle = 0 then Exit; + if DC = 0 then Exit; + LPPI := Control.CurrentPPI; + LStyle := StyleServices; + LHorzScrollRect := HorzScrollRect; + if (LHorzScrollRect.Height > 0) and (LHorzScrollRect.Width > 0) then + begin + LBitmap := TBitmap.Create; + try + LBitmap.Width := LHorzScrollRect.Width; + LBitmap.Height := LHorzScrollRect.Height; + MoveWindowOrg(LBitmap.Canvas.Handle, -LHorzScrollRect.Left, -LHorzScrollRect.Top); + if LStyle.Available then + begin + R := LHorzScrollRect; + R.Left := HorzUpButtonRect.Right; + R.Right := HorzDownButtonRect.Left; + if (R.Height > 0) and (R.Width > 0) then + begin + Details := LStyle.GetElementDetails(tsUpperTrackHorzNormal); + LStyle.DrawElement(LBitmap.Canvas.Handle, Details, R, nil, LPPI); + end; + + if (HorzSliderRect.Height > 0) and (HorzSliderRect.Width > 0) then + begin + Details := LStyle.GetElementDetails(HorzSliderState); + LStyle.DrawElement(LBitmap.Canvas.Handle, Details, HorzSliderRect, nil, LPPI); + end; + + with TCustomSynEdit(Control) do + BtnEnabled := not (eoDisableScrollArrows in ScrollOptions) or (LeftChar > 1); + if (HorzSliderRect.Height > 0) and BtnEnabled then + Details := LStyle.GetElementDetails(HorzUpState) + else + Details := LStyle.GetElementDetails(tsArrowBtnLeftDisabled); + LStyle.DrawElement(LBitmap.Canvas.Handle, Details, HorzUpButtonRect, nil, LPPI); + + ScrollInfo := GetBarScrollInfo(Control.Handle, sbHorizontal); + BtnEnabled := ([eoDisableScrollArrows, eoScrollPastEol] * + TCustomSynEdit(Control).ScrollOptions <> [eoDisableScrollArrows]) or + (ScrollInfo.nPos <= ScrollInfo.nMax - Integer(ScrollInfo.nPage)); + if (HorzSliderRect.Height > 0) and BtnEnabled then + Details := LStyle.GetElementDetails(HorzDownState) + else + Details := LStyle.GetElementDetails(tsArrowBtnRightDisabled); + LStyle.DrawElement(LBitmap.Canvas.Handle, Details, HorzDownButtonRect, nil, LPPI); + end; + MoveWindowOrg(LBitmap.Canvas.Handle, LHorzScrollRect.Left, LHorzScrollRect.Top); + BitBlt(DC, LHorzScrollRect.Left, LHorzScrollRect.Top, LBitmap.Width, LBitmap.Height, + LBitmap.Canvas.Handle, 0, 0, SRCCOPY); + finally + LBitmap.Free; + end; + end; +end; + +procedure TSynScrollingStyleHook.DrawVertScroll(DC: HDC); +var + LBitmap: TBitmap; + Details: TThemedElementDetails; + R, AnnRect: TRect; + LPPI: Integer; + LStyle: TCustomStyleServices; + LVertScrollRect, LVertSliderRect: TRect; + Editor: TCustomSynEdit; + Ann: TSynScrollbarAnnItem; + I, J, Row, RowCount: Integer; + Rows: TArray; + Colors: TArray; + Color: TColor; + AnnWidth: Integer; + SliderBitmap: TBitmap; + BtnEnabled: Boolean; + MaxScroll: Integer; +begin + if Handle = 0 then Exit; + if DC = 0 then Exit; + LPPI := Control.CurrentPPI; + LStyle := StyleServices; + LVertScrollRect := VertScrollRect; + LVertSliderRect := VertSliderRect; + Editor := Control as TCustomSynEdit; + if (LVertScrollRect.Width > 0) and (LVertScrollRect.Height > 0) then + begin + LBitmap := TBitmap.Create; + try + LBitmap.Width := LVertScrollRect.Width; + LBitmap.Height := LVertScrollRect.Height; + if LStyle.Available then + begin + MoveWindowOrg(LBitmap.Canvas.Handle, -LVertScrollRect.Left, -LVertScrollRect.Top); + R := LVertScrollRect; + R.Top := VertUpButtonRect.Bottom; + R.Bottom := VertDownButtonRect.Top; + if (R.Height > 0) and (R.Width > 0) then + begin + Details := LStyle.GetElementDetails(tsUpperTrackVertNormal); + LStyle.DrawElement(LBitmap.Canvas.Handle, Details, R, nil, LPPI); + end; + + if Editor.ScrollbarAnnotations.Count = 0 then + begin + if (LVertSliderRect.Height > 0) and (LVertSliderRect.Width > 0) then + begin + Details := LStyle.GetElementDetails(VertSliderState); + LStyle.DrawElement(LBitmap.Canvas.Handle, Details, LVertSliderRect, nil, LPPI); + end; + end; + + with TCustomSynEdit(Control) do + BtnEnabled := not (eoDisableScrollArrows in ScrollOptions) or (TopLine > 1); + + if (LVertSliderRect.Height <> 0) and BtnEnabled then + Details := LStyle.GetElementDetails(VertUpState) + else + Details := LStyle.GetElementDetails(tsArrowBtnUpDisabled); + LStyle.DrawElement(LBitmap.Canvas.Handle, Details, VertUpButtonRect, nil, LPPI); + + with TCustomSynEdit(Control) do + begin + if (eoScrollPastEof in ScrollOptions) then + MaxScroll := DisplayRowCount + else + MaxScroll := DisplayRowCount - LinesInWindow + 1; + BtnEnabled := not (eoDisableScrollArrows in ScrollOptions) or (TopLine < MaxScroll); + end; + + if (LVertSliderRect.Height <> 0) and BtnEnabled then + Details := LStyle.GetElementDetails(VertDownState) + else + Details := LStyle.GetElementDetails(tsArrowBtnDownDisabled); + LStyle.DrawElement(LBitmap.Canvas.Handle, Details, VertDownButtonRect, nil, LPPI); + + MoveWindowOrg(LBitmap.Canvas.Handle, LVertScrollRect.Left, LVertScrollRect.Top + VertUpButtonRect.Height); + + // Scrollbar Annotations + + RowCount := Editor.DisplayRowCount; + if (RowCount > Editor.LinesInWindow) and (LVertSliderRect.Height > 0) + and (R.Height > 0) and (R.Width > 0) + then + begin + LBitmap.Canvas.Brush.Style := bsSolid; + + RowCount := Editor.DisplayRowCount; + AnnWidth := Max(R.Width div 5, 1); // Allow 5 annotations per row + for I := 0 to Editor.ScrollbarAnnotations.Count - 1 do + begin + Ann := Editor.ScrollbarAnnotations[I]; + + case Ann.AnnPos of + sbpLeft, sbpFullWidth: AnnRect.Left := 0; + sbpSecondLeft: AnnRect.Left := AnnWidth; + sbpMiddle: AnnRect.Left := 2 * AnnWidth; + sbpSecondRight: AnnRect.Left := R.Width - 2 * AnnWidth; + sbpRight: AnnRect.Left := R.Width - AnnWidth; + end; + if Ann.AnnPos = sbpFullWidth then + AnnRect.Right := R.Width + else + AnnRect.Right := AnnRect.Left + AnnWidth; + + Ann.GetInfo(Rows, Colors); + + J := Low(Rows); + while J <= High(Rows) do + begin + Row := Rows[J]; + AnnRect.Top := Muldiv(R.Height, Row - 1, RowCount); + if Ann.FullRow then + AnnRect.Bottom := Max(Muldiv(R.Height, Row, RowCount), + AnnRect.Top + MulDiv(1, LPPI, 96)) + else + AnnRect.Bottom := AnnRect.Top + MulDiv(1, LPPI, 96); + + if Length(Colors) = 1 then + Color := Colors[0] + else + Color := Colors[J]; + + // Merge same annotations + while Ann.FullRow and (J < High(Rows)) and + (Rows[J + 1] = Row + 1) and + ((Length(Colors) = 1) or (Colors[J] = Colors[J + 1])) do + begin + Inc(J); + Row := Rows[J]; + AnnRect.Bottom := Muldiv(R.Height, Row, RowCount); + end; + + LBitmap.Canvas.Brush.Color := Color; + LBitmap.Canvas.FillRect(AnnRect); + + Inc(J); + end;; + end; + end; + + MoveWindowOrg(LBitmap.Canvas.Handle, 0, -VertUpButtonRect.Height); + + // Alpha blend the slider + if (Editor.ScrollbarAnnotations.Count > 0) and + (LVertSliderRect.Height > 0) and (LVertSliderRect.Width > 0) + then + begin + SliderBitmap := TBitmap.Create; + try + SliderBitmap.PixelFormat := pf32bit; + SliderBitmap.Canvas.Brush.Color := clBlack; // 0 opacity + SliderBitmap.SetSize(LVertSliderRect.Width, LVertSliderRect.Height); + Details := LStyle.GetElementDetails(VertSliderState); + LStyle.DrawElement(SliderBitmap.Canvas.Handle, Details, + Rect(0, 0, LVertSliderRect.Width, LVertSliderRect.Height), nil, LPPI); + LBitmap.Canvas.Draw(0, LVertSliderRect.Top - LVertScrollRect.Top, + SliderBitmap, 80 * 255 div 100); // 80% opacity + finally + SliderBitmap.Free; + end; + end; + end; + BitBlt(DC, LVertScrollRect.Left, LVertScrollRect.Top, LBitmap.Width, + LBitmap.Height, LBitmap.Canvas.Handle, 0, 0, SRCCOPY); + finally + LBitmap.Free; + end; + end; +end; + +// Workaround for https://embt.atlassian.net/servicedesk/customer/portal/1/RSS-2252 + +{ TScrollingStyleHookHelper } +type + TScrollingStyleHookHelper = class helper for TScrollingStyleHook + procedure SetLeftButtonDownToFalse; + end; + +procedure TScrollingStyleHookHelper.SetLeftButtonDownToFalse; +begin + with Self do + FLeftButtonDown := False; +end; + +procedure TSynScrollingStyleHook.WMKeyDown(var Msg: TMessage); +begin + CallDefaultProc(TMessage(Msg)); + Handled := True; +end; + +procedure TSynScrollingStyleHook.WMKeyUp(var Msg: TMessage); +begin + CallDefaultProc(TMessage(Msg)); + Handled := True; +end; + +procedure TSynScrollingStyleHook.WMMouseMove(var Msg: TWMMouse); +begin + if not (ssLeft in KeysToShiftState(Msg.Keys)) then + SetLeftButtonDownToFalse; + inherited; +end; + +{$ENDREGION 'TSynScrollingStyleHook'} + + +end. diff --git a/Ext/SynEdit/Source/SynEditSearch.pas b/Ext/SynEdit/Source/SynEditSearch.pas index f7add5e..1263ad2 100644 --- a/Ext/SynEdit/Source/SynEditSearch.pas +++ b/Ext/SynEdit/Source/SynEditSearch.pas @@ -1,4 +1,4 @@ -{------------------------------------------------------------------------------- +{------------------------------------------------------------------------------- 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 @@ -28,17 +28,10 @@ If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: SynEditSearch.pas,v 1.12.2.6 2009/09/29 00:16:46 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - Known Issues: -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITSEARCH} unit SynEditSearch; -{$ENDIF} {$I SynEdit.inc} @@ -54,26 +47,29 @@ interface TSynEditSearch = class(TSynEditSearchCustom) private Run: PWideChar; - FOrigin: PWideChar; - FTheEnd: PWideChar; - FPat, FCasedPat: UnicodeString; - FCount: Integer; - FTextLen: Integer; - FLookAt: Integer; - FPatLen, FPatLenSucc: Integer; - FShift: array[WideChar] of Integer; - FCaseSensitive: Boolean; - FWhole: Boolean; - FResults: TList; - FShiftInitialized: Boolean; - FTextToSearch: UnicodeString; + Origin: PWideChar; + TheEnd: PWideChar; + Pat, CasedPat: string; + fCount: Integer; + fTextLen: Integer; + FLineStart: PWideChar; + Look_At: Integer; + PatLen, PatLenSucc: Integer; + Shift: array[WideChar] of Integer; + fBackwards: Boolean; + fCaseSensitive: Boolean; + fWhole: Boolean; + fResults: TList; + fShiftInitialized: Boolean; + FTextToSearch: string; function GetFinished: Boolean; procedure InitShiftTable; procedure SetCaseSensitive(const Value: Boolean); + function IsWordBreakChar(C: WideChar): Boolean; protected function TestWholeWord: Boolean; - procedure SetPattern(const Value: UnicodeString); override; - function GetPattern: UnicodeString; override; + procedure SetPattern(const Value: string); override; + function GetPattern: string; override; function GetLength(Index: Integer): Integer; override; function GetResult(Index: Integer): Integer; override; function GetResultCount: Integer; override; @@ -81,18 +77,20 @@ TSynEditSearch = class(TSynEditSearchCustom) public constructor Create(aOwner: TComponent); override; destructor Destroy; override; - - function FindAll(const NewText: UnicodeString): Integer; override; - function Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; override; - function FindFirst(const NewText: UnicodeString): Integer; + function FindAll(const NewText: string; StartChar: Integer = 1; + EndChar: Integer = 0): Integer; override; + function Replace(const aOccurrence, aReplacement: string): string; override; + function FindFirst(const NewText: string; StartChar, EndChar: Integer): Integer; + function FindLast(const NewText: string; StartChar, EndChar: Integer): Integer; procedure FixResults(First, Delta: Integer); function Next: Integer; - - property Count: Integer read FCount write FCount; + function Prev: Integer; + property Count: Integer read fCount write fCount; property Finished: Boolean read GetFinished; - property Pattern read FCasedPat; - property CaseSensitive: Boolean read FCaseSensitive write SetCaseSensitive; - property Whole: Boolean read FWhole write FWhole; + property Pattern read CasedPat; + property Backwards: Boolean read fBackwards write fBackwards; + property CaseSensitive: Boolean read fCaseSensitive write SetCaseSensitive; + property Whole: Boolean read fWhole write fWhole; end; implementation @@ -104,36 +102,36 @@ implementation constructor TSynEditSearch.Create(aOwner: TComponent); begin inherited; - FResults := TList.Create; + fResults := TList.Create; end; function TSynEditSearch.GetFinished: Boolean; begin - Result := (Run >= FTheEnd) or (FPatLen >= FTextLen); + Result := (Run >= TheEnd) or (PatLen >= fTextLen); end; function TSynEditSearch.GetResult(Index: Integer): Integer; begin Result := 0; - if (Index >= 0) and (Index < FResults.Count) then - Result := Integer(FResults[Index]); + if (Index >= 0) and (Index < fResults.Count) then + Result := Integer(fResults[Index]); end; function TSynEditSearch.GetResultCount: Integer; begin - Result := FResults.Count; + Result := fResults.Count; end; procedure TSynEditSearch.FixResults(First, Delta: Integer); var - i: Integer; + I: Integer; begin - if (Delta <> 0) and (FResults.Count > 0) then begin - i := Pred(FResults.Count); - while i >= 0 do begin - if Integer(FResults[i]) <= First then Break; - FResults[i] := Pointer(Integer(FResults[i]) - Delta); - Dec(i); + if (Delta <> 0) and (fResults.Count > 0) then begin + I := Pred(fResults.Count); + while I >= 0 do begin + if Integer(fResults[I]) <= First then Break; + fResults[I] := pointer(Integer(fResults[I]) - Delta); + Dec(I); end; end; end; @@ -143,28 +141,28 @@ procedure TSynEditSearch.InitShiftTable; C: WideChar; I: Integer; begin - FPatLen := Length(FPat); - if FPatLen = 0 then raise Exception.Create('Pattern is empty'); - FPatLenSucc := FPatLen + 1; - FLookAt := 1; - for C := Low(WideChar) to High(WideChar) do FShift[C] := FPatLenSucc; - for I := 1 to FPatLen do FShift[FPat[I]] := FPatLenSucc - I; - while FLookAt < FPatLen do + PatLenSucc := PatLen + 1; + Look_At := 1; + for C := Low(WideChar) to High(WideChar) do Shift[C] := PatLenSucc; + for I := 1 to PatLen do Shift[Pat[I]] := PatLenSucc - I; + while Look_at < PatLen do begin - if FPat[FPatLen] = FPat[FPatLen - FLookAt] then Break; - Inc(FLookAt); + if Pat[PatLen] = Pat[PatLen - Look_at] then Break; + Inc(Look_at); end; - FShiftInitialized := True; -end; + fShiftInitialized := True; +end; -// TODO: would be more intelligent to use IsWordBreakChar for SynEdit -function IsWordBreakChar(C: WideChar): Boolean; +function TSynEditSearch.IsWordBreakChar(C: WideChar): Boolean; begin + if Assigned(FIsWordBreakFunction) then + Exit(FIsWordBreakFunction(C)); + case C of - #0..#32, '.', ',', ';', ':', '"', '''', WideChar(#$00B4), WideChar(#$0060), - WideChar(#$00B0), '^', '!', '?', '&', '$', '@', WideChar(#$00A7), '%', '#', - '~', '[', ']', '(', ')', '{', '}', '<', '>', '-', '=', '+', '*', '/', - '\', '|': + #0..#32, '.', ',', ';', ':', '"', '''', #$00B4, '`', + #$00B0, '^', '!', '?', '&', '$', '@', #$00A7, '%', + '#', '~', '[', ']', '(', ')', '{', '}', '<', '>', '-', '=', '+', '*', + '/', '\', '|': Result := True; else Result := False; @@ -175,10 +173,10 @@ function TSynEditSearch.TestWholeWord: Boolean; var Test: PWideChar; begin - Test := Run - FPatLen; + Test := Run - PatLen; - Result := ((Test < FOrigin) or IsWordBreakChar(Test[0])) and - ((Run >= FTheEnd) or IsWordBreakChar(Run[1])); + Result := ((Test < FLineStart) or IsWordBreakChar(Test[0])) and + ((Run >= FLineStart + fTextLen) or IsWordBreakChar(Run[1])); end; function TSynEditSearch.Next: Integer; @@ -187,121 +185,189 @@ function TSynEditSearch.Next: Integer; J: PWideChar; begin Result := 0; - Inc(Run, FPatLen); - while Run < FTheEnd do + Inc(Run, PatLen); + while Run < TheEnd do begin - if FPat[FPatLen] <> Run^ then - Inc(Run, FShift[(Run + 1)^]) + if Pat[Patlen] <> Run^ then + Inc(Run, Shift[(Run + 1)^]) else begin - J := Run - FPatLen + 1; + J := Run - PatLen + 1; I := 1; - while FPat[I] = J^ do + while Pat[I] = J^ do begin - if I = FPatLen then + if I = PatLen then begin - if FWhole and not TestWholeWord then Break; - Inc(FCount); - Result := Run - FOrigin - FPatLen + 2; + if fWhole and not TestWholeWord then Break; + Inc(fCount); + Result := Run - FLineStart - Patlen + 2; Exit; end; Inc(I); Inc(J); end; - Inc(Run, FLookAt); - if Run >= FTheEnd then + Inc(Run, Look_At); + if Run >= TheEnd then + Break; + Inc(Run, Shift[Run^] - 1); + end; + end; +end; + +function TSynEditSearch.Prev: Integer; +// "Naive" backward search +// Run points to the last char of the pattern in the search string +// as in Next so that we can reuse TestWholeWord. +var + I: Integer; + PTrial: PChar; +begin + Result := 0; + while Run >= Origin + PatLen do + begin + Dec(Run); + PTrial := Run - PatLen + 1; + I := PatLen; + while I >= 1 do + begin + if PTrial[I - 1] <> Pat[I] then Break; - Inc(Run, FShift[Run^] - 1); + Dec(I); + end; + if (I = 0) and (not fWhole or TestWholeWord) then + begin + Result := PTrial - FLineStart + 1; + Run := PTrial; + Exit; end; end; + Run := Origin; end; destructor TSynEditSearch.Destroy; begin - FResults.Free; + fResults.Free; inherited Destroy; end; -procedure TSynEditSearch.SetPattern(const Value: UnicodeString); +procedure TSynEditSearch.SetPattern(const Value: string); begin - if FPat <> Value then + if Pat <> Value then begin - FCasedPat := Value; + CasedPat := Value; if CaseSensitive then - FPat := FCasedPat + Pat := CasedPat else - FPat := SynWideLowerCase(FCasedPat); - FShiftInitialized := False; + Pat := SysUtils.AnsiLowerCase(CasedPat); + fShiftInitialized := False; end; - FCount := 0; + fCount := 0; end; procedure TSynEditSearch.SetCaseSensitive(const Value: Boolean); begin - if FCaseSensitive <> Value then + if fCaseSensitive <> Value then begin - FCaseSensitive := Value; - if FCaseSensitive then - FPat := FCasedPat + fCaseSensitive := Value; + if fCaseSensitive then + Pat := CasedPat else - FPat := SynWideLowerCase(FCasedPat); - FShiftInitialized := False; + Pat := SysUtils.AnsiLowerCase(CasedPat); + fShiftInitialized := False; end; end; -function TSynEditSearch.FindAll(const NewText: UnicodeString): Integer; +function TSynEditSearch.FindAll(const NewText: string; StartChar: Integer = 1; + EndChar: Integer = 0): Integer; +// Uses a Boyer-Moore algorithm for forward seach and a "naive" one +// for backward search var Found: Integer; begin + if EndChar = 0 then + EndChar := NewText.Length + 1; + fTextLen := Length(NewText); + PatLen := Length(Pat); + + if Patlen = 0 then + raise Exception.Create('Pattern is empty'); + // never shrink Capacity - FResults.Count := 0; - Found := FindFirst(NewText); - while Found > 0 do + fResults.Count := 0; + + if (fTextLen = 0) or (EndChar <= StartChar) or (fTextLen < PatLen) or + (PatLen > EndChar - StartChar) + then + Exit(0); + + if CaseSensitive then + FTextToSearch := NewText + else + FTextToSearch := SysUtils.AnsiLowerCase(NewText); + FLineStart := PWideChar(FTextToSearch); + + if Backwards then begin - FResults.Add(Pointer(Found)); - Found := Next; + Found := FindLast(NewText, StartChar, EndChar); + while Found > 0 do + begin + fResults.Insert(0, Pointer(Found)); + Found := Prev; + end; + end + else + begin + Found := FindFirst(NewText, StartChar, EndChar); + while Found > 0 do + begin + fResults.Add(Pointer(Found)); + Found := Next; + end; end; - Result := FResults.Count; + Result := fResults.Count; end; -function TSynEditSearch.Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; +function TSynEditSearch.Replace(const aOccurrence, aReplacement: string): string; begin Result := aReplacement; -end; +end; -function TSynEditSearch.FindFirst(const NewText: UnicodeString): Integer; +function TSynEditSearch.FindFirst(const NewText: string; + StartChar, EndChar: Integer): Integer; begin - if not FShiftInitialized then + if not fShiftInitialized then InitShiftTable; - Result := 0; - FTextLen := Length(NewText); - if FTextLen >= FPatLen then - begin - if CaseSensitive then - FTextToSearch := NewText - else - FTextToSearch := SynWideLowerCase(NewText); - FOrigin := PWideChar(FTextToSearch); - FTheEnd := FOrigin + FTextLen; - Run := (FOrigin - 1); - Result := Next; - end; + + Origin := FLineStart + StartChar - 1; + TheEnd := Origin + (EndChar - StartChar); + Run := (Origin - 1); + Result := Next; +end; + +function TSynEditSearch.FindLast(const NewText: string; + StartChar, EndChar: Integer): Integer; +begin + Origin := FLineStart + StartChar - 1; + TheEnd := Origin + EndChar - StartChar; + Run := TheEnd; + Result := Prev; end; function TSynEditSearch.GetLength(Index: Integer): Integer; begin - Result := FPatLen; + Result := PatLen; end; -function TSynEditSearch.GetPattern: UnicodeString; +function TSynEditSearch.GetPattern: string; begin - Result := FCasedPat; + Result := CasedPat; end; procedure TSynEditSearch.SetOptions(const Value: TSynSearchOptions); begin CaseSensitive := ssoMatchCase in Value; Whole := ssoWholeWord in Value; + Backwards := ssoBackwards in Value; end; end. diff --git a/Ext/SynEdit/Source/SynEditStrConst.pas b/Ext/SynEdit/Source/SynEditStrConst.pas index 3cccc0f..907b122 100644 --- a/Ext/SynEdit/Source/SynEditStrConst.pas +++ b/Ext/SynEdit/Source/SynEditStrConst.pas @@ -24,13 +24,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditStrConst.pas,v 1.41.2.5 2009/01/06 16:26:01 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} unit SynEditStrConst; @@ -55,6 +48,7 @@ interface // // const + SYNS_AttrAnchor = 'Anchor'; SYNS_AttrAreaAIdentifier = 'Area_A_Identifier'; SYNS_AttrArrowHead = 'ArrowHead'; SYNS_AttrAsm = 'Asm'; @@ -87,6 +81,7 @@ interface SYNS_AttrDirective = 'Directive'; SYNS_AttrDOCTYPESection = 'DOCTYPE-Section'; SYNS_AttrDocumentation = 'Documentation'; + SYNS_AttrDocumentDelimiter = 'DocumentDelimiter'; SYNS_AttrElementName = 'ElementName'; SYNS_AttrEmbedSQL = 'EmbeddedSQL'; SYNS_AttrEmbedText = 'EmbeddedText'; @@ -108,7 +103,6 @@ interface SYNS_AttrIndirect = 'Indirect'; SYNS_AttrInstructions = 'Instructions'; SYNS_AttrInvalidSymbol = 'InvalidSymbol'; - SYNS_AttrInterfaceQualifier = 'InterfaceQualifier'; SYNS_AttrInternalFunction = 'InternalFunction'; SYNS_AttrKey = 'Key'; SYNS_AttrLabel = 'Label'; @@ -124,6 +118,7 @@ interface SYNS_AttrNonReservedKeyword = 'NonreservedKeyword'; SYNS_AttrNull = 'Null'; SYNS_AttrNumber = 'Number'; + SYNS_AttrNumericValue = 'NumericValue'; SYNS_AttrOctal = 'Octal'; SYNS_AttrOperator = 'Operator'; SYNS_AttrOperatorAndSymbols = 'OperatorAndSymbols'; @@ -165,11 +160,14 @@ interface SYNS_AttrSyntaxError = 'SyntaxError'; SYNS_AttrSystem = 'SystemFunctionsAndVariables'; SYNS_AttrSystemValue = 'SystemValue'; + SYNS_AttrTag = 'Tag'; SYNS_AttrTagArea = 'TagArea'; SYNS_AttrTableName = 'TableName'; + SYNS_AttrTemplate = 'Template'; SYNS_AttrTerminator = 'Terminator'; SYNS_AttrTeXCommand = 'TeX-Command'; SYNS_AttrText = 'Text'; + SYNS_AttrTextValue = 'TextValue'; SYNS_AttrTextMathMode = 'TextInMathMode'; SYNS_AttrThirdTri = 'ThirdTri'; SYNS_AttrTixKeyWords = 'Tix-Keywords'; @@ -204,77 +202,85 @@ interface SYNS_AttrX3DHeader = 'X3DHeader'; // constant language names - SYNS_Lang68HC11 = '68HC11_Assembler'; - SYNS_LangADSP21xx = 'ADSP21xx'; - SYNS_LangAWK = 'AWK'; - SYNS_LangBaan = 'Baan_4GL'; - SYNS_LangBatch = 'MS-DOS_Batch'; - SYNS_LangCache = 'CacheObjectScript'; + SYNS_LangHP48 = 'HP48'; SYNS_LangCAClipper = 'CA-Clipper'; - SYNS_LangCOBOL = 'COBOL'; - SYNS_LangCORBAIDL = 'CORBA_IDL'; SYNS_LangCPM = 'COAS_Product_Manager_Report'; SYNS_LangCPP = 'CandCPlusPlus'; SYNS_LangCS = 'CSharp'; - SYNS_LangCSS = 'CascadingStyleSheet'; + SYNS_LangJava = 'Java'; + SYNS_LangPerl = 'Perl'; + SYNS_LangBatch = 'MS-DOS_Batch'; SYNS_LangDfm = 'BorlandForms'; - SYNS_LangDOT = 'DOT_Graph_Drawing_Description_language'; - SYNS_LangECMAScript = 'ECMAScript'; - SYNS_LangEiffel = 'Eiffel'; - SYNS_LangFortran = 'Fortran'; - SYNS_LangFoxpro = 'Foxpro'; + SYNS_LangAWK = 'AWK'; + SYNS_LangCORBAIDL = 'CORBA_IDL'; + SYNS_LangHTML = 'HTML'; + SYNS_LangVBSScript = 'MS-VBScript'; SYNS_LangGalaxy = 'Galaxy'; - SYNS_LangGembase = 'Gembase'; SYNS_LangGeneral = 'General'; - SYNS_LangGeneralMulti = 'General_Multi-Highlighter'; - SYNS_LangGLSL = 'OpenGL Shader Language'; - SYNS_LangGo = 'Go'; - SYNS_LangGWS = 'GW-TEL'; - SYNS_LangHaskell = 'Haskell'; - SYNS_LangHP48 = 'HP48'; - SYNS_LangHTML = 'HTML'; + SYNS_LangOmni = 'Omni'; + SYNS_LangPascal = 'ObjectPascal'; + SYNS_LangDWScript = 'DWScriptPascal'; + SYNS_LangX86Asm = 'x86Assembly'; + SYNS_LangPython = 'Python'; + SYNS_LangTclTk = 'TclTk'; + SYNS_LangSQL = 'SQL'; + SYNS_LangGembase = 'Gembase'; SYNS_LangINI = 'INI'; - SYNS_LangInno = 'InnoSetupScript'; - SYNS_LangJava = 'Java'; + SYNS_LangSML = 'StandardML'; + SYNS_LangVisualBASIC = 'VisualBasic'; + SYNS_LangADSP21xx = 'ADSP21xx'; + SYNS_LangPHP = 'PHP'; + SYNS_LangSybaseSQL = 'SybaseSQL'; + SYNS_LangGeneralMulti = 'General_Multi-Highlighter'; + SYNS_LangCache = 'CacheObjectScript'; + SYNS_LangCSS = 'CascadingStyleSheet'; SYNS_LangJScript = 'JavaScript'; SYNS_LangJSON = 'JSON'; SYNS_LangKIX = 'KiXtart'; - SYNS_LangLDraw = 'LEGO_LDraw'; - SYNS_LangLLVMIR = 'LLVM IR'; - SYNS_LangMASM = 'x86Assembly MASM'; + SYNS_LangBaan = 'Baan_4GL'; + SYNS_LangFoxpro = 'Foxpro'; + SYNS_LangFortran = 'Fortran'; + SYNS_Lang68HC11 = '68HC11_Assembler'; + SYNS_LangProgress = 'Progress'; + SYNS_LangInno = 'InnoSetupScript'; SYNS_LangModelica = 'Modelica'; SYNS_LangModula3 = 'Modula3'; - SYNS_LangNameUNIXShellScript = 'UNIXShellScript'; - SYNS_LangPascal = 'ObjectPascal'; - SYNS_LangPerl = 'Perl'; - SYNS_LangPHP = 'PHP'; - SYNS_LangProgress = 'Progress'; - SYNS_LangPython = 'Python'; - SYNS_LangRC = 'Resource'; - SYNS_LangRuby = 'Ruby'; SYNS_LangSDD = 'SemantaDataDictionary'; - SYNS_LangSML = 'StandardML'; - SYNS_LangSQL = 'SQL'; - SYNS_LangST = 'StructuredText'; - SYNS_LangSybaseSQL = 'SybaseSQL'; + SYNS_LangXML = 'XML'; + SYNS_LangGWS = 'GW-TEL'; SYNS_LangSynGenMsgfiles = 'SynGen_Msg'; - SYNS_LangTclTk = 'TclTk'; + SYNS_LangUnreal = 'Unreal'; + SYNS_LangST = 'StructuredText'; + SYNS_LangCOBOL = 'COBOL'; SYNS_LangTeX = 'TeX'; + SYNS_LangRC = 'Resource'; + SYNS_LangRuby = 'Ruby'; + SYNS_LangNameUNIXShellScript = 'UNIXShellScript'; + SYNS_LangHaskell = 'Haskell'; + SYNS_LangDOT = 'DOT_Graph_Drawing_Description_language'; + SYNS_LangEiffel = 'Eiffel'; + SYNS_LangLDraw = 'LEGO_LDraw'; + SYNS_LangLLVMIR = 'LLVM IR'; SYNS_LangUnknown = ''; - SYNS_LangUnreal = 'Unreal'; SYNS_LangURI = 'URI'; - SYNS_LangVBSScript = 'MS-VBScript'; - SYNS_LangVisualBASIC = 'VisualBasic'; SYNS_LangVrml97 = 'Vrml97'; - SYNS_LangX86Asm = 'x86Assembly'; - SYNS_LangXML = 'XML'; + SYNS_LangYAML = 'YAML'; resourcestring SYNS_NoSearchEngineError = 'No search engine has been assigned'; + SYNS_SaveError = 'Saving highlighter to file "%s" failed'; + SYNS_LoadError = 'Loading highlighter from file "%s" failed'; + + SYNS_Untitled = 'Untitled'; + SYNS_Line = 'Line'; + SYNS_Char = 'Char'; + SYNS_Row = 'Row'; + SYNS_Column = 'Column'; + SYNS_Files = 'Files'; - SYNS_Untitled = 'Untitled'; // Friendly names for highlighter attributes + SYNS_FriendlyAttrAnchor = 'Anchor'; SYNS_FriendlyAttrAreaAIdentifier = 'Area A Identifier'; SYNS_FriendlyAttrArrowHead = 'ArrowHead'; SYNS_FriendlyAttrAsm = 'Asm'; @@ -307,6 +313,7 @@ interface SYNS_FriendlyAttrDirective = 'Directive'; SYNS_FriendlyAttrDOCTYPESection = 'DOCTYPE Section'; SYNS_FriendlyAttrDocumentation = 'Documentation'; + SYNS_FriendlyAttrDocumentDelimiter = 'Document Delimiter'; SYNS_FriendlyAttrElementName = 'Element Name'; SYNS_FriendlyAttrEmbedSQL = 'Embedded SQL'; SYNS_FriendlyAttrEmbedText = 'Embedded Text'; @@ -327,7 +334,6 @@ interface SYNS_FriendlyAttrIndicator = 'Indicator Area'; SYNS_FriendlyAttrIndirect = 'Indirect'; SYNS_FriendlyAttrInstructions = 'Instructions'; - SYNS_FriendlyAttrInterfaceQualifier = 'Interface Qualifier'; SYNS_FriendlyAttrInternalFunction = 'Internal Function'; SYNS_FriendlyAttrInvalidSymbol = 'Invalid Symbol'; SYNS_FriendlyAttrKey = 'Key'; @@ -344,6 +350,7 @@ interface SYNS_FriendlyAttrNonReservedKeyword = 'Non-reserved Keyword'; SYNS_FriendlyAttrNull = 'Null'; SYNS_FriendlyAttrNumber = 'Number'; + SYNS_FriendlyAttrNumericValue = 'Numeric Value'; SYNS_FriendlyAttrOctal = 'Octal'; SYNS_FriendlyAttrOperator = 'Operator'; SYNS_FriendlyAttrOperatorAndSymbols = 'Operator And Symbols'; @@ -385,11 +392,14 @@ interface SYNS_FriendlyAttrSyntaxError = 'Syntax Error'; SYNS_FriendlyAttrSystem = 'System Functions and Variables'; SYNS_FriendlyAttrSystemValue = 'System Value'; + SYNS_FriendlyAttrTag = 'Tag'; SYNS_FriendlyAttrTagArea = 'Tag Area'; SYNS_FriendlyAttrTableName = 'Table Name'; + SYNS_FriendlyAttrTemplate = 'Template'; SYNS_FriendlyAttrTerminator = 'Terminator'; SYNS_FriendlyAttrTeXCommand = 'TeX Command'; SYNS_FriendlyAttrText = 'Text'; + SYNS_FriendlyAttrTextValue = 'Text Value'; SYNS_FriendlyAttrTextMathMode = 'Text in Math Mode'; SYNS_FriendlyAttrThirdTri = 'ThirdTri'; SYNS_FriendlyAttrTixKeyWords = 'Tix Keywords'; @@ -435,7 +445,7 @@ interface SYNS_PreviewScrollInfoFmt = 'Page: %d'; // strings for property editors etc - SYNS_EDuplicateShortcut = 'Shortcut already exists'; + SYNS_EDuplicateShortcut = 'Shortcut for command "%s" is already used for command "%s"'; SYNS_ShortcutNone = ''; SYNS_DuplicateShortcutMsg = 'The keystroke "%s" is already assigned ' + 'to another editor command. (%s)'; @@ -444,133 +454,129 @@ interface 'shortcut for this item has not been changed.'; // Filters used for open/save dialog - SYNS_FilterADSP21xx = 'DSP Files (*.dsp;*.inc)|*.dsp;*.inc'; - SYNS_FilterAsm68HC11 = '68HC11 Assembler Files (*.hc11;*.asm;*.asc)|*.hc11;*.asm;*.asc'; - SYNS_FilterAWK = 'AWK Scripts (*.awk)|*.awk'; - SYNS_FilterBaan = 'Baan 4GL Files (*.cln)|*.cln'; - SYNS_FilterBatch = 'MS-DOS Batch Files (*.bat;*.cmd)|*.bat;*.cmd'; - SYNS_FilterCache = 'Cache Files (*.mac;*.inc;*.int)|*.mac;*.inc;*.int'; + SYNS_FilterPascal = 'Pascal Files (*.pas;*.pp;*.dpr;*.dpk;*.inc)|*.pas;*.pp;*.dpr;*.dpk;*.inc'; + SYNS_FilterHP48 = 'HP48 Files (*.s;*.sou;*.a;*.hp)|*.s;*.sou;*.a;*.hp'; SYNS_FilterCAClipper = 'CA-Clipper Files (*.prg;*.ch;*.inc)|*.prg;*.ch;*.inc'; - SYNS_FilterCOBOL = 'COBOL Files (*.cbl;*.cob)|*.cbl;*.cob'; SYNS_FilterCORBAIDL = 'CORBA IDL Files (*.idl)|*.idl'; SYNS_FilterCPM = 'CPM Reports (*.rdf;*.rif;*.rmf;*.rxf)|*.rdf;*.rif;*.rmf;*.rxf'; SYNS_FilterCPP = 'C/C++ Files (*.c;*.cpp;*.cc;*.h;*.hpp;*.hh;*.cxx;*.hxx;*.cu)|*.c;*.cpp;*.cc;*.h;*.hpp;*.hh;*.cxx;*.hxx;*.cu'; SYNS_FilterCS = 'C# Files (*.cs)|*.cs'; - SYNS_FilterCSS = 'Cascading Stylesheets (*.css)|*.css'; - SYNS_FilterDFM = 'Borland Form Files (*.dfm;*.xfm)|*.dfm;*.xfm'; - SYNS_FilterDOT = 'DOT Graph Drawing Description (*.dot)|*.dot'; SYNS_FilterDWS = 'DWScript Files (*.dws;*.pas;*.inc)|*.dws;*.pas;*.inc'; - SYNS_FilterEcmaScript = 'Javascript Files (*.js)|*.js'; - SYNS_FilterEiffel = 'Eiffel (*.e;*.ace)|*.e;*.ace'; - SYNS_FilterFortran = 'Fortran Files (*.for)|*.for'; - SYNS_FilterFoxpro = 'Foxpro Files (*.prg)|*.prg'; + SYNS_FilterJava = 'Java Files (*.java)|*.java'; + SYNS_FilterPerl = 'Perl Files (*.pl;*.pm;*.cgi)|*.pl;*.pm;*.cgi'; + SYNS_FilterAWK = 'AWK Scripts (*.awk)|*.awk'; + SYNS_FilterHTML = 'HTML Documents (*.htm;*.html)|*.htm;*.html'; + SYNS_FilterVBScript = 'VBScript Files (*.vbs)|*.vbs'; SYNS_FilterGalaxy = 'Galaxy Files (*.gtv;*.galrep;*.txt)|*.gtv;*.galrep;*.txt'; + SYNS_FilterPython = 'Python Files (*.py)|*.py'; + SYNS_FilterSQL = 'SQL Files (*.sql)|*.sql'; + SYNS_FilterTclTk = 'Tcl/Tk Files (*.tcl)|*.tcl'; + SYNS_FilterRTF = 'Rich Text Format Documents (*.rtf)|*.rtf'; + SYNS_FilterBatch = 'MS-DOS Batch Files (*.bat;*.cmd)|*.bat;*.cmd'; + SYNS_FilterDFM = 'Borland Form Files (*.dfm;*.xfm)|*.dfm;*.xfm'; + SYNS_FilterX86Assembly = 'x86 Assembly Files (*.asm)|*.asm'; SYNS_FilterGembase = 'GEMBASE Files (*.dml;*.gem)|*.dml;*.gem'; - SYNS_FilterGo = 'Go files (*.go)|*.go'; - SYNS_FilterGLSL = 'GLSL files (*.glsl)|*.glsl'; - SYNS_FilterGWS = 'GW-TEL Scripts (*.gws)|*.gws'; - SYNS_FilterHaskell = 'Haskell Files (*.hs;*.lhs)|*.hs;*.lhs'; - SYNS_FilterHP48 = 'HP48 Files (*.s;*.sou;*.a;*.hp)|*.s;*.sou;*.a;*.hp'; - SYNS_FilterHTML = 'HTML Documents (*.htm;*.html)|*.htm;*.html'; - SYNS_FilterINI = 'INI Files (*.ini)|*.ini'; - SYNS_FilterInno = 'Inno Setup Scripts (*.iss)|*.iss'; - SYNS_FilterJava = 'Java Files (*.java)|*.java'; + SYNS_FilterINI = 'INI/TOML Files (*.ini;*.toml)|*.ini;*.toml'; + SYNS_FilterSML = 'Standard ML Files (*.sml)|*.sml'; + SYNS_FilterVisualBASIC = 'Visual Basic Files (*.bas)|*.bas'; + SYNS_FilterADSP21xx = 'DSP Files (*.dsp;*.inc)|*.dsp;*.inc'; + SYNS_FilterPHP = 'PHP Files (*.php;*.php3;*.phtml;*.inc)|*.php;*.php3;*.phtml;*.inc'; + SYNS_FilterCache = 'Cache Files (*.mac;*.inc;*.int)|*.mac;*.inc;*.int'; + SYNS_FilterCSS = 'Cascading Stylesheets (*.css)|*.css'; SYNS_FilterJScript = 'Javascript Files (*.js)|*.js'; SYNS_FilterJSON = 'JSON Files (*.json)|*.json'; SYNS_FilterKIX = 'KiXtart Scripts (*.kix)|*.kix'; - SYNS_FilterLDraw = 'LEGO LDraw Files (*.ldr)|*.ldr'; - SYNS_FilterLLVMIR = 'LLVM IR files (*.ll)|*.ll'; + SYNS_FilterBaan = 'Baan 4GL Files (*.cln)|*.cln'; + SYNS_FilterFoxpro = 'Foxpro Files (*.prg)|*.prg'; + SYNS_FilterFortran = 'Fortran Files (*.for)|*.for'; + SYNS_FilterAsm68HC11 = '68HC11 Assembler Files (*.hc11;*.asm;*.asc)|*.hc11;*.asm;*.asc'; + SYNS_FilterProgress = 'Progress Files (*.w;*.p;*.i)|*.w;*.p;*.i'; + SYNS_FilterInno = 'Inno Setup Scripts (*.iss)|*.iss'; SYNS_FilterModelica = 'Modelica Files (*.mo)|*.mo'; SYNS_FilterModula3 = 'Modula-3 Files (*.m3)|*.m3'; - SYNS_FilterPascal = 'Pascal Files (*.pas;*.pp;*.dpr;*.dpk;*.inc)|*.pas;*.pp;*.dpr;*.dpk;*.inc'; - SYNS_FilterPerl = 'Perl Files (*.pl;*.pm;*.cgi)|*.pl;*.pm;*.cgi'; - SYNS_FilterPHP = 'PHP Files (*.php;*.php3;*.phtml;*.inc)|*.php;*.php3;*.phtml;*.inc'; - SYNS_FilterProgress = 'Progress Files (*.w;*.p;*.i)|*.w;*.p;*.i'; - SYNS_FilterPython = 'Python Files (*.py)|*.py'; - SYNS_FilterRC = 'Resource Files (*.rc)|*.rc'; - SYNS_FilterRTF = 'Rich Text Format Documents (*.rtf)|*.rtf'; - SYNS_FilterRuby = 'Ruby Files (*.rb;*.rbw)|*.rb;*.rbw'; SYNS_FilterSDD = 'Semanta DD Files (*.sdd)|*.sdd'; - SYNS_FilterSML = 'Standard ML Files (*.sml)|*.sml'; - SYNS_FilterSQL = 'SQL Files (*.sql)|*.sql'; - SYNS_FilterST = 'Structured Text Files (*.st)|*.st'; + SYNS_FilterXML = 'XML Files (*.xml;*.xsd;*.xsl;*.xslt;*.dtd)|*.xml;*.xsd;*.xsl;*.xslt;*.dtd'; + SYNS_FilterGWS = 'GW-TEL Scripts (*.gws)|*.gws'; SYNS_FilterSynGenMsgfiles = 'Msg Files (*.msg)|*.msg'; - SYNS_FilterTclTk = 'Tcl/Tk Files (*.tcl)|*.tcl'; + SYNS_FilterST = 'Structured Text Files (*.st)|*.st'; + SYNS_FilterCOBOL = 'COBOL Files (*.cbl;*.cob)|*.cbl;*.cob'; SYNS_FilterTeX = 'TeX Files (*.tex)|*.tex'; + SYNS_FilterRC = 'Resource Files (*.rc)|*.rc'; + SYNS_FilterRuby = 'Ruby Files (*.rb;*.rbw)|*.rb;*.rbw'; SYNS_FilterUNIXShellScript = 'UNIX Shell Scripts (*.sh)|*.sh'; + SYNS_FilterHaskell = 'Haskell Files (*.hs;*.lhs)|*.hs;*.lhs'; + SYNS_FilterDOT = 'DOT Graph Drawing Description (*.dot)|*.dot'; + SYNS_FilterEiffel = 'Eiffel (*.e;*.ace)|*.e;*.ace'; + SYNS_FilterLDraw = 'LEGO LDraw Files (*.ldr)|*.ldr'; + SYNS_FilterLLVMIR = 'LLVM IR files (*.ll)|*.ll'; SYNS_FilterURI = 'All Files (*.*)|*.*'; - SYNS_FilterVBScript = 'VBScript Files (*.vbs)|*.vbs'; - SYNS_FilterVisualBASIC = 'Visual Basic Files (*.bas)|*.bas'; SYNS_FilterVrml97 = 'Vrml97/X3D World (*.wrl;*.wrml;*.vrl;*.vrml;*.x3d)|*.wrl;*.wrml;*.vrl;*.vrml;*.x3d'; - SYNS_FilterX86Assembly = 'x86 Assembly Files (*.asm)|*.asm'; - SYNS_FilterXML = 'XML Files (*.xml;*.xsd;*.xsl;*.xslt;*.dtd)|*.xml;*.xsd;*.xsl;*.xslt;*.dtd'; + SYNS_FilterYAML = 'YAML files (*.yaml)|*.yaml'; // friendly language names - SYNS_FriendlyLang68HC11 = '68HC11 Assembler'; - SYNS_FriendlyLangADSP21xx = 'ADSP21xx'; - SYNS_FriendlyLangAWK = 'AWK'; - SYNS_FriendlyLangBaan = 'Baan 4GL'; - SYNS_FriendlyLangBatch = 'MS-DOS Batch'; - SYNS_FriendlyLangCache = 'Cache Object Script'; + SYNS_FriendlyLangHP48 = 'HP48'; SYNS_FriendlyLangCAClipper = 'CA-Clipper'; - SYNS_FriendlyLangCOBOL = 'COBOL'; - SYNS_FriendlyLangCORBAIDL = 'CORBA IDL'; SYNS_FriendlyLangCPM = 'COAS Product Manager Report'; SYNS_FriendlyLangCPP = 'C/C++'; SYNS_FriendlyLangCS = 'C#'; - SYNS_FriendlyLangCSS = 'Cascading Style Sheet'; + SYNS_FriendlyLangJava = 'Java'; + SYNS_FriendlyLangPerl = 'Perl'; + SYNS_FriendlyLangBatch = 'MS-DOS Batch'; SYNS_FriendlyLangDfm = 'Borland Forms'; - SYNS_FriendlyLangDOT = 'DOT Graph Drawing Description language'; - SYNS_FriendlyLangEcmaScript = 'ECMA Script'; - SYNS_FriendlyLangEiffel = 'Eiffel'; - SYNS_FriendlyLangFortran = 'Fortran'; - SYNS_FriendlyLangFoxpro = 'Foxpro'; + SYNS_FriendlyLangAWK = 'AWK'; + SYNS_FriendlyLangCORBAIDL = 'CORBA IDL'; + SYNS_FriendlyLangHTML = 'HTML'; + SYNS_FriendlyLangVBSScript = 'MS VBScript'; SYNS_FriendlyLangGalaxy = 'Galaxy'; - SYNS_FriendlyLangGembase = 'Gembase'; SYNS_FriendlyLangGeneral = 'General'; - SYNS_FriendlyLangGeneralMulti = 'General Multi-Highlighter'; - SYNS_FriendlyLangGo = 'Go'; - SYNS_FriendlyLangGLSL = 'GLSL'; - SYNS_FriendlyLangGWS = 'GW-TEL'; - SYNS_FriendlyLangHaskell = 'Haskell'; - SYNS_FriendlyLangHP48 = 'HP48'; - SYNS_FriendlyLangHTML = 'HTML'; + SYNS_FriendlyLangOmni = 'Omni'; + SYNS_FriendlyLangPascal = 'Object Pascal'; + SYNS_FriendlyLangDWScript = 'DWScript Pascal'; + SYNS_FriendlyLangX86Asm = 'x86 Assembly'; + SYNS_FriendlyLangPython = 'Python'; + SYNS_FriendlyLangTclTk = 'Tcl/Tk'; + SYNS_FriendlyLangSQL = 'SQL'; + SYNS_FriendlyLangGembase = 'Gembase'; SYNS_FriendlyLangINI = 'INI'; - SYNS_FriendlyLangInno = 'Inno Setup Script'; - SYNS_FriendlyLangJava = 'Java'; - SYNS_FriendlyLangJavaScript = 'JavaScript'; + SYNS_FriendlyLangSML = 'Standard ML'; + SYNS_FriendlyLangVisualBASIC = 'Visual Basic'; + SYNS_FriendlyLangADSP21xx = 'ADSP21xx'; + SYNS_FriendlyLangPHP = 'PHP'; + SYNS_FriendlyLangSybaseSQL = 'Sybase SQL'; + SYNS_FriendlyLangGeneralMulti = 'General Multi-Highlighter'; + SYNS_FriendlyLangCache = 'Cache Object Script'; + SYNS_FriendlyLangCSS = 'Cascading Style Sheet'; SYNS_FriendlyLangJScript = 'JavaScript'; SYNS_FriendlyLangJSON = 'JSON'; SYNS_FriendlyLangKIX = 'KiXtart'; - SYNS_FriendlyLangLDraw = 'LEGO LDraw'; - SYNS_FriendlyLangLLVMIR = 'LLVM Intermediate Representation'; - SYNS_FriendlyLangMASM = 'x86 Assembly MASM'; + SYNS_FriendlyLangBaan = 'Baan 4GL'; + SYNS_FriendlyLangFoxpro = 'Foxpro'; + SYNS_FriendlyLangFortran = 'Fortran'; + SYNS_FriendlyLang68HC11 = '68HC11 Assembler'; + SYNS_FriendlyLangProgress = 'Progress'; + SYNS_FriendlyLangInno = 'Inno Setup Script'; SYNS_FriendlyLangModelica = 'Modelica'; SYNS_FriendlyLangModula3 = 'Modula 3'; - SYNS_FriendlyLangNameUNIXShellScript = 'UNIX Shell Script'; - SYNS_FriendlyLangPascal = 'Object Pascal'; - SYNS_FriendlyLangPerl = 'Perl'; - SYNS_FriendlyLangPHP = 'PHP'; - SYNS_FriendlyLangProgress = 'Progress'; - SYNS_FriendlyLangPython = 'Python'; - SYNS_FriendlyLangRC = 'Resource'; - SYNS_FriendlyLangRuby = 'Ruby'; SYNS_FriendlyLangSDD = 'Semanta Data Dictionary'; - SYNS_FriendlyLangSML = 'Standard ML'; - SYNS_FriendlyLangSQL = 'SQL'; - SYNS_FriendlyLangST = 'Structured Text'; - SYNS_FriendlyLangSybaseSQL = 'Sybase SQL'; + SYNS_FriendlyLangXML = 'XML'; + SYNS_FriendlyLangGWS = 'GW-TEL'; SYNS_FriendlyLangSynGenMsgfiles = 'SynGen Msg'; - SYNS_FriendlyLangTclTk = 'Tcl/Tk'; + SYNS_FriendlyLangUnreal = 'Unreal'; + SYNS_FriendlyLangST = 'Structured Text'; + SYNS_FriendlyLangCOBOL = 'COBOL'; SYNS_FriendlyLangTeX = 'TeX'; + SYNS_FriendlyLangRC = 'Resource'; + SYNS_FriendlyLangRuby = 'Ruby'; + SYNS_FriendlyLangNameUNIXShellScript = 'UNIX Shell Script'; + SYNS_FriendlyLangHaskell = 'Haskell'; + SYNS_FriendlyLangDOT = 'DOT Graph Drawing Description language'; + SYNS_FriendlyLangEiffel = 'Eiffel'; + SYNS_FriendlyLangLDraw = 'LEGO LDraw'; + SYNS_FriendlyLangLLVMIR = 'LLVM Intermediate Representation'; SYNS_FriendlyLangUnknown = ''; - SYNS_FriendlyLangUnreal = 'Unreal'; SYNS_FriendlyLangURI = 'URI'; - SYNS_FriendlyLangVBSScript = 'MS VBScript'; - SYNS_FriendlyLangVisualBASIC = 'Visual Basic'; SYNS_FriendlyLangVrml97 = 'Vrml97'; - SYNS_FriendlyLangX86Asm = 'x86 Assembly'; - SYNS_FriendlyLangXML = 'XML'; + SYNS_FriendlyLangYAML = 'YAML'; implementation diff --git a/Ext/SynEdit/Source/SynEditTextBuffer.pas b/Ext/SynEdit/Source/SynEditTextBuffer.pas index 7a3c85d..506bcca 100644 --- a/Ext/SynEdit/Source/SynEditTextBuffer.pas +++ b/Ext/SynEdit/Source/SynEditTextBuffer.pas @@ -1,83 +1,74 @@ -{------------------------------------------------------------------------------- -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: SynEditTextBuffer.pas, released 2000-04-07. -The Original Code is based on parts of mwCustomEdit.pas by Martin Waldenburg, -part of the mwEdit component suite. -Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit and mwEdit projects are listed in the -Contributors.txt file. - -Alternatively, the contents of this file may be used under the terms of the -GNU General Public License Version 2 or later (the "GPL"), in which case -the provisions of the GPL are applicable instead of those above. -If you wish to allow use of your version of this file only under the terms -of the GPL and not to allow others to use your version of this file -under the MPL, indicate your decision by deleting the provisions above and -replace them with the notice and other provisions required by the GPL. -If you do not delete the provisions above, a recipient may use your version -of this file under either the MPL or the GPL. - -$Id: SynEditTextBuffer.pas,v 1.14 2011/12/28 09:24:20 Egg Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -//todo: Avoid calculating expanded string unncessarily (just calculate expandedLength instead). - -{$IFNDEF QSYNEDITTEXTBUFFER} +{ ------------------------------------------------------------------------------ + 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: SynEditTextBuffer.pas, released 2000-04-07. + The Original Code is based on parts of mwCustomEdit.pas by Martin Waldenburg, + part of the mwEdit component suite. + Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. + Unicode translation by Maël Hörz. + All Rights Reserved. + + Contributors to the SynEdit and mwEdit projects are listed in the + Contributors.txt file. + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License Version 2 or later (the "GPL"), in which case + the provisions of the GPL are applicable instead of those above. + If you wish to allow use of your version of this file only under the terms + of the GPL and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the GPL. + If you do not delete the provisions above, a recipient may use your version + of this file under either the MPL or the GPL. + + Known Issues: + -----------------------------------------------------------------------------} + unit SynEditTextBuffer; -{$ENDIF} {$I SynEdit.inc} interface uses - Windows, + System.Classes, + System.SysUtils, SynEditTypes, SynEditMiscProcs, - SynUnicode, - Classes, - SysUtils, - Graphics; + SynUnicode; type TSynEditRange = Pointer; - TSynEditStringFlag = (sfHasTabs, sfHasNoTabs, sfExpandedLengthUnknown, - sfModified, sfSaved); + TSynEditStringFlag = (sfTextWidthUnknown, sfModified, sfSaved, sfAsSaved); TSynEditStringFlags = set of TSynEditStringFlag; + // Managed by Undo + TSynLineChangeFlag = sfModified..sfAsSaved; + TSynLineChangeFlags = set of TSynLineChangeFlag; + PSynEditStringRec = ^TSynEditStringRec; + TSynEditStringRec = record - {$IFDEF OWN_UnicodeString_MEMMGR} - FString: PWideChar; // "array of WideChar"; - {$ELSE} - FString: UnicodeString; - {$ENDIF OWN_UnicodeString_MEMMGR} + FString: string; FObject: TObject; FRange: TSynEditRange; - FExpandedLength: Integer; - fCharIndex : Integer; + FTextWidth: Integer; + FCharIndex: Integer; FFlags: TSynEditStringFlags; end; TSynEditTwoWideChars = record - One, Two : WideChar; + One, Two: WideChar; end; + PSynEditTwoWideChars = ^TSynEditTwoWideChars; const @@ -88,223 +79,133 @@ TSynEditTwoWideChars = record type PSynEditStringRecList = ^TSynEditStringRecList; - TSynEditStringRecList = array[0..MaxSynEditStrings - 1] of TSynEditStringRec; + TSynEditStringRecList = array [0 .. MaxSynEditStrings - 1] + of TSynEditStringRec; TStringListChangeEvent = procedure(Sender: TObject; Index: Integer; Count: Integer) of object; + TStringListPutEvent = procedure(Sender: TObject; Index: Integer; + const OldLine: string) of object; - TExpandAtWideGlyphsFunc = function (const S: UnicodeString): UnicodeString of object; - - TSynEditFileFormat = (sffDos, sffUnix, sffMac, sffUnicode); // DOS: CRLF, UNIX: LF, Mac: CR, Unicode: LINE SEPARATOR - - TSynEditModification = (smOriginal, smModified, smSaved); + TTextWidthFunc = function(const S: string): Integer of object; - TSynEditStringList = class(TUnicodeStrings) + TSynEditStringList = class(TStrings) private + FTextWidthFunc: TTextWidthFunc; FList: PSynEditStringRecList; FCount: Integer; FCapacity: Integer; FFileFormat: TSynEditFileFormat; - FAppendNewLineAtEOF: Boolean; - FConvertTabsProc: TConvertTabsProcEx; - FIndexOfLongestLine: Integer; + FMaxWidth: Integer; FTabWidth: Integer; - FExpandAtWideGlyphsFunc: TExpandAtWideGlyphsFunc; - FCharIndexesAreValid : Boolean; + FCharIndexesAreValid: Boolean; + FDetectUTF8: Boolean; + FUTF8CheckLen: Integer; FOnChange: TNotifyEvent; FOnChanging: TNotifyEvent; FOnCleared: TNotifyEvent; + FOnBeforeDeleted: TStringListChangeEvent; FOnDeleted: TStringListChangeEvent; FOnInserted: TStringListChangeEvent; - FOnPutted: TStringListChangeEvent; - function ExpandString(Index: Integer): UnicodeString; - function GetExpandedString(Index: Integer): UnicodeString; - function GetExpandedStringLength(Index: Integer): Integer; - function GetLengthOfLongestLine: Integer; + FOnPut: TStringListPutEvent; + FOnInfoLoss: TSynInfoLossEvent; + function GetTextWidth(Index: Integer): Integer; + function GetMaxWidth: Integer; function GetRange(Index: Integer): TSynEditRange; - function GetModification(Index: Integer): TSynEditModification; procedure Grow; - procedure InsertItem(Index: Integer; const S: UnicodeString); + procedure InsertItem(Index: Integer; const S: string); procedure PutRange(Index: Integer; ARange: TSynEditRange); + function GetChangeFlags(Index: Integer): TSynLineChangeFlags; + procedure SetChangeFlags(Index: Integer; const Value: TSynLineChangeFlags); + function GetFileFormat: TSynEditFileFormat; procedure SetFileFormat(const Value: TSynEditFileFormat); - {$IFDEF OWN_UnicodeString_MEMMGR} - procedure SetListString(Index: Integer; const S: UnicodeString); - {$ENDIF OWN_UnicodeString_MEMMGR} protected - FStreaming: Boolean; - function Get(Index: Integer): UnicodeString; override; - function GetCapacity: Integer; - {$IFDEF SYN_COMPILER_3_UP} override; {$ENDIF} + procedure Changed; virtual; + procedure Changing; virtual; + // TStrings overriden protected methods + function Get(Index: Integer): string; override; + function GetCapacity: Integer; override; function GetCount: Integer; override; function GetObject(Index: Integer): TObject; override; - function GetTextStr: UnicodeString; override; - procedure Put(Index: Integer; const S: UnicodeString); override; + procedure Put(Index: Integer; const S: string); override; procedure PutObject(Index: Integer; AObject: TObject); override; - procedure SetCapacity(NewCapacity: Integer); - {$IFDEF SYN_COMPILER_3_UP} override; {$ENDIF} - procedure SetTabWidth(Value: Integer); + procedure SetCapacity(NewCapacity: Integer); override; + procedure SetTextStr(const Value: string); override; procedure SetUpdateState(Updating: Boolean); override; + // Other protected methods + procedure SetTabWidth(Value: Integer); procedure UpdateCharIndexes; public - constructor Create(AExpandAtWideGlyphsFunc: TExpandAtWideGlyphsFunc); - destructor Destroy; override; - function Add(const S: UnicodeString): Integer; override; - procedure AddStrings(Strings: TUnicodeStrings); override; + // TStrings overriden public methods procedure Clear; override; procedure Delete(Index: Integer); override; procedure DeleteLines(Index, NumLines: Integer); - procedure Exchange(Index1, Index2: Integer); override; - procedure Insert(Index: Integer; const S: UnicodeString); override; - procedure InsertLines(Index, NumLines: Integer); - procedure InsertStrings(Index: Integer; NewStrings: TUnicodeStrings); - procedure InsertText(Index: Integer; NewText: UnicodeString); -{$IFDEF UNICODE} + procedure Insert(Index: Integer; const S: string); override; + procedure LoadFromStream(Stream: TStream; Encoding: TEncoding); override; procedure SaveToStream(Stream: TStream; Encoding: TEncoding); override; - function GetSeparatedText(Separators: UnicodeString): UnicodeString; -{$ELSE} - procedure SaveToStream(Stream: TStream; WithBOM: Boolean = True); override; -{$ENDIF} - procedure SetTextStr(const Value: UnicodeString); override; - procedure LoadFromStream(Stream: TStream); override; - procedure FontChanged; - function LineCharLength(Index : Integer) : Integer; - function LineCharIndex(Index : Integer) : Integer; - - procedure MarkModifiedLinesAsSaved; - procedure ResetModificationIndicator; - - property AppendNewLineAtEOF: Boolean read FAppendNewLineAtEOF write FAppendNewLineAtEOF; - - property FileFormat: TSynEditFileFormat read FFileFormat write SetFileFormat; - property ExpandedStrings[Index: Integer]: UnicodeString read GetExpandedString; - property ExpandedStringLengths[Index: Integer]: Integer read GetExpandedStringLength; - property LengthOfLongestLine: Integer read GetLengthOfLongestLine; + procedure SetEncoding(const Value: TEncoding); override; // just to elevate + // Other public methods + constructor Create(TextWidthFunc: TTextWidthFunc); + destructor Destroy; override; + procedure InsertStrings(Index: Integer; Strings: TArray; + FromIndex: Integer = 0); + procedure InsertText(Index: Integer; NewText: string); + function GetSeparatedText(Separators: string): string; + procedure ResetMaxWidth; + function LineCharLength(Index: Integer): Integer; + function LineCharIndex(Index: Integer): Integer; + procedure SetTextAndFileFormat(const Value: string); + + // FileFormat is deprecated and will be removed - Use LineBreak instead + property FileFormat: TSynEditFileFormat read GetFileFormat write SetFileFormat; + property TextWidth[Index: Integer]: Integer read GetTextWidth; + property MaxWidth: Integer read GetMaxWidth; property Ranges[Index: Integer]: TSynEditRange read GetRange write PutRange; - property Modification[Index: Integer]: TSynEditModification read GetModification; property TabWidth: Integer read FTabWidth write SetTabWidth; + property UTF8CheckLen: Integer read FUTF8CheckLen write FUTF8CheckLen; + property DetectUTF8: Boolean read FDetectUTF8 write FDetectUTF8; + property ChangeFlags[Index: Integer]: TSynLineChangeFlags read GetChangeFlags + write SetChangeFlags; property OnChange: TNotifyEvent read FOnChange write FOnChange; property OnChanging: TNotifyEvent read FOnChanging write FOnChanging; property OnCleared: TNotifyEvent read FOnCleared write FOnCleared; + property OnBeforeDeleted: TStringListChangeEvent read FOnBeforeDeleted + write FOnBeforeDeleted; property OnDeleted: TStringListChangeEvent read FOnDeleted write FOnDeleted; property OnInserted: TStringListChangeEvent read FOnInserted write FOnInserted; - property OnPutted: TStringListChangeEvent read FOnPutted write FOnPutted; + property OnPut: TStringListPutEvent read FOnPut write FOnPut; + property OnInfoLoss: TSynInfoLossEvent read FOnInfoLoss write FOnInfoLoss; end; ESynEditStringList = class(Exception); - TSynChangeReason = (crInsert, crPaste, crDragDropInsert, - // Note: several undo entries can be chained together via the ChangeNumber - // see also TCustomSynEdit.[Begin|End]UndoBlock methods - crDeleteAfterCursor, crDelete, - crLineBreak, crIndent, crUnindent, - crSilentDelete, crSilentDeleteAfterCursor, - crAutoCompleteBegin, crAutoCompleteEnd, - crPasteBegin, crPasteEnd, // for pasting, since it might do a lot of operations - crSpecial1Begin, crSpecial1End, - crSpecial2Begin, crSpecial2End, - crCaret, // just restore the Caret, allowing better Undo behavior - crSelection, // restore Selection - crNothing, - crGroupBreak, - crDeleteAll, - crWhiteSpaceAdd // for undo/redo of adding a character past EOL and repositioning the caret - ); - - TSynEditUndoItem = class(TPersistent) - protected - FChangeReason: TSynChangeReason; - FChangeSelMode: TSynSelectionMode; - FChangeStartPos: TBufferCoord; - FChangeEndPos: TBufferCoord; - FChangeStr: UnicodeString; - FChangeNumber: Integer; - public - procedure Assign(Source: TPersistent); override; - property ChangeReason: TSynChangeReason read FChangeReason; - property ChangeSelMode: TSynSelectionMode read FChangeSelMode; - property ChangeStartPos: TBufferCoord read FChangeStartPos; - property ChangeEndPos: TBufferCoord read FChangeEndPos; - property ChangeStr: UnicodeString read FChangeStr; - property ChangeNumber: Integer read FChangeNumber; - end; - - TSynEditUndoList = class(TPersistent) - protected - FBlockChangeNumber: Integer; - FBlockCount: Integer; - FFullUndoImposible: Boolean; - FItems: TList; - FLockCount: Integer; - FMaxUndoActions: Integer; - FNextChangeNumber: Integer; - FInitialChangeNumber: Integer; - FInsideRedo: Boolean; - FOnAddedUndo: TNotifyEvent; - procedure EnsureMaxEntries; - function GetCanUndo: Boolean; - function GetItemCount: Integer; - procedure SetMaxUndoActions(Value: Integer); - procedure SetInitialState(const Value: Boolean); - function GetInitialState: Boolean; - function GetItems(Index: Integer): TSynEditUndoItem; - procedure SetItems(Index: Integer; const Value: TSynEditUndoItem); - public - constructor Create; - destructor Destroy; override; - procedure AddChange(AReason: TSynChangeReason; const AStart, AEnd: TBufferCoord; - const ChangeText: UnicodeString; SelMode: TSynSelectionMode); - procedure BeginBlock; - procedure Clear; - procedure EndBlock; - procedure Lock; - function PeekItem: TSynEditUndoItem; - function PopItem: TSynEditUndoItem; - procedure PushItem(Item: TSynEditUndoItem); - procedure Unlock; - function LastChangeReason: TSynChangeReason; - public - procedure Assign(Source: TPersistent); override; - procedure AddGroupBreak; - procedure DeleteItem(AIndex: Integer); - property BlockChangeNumber: Integer read FBlockChangeNumber - write FBlockChangeNumber; - property CanUndo: Boolean read GetCanUndo; - property FullUndoImpossible: Boolean read FFullUndoImposible; - property InitialState: Boolean read GetInitialState write SetInitialState; - property Items[Index: Integer]: TSynEditUndoItem read GetItems write SetItems; - property ItemCount: Integer read GetItemCount; - property BlockCount: Integer read FBlockCount; - property MaxUndoActions: Integer read FMaxUndoActions - write SetMaxUndoActions; - property InsideRedo: Boolean read FInsideRedo write FInsideRedo; - property OnAddedUndo: TNotifyEvent read FOnAddedUndo write FOnAddedUndo; - end; - implementation +uses + System.Math, + System.Threading; -{$IFDEF SYN_COMPILER_3_UP} resourcestring -{$ELSE} -const -{$ENDIF} SListIndexOutOfBounds = 'Invalid stringlist index %d'; SInvalidCapacity = 'Stringlist capacity cannot be smaller than count'; -{ TSynEditStringList } + { TSynEditStringList } procedure ListIndexOutOfBounds(Index: Integer); begin raise ESynEditStringList.CreateFmt(SListIndexOutOfBounds, [Index]); end; -constructor TSynEditStringList.Create(AExpandAtWideGlyphsFunc: TExpandAtWideGlyphsFunc); +constructor TSynEditStringList.Create; begin inherited Create; - FExpandAtWideGlyphsFunc := AExpandAtWideGlyphsFunc; - SetFileFormat(sffDos); - FIndexOfLongestLine := -1; - TabWidth := 8; + FFileFormat := sffDos; + FMaxWidth := -1; + FTabWidth := 8; + FUTF8CheckLen := -1; + Options := Options - [soWriteBOM, soTrailingLineBreak]; + FDetectUTF8 := True; + FTextWidthFunc := TextWidthFunc; end; destructor TSynEditStringList.Destroy; @@ -312,255 +213,139 @@ destructor TSynEditStringList.Destroy; FOnChange := nil; FOnChanging := nil; inherited Destroy; - {$IFDEF OWN_UnicodeString_MEMMGR} - FOnCleared := nil; - Clear; - {$ELSE} if FCount <> 0 then Finalize(FList^[0], FCount); FCount := 0; SetCapacity(0); - {$ENDIF OWN_UnicodeString_MEMMGR} end; -function TSynEditStringList.Add(const S: UnicodeString): Integer; +procedure TSynEditStringList.Changed; begin - BeginUpdate; - Result := FCount; - InsertItem(Result, S); - if Assigned(OnInserted) then - OnInserted(Self, Result, 1); - EndUpdate; + if not Updating and Assigned(FOnChange) then + FOnChange(Self); end; -procedure TSynEditStringList.AddStrings(Strings: TUnicodeStrings); -var - i, FirstAdded: Integer; +procedure TSynEditStringList.Changing; begin - if Strings.Count > 0 then begin - FIndexOfLongestLine := -1; - BeginUpdate; - try - i := FCount + Strings.Count; - if i > FCapacity then - SetCapacity((i + 15) and (not 15)); - FirstAdded := FCount; - for i := 0 to Strings.Count - 1 do begin - with FList^[FCount] do begin - Pointer(FString) := nil; - {$IFDEF OWN_UnicodeString_MEMMGR} - SetListString(FCount, Strings[i]); - {$ELSE} - FString := Strings[i]; - {$ENDIF OWN_UnicodeString_MEMMGR} - FObject := Strings.Objects[i]; - FRange := NullRange; - FExpandedLength := -1; - FFlags := [sfExpandedLengthUnknown]; - end; - Inc(FCount); - end; - if Assigned(OnInserted) then - OnInserted(Self, FirstAdded, Strings.Count); - finally - EndUpdate; - end; - end; + FCharIndexesAreValid := False; + if not Updating and Assigned(FOnChanging) then + FOnChanging(Self); end; procedure TSynEditStringList.Clear; -{$IFDEF OWN_UnicodeString_MEMMGR} var - I: Integer; -{$ENDIF OWN_UnicodeString_MEMMGR} + OldCount: Integer; begin - if FCount <> 0 then begin - BeginUpdate; - {$IFDEF OWN_UnicodeString_MEMMGR} - for I := 0 to FCount - 1 do - with FList[I] do - if TDynWideCharArray(FString) <> nil then - TDynWideCharArray(FString) := nil; - {$ELSE} + if FCount <> 0 then + begin + Changing; + OldCount := FCount; + if Assigned(FOnBeforeDeleted) then + FOnBeforeDeleted(Self, 0, OldCount); Finalize(FList^[0], FCount); - {$ENDIF OWN_UnicodeString_MEMMGR} FCount := 0; SetCapacity(0); + if Assigned(FOnDeleted) then + FOnDeleted(Self, 0, OldCount); if Assigned(FOnCleared) then FOnCleared(Self); - EndUpdate; + Changed; end; - FIndexOfLongestLine := -1; + FMaxWidth := -1; end; procedure TSynEditStringList.Delete(Index: Integer); begin if (Index < 0) or (Index >= FCount) then ListIndexOutOfBounds(Index); - BeginUpdate; - {$IFDEF OWN_UnicodeString_MEMMGR} - SetListString(Index, ''); - {$ELSE} + Changing; + if Assigned(FOnBeforeDeleted) then + FOnBeforeDeleted(Self, Index, 1); Finalize(FList^[Index]); - {$ENDIF OWN_UnicodeString_MEMMGR} Dec(FCount); - if Index < FCount then begin + if Index < FCount then + begin System.Move(FList^[Index + 1], FList^[Index], (FCount - Index) * SynEditStringRecSize); - {$IFDEF OWN_UnicodeString_MEMMGR} - Pointer(FList[FCount].FString) := nil; // avoid freeing the string, the address is now used in another element - {$ENDIF OWN_UnicodeString_MEMMGR} end; - FIndexOfLongestLine := -1; + FMaxWidth := -1; if Assigned(FOnDeleted) then - FOnDeleted( Self, Index, 1 ); - EndUpdate; + FOnDeleted(Self, Index, 1); + Changed; end; procedure TSynEditStringList.DeleteLines(Index, NumLines: Integer); var LinesAfter: Integer; -{$IFDEF OWN_UnicodeString_MEMMGR} - I: Integer; -{$ENDIF OWN_UnicodeString_MEMMGR} begin - if NumLines > 0 then begin + if NumLines > 0 then + begin if (Index < 0) or (Index >= FCount) then ListIndexOutOfBounds(Index); + + Changing; + if Assigned(FOnBeforeDeleted) then + FOnBeforeDeleted(Self, Index, NumLines); + LinesAfter := FCount - (Index + NumLines); if LinesAfter < 0 then NumLines := FCount - Index; - {$IFDEF OWN_UnicodeString_MEMMGR} - for I := Index to Index + NumLines - 1 do - with FList[I] do - if TDynWideCharArray(FString) <> nil then - TDynWideCharArray(FString) := nil; - {$ELSE} Finalize(FList^[Index], NumLines); - {$ENDIF OWN_UnicodeString_MEMMGR} - - if LinesAfter > 0 then begin - BeginUpdate; - try - System.Move(FList^[Index + NumLines], FList^[Index], - LinesAfter * SynEditStringRecSize); - finally - EndUpdate; - end; - end; + + if LinesAfter > 0 then + System.Move(FList^[Index + NumLines], FList^[Index], + LinesAfter * SynEditStringRecSize); Dec(FCount, NumLines); if Assigned(FOnDeleted) then - FOnDeleted( Self, Index, NumLines ); + FOnDeleted(Self, Index, NumLines); + Changed; end; end; -procedure TSynEditStringList.Exchange(Index1, Index2: Integer); -var - Temp: TSynEditStringRec; -begin - if (Index1 < 0) or (Index1 >= FCount) then - ListIndexOutOfBounds(Index1); - if (Index2 < 0) or (Index2 >= FCount) then - ListIndexOutOfBounds(Index2); - BeginUpdate; - Temp := FList^[Index1]; - FList^[Index1] := FList^[Index2]; - FList^[Index2] := Temp; - if FIndexOfLongestLine = Index1 then - FIndexOfLongestLine := Index2 - else if FIndexOfLongestLine = Index2 then - FIndexOfLongestLine := Index1; - EndUpdate; -end; - -function TSynEditStringList.ExpandString(Index: Integer): UnicodeString; -var - HasTabs: Boolean; -begin - with FList^[Index] do - {$IFDEF OWN_UnicodeString_MEMMGR} - if Length(TDynWideCharArray(FString)) = 0 then - {$ELSE} - if Length(FString) = 0 then - {$ENDIF} - begin - Result := ''; - Exclude(FFlags, sfExpandedLengthUnknown); - Exclude(FFlags, sfHasTabs); - Include(FFlags, sfHasNoTabs); - FExpandedLength := 0; - end - else - begin - Result := FConvertTabsProc(FString, FTabWidth, HasTabs); - FExpandedLength := Length(FExpandAtWideGlyphsFunc(Result)); - Exclude(FFlags, sfExpandedLengthUnknown); - Exclude(FFlags, sfHasTabs); - Exclude(FFlags, sfHasNoTabs); - if HasTabs then - Include(FFlags, sfHasTabs) - else - Include(FFlags, sfHasNoTabs); - end; -end; - -function TSynEditStringList.Get(Index: Integer): UnicodeString; -{$IFDEF OWN_UnicodeString_MEMMGR} -var - Len: Integer; -{$ENDIF OWN_UnicodeString_MEMMGR} +function TSynEditStringList.Get(Index: Integer): string; begin - if Cardinal(Index) 0 then - begin - SetLength(Result, Len - 1); // exclude #0 - if Result <> '' then - System.Move(FString^, Result[1], Len * SizeOf(WideChar)); - end - else - Result := ''; - end - {$ELSE} + if (Index >= 0) and (Index < FCount) then Result := FList^[Index].FString - {$ENDIF OWN_UnicodeString_MEMMGR} else Result := ''; end; procedure TSynEditStringList.UpdateCharIndexes; var - i, n : Integer; - p : PSynEditStringRec; + I, N: Integer; + P: PSynEditStringRec; begin - FCharIndexesAreValid:=True; - if FCount=0 then Exit; - p:=@FList^[0]; - n:=0; - for i:=1 to FCount do begin - p.fCharIndex:=n; - Inc(n, Length(p.FString)); - Inc(p); + FCharIndexesAreValid := True; + if FCount = 0 then + Exit; + P := @FList^[0]; + N := 0; + for I := 1 to FCount do + begin + P.FCharIndex := N; + Inc(N, Length(P.FString)); + Inc(P); end; end; -function TSynEditStringList.LineCharLength(Index : Integer) : Integer; +function TSynEditStringList.LineCharLength(Index: Integer): Integer; begin - if Cardinal(Index)= 0) and (Index < FCount) then + Result := Length(FList^[Index].FString) + else + Result := 0; end; -function TSynEditStringList.LineCharIndex(Index : Integer) : Integer; +function TSynEditStringList.LineCharIndex(Index: Integer): Integer; begin - if Cardinal(Index)= 0) and (Index < FCount) then + begin if not FCharIndexesAreValid then UpdateCharIndexes; - Result:=FList^[Index].fCharIndex; - end else Result:=0; + Result := FList^[Index].FCharIndex; + end + else + Result := 0; end; function TSynEditStringList.GetCapacity: Integer; @@ -568,76 +353,75 @@ function TSynEditStringList.GetCapacity: Integer; Result := FCapacity; end; +function TSynEditStringList.GetChangeFlags(Index: Integer): TSynLineChangeFlags; +begin + if (Index >= 0) and (Index < FCount) then + Result := FList^[Index].FFlags * [sfModified..sfAsSaved] + else + Result := []; +end; + function TSynEditStringList.GetCount: Integer; begin Result := FCount; end; -function TSynEditStringList.GetExpandedString(Index: Integer): UnicodeString; +function TSynEditStringList.GetFileFormat: TSynEditFileFormat; begin - if (Index >= 0) and (Index < FCount) then - begin - if sfHasNoTabs in FList^[Index].FFlags then - Result := Get(Index) - else - Result := ExpandString(Index); - end else - Result := ''; + if LineBreak = WideLF then + Result := sffUnix + else if LineBreak = WideCR then + Result := sffMac + else if LineBreak = WideLineSeparator then + Result := sffUnicode + else + Result := sffDos; end; -function TSynEditStringList.GetExpandedStringLength(Index: Integer): Integer; +function TSynEditStringList.GetTextWidth(Index: Integer): Integer; begin if (Index >= 0) and (Index < FCount) then begin - if sfExpandedLengthUnknown in FList^[Index].FFlags then - Result := Length( ExpandedStrings[index] ) + if sfTextWidthUnknown in FList^[Index].FFlags then + begin + Result := FTextWidthFunc(FList^[Index].FString); + FList^[Index].FTextWidth := Result; + Exclude(FList^[Index].FFlags, sfTextWidthUnknown); + end else - Result := FList^[Index].FExpandedLength; + Result := FList^[Index].FTextWidth; end else Result := 0; end; -function TSynEditStringList.GetLengthOfLongestLine: Integer; -var - i, MaxLen: Integer; - PRec: PSynEditStringRec; +function TSynEditStringList.GetMaxWidth: Integer; begin - if FIndexOfLongestLine < 0 then + if FMaxWidth > 0 then + Result := FMaxWidth + else if FCount = 0 then + Result := 0 + else begin - MaxLen := 0; - if FCount > 0 then + TParallel.&For(0, FCount - 1, procedure(I:Integer) + var + LMaxW: Integer; + PRec: PSynEditStringRec; begin - PRec := @FList^[0]; - for i := 0 to FCount - 1 do + PRec := @FList^[I]; + if sfTextWidthUnknown in PRec^.FFlags then begin - if sfExpandedLengthUnknown in PRec^.FFlags then - ExpandString(i); - if PRec^.FExpandedLength > MaxLen then - begin - MaxLen := PRec^.FExpandedLength; - FIndexOfLongestLine := i; - end; - Inc(PRec); + PRec^.FTextWidth := FTextWidthFunc(PRec^.FString); + Exclude(PRec^.FFlags, sfTextWidthUnknown); end; - end; + repeat + LMaxW := FMaxWidth; + if PRec^.FTextWidth <= LMaxW then + Break; + until AtomicCmpExchange(FMaxWidth, PRec^.FTextWidth, LMaxW) = LMaxW; + end); + Result := Max(FMaxWidth, 0); end; - if (FIndexOfLongestLine >= 0) and (FIndexOfLongestLine < FCount) then - Result := FList^[FIndexOfLongestLine].FExpandedLength - else - Result := 0; -end; - -function TSynEditStringList.GetModification( - Index: Integer): TSynEditModification; -begin - Result := smOriginal; - if (Index >= 0) and (Index < FCount) then - if sfSaved in FList^[Index].FFlags then - Result := smSaved - else - if sfModified in FList^[Index].FFlags then - Result := smModified; end; function TSynEditStringList.GetObject(Index: Integer): TObject; @@ -656,9 +440,8 @@ function TSynEditStringList.GetRange(Index: Integer): TSynEditRange; Result := nil; end; -{$IFDEF UNICODE} -function TSynEditStringList.GetSeparatedText(Separators: UnicodeString): UnicodeString; -{Optimized by Eric Grange} +function TSynEditStringList.GetSeparatedText(Separators: string): string; +{ Optimized by Eric Grange } var I, L, Size, LineBreakSize: Integer; P, PLineBreak: PChar; @@ -673,9 +456,8 @@ function TSynEditStringList.GetSeparatedText(Separators: UnicodeString): Unicode PLineBreak := Pointer(Separators); // compute buffer size - Size := (FCount - 1) * LineBreakSize - + LineCharIndex( FCount - 1 ) - + Length( FList^[FCount - 1].FString ); + Size := (FCount - 1) * LineBreakSize + LineCharIndex(FCount - 1) + + Length(FList^[FCount - 1].FString); SetLength(Result, Size); P := Pointer(Result); @@ -690,23 +472,26 @@ function TSynEditStringList.GetSeparatedText(Separators: UnicodeString): Unicode end; Inc(PRec); - for I := 1 to FCount-1 do + for I := 1 to FCount - 1 do begin case LineBreakSize of - 0 : ; - 1 : begin - P^ := PLineBreak^; - Inc(P); - end; - 2 : begin - PSynEditTwoWideChars(P)^ := PSynEditTwoWideChars(PLineBreak)^; - Inc(P, 2); - end; + 0: + ; + 1: + begin + P^ := PLineBreak^; + Inc(P); + end; + 2: + begin + PSynEditTwoWideChars(P)^ := PSynEditTwoWideChars(PLineBreak)^; + Inc(P, 2); + end; else System.Move(PLineBreak^, P^, LineBreakSize * SizeOf(Char)); Inc(P, LineBreakSize); end; - if Pointer( PRec.FString ) <> nil then + if Pointer(PRec.FString) <> nil then begin L := Length(PRec.FString); System.Move(Pointer(PRec.FString)^, P^, L * SizeOf(Char)); @@ -715,326 +500,251 @@ function TSynEditStringList.GetSeparatedText(Separators: UnicodeString): Unicode Inc(PRec); end; end; -{$ENDIF} - -function TSynEditStringList.GetTextStr: UnicodeString; -var - LB: UnicodeString; -begin - if not FStreaming then - begin - Result := GetSeparatedText(sLineBreak); - end - else - begin - case FileFormat of - sffDos: - LB := WideCRLF; - sffUnix: - LB := WideLF; - sffMac: - LB := WideCR; - sffUnicode: - LB := WideLineSeparator; - end; - Result := GetSeparatedText(LB); - if AppendNewLineAtEOF then - Result := Result + LB; - end; -end; procedure TSynEditStringList.Grow; -var - Delta: Integer; begin - if FCapacity > 64 then - Delta := FCapacity div 4 - else - Delta := 16; - SetCapacity(FCapacity + Delta); + SetCapacity(GrowCollection(FCapacity, FCount + 1)); end; -procedure TSynEditStringList.Insert(Index: Integer; const S: UnicodeString); +procedure TSynEditStringList.Insert(Index: Integer; const S: string); begin - if (Index < 0) or (Index > FCount) then - ListIndexOutOfBounds(Index); - BeginUpdate; - InsertItem(Index, S); - if Assigned(FOnInserted) then - FOnInserted( Self, Index, 1 ); - EndUpdate; + InsertStrings(Index, [S]); end; -procedure TSynEditStringList.InsertItem(Index: Integer; const S: UnicodeString); +procedure TSynEditStringList.InsertItem(Index: Integer; const S: string); begin - BeginUpdate; if FCount = FCapacity then Grow; + + Changing; if Index < FCount then begin System.Move(FList^[Index], FList^[Index + 1], (FCount - Index) * SynEditStringRecSize); end; - FIndexOfLongestLine := -1; + FMaxWidth := -1; with FList^[Index] do begin Pointer(FString) := nil; - {$IFDEF OWN_UnicodeString_MEMMGR} - SetListString(Index, S); - {$ELSE} FString := S; - {$ENDIF OWN_UnicodeString_MEMMGR} FObject := nil; FRange := NullRange; - FExpandedLength := -1; - FFlags := [sfExpandedLengthUnknown]; - Include(FFlags, sfModified); + FTextWidth := -1; + FFlags := [sfTextWidthUnknown]; end; Inc(FCount); - EndUpdate; + Changed; end; -procedure TSynEditStringList.InsertLines(Index, NumLines: Integer); +procedure TSynEditStringList.InsertStrings(Index: Integer; + Strings: TArray; FromIndex: Integer); var - c_Line: Integer; + I: Integer; + LineCount: Integer; begin if (Index < 0) or (Index > FCount) then ListIndexOutOfBounds(Index); - if NumLines > 0 then + + LineCount := Length(Strings) - FromIndex; + if LineCount > 0 then begin - BeginUpdate; - try - SetCapacity(FCount + NumLines); - if Index < FCount then + if FCapacity < FCount + LineCount then + SetCapacity(GrowCollection(FCapacity, FCount + LineCount)); + + Changing; + if Index < FCount then + begin + System.Move(FList^[Index], FList^[Index + LineCount], + (FCount - Index) * SynEditStringRecSize); + end; + for I := 0 to LineCount - 1 do + with FList^[Index + I] do begin - System.Move(FList^[Index], FList^[Index + NumLines], - (FCount - Index) * SynEditStringRecSize); + Pointer(FString) := nil; + FString := Strings[FromIndex + I]; + FObject := nil; + FRange := NullRange; + FTextWidth := -1; + FFlags := [sfTextWidthUnknown]; end; - for c_Line := Index to Index + NumLines -1 do - with FList^[c_Line] do - begin - Pointer(FString) := nil; - FObject := nil; - FRange := NullRange; - FExpandedLength := -1; - FFlags := [sfExpandedLengthUnknown]; - end; - Inc(FCount, NumLines); - if Assigned(OnInserted) then - OnInserted(Self, Index, NumLines); - finally - EndUpdate; - end; - end; -end; - -procedure TSynEditStringList.InsertStrings(Index: Integer; - NewStrings: TUnicodeStrings); -var - i, Cnt: Integer; -begin - Cnt := NewStrings.Count; - if Cnt = 0 then Exit; - - BeginUpdate; - try - InsertLines(Index, Cnt); - for i := 0 to Cnt - 1 do - Strings[Index + i] := NewStrings[i]; - finally - EndUpdate; + Inc(FCount, LineCount); + FMaxWidth := -1; + if Assigned(OnInserted) then + OnInserted(Self, Index, LineCount); + Changed; end; end; -procedure TSynEditStringList.InsertText(Index: Integer; - NewText: UnicodeString); +procedure TSynEditStringList.InsertText(Index: Integer; NewText: string); var - TmpStringList: TUnicodeStringList; + TmpStringList: TStringList; begin - if NewText = '' then Exit; + if NewText = '' then + Exit; - TmpStringList := TUnicodeStringList.Create; + TmpStringList := TStringList.Create; try TmpStringList.Text := NewText; - InsertStrings(Index, TmpStringList); + InsertStrings(Index, TmpStringList.ToStringArray); finally TmpStringList.Free; end; end; -procedure TSynEditStringList.LoadFromStream(Stream: TStream); -begin - FStreaming := True; - inherited; - FStreaming := False; - ResetModificationIndicator; -end; - -procedure TSynEditStringList.MarkModifiedLinesAsSaved; +procedure TSynEditStringList.LoadFromStream(Stream: TStream; + Encoding: TEncoding); var - Index: Integer; -begin - for Index := 0 to FCount - 1 do - if sfModified in FList^[Index].FFlags then - Include(FList^[Index].FFlags, sfSaved); + Size: Integer; + Buffer: TBytes; + DecodedText: string; +begin + Size := Stream.Size - Stream.Position; + SetLength(Buffer, Size); + Stream.Read(Buffer, 0, Size); + Size := TEncoding.GetBufferEncoding(Buffer, Encoding, DefaultEncoding); + WriteBOM := Size > 0; // Keep WriteBom in case the stream is saved + // If the encoding is ANSI and DetectUtf8 is True try to Detect UTF8 + if (Encoding = TEncoding.ANSI) and DetectUTF8 and IsUTF8(Buffer, Size) then + Encoding := TEncoding.UTF8; + SetEncoding(Encoding); // Keep Encoding in case the stream is saved + DecodedText := Encoding.GetString(Buffer, Size, Length(Buffer) - Size); + SetLength(Buffer, 0); // Free the buffer here to reduce memory footprint + SetTextAndFileFormat(DecodedText); end; -procedure TSynEditStringList.ResetModificationIndicator; +procedure TSynEditStringList.SaveToStream(Stream: TStream; Encoding: TEncoding); var - Index: Integer; + Cancel: Boolean; + S: string; + Buffer, Preamble: TBytes; begin - for Index := 0 to FCount - 1 do + if Encoding = nil then + Encoding := DefaultEncoding; + + S := GetTextStr; + + Cancel := False; + if (Encoding = TEncoding.ANSI) and Assigned(FOnInfoLoss) and not IsAnsiOnly(S) + then begin - Exclude(FList^[Index].FFlags, sfModified); - Exclude(FList^[Index].FFlags, sfSaved); + FOnInfoLoss(Encoding, Cancel); + if Cancel then + Exit; + if Encoding <> TEncoding.ANSI then + SetEncoding(Encoding); end; -end; -{$IFDEF UNICODE} -procedure TSynEditStringList.SaveToStream(Stream: TStream; Encoding: TEncoding); -begin - FStreaming := True; - inherited; - FStreaming := False; -end; -{$ELSE} -procedure TSynEditStringList.SaveToStream(Stream: TStream; WithBOM: Boolean); -begin - FStreaming := True; - inherited; - FStreaming := False; + Buffer := Encoding.GetBytes(S); + if WriteBOM then + begin + Preamble := Encoding.GetPreamble; + if Length(Preamble) > 0 then + Stream.WriteBuffer(Preamble, Length(Preamble)); + end; + Stream.WriteBuffer(Buffer, Length(Buffer)); end; -{$ENDIF} -procedure TSynEditStringList.Put(Index: Integer; const S: UnicodeString); +procedure TSynEditStringList.Put(Index: Integer; const S: string); +var + OldLine: string; + OldWidth: Integer; begin if (Index = 0) and (FCount = 0) or (FCount = Index) then - Add(S) - else begin - if Cardinal(Index)>=Cardinal(FCount) then - ListIndexOutOfBounds(Index); - BeginUpdate; - FIndexOfLongestLine := -1; - with FList^[Index] do begin - Include(FFlags, sfExpandedLengthUnknown); - Exclude(FFlags, sfHasTabs); - Exclude(FFlags, sfHasNoTabs); - Include(FFlags, sfModified); - Exclude(FFlags, sfSaved); - {$IFDEF OWN_UnicodeString_MEMMGR} - SetListString(Index, S); - {$ELSE} - FString := S; - {$ENDIF OWN_UnicodeString_MEMMGR} - end; - if Assigned(FOnPutted) then - FOnPutted( Self, Index, 1 ); - EndUpdate; + Add(''); + + if (Index < 0) or (Index >= FCount) then + ListIndexOutOfBounds(Index); + + Changing; + with FList^[Index] do + begin + OldLine := FString; + FString := S; + + if FMaxWidth >= 0 then + begin + // Optimization: We calculate text width here, thus + // in most cases avoiding to recalc FMaxWidth the hard way + OldWidth := FTextWidth; + FTextWidth := FTextWidthFunc(FString); + Exclude(FFlags, sfTextWidthUnknown); + if (FMaxWidth = OldWidth) and (OldWidth > FTextWidth) then + FMaxWidth := -1 + else if FTextWidth > FMaxWidth then + FMaxWidth := FTextWidth + end + else + Include(FFlags, sfTextWidthUnknown); end; + if Assigned(FOnPut) then + FOnPut(Self, Index, OldLine); + Changed; end; procedure TSynEditStringList.PutObject(Index: Integer; AObject: TObject); begin - if Cardinal(Index)>=Cardinal(FCount) then + if (Index < 0) or (Index >= FCount) then ListIndexOutOfBounds(Index); - BeginUpdate; + Changing; FList^[Index].FObject := AObject; - EndUpdate; + Changed; end; procedure TSynEditStringList.PutRange(Index: Integer; ARange: TSynEditRange); begin - if Cardinal(Index)>=Cardinal(FCount) then + if (Index < 0) or (Index >= FCount) then ListIndexOutOfBounds(Index); - BeginUpdate; FList^[Index].FRange := ARange; - EndUpdate; end; procedure TSynEditStringList.SetCapacity(NewCapacity: Integer); -{$IFDEF OWN_UnicodeString_MEMMGR} -var - I : Integer; -{$ENDIF OWN_UnicodeString_MEMMGR} begin if NewCapacity < Count then - EListError.Create( SInvalidCapacity ); + EListError.Create(SInvalidCapacity); ReallocMem(FList, NewCapacity * SynEditStringRecSize); - {$IFDEF OWN_UnicodeString_MEMMGR} - for I := FCount to NewCapacity - 1 do - Pointer(FList[I].FString) := nil; // so that it does not get freed - {$ENDIF OWN_UnicodeString_MEMMGR} FCapacity := NewCapacity; end; -procedure TSynEditStringList.SetFileFormat(const Value: TSynEditFileFormat); +procedure TSynEditStringList.SetChangeFlags(Index: Integer; + const Value: TSynLineChangeFlags); begin - FFileFormat := Value; -{$IFDEF UNICODE} - case FileFormat of - sffDos: - LineBreak := WideCRLF; - sffUnix: - LineBreak := WideLF; - sffMac: - LineBreak := WideCR; - sffUnicode: - LineBreak := WideLineSeparator; - end; -{$ENDIF} + if (Index >= 0) and (Index < FCount) then + FList^[Index].FFlags := FList^[Index].FFlags - [sfModified..sfAsSaved] + + Value; end; -{$IFDEF OWN_UnicodeString_MEMMGR} -procedure TSynEditStringList.SetListString(Index: Integer; const S: UnicodeString); -var - Len: Integer; - A: TDynWideCharArray; +procedure TSynEditStringList.SetEncoding(const Value: TEncoding); begin - with FList[Index] do - begin - Pointer(A) := TDynWideCharArray(FString); - if A <> nil then - A := nil; // free memory - - Len := Length(S); - if Len > 0 then - begin - SetLength(A, Len + 1); // include #0 - System.Move(S[1], A[0], Len * SizeOf(WideChar)); - A[Len] := #0; - end; + inherited; +end; - FString := PWideChar(A); - Pointer(A) := nil; // do not release the array on procedure Exit +procedure TSynEditStringList.SetFileFormat(const Value: TSynEditFileFormat); +begin + case Value of + sffDos: LineBreak := WideCRLF; + sffUnix: LineBreak := WideLF; + sffMac: LineBreak := WideCR; + sffUnicode: LineBreak := WideLineSeparator; end; end; -{$ENDIF OWN_UnicodeString_MEMMGR} procedure TSynEditStringList.SetTabWidth(Value: Integer); -var - i: Integer; begin - if Value <> FTabWidth then begin + if Value <> FTabWidth then + begin FTabWidth := Value; - FConvertTabsProc := GetBestConvertTabsProcEx(FTabWidth); - FIndexOfLongestLine := -1; - for i := 0 to FCount - 1 do - with FList^[i] do begin - FExpandedLength := -1; - Exclude(FFlags, sfHasNoTabs); - Include(FFlags, sfExpandedLengthUnknown); - end; + ResetMaxWidth; end; end; -procedure TSynEditStringList.SetTextStr(const Value: UnicodeString); +procedure TSynEditStringList.SetTextAndFileFormat(const Value: string); var - S: UnicodeString; + S: string; Size: Integer; - P, Start, Pmax: PWideChar; - fCR, fLF, fLINESEPARATOR: Boolean; + P, Start, Pmax: PChar; + fCR, fLF, fUnicodeSeparator: Boolean; begin - fLINESEPARATOR := False; + fUnicodeSeparator := False; fCR := False; fLF := False; BeginUpdate; @@ -1044,22 +754,25 @@ procedure TSynEditStringList.SetTextStr(const Value: UnicodeString); if P <> nil then begin Size := Length(Value); - Pmax := @Value[Size]; - while (P <= Pmax) do + Pmax := P + Length(Value); + while (P < Pmax) do begin Start := P; - while (P^ <> WideCR) and (P^ <> WideLF) and (P^ <> WideLineSeparator) and (P <= Pmax) do - begin + while (P < Pmax) and not (Word(P^) in [10, 13]) and (P^ <> WideLineSeparator) + do Inc(P); - end; - if P<>Start then + if P <> Start then begin SetString(S, Start, P - Start); InsertItem(FCount, S); - end else InsertItem(FCount, ''); + end + else + InsertItem(FCount, ''); + if P^ = #0 then + Inc(P); if P^ = WideLineSeparator then begin - fLINESEPARATOR := True; + fUnicodeSeparator := True; Inc(P); end; if P^ = WideCR then @@ -1074,9 +787,8 @@ procedure TSynEditStringList.SetTextStr(const Value: UnicodeString); end; end; // keep the old format of the file - if not AppendNewLineAtEOF and - (CharInSet(Value[Size], [#10, #13]) or (Value[Size] = WideLineSeparator)) - then + if not TrailingLineBreak and (CharInSet(Value[Size], [#10, #13]) or + (Value[Size] = WideLineSeparator)) then InsertItem(FCount, ''); end; if Assigned(OnInserted) and (FCount > 0) then @@ -1084,314 +796,37 @@ procedure TSynEditStringList.SetTextStr(const Value: UnicodeString); finally EndUpdate; end; - if fLINESEPARATOR then - FileFormat := sffUnicode + if fUnicodeSeparator then + LineBreak := WideLineSeparator else if fCR and not fLF then - FileFormat := sffMac + LineBreak := WideCR else if fLF and not fCR then - FileFormat := sffUnix - else - FileFormat := sffDos; -end; - -procedure TSynEditStringList.SetUpdateState(Updating: Boolean); -begin - FCharIndexesAreValid:=False; - if Updating then begin - if Assigned(FOnChanging) then - FOnChanging(Self); - end else begin - if Assigned(FOnChange) then - FOnChange(Self); - end; -end; - -procedure TSynEditStringList.FontChanged; -var - i: Integer; -begin - FIndexOfLongestLine := -1; - for i := 0 to FCount - 1 do - with FList^[i] do - begin - FExpandedLength := -1; - Exclude(FFlags, sfHasNoTabs); - Include(FFlags, sfExpandedLengthUnknown); - end; -end; - -{ TSynEditUndoItem } - -procedure TSynEditUndoItem.Assign(Source: TPersistent); -begin - if (Source is TSynEditUndoItem) then - begin - FChangeReason:=TSynEditUndoItem(Source).FChangeReason; - FChangeSelMode:=TSynEditUndoItem(Source).FChangeSelMode; - FChangeStartPos:=TSynEditUndoItem(Source).FChangeStartPos; - FChangeEndPos:=TSynEditUndoItem(Source).FChangeEndPos; - FChangeStr:=TSynEditUndoItem(Source).FChangeStr; - FChangeNumber:=TSynEditUndoItem(Source).FChangeNumber; - end + LineBreak := WideLF else - inherited Assign(Source); + LineBreak := WideCRLF; end; - -{ TSynEditUndoList } - -constructor TSynEditUndoList.Create; +procedure TSynEditStringList.SetTextStr(const Value: string); begin - inherited Create; - FItems := TList.Create; - FMaxUndoActions := 1024; - FNextChangeNumber := 1; - FInsideRedo := False; + SetTextAndFileFormat(Value); end; -destructor TSynEditUndoList.Destroy; +procedure TSynEditStringList.SetUpdateState(Updating: Boolean); begin - Clear; - FItems.Free; - inherited Destroy; + if Updating then Changing else Changed; end; -procedure TSynEditUndoList.Assign(Source: TPersistent); +procedure TSynEditStringList.ResetMaxWidth; var - i: Integer; - UndoItem: TSynEditUndoItem; + I: Integer; begin - if (Source is TSynEditUndoList) then - begin - Clear; - for i:=0 to TSynEditUndoList(Source).FItems.Count-1 do + FMaxWidth := -1; + for I := 0 to FCount - 1 do + with FList^[I] do begin - UndoItem:=TSynEditUndoItem.Create; - UndoItem.Assign(TSynEditUndoList(Source).FItems[i]); - FItems.Add(UndoItem); - end; - FBlockChangeNumber:=TSynEditUndoList(Source).FBlockChangeNumber; - FBlockCount:=TSynEditUndoList(Source).FBlockCount; - FFullUndoImposible:=TSynEditUndoList(Source).FFullUndoImposible; - FLockCount:=TSynEditUndoList(Source).FLockCount; - FMaxUndoActions:=TSynEditUndoList(Source).FMaxUndoActions; - FNextChangeNumber:=TSynEditUndoList(Source).FNextChangeNumber; - FInsideRedo:=TSynEditUndoList(Source).FInsideRedo; - end - else - inherited Assign(Source); -end; - -procedure TSynEditUndoList.AddChange(AReason: TSynChangeReason; const AStart, - AEnd: TBufferCoord; const ChangeText: UnicodeString; SelMode: TSynSelectionMode); -var - NewItem: TSynEditUndoItem; -begin - if FLockCount = 0 then begin - NewItem := TSynEditUndoItem.Create; - try - with NewItem do begin - FChangeReason := AReason; - FChangeSelMode := SelMode; - FChangeStartPos := AStart; - FChangeEndPos := AEnd; - FChangeStr := ChangeText; - if FBlockChangeNumber <> 0 then - FChangeNumber := FBlockChangeNumber - else begin - FChangeNumber := FNextChangeNumber; - if FBlockCount = 0 then begin - Inc(FNextChangeNumber); - if FNextChangeNumber = 0 then - Inc(FNextChangeNumber); - end; - end; - end; - PushItem(NewItem); - except - NewItem.Free; - raise; - end; - end; -end; - -procedure TSynEditUndoList.BeginBlock; -begin - Inc(FBlockCount); - FBlockChangeNumber := FNextChangeNumber; -end; - -procedure TSynEditUndoList.Clear; -var - i: Integer; -begin - for i := 0 to FItems.Count - 1 do - TSynEditUndoItem(FItems[i]).Free; - FItems.Clear; - FFullUndoImposible := False; -end; - -procedure TSynEditUndoList.EndBlock; -var - iBlockID: Integer; -begin - if FBlockCount > 0 then begin - Dec(FBlockCount); - if FBlockCount = 0 then begin - iBlockID := FBlockChangeNumber; - FBlockChangeNumber := 0; - Inc(FNextChangeNumber); - if FNextChangeNumber = 0 then - Inc(FNextChangeNumber); - if (FItems.Count > 0) and (PeekItem.ChangeNumber = iBlockID) and - Assigned(OnAddedUndo) then - begin - OnAddedUndo( Self ); - end; - end; - end; -end; - -procedure TSynEditUndoList.EnsureMaxEntries; -var - Item: TSynEditUndoItem; -begin - if FItems.Count > FMaxUndoActions then - begin - FFullUndoImposible := True; - while FItems.Count > FMaxUndoActions do begin - Item := FItems[0]; - Item.Free; - FItems.Delete(0); + FTextWidth := -1; + Include(FFlags, sfTextWidthUnknown); end; - end; -end; - -function TSynEditUndoList.GetCanUndo: Boolean; -begin - Result := FItems.Count > 0; -end; - -function TSynEditUndoList.GetItemCount: Integer; -begin - Result := FItems.Count; -end; - -procedure TSynEditUndoList.Lock; -begin - Inc(FLockCount); -end; - -function TSynEditUndoList.PeekItem: TSynEditUndoItem; -var - iLast: Integer; -begin - Result := nil; - iLast := FItems.Count - 1; - if iLast >= 0 then - Result := FItems[iLast]; -end; - -function TSynEditUndoList.PopItem: TSynEditUndoItem; -var - iLast: Integer; -begin - Result := nil; - iLast := FItems.Count - 1; - if iLast >= 0 then begin - Result := FItems[iLast]; - FItems.Delete(iLast); - end; -end; - -procedure TSynEditUndoList.PushItem(Item: TSynEditUndoItem); -begin - if Assigned(Item) then begin - FItems.Add(Item); - EnsureMaxEntries; - if (Item.ChangeReason <> crGroupBreak) and Assigned(OnAddedUndo) then - OnAddedUndo(Self); - end; -end; - -procedure TSynEditUndoList.SetMaxUndoActions(Value: Integer); -begin - if Value < 0 then - Value := 0; - if Value <> FMaxUndoActions then begin - FMaxUndoActions := Value; - EnsureMaxEntries; - end; -end; - -procedure TSynEditUndoList.Unlock; -begin - if FLockCount > 0 then - Dec(FLockCount); -end; - -function TSynEditUndoList.LastChangeReason: TSynChangeReason; -begin - if FItems.Count = 0 then - Result := crNothing - else - Result := TSynEditUndoItem(FItems[FItems.Count - 1]).FChangeReason; -end; - -procedure TSynEditUndoList.AddGroupBreak; -var - vDummy: TBufferCoord; -begin - //Add the GroupBreak even if ItemCount = 0. Since items are stored in - //reverse order in TCustomSynEdit.fRedoList, a GroupBreak could be lost. - if LastChangeReason <> crGroupBreak then - begin - AddChange(crGroupBreak, vDummy, vDummy, '', smNormal); - end; -end; - -procedure TSynEditUndoList.SetInitialState(const Value: Boolean); -begin - if Value then - begin - if ItemCount = 0 then - FInitialChangeNumber := 0 - else - FInitialChangeNumber := PeekItem.ChangeNumber; - end - else - if ItemCount = 0 then - begin - if FInitialChangeNumber = 0 then - FInitialChangeNumber := -1; - end - else if PeekItem.ChangeNumber = FInitialChangeNumber then - FInitialChangeNumber := -1; -end; - -function TSynEditUndoList.GetInitialState: Boolean; -begin - if ItemCount = 0 then - Result := FInitialChangeNumber = 0 - else - Result := PeekItem.ChangeNumber = FInitialChangeNumber; -end; - -function TSynEditUndoList.GetItems(Index: Integer): TSynEditUndoItem; -begin - Result := TSynEditUndoItem(FItems[Index]); -end; - -procedure TSynEditUndoList.SetItems(Index: Integer; - const Value: TSynEditUndoItem); -begin - FItems[Index] := Value; -end; - -procedure TSynEditUndoList.DeleteItem(AIndex: Integer); -begin - TSynEditUndoItem(FItems[AIndex]).Free; - FItems.Delete(AIndex); end; end. diff --git a/Ext/SynEdit/Source/SynEditTypes.pas b/Ext/SynEdit/Source/SynEditTypes.pas index d8104af..6515149 100644 --- a/Ext/SynEdit/Source/SynEditTypes.pas +++ b/Ext/SynEdit/Source/SynEditTypes.pas @@ -28,86 +28,252 @@ If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: SynEditTypes.pas,v 1.13.2.2 2012/09/17 14:17:25 CodehunterWorks Exp $ - You may retrieve the latest version of this file at the SynEdit home page, located at http://SynEdit.SourceForge.net Known Issues: -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITTYPES} unit SynEditTypes; -{$ENDIF} {$I SynEdit.inc} interface uses - SysUtils; + Winapi.Windows, + Winapi.Messages, + System.Types, + System.Math, + Vcl.Controls, + System.SysUtils, + System.Classes; const -// These might need to be localized depending on the characterset because they might be -// interpreted as valid ident characters. - SynTabGlyph = WideChar($2192); //'->' - SynSoftBreakGlyph = WideChar($00AC); //'¬' - SynLineBreakGlyph = WideChar($00B6); //'¶' - SynSpaceGlyph = WideChar($2219); //'·' + DefaultBrackets = '()[]{}'; + +type + TSynAlignment = TAlignment; + +var + SynTabAlignment: TSynAlignment = taCenter; type - {$IF (CompilerVersion >= 36)}TListSize = NativeInt;{$ELSE}TListSize = Integer;{$IFEND} ESynError = class(Exception); + TSynFlowControl = (fcNone, fcContinue, fcBreak, fcExit); + + // DOS: CRLF, UNIX: LF, Mac: CR, Unicode: LINE SEPARATOR + TSynEditFileFormat = (sffDos, sffUnix, sffMac, sffUnicode); + TSynSearchOption = (ssoMatchCase, ssoWholeWord, ssoBackwards, ssoEntireScope, ssoSelectedOnly, ssoReplace, ssoReplaceAll, ssoPrompt); TSynSearchOptions = set of TSynSearchOption; TCategoryMethod = function(AChar: WideChar): Boolean of object; - TKeyPressWEvent = procedure(Sender: TObject; var Key: WideChar) of object; + TSynEditorCommand = type Word; - PSynSelectionMode = ^TSynSelectionMode; - TSynSelectionMode = (smNormal, smLine, smColumn); + THookedCommandEvent = procedure(Sender: TObject; AfterProcessing: Boolean; + var Handled: Boolean; var Command: TSynEditorCommand; var AChar: WideChar; + Data: pointer; HandlerData: pointer) of object; - PBorlandSelectionMode = ^TBorlandSelectionMode; - TBorlandSelectionMode = ( - bsmInclusive, // selects inclusive blocks. Borland IDE shortcut: Ctrl+O+I - bsmLine, // selects line blocks. Borland IDE shortcut: Ctrl+O+L - bsmColumn, // selects column blocks. Borland IDE shortcut: Ctrl+O+C - bsmNormal // selects normal Block. Borland IDE shortcut: Ctrl+O+K - ); + TSynInfoLossEvent = procedure (var Encoding: TEncoding; Cancel: Boolean) of object; - //todo: better field names. CharIndex and LineIndex? TBufferCoord = record + // Char and Line are 1-based Char: Integer; Line: Integer; - {$IFDEF SYN_COMPILER_10_UP} + function ToString(ShortForm: Boolean = True): string; class operator Equal(a, b: TBufferCoord): Boolean; - {$ENDIF} - end; - - // Codehunter patch: added TBufferBlock - TBufferBlock = record - BeginLine, BeginChar: Integer; - EndLine, EndChar: Integer; - {$IFDEF SYN_COMPILER_10_UP} - class operator Equal(a, b: TBufferBlock): Boolean; - {$ENDIF} + class operator NotEqual(a, b: TBufferCoord): Boolean; + class operator LessThan(a, b: TBufferCoord): Boolean; + class operator LessThanOrEqual(a, b: TBufferCoord): Boolean; + class operator GreaterThan(a, b: TBufferCoord): Boolean; + class operator GreaterThanOrEqual(a, b: TBufferCoord): Boolean; + class function Min(a, b: TBufferCoord): TBufferCoord; static; + class function Max(a, b: TBufferCoord): TBufferCoord; static; + class function Invalid: TBufferCoord; static; + function IsValid: Boolean; end; TDisplayCoord = record Column: Integer; Row: Integer; - {$IFDEF SYN_COMPILER_10_UP} class operator Equal(a, b: TDisplayCoord): Boolean; - {$ENDIF} + class operator NotEqual(a, b: TDisplayCoord): Boolean; + class operator LessThan(a, b: TDisplayCoord): Boolean; + class operator LessThanOrEqual(a, b: TDisplayCoord): Boolean; + class operator GreaterThan(a, b: TDisplayCoord): Boolean; + class operator GreaterThanOrEqual(a, b: TDisplayCoord): Boolean; + class function Min(a, b: TDisplayCoord): TDisplayCoord; static; + class function Max(a, b: TDisplayCoord): TDisplayCoord; static; + end; + + TSynSelection = record + Caret: TBufferCoord; + Start: TBufferCoord; + Stop: TBufferCoord; + CaretAtEOL: Boolean; // used by wordwrap + LastPosX: Integer; // in pixels. Used in vertical movements + procedure Normalize; + function Normalized: TSynSelection; + function IsEmpty: Boolean; + procedure Join(const Sel: TSynSelection); + function Intersects(const Other: TSynSelection): Boolean; + function Contains(const BC: TBufferCoord): Boolean; + constructor Create(const ACaret, AStart, AStop: TBufferCoord; ACaretAtEOL: + Boolean = False; ALastPosX: Integer = 0); + class operator Equal(a, b: TSynSelection): Boolean; + class operator NotEqual(a, b: TSynSelection): Boolean; + class function Invalid: TSynSelection; static; + function IsValid: Boolean; + end; + + TSynSelectionArray = TArray; + + (* Helper methods for TControl - for backwward compatibility *) + {$IF CompilerVersion <= 32} + TControlHelper = class helper for TControl + public + function CurrentPPI: Integer; + function FCurrentPPI: Integer; end; + {$ENDIF} function DisplayCoord(AColumn, ARow: Integer): TDisplayCoord; function BufferCoord(AChar, ALine: Integer): TBufferCoord; +type +{ *************************** For Carets **********************************} + +TCaretShape = record + Width: Integer; + Height: Integer; + Offset: TPoint; + constructor Create(AWidth, AHeight: Integer; AOffset: TPoint); +end; + + +{ ************************* For ScrollBars ********************************} + + ISynEditScrollBars = interface + function UpdateScrollBars: Boolean; + function GetIsScrolling: Boolean; + procedure WMHScroll(var AMsg: TWMScroll); + procedure WMVScroll(var AMsg: TWMScroll); + procedure DoMouseWheel(Shift: TShiftState; WheelDelta: Integer; + MousePos: TPoint); + property IsScrolling: Boolean read GetIsScrolling; + end; + +{ ************************* For Word Wrap ********************************} + + // aIndex parameters of Line notifications are 0-based. + // aRow parameter of GetRowLength() is 1-based. + ISynEditBufferPlugin = interface + // conversion methods + function BufferToDisplayPos(const aPos: TBufferCoord): TDisplayCoord; + function DisplayToBufferPos(const aPos: TDisplayCoord): TBufferCoord; + function RowCount: Integer; + function GetRowLength(aRow: Integer): Integer; + // plugin notifications + function LinesInserted(aIndex: Integer; aCount: Integer): Integer; + function LinesDeleted(aIndex: Integer; aCount: Integer): Integer; + function LinePut(aIndex: Integer; const OldLine: string): Integer; + // font or size change + procedure DisplayChanged; + // pretty clear, heh? + procedure Reset; + property RowLength[RowIndex: Integer]: Integer read GetRowLength; + end; + +{ ************************* For Undo Redo ********************************} + + // Note: several undo entries can be chained together via the ChangeNumber + // see also TCustomSynEdit.[Begin|End]UndoBlock methods + TSynChangeReason = ( + crNothing, + crInsert, crDelete, crSilentDelete, + crLineBreak, + crIndent, crUnindent, + crCaret, // just restore the Caret, allowing better Undo behavior + crSelection, // restore Selection + crWhiteSpaceAdd + // for undo/redo of adding a character past EOL and repositioning the caret + ); + + TSynEditUndoItem = class(TObject) + ChangeStartPos: TBufferCoord; + ChangeEndPos: TBufferCoord; + ChangeStr: string; + ChangeNumber: Integer; + ChangeReason: TSynChangeReason; + // the following undo item cannot be grouped with this one when undoing + // don't group the previous one with this one when redoing + GroupBreak: Boolean; + end; + + { Handles undo/redo and manages Modified status } + ISynEditUndo = interface + function GetModified: Boolean; + function GetMaxUndoActions: Integer; + function GetCanUndo: Boolean; + function GetCanRedo: Boolean; + function GetFullUndoImposible: Boolean; + function GetOnModifiedChanged: TNotifyEvent; + function GetInsideUndoRedo: Boolean; + procedure SetModified(const Value: Boolean); + procedure SetMaxUndoActions(const Value: Integer); + procedure SetGroupUndo(const Value: Boolean); + procedure SetOnModifiedChanged(const Event: TNotifyEvent); + procedure SetCommandProcessed(const Command: TSynEditorCommand); + { Begin/EndBlock pairs group undo actions together and also + store/restore editor caret and selection + We need to pass the Editor so that they works with chained SynEdits + } + procedure BeginBlock(Editor: TControl); + procedure EndBlock(Editor: TControl); + { Lock disables undo/redo - useful if you are about to do a large number of + changes and planning to clear undo afterwards } + procedure Lock; + procedure Unlock; + procedure Clear; + { Call AddGroupBreak to signal that the next undo action + cannot be grouped with the current one } + procedure AddGroupBreak; + {Note: Undo/Redo are not reentrant} + procedure Undo(Editor: TControl); + procedure Redo(Editor: TControl); + {TrackChanges stuff} + procedure BufferSaved(Lines: TStrings); + procedure ClearTrackChanges(Lines: TStrings); + + property CanRedo: Boolean read GetCanRedo; + property CanUndo: Boolean read GetCanUndo; + property GroupUndo: Boolean write SetGroupUndo; + property Modified: Boolean read GetModified write SetModified; + { Used by SynEdit to inform the Undo system about the command being + processed } + property CommandProcessed: TSynEditorCommand write SetCommandProcessed; + { MaxUndoActions zero or less indicates unlimited undo. It grows as needed. + If it is a positive number, when the limit is reached 1/4 of the + Undo history is discarded to make space for following undo actions } + property MaxUndoActions: Integer read GetMaxUndoActions + write SetMaxUndoActions; + property FullUndoImpossible: Boolean read GetFullUndoImposible; + property OnModifiedChanged: TNotifyEvent read GetOnModifiedChanged + write SetOnModifiedChanged; + property InsideUndoRedo: Boolean read GetInsideUndoRedo; + end; + implementation +Uses +{$IF CompilerVersion <= 32} + Vcl.Forms, +{$ENDIF} + SynEditStrConst, + SynUnicode; function DisplayCoord(AColumn, ARow: Integer): TDisplayCoord; begin @@ -121,8 +287,6 @@ function BufferCoord(AChar, ALine: Integer): TBufferCoord; Result.Line := ALine; end; -{$IFDEF SYN_COMPILER_10_UP} - { TBufferCoord } class operator TBufferCoord.Equal(a, b: TBufferCoord): Boolean; @@ -130,12 +294,72 @@ function BufferCoord(AChar, ALine: Integer): TBufferCoord; Result := (a.Char = b.Char) and (a.Line = b.Line); end; -{ TBufferBlock } +class operator TBufferCoord.GreaterThan(a, b: TBufferCoord): Boolean; +begin + Result := (b.Line < a.Line) + or ((b.Line = a.Line) and (b.Char < a.Char)) +end; -class operator TBufferBlock.Equal(a, b: TBufferBlock): Boolean; +class operator TBufferCoord.GreaterThanOrEqual(a, b: TBufferCoord): Boolean; begin - Result := (a.BeginLine = b.BeginLine) and (a.BeginChar = b.BeginChar) and - (a.EndLine = b.EndLine) and (a.EndChar = b.EndChar); + Result := (b.Line < a.Line) + or ((b.Line = a.Line) and (b.Char <= a.Char)) +end; + +class function TBufferCoord.Invalid: TBufferCoord; +begin + Result.Char := 0; + Result.Line := 0; +end; + +function TBufferCoord.IsValid: Boolean; +begin + Result := (Char > 0) and (Line > 0); +end; + +class operator TBufferCoord.LessThan(a, b: TBufferCoord): Boolean; +begin + Result := (b.Line > a.Line) + or ((b.Line = a.Line) and (b.Char > a.Char)) +end; + +class operator TBufferCoord.LessThanOrEqual(a, b: TBufferCoord): Boolean; +begin + Result := (b.Line > a.Line) + or ((b.Line = a.Line) and (b.Char >= a.Char)) +end; + +class function TBufferCoord.Max(a, b: TBufferCoord): TBufferCoord; +begin + if (b.Line < a.Line) + or ((b.Line = a.Line) and (b.Char < a.Char)) + then + Result := a + else + Result := b; +end; + +class function TBufferCoord.Min(a, b: TBufferCoord): TBufferCoord; +begin + if (b.Line < a.Line) + or ((b.Line = a.Line) and (b.Char < a.Char)) + then + Result := b + else + Result := a; +end; + +class operator TBufferCoord.NotEqual(a, b: TBufferCoord): Boolean; +begin + Result := (a.Char <> b.Char) or (a.Line <> b.Line); +end; + +function TBufferCoord.ToString(ShortForm: Boolean = True): string; +begin + if ShortForm then + Result := Format('%d:%d', [Self.Line, Self.Char]) + else + Result := Format('%s: %d %s: %d',[SYNS_Line, Self.Line, SYNS_Char, Self.Char]); end; { TDisplayCoord } @@ -145,6 +369,161 @@ function BufferCoord(AChar, ALine: Integer): TBufferCoord; Result := (a.Row = b.Row) and (a.Column = b.Column); end; +class operator TDisplayCoord.GreaterThan(a, b: TDisplayCoord): Boolean; +begin + Result := (b.Row < a.Row) + or ((b.Row = a.Row) and (b.Column < a.Column)) +end; + +class operator TDisplayCoord.GreaterThanOrEqual(a, b: TDisplayCoord): Boolean; +begin + Result := (b.Row < a.Row) + or ((b.Row = a.Row) and (b.Column <= a.Column)) +end; + +class operator TDisplayCoord.LessThan(a, b: TDisplayCoord): Boolean; +begin + Result := (b.Row > a.Row) + or ((b.Row = a.Row) and (b.Column > a.Column)) +end; + +class operator TDisplayCoord.LessThanOrEqual(a, b: TDisplayCoord): Boolean; +begin + Result := (b.Row > a.Row) + or ((b.Row = a.Row) and (b.Column >= a.Column)) +end; + +class function TDisplayCoord.Max(a, b: TDisplayCoord): TDisplayCoord; +begin + if (b.Row < a.Row) + or ((b.Row = a.Row) and (b.Column < a.Column)) + then + Result := a + else + Result := b; +end; + +class function TDisplayCoord.Min(a, b: TDisplayCoord): TDisplayCoord; +begin + if (b.Row < a.Row) + or ((b.Row = a.Row) and (b.Column < a.Column)) + then + Result := b + else + Result := a; +end; + +class operator TDisplayCoord.NotEqual(a, b: TDisplayCoord): Boolean; +begin + Result := (a.Row <> b.Row) or (a.Column <> b.Column); +end; + +{$IF CompilerVersion <= 32} +{ TControlHelper } + +function TControlHelper.CurrentPPI: Integer; +begin + Result := Screen.PixelsPerInch; +end; + +function TControlHelper.FCurrentPPI: Integer; +begin + Result := Screen.PixelsPerInch; +end; {$ENDIF} + + +{ TSynSelection } + +function TSynSelection.Contains(const BC: TBufferCoord): Boolean; +begin + Result := (BC >= TBufferCoord.Min(Start, Stop)) and + (BC < TBufferCoord.Max(Start, Stop)); +end; + +constructor TSynSelection.Create(const ACaret, AStart, AStop: TBufferCoord; + ACaretAtEOL: Boolean = False; ALastPosX: Integer = 0); +begin + Caret := ACaret; + Start := AStart; + Stop := AStop; + CaretAtEOL := ACaretAtEOL; + LastPosX := ALastPosX; +end; + +class operator TSynSelection.Equal(a, b: TSynSelection): Boolean; +begin + Result := (a.Start = b.Start) and (a.Stop = b.Stop); +end; + +function TSynSelection.Intersects(const Other: TSynSelection): Boolean; +begin + Result := Self.Contains(Other.Start) or Self.Contains(Other.Stop) or + Other.Contains(TBufferCoord.Min(Self.Start, Self.Stop)); +end; + +class function TSynSelection.Invalid: TSynSelection; +begin + Result := TSynSelection.Create(TBufferCoord.Invalid, TBufferCoord.Invalid, + TBufferCoord.Invalid); +end; + +function TSynSelection.IsEmpty: Boolean; +begin + Result := Start = Stop +end; + +function TSynSelection.IsValid: Boolean; +begin + Result := Caret.IsValid and Start.IsValid and Stop.IsValid; +end; + +procedure TSynSelection.Join(const Sel: TSynSelection); +var + N1, N2: TSynSelection; +begin + N1 := Normalized; + N2 := Sel.Normalized; + Start := TBufferCoord.Min(N1.Start, N2.Start); + Stop := TBufferCoord.Max(N1.Stop, N2.Stop); + // Set the caret to the Start or the Stop depending on the orignal carets + if (Sel.Caret = Start) or (Sel.Caret = Stop) then + Caret := Sel.Caret + else if not (Caret = Start) and not (Caret = Stop) then + Caret := Stop; +end; + +procedure TSynSelection.Normalize; +begin + if Start > Stop then + begin + var Temp := Start; + Start := Stop; + Stop := Temp; + Caret := Stop; + end; +end; + +function TSynSelection.Normalized: TSynSelection; +begin + Result := Self; + Result.Normalize; +end; + +class operator TSynSelection.NotEqual(a, b: TSynSelection): Boolean; +begin + Result := (a.Start <> b.Start) or (a.Stop <> b.Stop) +end; + +{ TCaretShape } + +constructor TCaretShape.Create(AWidth, AHeight: Integer; AOffset: TPoint); +begin + Width := AWidth; + Height := AHeight; + Offset := AOffset; +end; + end. + diff --git a/Ext/SynEdit/Source/SynEditUndo.pas b/Ext/SynEdit/Source/SynEditUndo.pas new file mode 100644 index 0000000..e0ad496 --- /dev/null +++ b/Ext/SynEdit/Source/SynEditUndo.pas @@ -0,0 +1,955 @@ +{ ------------------------------------------------------------------------------- + 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. + + Contributors to the SynEdit and mwEdit projects are listed in the + Contributors.txt file. + + Alternatively, the contents of this file may be used under the terms of the + GNU General Public License Version 2 or later (the "GPL"), in which case + the provisions of the GPL are applicable instead of those above. + If you wish to allow use of your version of this file only under the terms + of the GPL and not to allow others to use your version of this file + under the MPL, indicate your decision by deleting the provisions above and + replace them with the notice and other provisions required by the GPL. + If you do not delete the provisions above, a recipient may use your version + of this file under either the MPL or the GPL. + + Known Issues: + ------------------------------------------------------------------------------- } + +unit SynEditUndo; + +{$I SynEdit.inc} + +interface + +uses + SynEdit, + SynEditTypes, + SynEditKeyCmds; + +{ Factory Method} + +function CreateSynEditUndo(Editor: TCustomSynEdit): ISynEditUndo; + +implementation + +uses + System.Classes, + System.SysUtils, + System.Math, + System.Generics.Collections, + Vcl.Controls, + SynEditMiscProcs, + SynEditMiscClasses, + SynEditTextBuffer; + +type + + TSynUndoItem = class abstract(TObject) + ChangeNumber: Integer; // Undo items with the same change number are grouped + FCaret: TBufferCoord; + GroupBreak: Boolean; // Singnals not to group items together + public + procedure Undo(Editor: TCustomSynEdit); virtual; abstract; + procedure Redo(Editor: TCustomSynEdit); virtual; abstract; + end; + + TSynLinePutUndoItem = class(TSynUndoItem) + private + FIndex: Integer; + FStartPos: Integer; + FOldValue: string; + FNewValue: string; + FChangeFlags: TSynLineChangeFlags; + FCommandProcessed: TSynEditorCommand; + public + function GroupWith(Item:TSynLinePutUndoItem): Boolean; + procedure Undo(Editor: TCustomSynEdit); override; + procedure Redo(Editor: TCustomSynEdit); override; + constructor Create(Editor: TCustomSynEdit; Index: Integer; OldLine: string; + Command: TSynEditorCommand); + end; + + TSynLinesInsertedUndoItem = class(TSynUndoItem) + private + FIndex: Integer; + FLines: TArray; + FChangeFlags: TArray; + public + procedure Undo(Editor: TCustomSynEdit); override; + procedure Redo(Editor: TCustomSynEdit); override; + constructor Create(Editor: TCustomSynEdit; Index, Count: Integer); + end; + + TSynLinesDeletedUndoItem = class(TSynUndoItem) + private + FIndex: Integer; + FLines: TArray; + FChangeFlags: TArray; + public + procedure Undo(Editor: TCustomSynEdit); override; + procedure Redo(Editor: TCustomSynEdit); override; + constructor Create(Editor: TCustomSynEdit; Index: Integer; DeletedLines: + TArray; DeletedChangeFlags: TArray); + end; + + TSynCaretAndSelectionUndoItem = class(TSynUndoItem) + private + FBlockBegin: TBufferCoord; + FBlockEnd: TBufferCoord; + SelStorage: TSynSelStorage; + public + procedure Undo(Editor: TCustomSynEdit); override; + procedure Redo(Editor: TCustomSynEdit); override; + constructor Create(Editor: TCustomSynEdit); + end; + + TSynEditUndo = class; + + TSynUndoPlugin = class(TSynEditPlugin) + private + FSynEditUndo: TSynEditUndo; + FDeletedLines: TArray; + FDeletedChangeFlags: TArray; + protected + procedure LinesInserted(FirstLine, Count: Integer); override; + procedure LinesBeforeDeleted(FirstLine, Count: Integer); override; + procedure LinesDeleted(FirstLine, Count: Integer); override; + procedure LinePut(aIndex: Integer; const OldLine: string); override; + public + constructor Create(SynEditUndo: TSynEditUndo; Editor: TCustomSynEdit); + end; + + TSynEditUndoList = class(TObjectStack) + protected + FOwner: TSynEditUndo; + FFullUndoImposible: Boolean; + procedure EnsureMaxEntries; + public + constructor Create(Owner: TSynEditUndo); + procedure Push(const Value: TSynUndoItem); + end; + + TSynEditUndo = class(TInterfacedObject, ISynEditUndo) + private + FPlugin: TSynUndoPlugin; + FGroupUndo: Boolean; + FBlockCount: Integer; + FLockCount: Integer; + FBlockChangeNumber: Integer; + FNextChangeNumber: Integer; + FInitialChangeNumber: Integer; + FMaxUndoActions: Integer; + FBlockStartModified: Boolean; + FUndoList: TSynEditUndoList; + FRedoList: TSynEditUndoList; + FOnModifiedChanged: TNotifyEvent; + FInsideUndoRedo: Boolean; + FCommandProcessed: TSynEditorCommand; + FBlockSelRestoreItem: TSynUndoItem; + function GetModified: Boolean; + function GetCanUndo: Boolean; + function GetCanRedo: Boolean; + function GetFullUndoImposible: Boolean; + function GetOnModifiedChanged: TNotifyEvent; + function GetInsideUndoRedo: Boolean; + procedure SetModified(const Value: Boolean); + procedure SetCommandProcessed(const Command: TSynEditorCommand); + procedure SetMaxUndoActions(const Value: Integer); + procedure SetOnModifiedChanged(const Value: TNotifyEvent); + procedure SetGroupUndo(const Value: Boolean); + function GetMaxUndoActions: Integer; + procedure BeginBlock(Editor: TControl); + procedure EndBlock(Editor: TControl); + procedure Lock; + procedure Unlock; + function IsLocked: Boolean; + procedure Clear; + procedure Undo(Editor: TControl); + procedure Redo(Editor: TControl); + procedure BufferSaved(Lines: TStrings); + procedure ClearTrackChanges(Lines: TStrings); + + function NextChangeNumber: Integer; + procedure AddGroupBreak; + procedure AddUndoItem(Item: TSynUndoItem); + public + constructor Create(Editor: TCustomSynEdit); + destructor Destroy; override; + end; + +{ TSynEditUndoList } + +constructor TSynEditUndoList.Create(Owner: TSynEditUndo); +begin + inherited Create(True); + FOwner := Owner; +end; + +procedure TSynEditUndoList.EnsureMaxEntries; +var + KeepCount: Integer; + ItemArray: TArray; + I: Integer; +begin + if FOwner.FMaxUndoActions <= 0 then Exit; + + if Count > FOwner.FMaxUndoActions then + begin + FFullUndoImposible := True; + KeepCount := (FOwner.FMaxUndoActions div 4) * 3; + ItemArray := ToArray; + for I := 1 to KeepCount do + Extract; + Clear; // Destroys remaining items + for I := Length(ItemArray) - KeepCount to Length(ItemArray) - 1 do + Push(ItemArray[I]); + end; +end; + +procedure TSynEditUndoList.Push(const Value: TSynUndoItem); +begin + inherited Push(Value); + EnsureMaxEntries; +end; + +{ TSynEditUndo } + +procedure TSynEditUndo.AddUndoItem(Item: TSynUndoItem); +var + OldModified: Boolean; +begin + Assert(not FInsideUndoRedo); + OldModified := GetModified; + if FBlockChangeNumber <> 0 then + Item.ChangeNumber := FBlockChangeNumber + else + Item.ChangeNumber := NextChangeNumber; + FUndoList.Push(Item); + FRedoList.Clear; + // Do not sent unnecessary notifications + if (FBlockCount = 0) and (OldModified xor GetModified) and + Assigned(FOnModifiedChanged) + then + FOnModifiedChanged(Self); +end; + +procedure TSynEditUndo.AddGroupBreak; +begin + if (FUndoList.Count > 0) and (FBlockCount = 0) then + FUndoList.Peek.GroupBreak := True; +end; + +procedure TSynEditUndo.BeginBlock(Editor: TControl); +begin + if IsLocked then Exit; + + Inc(FBlockCount); + if FBlockCount = 1 then // it was 0 + begin + FBlockStartModified := GetModified; + // All undo items added until the matching EndBlock is called + // will get the same change number and will be grouped together + FBlockChangeNumber := NextChangeNumber; + + // So that position is restored after Redo + FBlockSelRestoreItem := TSynCaretAndSelectionUndoItem.Create(Editor as TCustomSynEdit); + FBlockSelRestoreItem.ChangeNumber := FBlockChangeNumber; + FUndoList.Push(FBlockSelRestoreItem); + end; +end; + +procedure TSynEditUndo.BufferSaved(Lines: TStrings); + + procedure PutItemSaved(Item: TSynLinePutUndoItem); + begin + if Item.FChangeFlags = [sfAsSaved] then + Item.FChangeFlags := [sfModified]; + end; + + procedure InsertedItemSaved(Item: TSynLinesInsertedUndoItem); + var + I: Integer; + begin + for I := 0 to Length(Item.FChangeFlags) - 1 do + Item.FChangeFlags[I] := [sfModified]; + end; + + procedure DeletedItemSaved(Item: TSynLinesDeletedUndoItem); + var + I: Integer; + begin + for I := 0 to Length(Item.FChangeFlags) - 1 do + Item.FChangeFlags[I] := [sfModified]; + end; + +var + SynLines: TSynEditStringList; + Index: Integer; + Flags: TSynLineChangeFlags; + Item: TSynUndoItem; +begin + SynLines := Lines as TSynEditStringList; + // First change the flags of TSynEditStringList + for Index := 0 to SynLines.Count - 1 do + begin + Flags := SynLines.ChangeFlags[Index]; + if Flags = [sfSaved] then + // original line saved and then restored + SynLines.ChangeFlags[Index] := [] + else if sfModified in Flags then + SynLines.ChangeFlags[Index] := Flags - [sfModified] + [sfSaved, sfAsSaved]; + end; + // Then modify the Undo/Redo lists + for Item in FUndoList do + if Item is TSynLinePutUndoItem then + PutItemSaved(TSynLinePutUndoItem(Item)) + else if Item is TSynLinesInsertedUndoItem then + InsertedItemSaved(TSynLinesInsertedUndoItem(Item)) + else if Item is TSynLinesDeletedUndoItem then + DeletedItemSaved(TSynLinesDeletedUndoItem(Item)); + + for Item in FRedoList do + if Item is TSynLinePutUndoItem then + PutItemSaved(TSynLinePutUndoItem(Item)) + else if Item is TSynLinesInsertedUndoItem then + InsertedItemSaved(TSynLinesInsertedUndoItem(Item)) + else if Item is TSynLinesDeletedUndoItem then + DeletedItemSaved(TSynLinesDeletedUndoItem(Item)); +end; + +procedure TSynEditUndo.Clear; +begin + FUndoList.Clear; + FRedoList.Clear; +end; + +procedure TSynEditUndo.ClearTrackChanges(Lines: TStrings); + procedure InsertedItemClear(Item: TSynLinesInsertedUndoItem); + var + I: Integer; + begin + for I := 0 to Length(Item.FChangeFlags) - 1 do + Item.FChangeFlags[I] := [sfModified]; + end; + + procedure DeletedItemClear(Item: TSynLinesDeletedUndoItem); + var + I: Integer; + begin + for I := 0 to Length(Item.FChangeFlags) - 1 do + Item.FChangeFlags[I] := [sfModified]; + end; +var + SynLines: TSynEditStringList; + Index: Integer; + Item: TSynUndoItem; +begin + SynLines := Lines as TSynEditStringList; + // First change the flags of TSynEditStringList + for Index := 0 to SynLines.Count - 1 do + SynLines.ChangeFlags[Index] := []; + // Then modify the Undo/Redo lists + for Item in FUndoList do + if Item is TSynLinesInsertedUndoItem then + InsertedItemClear(TSynLinesInsertedUndoItem(Item)) + else if Item is TSynLinesDeletedUndoItem then + DeletedItemClear(TSynLinesDeletedUndoItem(Item)); + + for Item in FRedoList do + if Item is TSynLinesInsertedUndoItem then + InsertedItemClear(TSynLinesInsertedUndoItem(Item)) + else if Item is TSynLinesDeletedUndoItem then + DeletedItemClear(TSynLinesDeletedUndoItem(Item)); +end; + +constructor TSynEditUndo.Create(Editor: TCustomSynEdit); +begin + inherited Create; + FGroupUndo := True; + FMaxUndoActions := 0; + FNextChangeNumber := 1; + FUndoList := TSynEditUndoList.Create(Self); + FRedoList := TSynEditUndoList.Create(Self); + FPlugin := TSynUndoPlugin.Create(Self, Editor); +end; + +destructor TSynEditUndo.Destroy; +begin + FUndoList.Free; + FRedoList.Free; + inherited; +end; + +procedure TSynEditUndo.EndBlock(Editor: TControl); +var + Item: TSynCaretAndSelectionUndoItem; +begin + if IsLocked then Exit; + + Assert(FBlockCount > 0); + if FBlockCount > 0 then + begin + Dec(FBlockCount); + if FBlockCount = 0 then + begin + if (FUndoList.Count > 0) and (FUndoList.Peek = FBlockSelRestoreItem) then + // No undo items added from BlockBegin to BlockEnd + FUndoList.Pop + else + begin + // So that position is restored after Redo + Item := TSynCaretAndSelectionUndoItem.Create(Editor as TCustomSynEdit); + Item.ChangeNumber := FBlockChangeNumber; + FUndoList.Push(Item); + end; + + FBlockChangeNumber := 0; + AddGroupBreak; + if FBlockStartModified xor GetModified and Assigned(FOnModifiedChanged) then + FOnModifiedChanged(Self); + end; + end; +end; + +function TSynEditUndo.GetCanUndo: Boolean; +begin + Result := FUndoList.Count > 0; +end; + +function TSynEditUndo.GetFullUndoImposible: Boolean; +begin + Result := FUndoList.FFullUndoImposible; +end; + +function TSynEditUndo.GetInsideUndoRedo: Boolean; +begin + Result := FInsideUndoRedo; +end; + +function TSynEditUndo.GetMaxUndoActions: Integer; +begin + Result := FMaxUndoActions; +end; + +function TSynEditUndo.GetModified: Boolean; +begin + if FUndoList.Count = 0 then + Result := FInitialChangeNumber <> 0 + else + Result := FUndoList.Peek.ChangeNumber <> FInitialChangeNumber; +end; + +function TSynEditUndo.GetOnModifiedChanged: TNotifyEvent; +begin + Result := FOnModifiedChanged; +end; + +function TSynEditUndo.IsLocked: Boolean; +begin + Result := FLockCount > 0; +end; + +function TSynEditUndo.GetCanRedo: Boolean; +begin + Result := FRedoList.Count > 0; +end; + +procedure TSynEditUndo.Lock; +begin + Inc(FLockCount); +end; + +function TSynEditUndo.NextChangeNumber: Integer; +begin + Result := FNextChangeNumber; + Inc(FNextChangeNumber); +end; + +procedure TSynEditUndo.Redo(Editor: TControl); +var + Item, LastItem: TSynUndoItem; + OldChangeNumber: Integer; + OldModified: Boolean; + FKeepGoing: Boolean; + LastItemHasGroupBreak: Boolean; +begin + Assert((FBlockCount = 0) and (FBlockChangeNumber = 0)); + + if FRedoList.Count > 0 then + begin + Item := FRedoList.Peek; + OldModified := GetModified; + OldChangeNumber := Item.ChangeNumber; + + repeat + Item := FRedoList.Extract; + LastItemHasGroupBreak := Item.GroupBreak; + LastItem := Item; + FInsideUndoRedo := True; + try + Item.Redo(Editor as TCustomSynEdit); + finally + FInsideUndoRedo := False; + end; + // Move it to the UndoList + FUndoList.Push(Item); + + if FRedoList.Count = 0 then + Break + else + Item := FRedoList.Peek; + + if Item.ChangeNumber = OldChangeNumber then + FKeepGoing := True + else + FKeepGoing := + FGroupUndo and + { Last Item had a group break - Stop redoing } + not LastItemHasGroupBreak and + { Group together same undo actions } + (LastItem is TSynLinePutUndoItem) and + (Item is TSynLinePutUndoItem) and + TSynLinePutUndoItem(LastItem).GroupWith(TSynLinePutUndoItem(Item)); + until not(FKeepGoing); + + if not (Item is TSynCaretAndSelectionUndoItem) then + begin + (Editor as TCustomSynEdit).Selections.Clear; + (Editor as TCustomSynEdit).CaretXY := Item.FCaret; // removes selection + end; + if (OldModified xor GetModified) and Assigned(FOnModifiedChanged) then + FOnModifiedChanged(Self); + end; +end; + +procedure TSynEditUndo.SetCommandProcessed(const Command: TSynEditorCommand); +begin + FCommandProcessed := Command; +end; + +procedure TSynEditUndo.SetGroupUndo(const Value: Boolean); +begin + FGroupUndo := Value; +end; + +procedure TSynEditUndo.SetMaxUndoActions(const Value: Integer); +begin + if Value <> FMaxUndoActions then + begin + FMaxUndoActions := Value; + FUndoList.EnsureMaxEntries; + FRedoList.EnsureMaxEntries; + end; +end; + +procedure TSynEditUndo.SetModified(const Value: Boolean); +begin + if not Value then + begin + if FUndoList.Count = 0 then + FInitialChangeNumber := 0 + else + FInitialChangeNumber := FUndoList.Peek.ChangeNumber; + end + else if FUndoList.Count = 0 then + begin + if FInitialChangeNumber = 0 then + FInitialChangeNumber := -1; + end + else if FUndoList.Peek.ChangeNumber = FInitialChangeNumber then + FInitialChangeNumber := -1 +end; + +procedure TSynEditUndo.SetOnModifiedChanged(const Value: TNotifyEvent); +begin + FOnModifiedChanged := Value; +end; + +procedure TSynEditUndo.Undo(Editor: TControl); +var + Item, LastItem: TSynUndoItem; + OldChangeNumber: Integer; + OldModified: Boolean; + FKeepGoing: Boolean; +begin + Assert((FBlockCount = 0) and (FBlockChangeNumber = 0)); + + if FUndoList.Count > 0 then + begin + Item := FUndoList.Peek; + OldModified := GetModified; + OldChangeNumber := Item.ChangeNumber; + + repeat + Item := FUndoList.Extract; + LastItem := Item; + FInsideUndoRedo := True; + try + Item.Undo(Editor as TCustomSynEdit); + finally + FInsideUndoRedo := False; + end; + // Move it to the RedoList + FRedoList.Push(Item); + + if FUndoList.Count = 0 then + Break + else + Item := FUndoList.Peek; + + if Item.ChangeNumber = OldChangeNumber then + FKeepGoing := True + else + FKeepGoing := + FGroupUndo and + { Last Item had a group break - Stop redoing } + not Item.GroupBreak and + { Group together same undo actions } + (LastItem is TSynLinePutUndoItem) and + (Item is TSynLinePutUndoItem) and + TSynLinePutUndoItem(Item).GroupWith(TSynLinePutUndoItem(LastItem)); + until not(FKeepGoing); + + if not (LastItem is TSynCaretAndSelectionUndoItem) then + begin + (Editor as TCustomSynEdit).Selections.Clear; + (Editor as TCustomSynEdit).SetCaretAndSelection(LastItem.FCaret, LastItem.FCaret, + LastItem.FCaret); + end; + if (OldModified xor GetModified) and Assigned(FOnModifiedChanged) then + FOnModifiedChanged(Self); + end; +end; + +procedure TSynEditUndo.Unlock; +begin + if FLockCount > 0 then + Dec(FLockCount); +end; + +{ Factory Method} + +function CreateSynEditUndo(Editor: TCustomSynEdit): ISynEditUndo; +begin + Result := TSynEditUndo.Create(Editor); +end; + +{ TSynCaretAndSelectionUndoItem } + +constructor TSynCaretAndSelectionUndoItem.Create(Editor: TCustomSynEdit); +begin + inherited Create; + if Editor.Selections.Count = 1 then + begin + FCaret := Editor.CaretXY; + FBlockBegin := Editor.BlockBegin; + FBlockEnd := Editor.BlockEnd; + end + else + begin + Editor.Selections.Store(SelStorage); + end; +end; + +procedure TSynCaretAndSelectionUndoItem.Redo(Editor: TCustomSynEdit); +begin + // Same as Undo + Undo(Editor); +end; + +procedure TSynCaretAndSelectionUndoItem.Undo(Editor: TCustomSynEdit); +begin + if Length(SelStorage.Selections) > 0 then + Editor.Selections.Restore(SelStorage) + else + begin + Editor.Selections.Clear; + Editor.SetCaretAndSelection(FCaret, FBlockBegin, FBlockEnd); + end; +end; + +{ TSynLinesDeletedUndoItem } + +constructor TSynLinesDeletedUndoItem.Create(Editor: TCustomSynEdit; Index: + Integer; DeletedLines: TArray; DeletedChangeFlags: + TArray); +begin + inherited Create; + FIndex := Index; + FLines := DeletedLines; + FChangeFlags := DeletedChangeFlags; +end; + +procedure TSynLinesDeletedUndoItem.Redo(Editor: TCustomSynEdit); +var + I: Integer; +begin + // Save change flags + SetLength(FChangeFlags, Length(FLines)); + for I := 0 to Length(FLines) - 1 do + FChangeFlags[I] := TSynEditStringList(Editor.Lines).ChangeFlags[FIndex + I]; + + TSynEditStringList(Editor.Lines).DeleteLines(FIndex, Length(FLines)); + FCaret := BufferCoord(1, FIndex + 1); +end; + +procedure TSynLinesDeletedUndoItem.Undo(Editor: TCustomSynEdit); +var + I: Integer; +begin + TSynEditStringList(Editor.Lines).InsertStrings(FIndex, FLines); + + // Restore change flags + for I := 0 to Length(FLines) - 1 do + TSynEditStringList(Editor.Lines).ChangeFlags[FIndex + I] := FChangeFlags[I]; + + FCaret := BufferCoord(1, + Min(Editor.Lines.Count, FIndex + Length(FLines) + 1)); +end; + +{ TSynLinesInsertedUndoItem } + +constructor TSynLinesInsertedUndoItem.Create(Editor: TCustomSynEdit; Index, + Count: Integer); +var + I: Integer; +begin + inherited Create; + FIndex := Index; + SetLength(FLines, Count); + for I := 0 to Count - 1 do + begin + FLines[I] := Editor.Lines[Index + I]; + // Mark the lines modified + TSynEditStringList(Editor.Lines).ChangeFlags[Index + I] := [sfModified]; + end; +end; + +procedure TSynLinesInsertedUndoItem.Redo(Editor: TCustomSynEdit); +var + I: Integer; +begin + TSynEditStringList(Editor.Lines).InsertStrings(FIndex, FLines); + + // Restore change flags + for I := 0 to Length(FLines) - 1 do + TSynEditStringList(Editor.Lines).ChangeFlags[FIndex + I] := FChangeFlags[I]; + + FCaret := BufferCoord(1, + Min(Editor.Lines.Count, FIndex + Length(FLines) + 1)); +end; + +procedure TSynLinesInsertedUndoItem.Undo(Editor: TCustomSynEdit); +var + I: Integer; +begin + // Save change flags + SetLength(FChangeFlags, Length(FLines)); + for I := 0 to Length(FLines) - 1 do + FChangeFlags[I] := TSynEditStringList(Editor.Lines).ChangeFlags[FIndex + I]; + + TSynEditStringList(Editor.Lines).DeleteLines(FIndex, Length(FLines)); + FCaret := BufferCoord(1, FIndex + 1); +end; + +{ TSynLinePutUndoItem } + +function TSynLinePutUndoItem.GroupWith(Item: TSynLinePutUndoItem): Boolean; +begin + if (FNewValue.Length = Item.FNewValue.Length) and + (FOldValue.Length = Item.FOldValue.Length) and + (FOldValue.Length <= 1) and (FNewValue.Length <= 1) and + (Abs(FStartPos - Item.FStartPos) <= 1) + then + Result := True + else + Result := False; +end; + +constructor TSynLinePutUndoItem.Create(Editor: TCustomSynEdit; Index: Integer; + OldLine: string; Command: TSynEditorCommand); +var + Len1, Len2: Integer; + Line: string; +begin + FCommandProcessed := Command; + + FIndex := Index; + Line := Editor.Lines[Index]; + + LineDiff(Line, OldLine, FStartPos, Len1, Len2); + + FOldValue := Copy(OldLine, FStartPos, Len1); + FNewValue := Copy(Line, FStartPos, Len2); + + FChangeFlags := TSynEditStringList(Editor.Lines).ChangeFlags[Index] - + [sfSaved]; + TSynEditStringList(Editor.Lines).ChangeFlags[Index] := + TSynEditStringList(Editor.Lines).ChangeFlags[Index] + + [sfModified] - [sfAsSaved]; +end; + +procedure TSynLinePutUndoItem.Redo(Editor: TCustomSynEdit); +var + Line: string; + Char: Integer; + TempCF: TSynLineChangeFlags; +begin + Line := Editor.Lines[FIndex]; + // Delete New + Delete(Line, FStartPos, FOldValue.Length); + Insert(FNewValue, Line, FStartPos); + Editor.Lines[FIndex] := Line; + // Swap change flags + TempCF := FChangeFlags; + FChangeFlags := TSynEditStringList(Editor.Lines).ChangeFlags[FIndex] - + [sfSaved]; + TSynEditStringList(Editor.Lines).ChangeFlags[FIndex] := + TSynEditStringList(Editor.Lines).ChangeFlags[FIndex] + - [sfModified, sfAsSaved] + TempCF; + // Guess Caret position + case FCommandProcessed of + ecChar: + if (FOldValue.Length = 1) and (FNewValue.Length = 1) then + Char := FStartPos // Typing in Insert Mode + else + Char := FStartPos + FNewValue.Length; + ecDeleteChar, + ecDeleteWord, + ecDeleteEOL: Char := FStartPos; + else + Char := FStartPos + FNewValue.Length; + end; + FCaret := BufferCoord(Char, FIndex + 1); +end; + +procedure TSynLinePutUndoItem.Undo(Editor: TCustomSynEdit); +var + Line: string; + Char: Integer; + TempCF: TSynLineChangeFlags; +begin + Line := Editor.Lines[FIndex]; + // Delete New + Delete(Line, FStartPos, FNewValue.Length); + Insert(FOldValue, Line, FStartPos); + Editor.Lines[FIndex] := Line; + // Swap change flags + TempCF := FChangeFlags; + FChangeFlags := TSynEditStringList(Editor.Lines).ChangeFlags[FIndex] - + [sfSaved]; + TSynEditStringList(Editor.Lines).ChangeFlags[FIndex] := + TSynEditStringList(Editor.Lines).ChangeFlags[FIndex] + - [sfModified, sfAsSaved] + TempCF; + // Guess Caret position + case FCommandProcessed of + ecChar: + if (FOldValue.Length = 1) and (FNewValue.Length = 1) then + Char := FStartPos // Typing in Overwrite Mode + else + Char := FStartPos + FOldValue.Length; + ecDeleteChar, + ecDeleteWord, + ecDeleteEOL: Char := FStartPos; + else + Char := FStartPos + FOldValue.Length; + end; + FCaret := BufferCoord(Char, FIndex + 1); +end; + +{ TSynUndoPlugin } + +constructor TSynUndoPlugin.Create(SynEditUndo: TSynEditUndo; + Editor: TCustomSynEdit); +begin + FSynEditUndo := SynEditUndo; + inherited Create(Editor, + [phLinePut, phLinesInserted, phLinesBeforeDeleted, phLinesDeleted]); +end; + +procedure TSynUndoPlugin.LinePut(aIndex: Integer; const OldLine: string); +var + Line: string; + Item: TSynLinePutUndoItem; +begin + if Editor.IsChained or FSynEditUndo.IsLocked or FSynEditUndo.FInsideUndoRedo + then + Exit; + + Line := Editor.Lines[aIndex]; + if Line <> OldLine then + begin + Item := TSynLinePutUndoItem.Create(Editor, aIndex, OldLine, + FSynEditUndo.FCommandProcessed); + FSynEditUndo.AddUndoItem(Item); + end; +end; + +procedure TSynUndoPlugin.LinesBeforeDeleted(FirstLine, Count: Integer); +var + I: Integer; +begin + if Editor.IsChained or FSynEditUndo.IsLocked or FSynEditUndo.FInsideUndoRedo + then + Exit; + + // Save deleted lines and change flags + SetLength(FDeletedLines, Count); + SetLength(FDeletedChangeFlags, Count); + for I := 0 to Count -1 do + begin + FDeletedLines[I] := Editor.Lines[FirstLine + I]; + FDeletedChangeFlags[I] := + TSynEditStringList(Editor.Lines).ChangeFlags[FirstLine + I]; + end; +end; + +procedure TSynUndoPlugin.LinesDeleted(FirstLine, Count: Integer); +var + Item: TSynLinesDeletedUndoItem; +begin + if Editor.IsChained or FSynEditUndo.IsLocked or FSynEditUndo.FInsideUndoRedo + then + Exit; + + if Count > 0 then + begin + Item := TSynLinesDeletedUndoItem.Create(Editor, FirstLine, + FDeletedLines, FDeletedChangeFlags); + FSynEditUndo.AddUndoItem(Item); + end; +end; + +procedure TSynUndoPlugin.LinesInserted(FirstLine, Count: Integer); +var + Item: TSynLinesInsertedUndoItem; +begin + if Editor.IsChained or FSynEditUndo.IsLocked or FSynEditUndo.FInsideUndoRedo + then + Exit; + + // Consider a file with one empty line as empty + // Otherwise when you type in a new file and undo it, CanUndo will still + // return True because the initial insertion will be on the Undo list + if (FSynEditUndo.FUndoList.Count = 0) and + (Editor.Lines.Count = 1) and (Editor.Lines[0] = '') + then + Exit; + + if Count > 0 then + begin + Item := TSynLinesInsertedUndoItem.Create(Editor, FirstLine, Count); + FSynEditUndo.AddUndoItem(Item); + end; +end; + +end. diff --git a/Ext/SynEdit/Source/SynEditWildcardSearch.pas b/Ext/SynEdit/Source/SynEditWildcardSearch.pas index c74af5b..f34b357 100644 --- a/Ext/SynEdit/Source/SynEditWildcardSearch.pas +++ b/Ext/SynEdit/Source/SynEditWildcardSearch.pas @@ -26,17 +26,11 @@ If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: SynEditWildcardSearch.pas,v 1.2.2.2 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - Known Issues: + - Same limitations as TSynEditRegexSearch -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITWILDCARDSEARCH} unit SynEditWildcardSearch; -{$ENDIF} {$I SynEdit.inc} @@ -45,7 +39,6 @@ interface uses SynEdit, SynEditTypes, - SynRegExpr, SynEditRegexSearch, Classes; @@ -65,8 +58,9 @@ TSynEditWildcardSearch = class(TSynEditRegexSearch) public constructor Create(AOwner: TComponent); override; destructor Destroy; override; - function FindAll(const NewText: UnicodeString): Integer; override; - function Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; override; //slm 11/29/02 + function FindAll(const NewText: string; StartChar: Integer = 1; + EndChar: Integer = 0): Integer; override; + function Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; override; end; implementation @@ -79,7 +73,7 @@ implementation constructor TSynEditWildcardSearch.Create(AOwner: TComponent); begin inherited Create(AOwner); - FPattern := ''; + fPattern := ''; end; destructor TSynEditWildcardSearch.Destroy; @@ -87,9 +81,10 @@ destructor TSynEditWildcardSearch.Destroy; inherited; end; -function TSynEditWildcardSearch.FindAll(const NewText: UnicodeString): integer; +function TSynEditWildcardSearch.FindAll(const NewText: string; + StartChar: Integer = 1; EndChar: Integer = 0): Integer; begin - Result := inherited FindAll(NewText); + Result := inherited FindAll(NewText, StartChar, EndChar); end; function TSynEditWildcardSearch.Replace(const aOccurrence, aReplacement: UnicodeString): UnicodeString; @@ -107,12 +102,12 @@ function TSynEditWildcardSearch.GetPattern: UnicodeString; Result := fPattern; end; -function TSynEditWildcardSearch.GetResult(Index: integer): integer; +function TSynEditWildcardSearch.GetResult(Index: Integer): Integer; begin Result := inherited GetResult(Index); end; -function TSynEditWildcardSearch.GetResultCount: integer; +function TSynEditWildcardSearch.GetResultCount: Integer; begin Result := inherited GetResultCount; end; @@ -124,7 +119,7 @@ procedure TSynEditWildcardSearch.SetOptions(const Value: TSynSearchOptions); procedure TSynEditWildcardSearch.SetPattern(const Value: UnicodeString); begin - FPattern := Value; + fPattern := Value; // Convert into a real regular expression and assign it inherited SetPattern(WildCardToRegExpr(Value)); end; diff --git a/Ext/SynEdit/Source/SynEditWordWrap.pas b/Ext/SynEdit/Source/SynEditWordWrap.pas index fd3b021..ac71068 100644 --- a/Ext/SynEdit/Source/SynEditWordWrap.pas +++ b/Ext/SynEdit/Source/SynEditWordWrap.pas @@ -24,37 +24,21 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditWordWrap.pas,v 1.8.2.6 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} -//todo: Use a single implementation of ReWrapLines that takes starting line and number of lines to rewrap -//todo: Tweak code to try finding better wrapping points. Some support by the highlighters will be needed, probably. -//todo: Document the code -//todo: The length of the last Row of a Line could be calculated from the Line length instead of being stored. This would be only useful when most of the lines aren't wrapped. -{$IFNDEF QSYNEDITWORDWRAP} unit SynEditWordWrap; -{$ENDIF} {$I SynEdit.inc} interface uses + System.SysUtils, + System.Classes, + System.Generics.Collections, SynEditTypes, SynEditTextBuffer, - SynEdit, - SysUtils, - Classes; - -var - // Accumulate/hide whitespace at EOL (at end of wrapped rows, actually) - OldWhitespaceBehaviour: Boolean = False; + SynEdit; const MaxIndex = MaxInt div 16; @@ -62,52 +46,27 @@ interface type TLineIndex = 0..MaxIndex; TRowIndex = 0..MaxIndex; - TRowLength = Word; - - TRowIndexArray = array [TLineIndex] of TRowIndex; - PRowIndexArray = ^TRowIndexArray; - - TRowLengthArray = array [TRowIndex] of TRowLength; - PRowLengthArray = ^TRowLengthArray; - - {$IFNDEF SYN_COMPILER_4_UP} - TSysCharSet = set of Char; - {$ENDIF} - - // For clarity, I'll refer to buffer coordinates as 'Line' and - // 'Char' and to display (wrapped) coordinates as 'Row' and 'Column'. - // FLineOffsets[n] is the index of the first row of the [n+1]th line. + // fLineOffsets[n] is the index of the first row of the [n+1]th line. // e.g. Starting row of first line (0) is 0. Starting row of second line (1) - // is FLineOffsets[0]. Clear? + // is fLineOffsets[0]. Clear? TSynWordWrapPlugin = class(TInterfacedObject, ISynEditBufferPlugin) private - FLineOffsets: PRowIndexArray; - FRowLengths: PRowLengthArray; - FLineCapacity: Integer; - FRowCapacity: Integer; + FLineOffsets: TList; + FRowLengths: TList; FLineCount: Integer; - FEditor: TCustomSynEdit; - FMinRowLength: TRowLength; - FMaxRowLength: TRowLength; - procedure GrowLines(aMinSize: Integer); - procedure MoveLines(aStart: TLineIndex; aMoveBy: Integer); - procedure GrowRows(aMinSize: Integer); - procedure MoveRows(aStart: TRowIndex; aMoveBy: Integer); - procedure SetEmpty; + FMaxRowWidth: Integer; protected + procedure WrapLine(const Index: Integer; out RowLengths: TArray); procedure WrapLines; - function ReWrapLine(aIndex: TLineIndex): Integer; + function ReWrapLine(aIndex: TLineIndex; IsLineInserted: Boolean = False): Integer; procedure TrimArrays; - property LineOffsets: PRowIndexArray read FLineOffsets; - property RowLengths: PRowLengthArray read FRowLengths; property Editor: TCustomSynEdit read FEditor; public constructor Create(aOwner: TCustomSynEdit); destructor Destroy; override; - property LineCount: Integer read FLineCount; { ISynEditBufferPlugin } function BufferToDisplayPos(const aPos: TBufferCoord): TDisplayCoord; function DisplayToBufferPos(const aPos: TDisplayCoord): TBufferCoord; @@ -115,24 +74,23 @@ TSynWordWrapPlugin = class(TInterfacedObject, ISynEditBufferPlugin) function GetRowLength(aRow: Integer): Integer; function LinesInserted(aIndex: Integer; aCount: Integer): Integer; function LinesDeleted(aIndex: Integer; aCount: Integer): Integer; - function LinesPutted(aIndex: Integer; aCount: Integer): Integer; + function LinePut(aIndex: Integer; const OldLine: string): Integer; procedure Reset; - procedure DisplayChanged; + procedure DisplayChanged; end; implementation uses + Winapi.Windows, + Winapi.D2D1, + System.RTLConsts, + System.Math, + System.Threading, SynUnicode, -{$IFDEF SYN_COMPILER_6_UP} - RTLConsts, -{$ELSE} - Consts, -{$ENDIF} -{$IFNDEF SYN_COMPILER_4_UP} SynEditMiscProcs, -{$ENDIF} - Math; + SynDWrite; + { TSynWordWrapPlugin } @@ -145,11 +103,11 @@ function TSynWordWrapPlugin.BufferToDisplayPos( begin Assert(aPos.Char > 0); Assert(aPos.Line > 0); - if LineCount < aPos.Line then + if FLineCount < aPos.Line then begin // beyond EOF Result.Column := aPos.Char; - Result.Row := RowCount + (aPos.Line - LineCount); + Result.Row := FRowLengths.Count + (aPos.Line - FLineCount); Exit; end; if aPos.Line = 1 then @@ -174,23 +132,26 @@ function TSynWordWrapPlugin.BufferToDisplayPos( constructor TSynWordWrapPlugin.Create(aOwner: TCustomSynEdit); begin - inherited Create; // just to work as reminder in case I revert it to a TComponent... + inherited Create; // just to work as reminder in case I revert it to a TComponent... if aOwner = nil then raise Exception.Create( 'Owner of TSynWordWrapPlugin must be a TCustomSynEdit' ); FEditor := aOwner; + FLineCount := FEditor.Lines.Count; + FLineOffsets := TList.Create; + FRowLengths := TList.Create; Reset; end; destructor TSynWordWrapPlugin.Destroy; begin inherited; - FreeMem(FLineOffsets); - FreeMem(FRowLengths); + FLineOffsets.Free;; + FRowLengths.Free; end; procedure TSynWordWrapPlugin.DisplayChanged; begin - if Editor.CharsInWindow <> FMaxRowLength then + if Max(Editor.WrapAreaWidth, 2 * Editor.CharWidth) <> FMaxRowWidth then Reset; end; @@ -202,20 +163,20 @@ function TSynWordWrapPlugin.DisplayToBufferPos( begin Assert(aPos.Column > 0); Assert(aPos.Row > 0); - if aPos.Row > RowCount then + if aPos.Row > FRowLengths.Count then begin // beyond EOF Result.Char := aPos.Column; - Result.Line := aPos.Row - RowCount + LineCount; + Result.Line := aPos.Row - FRowLengths.Count + FLineCount; Exit; end; - //todo: use a binary search or something smarter - for cLine := LineCount - 2 downto 0 do + //Optimized loop start point but could use binary search + for cLine := Min(aPos.Row - 2, FLineCount - 2) downto 0 do if aPos.Row > FLineOffsets[cLine] then begin Result.Line := cLine + 2; if aPos.Row = FLineOffsets[cLine + 1] then //last row of line - Result.Char := Min(aPos.Column, FMaxRowLength + 1) + Result.Char := aPos.Column else Result.Char := Min(aPos.Column, FRowLengths[aPos.Row - 1] + 1); for cRow := FLineOffsets[cLine] to aPos.Row - 2 do @@ -225,7 +186,7 @@ function TSynWordWrapPlugin.DisplayToBufferPos( // first line Result.Line := 1; if aPos.Row = FLineOffsets[0] then //last row of line - Result.Char := Min(aPos.Column, FMaxRowLength + 1) + Result.Char := aPos.Column else Result.Char := Min(aPos.Column, FRowLengths[aPos.Row - 1] + 1); for cRow := 0 to aPos.Row - 2 do @@ -235,51 +196,21 @@ function TSynWordWrapPlugin.DisplayToBufferPos( function TSynWordWrapPlugin.GetRowLength(aRow: Integer): Integer; // aRow is 1-based... begin - if (aRow <= 0) or (aRow > RowCount) then + if (aRow <= 0) or (aRow > FRowLengths.Count) then TList.Error(SListIndexError, aRow); Result := FRowLengths[aRow - 1]; end; -procedure TSynWordWrapPlugin.GrowLines(aMinSize: Integer); -const - vStepSize = 256; -begin - Assert(aMinSize > 0); - if aMinSize > FLineCapacity then - begin - aMinSize := aMinSize + vStepSize - (aMinSize mod vStepSize); - ReallocMem(FLineOffsets, aMinSize * SizeOf(TRowIndex)); - FLineCapacity := aMinSize; - end; -end; - -procedure TSynWordWrapPlugin.GrowRows(aMinSize: Integer); -const - vStepSize = 512; -begin - Assert(aMinSize > 0); - if aMinSize > FRowCapacity then - begin - aMinSize := aMinSize + vStepSize - (aMinSize mod vStepSize); - ReallocMem(FRowLengths, aMinSize * SizeOf(TRowLength)); - FRowCapacity := aMinSize; - end; -end; - function TSynWordWrapPlugin.LinesDeleted(aIndex: Integer; aCount: Integer): Integer; +// Returns the number of rows deleted var vStartRow: Integer; vEndRow: Integer; cLine: Integer; begin - if FMaxRowLength = 0 then - begin - Result := 0; - Exit; - end; Assert(aIndex >= 0); Assert(aCount >= 1); - Assert(aIndex + aCount <= LineCount); + Assert(aIndex + aCount <= FLineCount); if aIndex = 0 then vStartRow := 0 @@ -288,350 +219,236 @@ function TSynWordWrapPlugin.LinesDeleted(aIndex: Integer; aCount: Integer): Inte vEndRow := FLineOffsets[aIndex + aCount - 1]; Result := vEndRow - vStartRow; // resize FRowLengths - if vEndRow < RowCount then - MoveRows(vEndRow, -Result); + if vStartRow < FRowLengths.Count then + FRowLengths.DeleteRange(vStartRow, Result); // resize FLineOffsets - MoveLines(aIndex + aCount, -aCount); + FLineOffsets.DeleteRange(aIndex, aCount); Dec(FLineCount, aCount); // update offsets - for cLine := aIndex to LineCount - 1 do - Dec(FLineOffsets[cLine], Result); + for cLine := aIndex to FLineCount - 1 do + Dec(FLineOffsets.List[cLine], Result); + if FLineCount = 0 then + TrimArrays; end; function TSynWordWrapPlugin.LinesInserted(aIndex: Integer; aCount: Integer): Integer; +// Returns the number of rows inserted var - vPrevOffset: TRowIndex; cLine: Integer; + TempArray: TArray; begin - if FMaxRowLength = 0 then - begin - Result := 0; - Exit; - end; Assert(aIndex >= 0); Assert(aCount >= 1); - Assert(aIndex <= LineCount); + Assert(aIndex <= FLineCount); + Inc(FLineCount, aCount); // resize FLineOffsets - GrowLines(LineCount + aCount); - if aIndex < LineCount then // no need for MoveLines if inserting at LineCount (TSynEditStringList.Add) - begin - Inc(FLineCount, aCount); // FLineCount must be updated before calling MoveLines() - MoveLines(aIndex, aCount); - end - else - Inc(FLineCount, aCount); - // set offset to same as previous line (i.e. the line has 0 rows) - if aIndex = 0 then - vPrevOffset := 0 - else - vPrevOffset := FLineOffsets[aIndex - 1]; - for cLine := aIndex to aIndex + aCount - 1 do - FLineOffsets[cLine] := vPrevOffset; + SetLength(TempArray, aCount); + FLineOffsets.InsertRange(aIndex, TempArray); // Rewrap Result := 0; for cLine := aIndex to aIndex + aCount - 1 do - Inc(Result, ReWrapLine(cLine)); + Inc(Result, ReWrapLine(cLine, True)); + // Adjust lines below + for cLine := aIndex + aCount to FLineCount - 1 do + Inc(FLineOffsets.List[cLine], Result); end; -function TSynWordWrapPlugin.LinesPutted(aIndex: Integer; aCount: Integer): Integer; +function TSynWordWrapPlugin.LinePut(aIndex: Integer; const OldLine: string): Integer; var cLine: Integer; begin - if FMaxRowLength = 0 then - begin - Result := 0; - Exit; - end; Assert(aIndex >= 0); - Assert(aCount >= 1); - Assert(aIndex + aCount <= LineCount); + Assert(aIndex < FLineCount); // Rewrap - Result := 0; - for cLine := aIndex to aIndex + aCount - 1 do - Inc(Result, ReWrapLine(cLine)); + Result := ReWrapLine(aIndex); + // Adjust lines below + if Result <> 0 then + for cLine := aIndex + 1 to FLineCount - 1 do + Inc(FLineOffsets.List[cLine], Result); end; -procedure TSynWordWrapPlugin.MoveLines(aStart: TLineIndex; aMoveBy: Integer); -var - vMoveCount: Integer; +procedure TSynWordWrapPlugin.Reset; begin - Assert(aMoveBy <> 0); - Assert(aStart + aMoveBy >= 0); - Assert(aStart + aMoveBy < LineCount); - vMoveCount := LineCount - aStart; - if aMoveBy > 0 then - Dec(vMoveCount, aMoveBy); - Move(FLineOffsets[aStart], FLineOffsets[aStart + aMoveBy], - vMoveCount * SizeOf(TRowIndex)); + // Ensure minimum line length + FMaxRowWidth := Max(Editor.WrapAreaWidth, 2 * Editor.CharWidth); + + WrapLines; end; -procedure TSynWordWrapPlugin.MoveRows(aStart: TRowIndex; aMoveBy: Integer); +function TSynWordWrapPlugin.ReWrapLine(aIndex: TLineIndex; IsLineInserted: Boolean): Integer; +// Wraps the line and adjusts fRowLenghts and FLineOffsets[aIndex] +// Returns RowCount delta (how many wrapped lines were added or removed by this change). var - vMoveCount: Integer; + RowLengths: TArray; + PrevOffset: Integer; + PrevRowCount: Integer; begin - Assert(aMoveBy <> 0); - Assert(aStart + aMoveBy >= 0); - Assert(aStart + aMoveBy < RowCount); - vMoveCount := RowCount - aStart; - if aMoveBy > 0 then - Dec(vMoveCount, aMoveBy); - Move(FRowLengths[aStart], FRowLengths[aStart + aMoveBy], - vMoveCount * SizeOf(TRowLength)); + WrapLine(aIndex, RowLengths); + + if aIndex = 0 then + PrevOffset := 0 + else + PrevOffset := FLineOffsets[aIndex - 1]; + if IsLineInserted then + PrevRowCount := 0 + else + PrevRowCount := FLineOffsets[aIndex] - PrevOffset; + if PrevRowCount > 0 then + FRowLengths.DeleteRange(PrevOffset, PrevRowCount); + FRowLengths.InsertRange(PrevOffset, RowLengths); + FLineOffsets[aIndex] := PrevOffset + Length(RowLengths); + Result := Length(RowLengths) - PrevRowCount; end; -procedure TSynWordWrapPlugin.Reset; +procedure TSynWordWrapPlugin.WrapLines; +var + cLine: Integer; + RowLengths: TArray>; begin - Assert(Editor.CharsInWindow >= 0); + FLineOffsets.Clear; + FLineOffsets.Capacity := Editor.Lines.Count; + FRowLengths.Clear; + FRowLengths.Capacity := Editor.Lines.Count; - FMaxRowLength := Min(Editor.MaxScrollWidth, Editor.CharsInWindow); // see github issue #129 - FMinRowLength := Editor.CharsInWindow - (Editor.CharsInWindow div 3); + if (Editor.Lines.Count = 0) or (FMaxRowWidth < Editor.CharWidth) then + Exit; - if FMinRowLength <= 0 then - FMinRowLength := 1; + SetLength(RowLengths, Editor.Lines.Count); + TParallel.&For(0, Editor.Lines.Count - 1, procedure(I: Integer) + begin + WrapLine(I, RowLengths[I]); + end); - WrapLines; + for cLine := 0 to Editor.Lines.Count - 1 do + begin + FRowLengths.AddRange(RowLengths[cLine]); + FLineOffsets.Add(FRowLengths.Count); + end; end; -function TSynWordWrapPlugin.ReWrapLine(aIndex: TLineIndex): Integer; -// Returns RowCount delta (how many wrapped lines were added or removed by this change). -var - vMaxNewRows: Cardinal; - vLine: UnicodeString; - vLineRowCount: Integer; //numbers of rows parsed in this line - vTempRowLengths: PRowLengthArray; - vRowBegin: PWideChar; - vLineEnd: PWideChar; - vRowEnd: PWideChar; - vRunner: PWideChar; - vRowMinEnd: PWideChar; - vLastVisibleChar: PWideChar; +function TSynWordWrapPlugin.RowCount: Integer; +begin + Result := FRowLengths.Count; + if FLineCount > 0 then + Assert(Result = FLineOffsets[FLineCount - 1]) + else + Assert(Result = 0); +end; - vStartRow: Integer; // first row of the line - vOldNextRow: Integer; // first row of the next line, before the change - cLine: Integer; +procedure TSynWordWrapPlugin.TrimArrays; +begin + FLineOffsets.TrimExcess; + FRowLengths.TrimExcess; +end; - p : PRowIndexArray; +procedure TSynWordWrapPlugin.WrapLine(const Index: Integer; + out RowLengths: TArray); +var + SLine: string; + Layout: TSynTextLayout; + W: Integer; + P, P2, PStart, PEnd, PBreak: PChar; + CW, TW, LW: Integer; + IsTrailing, IsInside: BOOL; + fWorkList: TList; + HTM: TDwriteHitTestMetrics; begin - // ****** First parse the new string using an auxiliar array ***** - vLine := TSynEditStringList(Editor.Lines).ExpandedStrings[aIndex]; - vLine := Editor.ExpandAtWideGlyphs(vLine); - // Pre-allocate a buffer for rowlengths - vMaxNewRows := ((Length(vLine) - 1) div FMinRowLength) + 1; - vTempRowLengths := AllocMem(vMaxNewRows * SizeOf(TRowLength)); - try - vLineRowCount := 0; - vRowBegin := PWideChar(vLine); - vRowEnd := vRowBegin + FMaxRowLength; - vLineEnd := vRowBegin + Length(vLine); - while vRowEnd < vLineEnd do - begin - if OldWhitespaceBehaviour and CharInSet(vRowEnd^, [#32, #9]) then - begin - repeat - Inc(vRowEnd); - until not CharInSet(vRowEnd^, [#32, #9]); - end - else + CW := Editor.CharWidth; + TW := Editor.TabWidth * Editor.CharWidth; + SLine := Editor.Lines[Index]; + + PStart := PChar(SLine); + PEnd := PStart + SLine.Length; + if (PEnd - PStart) * CW < FMaxRowWidth div 3 then + // Optimization. Assume line will fit! + RowLengths := [SLine.Length] + else + begin + fWorkList := TList.Create; + try + // Preallocation helps with very long lines + fWorkList.Capacity := MulDiv(SLine.Length, CW + 1, FMaxRowWidth); + P := PStart; + PBreak := nil; + W := 0; + while (P < PEnd) do begin - vRowMinEnd := vRowBegin + FMinRowLength; - vRunner := vRowEnd; - while vRunner > vRowMinEnd do + while (P < PEnd) do begin - if Editor.IsWordBreakChar(vRunner^) then - begin - vRowEnd := vRunner; + // Special case with space. Keep it on the row even if it does't fit. + if (P > PStart) and Editor.IsWordBreakChar(P^) then + PBreak := P + IfThen(P^ = #32, 1, 0); + case P^ of + #9: Inc(W, TW - W mod TW); + #32..#126, #$00A0: Inc(W, CW); + else Break; end; - Dec(vRunner); + if W > FMaxRowWidth then + Break; + if (P > PStart) and Editor.IsWordBreakChar(P^) then + // Keep opening brackets with the next line + PBreak := P + IfThen(Word(P^) in [40, 91], 0, 1); + Inc(P); end; - end; - // Check TRowLength overflow - if OldWhitespaceBehaviour and (vRowEnd - vRowBegin > High(TRowLength)) then - begin - vRowEnd := vRowBegin + High(TRowLength); - vRowMinEnd := vRowEnd - (High(TRowLength) mod Editor.TabWidth); - while (vRowEnd^ = #9) and (vRowEnd > vRowMinEnd) do - Dec(vRowEnd); - end; - // do not cut wide glyphs in half - if vRowEnd > vRowBegin then - begin - vLastVisibleChar := vRowEnd - 1; - while (vLastVisibleChar^ = FillerChar) and (vLastVisibleChar > vRowBegin) do - Dec(vLastVisibleChar); - vRowEnd := vLastVisibleChar + 1; - end; + if (P < PEnd) and (W <= FMaxRowWidth) then + begin + // Just in case P is followed by combining characters + if (P > PStart) and not (Word((P-1)^) in [9, 32]) then + begin + Dec(P); + Dec(W, CW); + end; - // Finally store the rowlength - vTempRowLengths[vLineRowCount] := vRowEnd - vRowBegin; + // Measure non-ascii text code points + P2 := P; + while P2 < PEnd do + begin + Inc(P2); + if Word(P2^) in [9, 65..90, 97..122] then Break; + end; - Inc(vLineRowCount); - vRowBegin := vRowEnd; - Inc(vRowEnd, FMaxRowLength); - end; //endwhile vRowEnd < vLineEnd - if (vLineEnd > vRowBegin) or (Length(vLine) = 0) then - begin - vTempRowLengths[vLineRowCount] := vLineEnd - vRowBegin; - Inc(vLineRowCount); - end; + Layout.Create(Editor.TextFormat, P, P2-P, MaxInt, Editor.LineHeight); + LW := Round(Layout.TextMetrics.width); - // ****** Then updates the main arrays ****** - if aIndex = 0 then - vStartRow := 0 - else - vStartRow := FLineOffsets[aIndex - 1]; - vOldNextRow := FLineOffsets[aIndex]; - Result := vLineRowCount - (vOldNextRow - vStartRow); - if Result <> 0 then - begin - // MoveRows depends on RowCount, so we need some special processing... - if Result > 0 then - begin - // ...if growing, update offsets (and thus RowCount) before rowlengths - GrowRows(RowCount + Result); - if Result = 1 then begin - // EG: this makes Schlemiel run twice as fast, but doesn't solve - // the algorithmic issue if someone can spend some time looking - // at the big picture... there are huge speedups to be made by - // eliminating this loop - p:=FLineOffsets; - for cLine := aIndex to LineCount - 1 do - Inc(p[cLine]) - end else begin - p:=FLineOffsets; - for cLine := aIndex to LineCount - 1 do - Inc(p[cLine], Result); + if W + LW >= FMaxRowWidth then + begin + CheckOSError(Layout.IDW.HitTestPoint(FMaxRowWidth - W, + Editor.LineHeight div 2, IsTrailing, IsInside, HTM)); + Inc(P, HTM.textPosition); + end + else + P := P2; + Inc(W, LW); end; - if vOldNextRow < RowCount - Result then - MoveRows(vOldNextRow, Result); - end - else - begin - // ...if shrinking, update offsets after rowlengths - if vOldNextRow < RowCount then - MoveRows(vOldNextRow, Result); - for cLine := aIndex to LineCount - 1 do - Inc(FLineOffsets[cLine], Result); - end; - end; - Move(vTempRowLengths[0], FRowLengths[vStartRow], vLineRowCount * SizeOf(TRowLength)); - finally - FreeMem(vTempRowLengths); - end; -end; - -procedure TSynWordWrapPlugin.WrapLines; -var - cRow: Integer; - cLine: Integer; - vLine: UnicodeString; - vMaxNewRows: Integer; - vRowBegin: PWideChar; - vLineEnd: PWideChar; - vRowEnd: PWideChar; - vRunner: PWideChar; - vRowMinEnd: PWideChar; - vLastVisibleChar: PWideChar; -begin - if (Editor.Lines.Count = 0) or (FMaxRowLength <= 0) then - begin - SetEmpty; - Exit; - end; - GrowLines(Editor.Lines.Count); - GrowRows(Editor.Lines.Count); - - cRow := 0; - for cLine := 0 to Editor.Lines.Count - 1 do - begin - vLine := TSynEditStringList(Editor.Lines).ExpandedStrings[cLine]; - vLine := Editor.ExpandAtWideGlyphs(vLine); - - vMaxNewRows := ((Length(vLine) - 1) div FMinRowLength) + 1; - GrowRows(cRow + vMaxNewRows); - - vRowBegin := PWideChar(vLine); - vRowEnd := vRowBegin + FMaxRowLength; - vLineEnd := vRowBegin + Length(vLine); - while vRowEnd < vLineEnd do - begin - if OldWhitespaceBehaviour and CharInSet(vRowEnd^, [#32, #9]) then - begin - repeat - Inc(vRowEnd); - until not CharInSet(vRowEnd^, [#32, #9]); - end - else - begin - vRowMinEnd := vRowBegin + FMinRowLength; - vRunner := vRowEnd; - while vRunner > vRowMinEnd do + if W >= FMaxRowWidth then begin - if Editor.IsWordBreakChar(vRunner^) then + if Assigned(PBreak) then begin - vRowEnd := vRunner; - Break; + FWorkList.Add(PBreak - PStart); + PStart := PBreak; + P := PStart; + PBreak := nil; + end + else + begin + // "emergency" wrapping + FWorkList.Add(P - PStart); + PStart := P; end; - Dec(vRunner); + W := 0; end; end; + if P > PStart then + FWorkList.Add(P - PStart); - if OldWhitespaceBehaviour and (vRowEnd - vRowBegin > High(TRowLength)) then - begin - vRowEnd := vRowBegin + High(TRowLength); - vRowMinEnd := vRowEnd - (High(TRowLength) mod Editor.TabWidth); - while (vRowEnd^ = #9) and (vRowEnd > vRowMinEnd) do - Dec(vRowEnd); - end; - - // do not cut wide glyphs in half - if vRowEnd > vRowBegin then - begin - vLastVisibleChar := vRowEnd - 1; - while (vLastVisibleChar^ = FillerChar) and (vLastVisibleChar > vRowBegin) do - Dec(vLastVisibleChar); - vRowEnd := vLastVisibleChar + 1; - end; - - FRowLengths[cRow] := vRowEnd - vRowBegin; - - Inc(cRow); - vRowBegin := vRowEnd; - Inc(vRowEnd, FMaxRowLength); - end; - if (vLineEnd > vRowBegin) or (Length(vLine) = 0) then - begin - FRowLengths[cRow] := vLineEnd - vRowBegin; - Inc(cRow); + RowLengths := fWorkList.ToArray; + finally + fWorkList.Free; end; - FLineOffsets[cLine] := cRow; end; - FLineCount := Editor.Lines.Count; -end; - -function TSynWordWrapPlugin.RowCount: Integer; -begin - if LineCount > 0 then - Result := FLineOffsets[LineCount - 1] - else - Result := 0; -end; - -procedure TSynWordWrapPlugin.SetEmpty; -begin - FLineCount := 0; - // free unsused memory - TrimArrays; -end; - -procedure TSynWordWrapPlugin.TrimArrays; -begin - ReallocMem(FLineOffsets, LineCount * SizeOf(TRowIndex)); - FLineCapacity := LineCount; - ReallocMem(FRowLengths, RowCount * SizeOf(TRowLength)); - FRowCapacity := RowCount; end; end. diff --git a/Ext/SynEdit/Source/SynExportHTML.pas b/Ext/SynEdit/Source/SynExportHTML.pas index 82fcec2..62127ce 100644 --- a/Ext/SynEdit/Source/SynExportHTML.pas +++ b/Ext/SynEdit/Source/SynExportHTML.pas @@ -3,13 +3,10 @@ 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: SynExportHTML.pas, released 2000-04-16. - The Original Code is partly based on the mwHTMLExport.pas file from the mwEdit component suite by Martin Waldenburg and other developers, the Initial Author of this file is Michael Hieke. @@ -20,7 +17,6 @@ All Rights Reserved. Contributors to the SynEdit project are listed in the Contributors.txt file. - Alternatively, the contents of this file may be used under the terms of the GNU General Public License Version 2 or later (the "GPL"), in which case the provisions of the GPL are applicable instead of those above. @@ -30,18 +26,9 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynExportHTML.pas,v 1.19.2.7 2008/09/14 16:24:59 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} -{$IFNDEF QSYNEXPORTHTML} unit SynExportHTML; -{$ENDIF} {$I SynEdit.inc} @@ -53,25 +40,37 @@ interface SynEditExport, SynEditHighlighter, SynUnicode, + System.Generics.Collections, Classes; type TSynExporterHTML = class(TSynCustomExporter) private + FStyleNameCache: TDictionary; + FStyleValueCache: TDictionary; + FAddNewLine: Boolean; + FSuppressFragmentInfo: Boolean; function AttriToCSS(Attri: TSynHighlighterAttributes; UniqueAttriName: string): string; function AttriToCSSCallback(Highlighter: TSynCustomHighlighter; Attri: TSynHighlighterAttributes; UniqueAttriName: string; Params: array of Pointer): Boolean; - function ColorToHTML(AColor: TColor): string; function GetStyleName(Highlighter: TSynCustomHighlighter; Attri: TSynHighlighterAttributes): string; function MakeValidName(Name: string): string; function StyleNameCallback(Highlighter: TSynCustomHighlighter; Attri: TSynHighlighterAttributes; UniqueAttriName: string; Params: array of Pointer): Boolean; + function AttriToInlineCSSCallback(Highlighter: TSynCustomHighlighter; + Attri: TSynHighlighterAttributes; UniqueAttriName: string; + Params: array of Pointer): Boolean; + function AttriToInlineCSS(Attri: TSynHighlighterAttributes): string; protected - FCreateHTMLFragment: Boolean; + // CreateHTMLFragment is used to indicate that this is for the clipboard "HTML Format" output. + // Note: SynEdit's default OLE clipboard handling bypasses SynEditExport's clipboard handling. + FCreateHTMLFragment: Boolean; // True if format should be "HTML Format", always uses inline css. + FInlineCSS: Boolean; + procedure SetTokenAttribute(Attri: TSynHighlighterAttributes); override; procedure FormatAfterLastAttribute; override; procedure FormatAttributeDone(BackgroundChanged, ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); override; @@ -80,18 +79,24 @@ TSynExporterHTML = class(TSynCustomExporter) procedure FormatBeforeFirstAttribute(BackgroundChanged, ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); override; procedure FormatNewLine; override; - function GetFooter: UnicodeString; override; + function GetFooter: string; override; function GetFormatName: string; override; - function GetHeader: UnicodeString; override; - function ReplaceReservedChar(AChar: WideChar): UnicodeString; override; + function GetHeader: string; override; + function ReplaceReservedChar(AChar: WideChar): string; override; function UseBom: Boolean; override; public constructor Create(AOwner: TComponent); override; + destructor Destroy; override; function SupportedEncodings: TSynEncodings; override; + procedure Clear; override; published property Color; property CreateHTMLFragment: Boolean read FCreateHTMLFragment write FCreateHTMLFragment default False; + property InlineCSS: Boolean read FInlineCSS + write FInlineCSS default False; + property SuppressFragmentInfo: Boolean read FSuppressFragmentInfo + write FSuppressFragmentInfo default False; property DefaultFilter; property Encoding; property Font; @@ -108,32 +113,65 @@ implementation SynHighlighterMulti, SysUtils; - { TSynExporterHTML } +const + DetailLength = 95 + 5 * Length(SLineBreak); // This is the fixed length of the filled-in DetailSection. + DetailSection = 'Version:0.9' + SLineBreak + + 'StartHTML:%.10d' + SLineBreak + + 'EndHTML:%.10d' + SLineBreak + + 'StartFragment:%.10d' + SLineBreak + + 'EndFragment:%.10d' + SLineBreak; + + HTMLStartText = '' + SLineBreak; + DocType = '' + SLineBreak; + HeadStartText = '' + SLineBreak; + MetaUTF8Encoding = '' + SLineBreak; + + StyleStartText = '' + SLineBreak; + + HeadEndText = '' + SLineBreak; + BodyStartText = '' + SLineBreak; + + FragmentStartText = ''; + FragmentEndText = ''; + + BodyEndText = '' + SLineBreak; + HTMLEndText = ''; + + constructor TSynExporterHTML.Create(AOwner: TComponent); const CF_HTML = 'HTML Format'; begin inherited Create(AOwner); - FClipboardFormat := RegisterClipboardFormat(CF_HTML); - FDefaultFilter := SYNS_FilterHTML; + FStyleNameCache := TDictionary.Create; + FStyleValueCache := TDictionary.Create; + fClipboardFormat := RegisterClipboardFormat(CF_HTML); + fDefaultFilter := SYNS_FilterHTML; FEncoding := seUTF8; + FCreateHTMLFragment := False; + FInlineCSS := False; end; -function TSynExporterHTML.AttriToCSS(Attri: TSynHighlighterAttributes; - UniqueAttriName: string): string; -var - StyleName: string; +destructor TSynExporterHTML.Destroy; begin - StyleName := MakeValidName(UniqueAttriName); + FStyleNameCache.Free; + FStyleValueCache.Free; + inherited; +end; - Result := '.' + StyleName + ' { '; - if UseBackground and (Attri.Background <> clNone) then +function TSynExporterHTML.AttriToInlineCSS(Attri: TSynHighlighterAttributes): string; +begin + Result := ''; + if UseBackground and (Attri.Background <> clNone) and + (ColorToRGB(Attri.Background) <> ColorToRGB(fBackgroundColor)) + then Result := Result + 'background-color: ' + ColorToHTML(Attri.Background) + '; '; if Attri.Foreground <> clNone then Result := Result + 'color: ' + ColorToHTML(Attri.Foreground) + '; '; - if fsBold in Attri.Style then Result := Result + 'font-weight: bold; '; if fsItalic in Attri.Style then @@ -142,7 +180,28 @@ function TSynExporterHTML.AttriToCSS(Attri: TSynHighlighterAttributes; Result := Result + 'text-decoration: underline; '; if fsStrikeOut in Attri.Style then Result := Result + 'text-decoration: line-through; '; +end; + +function TSynExporterHTML.AttriToInlineCSSCallback(Highlighter: TSynCustomHighlighter; + Attri: TSynHighlighterAttributes; UniqueAttriName: string; + Params: array of Pointer): Boolean; +var + StyleText: string; +begin + StyleText := AttriToInlineCSS(Attri); + FStyleValueCache.Add(Attri, StyleText); + Result := True; // Get all attributes. +end; +function TSynExporterHTML.AttriToCSS(Attri: TSynHighlighterAttributes; + UniqueAttriName: string): string; +var + StyleName: string; +begin + if not FStyleNameCache.TryGetValue(Attri, StyleName) then + Exit(''); // Skip any styles that weren't in the data. + Result := '.' + StyleName + ' { '; + Result := Result + AttriToInlineCSS(Attri); Result := Result + '}'; end; @@ -151,84 +210,133 @@ function TSynExporterHTML.AttriToCSSCallback(Highlighter: TSynCustomHighlighter; Params: array of Pointer): Boolean; var Styles: ^string; + StyleText: string; begin Styles := Params[0]; - Styles^ := Styles^ + AttriToCSS(Attri, UniqueAttriName) + #13#10; + StyleText := AttriToCSS(Attri, UniqueAttriName); + if StyleText <> '' then + Styles^ := Styles^ + StyleText + SLineBreak; Result := True; // we want all attributes => tell EnumHighlighterAttris to continue end; -function TSynExporterHTML.ColorToHTML(AColor: TColor): string; -var - RGBColor: longint; - RGBValue: byte; -const - Digits: array[0..15] of Char = '0123456789ABCDEF'; +procedure TSynExporterHTML.Clear; begin - RGBColor := ColorToRGB(AColor); - Result := '#000000'; - RGBValue := GetRValue(RGBColor); - if RGBValue > 0 then - begin - Result[2] := Digits[RGBValue shr 4]; - Result[3] := Digits[RGBValue and 15]; - end; - RGBValue := GetGValue(RGBColor); - if RGBValue > 0 then - begin - Result[4] := Digits[RGBValue shr 4]; - Result[5] := Digits[RGBValue and 15]; - end; - RGBValue := GetBValue(RGBColor); - if RGBValue > 0 then + inherited; + if Assigned(FStyleNameCache) then + FStyleNameCache.Clear; + if Assigned(FStyleValueCache) then + FStyleValueCache.Clear; + FAddNewLine := False; +end; + +procedure TSynExporterHTML.SetTokenAttribute(Attri: TSynHighlighterAttributes); +begin + inherited; + // If a newline happens while there are tokens with no attributes we add
s + if FAddNewLine then begin - Result[6] := Digits[RGBValue shr 4]; - Result[7] := Digits[RGBValue and 15]; + AddNewLine; + FAddNewLine := False; end; end; procedure TSynExporterHTML.FormatAfterLastAttribute; begin AddData(''); + if FAddNewLine then + AddNewLine; + AddData(''); + AddNewLine; + AddData(''); + FAddNewLine := False; end; procedure TSynExporterHTML.FormatAttributeDone(BackgroundChanged, ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); begin - AddData(''); + if FAddNewLine then + begin + AddData('' + SLineBreak); + FAddNewLine := False; + end + else + AddData(''); end; procedure TSynExporterHTML.FormatAttributeInit(BackgroundChanged, ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); var StyleName: string; + StyleValue: string; begin - StyleName := GetStyleName(Highlighter, Highlighter.GetTokenAttribute); - AddData(Format('', [StyleName])); + if FCreateHTMLFragment or FInlineCSS then + begin + FStyleValueCache.TryGetValue(Highlighter.GetTokenAttribute, StyleValue); + if StyleValue <> '' then + AddData('') + else + AddData(''); + end + else + begin + StyleName := GetStyleName(Highlighter, Highlighter.GetTokenAttribute); + AddData(''); + end; end; procedure TSynExporterHTML.FormatBeforeFirstAttribute(BackgroundChanged, ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); +const + ColorAttrFmt = ' background-color: %s; color: %s;'; + FirstDiv = + '

' + + sLineBreak; var StyleName: string; + StyleValue: string; + ColorAttrs: string; begin - StyleName := GetStyleName(Highlighter, Highlighter.GetTokenAttribute); - AddData(Format('', [StyleName])); + if UseBackground then + ColorAttrs := Format(ColorAttrFmt, [ColorToHTML(Color), ColorToHTML(Font.Color)]) + else + ColorAttrs := ''; + AddData(Format(FirstDiv, [FFont.Name, FFont.Size.ToString, ColorAttrs])); + AddData('
');
+  if FCreateHTMLFragment or FInlineCSS then
+  begin
+    // Cache all our CSS values.
+    FStyleValueCache.Clear;
+    EnumHighlighterAttris(Highlighter, True, AttriToInlineCSSCallback, []);
+    FStyleValueCache.TryGetValue(Highlighter.GetTokenAttribute, StyleValue);
+    if StyleValue <> '' then
+      AddData('')
+    else
+      AddData('');
+  end
+  else
+  begin
+    StyleName := GetStyleName(Highlighter, Highlighter.GetTokenAttribute);
+    AddData('');
+  end;
 end;
 
 procedure TSynExporterHTML.FormatNewLine;
 begin
-  AddNewLine;
+  if FAddNewLine then
+  begin
+    AddData(SLineBreak);
+    FAddNewLine := False;
+  end;
+  FAddNewLine := True;
 end;
 
-function TSynExporterHTML.GetFooter: UnicodeString;
+function TSynExporterHTML.GetFooter: string;
 begin
   Result := '';
-  if fExportAsText then
-    Result := ''#13#10'
'#13#10 - else - Result := ''; - if not(FCreateHTMLFragment and fExportAsText) then - Result := Result + ''#13#10''; + if FCreateHTMLFragment and not FSuppressFragmentInfo then + Result := Result + FragmentEndText; + if not FCreateHTMLFragment then + Result := Result + SLineBreak + BodyEndText + HTMLEndText; end; function TSynExporterHTML.GetFormatName: string; @@ -236,68 +344,62 @@ function TSynExporterHTML.GetFormatName: string; Result := SYNS_ExporterFormatHTML; end; -function TSynExporterHTML.GetHeader: UnicodeString; -const - DescriptionSize = 105; - FooterSize1 = 47; - FooterSize2 = 31; - NativeHeader = 'Version:0.9'#13#10 + - 'StartHTML:%.10d'#13#10 + - 'EndHTML:%.10d'#13#10 + - 'StartFragment:%.10d'#13#10 + - 'EndFragment:%.10d'#13#10; - HTMLAsTextHeader = ''#13#10 + - ''#13#10 + - ''#13#10 + - ''#13#10; - HTMLAsTextHeader2 =''#13#10 + - ''#13#10 + - ''#13#10 + - ''#13#10 + - ''#13#10; - EncodingStrs: array[TSynEncoding] of string = - ('UTF-8', 'UTF-16', 'UTF-16', 'ANSI is Unsupported'); +function TSynExporterHTML.GetHeader: string; var - EncodingStr, Styles, Header, Header2: string; + Styles: string; + Header: string; + StartHTMLPos: Integer; + EndHTMLPos: Integer; + StartFragmentPos: Integer; + EndFragmentPos: Integer; begin - EncodingStr := EncodingStrs[Encoding]; - EnumHighlighterAttris(Highlighter, True, AttriToCSSCallback, [@Styles]); - - Header := Format(HTMLAsTextHeader, [EncodingStr]); - Header := Header + '' + Title + ''#13#10 + - Format(HTMLAsTextHeader2, [EncodingStr, ColorToHtml(fFont.Color), - ColorToHTML(fBackgroundColor), Styles]); - + Header := HTMLStartText; + if not FCreateHTMLFragment then + begin + Header := DocType + Header + HeadStartText; + if Encoding = seUTF8 then + Header := Header + MetaUTF8Encoding; + Header := Header + '' + Title + '' + SLineBreak; + Header := Header + StyleStartText; + Header := Header + + Format(BodyStyleTextFormat, [ColorToHtml(fFont.Color), ColorToHTML(fBackgroundColor)]); + if not InlineCSS then + begin + EnumHighlighterAttris(Highlighter, True, AttriToCSSCallback, [@Styles]); + Header := Header + Styles; + end; + Header := Header + StyleEndText; + Header := Header + HeadEndText; + end; + Header := Header + BodyStartText; Result := ''; - if fExportAsText then + if not FCreateHTMLFragment then begin - if not FCreateHTMLFragment then - Result := Header; - - Result := Result + Format('
'#13#10'',
-      [fFont.Size, fFont.Name]);
+    Result := Header;
   end
   else
   begin
-    // Described in http://msdn.microsoft.com/library/sdkdoc/htmlclip/htmlclipboard.htm
-    Header2 := '
';
-    Result := Format(NativeHeader, [DescriptionSize,
-      DescriptionSize + Length(Header) + Length(Header2) + GetBufferSize + FooterSize1,
-      DescriptionSize + Length(Header),
-      DescriptionSize + Length(Header) + Length(Header2) + GetBufferSize + FooterSize2]);
-    Result := Result + Header + Header2;
+    if not FSuppressFragmentInfo then
+    begin
+      StartHTMLPos := DetailLength;
+      StartFragmentPos := DetailLength + Header.Length + FragmentStartText.Length;
+      EndFragmentPos := StartFragmentPos + GetBufferSize;
+      EndHTMLPos := EndFragmentPos + GetFooter.Length;
+      Result := Format(DetailSection,
+        [StartHTMLPos, EndHTMLPos, StartFragmentPos, EndFragmentPos]);
+      Result := Result + Header + FragmentStartText;
+    end;
   end;
 end;
 
 function TSynExporterHTML.GetStyleName(Highlighter: TSynCustomHighlighter;
   Attri: TSynHighlighterAttributes): string;
 begin
-  EnumHighlighterAttris(Highlighter, False, StyleNameCallback, [Attri, @Result]);
+  if not FStyleNameCache.TryGetValue(Attri, Result) then
+  begin
+    EnumHighlighterAttris(Highlighter, False, StyleNameCallback, [Attri, @Result]);
+    FStyleNameCache.Add(Attri, Result);
+  end;
 end;
 
 function TSynExporterHTML.MakeValidName(Name: string): string;
@@ -312,7 +414,7 @@ function TSynExporterHTML.MakeValidName(Name: string): string;
       Delete(Result, i, 1);
 end;
 
-function TSynExporterHTML.ReplaceReservedChar(AChar: WideChar): UnicodeString;
+function TSynExporterHTML.ReplaceReservedChar(AChar: WideChar): string;
 begin
   case AChar of
     '&': Result := '&';
@@ -354,3 +456,4 @@ function TSynExporterHTML.SupportedEncodings: TSynEncodings;
 end;
 
 end.
+
diff --git a/Ext/SynEdit/Source/SynExportRTF.pas b/Ext/SynEdit/Source/SynExportRTF.pas
index 3b1ad2a..24139dd 100644
--- a/Ext/SynEdit/Source/SynExportRTF.pas
+++ b/Ext/SynEdit/Source/SynExportRTF.pas
@@ -1,4 +1,4 @@
-{-------------------------------------------------------------------------------
+{-------------------------------------------------------------------------------
 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
@@ -15,7 +15,7 @@
 Author of this file is Michael Hieke.
 Portions created by Michael Hieke are Copyright 2000 Michael Hieke.
 Portions created by James D. Jacobson are Copyright 1999 Martin Waldenburg.
-Unicode translation by Maël Hörz.
+Unicode translation by Maël Hörz.
 All Rights Reserved.
 
 Contributors to the SynEdit project are listed in the Contributors.txt file.
@@ -29,18 +29,9 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynExportRTF.pas,v 1.10.2.3 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 
-{$IFNDEF QSYNEXPORTRTF}
 unit SynExportRTF;
-{$ENDIF}
 
 {$I SynEdit.inc}
 
@@ -58,8 +49,8 @@ interface
   TSynExporterRTF = class(TSynCustomExporter)
   private
     fAttributesChanged: Boolean;
-    FListColors: TList;
-    function ColorToRTF(AColor: TColor): UnicodeString;
+    fListColors: TList;
+    function ColorToRTF(AColor: TColor): string;
     function GetColorIndex(AColor: TColor): Integer;
   protected
     procedure FormatAfterLastAttribute; override;
@@ -70,10 +61,10 @@   TSynExporterRTF = class(TSynCustomExporter)
     procedure FormatBeforeFirstAttribute(BackgroundChanged,
       ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); override;
     procedure FormatNewLine; override;
-    function GetFooter: UnicodeString; override;
+    function GetFooter: string; override;
     function GetFormatName: string; override;
-    function GetHeader: UnicodeString; override;
-    function ReplaceReservedChar(AChar: WideChar): UnicodeString; override;
+    function GetHeader: string; override;
+    function ReplaceReservedChar(AChar: WideChar): string; override;
     function UseBom: Boolean; override;
   public
     constructor Create(AOwner: TComponent); override;
@@ -101,27 +92,27 @@ implementation
 constructor TSynExporterRTF.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
-  FListColors := TList.Create;
-  FDefaultFilter := SYNS_FilterRTF;
-  FClipboardFormat := RegisterClipboardFormat(CF_RTF);
+  fListColors := TList.Create;
+  fDefaultFilter := SYNS_FilterRTF;
+  fClipboardFormat := RegisterClipboardFormat(CF_RTF);
   FEncoding := seUTF8;
 end;
 
 destructor TSynExporterRTF.Destroy;
 begin
-  FListColors.Free;
-  FListColors := nil;
+  fListColors.Free;
+  fListColors := nil;
   inherited Destroy;
 end;
 
 procedure TSynExporterRTF.Clear;
 begin
   inherited Clear;
-  if Assigned(FListColors) then
-    FListColors.Clear;
+  if Assigned(fListColors) then
+    fListColors.Clear;
 end;
 
-function TSynExporterRTF.ColorToRTF(AColor: TColor): UnicodeString;
+function TSynExporterRTF.ColorToRTF(AColor: TColor): string;
 var
   Col: Integer;
 begin
@@ -138,7 +129,7 @@ procedure TSynExporterRTF.FormatAfterLastAttribute;
 procedure TSynExporterRTF.FormatAttributeDone(BackgroundChanged,
   ForegroundChanged: Boolean; FontStylesChanged: TFontStyles);
 const
-  FontTags: array[TFontStyle] of UnicodeString = ('\b0', '\i0', '\ul0', '\strike0');
+  FontTags: array[TFontStyle] of string = ('\b0', '\i0', '\ul0', '\strike0');
 var
   AStyle: TFontStyle;
 begin
@@ -156,14 +147,14 @@ procedure TSynExporterRTF.FormatAttributeDone(BackgroundChanged,
 procedure TSynExporterRTF.FormatAttributeInit(BackgroundChanged,
   ForegroundChanged: Boolean; FontStylesChanged: TFontStyles);
 const
-  FontTags: array[TFontStyle] of UnicodeString = ('\b', '\i', '\ul', '\strike');
+  FontTags: array[TFontStyle] of string = ('\b', '\i', '\ul', '\strike');
 var
   AStyle: TFontStyle;
 begin
   // background color
   if BackgroundChanged then
   begin
-    AddData(Format('\cb%d', [GetColorIndex(fLastBG)]));
+    AddData(Format('\chcbpat%d\cb%d', [GetColorIndex(fLastBG), GetColorIndex(fLastBG)]));
     fAttributesChanged := True;
   end;
   // text color
@@ -199,12 +190,12 @@ procedure TSynExporterRTF.FormatNewLine;
 
 function TSynExporterRTF.GetColorIndex(AColor: TColor): Integer;
 begin
-  Result := FListColors.IndexOf(Pointer(AColor));
+  Result := fListColors.IndexOf(pointer(AColor));
   if Result = -1 then
-    Result := FListColors.Add(Pointer(AColor));
+    Result := fListColors.Add(pointer(AColor));
 end;
 
-function TSynExporterRTF.GetFooter: UnicodeString;
+function TSynExporterRTF.GetFooter: string;
 begin
   Result := '}';
 end;
@@ -214,11 +205,11 @@ function TSynExporterRTF.GetFormatName: string;
   Result := SYNS_ExporterFormatRTF;
 end;
 
-function TSynExporterRTF.GetHeader: UnicodeString;
+function TSynExporterRTF.GetHeader: string;
 var
   i: Integer;
 
-  function GetFontTable: UnicodeString;
+  function GetFontTable: string;
   begin
     Result := '{\fonttbl{\f0\fmodern ' + Font.Name;
     Result := Result + ';}}'#13#10;
@@ -228,8 +219,8 @@ function TSynExporterRTF.GetHeader: UnicodeString;
   Result := '{\rtf1\ansi\ansicpg1252\uc1\deff0\deftab720' + GetFontTable;
   // all the colors
   Result := Result + '{\colortbl';
-  for i := 0 to FListColors.Count - 1 do
-    Result := Result + ColorToRTF(TColor(FListColors[i]));
+  for i := 0 to fListColors.Count - 1 do
+    Result := Result + ColorToRTF(TColor(fListColors[i]));
   Result := Result + '}'#13#10;
   // title and creator comment
   Result := Result + '{\info{\comment Generated by the SynEdit RTF ' +
@@ -241,7 +232,7 @@ function TSynExporterRTF.GetHeader: UnicodeString;
     [2 * Font.Size]);
 end;
 
-function TSynExporterRTF.ReplaceReservedChar(AChar: WideChar): UnicodeString;
+function TSynExporterRTF.ReplaceReservedChar(AChar: WideChar): string;
 begin
   Result := '';
   case AChar of
@@ -249,9 +240,9 @@ function TSynExporterRTF.ReplaceReservedChar(AChar: WideChar): UnicodeString;
     '{': Result := '\{';
     '}': Result := '\}';
   end;
-  if Ord(AChar) > 127 then
+  if AChar > #127 then
   begin
-    if Ord(AChar) <= 255 then
+    if AChar <= #$00FF then
       Result := '\''' + LowerCase(IntToHex(Ord(AChar), 2))
     else
       // SmallInt type-cast is necessary because RTF
diff --git a/Ext/SynEdit/Source/SynExportTeX.pas b/Ext/SynEdit/Source/SynExportTeX.pas
index 02d2405..33e8806 100644
--- a/Ext/SynEdit/Source/SynExportTeX.pas
+++ b/Ext/SynEdit/Source/SynExportTeX.pas
@@ -29,11 +29,6 @@
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
 
-$Id: SynExportTeX.pas,v 1.8.2.5 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
 Known Issues:
 - LaTeX 2e doesn't support Unicode, so this exporter doesn't either.
   (There are solutions like the package utc.sty but still they don't allow mixing
@@ -41,9 +36,7 @@
   We'll have to wait for LaTeX 3.)
 -------------------------------------------------------------------------------}
 
-{$IFNDEF QSYNEXPORTTEX}
 unit SynExportTeX;
-{$ENDIF}
 
 {$I SynEdit.inc}
 
@@ -75,9 +68,9 @@   TSynExporterTeX = class(TSynCustomExporter)
     function GetNewCommands: string;
     function MakeValidName(Name: string): string;
   protected
-    FCreateTeXFragment: Boolean;
-    FTabWidth: Integer;
-    FPageStyleEmpty: Boolean;
+    fCreateTeXFragment: Boolean;
+    fTabWidth: Integer;
+    fPageStyleEmpty: Boolean;
     
     // overriding these abstract methods (though they are never called for this
     // specific highlighter) to prevent abstract instance warnings
@@ -90,11 +83,11 @@   TSynExporterTeX = class(TSynCustomExporter)
       ForegroundChanged: Boolean; FontStylesChanged: TFontStyles); override;
 
     procedure FormatNewLine; override;
-    procedure FormatToken(Token: UnicodeString); override;
-    function GetFooter: UnicodeString; override;
+    procedure FormatToken(Token: string); override;
+    function GetFooter: string; override;
     function GetFormatName: string; override;
-    function GetHeader: UnicodeString; override;
-    function ReplaceReservedChar(AChar: WideChar): UnicodeString; override;
+    function GetHeader: string; override;
+    function ReplaceReservedChar(AChar: WideChar): string; override;
     procedure SetTokenAttribute(Attri: TSynHighlighterAttributes); override;
     function UseBom: Boolean; override;
   public
@@ -102,12 +95,12 @@   TSynExporterTeX = class(TSynCustomExporter)
     function SupportedEncodings: TSynEncodings; override;
   published
     property Margin: Integer read FMargin write FMargin default 2;
-    property TabWidth: Integer read FTabWidth write FTabWidth default 2;
+    property TabWidth: Integer read fTabWidth write fTabWidth default 2;
     property Color;
-    property CreateTeXFragment: Boolean read FCreateTeXFragment
-      write FCreateTeXFragment default false;
-    property PageStyleEmpty: Boolean read FPageStyleEmpty write FPageStyleEmpty
-      default false;
+    property CreateTeXFragment: Boolean read fCreateTeXFragment
+      write fCreateTeXFragment default False;
+    property PageStyleEmpty: Boolean read fPageStyleEmpty write fPageStyleEmpty
+      default False;
     property DefaultFilter;
     property Encoding;
     property Font;
@@ -130,16 +123,11 @@ implementation
 // different (for example a comma).
 function DotDecSepFormat(const Format: string; const Args: array of const): string;
 var
-{$IFDEF UNICODE}
-  OldDecimalSeparator: WideChar;
-{$ELSE}
-  OldDecimalSeparator: AnsiChar;
-{$ENDIF}
+  pSettings: TFormatSettings;
 begin
-  OldDecimalSeparator := {$IFDEF SYN_COMPILER_15_UP}FormatSettings.{$ENDIF}DecimalSeparator;
-  {$IFDEF SYN_COMPILER_15_UP}FormatSettings.{$ENDIF}DecimalSeparator := '.';
-  Result := SysUtils.Format(Format, Args);
-  {$IFDEF SYN_COMPILER_15_UP}FormatSettings.{$ENDIF}DecimalSeparator := OldDecimalSeparator;
+  pSettings := FormatSettings;
+  pSettings.DecimalSeparator := '.';
+  Result := SysUtils.Format(Format, Args, pSettings);
 end;
 
 function ColorToTeX(AColor: TColor): string;
@@ -163,9 +151,9 @@ constructor TSynExporterTeX.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
   FMargin := 2;
-  FTabWidth := 2;
-  FPageStyleEmpty := False;
-  FDefaultFilter := SYNS_FilterTeX;
+  fTabWidth := 2;
+  fPageStyleEmpty := False;
+  fDefaultFilter := SYNS_FilterTeX;
   FEncoding := seAnsi;
 end;
 
@@ -245,7 +233,7 @@ function TSynExporterTeX.CommandNameCallback(
     Result := True;
 end;
 
-procedure TSynExporterTeX.FormatToken(Token: UnicodeString);
+procedure TSynExporterTeX.FormatToken(Token: string);
 var
   CommandName: string;
 begin
@@ -281,9 +269,9 @@ function TSynExporterTeX.GetCommandName(Highlighter: TSynCustomHighlighter;
   EnumHighlighterAttris(Highlighter, False, CommandNameCallback, [Attri, @Result]);
 end;
 
-function TSynExporterTeX.GetFooter: UnicodeString;
+function TSynExporterTeX.GetFooter: string;
 begin
-  if not FCreateTeXFragment then
+  if not fCreateTeXFragment then
     Result := SLineBreak + '\end{ttfamily}' + SLineBreak + '\end{document}'
   else
     Result := SLineBreak + '\end{ttfamily}';
@@ -294,7 +282,7 @@ function TSynExporterTeX.GetFormatName: string;
   Result := SYNS_ExporterFormatTeX;
 end;
 
-function TSynExporterTeX.GetHeader: UnicodeString;
+function TSynExporterTeX.GetHeader: string;
 const
   TeXHeader   = '\documentclass[a4paper, %dpt]{article}' + SLineBreak +
                 '\usepackage[a4paper, margin=%dcm]{geometry}' + SLineBreak +
@@ -303,13 +291,8 @@ function TSynExporterTeX.GetHeader: UnicodeString;
                 '\usepackage{alltt}' + SLineBreak +
                 '\usepackage{times}' + SLineBreak +
                 '\usepackage{ulem}' + SLineBreak +
-{$IFDEF WIN32}
                 // It is recommennded to use AnsiNew on Windows
                 '\usepackage[ansinew]{inputenc}' + SLineBreak +
-{$ELSE}
-                // and Latin1 on UNIX Systems, see also DE FAQ 8.5.3
-                '\usepackage[latin1]{inputenc}' + SLineBreak +
-{$ENDIF}
                 '%s' + SLineBreak; // New Commands
   TeXHeader2  = '%% Generated by SynEdit TeX exporter' + SLineBreak + SLineBreak +
                 '\begin{document}';
@@ -319,9 +302,9 @@ function TSynExporterTeX.GetHeader: UnicodeString;
 var
   PageStyle: string;
 begin
-  if not FCreateTeXFragment then
+  if not fCreateTeXFragment then
   begin
-    if FPageStyleEmpty then
+    if fPageStyleEmpty then
       PageStyle := SLineBreak + EmptyPage
     else
       PageStyle := '';
@@ -350,7 +333,7 @@ function TSynExporterTeX.GetNewCommands: string;
   tw: string;
   Commands: string;
 begin
-  tw := DotDecSepFormat(f, [FTabWidth * 0.6]);
+  tw := DotDecSepFormat(f, [fTabWidth * 0.6]);
   Result := Format(FixedCommands, [tw]);
 
   EnumHighlighterAttris(Highlighter, True, AttriToCommandCallback, [@Commands]);
@@ -372,7 +355,7 @@ function TSynExporterTeX.MakeValidName(Name: string): string;
     Delete(Result, i, 1);
 end;
 
-function TSynExporterTeX.ReplaceReservedChar(AChar: WideChar): UnicodeString;
+function TSynExporterTeX.ReplaceReservedChar(AChar: WideChar): string;
 begin
   case AChar of
     '{': Result := '\{';
diff --git a/Ext/SynEdit/Source/SynHighlighterADSP21xx.pas b/Ext/SynEdit/Source/SynHighlighterADSP21xx.pas
index 896bcc9..7049172 100644
--- a/Ext/SynEdit/Source/SynHighlighterADSP21xx.pas
+++ b/Ext/SynEdit/Source/SynHighlighterADSP21xx.pas
@@ -27,13 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterADSP21xx.pas,v 1.16.2.7 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a ADSP21xx highlighter for SynEdit)
@@ -61,7 +54,7 @@ interface
   TtkTokenKind = (tkComment, tkCondition, tkIdentifier, tkKey, tkNull, tkNumber,
     tkRegister, tkSpace, tkString, tkSymbol, tkUnknown);
 
-  TRangeState = (rsUnknown, rsPascalComment, rsCComment, rsHexNumber,
+  TRangeState = (rsUnKnown, rsPascalComment, rsCComment, rsHexNumber,
     rsBinaryNumber, rsInclude);
 
   PIdentFuncTableFunc = ^TIdentFuncTableFunc;
@@ -69,20 +62,20 @@ interface
 
   TSynADSP21xxSyn = class(TSynCustomHighlighter)
   private
-    FRange: TRangeState;
-    FIdentFuncTable: array[0..820] of TIdentFuncTableFunc;
-    FTokenId: TtkTokenKind;
-    FNumberAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FRegisterAttri: TSynHighlighterAttributes;
-    FConditionAttri: TSynHighlighterAttributes;
-    FNullAttri: TSynHighlighterAttributes;
-    FUnknownAttri: TSynHighlighterAttributes;
+    fRange: TRangeState;
+    fIdentFuncTable: array[0..820] of TIdentFuncTableFunc;
+    FTokenID: TtkTokenKind;
+    fNumberAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fRegisterAttri: TSynHighlighterAttributes;
+    fConditionAttri: TSynHighlighterAttributes;
+    fNullAttri: TSynHighlighterAttributes;
+    fUnknownAttri: TSynHighlighterAttributes;
     function AltFunc(Index: Integer): TtkTokenKind;
     function FuncAbs(Index: Integer): TtkTokenKind;
     function FuncAbstract(Index: Integer): TtkTokenKind;
@@ -289,7 +282,7 @@   TSynADSP21xxSyn = class(TSynCustomHighlighter)
   public
     class function GetCapabilities: TSynHighlighterCapabilities; override;
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -305,48 +298,49 @@   TSynADSP21xxSyn = class(TSynCustomHighlighter)
     function UseUserSettings(settingIndex: Integer): Boolean; override;
     procedure EnumUserSettings(settings: TStrings); override;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property ConditionAttri: TSynHighlighterAttributes read FConditionAttri
-      write FConditionAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property RegisterAttri: TSynHighlighterAttributes read FRegisterAttri
-      write FRegisterAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property ConditionAttri: TSynHighlighterAttributes read fConditionAttri
+      write fConditionAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property RegisterAttri: TSynHighlighterAttributes read fRegisterAttri
+      write fRegisterAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
   end;
 
 implementation
 
 uses
   Windows,
+  Registry,
   SynEditStrConst;
 
 const
-  KeyWords: array[0..178] of UnicodeString = (
-    'abs', 'abstract', 'ac', 'af', 'alt_reg', 'and', 'ar', 'ar_sat', 'ashift', 
-    'astat', 'aux', 'av', 'av_latch', 'ax0', 'ax1', 'ay0', 'ay1', 'b', 
-    'bit_rev', 'bm', 'boot', 'by', 'cache', 'call', 'ce', 'circ', 'clear', 
-    'clr', 'clrbit', 'cntl', 'cntr', 'const', 'define', 'dis', 'divq', 'divs', 
-    'dm', 'dmovlay', 'do', 'else', 'emode', 'ena', 'endif', 'endmacro', 
-    'endmod', 'entry', 'eq', 'exp', 'expadj', 'external', 'fl0', 'fl1', 'fl2', 
-    'flag_in', 'flag_out', 'for', 'forever', 'ge', 'global', 'go_mode', 'gt', 
-    'h', 'hi', 'i0', 'i1', 'i2', 'i3', 'i4', 'i5', 'i6', 'i7', 'icntl', 'idle', 
-    'if', 'ifc', 'ifdef', 'ifndef', 'imask', 'in', 'include', 'init', 'io', 
-    'jump', 'l0', 'l1', 'l2', 'l3', 'l4', 'l5', 'l6', 'l7', 'le', 'lo', 'local', 
-    'loop', 'lshift', 'lt', 'm_mode', 'm0', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6', 
-    'm7', 'macro', 'mf', 'modify', 'module', 'mr', 'mr0', 'mr1', 'mr2', 'mstat', 
-    'mv', 'mx0', 'mx1', 'my0', 'my1', 'name', 'ne', 'neg', 'newpage', 'nop', 
-    'norm', 'not', 'of', 'or', 'pass', 'pc', 'pm', 'pop', 'port', 'push', 'ram', 
-    'regbank', 'reset', 'rnd', 'rom', 'rti', 'rts', 'rx0', 'rx1', 'sat', 'sb', 
+  KeyWords: array[0..178] of string = (
+    'abs', 'abstract', 'ac', 'af', 'alt_reg', 'and', 'ar', 'ar_sat', 'ashift',
+    'astat', 'aux', 'av', 'av_latch', 'ax0', 'ax1', 'ay0', 'ay1', 'b',
+    'bit_rev', 'bm', 'boot', 'by', 'cache', 'call', 'ce', 'circ', 'clear',
+    'clr', 'clrbit', 'cntl', 'cntr', 'const', 'define', 'dis', 'divq', 'divs',
+    'dm', 'dmovlay', 'do', 'else', 'emode', 'ena', 'endif', 'endmacro',
+    'endmod', 'entry', 'eq', 'exp', 'expadj', 'external', 'fl0', 'fl1', 'fl2',
+    'flag_in', 'flag_out', 'for', 'forever', 'ge', 'global', 'go_mode', 'gt',
+    'h', 'hi', 'i0', 'i1', 'i2', 'i3', 'i4', 'i5', 'i6', 'i7', 'icntl', 'idle',
+    'if', 'ifc', 'ifdef', 'ifndef', 'imask', 'in', 'include', 'init', 'io',
+    'jump', 'l0', 'l1', 'l2', 'l3', 'l4', 'l5', 'l6', 'l7', 'le', 'lo', 'local',
+    'loop', 'lshift', 'lt', 'm_mode', 'm0', 'm1', 'm2', 'm3', 'm4', 'm5', 'm6',
+    'm7', 'macro', 'mf', 'modify', 'module', 'mr', 'mr0', 'mr1', 'mr2', 'mstat',
+    'mv', 'mx0', 'mx1', 'my0', 'my1', 'name', 'ne', 'neg', 'newpage', 'nop',
+    'norm', 'not', 'of', 'or', 'pass', 'pc', 'pm', 'pop', 'port', 'push', 'ram',
+    'regbank', 'reset', 'rnd', 'rom', 'rti', 'rts', 'rx0', 'rx1', 'sat', 'sb',
     'sec_reg', 'seg', 'segment', 'set', 'setbit', 'shift', 'shl', 'shr', 'si', 
     'sr', 'sr0', 'sr1', 'ss', 'sstat', 'static', 'sts', 'su', 'test', 'testbit', 
     'tglbit', 'timer', 'toggle', 'topofpcstack', 'trap', 'true', 'tx0', 'tx1', 
@@ -411,7 +405,7 @@ function TSynADSP21xxSyn.HashKey(Str: PWideChar): Cardinal;
     Inc(Str);
   end;
   Result := Result mod 821;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -419,10 +413,10 @@ function TSynADSP21xxSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
@@ -431,189 +425,189 @@ procedure TSynADSP21xxSyn.InitIdent;
 var
   i: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
     if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
-
-  FIdentFuncTable[48] := FuncAbs;
-  FIdentFuncTable[426] := FuncAbstract;
-  FIdentFuncTable[642] := FuncAc;
-  FIdentFuncTable[667] := FuncAf;
-  FIdentFuncTable[693] := FuncAlt95reg;
-  FIdentFuncTable[806] := FuncAnd;
-  FIdentFuncTable[767] := FuncAr;
-  FIdentFuncTable[153] := FuncAr95sat;
-  FIdentFuncTable[126] := FuncAshift;
-  FIdentFuncTable[220] := FuncAstat;
-  FIdentFuncTable[51] := FuncAux;
-  FIdentFuncTable[253] := FuncAv;
-  FIdentFuncTable[99] := FuncAv95latch;
-  FIdentFuncTable[698] := FuncAx0;
-  FIdentFuncTable[159] := FuncAx1;
-  FIdentFuncTable[19] := FuncAy0;
-  FIdentFuncTable[301] := FuncAy1;
-  FIdentFuncTable[543] := FuncB;
-  FIdentFuncTable[298] := FuncBit95rev;
-  FIdentFuncTable[320] := FuncBm;
-  FIdentFuncTable[118] := FuncBoot;
-  FIdentFuncTable[420] := FuncBy;
-  FIdentFuncTable[763] := FuncCache;
-  FIdentFuncTable[217] := FuncCall;
-  FIdentFuncTable[669] := FuncCe;
-  FIdentFuncTable[122] := FuncCirc;
-  FIdentFuncTable[579] := FuncClear;
-  FIdentFuncTable[147] := FuncClr;
-  FIdentFuncTable[196] := FuncClrbit;
-  FIdentFuncTable[757] := FuncCntl;
-  FIdentFuncTable[807] := FuncCntr;
-  FIdentFuncTable[525] := FuncConst;
-  FIdentFuncTable[629] := FuncDefine;
-  FIdentFuncTable[715] := FuncDis;
-  FIdentFuncTable[756] := FuncDivq;
-  FIdentFuncTable[499] := FuncDivs;
-  FIdentFuncTable[604] := FuncDm;
-  FIdentFuncTable[576] := FuncDmovlay;
-  FIdentFuncTable[347] := FuncDo;
-  FIdentFuncTable[337] := FuncElse;
-  FIdentFuncTable[229] := FuncEmode;
-  FIdentFuncTable[345] := FuncEna;
-  FIdentFuncTable[391] := FuncEndif;
-  FIdentFuncTable[156] := FuncEndmacro;
-  FIdentFuncTable[509] := FuncEndmod;
-  FIdentFuncTable[146] := FuncEntry;
-  FIdentFuncTable[232] := FuncEq;
-  FIdentFuncTable[248] := FuncExp;
-  FIdentFuncTable[21] := FuncExpadj;
-  FIdentFuncTable[213] := FuncExternal;
-  FIdentFuncTable[91] := FuncFl0;
-  FIdentFuncTable[373] := FuncFl1;
-  FIdentFuncTable[655] := FuncFl2;
-  FIdentFuncTable[750] := FuncFlag95in;
-  FIdentFuncTable[448] := FuncFlag95out;
-  FIdentFuncTable[246] := FuncFor;
-  FIdentFuncTable[175] := FuncForever;
-  FIdentFuncTable[416] := FuncGe;
-  FIdentFuncTable[398] := FuncGlobal;
-  FIdentFuncTable[702] := FuncGo95mode;
-  FIdentFuncTable[541] := FuncGt;
-  FIdentFuncTable[593] := FuncH;
-  FIdentFuncTable[44] := FuncHi;
-  FIdentFuncTable[532] := FuncI0;
-  FIdentFuncTable[814] := FuncI1;
-  FIdentFuncTable[275] := FuncI2;
-  FIdentFuncTable[557] := FuncI3;
-  FIdentFuncTable[18] := FuncI4;
-  FIdentFuncTable[300] := FuncI5;
-  FIdentFuncTable[582] := FuncI6;
-  FIdentFuncTable[43] := FuncI7;
-  FIdentFuncTable[369] := FuncIcntl;
-  FIdentFuncTable[98] := FuncIdle;
-  FIdentFuncTable[161] := FuncIf;
-  FIdentFuncTable[158] := FuncIfc;
-  FIdentFuncTable[370] := FuncIfdef;
-  FIdentFuncTable[800] := FuncIfndef;
-  FIdentFuncTable[143] := FuncImask;
-  FIdentFuncTable[775] := FuncIn;
-  FIdentFuncTable[339] := FuncInclude;
-  FIdentFuncTable[349] := FuncInit;
-  FIdentFuncTable[236] := FuncIo;
-  FIdentFuncTable[70] := FuncJump;
-  FIdentFuncTable[137] := FuncL0;
-  FIdentFuncTable[419] := FuncL1;
-  FIdentFuncTable[701] := FuncL2;
-  FIdentFuncTable[162] := FuncL3;
-  FIdentFuncTable[444] := FuncL4;
-  FIdentFuncTable[726] := FuncL5;
-  FIdentFuncTable[187] := FuncL6;
-  FIdentFuncTable[469] := FuncL7;
-  FIdentFuncTable[305] := FuncLe;
-  FIdentFuncTable[662] := FuncLo;
-  FIdentFuncTable[38] := FuncLocal;
-  FIdentFuncTable[234] := FuncLoop;
-  FIdentFuncTable[595] := FuncLshift;
-  FIdentFuncTable[430] := FuncLt;
-  FIdentFuncTable[564] := FuncM95mode;
-  FIdentFuncTable[279] := FuncM0;
-  FIdentFuncTable[561] := FuncM1;
-  FIdentFuncTable[22] := FuncM2;
-  FIdentFuncTable[304] := FuncM3;
-  FIdentFuncTable[586] := FuncM4;
-  FIdentFuncTable[47] := FuncM5;
-  FIdentFuncTable[329] := FuncM6;
-  FIdentFuncTable[611] := FuncM7;
-  FIdentFuncTable[144] := FuncMacro;
-  FIdentFuncTable[729] := FuncMf;
-  FIdentFuncTable[617] := FuncModify;
-  FIdentFuncTable[268] := FuncModule;
-  FIdentFuncTable[8] := FuncMr;
-  FIdentFuncTable[180] := FuncMr0;
-  FIdentFuncTable[462] := FuncMr1;
-  FIdentFuncTable[744] := FuncMr2;
-  FIdentFuncTable[760] := FuncMstat;
-  FIdentFuncTable[315] := FuncMv;
-  FIdentFuncTable[211] := FuncMx0;
-  FIdentFuncTable[493] := FuncMx1;
-  FIdentFuncTable[353] := FuncMy0;
-  FIdentFuncTable[635] := FuncMy1;
-  FIdentFuncTable[63] := FuncName;
-  FIdentFuncTable[589] := FuncNe;
-  FIdentFuncTable[599] := FuncNeg;
-  FIdentFuncTable[434] := FuncNewpage;
-  FIdentFuncTable[452] := FuncNop;
-  FIdentFuncTable[471] := FuncNorm;
-  FIdentFuncTable[759] := FuncNot;
-  FIdentFuncTable[192] := FuncOf;
-  FIdentFuncTable[292] := FuncOr;
-  FIdentFuncTable[594] := FuncPass;
-  FIdentFuncTable[309] := FuncPc;
-  FIdentFuncTable[666] := FuncPm;
-  FIdentFuncTable[23] := FuncPop;
-  FIdentFuncTable[29] := FuncPort;
-  FIdentFuncTable[238] := FuncPush;
-  FIdentFuncTable[255] := FuncRam;
-  FIdentFuncTable[401] := FuncRegbank;
-  FIdentFuncTable[449] := FuncReset;
-  FIdentFuncTable[384] := FuncRnd;
-  FIdentFuncTable[601] := FuncRom;
-  FIdentFuncTable[183] := FuncRti;
-  FIdentFuncTable[540] := FuncRts;
-  FIdentFuncTable[276] := FuncRx0;
-  FIdentFuncTable[558] := FuncRx1;
-  FIdentFuncTable[478] := FuncSat;
-  FIdentFuncTable[453] := FuncSb;
-  FIdentFuncTable[705] := FuncSec95reg;
-  FIdentFuncTable[664] := FuncSeg;
-  FIdentFuncTable[507] := FuncSegment;
-  FIdentFuncTable[225] := FuncSet;
-  FIdentFuncTable[520] := FuncSetbit;
-  FIdentFuncTable[745] := FuncShift;
-  FIdentFuncTable[37] := FuncShl;
-  FIdentFuncTable[87] := FuncShr;
-  FIdentFuncTable[785] := FuncSi;
-  FIdentFuncTable[39] := FuncSr;
-  FIdentFuncTable[136] := FuncSr0;
-  FIdentFuncTable[418] := FuncSr1;
-  FIdentFuncTable[321] := FuncSs;
-  FIdentFuncTable[514] := FuncSstat;
-  FIdentFuncTable[736] := FuncStatic;
-  FIdentFuncTable[431] := FuncSts;
-  FIdentFuncTable[64] := FuncSu;
-  FIdentFuncTable[323] := FuncTest;
-  FIdentFuncTable[216] := FuncTestbit;
-  FIdentFuncTable[645] := FuncTglbit;
-  FIdentFuncTable[473] := FuncTimer;
-  FIdentFuncTable[311] := FuncToggle;
-  FIdentFuncTable[683] := FuncTopofpcstack;
-  FIdentFuncTable[758] := FuncTrap;
-  FIdentFuncTable[496] := FuncTrue;
-  FIdentFuncTable[58] := FuncTx0;
-  FIdentFuncTable[340] := FuncTx1;
-  FIdentFuncTable[465] := FuncUndef;
-  FIdentFuncTable[160] := FuncUntil;
-  FIdentFuncTable[605] := FuncUs;
-  FIdentFuncTable[348] := FuncUu;
-  FIdentFuncTable[408] := FuncVar;
-  FIdentFuncTable[536] := FuncXor;
+      fIdentFuncTable[i] := AltFunc;
+
+  fIdentFuncTable[48] := FuncAbs;
+  fIdentFuncTable[426] := FuncAbstract;
+  fIdentFuncTable[642] := FuncAc;
+  fIdentFuncTable[667] := FuncAf;
+  fIdentFuncTable[693] := FuncAlt95reg;
+  fIdentFuncTable[806] := FuncAnd;
+  fIdentFuncTable[767] := FuncAr;
+  fIdentFuncTable[153] := FuncAr95sat;
+  fIdentFuncTable[126] := FuncAshift;
+  fIdentFuncTable[220] := FuncAstat;
+  fIdentFuncTable[51] := FuncAux;
+  fIdentFuncTable[253] := FuncAv;
+  fIdentFuncTable[99] := FuncAv95latch;
+  fIdentFuncTable[698] := FuncAx0;
+  fIdentFuncTable[159] := FuncAx1;
+  fIdentFuncTable[19] := FuncAy0;
+  fIdentFuncTable[301] := FuncAy1;
+  fIdentFuncTable[543] := FuncB;
+  fIdentFuncTable[298] := FuncBit95rev;
+  fIdentFuncTable[320] := FuncBm;
+  fIdentFuncTable[118] := FuncBoot;
+  fIdentFuncTable[420] := FuncBy;
+  fIdentFuncTable[763] := FuncCache;
+  fIdentFuncTable[217] := FuncCall;
+  fIdentFuncTable[669] := FuncCe;
+  fIdentFuncTable[122] := FuncCirc;
+  fIdentFuncTable[579] := FuncClear;
+  fIdentFuncTable[147] := FuncClr;
+  fIdentFuncTable[196] := FuncClrbit;
+  fIdentFuncTable[757] := FuncCntl;
+  fIdentFuncTable[807] := FuncCntr;
+  fIdentFuncTable[525] := FuncConst;
+  fIdentFuncTable[629] := FuncDefine;
+  fIdentFuncTable[715] := FuncDis;
+  fIdentFuncTable[756] := FuncDivq;
+  fIdentFuncTable[499] := FuncDivs;
+  fIdentFuncTable[604] := FuncDm;
+  fIdentFuncTable[576] := FuncDmovlay;
+  fIdentFuncTable[347] := FuncDo;
+  fIdentFuncTable[337] := FuncElse;
+  fIdentFuncTable[229] := FuncEmode;
+  fIdentFuncTable[345] := FuncEna;
+  fIdentFuncTable[391] := FuncEndif;
+  fIdentFuncTable[156] := FuncEndmacro;
+  fIdentFuncTable[509] := FuncEndmod;
+  fIdentFuncTable[146] := FuncEntry;
+  fIdentFuncTable[232] := FuncEq;
+  fIdentFuncTable[248] := FuncExp;
+  fIdentFuncTable[21] := FuncExpadj;
+  fIdentFuncTable[213] := FuncExternal;
+  fIdentFuncTable[91] := FuncFl0;
+  fIdentFuncTable[373] := FuncFl1;
+  fIdentFuncTable[655] := FuncFl2;
+  fIdentFuncTable[750] := FuncFlag95in;
+  fIdentFuncTable[448] := FuncFlag95out;
+  fIdentFuncTable[246] := FuncFor;
+  fIdentFuncTable[175] := FuncForever;
+  fIdentFuncTable[416] := FuncGe;
+  fIdentFuncTable[398] := FuncGlobal;
+  fIdentFuncTable[702] := FuncGo95mode;
+  fIdentFuncTable[541] := FuncGt;
+  fIdentFuncTable[593] := FuncH;
+  fIdentFuncTable[44] := FuncHi;
+  fIdentFuncTable[532] := FuncI0;
+  fIdentFuncTable[814] := FuncI1;
+  fIdentFuncTable[275] := FuncI2;
+  fIdentFuncTable[557] := FuncI3;
+  fIdentFuncTable[18] := FuncI4;
+  fIdentFuncTable[300] := FuncI5;
+  fIdentFuncTable[582] := FuncI6;
+  fIdentFuncTable[43] := FuncI7;
+  fIdentFuncTable[369] := FuncIcntl;
+  fIdentFuncTable[98] := FuncIdle;
+  fIdentFuncTable[161] := FuncIf;
+  fIdentFuncTable[158] := FuncIfc;
+  fIdentFuncTable[370] := FuncIfdef;
+  fIdentFuncTable[800] := FuncIfndef;
+  fIdentFuncTable[143] := FuncImask;
+  fIdentFuncTable[775] := FuncIn;
+  fIdentFuncTable[339] := FuncInclude;
+  fIdentFuncTable[349] := FuncInit;
+  fIdentFuncTable[236] := FuncIo;
+  fIdentFuncTable[70] := FuncJump;
+  fIdentFuncTable[137] := FuncL0;
+  fIdentFuncTable[419] := FuncL1;
+  fIdentFuncTable[701] := FuncL2;
+  fIdentFuncTable[162] := FuncL3;
+  fIdentFuncTable[444] := FuncL4;
+  fIdentFuncTable[726] := FuncL5;
+  fIdentFuncTable[187] := FuncL6;
+  fIdentFuncTable[469] := FuncL7;
+  fIdentFuncTable[305] := FuncLe;
+  fIdentFuncTable[662] := FuncLo;
+  fIdentFuncTable[38] := FuncLocal;
+  fIdentFuncTable[234] := FuncLoop;
+  fIdentFuncTable[595] := FuncLshift;
+  fIdentFuncTable[430] := FuncLt;
+  fIdentFuncTable[564] := FuncM95mode;
+  fIdentFuncTable[279] := FuncM0;
+  fIdentFuncTable[561] := FuncM1;
+  fIdentFuncTable[22] := FuncM2;
+  fIdentFuncTable[304] := FuncM3;
+  fIdentFuncTable[586] := FuncM4;
+  fIdentFuncTable[47] := FuncM5;
+  fIdentFuncTable[329] := FuncM6;
+  fIdentFuncTable[611] := FuncM7;
+  fIdentFuncTable[144] := FuncMacro;
+  fIdentFuncTable[729] := FuncMf;
+  fIdentFuncTable[617] := FuncModify;
+  fIdentFuncTable[268] := FuncModule;
+  fIdentFuncTable[8] := FuncMr;
+  fIdentFuncTable[180] := FuncMr0;
+  fIdentFuncTable[462] := FuncMr1;
+  fIdentFuncTable[744] := FuncMr2;
+  fIdentFuncTable[760] := FuncMstat;
+  fIdentFuncTable[315] := FuncMv;
+  fIdentFuncTable[211] := FuncMx0;
+  fIdentFuncTable[493] := FuncMx1;
+  fIdentFuncTable[353] := FuncMy0;
+  fIdentFuncTable[635] := FuncMy1;
+  fIdentFuncTable[63] := FuncName;
+  fIdentFuncTable[589] := FuncNe;
+  fIdentFuncTable[599] := FuncNeg;
+  fIdentFuncTable[434] := FuncNewpage;
+  fIdentFuncTable[452] := FuncNop;
+  fIdentFuncTable[471] := FuncNorm;
+  fIdentFuncTable[759] := FuncNot;
+  fIdentFuncTable[192] := FuncOf;
+  fIdentFuncTable[292] := FuncOr;
+  fIdentFuncTable[594] := FuncPass;
+  fIdentFuncTable[309] := FuncPc;
+  fIdentFuncTable[666] := FuncPm;
+  fIdentFuncTable[23] := FuncPop;
+  fIdentFuncTable[29] := FuncPort;
+  fIdentFuncTable[238] := FuncPush;
+  fIdentFuncTable[255] := FuncRam;
+  fIdentFuncTable[401] := FuncRegbank;
+  fIdentFuncTable[449] := FuncReset;
+  fIdentFuncTable[384] := FuncRnd;
+  fIdentFuncTable[601] := FuncRom;
+  fIdentFuncTable[183] := FuncRti;
+  fIdentFuncTable[540] := FuncRts;
+  fIdentFuncTable[276] := FuncRx0;
+  fIdentFuncTable[558] := FuncRx1;
+  fIdentFuncTable[478] := FuncSat;
+  fIdentFuncTable[453] := FuncSb;
+  fIdentFuncTable[705] := FuncSec95reg;
+  fIdentFuncTable[664] := FuncSeg;
+  fIdentFuncTable[507] := FuncSegment;
+  fIdentFuncTable[225] := FuncSet;
+  fIdentFuncTable[520] := FuncSetbit;
+  fIdentFuncTable[745] := FuncShift;
+  fIdentFuncTable[37] := FuncShl;
+  fIdentFuncTable[87] := FuncShr;
+  fIdentFuncTable[785] := FuncSi;
+  fIdentFuncTable[39] := FuncSr;
+  fIdentFuncTable[136] := FuncSr0;
+  fIdentFuncTable[418] := FuncSr1;
+  fIdentFuncTable[321] := FuncSs;
+  fIdentFuncTable[514] := FuncSstat;
+  fIdentFuncTable[736] := FuncStatic;
+  fIdentFuncTable[431] := FuncSts;
+  fIdentFuncTable[64] := FuncSu;
+  fIdentFuncTable[323] := FuncTest;
+  fIdentFuncTable[216] := FuncTestbit;
+  fIdentFuncTable[645] := FuncTglbit;
+  fIdentFuncTable[473] := FuncTimer;
+  fIdentFuncTable[311] := FuncToggle;
+  fIdentFuncTable[683] := FuncTopofpcstack;
+  fIdentFuncTable[758] := FuncTrap;
+  fIdentFuncTable[496] := FuncTrue;
+  fIdentFuncTable[58] := FuncTx0;
+  fIdentFuncTable[340] := FuncTx1;
+  fIdentFuncTable[465] := FuncUndef;
+  fIdentFuncTable[160] := FuncUntil;
+  fIdentFuncTable[605] := FuncUs;
+  fIdentFuncTable[348] := FuncUu;
+  fIdentFuncTable[408] := FuncVar;
+  fIdentFuncTable[536] := FuncXor;
 end;
 
 function TSynADSP21xxSyn.AltFunc(Index: Integer): TtkTokenKind;
@@ -764,7 +758,7 @@ function TSynADSP21xxSyn.FuncB(Index: Integer): TtkTokenKind;
     if FLine[Run + 1] = '#' then
     begin
       Result := tkNumber;
-      FRange := rsBinaryNumber;
+      fRange := rsBinaryNumber;
     end
     else
     begin
@@ -1126,7 +1120,7 @@ function TSynADSP21xxSyn.FuncH(Index: Integer): TtkTokenKind;
     if FLine[Run + 1] = '#' then
     begin
       Result := tkNumber;
-      FRange := rsHexNumber;
+      fRange := rsHexNumber;
     end
     else
     begin
@@ -2077,68 +2071,67 @@ constructor TSynADSP21xxSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
+  fCaseSensitive := False;
 
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.ForeGround := clTeal;
-  FCommentAttri.Style:= [fsItalic];
-  AddAttribute(FCommentAttri);
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.ForeGround := clTeal;
+  fCommentAttri.Style:= [fsItalic];
+  AddAttribute(fCommentAttri);
 
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
 
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style:= [fsBold];
-  AddAttribute(FKeyAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style:= [fsBold];
+  AddAttribute(fKeyAttri);
 
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  FNumberAttri.ForeGround := clOlive;
-  AddAttribute(FNumberAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  fNumberAttri.ForeGround := clOlive;
+  AddAttribute(fNumberAttri);
 
-  FRegisterAttri := TSynHighlighterAttributes.Create(SYNS_AttrRegister, SYNS_FriendlyAttrRegister);
-  FRegisterAttri.ForeGround := clBlue;
-  AddAttribute(FRegisterAttri);
+  fRegisterAttri := TSynHighlighterAttributes.Create(SYNS_AttrRegister, SYNS_FriendlyAttrRegister);
+  fRegisterAttri.ForeGround := clBlue;
+  AddAttribute(fRegisterAttri);
 
-  FConditionAttri := TSynHighlighterAttributes.Create(SYNS_AttrCondition, SYNS_FriendlyAttrCondition);
-  FConditionAttri.ForeGround := clFuchsia;
-  AddAttribute(FConditionAttri);
+  fConditionAttri := TSynHighlighterAttributes.Create(SYNS_AttrCondition, SYNS_FriendlyAttrCondition);
+  fConditionAttri.ForeGround := clFuchsia;
+  AddAttribute(fConditionAttri);
 
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
 
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
 
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
 
-  FNullAttri := TSynHighlighterAttributes.Create(SYNS_AttrNull, SYNS_FriendlyAttrNull);
-  AddAttribute(FNullAttri);
+  fNullAttri := TSynHighlighterAttributes.Create(SYNS_AttrNull, SYNS_FriendlyAttrNull);
+  AddAttribute(fNullAttri);
 
-  FUnknownAttri := TSynHighlighterAttributes.Create(SYNS_AttrUnknownWord, SYNS_FriendlyAttrUnknownWord);
-  AddAttribute(FUnknownAttri);
+  fUnknownAttri := TSynHighlighterAttributes.Create(SYNS_AttrUnknownWord, SYNS_FriendlyAttrUnknownWord);
+  AddAttribute(fUnknownAttri);
 
   SetAttributesOnChange(DefHighlightChange);
 
   InitIdent;
-  FRange := rsUnknown;
-  FDefaultFilter := SYNS_FilterADSP21xx;
+  fRange := rsUnknown;
+  fDefaultFilter := SYNS_FilterADSP21xx;
 end;
 
 procedure TSynADSP21xxSyn.BraceCloseProc;
 begin
   Inc(Run);
-  FTokenId := tkSymbol;
+  fTokenId := tkSymbol;
 end;
 
 procedure TSynADSP21xxSyn.StringProc;
 begin
-  FTokenId := tkString;
+  fTokenID := tkString;
   if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then Inc(Run, 2);
   repeat
     case FLine[Run] of
-      #0, #10, #13:
-        Break;
+      #0, #10, #13: Break;
     end;
     Inc(Run);
   until FLine[Run] = #39;
@@ -2147,7 +2140,7 @@ procedure TSynADSP21xxSyn.StringProc;
 
 procedure TSynADSP21xxSyn.PascalCommentProc;
 begin
-  FTokenId := tkComment;
+  fTokenID := tkComment;
   case FLine[Run] of
     #0:
       begin
@@ -2170,35 +2163,32 @@ procedure TSynADSP21xxSyn.PascalCommentProc;
     case FLine[Run] of
       '}':
         begin
-          FRange := rsUnknown;
+          fRange := rsUnKnown;
           Inc(Run);
           Break;
         end;
-      #10, #13:
-        Break;
+      #10: Break;
+      #13: Break;
       else Inc(Run);
     end;
 end;
 
 procedure TSynADSP21xxSyn.CCommentProc;
 begin
-  FTokenId := tkComment;
+  fTokenID := tkComment;
   case FLine[Run] of
-    #0: 
-      begin
-        NullProc;
-        Exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        Exit;
-      end;
-    #13:
-      begin
-        CRProc;
-        Exit;
-      end;
+    #0: begin
+          NullProc;
+          Exit;
+        end;
+    #10:begin
+         LFProc;
+         Exit;
+        end;
+    #13:begin
+          CRProc;
+          Exit;
+        end;
   end;
 
   while FLine[Run] <> #0 do
@@ -2207,37 +2197,35 @@ procedure TSynADSP21xxSyn.CCommentProc;
         begin
           if FLine[Run+1] = '/' then
           begin
-            FRange := rsUnknown;
+            fRange := rsUnknown;
             Inc(Run, 2);
             Break;
           end
           else
             Inc(Run);
         end;
-      #10, #13:
-        Break;
-      else
-        Inc(Run);
+      #10: Break;
+      #13: Break;
+      else Inc(Run);
     end;
 end;
 
 procedure TSynADSP21xxSyn.BraceOpenProc;
 begin
-  FTokenId := tkComment;
-  FRange := rsPascalComment;
+  fTokenID := tkComment;
+  fRange := rsPascalComment;
   Inc(Run);
   while FLine[Run] <> #0 do
     case FLine[Run] of
       '}':
         begin
-          FRange := rsUnknown;
+          fRange := rsUnKnown;
           Inc(Run);
           Break;
         end;
-      #10, #13:
-        Break;
-      else
-        Inc(Run);
+      #10: Break;
+      #13: Break;
+    else Inc(Run);
     end;
 end;
 
@@ -2245,22 +2233,21 @@ procedure TSynADSP21xxSyn.BraceOpenProc;
 procedure TSynADSP21xxSyn.IncludeCloseProc;
 begin
   Inc(Run);
-  FTokenId := tkSymbol;
+  fTokenId := tkSymbol;
 end;
 
 procedure TSynADSP21xxSyn.CRProc;
 begin
-  FTokenId := tkSpace;
-  case FLine[Run + 1] of
+  fTokenID := tkSpace;
+  Case FLine[Run + 1] of
     #10: Inc(Run, 2);
-  else
-    Inc(Run);
+  else Inc(Run);
   end;
 end;
 
 procedure TSynADSP21xxSyn.ExclamationProc;
 begin
-  FTokenId := tkComment;
+  fTokenID := tkComment;
   repeat
     Inc(Run);
   until IsLineEnd(Run);
@@ -2268,9 +2255,9 @@ procedure TSynADSP21xxSyn.ExclamationProc;
 
 procedure TSynADSP21xxSyn.IdentProc;
 begin
-  FTokenId := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do
+  fTokenID := IdentKind((fLine + Run));
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do
     Inc(Run);
 end;
 
@@ -2278,7 +2265,7 @@ procedure TSynADSP21xxSyn.IntegerProc;
 
   function IsIntegerChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f':
         Result := True;
       else
@@ -2288,19 +2275,19 @@ procedure TSynADSP21xxSyn.IntegerProc;
 
 begin
   Inc(Run);
-  FTokenId := tkNumber;
+  fTokenID := tkNumber;
   while IsIntegerChar do Inc(Run);
 end;
 
 procedure TSynADSP21xxSyn.LFProc;
 begin
-  FTokenId := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynADSP21xxSyn.NullProc;
 begin
-  FTokenId := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -2308,7 +2295,7 @@ procedure TSynADSP21xxSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f', 'x', 'X', '.':
         Result := True;
       else
@@ -2318,13 +2305,12 @@ procedure TSynADSP21xxSyn.NumberProc;
 
 begin
   Inc(Run);
-  FTokenId := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar do
   begin
     case FLine[Run] of
       '.':
-        if FLine[Run + 1] = '.' then
-          Break;
+        if FLine[Run + 1] = '.' then Break;
     end;
     Inc(Run);
   end;
@@ -2334,7 +2320,7 @@ procedure TSynADSP21xxSyn.HexNumber;
 
   function IsHexChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f':
         Result := True;
       else
@@ -2344,8 +2330,8 @@ procedure TSynADSP21xxSyn.HexNumber;
 
 begin
   Inc(Run);
-  FTokenId := tkNumber;
-  FRange := rsUnknown;
+  fTokenID := tkNumber;
+  fRange := rsUnKnown;
   while IsHexChar do
   begin
     Inc(Run);
@@ -2355,76 +2341,73 @@ procedure TSynADSP21xxSyn.HexNumber;
 procedure TSynADSP21xxSyn.BinaryNumber;
 begin
   Inc(Run);
-  FRange := rsUnknown;
+  fRange := rsUnKnown;
   while CharInSet(FLine[Run], ['0'..'1']) do
   begin
     Inc(Run);
   end;
   if CharInSet(FLine[Run], ['2'..'9', 'A'..'F', 'a'..'f']) then
   begin
-    FTokenId := tkIdentifier
+    fTokenID := tkIdentifier
   end
   else
-    FTokenId := tkNumber;
+    fTokenID := tkNumber;
 end;
 
 procedure TSynADSP21xxSyn.SlashProc;
 begin
   if FLine[Run + 1] = '*' then
   begin
-    FTokenId := tkComment;
-    FRange := rsCComment;
+    fTokenID := tkComment;
+    fRange := rsCComment;
     Inc(Run, 2);
     while FLine[Run] <> #0 do
       case FLine[Run] of
-        '*':
-          begin
-            if FLine[Run+1] = '/' then
-            begin
-              Inc(Run, 2);
-              FRange := rsUnknown;
-              Break;
-            end
-            else
-              Inc(Run);
-          end;
-        #10, #13:
-          Break;
-        else
-          Inc(Run);
+        '*':  begin
+                if FLine[Run+1] = '/' then
+                begin
+                  Inc(Run, 2);
+                  fRange := rsUnknown;
+                  Break;
+                end
+                else Inc(Run);
+              end;
+        #10: Break;
+        #13: Break;
+        else Inc(Run);
       end;
     end
   else
   begin
     Inc(Run);
-    FTokenId := tkSymbol;
+    fTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynADSP21xxSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenId := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynADSP21xxSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenId := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynADSP21xxSyn.Next;
 begin
-  FTokenPos := Run;
-  case FRange of
+  fTokenPos := Run;
+  case fRange of
     rsPascalComment: PascalCommentProc;
     rsCComment: CCommentProc;
     rsHexNumber: HexNumber;
     rsBinaryNumber: BinaryNumber;
   else
-    FRange := rsUnknown;
-    case FLine[Run] of
+    fRange := rsUnknown;
+    case fLine[Run] of
       #0: NullProc;
       #10: LFProc;
       #13: CRProc;
@@ -2447,12 +2430,12 @@ procedure TSynADSP21xxSyn.Next;
 function TSynADSP21xxSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -2460,12 +2443,12 @@ function TSynADSP21xxSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAtt
 
 function TSynADSP21xxSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynADSP21xxSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenId;
+  Result := fTokenId;
 end;
 
 function TSynADSP21xxSyn.GetTokenKind: Integer;
@@ -2476,16 +2459,16 @@ function TSynADSP21xxSyn.GetTokenKind: Integer;
 function TSynADSP21xxSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
   case GetTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkRegister: Result := FRegisterAttri;
-    tkCondition: Result := FConditionAttri;
-    tkUnknown: Result := FSymbolAttri;
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkRegister: Result := fRegisterAttri;
+    tkCondition: Result := fConditionAttri;
+    tkUnknown: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -2493,23 +2476,23 @@ function TSynADSP21xxSyn.GetTokenAttribute: TSynHighlighterAttributes;
 
 function TSynADSP21xxSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 procedure TSynADSP21xxSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 procedure TSynADSP21xxSyn.ResetRange;
 begin
-  FRange:= rsUnknown;
+  fRange:= rsUnknown;
 end;
 
 procedure TSynADSP21xxSyn.EnumUserSettings(settings: TStrings);
 begin
   { returns the user settings that exist in the registry }
-  with TBetterRegistry.Create do
+  with TRegistry.Create do
   begin
     try
       RootKey := HKEY_CURRENT_USER;
@@ -2533,14 +2516,14 @@ function TSynADSP21xxSyn.UseUserSettings(settingIndex: Integer): Boolean;
 //   index into TStrings returned by EnumUserSettings
 // Possible return values:
 //   true : settings were read and used
-//   False: problem reading settings or invalid version specified - old settings
+//   false: problem reading settings or invalid version specified - old settings
 //          were preserved
 
     function ReadDspIDESetting(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean;
     begin
       try
         Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
-          '\Software\Wynand\DspIDE\1.0\Editor\Highlight', key, False);
+               '\Software\Wynand\DspIDE\1.0\Editor\Highlight',key, False);
       except
         Result := False;
       end;
@@ -2573,34 +2556,33 @@ function TSynADSP21xxSyn.UseUserSettings(settingIndex: Integer): Boolean;
       tmpSpaceAttri     := TSynHighlighterAttributes.Create('', '');
       tmpRegisterAttri  := TSynHighlighterAttributes.Create('', '');
 
-      tmpNumberAttri    .Assign(FNumberAttri);
-      tmpKeyAttri       .Assign(FKeyAttri);
-      tmpSymbolAttri    .Assign(FSymbolAttri);
-      tmpCommentAttri   .Assign(FCommentAttri);
-      tmpConditionAttri .Assign(FConditionAttri);
-      tmpIdentifierAttri.Assign(FIdentifierAttri);
-      tmpSpaceAttri     .Assign(FSpaceAttri);
-      tmpRegisterAttri  .Assign(FRegisterAttri);
-      Result :=
-        ReadDspIDESetting(StrLst[settingIndex], FCommentAttri,'Comment')       and
-        ReadDspIDESetting(StrLst[settingIndex], FIdentifierAttri,'Identifier') and
-        ReadDspIDESetting(StrLst[settingIndex], FKeyAttri,'Reserved word')     and
-        ReadDspIDESetting(StrLst[settingIndex], FNumberAttri,'BinaryNumber')   and
-        ReadDspIDESetting(StrLst[settingIndex], FSpaceAttri,'Whitespace')      and
-        ReadDspIDESetting(StrLst[settingIndex], FSymbolAttri,'Symbol')         and
-        ReadDspIDESetting(StrLst[settingIndex], FConditionAttri,'Condition')   and
-        ReadDspIDESetting(StrLst[settingIndex], FRegisterAttri,'Symbol');
+      tmpNumberAttri    .Assign(fNumberAttri);
+      tmpKeyAttri       .Assign(fKeyAttri);
+      tmpSymbolAttri    .Assign(fSymbolAttri);
+      tmpCommentAttri   .Assign(fCommentAttri);
+      tmpConditionAttri .Assign(fConditionAttri);
+      tmpIdentifierAttri.Assign(fIdentifierAttri);
+      tmpSpaceAttri     .Assign(fSpaceAttri);
+      tmpRegisterAttri  .Assign(fRegisterAttri);
+      Result := ReadDspIDESetting(StrLst[settingIndex],fCommentAttri,'Comment')       and
+                ReadDspIDESetting(StrLst[settingIndex],fIdentifierAttri,'Identifier') and
+                ReadDspIDESetting(StrLst[settingIndex],fKeyAttri,'Reserved word')     and
+                ReadDspIDESetting(StrLst[settingIndex],fNumberAttri,'BinaryNumber')   and
+                ReadDspIDESetting(StrLst[settingIndex],fSpaceAttri,'Whitespace')      and
+                ReadDspIDESetting(StrLst[settingIndex],fSymbolAttri,'Symbol')         and
+                ReadDspIDESetting(StrLst[settingIndex],fConditionAttri,'Condition')   and
+                ReadDspIDESetting(StrLst[settingIndex],fRegisterAttri,'Symbol');
       if not Result then
       begin
-        FNumberAttri     .Assign(tmpNumberAttri);
-        FKeyAttri        .Assign(tmpKeyAttri);
-        FSymbolAttri     .Assign(tmpSymbolAttri);
-        FCommentAttri    .Assign(tmpCommentAttri);
-        FConditionAttri  .Assign(tmpConditionAttri);
-        FIdentifierAttri .Assign(tmpIdentifierAttri);
-        FSpaceAttri      .Assign(tmpSpaceAttri);
-        FConditionAttri  .Assign(tmpConditionAttri);
-        FRegisterAttri   .Assign(tmpRegisterAttri);
+        fNumberAttri     .Assign(tmpNumberAttri);
+        fKeyAttri        .Assign(tmpKeyAttri);
+        fSymbolAttri     .Assign(tmpSymbolAttri);
+        fCommentAttri    .Assign(tmpCommentAttri);
+        fConditionAttri  .Assign(tmpConditionAttri);
+        fIdentifierAttri .Assign(tmpIdentifierAttri);
+        fSpaceAttri      .Assign(tmpSpaceAttri);
+        fConditionAttri  .Assign(tmpConditionAttri);
+        fRegisterAttri   .Assign(tmpRegisterAttri);
       end;
       tmpNumberAttri    .Free;
       tmpKeyAttri       .Free;
@@ -2611,14 +2593,12 @@ function TSynADSP21xxSyn.UseUserSettings(settingIndex: Integer): Boolean;
       tmpSpaceAttri     .Free;
       tmpRegisterAttri  .Free;
     end;
-  finally
-    StrLst.Free;
-  end;
+  finally StrLst.Free; end;
 end;
 
 function TSynADSP21xxSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterADSP21xx;
+  Result := fDefaultFilter <> SYNS_FilterADSP21xx;
 end;
 
 class function TSynADSP21xxSyn.GetLanguageName: string;
@@ -2631,13 +2611,11 @@ class function TSynADSP21xxSyn.GetCapabilities: TSynHighlighterCapabilities;
   Result := inherited GetCapabilities + [hcUserSettings];
 end;
 
-class function TSynADSP21xxSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynADSP21xxSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangADSP21xx;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynADSP21xxSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterAWK.pas b/Ext/SynEdit/Source/SynHighlighterAWK.pas
index 48894ac..1871e89 100644
--- a/Ext/SynEdit/Source/SynHighlighterAWK.pas
+++ b/Ext/SynEdit/Source/SynHighlighterAWK.pas
@@ -27,13 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterAWK.pas,v 1.10.2.6 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a AWK Script highlighter for SynEdit)
@@ -63,17 +56,17 @@ interface
 
   TSynAWKSyn = class(TSynCustomHighLighter)
   private
-    AWKSyntaxList: TUnicodeStringList;
+    AWKSyntaxList: TStringList;
     FTokenID: TtkTokenKind;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FInterFuncAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FSysVarAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fInterFuncAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    fSysVarAttri: TSynHighlighterAttributes;
     procedure AndProc;
     procedure CommentProc;
     procedure CRProc;
@@ -97,7 +90,7 @@   TSynAWKSyn = class(TSynCustomHighLighter)
     function IsFilterStored: Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
@@ -109,31 +102,28 @@   TSynAWKSyn = class(TSynCustomHighLighter)
     function GetTokenKind: Integer; override;
     procedure Next; override;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property InterFuncAttri: TSynHighlighterAttributes read FInterFuncAttri
-      write FInterFuncAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
-    property SysVarAttri: TSynHighlighterAttributes read FSysVarAttri
-      write FSysVarAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property InterFuncAttri: TSynHighlighterAttributes read fInterFuncAttri
+      write fInterFuncAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
+    property SysVarAttri: TSynHighlighterAttributes read fSysVarAttri
+      write fSysVarAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
   end;
 
 implementation
 
 uses
-{$IFDEF UNICODE}
-  WideStrUtils,
-{$ENDIF}
   SynEditStrConst;
 
 procedure TSynAWKSyn.MakeSyntaxList;
@@ -211,15 +201,15 @@ procedure TSynAWKSyn.MakeSyntaxList;
 
 procedure TSynAWKSyn.BraceProc;
 begin
-  FTokenID := tkIdentifier;
+  fTokenID := tkIdentifier;
   Inc(Run);
 end;
 
 procedure TSynAWKSyn.NumberProc;
 begin
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   Inc(Run);
-  while CharInSet(FLine[Run], ['0'..'9']) do
+  while CharInSet(fLine[Run], ['0'..'9']) do
     Inc(Run);
 end;
 
@@ -227,29 +217,29 @@ procedure TSynAWKSyn.IdentProc;
 var
   i: Integer;
   idx: Integer;
-  s: UnicodeString;
+  s: string;
 begin
   i := Run;
-  while CharInSet(FLine[i], ['a'..'z', 'A'..'Z']) do
+  while CharInSet(fLine[i], ['a'..'z', 'A'..'Z']) do
     Inc(i);
   SetLength(s, i - Run);
-  WStrLCopy(PWideChar(s), FLine + Run, i - Run);
+  StrLCopy(PWideChar(s), fLine + Run, i - Run);
   Run := i;
   if AWKSyntaxList.Find(s, idx) and (AWKSyntaxList.Strings[idx] = s) then
   begin
-    FTokenID := TtkTokenKind(AWKSyntaxList.Objects[idx]);
-    if (FTokenID = tkUnKnown) then
+    fTokenID := TtkTokenKind(AWKSyntaxList.Objects[idx]);
+    if (fTokenID = tkUnKnown) then
     begin
-      FTokenID := tkKey;
-      if (FLine[i] = ' ') then
+      fTokenID := tkKey;
+      if (fLine[i] = ' ') then
       begin
-        while (FLine[i] = ' ') do
+        while (fLine[i] = ' ') do
           Inc(i);
-        if (FLine[i + 0] = 'f') and
-          (FLine[i + 1] = 'i') and
-          (FLine[i + 2] = 'l') and
-          (FLine[i + 3] = 'e') and
-          CharInSet(FLine[i + 4], [#0..#32, ';']) then
+        if (fLine[i + 0] = 'f') and
+          (fLine[i + 1] = 'i') and
+          (fLine[i + 2] = 'l') and
+          (fLine[i + 3] = 'e') and
+          CharInSet(fLine[i + 4], [#0..#32, ';']) then
         begin
           Run := (i + 4);
         end;
@@ -257,13 +247,13 @@ procedure TSynAWKSyn.IdentProc;
     end;
   end
   else
-    FTokenID := tkIdentifier;
+    fTokenID := tkIdentifier;
 end;
 
 procedure TSynAWKSyn.Next;
 begin
-  FTokenPos := Run;
-  case FLine[Run] of
+  fTokenPos := Run;
+  case fLine[Run] of
     #0: NullProc;
     #10: LFProc;
     #13: CRProc;
@@ -290,19 +280,19 @@ procedure TSynAWKSyn.StringProc;
 begin
   repeat
     Inc(Run);
-    if (FLine[Run] = '"') and (FLine[Run - 1] <> '\') then
+    if (fLine[Run] = '"') and (fLine[Run - 1] <> '\') then
     begin
-      FTokenID := tkString;
+      fTokenID := tkString;
       Inc(Run);
       Exit;
     end;
-  until CharInSet(FLine[Run], [#0..#31]);
-  FTokenID := tkIdentifier;
+  until CharInSet(fLine[Run], [#0..#31]);
+  fTokenID := tkIdentifier;
 end;
 
 procedure TSynAWKSyn.CommentProc;
 begin
-  FTokenID := tkComment;
+  fTokenID := tkComment;
   while not IsLineEnd(Run) do
     Inc(Run);
 end;
@@ -311,7 +301,7 @@ procedure TSynAWKSyn.FieldRefProc;
 
   function IsAlphaNumChar(Run: Integer): Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'a'..'z', 'A'..'Z':
         Result := True;
       else
@@ -321,137 +311,137 @@ procedure TSynAWKSyn.FieldRefProc;
 
 begin
   Inc(Run);
-  if CharInSet(FLine[Run], ['0'..'9']) and not IsAlphaNumChar(Run + 1) then
+  if CharInSet(fLine[Run], ['0'..'9']) and not IsAlphaNumChar(Run + 1) then
   begin
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
     Inc(Run);
   end
   else
-    FTokenID := tkIdentifier;
+    fTokenID := tkIdentifier;
 end;
 
 procedure TSynAWKSyn.SymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
 end;
 
 procedure TSynAWKSyn.PlusProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
-  if CharInSet(FLine[Run], ['+', '=']) then
+  if CharInSet(fLine[Run], ['+', '=']) then
     Inc(Run);
 end;
 
 procedure TSynAWKSyn.MinusProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
-  if CharInSet(FLine[Run], ['-', '=']) then
+  if CharInSet(fLine[Run], ['-', '=']) then
     Inc(Run);
 end;
 
 procedure TSynAWKSyn.OpInputProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
-  if (FLine[Run] = '=') then
+  if (fLine[Run] = '=') then
     Inc(Run);
 end;
 
 procedure TSynAWKSyn.ExclamProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
-  if CharInSet(FLine[Run], ['=', '~']) then
+  if CharInSet(fLine[Run], ['=', '~']) then
     Inc(Run);
 end;
 
 procedure TSynAWKSyn.QuestionProc;
 begin
   Inc(Run);
-  if (FLine[Run] = ':') then
+  if (fLine[Run] = ':') then
   begin
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
     Inc(Run);
   end
   else
-    FTokenID := tkIdentifier;
+    fTokenID := tkIdentifier;
 end;
 
 procedure TSynAWKSyn.OrProc;
 begin
   Inc(Run);
-  if (FLine[Run] = '|') then
+  if (fLine[Run] = '|') then
   begin
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
     Inc(Run);
   end
   else
-    FTokenID := tkIdentifier;
+    fTokenID := tkIdentifier;
 end;
 
 procedure TSynAWKSyn.AndProc;
 begin
   Inc(Run);
-  if (FLine[Run] = '&') then
+  if (fLine[Run] = '&') then
   begin
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
     Inc(Run);
   end
   else
-    FTokenID := tkIdentifier;
+    fTokenID := tkIdentifier;
 end;
 
 constructor TSynAWKSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := True;
+  fCaseSensitive := True;
 
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Foreground := clBlue;
-  AddAttribute(FCommentAttri);
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Foreground := clBlue;
+  AddAttribute(fCommentAttri);
 
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
 
-  FInterFuncAttri := TSynHighlighterAttributes.Create(SYNS_AttrInternalFunction, SYNS_FriendlyAttrInternalFunction);
-  FInterFuncAttri.Foreground := $00408080;
-  FInterFuncAttri.Style := [fsBold];
-  AddAttribute(FInterFuncAttri);
+  fInterFuncAttri := TSynHighlighterAttributes.Create(SYNS_AttrInternalFunction, SYNS_FriendlyAttrInternalFunction);
+  fInterFuncAttri.Foreground := $00408080;
+  fInterFuncAttri.Style := [fsBold];
+  AddAttribute(fInterFuncAttri);
 
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Foreground := $00FF0080;
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Foreground := $00FF0080;
+  fKeyAttri.Style := [fsBold];
+  AddAttribute(fKeyAttri);
 
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
 
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
 
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  FStringAttri.Foreground := clTeal;
-  AddAttribute(FStringAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  fStringAttri.Foreground := clTeal;
+  AddAttribute(fStringAttri);
 
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  FSymbolAttri.Style := [fsBold];
-  AddAttribute(FSymbolAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  fSymbolAttri.Style := [fsBold];
+  AddAttribute(fSymbolAttri);
 
-  FSysVarAttri := TSynHighlighterAttributes.Create(SYNS_AttrSystemValue, SYNS_FriendlyAttrSystemValue);
-  FSysVarAttri.Foreground := $000080FF;
-  FSysVarAttri.Style := [fsBold];
-  AddAttribute(FSysVarAttri);
+  fSysVarAttri := TSynHighlighterAttributes.Create(SYNS_AttrSystemValue, SYNS_FriendlyAttrSystemValue);
+  fSysVarAttri.Foreground := $000080FF;
+  fSysVarAttri.Style := [fsBold];
+  AddAttribute(fSysVarAttri);
 
   SetAttributesOnChange(DefHighlightChange);
 
-  AWKSyntaxList := TUnicodeStringList.Create;
+  AWKSyntaxList := TStringList.Create;
   MakeSyntaxList;
 
-  FDefaultFilter := SYNS_FilterAWK;
+  fDefaultFilter := SYNS_FilterAWK;
 end;
 
 destructor TSynAWKSyn.Destroy;
@@ -463,37 +453,37 @@ destructor TSynAWKSyn.Destroy;
 
 procedure TSynAWKSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run] = #10 then Inc(Run);
+  if fLine[Run] = #10 then Inc(Run);
 end;
 
 procedure TSynAWKSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynAWKSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
 procedure TSynAWKSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 function TSynAWKSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -501,26 +491,26 @@ function TSynAWKSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribut
 
 function TSynAWKSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynAWKSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynAWKSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  case FTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkInterFunc: Result := FInterFuncAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkSysVar: Result := FSysVarAttri;
+  case fTokenID of
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkInterFunc: Result := fInterFuncAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkSysVar: Result := fSysVarAttri;
   else
     Result := nil;
   end;
@@ -528,12 +518,12 @@ function TSynAWKSyn.GetTokenAttribute: TSynHighlighterAttributes;
 
 function TSynAWKSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
 function TSynAWKSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterAWK;
+  Result := fDefaultFilter <> SYNS_FilterAWK;
 end;
 
 class function TSynAWKSyn.GetLanguageName: string;
@@ -541,13 +531,11 @@ class function TSynAWKSyn.GetLanguageName: string;
   Result := SYNS_LangAWK;
 end;
 
-class function TSynAWKSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynAWKSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangAWK;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynAWKSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterAsm.pas b/Ext/SynEdit/Source/SynHighlighterAsm.pas
index 86d5145..d23c2b1 100644
--- a/Ext/SynEdit/Source/SynHighlighterAsm.pas
+++ b/Ext/SynEdit/Source/SynHighlighterAsm.pas
@@ -27,13 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterAsm.pas,v 1.14.2.6 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a x86 Assembler highlighter for SynEdit)
@@ -52,13 +45,13 @@
 interface
 
 uses
-  Graphics,
+  System.SysUtils,
+  System.Classes,
+  System.Generics.Defaults,
+  System.Generics.Collections,
+  Vcl.Graphics,
   SynEditTypes,
-  SynEditHighlighter,
-  SynHighlighterHashEntries,
-  SynUnicode,
-  SysUtils,
-  Classes;
+  SynEditHighlighter;
 
 type
   TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
@@ -67,16 +60,15 @@ interface
 type
   TSynAsmSyn = class(TSynCustomHighlighter)
   private
-    FTokenID: TtkTokenKind;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FKeywords: TSynHashEntryList;
-    function HashKey(Str: PWideChar): Cardinal;
+    fTokenID: TtkTokenKind;
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    FKeywords: TDictionary;
     procedure CommentProc;
     procedure CRProc;
     procedure GreaterProc;
@@ -91,14 +83,14 @@   TSynAsmSyn = class(TSynCustomHighlighter)
     procedure SingleQuoteStringProc;
     procedure SymbolProc;
     procedure UnknownProc;
-    procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
+    procedure DoAddKeyword(AKeyword: string; AKind: Integer);
     function IdentKind(MayBe: PWideChar): TtkTokenKind;
   protected
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     function IsFilterStored: Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;    
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
@@ -110,28 +102,29 @@   TSynAsmSyn = class(TSynCustomHighlighter)
     function GetTokenKind: Integer; override;
     procedure Next; override;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
   end;
 
 implementation
 
 uses
+  SynEditMiscProcs,
   SynEditStrConst;
 
 const
-  Mnemonics: UnicodeString =
+  Mnemonics: string =
     'aaa,aad,aam,adc,add,and,arpl,bound,bsf,bsr,bswap,bt,btc,' +
     'btr,bts,call,cbw,cdq,clc,cld,cli,clts,cmc,cmp,cmps,cmpsb,cmpsd,cmpsw,' +
     'cmpxchg,cwd,cwde,daa,das,dec,div,emms,enter,f2xm1,fabs,fadd,faddp,fbld,' +
@@ -164,88 +157,67 @@ implementation
     'sldt,smsw,stc,std,sti,stos,stosb,stosd,stosw,str,sub,test,verr,verw,' +
     'wait,wbinvd,xadd,xchg,xlat,xlatb,xor';
 
-procedure TSynAsmSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
-var
-  HashValue: Cardinal;
+procedure TSynAsmSyn.DoAddKeyword(AKeyword: string; AKind: Integer);
 begin
-  HashValue := HashKey(PWideChar(AKeyword));
-  FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
+  if not FKeywords.ContainsKey(AKeyword) then
+    FKeywords.Add(AKeyword, TtkTokenKind(AKind));
 end;
 
-{$Q-}
-function TSynAsmSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 197 + Ord(Str^) * 14;
-    Inc(Str);
-  end;
-  Result := Result mod 4561;
-  FStringLen := Str - FToIdent;
-end;
-{$Q+}
-
 function TSynAsmSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
-  Entry: TSynHashEntry;
+  S: string;
 begin
-  FToIdent := MayBe;
-  Entry := FKeywords[HashKey(MayBe)];
-  while Assigned(Entry) do
-  begin
-    if Entry.KeywordLen > FStringLen then
-      Break
-    else if Entry.KeywordLen = FStringLen then
-      if IsCurrentToken(Entry.Keyword) then
-      begin
-        Result := TtkTokenKind(Entry.Kind);
-        Exit;
-      end;
-    Entry := Entry.Next;
-  end;
-  Result := tkIdentifier;
+  fToIdent := MayBe;
+  while IsIdentChar(MayBe^) do
+    Inc(Maybe);
+  fStringLen := Maybe - fToIdent;
+  SetString(S, fToIdent, fStringLen);
+  if FKeywords.ContainsKey(S) then
+    Result := FKeywords[S]
+  else
+    Result := tkIdentifier;
 end;
 
 constructor TSynAsmSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
-
-  FKeywords := TSynHashEntryList.Create;
-
-  FCommentAttri       := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  AddAttribute(FCommentAttri);
-  FIdentifierAttri    := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FKeyAttri           := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style     := [fsBold];
-  AddAttribute(FKeyAttri);
-  FNumberAttri        := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-  FSpaceAttri         := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FStringAttri        := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-  FSymbolAttri        := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
+  fCaseSensitive := False;
+
+  // Create the keywords dictionary case-insensitive
+  FKeywords := TDictionary.Create(TIStringComparer.Ordinal);
+
+  fCommentAttri       := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  AddAttribute(fCommentAttri);
+  fIdentifierAttri    := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fKeyAttri           := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style     := [fsBold];
+  AddAttribute(fKeyAttri);
+  fNumberAttri        := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
+  fSpaceAttri         := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fStringAttri        := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
+  fSymbolAttri        := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
 
   EnumerateKeywords(Ord(tkKey), Mnemonics, IsIdentChar, DoAddKeyword);
   SetAttributesOnChange(DefHighlightChange);
-  FDefaultFilter      := SYNS_FilterX86Assembly;
+  fDefaultFilter      := SYNS_FilterX86Assembly;
 end;
 
 destructor TSynAsmSyn.Destroy;
 begin
-  FKeywords.Free;
+  fKeywords.Free;
   inherited Destroy;
 end;
 
 procedure TSynAsmSyn.CommentProc;
 begin
-  FTokenID := tkComment;
+  fTokenID := tkComment;
   repeat
     Inc(Run);
   until IsLineEnd(Run);
@@ -253,41 +225,41 @@ procedure TSynAsmSyn.CommentProc;
 
 procedure TSynAsmSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run] = #10 then Inc(Run);
+  if fLine[Run] = #10 then Inc(Run);
 end;
 
 procedure TSynAsmSyn.GreaterProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
-  if FLine[Run] = '=' then Inc(Run);
+  fTokenID := tkSymbol;
+  if fLine[Run] = '=' then Inc(Run);
 end;
 
 procedure TSynAsmSyn.IdentProc;
 begin
-  FTokenID := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  fTokenID := IdentKind((fLine + Run));
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
 end;
 
 procedure TSynAsmSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynAsmSyn.LowerProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
-  if CharInSet(FLine[Run], ['=', '>']) then Inc(Run);
+  fTokenID := tkSymbol;
+  if CharInSet(fLine[Run], ['=', '>']) then Inc(Run);
 end;
 
 procedure TSynAsmSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -295,7 +267,7 @@ procedure TSynAsmSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', '.', 'a'..'f', 'h', 'A'..'F', 'H':
         Result := True;
       else
@@ -305,7 +277,7 @@ procedure TSynAsmSyn.NumberProc;
 
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar do
     Inc(Run);
 end;
@@ -313,32 +285,31 @@ procedure TSynAsmSyn.NumberProc;
 procedure TSynAsmSyn.SlashProc;
 begin
   Inc(Run);
-  if FLine[Run] = '/' then begin
-    FTokenID := tkComment;
+  if fLine[Run] = '/' then begin
+    fTokenID := tkComment;
     repeat
       Inc(Run);
     until IsLineEnd(Run);
   end else
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
 end;
 
 procedure TSynAsmSyn.SpaceProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   repeat
     Inc(Run);
-  until (FLine[Run] > #32) or IsLineEnd(Run);
+  until (fLine[Run] > #32) or IsLineEnd(Run);
 end;
 
 procedure TSynAsmSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then
     Inc(Run, 2);
   repeat
     case FLine[Run] of
-      #0, #10, #13:
-        Break;
+      #0, #10, #13: Break;
     end;
     Inc(Run);
   until FLine[Run] = #34;
@@ -347,13 +318,12 @@ procedure TSynAsmSyn.StringProc;
 
 procedure TSynAsmSyn.SingleQuoteStringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then
     Inc(Run, 2);
   repeat
     case FLine[Run] of
-      #0, #10, #13:
-        Break;
+      #0, #10, #13: Break;
     end;
     Inc(Run);
   until FLine[Run] = #39;
@@ -363,19 +333,19 @@ procedure TSynAsmSyn.SingleQuoteStringProc;
 procedure TSynAsmSyn.SymbolProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynAsmSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkIdentifier;
+  fTokenID := tkIdentifier;
 end;
 
 procedure TSynAsmSyn.Next;
 begin
-  FTokenPos := Run;
-  case FLine[Run] of
+  fTokenPos := Run;
+  case fLine[Run] of
      #0: NullProc;
     #10: LFProc;
     #13: CRProc;
@@ -404,12 +374,12 @@ procedure TSynAsmSyn.Next;
 function TSynAsmSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -417,32 +387,32 @@ function TSynAsmSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribut
 
 function TSynAsmSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynAsmSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  case FTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkUnknown: Result := FIdentifierAttri;
+  case fTokenID of
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkUnknown: Result := fIdentifierAttri;
     else Result := nil;
   end;
 end;
 
 function TSynAsmSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
 function TSynAsmSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 class function TSynAsmSyn.GetLanguageName: string;
@@ -452,39 +422,36 @@ class function TSynAsmSyn.GetLanguageName: string;
 
 function TSynAsmSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterX86Assembly;
+  Result := fDefaultFilter <> SYNS_FilterX86Assembly;
 end;
 
-function TSynAsmSyn.GetSampleSource: UnicodeString;
+function TSynAsmSyn.GetSampleSource: string;
 begin
-  Result :=
-    '; x86 assembly sample source'#13#10 +
-    '  CODE	SEGMENT	BYTE PUBLIC'#13#10 +
-    '    ASSUME	CS:CODE'#13#10 +
-    #13#10 +
-    '    PUSH SS'#13#10 +
-    '    POP DS'#13#10 +
-    '    MOV AX, AABBh'#13#10 +
-    '    MOV	BYTE PTR ES:[DI], 255'#13#10 +
-    '    JMP SHORT AsmEnd'#13#10 +
-    #13#10 +
-    '  welcomeMsg DB ''Hello World'', 0'#13#10 +
-    #13#10 +
-    '  AsmEnd:'#13#10 +
-    '    MOV AX, 0'#13#10 +
-    #13#10 +
-    '  CODE	ENDS'#13#10 +
-    'END';
+  Result := '; x86 assembly sample source'#13#10 +
+            '  CODE	SEGMENT	BYTE PUBLIC'#13#10 +
+            '    ASSUME	CS:CODE'#13#10 +
+            #13#10 +
+            '    PUSH SS'#13#10 +
+            '    POP DS'#13#10 +
+            '    MOV AX, AABBh'#13#10 +
+            '    MOV	BYTE PTR ES:[DI], 255'#13#10 +
+            '    JMP SHORT AsmEnd'#13#10 +
+            #13#10 +
+            '  welcomeMsg DB ''Hello World'', 0'#13#10 +
+            #13#10 +
+            '  AsmEnd:'#13#10 +
+            '    MOV AX, 0'#13#10 +
+            #13#10 +
+            '  CODE	ENDS'#13#10 +
+            'END';
 end;
 
-class function TSynAsmSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynAsmSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangX86Asm;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynAsmSyn);
-{$ENDIF}
 end.
 
diff --git a/Ext/SynEdit/Source/SynHighlighterAsmMASM.pas b/Ext/SynEdit/Source/SynHighlighterAsmMASM.pas
deleted file mode 100644
index c212819..0000000
--- a/Ext/SynEdit/Source/SynHighlighterAsmMASM.pas
+++ /dev/null
@@ -1,749 +0,0 @@
-{-------------------------------------------------------------------------------
-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: SynHighlighterASM.pas, released 2000-04-18.
-The Original Code is based on the nhAsmSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Nick Hoddinott.
-Unicode translation by Maël Hörz.
-All Rights Reserved.
-
-Contributors to the SynEdit and mwEdit projects are listed in the
-Contributors.txt file.
-
-Alternatively, the contents of this file may be used under the terms of the
-GNU General Public License Version 2 or later (the "GPL"), in which case
-the provisions of the GPL are applicable instead of those above.
-If you wish to allow use of your version of this file only under the terms
-of the GPL and not to allow others to use your version of this file
-under the MPL, indicate your decision by deleting the provisions above and
-replace them with the notice and other provisions required by the GPL.
-If you do not delete the provisions above, a recipient may use your version
-of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterAsmMASM.pas,v 1.0 2017/02/12 tjaeger Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides Microsoft Macro Assembler (MASM) highlighter for SynEdit)
-@author(Thomas Jaeger )
-@created(February 12th, 2017)
-@lastmod(February 12th, 2017)
-The SynHighlighterASM unit provides SynEdit with a Microsoft Macro Assembler (MASM) highlighter.
-The highlighter supports all MASM features including directives and macros.
-
-May experience out of memory when compiling package. Folow instructions to
-compile externally until I move the API functions externally into JSON file.
-}
-
-unit SynHighlighterAsmMASM;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynHighlighterHashEntries,
-  SynUnicode,
-  SysUtils,
-  IOUtils,
-  SynMemo,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
-    tkString, tkSymbol, tkUnknown, tkDirectives, tkRegister, tkApi, tkInclude,
-    tkOperator);
-
-type
-  TSynAsmMASMSyn = class(TSynCustomHighlighter)
-  private
-    FTokenID: TtkTokenKind;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIncludeAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FKeywords: TSynHashEntryList;
-    FDirectivesKeywords: TSynHashEntryList;
-    FDirectivesAttri: TSynHighlighterAttributes;
-    FRegisterKeywords: TSynHashEntryList;
-    FRegisterAttri: TSynHighlighterAttributes;
-    FApiKeywords: TSynHashEntryList;
-    FApiAttri: TSynHighlighterAttributes;
-    FOperatorKeywords: TSynHashEntryList;
-    FOperatorAttri: TSynHighlighterAttributes;
-    FApis: UnicodeString;
-    function HashKey(Str: PWideChar): Cardinal;
-    procedure CommentProc;
-    procedure CRProc;
-    procedure GreaterProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure LowerProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure SlashProc;
-    procedure IncludeProc;
-    procedure SpaceProc;
-    procedure StringProc;
-    procedure SingleQuoteStringProc;
-    procedure SymbolProc;
-    procedure UnknownProc;
-    procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
-    procedure DoAddDirectivesKeyword(AKeyword: UnicodeString; AKind: Integer);
-    procedure DoAddRegisterKeyword(AKeyword: UnicodeString; AKind: Integer);
-    procedure DoAddApiKeyword(AKeyword: UnicodeString; AKind: Integer);
-    procedure DoAddOperatorKeyword(AKeyword: UnicodeString; AKind: Integer);
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-  protected
-    function GetSampleSource: UnicodeString; override;
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    destructor Destroy; override;
-    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: Integer; override;
-    procedure Next; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri;
-    property DirectivesAttri: TSynHighlighterAttributes read FDirectivesAttri write FDirectivesAttri;
-    property RegisterAttri: TSynHighlighterAttributes read FRegisterAttri write FRegisterAttri;
-    property ApiAttri: TSynHighlighterAttributes read FApiAttri write FApiAttri;
-    property IncludeAttri: TSynHighlighterAttributes read FIncludeAttri write FIncludeAttri;
-    property OperatorAttri: TSynHighlighterAttributes read FOperatorAttri write FOperatorAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  Mnemonics: UnicodeString =
-    'aaa,aad,aam,adc,add,and,arpl,bound,bsf,bsr,bswap,bt,btc,' +
-    'btr,bts,call,cbw,cdq,clc,cld,cli,clts,cmc,cmp,cmps,cmpsb,cmpsd,cmpsw,' +
-    'cmpxchg,cwd,cwde,daa,das,dec,div,emms,enter,f2xm1,fabs,fadd,faddp,fbld,' +
-    'fbstp,fchs,fclex,fcmovb,fcmovbe,fcmove,fcmovnb,fcmovnbe,fcmovne,fcmovnu,' +
-    'fcmovu,fcom,fcomi,fcomip,fcomp,fcompp,fcos,fdecstp,fdiv,fdivp,fdivr,' +
-    'fdivrp,femms,ffree,fiadd,ficom,ficomp,fidiv,fidivr,fild,fimul,fincstp,' +
-    'finit,fist,fistp,fisub,fisubr,fld,fld1,fldcw,fldenv,fldl2e,fldl2t,fldlg2,' +
-    'fldln2,fldpi,fldz,fmul,fmulp,fnclex,fninit,fnop,fnsave,fnstcw,fnstenv,' +
-    'fnstsw,fpatan,fprem1,fptan,frndint,frstor,fsave,fscale,fsin,fsincos,' +
-    'fsqrt,fst,fstcw,fstenv,fstp,fstsw,fsub,fsubp,fsubr,fsubrp,ftst,' +
-    'fucom,fucomi,fucomip,fucomp,fucompp,fwait,fxch,fxtract,fyl2xp1,hlt,idiv,' +
-    'imul,in,inc,ins,insb,insd,insw,int,into,invd,invlpg,iret,iretd,iretw,' +
-    'ja,jae,jb,jbe,jc,jcxz,je,jecxz,jg,jge,jl,jle,jmp,jna,jnae,jnb,jnbe,jnc,' +
-    'jne,jng,jnge,jnl,jnle,jno,jnp,jns,jnz,jo,jp,jpe,jpo,js,jz,lahf,lar,lds,' +
-    'lea,leave,les,lfs,lgdt,lgs,lidt,lldt,lmsw,lock,lods,lodsb,lodsd,lodsw,' +
-    'loop,loope,loopne,loopnz,loopz,lsl,lss,ltr,mov,movd,movq, movs,movsb,' +
-    'movsd,movsw,movsx,movzx,mul,neg,nop,not,or,out,outs,outsb,outsd,outsw,' +
-    'packssdw,packsswb,packuswb,paddb,paddd,paddsb,paddsw,paddusb,paddusw,' +
-    'paddw,pand,pandn,pavgusb,pcmpeqb,pcmpeqd,pcmpeqw,pcmpgtb,pcmpgtd,pcmpgtw,' +
-    'pf2id,pfacc,pfadd,pfcmpeq,pfcmpge,pfcmpgt,pfmax,pfmin,pfmul,pfrcp,' +
-    'pfrcpit1,pfrcpit2,pfrsqit1,pfrsqrt,pfsub,pfsubr,pi2fd,pmaddwd,pmulhrw,' +
-    'pmulhw,pmullw,pop,popa,popad,popaw,popf,popfd,popfw,por,prefetch,prefetchw,' +
-    'pslld,psllq,psllw,psrad,psraw,psrld,psrlq,psrlw,psubb,psubd,psubsb,' +
-    'psubsw,psubusb,psubusw,psubw,punpckhbw,punpckhdq,punpckhwd,punpcklbw,' +
-    'punpckldq,punpcklwd,push,pusha,pushad,pushaw,pushf,pushfd,pushfw,pxor,' +
-    'rcl,rcr,rep,repe,repne,repnz,repz,ret,rol,ror,sahf,sal,sar,sbb,scas,' +
-    'scasb,scasd,scasw,seta,setae,setb,setbe,setc,sete,setg,setge,setl,setle,' +
-    'setna,setnae,setnb,setnbe,setnc,setne,setng,setnge,setnl,setnle,setno,' +
-    'setnp,setns,setnz,seto,setp,setpo,sets,setz,sgdt,shl,shld,shr,shrd,sidt,' +
-    'sldt,smsw,stc,std,sti,stos,stosb,stosd,stosw,str,sub,test,verr,verw,' +
-    'wait,wbinvd,xadd,xchg,xlat,xlatb,xor';
-
-  Registers: UnicodeString =
-    'ah,al,ax,bh,bl,bx,ch,cl,cs,cx,dh,di,dl,ds,dx,'+
-    'eax,ebp,ebx,ecx,edi,edx,es,esi,esp,fs,gs,ip,eip,'+
-    'rax,rcx,rdx,rbx,rsp,rbp,rsi,rdisi,ss,'+
-    'r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r11,r12,r13,r14,r15,'+
-    'r0D,r1D,r2D,r3D,r4D,r5D,r6D,r7D,r8D,r9D,r10D,r11D,r12D,r13D,r14D,r15D,'+
-    'r0W,r1W,r2W,r3W,r4W,r5W,r6W,r7W,r8W,r9W,r10W,r11W,r12W,r13W,r14W,r15W,'+
-    'r0L,r1L,r2L,r3L,r4L,r5L,r6L,r7L,r8L,r9L,r10L,r11L,r12L,r13L,r14L,r15L';
-
-  Operators: UnicodeString = '+,-,*,/,==,!=,>,>=,<,<=,||,&&,&,!,carry?,overflow?,'+
-                              'parity?,sign?,zero?,%,&&,abs,addr,and,dup,eq,ge,'+
-                              'gt,high,high32,highword,imagerel,le,length,lengthof,' +
-                              'low,low32,lowword,lroffset,lt,mask,mod,ne,not,offset,' +
-                              'opattr,or,ptr,seg,shl,.type,sectionrel,short,shr,' +
-                              'size,sizeof,this,type,width,xor';
-//  Operators: UnicodeString = 'abs,addr,and,dup,eq,ge,'+
-//                              'gt,high,high32,highword,imagerel,le,length,lengthof,' +
-//                              'low,low32,lowword,lroffset,lt,mask,mod,ne,not,offset,' +
-//                              'opattr,or,ptr,seg,shl,.type,sectionrel,short,shr,' +
-//                              'size,sizeof,this,type,width,xor';
-
-  Directives: UnicodeString =
-    '=,.386,.386p,.387,.486,.486p,.586,.586p,.686,.686p,alias,align,.allocstack,'+
-    '.alpha,assume,.break,byte,catstr,.code,comm,comment,.const,.continue,.cref,'+
-    '.data,.data?,db,dd,df,.dosseg,dosseg,dq,dt,dw,dword,echo,.else,else,elseif,'+
-  	'.elseif,'+
-    'elseif2,end,.endif,endm,endp,.endprolog,ends,.endw,equ,.err,.err2,.errb,'+
-    '.errdef,.errdif[[i]],.erre,.erridn[[i]],.errnb,.errndef,.errnz,even,.exit,'+
-    'exitm,extern,externdef,extrn,.fardata,.fardata?,for,forc,.fpo,fword,goto,'+
-    'group,.if,if,if2,ifb,ifdef,ifdif[[i]],ife,ifidn[[i]],ifnb,ifndef,include,'+
-    'includelib,instr,invoke,irp,irpc,.k3d,label,.lall,.lfcond,.list,.listall,'+
-    '.listif,.listmacro,.listmacroall,local,macro,mmword,.mmx,.model,name,'+
-    '.nocref,.nollist,.nolistif,.nolistmacro,offset,option,org,%out,oword,page,'+
-    'popcontext,proc,proto,public,purge,pushcontext,.pushframe,.pushreg,qword,'+
-    '.radix,real10,real4,real8,record,.repeat,repeat,rept,.safeseh,.sall,'+
-    '.savereg,.savexmm128,sbyte,sdword,segment,.seq,.setframe,.sfcond,sizestr,'+
-    'sqword,.stack,.startup,struc,struct,substr,subtitle,subttl,sword,tbyte,'+
-    'textequ,.tfcond,title,typedef,union,.until,.untilcxz,.while,while,word,'+
-    '.xall,.xcref,.xlist,.xmm,xmmword,ymmword,'+
-    'tiny,small,compact,medium,large,huge,flat,nearstack,farstack'; // .MODEL options
-
-  // Directives for Masm and Tasm
-//  ProcessorSpecification: UnicodeString =
-//    '.186,.286,.286C,.286P,.287,.386,.386C,.386P,.387,' +
-//    '.486,.486C,.486P,.586,.8086,.8087,.NO87,P186,P286,P286N,P286P,P287,P386,P386N,' +
-//    'P386P,P387,P486,P486N,P8086,P8087,PNO87';
-//
-//  GlobalControl: UnicodeString =
-//    'align,emul,ideal,jumps,largestack,masm,masm51,.msfloat,' +
-//    'multerrs,name,noemul,nojumps,nomasm51,nomulterrs,nosmart,nowarn,option,popcontext,' +
-//    'pushcontext,quirks,.radix,radix,smallstack,smart,version,warn';
-//
-//  SegmentControl: UnicodeString =
-//    '.alpha,alpha,assume,.code,codeseg,.const,const,.data,.data?,' +
-//    'dataseg,.dosseg,end,ends,.exit,exitcode,.fardata,fardata,.fardata?,group,.model,' +
-//    'model,org,segment,.seq,seq,.stack,stack,.startup,startupcode,udataseg,ufardata';
-//
-//  Procedures: UnicodeString =
-//    'arg,endp,invoke,label,local,locals,nolocals,proc,proto,uses';
-//
-//  Scope: UnicodeString =
-//    'comm,extern.externdef,extrn,global,include,includelib,publicdll,public';
-//
-//  DataAllocation: UnicodeString =
-//    'byte,db,dd,df,dp,dt,dw,dword,dq,fword,qword,real4,real8,' +
-//    'real10,sbyte,sdword,sword,tbyte,word';
-//
-//  ComplexDataTypes: UnicodeString =
-//    'align,ends,enum,even,evendata,record,struc,struct,table,' +
-//    'tblptr,typedef,union';
-//
-//  Macros: UnicodeString =
-//    'endm,exitm,for,forc,goto,irp,irpc,macro,purge,repeat,rept,textequ,while';
-//
-//  ConditionalAssembly: UnicodeString =
-//    'else,elseif,endif,if,if1,if2,ifb,ifdef,ifdif,ifdif1,ife,' +
-//    'ifidn,ifidni,ifnb,ifndef';
-//
-//  ConditionalError: UnicodeString =
-//    '.err,err,.err1,.err2,.errb,.errdef,.errdif,.errdifi,.erredifni'+
-//    'errif,errif1,errif2,errifb,errifdef,errifdif,errifdifi,errife,errifidn,errifidni,' +
-//    'errifnn,errifndef,.errnb,.errndef,.errnz';
-//
-//  ListingControl: UnicodeString =
-//    '%bin,%conds,%cref,.cref,%crefall,%crefref,%crefuref,%ctls,%depth,' +
-//    '%incl,.lall,.lfcond,%linum,%list,.list,.listall,.listif,.listmacro,.listmacroall,%macs,' +
-//    '%newpage,%noconds,%nocref,.nocref,%noctls,%noincl,%nolist,.nolist,.nolistif,.nolistmacro,' +
-//    '%nomacs,%nosyms,%notrunc,page,$pagesize,%pcnt,%poplctl,%pushlctl,.sall,.sfcond,subtitle,' +
-//    '%subttl,subttl,$syms,%tablsize,%text,.tfcond,%title,title,%trunc,.xall,.xcref,.xlist';
-//
-//  StringControl: UnicodeString = 'catstr,instr,sizestr,substr';
-//
-//  Miscellaneous: UnicodeString = '=,comment,display,echo,equ,%out';
-
-procedure TSynAsmMASMSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
-var
-  HashValue: Cardinal;
-begin
-  HashValue := HashKey(PWideChar(AKeyword));
-  FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
-end;
-
-procedure TSynAsmMASMSyn.DoAddDirectivesKeyword(AKeyword: UnicodeString; AKind: Integer);
-var
-  HashValue: Cardinal;
-begin
-  HashValue := HashKey(PWideChar(AKeyword));
-  FDirectivesKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
-end;
-
-procedure TSynAsmMASMSyn.DoAddRegisterKeyword(AKeyword: UnicodeString; AKind: Integer);
-var
-  HashValue: Cardinal;
-begin
-  HashValue := HashKey(PWideChar(AKeyword));
-  FRegisterKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
-end;
-
-procedure TSynAsmMASMSyn.DoAddApiKeyword(AKeyword: UnicodeString; AKind: Integer);
-var
-  HashValue: Cardinal;
-begin
-  HashValue := HashKey(PWideChar(AKeyword));
-  FApiKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
-end;
-
-procedure TSynAsmMASMSyn.DoAddOperatorKeyword(AKeyword: UnicodeString; AKind: Integer);
-var
-  HashValue: Cardinal;
-begin
-  HashValue := HashKey(PWideChar(AKeyword));
-  FOperatorKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
-end;
-
-//{$Q-}
-function TSynAsmMASMSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 197 + Ord(Str^) * 14;
-    Inc(Str);
-  end;
-  Result := Result mod 4561;
-  FStringLen := Str - FToIdent;
-end;
-//{$Q+}
-
-function TSynAsmMASMSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
-var
-  Entry: TSynHashEntry;
-begin
-  FToIdent := MayBe;
-  Entry := FKeywords[HashKey(MayBe)];
-  while Assigned(Entry) do
-  begin
-    if Entry.KeywordLen > FStringLen then
-      Break
-    else if Entry.KeywordLen = FStringLen then
-      if IsCurrentToken(Entry.Keyword) then
-      begin
-        Result := TtkTokenKind(Entry.Kind);
-        Exit;
-      end;
-    Entry := Entry.Next;
-  end;
-
-  // THJ
-  Entry := FDirectivesKeywords[HashKey(MayBe)];
-  while Assigned(Entry) do
-  begin
-    if Entry.KeywordLen > FStringLen then
-      Break
-    else if Entry.KeywordLen = FStringLen then
-      if IsCurrentToken(Entry.Keyword) then
-      begin
-        Result := TtkTokenKind(Entry.Kind);
-        Exit;
-      end;
-    Entry := Entry.Next;
-  end;
-
-  // THJ
-  Entry := FRegisterKeywords[HashKey(MayBe)];
-  while Assigned(Entry) do
-  begin
-    if Entry.KeywordLen > FStringLen then
-      Break
-    else if Entry.KeywordLen = FStringLen then
-      if IsCurrentToken(Entry.Keyword) then
-      begin
-        Result := TtkTokenKind(Entry.Kind);
-        Exit;
-      end;
-    Entry := Entry.Next;
-  end;
-
-  // THJ
-  Entry := FApiKeywords[HashKey(MayBe)];
-  while Assigned(Entry) do
-  begin
-    if Entry.KeywordLen > FStringLen then
-      Break
-    else if Entry.KeywordLen = FStringLen then
-      if IsCurrentToken(Entry.Keyword) then
-      begin
-        Result := TtkTokenKind(Entry.Kind);
-        Exit;
-      end;
-    Entry := Entry.Next;
-  end;
-
-  Entry := FOperatorKeywords[HashKey(MayBe)];
-  while Assigned(Entry) do
-  begin
-    if Entry.KeywordLen > FStringLen then
-      Break
-    else if Entry.KeywordLen = FStringLen then
-      if IsCurrentToken(Entry.Keyword) then
-      begin
-        Result := TtkTokenKind(Entry.Kind);
-        Exit;
-      end;
-    Entry := Entry.Next;
-  end;
-
-  Result := tkIdentifier;
-end;
-
-constructor TSynAsmMASMSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  FCaseSensitive := False;
-
-  FKeywords := TSynHashEntryList.Create;
-  FDirectivesKeywords := TSynHashEntryList.Create;
-  FRegisterKeywords := TSynHashEntryList.Create;
-  FApiKeywords := TSynHashEntryList.Create;
-  FOperatorKeywords := TSynHashEntryList.Create;
-
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  AddAttribute(FCommentAttri);
-
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
-
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  FNumberAttri.Foreground := clRed;
-  AddAttribute(FNumberAttri);
-
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
-
-  FDirectivesAttri   := TSynHighlighterAttributes.Create('Directives', 'Directives');
-  FDirectivesAttri.Foreground := $008CFF;
-  FDirectivesAttri.Style := [fsBold];
-  AddAttribute(FDirectivesAttri);
-
-  FRegisterAttri := TSynHighlighterAttributes.Create('Register', 'Register');
-  FRegisterAttri.Foreground := $32CD32;
-  FRegisterAttri.Style := [fsBold];
-  AddAttribute(FRegisterAttri);
-
-  FApiAttri := TSynHighlighterAttributes.Create('Api', 'Api');
-  FApiAttri.Foreground := clYellow;
-  FApiAttri.Style := [fsBold];
-  AddAttribute(FApiAttri);
-
-  FIncludeAttri := TSynHighlighterAttributes.Create('Include', 'Include');
-  FIncludeAttri.Foreground := clMoneyGreen;
-  FIncludeAttri.Style := [fsBold];
-  AddAttribute(FIncludeAttri);
-
-  FOperatorAttri := TSynHighlighterAttributes.Create('Operator', 'Operator');
-  FOperatorAttri.Foreground := clLime;
-  FOperatorAttri.Style := [fsBold];
-  AddAttribute(FOperatorAttri);
-
-  EnumerateKeywords(Ord(tkKey), Mnemonics, IsIdentChar, DoAddKeyword);
-  EnumerateKeywords(Ord(tkDirectives), Directives, IsIdentChar, DoAddDirectivesKeyword);
-  EnumerateKeywords(Ord(tkRegister), Registers, IsIdentChar, DoAddRegisterKeyword);
-
-  if FileExists('WinAPIInsertList.txt') then
-    FApis := TFile.ReadAllText('WinAPIInsertList.txt');
-  EnumerateKeywords(Ord(tkApi), FApis, IsIdentChar, DoAddApiKeyword);
-
-  EnumerateKeywords(Ord(tkOperator), Operators, IsIdentChar, DoAddOperatorKeyword);
-
-  SetAttributesOnChange(DefHighlightChange);
-  FDefaultFilter := SYNS_FilterX86Assembly;
-end;
-
-destructor TSynAsmMASMSyn.Destroy;
-begin
-  FKeywords.Free;
-  FDirectivesKeywords.Free;
-  FRegisterKeywords.Free;
-  FApiKeywords.Free;
-  FOperatorKeywords.Free;
-  inherited Destroy;
-end;
-
-procedure TSynAsmMASMSyn.CommentProc;
-begin
-  FTokenID := tkComment;
-  repeat
-    Inc(Run);
-  until IsLineEnd(Run);
-end;
-
-procedure TSynAsmMASMSyn.CRProc;
-begin
-  FTokenID := tkSpace;
-  Inc(Run);
-  if FLine[Run] = #10 then Inc(Run);
-end;
-
-procedure TSynAsmMASMSyn.GreaterProc;
-begin
-  Inc(Run);
-  FTokenID := tkSymbol;
-  if FLine[Run] = '=' then Inc(Run);
-end;
-
-procedure TSynAsmMASMSyn.IdentProc;
-begin
-  FTokenID := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do Inc(Run);
-end;
-
-procedure TSynAsmMASMSyn.LFProc;
-begin
-  FTokenID := tkSpace;
-  Inc(Run);
-end;
-
-procedure TSynAsmMASMSyn.LowerProc;
-begin
-  Inc(Run);
-  FTokenID := tkSymbol;
-  if CharInSet(FLine[Run], ['=', '>']) then Inc(Run);
-end;
-
-procedure TSynAsmMASMSyn.NullProc;
-begin
-  FTokenID := tkNull;
-  Inc(Run);
-end;
-
-procedure TSynAsmMASMSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case FLine[Run] of
-      '0'..'9', 'a'..'f', 'h', 'A'..'F', 'H': Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  Inc(Run);
-  FTokenID := tkNumber;
-  while IsNumberChar do
-    Inc(Run);
-end;
-
-procedure TSynAsmMASMSyn.SlashProc;
-begin
-  Inc(Run);
-  if FLine[Run] = '/' then begin
-    FTokenID := tkComment;
-    repeat
-      Inc(Run);
-    until IsLineEnd(Run);
-  end else
-    FTokenID := tkSymbol;
-end;
-
-procedure TSynAsmMASMSyn.IncludeProc;
-begin
-  FTokenID := tkInclude;
-  repeat
-    Inc(Run);
-  until IsLineEnd(Run);
-end;
-
-procedure TSynAsmMASMSyn.SpaceProc;
-begin
-  FTokenID := tkSpace;
-  repeat
-    Inc(Run);
-  until (FLine[Run] > #32) or IsLineEnd(Run);
-end;
-
-procedure TSynAsmMASMSyn.StringProc;
-begin
-  FTokenID := tkString;
-  if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then
-    Inc(Run, 2);
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: Break;
-    end;
-    Inc(Run);
-  until FLine[Run] = #34;
-  if FLine[Run] <> #0 then Inc(Run);
-end;
-
-procedure TSynAsmMASMSyn.SingleQuoteStringProc;
-begin
-  FTokenID := tkString;
-  if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then
-    Inc(Run, 2);
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: Break;
-    end;
-    Inc(Run);
-  until FLine[Run] = #39;
-  if FLine[Run] <> #0 then Inc(Run);
-end;
-
-procedure TSynAsmMASMSyn.SymbolProc;
-begin
-  Inc(Run);
-  FTokenID := tkSymbol;
-end;
-
-procedure TSynAsmMASMSyn.UnknownProc;
-begin
-  Inc(Run);
-  FTokenID := tkIdentifier;
-end;
-
-procedure TSynAsmMASMSyn.Next;
-begin
-  FTokenPos := Run;
-  case FLine[Run] of
-     #0: NullProc;
-    #10: LFProc;
-    #13: CRProc;
-    #34: StringProc;
-    #39: SingleQuoteStringProc;
-    '>': GreaterProc;
-    '<': LowerProc;
-    '/': SlashProc;
-    '\': IncludeProc;
-    //'A'..'Z', 'a'..'z', '_': IdentProc;
-    'A'..'Z', 'a'..'z', '_', '.', '?', '[', ']': IdentProc;   // THJ
-    '0'..'9': NumberProc;
-    #1..#9, #11, #12, #14..#32: SpaceProc;
-    '#', ';': CommentProc;
-    //'.', ':', '&', '{', '}', '=', '^', '-', '+', '(', ')', '*': SymbolProc;
-    ':', '&', '{', '}', '^', '-', '+', '(', ')', '*': SymbolProc;
-    else
-      UnknownProc;
-  end;
-  inherited;
-end;
-
-function TSynAsmMASMSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
-begin
-  case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynAsmMASMSyn.GetEol: Boolean;
-begin
-  Result := Run = FLineLen + 1;
-end;
-
-function TSynAsmMASMSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  case FTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkUnknown: Result := FIdentifierAttri;
-    tkDirectives: Result := FDirectivesAttri;
-    tkRegister: Result := FRegisterAttri;
-    tkApi: Result := FApiAttri;
-    tkInclude: Result := FIncludeAttri;
-    tkOperator: Result := FOperatorAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynAsmMASMSyn.GetTokenKind: Integer;
-begin
-  Result := Ord(FTokenID);
-end;
-
-function TSynAsmMASMSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := FTokenID;
-end;
-
-class function TSynAsmMASMSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangMASM;
-end;
-
-function TSynAsmMASMSyn.IsFilterStored: Boolean;
-begin
-  Result := FDefaultFilter <> SYNS_FilterX86Assembly;
-end;
-
-function TSynAsmMASMSyn.GetSampleSource: UnicodeString;
-begin
-  Result := '; x86 assembly sample source'#13#10 +
-            '  CODE	SEGMENT	BYTE PUBLIC'#13#10 +
-            '    ASSUME	CS:CODE'#13#10 +
-            #13#10 +
-            '    PUSH SS'#13#10 +
-            '    POP DS'#13#10 +
-            '    MOV AX, AABBh'#13#10 +
-            '    MOV	BYTE PTR ES:[DI], 255'#13#10 +
-            '    JMP SHORT AsmEnd'#13#10 +
-            #13#10 +
-            '  welcomeMsg DB ''Hello World'', 0'#13#10 +
-            #13#10 +
-            '  AsmEnd:'#13#10 +
-            '    MOV AX, 0'#13#10 +
-            #13#10 +
-            '  CODE	ENDS'#13#10 +
-            'END';
-end;
-
-class function TSynAsmMASMSyn.GetFriendlyLanguageName: UnicodeString;
-begin
-  Result := SYNS_FriendlyLangMASM;
-end;
-
-initialization
-{$IFNDEF SYN_CPPB_1}
-  RegisterPlaceableHighlighter(TSynAsmMASMSyn);
-{$ENDIF}
-end.
diff --git a/Ext/SynEdit/Source/SynHighlighterBaan.pas b/Ext/SynEdit/Source/SynHighlighterBaan.pas
index 26b0901..79e5ec2 100644
--- a/Ext/SynEdit/Source/SynHighlighterBaan.pas
+++ b/Ext/SynEdit/Source/SynHighlighterBaan.pas
@@ -27,13 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterBaan.pas,v 1.13.2.6 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a Baan syntax highlighter for SynEdit)
@@ -68,16 +61,16 @@ interface
   TSynBaanSyn = class(TSynCustomHighlighter)
   private
     FTokenID: TtkTokenKind;
-    FIdentFuncTable: array[0..460] of TIdentFuncTableFunc;
-    FCommentAttri: TSynHighlighterAttributes;
-    FDirectiveAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FVariableAttri: TSynHighlighterAttributes;
+    fIdentFuncTable: array[0..460] of TIdentFuncTableFunc;
+    fCommentAttri: TSynHighlighterAttributes;
+    fDirectiveAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    fVariableAttri: TSynHighlighterAttributes;
     function AltFunc(Index: Integer): TtkTokenKind;
     function KeyWordFunc(Index: Integer): TtkTokenKind;
     function FuncBrp46open(Index: Integer): TtkTokenKind;
@@ -122,7 +115,7 @@   TSynBaanSyn = class(TSynCustomHighlighter)
     function IsFilterStored: Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -134,23 +127,23 @@   TSynBaanSyn = class(TSynCustomHighlighter)
     function IsIdentChar(AChar: WideChar): Boolean; override;
     procedure Next; override;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property DirectiveAttri: TSynHighlighterAttributes read FDirectiveAttri
-      write FDirectiveAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
-    property VariableAttri: TSynHighlighterAttributes read FVariableAttri
-      write FVariableAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property DirectiveAttri: TSynHighlighterAttributes read fDirectiveAttri
+      write fDirectiveAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
+    property VariableAttri: TSynHighlighterAttributes read fVariableAttri
+      write fVariableAttri;
   end;
 
 implementation
@@ -159,12 +152,12 @@ implementation
   SynEditStrConst;
 
 const
-  KeyWords: array[0..112] of UnicodeString = (
-    '__based', '__cdecl', '__declspe', '__except', '__export', '__far', 
-    '__fastcal', '__fortran', '__import', '__int16', '__int32', '__int64', 
-    '__int8', '__interrup', '__loadds', '__near', '__pascal', '__rtti', 
-    '__segment', '__segname', '__self', '__stdcall', '__thread', '__try', 
-    '_cdecl', '_export', '_fastcall', '_import', '_pascal', '_stdcall', 'auto', 
+  KeyWords: array[0..112] of string = (
+    '__based', '__cdecl', '__declspe', '__except', '__export', '__far',
+    '__fastcal', '__fortran', '__import', '__int16', '__int32', '__int64',
+    '__int8', '__interrup', '__loadds', '__near', '__pascal', '__rtti',
+    '__segment', '__segname', '__self', '__stdcall', '__thread', '__try',
+    '_cdecl', '_export', '_fastcall', '_import', '_pascal', '_stdcall', 'auto',
     'bool', 'break', 'brp.open', 'case', 'catch', 'cdecl', 'char', 'class', 
     'const', 'continue', 'date.num', 'default', 'defined', 'delete', 'do', 
     'domain', 'double', 'else', 'endif', 'endselect', 'enum', 'explicit', 
@@ -189,7 +182,7 @@ implementation
     -1, 16, -1, -1, -1, -1, 23, 88, -1, -1, 10, -1, -1, -1, -1, 67, -1, -1, -1, 
     72, 81, -1, -1, -1, 82, 24, -1, -1, -1, -1, -1, -1, -1, -1, 79, -1, -1, 64, 
     21, 80, -1, -1, 59, 0, -1, -1, -1, 12, -1, -1, 107, -1, 36, -1, -1, -1, -1, 
-    31, -1, -1, -1, 62, -1, -1, 112, -1, -1, -1, -1, -1, -1, 7, -1, 106, -1, -1, 
+    31, -1, -1, -1, 62, -1, -1, 112, -1, -1, -1, -1, -1, -1, 7, -1, 106, -1, -1,
     -1, -1, -1, -1, -1, -1, 52, 104, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
     -1, -1, -1, -1, 65, -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
     -1, -1, -1, -1, -1, -1, 29, 28, 43, -1, 20, -1, -1, -1, 38, -1, -1, -1, -1, 
@@ -217,7 +210,7 @@ function TSynBaanSyn.HashKey(Str: PWideChar): Cardinal;
     Inc(Str);
   end;
   Result := Result mod 461;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -225,10 +218,10 @@ function TSynBaanSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
@@ -237,16 +230,16 @@ procedure TSynBaanSyn.InitIdent;
 var
   i: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
     if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
+      fIdentFuncTable[i] := AltFunc;
 
-  FIdentFuncTable[21] := FuncBrp46open;
-  FIdentFuncTable[449] := FuncDate46num;
+  fIdentFuncTable[21] := FuncBrp46open;
+  fIdentFuncTable[449] := FuncDate46num;
 
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if @FIdentFuncTable[i] = nil then
-      FIdentFuncTable[i] := KeyWordFunc;
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
+    if @fIdentFuncTable[i] = nil then
+      fIdentFuncTable[i] := KeyWordFunc;
 end;
 
 function TSynBaanSyn.AltFunc(Index: Integer): TtkTokenKind;
@@ -282,31 +275,31 @@ constructor TSynBaanSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
-
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  AddAttribute(FCommentAttri);
-  FDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective);
-  AddAttribute(FDirectiveAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
-  FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
-  AddAttribute(FVariableAttri);
+  fCaseSensitive := False;
+
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  AddAttribute(fCommentAttri);
+  fDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective);
+  AddAttribute(fDirectiveAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style := [fsBold];
+  AddAttribute(fKeyAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
+  fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
+  AddAttribute(fVariableAttri);
   SetAttributesOnChange(DefHighlightChange);
   InitIdent;
-  FDefaultFilter := SYNS_FilterBaan;
+  fDefaultFilter := SYNS_FilterBaan;
 end;
 
 procedure TSynBaanSyn.AndSymbolProc;
@@ -315,28 +308,27 @@ procedure TSynBaanSyn.AndSymbolProc;
     '=':                               {and assign}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
     '&':                               {logical and}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {and}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
 
 procedure TSynBaanSyn.AsciiCharProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
     case FLine[Run] of
-      #0, #10, #13:
-        Break;
+      #0, #10, #13: Break;
     end;
     Inc(Run);
   until FLine[Run] = #39;
@@ -345,44 +337,43 @@ procedure TSynBaanSyn.AsciiCharProc;
 
 procedure TSynBaanSyn.AtSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
 end;
 
 procedure TSynBaanSyn.BraceCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
 end;
 
 procedure TSynBaanSyn.BraceOpenProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
 end;
 
 procedure TSynBaanSyn.CRProc;
 begin
-  FTokenID := tkSpace;
-  case FLine[Run + 1] of
+  fTokenID := tkSpace;
+  Case FLine[Run + 1] of
     #10: Inc(Run, 2);
-  else
-    Inc(Run);
+  else Inc(Run);
   end;
 end;
 
 procedure TSynBaanSyn.ColonProc;
 begin
-  case FLine[Run + 1] of
+  Case FLine[Run + 1] of
     ':':                               {scope resolution operator}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {colon}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
@@ -390,16 +381,15 @@ procedure TSynBaanSyn.ColonProc;
 procedure TSynBaanSyn.CommaProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynBaanSyn.DirectiveProc;
 begin
-  FTokenID := tkDirective;
+  fTokenID := tkDirective;
   repeat
     case FLine[Run] of
-      #0, #10, #13:
-        Break;
+      #0, #10, #13: Break;
     end;
     Inc(Run);
   until FLine[Run] = #0;
@@ -411,12 +401,12 @@ procedure TSynBaanSyn.EqualProc;
     '=':                               {logical equal}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {assign}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
@@ -424,12 +414,11 @@ procedure TSynBaanSyn.EqualProc;
 procedure TSynBaanSyn.ErectProc;
 begin
   Inc(Run, 1);                        {Bann Comments}
-  FTokenID := tkComment;
+  fTokenID := tkComment;
   while FLine[Run] <> #0 do
   begin
     case FLine[Run] of
-      #10, #13:
-        Break;
+      #10, #13: Break;
     end; //case
     Inc(Run);
   end; //while
@@ -437,11 +426,11 @@ procedure TSynBaanSyn.ErectProc;
 
 procedure TSynBaanSyn.GreaterProc;
 begin
-  case FLine[Run + 1] of
+  Case FLine[Run + 1] of
     '=':                               {greater than or equal to}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
     '>':
       begin
@@ -449,26 +438,26 @@ procedure TSynBaanSyn.GreaterProc;
           Inc(Run, 3)
         else                           {shift right}
           Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {greater than}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
 
 procedure TSynBaanSyn.IdentProc;
 begin
-  FTokenID := IdentKind(FLine + Run);
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  fTokenID := IdentKind(fLine + Run);
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
 end;
 
 procedure TSynBaanSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
@@ -478,7 +467,7 @@ procedure TSynBaanSyn.LowerProc;
     '=':                               {less than or equal to}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
     '<':
       begin
@@ -486,12 +475,12 @@ procedure TSynBaanSyn.LowerProc;
           Inc(Run, 3)
         else                           {shift left}
           Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {less than}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
@@ -502,22 +491,22 @@ procedure TSynBaanSyn.MinusProc;
     '=':                               {subtract assign}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
     '-':                               {decrement}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
     '>':                               {arrow}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {subtract}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
@@ -528,12 +517,12 @@ procedure TSynBaanSyn.ModSymbolProc;
     '=':                               {mod assign}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {mod}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
@@ -544,19 +533,19 @@ procedure TSynBaanSyn.NotSymbolProc;
     '=':                               {not equal}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {not}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
 
 procedure TSynBaanSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -564,7 +553,7 @@ procedure TSynBaanSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', '.', 'u', 'U', 'l', 'L', 'x', 'X', 'e', 'E', 'f', 'F':
         Result := True;
       else
@@ -574,13 +563,12 @@ procedure TSynBaanSyn.NumberProc;
 
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar do
   begin
     case FLine[Run] of
       '.':
-        if FLine[Run + 1] = '.' then
-          Break;
+        if FLine[Run + 1] = '.' then Break;
     end;
     Inc(Run);
   end;
@@ -592,17 +580,17 @@ procedure TSynBaanSyn.PlusProc;
     '=':                               {add assign}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
     '+':                               {increment}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {subtract}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
@@ -610,7 +598,7 @@ procedure TSynBaanSyn.PlusProc;
 procedure TSynBaanSyn.RoundCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynBaanSyn.RoundOpenProc;
@@ -622,7 +610,7 @@ procedure TSynBaanSyn.RoundOpenProc;
 procedure TSynBaanSyn.SemiColonProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynBaanSyn.SlashProc;
@@ -631,12 +619,12 @@ procedure TSynBaanSyn.SlashProc;
     '=':                               {division assign}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {division}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
@@ -644,20 +632,20 @@ procedure TSynBaanSyn.SlashProc;
 procedure TSynBaanSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynBaanSyn.SquareCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynBaanSyn.SquareOpenProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynBaanSyn.StarProc;
@@ -666,24 +654,23 @@ procedure TSynBaanSyn.StarProc;
     '=':                               {multiply assign}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {star}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
 
 procedure TSynBaanSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2);
   repeat
     case FLine[Run] of
-      #0, #10, #13:
-        Break;
+      #0, #10, #13: Break;
       #92:
         if FLine[Run + 1] = #10 then Inc(Run);
     end;
@@ -695,21 +682,21 @@ procedure TSynBaanSyn.StringProc;
 procedure TSynBaanSyn.TildeProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
 end;
 
 procedure TSynBaanSyn.XOrSymbolProc;
 begin
-  case FLine[Run + 1] of
+  Case FLine[Run + 1] of
     '=':                               {xor assign}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {xor}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
@@ -717,13 +704,13 @@ procedure TSynBaanSyn.XOrSymbolProc;
 procedure TSynBaanSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynBaanSyn.Next;
 begin
-  FTokenPos := Run;
-  case FLine[Run] of
+  fTokenPos := Run;
+  case fLine[Run] of
     '&': AndSymbolProc;
     #39: AsciiCharProc;
     '@': AtSymbolProc;
@@ -764,12 +751,12 @@ procedure TSynBaanSyn.Next;
 function TSynBaanSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -777,39 +764,39 @@ function TSynBaanSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribu
 
 function TSynBaanSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynBaanSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynBaanSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
   case GetTokenID of
-    tkComment: Result := FCommentAttri;
-    tkDirective: Result := FDirectiveAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkVariable: Result := FVariableAttri;
-    tkUnknown: Result := FIdentifierAttri;
+    tkComment: Result := fCommentAttri;
+    tkDirective: Result := fDirectiveAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkVariable: Result := fVariableAttri;
+    tkUnknown: Result := fIdentifierAttri;
     else Result := nil;
   end;
 end;
 
 function TSynBaanSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
 function TSynBaanSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterBaan;
+  Result := fDefaultFilter <> SYNS_FilterBaan;
 end;
 
 function TSynBaanSyn.IsIdentChar(AChar: WideChar): Boolean;
@@ -827,13 +814,11 @@ class function TSynBaanSyn.GetLanguageName: string;
   Result := SYNS_LangBaan;
 end;
 
-class function TSynBaanSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynBaanSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangBaan;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynBaanSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterBat.pas b/Ext/SynEdit/Source/SynHighlighterBat.pas
index a217a13..5aaa25e 100644
--- a/Ext/SynEdit/Source/SynHighlighterBat.pas
+++ b/Ext/SynEdit/Source/SynHighlighterBat.pas
@@ -27,13 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterBat.pas,v 1.14.2.6 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a MS-DOS Batch file highlighter for SynEdit)
@@ -68,14 +61,14 @@ interface
 type
   TSynBatSyn = class(TSynCustomHighlighter)
   private
-    FIdentFuncTable: array[0..24] of TIdentFuncTableFunc;
+    fIdentFuncTable: array[0..24] of TIdentFuncTableFunc;
     FTokenID: TtkTokenKind;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FVariableAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fVariableAttri: TSynHighlighterAttributes;
     function AltFunc(Index: Integer): TtkTokenKind;
     function FuncCall(Index: Integer): TtkTokenKind;
     function FuncCd(Index: Integer): TtkTokenKind;
@@ -112,11 +105,11 @@   TSynBatSyn = class(TSynCustomHighlighter)
     procedure SpaceProc;
     procedure UnknownProc;
   protected
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     function IsFilterStored: Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;        
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -127,17 +120,17 @@   TSynBatSyn = class(TSynCustomHighlighter)
     function GetTokenKind: Integer; override;
     procedure Next; override;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property VariableAttri: TSynHighlighterAttributes read FVariableAttri
-      write FVariableAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property VariableAttri: TSynHighlighterAttributes read fVariableAttri
+      write fVariableAttri;
   end;
 
 implementation
@@ -146,7 +139,7 @@ implementation
   SynEditStrConst;
 
 const
-  KeyWords: array[0..20] of UnicodeString = (
+  KeyWords: array[0..20] of string = (
     'call', 'cd', 'cls', 'copy', 'del', 'do', 'echo', 'errorlevel', 'exist', 
     'for', 'goto', 'if', 'in', 'not', 'off', 'on', 'pause', 'set', 'shift', 
     'start', 'title' 
@@ -167,7 +160,7 @@ function TSynBatSyn.HashKey(Str: PWideChar): Cardinal;
     Inc(Str);
   end;
   Result := Result mod 25;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -175,10 +168,10 @@ function TSynBatSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
@@ -187,31 +180,31 @@ procedure TSynBatSyn.InitIdent;
 var
   i: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
     if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
+      fIdentFuncTable[i] := AltFunc;
       
-  FIdentFuncTable[15] := FuncCall;
-  FIdentFuncTable[16] := FuncCd;
-  FIdentFuncTable[20] := FuncCls;
-  FIdentFuncTable[13] := FuncCopy;
-  FIdentFuncTable[1] := FuncDel;
-  FIdentFuncTable[21] := FuncDo;
-  FIdentFuncTable[3] := FuncEcho;
-  FIdentFuncTable[19] := FuncErrorlevel;
-  FIdentFuncTable[6] := FuncExist;
-  FIdentFuncTable[24] := FuncFor;
-  FIdentFuncTable[12] := FuncGoto;
-  FIdentFuncTable[17] := FuncIf;
-  FIdentFuncTable[5] := FuncIn;
-  FIdentFuncTable[14] := FuncNot;
-  FIdentFuncTable[0] := FuncOff;
-  FIdentFuncTable[9] := FuncOn;
-  FIdentFuncTable[23] := FuncPause;
-  FIdentFuncTable[4] := FuncSet;
-  FIdentFuncTable[7] := FuncShift;
-  FIdentFuncTable[8] := FuncStart;
-  FIdentFuncTable[18] := FuncTitle;
+  fIdentFuncTable[15] := FuncCall;
+  fIdentFuncTable[16] := FuncCd;
+  fIdentFuncTable[20] := FuncCls;
+  fIdentFuncTable[13] := FuncCopy;
+  fIdentFuncTable[1] := FuncDel;
+  fIdentFuncTable[21] := FuncDo;
+  fIdentFuncTable[3] := FuncEcho;
+  fIdentFuncTable[19] := FuncErrorlevel;
+  fIdentFuncTable[6] := FuncExist;
+  fIdentFuncTable[24] := FuncFor;
+  fIdentFuncTable[12] := FuncGoto;
+  fIdentFuncTable[17] := FuncIf;
+  fIdentFuncTable[5] := FuncIn;
+  fIdentFuncTable[14] := FuncNot;
+  fIdentFuncTable[0] := FuncOff;
+  fIdentFuncTable[9] := FuncOn;
+  fIdentFuncTable[23] := FuncPause;
+  fIdentFuncTable[4] := FuncSet;
+  fIdentFuncTable[7] := FuncShift;
+  fIdentFuncTable[8] := FuncStart;
+  fIdentFuncTable[18] := FuncTitle;
 end;
 
 function TSynBatSyn.AltFunc(Index: Integer): TtkTokenKind;
@@ -391,35 +384,35 @@ constructor TSynBatSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
-
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  FCommentAttri.Foreground := clNavy;
-  AddAttribute(FCommentAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey);
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  FNumberAttri.Foreground := clBlue;
-  AddAttribute(FNumberAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
-  FVariableAttri.Foreground := clGreen;
-  AddAttribute(FVariableAttri);
+  fCaseSensitive := False;
+
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  fCommentAttri.Foreground := clNavy;
+  AddAttribute(fCommentAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey);
+  fKeyAttri.Style := [fsBold];
+  AddAttribute(fKeyAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  fNumberAttri.Foreground := clBlue;
+  AddAttribute(fNumberAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
+  fVariableAttri.Foreground := clGreen;
+  AddAttribute(fVariableAttri);
   SetAttributesOnChange(DefHighlightChange);
   InitIdent;
-  FDefaultFilter := SYNS_FilterBatch;
+  fDefaultFilter := SYNS_FilterBatch;
 end;
 
 procedure TSynBatSyn.VariableProc;
 
   function IsVarChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '_', '0'..'9', 'A'..'Z', 'a'..'z':
         Result := True;
       else
@@ -428,27 +421,27 @@ procedure TSynBatSyn.VariableProc;
   end;
 
 begin
-  FTokenID := tkVariable;
+  fTokenID := tkVariable;
   repeat
     Inc(Run);
   until not IsVarChar;
-  if FLine[Run] = '%' then
+  if fLine[Run] = '%' then
     Inc(Run);
 end;
 
 procedure TSynBatSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if (FLine[Run] = #10) then Inc(Run);
+  if (fLine[Run] = #10) then Inc(Run);
 end;
 
 procedure TSynBatSyn.CommentProc;
 begin
-  FTokenID := tkIdentifier;
+  fTokenID := tkIdentifier;
   Inc(Run);
-  if FLine[Run] = ':' then begin
-    FTokenID := tkComment;
+  if fLine[Run] = ':' then begin
+    fTokenID := tkComment;
     repeat
       Inc(Run);
     until IsLineEnd(Run);
@@ -457,29 +450,29 @@ procedure TSynBatSyn.CommentProc;
 
 procedure TSynBatSyn.IdentProc;
 begin
-  FTokenID := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  fTokenID := IdentKind((fLine + Run));
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
 end;
 
 procedure TSynBatSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynBatSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
 procedure TSynBatSyn.NumberProc;
 begin
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   repeat
     Inc(Run);
-  until not CharInSet(FLine[Run], ['0'..'9', '.']);
+  until not CharInSet(fLine[Run], ['0'..'9', '.']);
 end;
 
 procedure TSynBatSyn.REMCommentProc;
@@ -488,42 +481,41 @@ procedure TSynBatSyn.REMCommentProc;
     CharInSet(FLine[Run + 2], ['M', 'm']) and
     (FLine[Run + 3] < #33) then
   begin
-    FTokenID := tkComment;
+    fTokenID := tkComment;
     Inc(Run, 3);
     while (FLine[Run] <> #0) do begin
       case FLine[Run] of
-        #10, #13:
-          Break;
+        #10, #13: Break;
       end; { case }
       Inc(Run);
     end; { while }
   end
   else
   begin
-    FTokenID := tkIdentifier;
+    fTokenID := tkIdentifier;
     IdentProc;
   end;
 end;
 
 procedure TSynBatSyn.SpaceProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   repeat
     Inc(Run);
-  until (FLine[Run] > #32) or IsLineEnd(Run);
+  until (fLine[Run] > #32) or IsLineEnd(Run);
 end;
 
 procedure TSynBatSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynBatSyn.Next;
 begin
-  FTokenPos := Run;
+  fTokenPos := Run;
 
-  case FLine[Run] of
+  case fLine[Run] of
     '%': VariableProc;
     #13: CRProc;
     ':': CommentProc;
@@ -542,10 +534,10 @@ procedure TSynBatSyn.Next;
 function TSynBatSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
   else
     Result := nil;
   end;
@@ -553,36 +545,36 @@ function TSynBatSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribut
 
 function TSynBatSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynBatSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  case FTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkUnknown: Result := FIdentifierAttri;
-    tkVariable: Result := FVariableAttri;
+  case fTokenID of
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkUnknown: Result := fIdentifierAttri;
+    tkVariable: Result := fVariableAttri;
     else Result := nil;
   end;
 end;
 
 function TSynBatSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynBatSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
 function TSynBatSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterBatch;
+  Result := fDefaultFilter <> SYNS_FilterBatch;
 end;
 
 class function TSynBatSyn.GetLanguageName: string;
@@ -590,7 +582,7 @@ class function TSynBatSyn.GetLanguageName: string;
   Result := SYNS_LangBatch;
 end;
 
-function TSynBatSyn.GetSampleSource: UnicodeString;
+function TSynBatSyn.GetSampleSource: string;
 begin
   Result := 'rem MS-DOS batch file'#13#10 +
             'rem'#13#10 +
@@ -604,13 +596,11 @@ function TSynBatSyn.GetSampleSource: UnicodeString;
             'if errorlevel 1 echo Error in copy action!';
 end;
 
-class function TSynBatSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynBatSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangBatch;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynBatSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterCAC.pas b/Ext/SynEdit/Source/SynHighlighterCAC.pas
index 8be6f4f..b9cb93f 100644
--- a/Ext/SynEdit/Source/SynHighlighterCAC.pas
+++ b/Ext/SynEdit/Source/SynHighlighterCAC.pas
@@ -27,13 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterCAC.pas,v 1.10.2.8 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a CA-Clipper syntax highlighter for SynEdit)
@@ -69,17 +62,17 @@ interface
 
   TSynCACSyn = class(TSynCustomHighlighter)
   private
-    FRange: TRangeState;
+    fRange: TRangeState;
     FTokenID: TtkTokenKind;
-    FStringAttri: TSynHighlighterAttributes;
-    FOperatorAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FCommentAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FDirecAttri: TSynHighlighterAttributes;
-    FIdentFuncTable: array[0..708] of TIdentFuncTableFunc;
+    fStringAttri: TSynHighlighterAttributes;
+    fOperatorAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fDirecAttri: TSynHighlighterAttributes;
+    fIdentFuncTable: array[0..708] of TIdentFuncTableFunc;
     function AltFunc(Index: Integer): TtkTokenKind;
     function KeyWordFunc(Index: Integer): TtkTokenKind;
     function HashKey(Str: PWideChar): Cardinal;
@@ -102,7 +95,7 @@   TSynCACSyn = class(TSynCustomHighlighter)
     function IsFilterStored: Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -116,21 +109,21 @@   TSynCACSyn = class(TSynCustomHighlighter)
     procedure SetRange(Value: Pointer); override;
     procedure ResetRange; override;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property OperatorAttri: TSynHighlighterAttributes read FOperatorAttri
-      write FOperatorAttri;
-    property DirecAttri: TSynHighlighterAttributes read FDirecAttri
-      write FDirecAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property OperatorAttri: TSynHighlighterAttributes read fOperatorAttri
+      write fOperatorAttri;
+    property DirecAttri: TSynHighlighterAttributes read fDirecAttri
+      write fDirecAttri;
   end;
 
 implementation
@@ -139,7 +132,7 @@ implementation
   SynEditStrConst;
 
 const
-  KeyWords: array[0..142] of UnicodeString = (
+  KeyWords: array[0..142] of string = (
     'aadd', 'abs', 'and', 'announce', 'asc', 'at', 'average', 'begin', 'bof', 
     'break', 'call', 'cancel', 'cdow', 'chr', 'clear', 'close', 'cmonth', 'col', 
     'commit', 'continue', 'copy', 'count', 'create', 'ctod', 'date', 'day', 
@@ -211,7 +204,7 @@ function TSynCACSyn.HashKey(Str: PWideChar): Cardinal;
     Inc(Str);
   end;
   Result := Result mod 709;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -219,10 +212,10 @@ function TSynCACSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
@@ -231,13 +224,13 @@ procedure TSynCACSyn.InitIdent;
 var
   i: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
     if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
+      fIdentFuncTable[i] := AltFunc;
 
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if @FIdentFuncTable[i] = nil then
-      FIdentFuncTable[i] := KeyWordFunc;
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
+    if @fIdentFuncTable[i] = nil then
+      fIdentFuncTable[i] := KeyWordFunc;  
 end;
 
 function TSynCACSyn.AltFunc(Index: Integer): TtkTokenKind;
@@ -257,35 +250,35 @@ constructor TSynCACSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
-
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  AddAttribute(FCommentAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-  FOperatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrOperator, SYNS_FriendlyAttrOperator);
-  AddAttribute(FOperatorAttri);
-  FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
-  AddAttribute(FDirecAttri);
+  fCaseSensitive := False;
+
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  AddAttribute(fCommentAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style := [fsBold];
+  AddAttribute(fKeyAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
+  fOperatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrOperator, SYNS_FriendlyAttrOperator);
+  AddAttribute(fOperatorAttri);
+  fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
+  AddAttribute(fDirecAttri);
   InitIdent;
   SetAttributesOnChange(DefHighlightChange);
-  FRange := rsUnknown;
-  FDefaultFilter := SYNS_FilterCAClipper;
+  fRange := rsUnknown;
+  fDefaultFilter := SYNS_FilterCAClipper;
 end;
 
 procedure TSynCACSyn.CStyleProc;
 begin
-  FTokenID := tkComment;
+  fTokenID := tkComment;
   case FLine[Run] of
     #0:
       begin
@@ -305,12 +298,12 @@ procedure TSynCACSyn.CStyleProc;
       end;
   end;
 
-  while FLine[Run] <> #0 do
-    case FLine[Run] of
+  while fLine[Run] <> #0 do
+    case fLine[Run] of
       '*':
-        if FLine[Run + 1] = '/' then
+        if fLine[Run + 1] = '/' then
         begin
-          FRange := rsUnknown;
+          fRange := rsUnknown;
           Inc(Run, 2);
           Break;
         end else Inc(Run);
@@ -322,7 +315,7 @@ procedure TSynCACSyn.CStyleProc;
 
 procedure TSynCACSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   case FLine[Run + 1] of
     #10: Inc(Run, 2);
   else Inc(Run);
@@ -331,20 +324,20 @@ procedure TSynCACSyn.CRProc;
 
 procedure TSynCACSyn.IdentProc;
 begin
-  FTokenID := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  fTokenID := IdentKind((fLine + Run));
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
 end;
 
 procedure TSynCACSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynCACSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -352,7 +345,7 @@ procedure TSynCACSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', '.', 'e', 'E':
         Result := True;
       else
@@ -362,7 +355,7 @@ procedure TSynCACSyn.NumberProc;
 
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar do
   begin
     case FLine[Run] of
@@ -379,7 +372,7 @@ procedure TSynCACSyn.SlashProc;
     '/':
       begin
         Inc(Run, 2);
-        FTokenID := tkComment;
+        fTokenID := tkComment;
         while FLine[Run] <> #0 do
         begin
           case FLine[Run] of
@@ -390,15 +383,15 @@ procedure TSynCACSyn.SlashProc;
       end;
     '*':
       begin
-        FTokenID := tkComment;
-        FRange := rsCStyle;
+        fTokenID := tkComment;
+        fRange := rsCStyle;
         Inc(Run, 2);
-        while FLine[Run] <> #0 do
-          case FLine[Run] of
+        while fLine[Run] <> #0 do
+          case fLine[Run] of
             '*':
-              if FLine[Run + 1] = '/' then
+              if fLine[Run + 1] = '/' then
               begin
-                FRange := rsUnknown;
+                fRange := rsUnknown;
                 Inc(Run, 2);
                 Break;
               end else Inc(Run);
@@ -410,7 +403,7 @@ procedure TSynCACSyn.SlashProc;
   else
     begin
       Inc(Run);
-      FTokenID := tkOperator;
+      fTokenID := tkOperator;
     end;
   end;
 end;
@@ -418,21 +411,21 @@ procedure TSynCACSyn.SlashProc;
 procedure TSynCACSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynCACSyn.SymbolProc;
 begin
   Inc(Run);
-  FTokenID := tkOperator;
+  fTokenID := tkOperator;
 end;
 
 procedure TSynCACSyn.StringProc;
 var
   ActiveStr: WideChar;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   ActiveStr := FLine[Run];
   if ((FLine[Run + 1] = #39) and (FLine[Run + 2] = #39)) or
     ((FLine[Run + 1] = #34) and (FLine[Run + 2] = #34)) then Inc(Run, 2);
@@ -447,7 +440,7 @@ procedure TSynCACSyn.StringProc;
 
 procedure TSynCACSyn.DirectiveProc;
 begin
-  FTokenID := tkDirective;
+  fTokenID := tkDirective;
   repeat
     case FLine[Run] of
       #0, #10, #13: Break;
@@ -461,16 +454,16 @@ procedure TSynCACSyn.DirectiveProc;
 procedure TSynCACSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynCACSyn.Next;
 begin
-  FTokenPos := Run;
-  case FRange of
+  fTokenPos := Run;
+  case fRange of
     rsCStyle: CStyleProc;
     else
-      case FLine[Run] of
+      case fLine[Run] of
         '@': SymbolProc;
         '&': SymbolProc;
         '{': SymbolProc;
@@ -510,11 +503,11 @@ procedure TSynCACSyn.Next;
 function TSynCACSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
   else
     Result := nil;
   end;
@@ -522,53 +515,53 @@ function TSynCACSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribut
 
 function TSynCACSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynCACSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 function TSynCACSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynCACSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  case FTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkDirective: Result := FDirecAttri;
-    tkOperator: Result := FOperatorAttri;
-    tkUnknown: Result := FOperatorAttri;
+  case fTokenID of
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkDirective: Result := fDirecAttri;
+    tkOperator: Result := fOperatorAttri;
+    tkUnknown: Result := fOperatorAttri;
     else Result := nil;
   end;
 end;
 
 function TSynCACSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
 procedure TSynCACSyn.ResetRange;
 begin
-  FRange := rsUnknown;
+  fRange := rsUnknown;
 end;
 
 procedure TSynCACSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 function TSynCACSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterCAClipper;
+  Result := fDefaultFilter <> SYNS_FilterCAClipper;
 end;
 
 class function TSynCACSyn.GetLanguageName: string;
@@ -581,7 +574,7 @@ procedure TSynCACSyn.StarProc;
 // if Run is 0 there could be an access violation
   if (Run = 0) or IsLineEnd(Run - 1) then
   begin
-    FTokenID := tkComment;
+    fTokenID := tkComment;
     repeat
       Inc(Run);
     until IsLineEnd(Run);
@@ -589,17 +582,15 @@ procedure TSynCACSyn.StarProc;
   else
   begin
     Inc(Run);
-    FTokenID := tkOperator;
+    fTokenID := tkOperator;
   end;
 end;
 
-class function TSynCACSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynCACSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangCAClipper;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynCACSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterCPM.pas b/Ext/SynEdit/Source/SynHighlighterCPM.pas
index e1bc612..ec31808 100644
--- a/Ext/SynEdit/Source/SynHighlighterCPM.pas
+++ b/Ext/SynEdit/Source/SynHighlighterCPM.pas
@@ -25,12 +25,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterCPM.pas,v 1.16.2.6 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
 -------------------------------------------------------------------------------}
 
 unit SynHighlighterCPM;
@@ -66,26 +60,26 @@ interface
   PIdentFuncTableFunc = ^TIdentFuncTableFunc;
   TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
 
-  TRangeState = (rsBraceComment, rsUnknown);
+  TRangeState = (rsBraceComment, rsUnKnown);
 
 type
   TSynCPMSyn = class(TSynCustomHighlighter)
   private
-    FRange: TRangeState;
-    FCommentLevel: Integer;
-    FTokenID: TtkTokenKind;
-    FIdentFuncTable: array[0..796] of TIdentFuncTableFunc;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FSQLKeyAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FSpecialVarAttri: TSynHighlighterAttributes;
-    FSystemAttri: TSynHighlighterAttributes;
-    FVariableAttri: TSynHighlighterAttributes;
+    fRange: TRangeState;
+    fCommentLevel: Integer;
+    fTokenID: TtkTokenKind;
+    fIdentFuncTable: array[0..796] of TIdentFuncTableFunc;
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fSQLKeyAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    fSpecialVarAttri: TSynHighlighterAttributes;
+    fSystemAttri: TSynHighlighterAttributes;
+    fVariableAttri: TSynHighlighterAttributes;
     function AltFunc(Index: Integer): TtkTokenKind;
     function FuncAllentities(Index: Integer): TtkTokenKind;
     function FuncAllproducts(Index: Integer): TtkTokenKind;
@@ -250,11 +244,11 @@   TSynCPMSyn = class(TSynCustomHighlighter)
     procedure UnknownProc;
     procedure BraceCommentProc;
   protected
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     function IsFilterStored: Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -268,17 +262,17 @@   TSynCPMSyn = class(TSynCustomHighlighter)
     procedure ResetRange; override;
     procedure SetRange(Value: Pointer); override;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri;
-    property SQLKeyAttri: TSynHighlighterAttributes read FSQLKeyAttri write FSQLKeyAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri;
-    property SpecialVarAttri: TSynHighlighterAttributes read FSpecialVarAttri write FSpecialVarAttri;
-    property SystemAttri: TSynHighlighterAttributes read FSystemAttri write FSystemAttri;
-    property VariableAttri: TSynHighlighterAttributes read FVariableAttri write FVariableAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri;
+    property SQLKeyAttri: TSynHighlighterAttributes read fSQLKeyAttri write fSQLKeyAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri;
+    property SpecialVarAttri: TSynHighlighterAttributes read fSpecialVarAttri write fSpecialVarAttri;
+    property SystemAttri: TSynHighlighterAttributes read fSystemAttri write fSystemAttri;
+    property VariableAttri: TSynHighlighterAttributes read fVariableAttri write fVariableAttri;
   end;
 
 implementation
@@ -287,7 +281,7 @@ implementation
   SynEditStrConst;
 
 const
-  KeyWords: array[0..145] of UnicodeString = (
+  KeyWords: array[0..145] of string = (
     'allentities', 'allproducts', 'allproperties', 'allqualityproperties', 
     'allsuppliers', 'assign', 'begin', 'block', 'case', 'category', 'centerstr', 
     'charreplacestr', 'charrlenstr', 'charrllenstr', 'chr', 'client', 
@@ -372,7 +366,7 @@ function TSynCPMSyn.HashKey(Str: PWideChar): Cardinal;
     Inc(Str);
   end;
   Result := Result mod 797;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -380,10 +374,10 @@ function TSynCPMSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
@@ -392,156 +386,156 @@ procedure TSynCPMSyn.InitIdent;
 var
   i: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
     if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
-
-  FIdentFuncTable[314] := FuncAllentities;
-  FIdentFuncTable[528] := FuncAllproducts;
-  FIdentFuncTable[212] := FuncAllproperties;
-  FIdentFuncTable[774] := FuncAllqualityproperties;
-  FIdentFuncTable[46] := FuncAllsuppliers;
-  FIdentFuncTable[127] := FuncAssign;
-  FIdentFuncTable[462] := FuncBegin;
-  FIdentFuncTable[297] := FuncBlock;
-  FIdentFuncTable[169] := FuncCase;
-  FIdentFuncTable[728] := FuncCategory;
-  FIdentFuncTable[106] := FuncCenterstr;
-  FIdentFuncTable[663] := FuncCharreplacestr;
-  FIdentFuncTable[607] := FuncCharrlenstr;
-  FIdentFuncTable[326] := FuncCharrllenstr;
-  FIdentFuncTable[753] := FuncChr;
-  FIdentFuncTable[251] := FuncClient;
-  FIdentFuncTable[793] := FuncConstants;
-  FIdentFuncTable[694] := FuncContinue;
-  FIdentFuncTable[674] := FuncCopyfile;
-  FIdentFuncTable[732] := FuncCountry;
-  FIdentFuncTable[481] := FuncDecr;
-  FIdentFuncTable[726] := FuncDefinition;
-  FIdentFuncTable[469] := FuncDistinct_execute;
-  FIdentFuncTable[120] := FuncDivide;
-  FIdentFuncTable[217] := FuncElse;
-  FIdentFuncTable[26] := FuncEmptysheet;
-  FIdentFuncTable[10] := FuncEnd;
-  FIdentFuncTable[197] := FuncEntitycode;
-  FIdentFuncTable[215] := FuncEqualstring;
-  FIdentFuncTable[446] := FuncEqualvalue;
-  FIdentFuncTable[48] := FuncExecute;
-  FIdentFuncTable[499] := FuncFileappend;
-  FIdentFuncTable[69] := FuncFileassign;
-  FIdentFuncTable[521] := FuncFileclose;
-  FIdentFuncTable[329] := FuncFilecopy;
-  FIdentFuncTable[124] := FuncFiledate;
-  FIdentFuncTable[142] := FuncFiledelete;
-  FIdentFuncTable[273] := FuncFileend;
-  FIdentFuncTable[67] := FuncFileexists;
-  FIdentFuncTable[454] := FuncFilereadln;
-  FIdentFuncTable[600] := FuncFilereset;
-  FIdentFuncTable[139] := FuncFilerewrite;
-  FIdentFuncTable[296] := FuncFilesize;
-  FIdentFuncTable[47] := FuncFilesort;
-  FIdentFuncTable[266] := FuncFiletime;
-  FIdentFuncTable[8] := FuncFilewriteln;
-  FIdentFuncTable[561] := FuncFilterstr;
-  FIdentFuncTable[505] := FuncFirstinstance;
-  FIdentFuncTable[356] := FuncFlow;
-  FIdentFuncTable[538] := FuncFold;
-  FIdentFuncTable[736] := FuncForeign;
-  FIdentFuncTable[33] := FuncGlobalconstants;
-  FIdentFuncTable[750] := FuncGlobals;
-  FIdentFuncTable[196] := FuncGlobalvariables;
-  FIdentFuncTable[50] := FuncGroupdown;
-  FIdentFuncTable[743] := FuncGroupfooter;
-  FIdentFuncTable[66] := FuncGroupheader;
-  FIdentFuncTable[478] := FuncGroupkey;
-  FIdentFuncTable[31] := FuncGroupup;
-  FIdentFuncTable[657] := FuncIf;
-  FIdentFuncTable[427] := FuncInclude;
-  FIdentFuncTable[456] := FuncIncr;
-  FIdentFuncTable[430] := FuncLanguage;
-  FIdentFuncTable[354] := FuncLastinstance;
-  FIdentFuncTable[525] := FuncLeftstr;
-  FIdentFuncTable[78] := FuncLength;
-  FIdentFuncTable[379] := FuncLlenstr;
-  FIdentFuncTable[177] := FuncLocal;
-  FIdentFuncTable[583] := FuncLocasestr;
-  FIdentFuncTable[285] := FuncLoop;
-  FIdentFuncTable[604] := FuncLowerlevelstoo;
-  FIdentFuncTable[403] := FuncLtrunc;
-  FIdentFuncTable[603] := FuncMatching;
-  FIdentFuncTable[328] := FuncMember;
-  FIdentFuncTable[16] := FuncMerge;
-  FIdentFuncTable[138] := FuncMessagedlg;
-  FIdentFuncTable[777] := FuncMetaflow;
-  FIdentFuncTable[271] := FuncMidstr;
-  FIdentFuncTable[675] := FuncMultiply;
-  FIdentFuncTable[544] := FuncNextinstance;
-  FIdentFuncTable[418] := FuncNextrepeatinstance;
-  FIdentFuncTable[476] := FuncOf;
-  FIdentFuncTable[440] := FuncOptions;
-  FIdentFuncTable[174] := FuncOrganisation;
-  FIdentFuncTable[390] := FuncOutput;
-  FIdentFuncTable[27] := FuncParam;
-  FIdentFuncTable[158] := FuncParent;
-  FIdentFuncTable[537] := FuncParseinc;
-  FIdentFuncTable[605] := FuncPdriver;
-  FIdentFuncTable[93] := FuncPrevinstance;
-  FIdentFuncTable[760] := FuncPrevrepeatinstance;
-  FIdentFuncTable[425] := FuncPrinter;
-  FIdentFuncTable[654] := FuncPrintfile;
-  FIdentFuncTable[414] := FuncPropertygroup;
-  FIdentFuncTable[497] := FuncRastr;
-  FIdentFuncTable[395] := FuncRaval;
-  FIdentFuncTable[80] := FuncReadinstance;
-  FIdentFuncTable[581] := FuncReadrepeatinstance;
-  FIdentFuncTable[721] := FuncRepeat;
-  FIdentFuncTable[160] := FuncRepeatcount;
-  FIdentFuncTable[249] := FuncReportlevel;
-  FIdentFuncTable[221] := FuncRightstr;
-  FIdentFuncTable[204] := FuncRlenstr;
-  FIdentFuncTable[768] := FuncRoot;
-  FIdentFuncTable[666] := FuncRound;
-  FIdentFuncTable[152] := FuncShowmessage;
-  FIdentFuncTable[579] := FuncSkipemtpty;
-  FIdentFuncTable[307] := FuncSortdown;
-  FIdentFuncTable[508] := FuncSortkey;
-  FIdentFuncTable[299] := FuncSortup;
-  FIdentFuncTable[415] := FuncSql_add;
-  FIdentFuncTable[247] := FuncSql_asfloat;
-  FIdentFuncTable[718] := FuncSql_asstring;
-  FIdentFuncTable[311] := FuncSql_create;
-  FIdentFuncTable[635] := FuncSql_dump;
-  FIdentFuncTable[756] := FuncSql_eof;
-  FIdentFuncTable[723] := FuncSql_execute;
-  FIdentFuncTable[269] := FuncSql_free;
-  FIdentFuncTable[530] := FuncSql_mladd;
-  FIdentFuncTable[551] := FuncSql_mlmultiadd;
-  FIdentFuncTable[724] := FuncSql_next;
-  FIdentFuncTable[482] := FuncSql_setvar;
-  FIdentFuncTable[449] := FuncSqr;
-  FIdentFuncTable[348] := FuncStripstr;
-  FIdentFuncTable[615] := FuncStroptions;
-  FIdentFuncTable[566] := FuncStrpos;
-  FIdentFuncTable[740] := FuncSubtract;
-  FIdentFuncTable[51] := FuncSum;
-  FIdentFuncTable[764] := FuncSupplier;
-  FIdentFuncTable[696] := FuncSuppliesofmembers;
-  FIdentFuncTable[470] := FuncThen;
-  FIdentFuncTable[162] := FuncTrunc;
-  FIdentFuncTable[344] := FuncUpcasestr;
-  FIdentFuncTable[77] := FuncUsedby;
-  FIdentFuncTable[224] := FuncV_date;
-  FIdentFuncTable[267] := FuncV_false;
-  FIdentFuncTable[55] := FuncV_nonereal;
-  FIdentFuncTable[421] := FuncV_par_language;
-  FIdentFuncTable[404] := FuncV_par_language_count;
-  FIdentFuncTable[751] := FuncV_par_language_fields;
-  FIdentFuncTable[366] := FuncV_time;
-  FIdentFuncTable[218] := FuncV_true;
-  FIdentFuncTable[159] := FuncVariables;
-  FIdentFuncTable[149] := FuncVaroptions;
-  FIdentFuncTable[84] := FuncWhile;
-  FIdentFuncTable[745] := FuncZerorlenstr;
+      fIdentFuncTable[i] := AltFunc;
+
+  fIdentFuncTable[314] := FuncAllentities;
+  fIdentFuncTable[528] := FuncAllproducts;
+  fIdentFuncTable[212] := FuncAllproperties;
+  fIdentFuncTable[774] := FuncAllqualityproperties;
+  fIdentFuncTable[46] := FuncAllsuppliers;
+  fIdentFuncTable[127] := FuncAssign;
+  fIdentFuncTable[462] := FuncBegin;
+  fIdentFuncTable[297] := FuncBlock;
+  fIdentFuncTable[169] := FuncCase;
+  fIdentFuncTable[728] := FuncCategory;
+  fIdentFuncTable[106] := FuncCenterstr;
+  fIdentFuncTable[663] := FuncCharreplacestr;
+  fIdentFuncTable[607] := FuncCharrlenstr;
+  fIdentFuncTable[326] := FuncCharrllenstr;
+  fIdentFuncTable[753] := FuncChr;
+  fIdentFuncTable[251] := FuncClient;
+  fIdentFuncTable[793] := FuncConstants;
+  fIdentFuncTable[694] := FuncContinue;
+  fIdentFuncTable[674] := FuncCopyfile;
+  fIdentFuncTable[732] := FuncCountry;
+  fIdentFuncTable[481] := FuncDecr;
+  fIdentFuncTable[726] := FuncDefinition;
+  fIdentFuncTable[469] := FuncDistinct_execute;
+  fIdentFuncTable[120] := FuncDivide;
+  fIdentFuncTable[217] := FuncElse;
+  fIdentFuncTable[26] := FuncEmptysheet;
+  fIdentFuncTable[10] := FuncEnd;
+  fIdentFuncTable[197] := FuncEntitycode;
+  fIdentFuncTable[215] := FuncEqualstring;
+  fIdentFuncTable[446] := FuncEqualvalue;
+  fIdentFuncTable[48] := FuncExecute;
+  fIdentFuncTable[499] := FuncFileappend;
+  fIdentFuncTable[69] := FuncFileassign;
+  fIdentFuncTable[521] := FuncFileclose;
+  fIdentFuncTable[329] := FuncFilecopy;
+  fIdentFuncTable[124] := FuncFiledate;
+  fIdentFuncTable[142] := FuncFiledelete;
+  fIdentFuncTable[273] := FuncFileend;
+  fIdentFuncTable[67] := FuncFileexists;
+  fIdentFuncTable[454] := FuncFilereadln;
+  fIdentFuncTable[600] := FuncFilereset;
+  fIdentFuncTable[139] := FuncFilerewrite;
+  fIdentFuncTable[296] := FuncFilesize;
+  fIdentFuncTable[47] := FuncFilesort;
+  fIdentFuncTable[266] := FuncFiletime;
+  fIdentFuncTable[8] := FuncFilewriteln;
+  fIdentFuncTable[561] := FuncFilterstr;
+  fIdentFuncTable[505] := FuncFirstinstance;
+  fIdentFuncTable[356] := FuncFlow;
+  fIdentFuncTable[538] := FuncFold;
+  fIdentFuncTable[736] := FuncForeign;
+  fIdentFuncTable[33] := FuncGlobalconstants;
+  fIdentFuncTable[750] := FuncGlobals;
+  fIdentFuncTable[196] := FuncGlobalvariables;
+  fIdentFuncTable[50] := FuncGroupdown;
+  fIdentFuncTable[743] := FuncGroupfooter;
+  fIdentFuncTable[66] := FuncGroupheader;
+  fIdentFuncTable[478] := FuncGroupkey;
+  fIdentFuncTable[31] := FuncGroupup;
+  fIdentFuncTable[657] := FuncIf;
+  fIdentFuncTable[427] := FuncInclude;
+  fIdentFuncTable[456] := FuncIncr;
+  fIdentFuncTable[430] := FuncLanguage;
+  fIdentFuncTable[354] := FuncLastinstance;
+  fIdentFuncTable[525] := FuncLeftstr;
+  fIdentFuncTable[78] := FuncLength;
+  fIdentFuncTable[379] := FuncLlenstr;
+  fIdentFuncTable[177] := FuncLocal;
+  fIdentFuncTable[583] := FuncLocasestr;
+  fIdentFuncTable[285] := FuncLoop;
+  fIdentFuncTable[604] := FuncLowerlevelstoo;
+  fIdentFuncTable[403] := FuncLtrunc;
+  fIdentFuncTable[603] := FuncMatching;
+  fIdentFuncTable[328] := FuncMember;
+  fIdentFuncTable[16] := FuncMerge;
+  fIdentFuncTable[138] := FuncMessagedlg;
+  fIdentFuncTable[777] := FuncMetaflow;
+  fIdentFuncTable[271] := FuncMidstr;
+  fIdentFuncTable[675] := FuncMultiply;
+  fIdentFuncTable[544] := FuncNextinstance;
+  fIdentFuncTable[418] := FuncNextrepeatinstance;
+  fIdentFuncTable[476] := FuncOf;
+  fIdentFuncTable[440] := FuncOptions;
+  fIdentFuncTable[174] := FuncOrganisation;
+  fIdentFuncTable[390] := FuncOutput;
+  fIdentFuncTable[27] := FuncParam;
+  fIdentFuncTable[158] := FuncParent;
+  fIdentFuncTable[537] := FuncParseinc;
+  fIdentFuncTable[605] := FuncPdriver;
+  fIdentFuncTable[93] := FuncPrevinstance;
+  fIdentFuncTable[760] := FuncPrevrepeatinstance;
+  fIdentFuncTable[425] := FuncPrinter;
+  fIdentFuncTable[654] := FuncPrintfile;
+  fIdentFuncTable[414] := FuncPropertygroup;
+  fIdentFuncTable[497] := FuncRastr;
+  fIdentFuncTable[395] := FuncRaval;
+  fIdentFuncTable[80] := FuncReadinstance;
+  fIdentFuncTable[581] := FuncReadrepeatinstance;
+  fIdentFuncTable[721] := FuncRepeat;
+  fIdentFuncTable[160] := FuncRepeatcount;
+  fIdentFuncTable[249] := FuncReportlevel;
+  fIdentFuncTable[221] := FuncRightstr;
+  fIdentFuncTable[204] := FuncRlenstr;
+  fIdentFuncTable[768] := FuncRoot;
+  fIdentFuncTable[666] := FuncRound;
+  fIdentFuncTable[152] := FuncShowmessage;
+  fIdentFuncTable[579] := FuncSkipemtpty;
+  fIdentFuncTable[307] := FuncSortdown;
+  fIdentFuncTable[508] := FuncSortkey;
+  fIdentFuncTable[299] := FuncSortup;
+  fIdentFuncTable[415] := FuncSql_add;
+  fIdentFuncTable[247] := FuncSql_asfloat;
+  fIdentFuncTable[718] := FuncSql_asstring;
+  fIdentFuncTable[311] := FuncSql_create;
+  fIdentFuncTable[635] := FuncSql_dump;
+  fIdentFuncTable[756] := FuncSql_eof;
+  fIdentFuncTable[723] := FuncSql_execute;
+  fIdentFuncTable[269] := FuncSql_free;
+  fIdentFuncTable[530] := FuncSql_mladd;
+  fIdentFuncTable[551] := FuncSql_mlmultiadd;
+  fIdentFuncTable[724] := FuncSql_next;
+  fIdentFuncTable[482] := FuncSql_setvar;
+  fIdentFuncTable[449] := FuncSqr;
+  fIdentFuncTable[348] := FuncStripstr;
+  fIdentFuncTable[615] := FuncStroptions;
+  fIdentFuncTable[566] := FuncStrpos;
+  fIdentFuncTable[740] := FuncSubtract;
+  fIdentFuncTable[51] := FuncSum;
+  fIdentFuncTable[764] := FuncSupplier;
+  fIdentFuncTable[696] := FuncSuppliesofmembers;
+  fIdentFuncTable[470] := FuncThen;
+  fIdentFuncTable[162] := FuncTrunc;
+  fIdentFuncTable[344] := FuncUpcasestr;
+  fIdentFuncTable[77] := FuncUsedby;
+  fIdentFuncTable[224] := FuncV_date;
+  fIdentFuncTable[267] := FuncV_false;
+  fIdentFuncTable[55] := FuncV_nonereal;
+  fIdentFuncTable[421] := FuncV_par_language;
+  fIdentFuncTable[404] := FuncV_par_language_count;
+  fIdentFuncTable[751] := FuncV_par_language_fields;
+  fIdentFuncTable[366] := FuncV_time;
+  fIdentFuncTable[218] := FuncV_true;
+  fIdentFuncTable[159] := FuncVariables;
+  fIdentFuncTable[149] := FuncVaroptions;
+  fIdentFuncTable[84] := FuncWhile;
+  fIdentFuncTable[745] := FuncZerorlenstr;
 end;
 
 function TSynCPMSyn.AltFunc(Index: Integer): TtkTokenKind;
@@ -1721,109 +1715,109 @@ constructor TSynCPMSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
+  fCaseSensitive := False;
 
-  FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Foreground := clNavy;
-  FCommentAttri.Style := [fsItalic];
-  AddAttribute(FCommentAttri);
+  fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Foreground := clNavy;
+  fCommentAttri.Style := [fsItalic];
+  AddAttribute(fCommentAttri);
 
-  FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
+  fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
 
-  FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Foreground := clGreen;
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
+  fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Foreground := clGreen;
+  fKeyAttri.Style := [fsBold];
+  AddAttribute(fKeyAttri);
 
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
   
-  FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
+  fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
 
-  FSQLKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrSQLKey, SYNS_FriendlyAttrSQLKey);
-  FSQLKeyAttri.ForeGround := clTeal;
-  FSQLKeyAttri.Style := [fsBold];
-  AddAttribute(FSQLKeyAttri);
+  fSQLKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrSQLKey, SYNS_FriendlyAttrSQLKey);
+  fSQLKeyAttri.ForeGround := clTeal;
+  fSQLKeyAttri.Style := [fsBold];
+  AddAttribute(fSQLKeyAttri);
 
-  FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
+  fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
 
-  FSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
+  fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
 
-  FSpecialVarAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpecialVariable, SYNS_FriendlyAttrSpecialVariable);
-  FSpecialVarAttri.Style := [fsBold];
-  AddAttribute(FSpecialVarAttri);
+  fSpecialVarAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpecialVariable, SYNS_FriendlyAttrSpecialVariable);
+  fSpecialVarAttri.Style := [fsBold];
+  AddAttribute(fSpecialVarAttri);
 
-  FSystemAttri := TSynHighlighterAttributes.Create(SYNS_AttrSystem, SYNS_FriendlyAttrSystem);
-  FSystemAttri.Foreground := $000080FF;
-  FSystemAttri.Style := [fsBold];
-  AddAttribute(FSystemAttri);
+  fSystemAttri := TSynHighlighterAttributes.Create(SYNS_AttrSystem, SYNS_FriendlyAttrSystem);
+  fSystemAttri.Foreground := $000080FF;
+  fSystemAttri.Style := [fsBold];
+  AddAttribute(fSystemAttri);
 
-  FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
-  FVariableAttri.Foreground := clMaroon;
-  AddAttribute(FVariableAttri);
+  fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
+  fVariableAttri.Foreground := clMaroon;
+  AddAttribute(fVariableAttri);
 
   SetAttributesOnChange(DefHighlightChange);
   InitIdent;
-  FRange := rsUnknown;
-  FCommentLevel := 0;
-  FDefaultFilter := SYNS_FilterCPM;
+  fRange := rsUnknown;
+  fCommentLevel := 0;
+  fDefaultFilter := SYNS_FilterCPM;
 end; { Create }
 
 procedure TSynCPMSyn.BraceOpenProc;
 begin
-  FRange := rsBraceComment;
+  fRange := rsBraceComment;
   BraceCommentProc;
-  FTokenID := tkComment;
+  fTokenID := tkComment;
 end; { BraceOpenProc }
 
 procedure TSynCPMSyn.IdentProc;
 begin
-  FTokenID := IdentKind(FLine + Run);
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do
+  fTokenID := IdentKind(fLine + Run);
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do
     Inc(Run);
 end; { IdentProc }
 
 procedure TSynCPMSyn.VariableProc;
 begin
-  FTokenID := IdentKind((FLine + Run));
-  if (FTokenID = tkIdentifier) then
+  fTokenID := IdentKind((fLine + Run));
+  if (fTokenID = tkIdentifier) then
   begin
-    if (FLine[Run + 1] = '_') then
-      FTokenID := tkVariable
+    if (fLine[Run + 1] = '_') then
+      fTokenID := tkVariable
   end;
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do
     Inc(Run);
 end; { VariableProc }
 
 procedure TSynCPMSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end; { NullProc }
 
 procedure TSynCPMSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end; { SpaceProc }
 
 procedure TSynCPMSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
     Inc(Run);
-  until IsLineEnd(Run) or (FLine[Run] = '"');
-  if (FLine[Run] = '"') then
+  until IsLineEnd(Run) or (fLine[Run] = '"');
+  if (fLine[Run] = '"') then
   begin
     Inc(Run);
-    if (FLine[Run] = '"') then
+    if (fLine[Run] = '"') then
       Inc(Run);
   end;
 end; { StringProc }
@@ -1831,16 +1825,16 @@ procedure TSynCPMSyn.StringProc;
 procedure TSynCPMSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end; { UnknownProc }
 
 procedure TSynCPMSyn.Next;
 begin
-  FTokenPos := Run;
-  case FRange of
+  fTokenPos := Run;
+  case fRange of
     rsBraceComment: BraceCommentProc;
   else
-    case FLine[Run] of
+    case fLine[Run] of
       #0: NullProc;
       #10: LFProc;
       #13: CRProc;
@@ -1848,7 +1842,7 @@ procedure TSynCPMSyn.Next;
       '"': StringProc;
       '0'..'9': NumberProc;
       'A'..'Z', 'a'..'z', '_':
-        case FLine[Run] of
+        case fLine[Run] of
           'V', 'v', 'S', 's': VariableProc;
           else
             IdentProc;
@@ -1856,7 +1850,7 @@ procedure TSynCPMSyn.Next;
       '{': BraceOpenProc;
       '}', '!', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~':
       begin
-        case FLine[Run] of
+        case fLine[Run] of
           ';': SemiColonProc;
           else
             SymbolProc;
@@ -1872,12 +1866,12 @@ procedure TSynCPMSyn.Next;
 function TSynCPMSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
     else
       Result := nil;
   end;
@@ -1885,29 +1879,29 @@ function TSynCPMSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttribut
 
 function TSynCPMSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end; { GetEol }
 
 function TSynCPMSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end; { GetTokenID }
 
 function TSynCPMSyn.GetTokenAttribute: TSynHighLighterAttributes;
 begin
   case GetTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkSQLKey: Result := FSQLKeyAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkSpecialVar: Result := FSpecialVarAttri;
-    tkSystem: Result := FSystemAttri;
-    tkVariable: Result := FVariableAttri;
-    tkUnknown: Result := FIdentifierAttri;
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkSQLKey: Result := fSQLKeyAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkSpecialVar: Result := fSpecialVarAttri;
+    tkSystem: Result := fSystemAttri;
+    tkVariable: Result := fVariableAttri; 
+    tkUnknown: Result := fIdentifierAttri;
   else
     Result := nil;
   end;
@@ -1915,7 +1909,7 @@ function TSynCPMSyn.GetTokenAttribute: TSynHighLighterAttributes;
 
 function TSynCPMSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end; { GetTokenKind }
 
 class function TSynCPMSyn.GetLanguageName: string;
@@ -1925,24 +1919,24 @@ class function TSynCPMSyn.GetLanguageName: string;
 
 procedure TSynCPMSyn.BraceCommentProc;
 begin
-  case FLine[Run] of
+  case fLine[Run] of
      #0: NullProc;
     #10: LFProc;
     #13: CRProc;
   else
     begin
-      FTokenID := tkComment;
+      fTokenID := tkComment;
       repeat
-        if FLine[Run] = '{' then
-          Inc(FCommentLevel)
-        else if FLine[Run] = '}' then
+        if fLine[Run] = '{' then
+          Inc(fCommentLevel)
+        else if fLine[Run] = '}' then
         begin
-          Dec(FCommentLevel);
-          if (FCommentLevel < 1) then
+          Dec(fCommentLevel);
+          if (fCommentLevel < 1) then
           begin
             Inc(Run);
-            FRange := rsUnknown;
-            FCommentLevel := 0;
+            fRange := rsUnKnown;
+            fCommentLevel := 0;
             Break;
           end;
         end;
@@ -1954,19 +1948,19 @@ procedure TSynCPMSyn.BraceCommentProc;
 
 procedure TSynCPMSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run] = #10 then
+  if fLine[Run] = #10 then
     Inc(Run);
 end; { CRProc }
 
 procedure TSynCPMSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end; { LFProc }
 
-function TSynCPMSyn.GetSampleSource: UnicodeString;
+function TSynCPMSyn.GetSampleSource: string;
 begin
   Result := '{ COAS Product Manager report (RDF) }'#13#10 +
             'PARAM'#13#10 +
@@ -1992,20 +1986,20 @@ function TSynCPMSyn.GetSampleSource: UnicodeString;
 
 function TSynCPMSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterCPM;
+  Result := fDefaultFilter <> SYNS_FilterCPM;
 end; { IsFilterStored }
 
 procedure TSynCPMSyn.SemiColonProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end; { SemiColonProc }
 
 procedure TSynCPMSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', '.', 'e', 'E':
         Result := True;
       else
@@ -2015,7 +2009,7 @@ procedure TSynCPMSyn.NumberProc;
 
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar do
   begin
     case FLine[Run] of
@@ -2029,38 +2023,36 @@ procedure TSynCPMSyn.NumberProc;
 procedure TSynCPMSyn.SymbolProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end; { SymbolProc }
 
 procedure TSynCPMSyn.ResetRange;
 begin
   inherited;
-  FRange := rsUnknown;
-  FCommentLevel := 0;
+  fRange := rsUnknown;
+  fCommentLevel := 0;
 end; { ResetRange }
 
 procedure TSynCPMSyn.SetRange(Value: Pointer);
 var
-  AValue: LongInt;
+  AValue: Integer;
 begin
   inherited;
-  AValue := Longint(Value);
-  FCommentLevel := AValue div $10000;
-  FRange := TRangeState(AValue mod $10000);
+  AValue := NativeInt(Value);
+  fCommentLevel := AValue div $10000;
+  fRange := TRangeState(AValue mod $10000);
 end; { SetRange }
 
 function TSynCPMSyn.GetRange: Pointer;
 begin
-  Result := Pointer((FCommentLevel * $10000) + Integer(FRange));
+  Result := Pointer((fCommentLevel * $10000) + Integer(fRange));
 end; { GetRange }
 
-class function TSynCPMSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynCPMSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangCPM;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynCPMSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterCS.pas b/Ext/SynEdit/Source/SynHighlighterCS.pas
index e12ff9e..37a966d 100644
--- a/Ext/SynEdit/Source/SynHighlighterCS.pas
+++ b/Ext/SynEdit/Source/SynHighlighterCS.pas
@@ -29,14 +29,6 @@
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
 
-$Id: SynHighlighterCS.pas,v 1.8.2.7 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of SynEdit from the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-You may retrieve the latest version of this file from
-http://www.ashleybrown.co.uk/synedit/
-
 Known Issues:
   - strings on multiple lines are not supported 
 -------------------------------------------------------------------------------}
@@ -62,11 +54,12 @@ interface
   SynEditMiscClasses,
   SynUnicode,
   SysUtils,
-  Classes;
+  Classes,
+  SynEditCodeFolding;
 
 type
-  TtkTokenKind = (tkAsm, tkComment, tkDirective, tkIdentifier, tkKey, tkNull,
-    tkNumber, tkSpace, tkString, tkSymbol, tkUnknown);
+  TtkTokenKind = (tkSymbol, tkKey, tkAsm, tkComment, tkDirective, tkIdentifier, tkNull,
+    tkNumber, tkSpace, tkString, tkType, tkUnknown);
 
   TxtkTokenKind = (
     xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkArrow, xtkAssign,
@@ -87,42 +80,39 @@ interface
   PIdentFuncTableFunc = ^TIdentFuncTableFunc;
   TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
 
-  TSynCSSyn = class(TSynCustomHighlighter)
+  TSynCSSyn = class(TSynCustomCodeFoldingHighlighter)
   private
-    FAsmStart: Boolean;
-    FRange: TRangeState;
+    fAsmStart: Boolean;
+    fRange: TRangeState;
     FTokenID: TtkTokenKind;
     FExtTokenID: TxtkTokenKind;
-    FIdentFuncTable: array[0..210] of TIdentFuncTableFunc;
-    FAsmAttri: TSynHighlighterAttributes;
-    FCommentAttri: TSynHighlighterAttributes;
-    FDirecAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FInvalidAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
+    fIdentFuncTable: array[0..210] of TIdentFuncTableFunc;
+    fAsmAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fDirecAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fInvalidAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    fTypeAttri: TSynHighlighterAttributes;
     function AltFunc(Index: Integer): TtkTokenKind;
+    function DataTypeFunc(Index: Integer): TtkTokenKind;
+
     function FuncAbstract(Index: Integer): TtkTokenKind;
     function FuncAs(Index: Integer): TtkTokenKind;
     function FuncBase(Index: Integer): TtkTokenKind;
-    function FuncBool(Index: Integer): TtkTokenKind;
     function FuncBreak(Index: Integer): TtkTokenKind;
-    function FuncByte(Index: Integer): TtkTokenKind;
     function FuncCase(Index: Integer): TtkTokenKind;
     function FuncCatch(Index: Integer): TtkTokenKind;
-    function FuncChar(Index: Integer): TtkTokenKind;
-    function FuncChecked(Index: Integer): TtkTokenKind;
     function FuncClass(Index: Integer): TtkTokenKind;
     function FuncConst(Index: Integer): TtkTokenKind;
     function FuncContinue(Index: Integer): TtkTokenKind;
-    function FuncDecimal(Index: Integer): TtkTokenKind;
     function FuncDefault(Index: Integer): TtkTokenKind;
     function FuncDelegate(Index: Integer): TtkTokenKind;
     function FuncDo(Index: Integer): TtkTokenKind;
-    function FuncDouble(Index: Integer): TtkTokenKind;
     function FuncElse(Index: Integer): TtkTokenKind;
     function FuncEnum(Index: Integer): TtkTokenKind;
     function FuncEvent(Index: Integer): TtkTokenKind;
@@ -131,19 +121,17 @@   TSynCSSyn = class(TSynCustomHighlighter)
     function FuncFalse(Index: Integer): TtkTokenKind;
     function FuncFinally(Index: Integer): TtkTokenKind;
     function FuncFixed(Index: Integer): TtkTokenKind;
-    function FuncFloat(Index: Integer): TtkTokenKind;
     function FuncFor(Index: Integer): TtkTokenKind;
     function FuncForeach(Index: Integer): TtkTokenKind;
     function FuncGoto(Index: Integer): TtkTokenKind;
+    function FuncChecked(Index: Integer): TtkTokenKind;
     function FuncIf(Index: Integer): TtkTokenKind;
     function FuncImplicit(Index: Integer): TtkTokenKind;
     function FuncIn(Index: Integer): TtkTokenKind;
-    function FuncInt(Index: Integer): TtkTokenKind;
     function FuncInterface(Index: Integer): TtkTokenKind;
     function FuncInternal(Index: Integer): TtkTokenKind;
     function FuncIs(Index: Integer): TtkTokenKind;
     function FuncLock(Index: Integer): TtkTokenKind;
-    function FuncLong(Index: Integer): TtkTokenKind;
     function FuncNamespace(Index: Integer): TtkTokenKind;
     function FuncNew(Index: Integer): TtkTokenKind;
     function FuncNull(Index: Integer): TtkTokenKind;
@@ -158,12 +146,10 @@   TSynCSSyn = class(TSynCustomHighlighter)
     function FuncReadonly(Index: Integer): TtkTokenKind;
     function FuncRef(Index: Integer): TtkTokenKind;
     function FuncReturn(Index: Integer): TtkTokenKind;
-    function FuncSbyte(Index: Integer): TtkTokenKind;
     function FuncSealed(Index: Integer): TtkTokenKind;
     function FuncSizeof(Index: Integer): TtkTokenKind;
     function FuncStackalloc(Index: Integer): TtkTokenKind;
     function FuncStatic(Index: Integer): TtkTokenKind;
-    function FuncString(Index: Integer): TtkTokenKind;
     function FuncStruct(Index: Integer): TtkTokenKind;
     function FuncSwitch(Index: Integer): TtkTokenKind;
     function FuncThis(Index: Integer): TtkTokenKind;
@@ -171,15 +157,14 @@   TSynCSSyn = class(TSynCustomHighlighter)
     function FuncTrue(Index: Integer): TtkTokenKind;
     function FuncTry(Index: Integer): TtkTokenKind;
     function FuncTypeof(Index: Integer): TtkTokenKind;
-    function FuncUint(Index: Integer): TtkTokenKind;
-    function FuncUlong(Index: Integer): TtkTokenKind;
     function FuncUnchecked(Index: Integer): TtkTokenKind;
     function FuncUnsafe(Index: Integer): TtkTokenKind;
-    function FuncUshort(Index: Integer): TtkTokenKind;
     function FuncUsing(Index: Integer): TtkTokenKind;
     function FuncVirtual(Index: Integer): TtkTokenKind;
     function FuncVoid(Index: Integer): TtkTokenKind;
+    function FuncVolatile(Index: Integer): TtkTokenKind;
     function FuncWhile(Index: Integer): TtkTokenKind;
+
     function HashKey(Str: PWideChar): Cardinal;
     function IdentKind(MayBe: PWideChar): TtkTokenKind;
     procedure InitIdent;
@@ -223,12 +208,12 @@   TSynCSSyn = class(TSynCustomHighlighter)
   protected
     function GetExtTokenID: TxtkTokenKind;
     function IsFilterStored: Boolean; override;
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     procedure NextProcedure;
   public
     class function GetCapabilities: TSynHighlighterCapabilities; override;
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -244,84 +229,88 @@   TSynCSSyn = class(TSynCustomHighlighter)
     function UseUserSettings(settingIndex: Integer): Boolean; override;
     procedure EnumUserSettings(settings: TStrings); override;
     property ExtTokenID: TxtkTokenKind read GetExtTokenID;
+    procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges;
+      LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override;
   published
-    property AsmAttri: TSynHighlighterAttributes read FAsmAttri write FAsmAttri;
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property DirecAttri: TSynHighlighterAttributes read FDirecAttri
-      write FDirecAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri
-      write FInvalidAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
+    property AsmAttri: TSynHighlighterAttributes read fAsmAttri write fAsmAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property DirecAttri: TSynHighlighterAttributes read fDirecAttri
+      write fDirecAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri
+      write fInvalidAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
+    property TypeAttri: TSynHighlighterAttributes read fTypeAttri write fTypeAttri;
   end;
 
 implementation
 
 uses
   Windows,
+  Registry,
   SynEditStrConst;
 
-const
-  KeyWords: array[0..74] of UnicodeString = (
-    'abstract', 'as', 'base', 'bool', 'break', 'byte', 'case', 'catch', 'char', 
-    'checked', 'class', 'const', 'continue', 'decimal', 'default', 'delegate', 
-    'do', 'double', 'else', 'enum', 'event', 'explicit', 'extern', 'false', 
-    'finally', 'fixed', 'float', 'for', 'foreach', 'goto', 'if', 'implicit', 
-    'in', 'int', 'interface', 'internal', 'is', 'lock', 'long', 'namespace', 
-    'new', 'null', 'object', 'operator', 'out', 'override', 'params', 'private', 
-    'protected', 'public', 'readonly', 'ref', 'return', 'sbyte', 'sealed', 
-    'sizeof', 'stackalloc', 'static', 'string', 'struct', 'switch', 'this', 
-    'throw', 'true', 'try', 'typeof', 'uint', 'ulong', 'unchecked', 'unsafe', 
-    'ushort', 'using', 'virtual', 'void', 'while' 
+ const
+  KeyWords: array[0..76] of string = (
+    'abstract', 'as', 'base', 'bool', 'break', 'byte', 'case', 'catch', 'class',
+    'const', 'continue', 'decimal', 'default', 'delegate', 'do', 'double',
+    'else', 'enum', 'event', 'explicit', 'extern', 'false', 'finally', 'fixed',
+    'float', 'for', 'foreach', 'goto', 'char', 'checked', 'if', 'implicit',
+    'in', 'int', 'interface', 'internal', 'is', 'lock', 'long', 'namespace',
+    'new', 'null', 'object', 'operator', 'out', 'override', 'params', 'private',
+    'protected', 'public', 'readonly', 'ref', 'return', 'sbyte', 'sealed',
+    'short', 'sizeof', 'stackalloc', 'static', 'string', 'struct', 'switch',
+    'this', 'throw', 'true', 'try', 'typeof', 'uint', 'ulong', 'unchecked',
+    'unsafe', 'ushort', 'using', 'virtual', 'void', 'volatile', 'while'
   );
 
   KeyIndices: array[0..210] of Integer = (
-    71, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, -1, 1, 46, -1, -1, 62, 
-    -1, 53, -1, -1, -1, -1, 3, -1, -1, 18, -1, 8, -1, -1, -1, -1, -1, 19, -1, 
-    -1, -1, -1, -1, 45, -1, -1, 28, 44, -1, 47, 21, -1, -1, -1, -1, -1, 73, -1, 
-    -1, 9, -1, -1, -1, 26, 49, 63, 65, -1, -1, 16, 67, -1, 59, -1, -1, -1, 66, 
-    -1, 50, -1, -1, -1, 29, -1, 32, 37, -1, -1, 48, -1, -1, 55, -1, 14, 40, -1, 
-    -1, 13, -1, 12, -1, -1, 15, 30, -1, -1, -1, 41, -1, -1, -1, -1, 4, 56, -1, 
-    58, -1, 38, -1, -1, -1, -1, 74, -1, -1, -1, 17, 33, -1, -1, 20, -1, -1, 27, 
-    31, -1, 6, -1, -1, -1, -1, 7, -1, -1, 10, -1, -1, 2, -1, -1, -1, 64, -1, -1, 
-    43, -1, -1, -1, 0, -1, 34, -1, 25, -1, -1, 5, 61, 60, -1, 42, -1, -1, -1, 
-    51, -1, -1, -1, -1, 22, -1, -1, 72, -1, -1, 57, -1, 70, -1, 11, -1, -1, -1, 
-    24, -1, 35, -1, -1, 23, -1, 39, -1, -1, 68, 52, 36, -1, -1, -1, -1, 54, -1, 
-    -1 
+    -1, 37, -1, -1, -1, -1, 27, -1, 70, -1, -1, 75, 7, -1, -1, 68, -1, -1, -1,
+    -1, -1, -1, 43, -1, 73, -1, -1, -1, 55, -1, 22, 39, -1, 10, -1, 6, -1, 34,
+    61, -1, 40, -1, -1, 60, 26, -1, -1, -1, -1, 45, -1, 29, 30, 67, 13, -1, 62,
+    72, -1, -1, 74, -1, -1, 41, -1, 1, 51, -1, -1, -1, -1, -1, 36, -1, 53, -1,
+    -1, -1, -1, 11, -1, -1, -1, 46, 58, 71, -1, -1, -1, -1, -1, -1, -1, -1, 28,
+    25, 0, -1, 16, -1, 63, -1, -1, 44, -1, 50, -1, 5, -1, -1, -1, 23, 38, 32,
+    33, 20, -1, -1, -1, -1, -1, -1, -1, 3, -1, -1, -1, 18, -1, -1, -1, -1, 54,
+    -1, -1, 12, 8, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, 56, 21, 47, 69, 64,
+    -1, -1, -1, 65, -1, -1, 9, 15, -1, -1, -1, -1, -1, 76, 24, -1, -1, 14, -1,
+    -1, -1, 19, 4, -1, -1, -1, -1, -1, -1, -1, 31, 48, 35, 66, -1, 52, -1, -1,
+    -1, -1, -1, -1, -1, 57, -1, 49, -1, 17, -1, 2, -1, -1, -1, -1, -1, -1, -1,
+    -1, 42
   );
 
 {$Q-}
-function TSynCSSyn.HashKey(Str: PWideChar): Cardinal;
+function TSynCsSyn.HashKey(Str: PWideChar): Cardinal;
 begin
   Result := 0;
   while IsIdentChar(Str^) do
   begin
-    Result := Result * 723 + Ord(Str^) * 24;
+    Result := Result * 52 + Ord(Str^) * 456;
     Inc(Str);
   end;
   Result := Result mod 211;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
-function TSynCSSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
+function TSynCsSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
@@ -330,85 +319,91 @@ procedure TSynCSSyn.InitIdent;
 var
   i: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
     if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
-
-  FIdentFuncTable[157] := FuncAbstract;
-  FIdentFuncTable[14] := FuncAs;
-  FIdentFuncTable[146] := FuncBase;
-  FIdentFuncTable[25] := FuncBool;
-  FIdentFuncTable[111] := FuncBreak;
-  FIdentFuncTable[164] := FuncByte;
-  FIdentFuncTable[135] := FuncCase;
-  FIdentFuncTable[140] := FuncCatch;
-  FIdentFuncTable[30] := FuncChar;
-  FIdentFuncTable[58] := FuncChecked;
-  FIdentFuncTable[143] := FuncClass;
-  FIdentFuncTable[187] := FuncConst;
-  FIdentFuncTable[98] := FuncContinue;
-  FIdentFuncTable[96] := FuncDecimal;
-  FIdentFuncTable[92] := FuncDefault;
-  FIdentFuncTable[101] := FuncDelegate;
-  FIdentFuncTable[68] := FuncDo;
-  FIdentFuncTable[125] := FuncDouble;
-  FIdentFuncTable[28] := FuncElse;
-  FIdentFuncTable[36] := FuncEnum;
-  FIdentFuncTable[129] := FuncEvent;
-  FIdentFuncTable[49] := FuncExplicit;
-  FIdentFuncTable[177] := FuncExtern;
-  FIdentFuncTable[196] := FuncFalse;
-  FIdentFuncTable[191] := FuncFinally;
-  FIdentFuncTable[161] := FuncFixed;
-  FIdentFuncTable[62] := FuncFloat;
-  FIdentFuncTable[132] := FuncFor;
-  FIdentFuncTable[45] := FuncForeach;
-  FIdentFuncTable[81] := FuncGoto;
-  FIdentFuncTable[102] := FuncIf;
-  FIdentFuncTable[133] := FuncImplicit;
-  FIdentFuncTable[83] := FuncIn;
-  FIdentFuncTable[126] := FuncInt;
-  FIdentFuncTable[159] := FuncInterface;
-  FIdentFuncTable[193] := FuncInternal;
-  FIdentFuncTable[203] := FuncIs;
-  FIdentFuncTable[84] := FuncLock;
-  FIdentFuncTable[116] := FuncLong;
-  FIdentFuncTable[198] := FuncNamespace;
-  FIdentFuncTable[93] := FuncNew;
-  FIdentFuncTable[106] := FuncNull;
-  FIdentFuncTable[168] := FuncObject;
-  FIdentFuncTable[153] := FuncOperator;
-  FIdentFuncTable[46] := FuncOut;
-  FIdentFuncTable[42] := FuncOverride;
-  FIdentFuncTable[15] := FuncParams;
-  FIdentFuncTable[48] := FuncPrivate;
-  FIdentFuncTable[87] := FuncProtected;
-  FIdentFuncTable[63] := FuncPublic;
-  FIdentFuncTable[77] := FuncReadonly;
-  FIdentFuncTable[172] := FuncRef;
-  FIdentFuncTable[202] := FuncReturn;
-  FIdentFuncTable[20] := FuncSbyte;
-  FIdentFuncTable[208] := FuncSealed;
-  FIdentFuncTable[90] := FuncSizeof;
-  FIdentFuncTable[112] := FuncStackalloc;
-  FIdentFuncTable[183] := FuncStatic;
-  FIdentFuncTable[114] := FuncString;
-  FIdentFuncTable[71] := FuncStruct;
-  FIdentFuncTable[166] := FuncSwitch;
-  FIdentFuncTable[165] := FuncThis;
-  FIdentFuncTable[18] := FuncThrow;
-  FIdentFuncTable[64] := FuncTrue;
-  FIdentFuncTable[150] := FuncTry;
-  FIdentFuncTable[65] := FuncTypeof;
-  FIdentFuncTable[75] := FuncUint;
-  FIdentFuncTable[69] := FuncUlong;
-  FIdentFuncTable[201] := FuncUnchecked;
-  FIdentFuncTable[9] := FuncUnsafe;
-  FIdentFuncTable[185] := FuncUshort;
-  FIdentFuncTable[0] := FuncUsing;
-  FIdentFuncTable[180] := FuncVirtual;
-  FIdentFuncTable[55] := FuncVoid;
-  FIdentFuncTable[121] := FuncWhile;
+      fIdentFuncTable[i] := AltFunc;
+
+  { nasledujici funkce nahradit za DataTypeFunc :
+  bool, byte, decimal, double, float, char, int, long, sbyte, short, string, uint, ulong, ushort
+  }
+
+  fIdentFuncTable[96] := FuncAbstract;
+  fIdentFuncTable[65] := FuncAs;
+  fIdentFuncTable[201] := FuncBase;
+  fIdentFuncTable[123] := DataTypeFunc;
+  fIdentFuncTable[174] := FuncBreak;
+  fIdentFuncTable[107] := DataTypeFunc;
+  fIdentFuncTable[35] := FuncCase;
+  fIdentFuncTable[12] := FuncCatch;
+  fIdentFuncTable[136] := FuncClass;
+  fIdentFuncTable[158] := FuncConst;
+  fIdentFuncTable[33] := FuncContinue;
+  fIdentFuncTable[79] := DataTypeFunc;
+  fIdentFuncTable[135] := FuncDefault;
+  fIdentFuncTable[54] := FuncDelegate;
+  fIdentFuncTable[169] := FuncDo;
+  fIdentFuncTable[159] := DataTypeFunc;
+  fIdentFuncTable[98] := FuncElse;
+  fIdentFuncTable[199] := FuncEnum;
+  fIdentFuncTable[127] := FuncEvent;
+  fIdentFuncTable[173] := FuncExplicit;
+  fIdentFuncTable[115] := FuncExtern;
+  fIdentFuncTable[148] := FuncFalse;
+  fIdentFuncTable[30] := FuncFinally;
+  fIdentFuncTable[111] := FuncFixed;
+  fIdentFuncTable[166] := DataTypeFunc;
+  fIdentFuncTable[95] := FuncFor;
+  fIdentFuncTable[44] := FuncForeach;
+  fIdentFuncTable[6] := FuncGoto;
+  fIdentFuncTable[94] := DataTypeFunc;
+  fIdentFuncTable[51] := FuncChecked;
+  fIdentFuncTable[52] := FuncIf;
+  fIdentFuncTable[182] := FuncImplicit;
+  fIdentFuncTable[113] := FuncIn;
+  fIdentFuncTable[114] := DataTypeFunc;
+  fIdentFuncTable[37] := FuncInterface;
+  fIdentFuncTable[184] := FuncInternal;
+  fIdentFuncTable[72] := FuncIs;
+  fIdentFuncTable[1] := FuncLock;
+  fIdentFuncTable[112] := DataTypeFunc;
+  fIdentFuncTable[31] := FuncNamespace;
+  fIdentFuncTable[40] := FuncNew;
+  fIdentFuncTable[63] := FuncNull;
+  fIdentFuncTable[210] := FuncObject;
+  fIdentFuncTable[22] := FuncOperator;
+  fIdentFuncTable[103] := FuncOut;
+  fIdentFuncTable[49] := FuncOverride;
+  fIdentFuncTable[83] := FuncParams;
+  fIdentFuncTable[149] := FuncPrivate;
+  fIdentFuncTable[183] := FuncProtected;
+  fIdentFuncTable[197] := FuncPublic;
+  fIdentFuncTable[105] := FuncReadonly;
+  fIdentFuncTable[66] := FuncRef;
+  fIdentFuncTable[187] := FuncReturn;
+  fIdentFuncTable[74] := DataTypeFunc;
+  fIdentFuncTable[132] := FuncSealed;
+  fIdentFuncTable[28] := DataTypeFunc;
+  fIdentFuncTable[147] := FuncSizeof;
+  fIdentFuncTable[195] := FuncStackalloc;
+  fIdentFuncTable[84] := FuncStatic;
+  fIdentFuncTable[146] := DataTypeFunc;
+  fIdentFuncTable[43] := FuncStruct;
+  fIdentFuncTable[38] := FuncSwitch;
+  fIdentFuncTable[56] := FuncThis;
+  fIdentFuncTable[100] := FuncThrow;
+  fIdentFuncTable[151] := FuncTrue;
+  fIdentFuncTable[155] := FuncTry;
+  fIdentFuncTable[185] := FuncTypeof;
+  fIdentFuncTable[53] := DataTypeFunc;
+  fIdentFuncTable[15] := DataTypeFunc;
+  fIdentFuncTable[150] := FuncUnchecked;
+  fIdentFuncTable[8] := FuncUnsafe;
+  fIdentFuncTable[85] := DataTypeFunc;
+  fIdentFuncTable[57] := FuncUsing;
+  fIdentFuncTable[24] := FuncVirtual;
+  fIdentFuncTable[60] := FuncVoid;
+  fIdentFuncTable[11] := FuncVolatile;
+  fIdentFuncTable[165] := FuncWhile;
 end;
 
 
@@ -442,14 +437,6 @@ function TSynCSSyn.FuncBase(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncBool(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
 function TSynCSSyn.FuncBreak(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
@@ -458,14 +445,6 @@ function TSynCSSyn.FuncBreak(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncByte(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
 function TSynCSSyn.FuncCase(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
@@ -482,14 +461,6 @@ function TSynCSSyn.FuncCatch(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncChar(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
 function TSynCSSyn.FuncChecked(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
@@ -522,14 +493,6 @@ function TSynCSSyn.FuncContinue(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncDecimal(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
 function TSynCSSyn.FuncDefault(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
@@ -554,14 +517,6 @@ function TSynCSSyn.FuncDo(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncDouble(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
 function TSynCSSyn.FuncElse(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
@@ -626,14 +581,6 @@ function TSynCSSyn.FuncFixed(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncFloat(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
 function TSynCSSyn.FuncFor(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
@@ -682,14 +629,6 @@ function TSynCSSyn.FuncIn(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncInt(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
 function TSynCSSyn.FuncInterface(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
@@ -722,14 +661,6 @@ function TSynCSSyn.FuncLock(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncLong(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
 function TSynCSSyn.FuncNamespace(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
@@ -842,14 +773,6 @@ function TSynCSSyn.FuncReturn(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncSbyte(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
 function TSynCSSyn.FuncSealed(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
@@ -882,14 +805,6 @@ function TSynCSSyn.FuncStatic(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncString(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
 function TSynCSSyn.FuncStruct(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
@@ -946,22 +861,6 @@ function TSynCSSyn.FuncTypeof(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncUint(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynCSSyn.FuncUlong(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
 function TSynCSSyn.FuncUnchecked(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
@@ -978,7 +877,7 @@ function TSynCSSyn.FuncUnsafe(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncUshort(Index: Integer): TtkTokenKind;
+function TSynCSSyn.FuncUsing(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
     Result := tkKey
@@ -986,7 +885,7 @@ function TSynCSSyn.FuncUshort(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncUsing(Index: Integer): TtkTokenKind;
+function TSynCSSyn.FuncVirtual(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
     Result := tkKey
@@ -994,7 +893,7 @@ function TSynCSSyn.FuncUsing(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncVirtual(Index: Integer): TtkTokenKind;
+function TSynCSSyn.FuncVoid(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
     Result := tkKey
@@ -1002,7 +901,7 @@ function TSynCSSyn.FuncVirtual(Index: Integer): TtkTokenKind;
     Result := tkIdentifier;
 end;
 
-function TSynCSSyn.FuncVoid(Index: Integer): TtkTokenKind;
+function TSynCSSyn.FuncVolatile(Index: Integer): TtkTokenKind;
 begin
   if IsCurrentToken(KeyWords[Index]) then
     Result := tkKey
@@ -1022,40 +921,43 @@ constructor TSynCSSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := True;
-
-  FAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler);
-  AddAttribute(FAsmAttri);
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style:= [fsItalic];
-  AddAttribute(FCommentAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
-  AddAttribute(FInvalidAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style:= [fsBold];
-  AddAttribute(FKeyAttri);
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
-  FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
-  AddAttribute(FDirecAttri);
+  fCaseSensitive := True;
+
+  fAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler);
+  AddAttribute(fAsmAttri);
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style:= [fsItalic];
+  AddAttribute(fCommentAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
+  AddAttribute(fInvalidAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style:= [fsBold];
+  AddAttribute(fKeyAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
+  fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
+  AddAttribute(fDirecAttri);
+  fTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType);
+  AddAttribute(fTypeAttri);
+
   SetAttributesOnChange(DefHighlightChange);
   InitIdent;
-  FRange := rsUnknown;
-  FAsmStart := False;
-  FDefaultFilter := SYNS_FilterCS;
+  fRange := rsUnknown;
+  fAsmStart := False;
+  fDefaultFilter := SYNS_FilterCS;
 end; { Create }
 
 procedure TSynCSSyn.AnsiCProc;
 begin
-  FTokenID := tkComment;
+  fTokenID := tkComment;
   case FLine[Run] of
     #0:
       begin
@@ -1077,30 +979,29 @@ procedure TSynCSSyn.AnsiCProc;
   while FLine[Run] <> #0 do
     case FLine[Run] of
       '*':
-        if FLine[Run + 1] = '/' then
+        if fLine[Run + 1] = '/' then
         begin
           Inc(Run, 2);
-          if FRange = rsAnsiCAsm then
-            FRange := rsAsm
-          else if FRange = rsAnsiCAsmBlock then
-            FRange := rsAsmBlock
-          else if FRange = rsDirectiveComment then
-            FRange := rsDirective
+          if fRange = rsAnsiCAsm then
+            fRange := rsAsm
+          else if fRange = rsAnsiCAsmBlock then
+            fRange := rsAsmBlock
+          else if fRange = rsDirectiveComment then
+            fRange := rsDirective
           else
-            FRange := rsUnknown;
+            fRange := rsUnKnown;
           Break;
         end else
           Inc(Run);
-      #10, #13:
-        Break;
-      else
-        Inc(Run);
+      #10: Break;
+      #13: Break;
+    else Inc(Run);
     end;
 end;
 
 procedure TSynCSSyn.AndSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {and assign}
       begin
@@ -1122,55 +1023,55 @@ procedure TSynCSSyn.AndSymbolProc;
 
 procedure TSynCSSyn.AsciiCharProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
-    if FLine[Run] = '\' then begin
-      if CharInSet(FLine[Run + 1], [#39, '\']) then
+    if fLine[Run] = '\' then begin
+      if CharInSet(fLine[Run + 1], [#39, '\']) then
         Inc(Run);
     end;
     Inc(Run);
-  until IsLineEnd(Run) or (FLine[Run] = #39);
-  if FLine[Run] = #39 then
+  until IsLineEnd(Run) or (fLine[Run] = #39);
+  if fLine[Run] = #39 then
     Inc(Run);
 end;
 
 procedure TSynCSSyn.AtSymbolProc;
 begin
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
   Inc(Run);
 end;
 
 procedure TSynCSSyn.BraceCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
   FExtTokenID := xtkBraceClose;
-  if FRange = rsAsmBlock then FRange := rsUnknown;
+  if fRange = rsAsmBlock then fRange := rsUnknown;
 end;
 
 procedure TSynCSSyn.BraceOpenProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
   FExtTokenID := xtkBraceOpen;
-  if FRange = rsAsm then
+  if fRange = rsAsm then
   begin
-    FRange := rsAsmBlock;
-    FAsmStart := True;
+    fRange := rsAsmBlock;
+    fAsmStart := True;
   end;
 end;
 
 procedure TSynCSSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run + 1] = #10 then Inc(Run);
+  if fLine[Run + 1] = #10 then Inc(Run);
 end;
 
 procedure TSynCSSyn.ColonProc;
 begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
+  fTokenID := tkSymbol;
+  Case FLine[Run + 1] of
     ':':                               {scope resolution operator}
       begin
         Inc(Run, 2);
@@ -1187,32 +1088,40 @@ procedure TSynCSSyn.ColonProc;
 procedure TSynCSSyn.CommaProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkComma;
 end;
 
+function TSynCSSyn.DataTypeFunc(Index: Integer): TtkTokenKind;
+begin
+  if IsCurrentToken(KeyWords[Index]) then
+    Result := tkType
+  else
+    Result := tkIdentifier;
+end;
+
 procedure TSynCSSyn.DirectiveProc;
 begin
   if IsLineEnd(Run) then
   begin
-    if (Run <= 0) or (FLine[Run - 1] <> '\') then
-      FRange := rsUnknown;
+    if (Run <= 0) or (fLine[Run - 1] <> '\') then
+      fRange := rsUnknown;
     NextProcedure;
   end
   else
   begin
-    FTokenID := tkDirective;
+    fTokenID := tkDirective;
     while True do
-      case FLine[Run] of
+      case fLine[Run] of
         '/': // comment?
           begin
-            if FLine[Run + 1] = '/' then
+            if fLine[Run + 1] = '/' then
             begin // is end of directive as well
-              FRange := rsUnknown;
+              fRange := rsUnknown;
               Break;
-            end else if FLine[Run + 1] = '*' then
+            end else if fLine[Run + 1] = '*' then
             begin // might be embedded only
-              FRange := rsDirectiveComment;
+              fRange := rsDirectiveComment;
               Break;
             end else
               Inc(Run);
@@ -1222,13 +1131,13 @@ procedure TSynCSSyn.DirectiveProc;
             Inc(Run);
             if IsLineEnd(Run) then
             begin
-              FRange := rsDirective;
+              fRange := rsDirective;
               Break;
             end;
           end;
         #0, #10, #13:
           begin
-            FRange := rsUnknown;
+            fRange := rsUnknown;
             Break;
           end;
         else
@@ -1239,7 +1148,7 @@ procedure TSynCSSyn.DirectiveProc;
 
 procedure TSynCSSyn.EqualProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {logical equal}
       begin
@@ -1256,8 +1165,8 @@ procedure TSynCSSyn.EqualProc;
 
 procedure TSynCSSyn.GreaterProc;
 begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
+  fTokenID := tkSymbol;
+  Case FLine[Run + 1] of
     '=':                               {greater than or equal to}
       begin
         Inc(Run, 2);
@@ -1286,27 +1195,27 @@ procedure TSynCSSyn.GreaterProc;
 
 procedure TSynCSSyn.QuestionProc;
 begin
-  FTokenID := tkSymbol;                {conditional}
+  fTokenID := tkSymbol;                {conditional}
   FExtTokenID := xtkQuestion;
   Inc(Run);
 end;
 
 procedure TSynCSSyn.IdentProc;
 begin
-  FTokenID := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  fTokenID := IdentKind((fLine + Run));
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
 end;
 
 procedure TSynCSSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynCSSyn.LowerProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {less than or equal to}
       begin
@@ -1336,7 +1245,7 @@ procedure TSynCSSyn.LowerProc;
 
 procedure TSynCSSyn.MinusProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {subtract assign}
       begin
@@ -1363,7 +1272,7 @@ procedure TSynCSSyn.MinusProc;
 
 procedure TSynCSSyn.ModSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {mod assign}
       begin
@@ -1380,7 +1289,7 @@ procedure TSynCSSyn.ModSymbolProc;
 
 procedure TSynCSSyn.NotSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {not equal}
       begin
@@ -1397,7 +1306,7 @@ procedure TSynCSSyn.NotSymbolProc;
 
 procedure TSynCSSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -1405,7 +1314,7 @@ procedure TSynCSSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X':
         Result := True;
       else
@@ -1415,13 +1324,12 @@ procedure TSynCSSyn.NumberProc;
 
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar do
   begin
     case FLine[Run] of
       '.':
-        if FLine[Run + 1] = '.' then
-          Break;
+        if FLine[Run + 1] = '.' then Break;
     end;
     Inc(Run);
   end;
@@ -1429,7 +1337,7 @@ procedure TSynCSSyn.NumberProc;
 
 procedure TSynCSSyn.OrSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {or assign}
       begin
@@ -1451,7 +1359,7 @@ procedure TSynCSSyn.OrSymbolProc;
 
 procedure TSynCSSyn.PlusProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {add assign}
       begin
@@ -1473,7 +1381,7 @@ procedure TSynCSSyn.PlusProc;
 
 procedure TSynCSSyn.PointProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
     begin                              {ellipse}
       Inc(Run, 3);
@@ -1489,7 +1397,7 @@ procedure TSynCSSyn.PointProc;
 procedure TSynCSSyn.RoundCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkRoundClose;
 end;
 
@@ -1500,12 +1408,129 @@ procedure TSynCSSyn.RoundOpenProc;
   FExtTokenID := xtkRoundOpen;
 end;
 
+//++ CodeFolding
+procedure TSynCSSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges;
+  LinesToScan: TStrings; FromLine, ToLine: Integer);
+var
+  CurLine: string;
+  Line: Integer;
+
+  function LineHasChar(Line: Integer; character: char;
+  StartCol: Integer): Boolean; // faster than Pos!
+  var
+    I: Integer;
+  begin
+    Result := False;
+    for I := StartCol to Length(CurLine) do begin
+      if CurLine[I] = character then begin
+        // Char must have proper highlighting (ignore stuff inside comments...)
+        if GetHighlighterAttriAtRowCol(LinesToScan, Line, I) <> fCommentAttri then begin
+          Result := True;
+          Break;
+        end;
+      end;
+    end;
+  end;
+
+  function FindBraces(Line: Integer): Boolean;
+  var
+    Col: Integer;
+  begin
+    Result := False;
+
+    for Col := 1 to Length(CurLine) do
+    begin
+      // We've found a starting character
+      if CurLine[col] = '{' then
+      begin
+        // Char must have proper highlighting (ignore stuff inside comments...)
+        if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> fCommentAttri then
+        begin
+          // And ignore lines with both opening and closing chars in them
+          if not LineHasChar(Line, '}', col + 1) then begin
+            FoldRanges.StartFoldRange(Line + 1, 1);
+            Result := True;
+          end;
+          // Skip until a newline
+          Break;
+        end;
+      end else if CurLine[col] = '}' then
+      begin
+        if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> fCommentAttri then
+        begin
+          // And ignore lines with both opening and closing chars in them
+          if not LineHasChar(Line, '{', col + 1) then begin
+            FoldRanges.StopFoldRange(Line + 1, 1);
+            Result := True;
+          end;
+          // Skip until a newline
+          Break;
+        end;
+      end;
+    end; // for Col
+  end;
+
+  function FoldRegion(Line: Integer): Boolean;
+  var
+    S: string;
+  begin
+    Result := False;
+    S := TrimLeft(CurLine);
+    if Uppercase(Copy(S, 1, 9)) = '//#REGION' then
+    begin
+      FoldRanges.StartFoldRange(Line + 1, FoldRegionType);
+      Result := True;
+    end
+    else if Uppercase(Copy(S, 1, 12)) = '//#ENDREGION' then
+    begin
+      FoldRanges.StopFoldRange(Line + 1, FoldRegionType);
+      Result := True;
+    end;
+  end;
+
+begin
+  for Line := FromLine to ToLine do
+  begin
+    // Deal first with Multiline comments (Fold Type 2)
+    if TRangeState(GetLineRange(LinesToScan, Line)) = rsANSIc then
+    begin
+      if TRangeState(GetLineRange(LinesToScan, Line - 1)) <> rsANSIc then
+        FoldRanges.StartFoldRange(Line + 1, 2)
+      else
+        FoldRanges.NoFoldInfo(Line + 1);
+      Continue;
+    end
+    else if TRangeState(GetLineRange(LinesToScan, Line - 1)) = rsANSIc then
+    begin
+      FoldRanges.StopFoldRange(Line + 1, 2);
+      Continue;
+    end;
+
+    CurLine := LinesToScan[Line];
+
+    // Skip empty lines
+    if CurLine = '' then begin
+      FoldRanges.NoFoldInfo(Line + 1);
+      Continue;
+    end;
+
+    // Find Fold regions
+    if FoldRegion(Line) then
+      Continue;
+
+    // Find an braces on this line  (Fold Type 1)
+    if not FindBraces(Line) then
+      FoldRanges.NoFoldInfo(Line + 1);
+  end; // while Line
+end;
+//-- CodeFolding
+
 procedure TSynCSSyn.SemiColonProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkSemiColon;
-  if FRange = rsAsm then FRange := rsUnknown;
+  if fRange = rsAsm then fRange := rsUnknown;
 end;
 
 procedure TSynCSSyn.SlashProc;
@@ -1513,43 +1538,43 @@ procedure TSynCSSyn.SlashProc;
   case FLine[Run + 1] of
     '/':                               {c++ style comments}
       begin
-        FTokenID := tkComment;
+        fTokenID := tkComment;
         Inc(Run, 2);
         while not IsLineEnd(Run) do Inc(Run);
       end;
     '*':                               {c style comments}
       begin
-        FTokenID := tkComment;
-        if FRange = rsAsm then
-          FRange := rsAnsiCAsm
-        else if FRange = rsAsmBlock then
-          FRange := rsAnsiCAsmBlock
-        else if FRange <> rsDirectiveComment then
-          FRange := rsAnsiC;
+        fTokenID := tkComment;
+        if fRange = rsAsm then
+          fRange := rsAnsiCAsm
+        else if fRange = rsAsmBlock then
+          fRange := rsAnsiCAsmBlock
+        else if fRange <> rsDirectiveComment then                          
+          fRange := rsAnsiC;
         Inc(Run, 2);
-        while FLine[Run] <> #0 do
-          case FLine[Run] of
+        while fLine[Run] <> #0 do
+          case fLine[Run] of
             '*':
-              if FLine[Run + 1] = '/' then
+              if fLine[Run + 1] = '/' then
               begin
                 Inc(Run, 2);
-                if FRange = rsDirectiveComment then
-                  FRange := rsDirective
-                else if FRange = rsAnsiCAsm then
-                  FRange := rsAsm
+                if fRange = rsDirectiveComment then
+                  fRange := rsDirective
+                else if fRange = rsAnsiCAsm then
+                  fRange := rsAsm
                 else
                   begin
-                  if FRange = rsAnsiCAsmBlock then
-                    FRange := rsAsmBlock
+                  if fRange = rsAnsiCAsmBlock then
+                    fRange := rsAsmBlock
                   else
-                    FRange := rsUnknown;
+                    fRange := rsUnKnown;
                   end;
                 Break;
               end else Inc(Run);
             #10, #13:
               begin
-                if FRange = rsDirectiveComment then
-                  FRange := rsAnsiC;
+                if fRange = rsDirectiveComment then
+                  fRange := rsAnsiC;
                 Break;
               end;
           else Inc(Run);
@@ -1558,13 +1583,13 @@ procedure TSynCSSyn.SlashProc;
     '=':                               {divide assign}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
         FExtTokenID := xtkDivideAssign;
       end;
   else                                 {divide}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
       FExtTokenID := xtkDivide;
     end;
   end;
@@ -1573,27 +1598,27 @@ procedure TSynCSSyn.SlashProc;
 procedure TSynCSSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynCSSyn.SquareCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkSquareClose;
 end;
 
 procedure TSynCSSyn.SquareOpenProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkSquareOpen;
 end;
 
 procedure TSynCSSyn.StarProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {multiply assign}
       begin
@@ -1610,29 +1635,29 @@ procedure TSynCSSyn.StarProc;
 
 procedure TSynCSSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
-    if FLine[Run] = '\' then begin
-      case FLine[Run + 1] of
+    if fLine[Run] = '\' then begin
+      case fLine[Run + 1] of
         #34, '\':
           Inc(Run);
         #00:
           begin
             Inc(Run);
-            FRange := rsMultilineString;
+            fRange := rsMultilineString;
             Exit;
           end;
       end;
     end;
     Inc(Run);
-  until IsLineEnd(Run) or (FLine[Run] = #34);
+  until IsLineEnd(Run) or (fLine[Run] = #34);
   if FLine[Run] = #34 then
     Inc(Run);
 end;
 
 procedure TSynCSSyn.StringEndProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
 
   case FLine[Run] of
     #0:
@@ -1652,20 +1677,20 @@ procedure TSynCSSyn.StringEndProc;
       end;
   end;
 
-  FRange := rsUnknown;
+  fRange := rsUnknown;
 
   repeat
     case FLine[Run] of
       #0, #10, #13: Break;
       '\':
         begin
-          case FLine[Run + 1] of
+          case fLine[Run + 1] of
             #34, '\':
               Inc(Run);
             #00:
               begin
                 Inc(Run);
-                FRange := rsMultilineString;
+                fRange := rsMultilineString;
                 Exit;
               end;
           end;
@@ -1673,7 +1698,7 @@ procedure TSynCSSyn.StringEndProc;
       #34: Break;
     end;
     Inc(Run);
-  until IsLineEnd(Run) or (FLine[Run] = #34);
+  until IsLineEnd(Run) or (fLine[Run] = #34);
   if FLine[Run] = #34 then
     Inc(Run);
 end;
@@ -1681,14 +1706,14 @@ procedure TSynCSSyn.StringEndProc;
 procedure TSynCSSyn.TildeProc;
 begin
   Inc(Run);                            {bitwise complement}
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
   FExtTokenID := xtkBitComplement;
 end;
 
 procedure TSynCSSyn.XOrSymbolProc;
 begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
+  fTokenID := tkSymbol;
+  Case FLine[Run + 1] of
   	'=':                               {xor assign}
       begin
         Inc(Run, 2);
@@ -1705,21 +1730,21 @@ procedure TSynCSSyn.XOrSymbolProc;
 procedure TSynCSSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynCSSyn.Next;
 begin
-  FAsmStart := False;
-  FTokenPos := Run;
-  case FRange of
+  fAsmStart := False;
+  fTokenPos := Run;
+  case fRange of
     rsAnsiC, rsAnsiCAsm,
     rsAnsiCAsmBlock, rsDirectiveComment: AnsiCProc;
     rsDirective: DirectiveProc;
     rsMultilineString: StringEndProc;
   else
     begin
-      FRange := rsUnknown;
+      fRange := rsUnknown;
       NextProcedure;
     end;
   end;
@@ -1728,7 +1753,7 @@ procedure TSynCSSyn.Next;
 
 procedure TSynCSSyn.NextProcedure;
 begin
-  case FLine[Run] of
+  case fLine[Run] of
     '&': AndSymbolProc;
     #39: AsciiCharProc;
     '@': AtSymbolProc;
@@ -1770,30 +1795,30 @@ procedure TSynCSSyn.NextProcedure;
 function TSynCSSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
     else Result := nil;
   end;
 end;
 
 function TSynCSSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynCSSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 function TSynCSSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
-  if ((FRange = rsAsm) or (FRange = rsAsmBlock)) and not FAsmStart
-    and not (FTokenID in [tkComment, tkSpace, tkNull])
+  Result := fTokenId;
+  if ((fRange = rsAsm) or (fRange = rsAsmBlock)) and not fAsmStart
+    and not (fTokenId in [tkComment, tkSpace, tkNull])
   then
     Result := tkAsm;
 end;
@@ -1805,17 +1830,18 @@ function TSynCSSyn.GetExtTokenID: TxtkTokenKind;
 
 function TSynCSSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  case FTokenID of
-    tkAsm: Result := FAsmAttri;
-    tkComment: Result := FCommentAttri;
-    tkDirective: Result := FDirecAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkUnknown: Result := FInvalidAttri;
+  case fTokenID of
+    tkAsm: Result := fAsmAttri;
+    tkComment: Result := fCommentAttri;
+    tkDirective: Result := fDirecAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkType: Result := fTypeAttri;
+    tkUnknown: Result := fInvalidAttri;
     else Result := nil;
   end;
 end;
@@ -1827,18 +1853,18 @@ function TSynCSSyn.GetTokenKind: Integer;
 
 procedure TSynCSSyn.ResetRange;
 begin
-  FRange:= rsUnknown;
+  fRange:= rsUnknown;
 end;
 
 procedure TSynCSSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 procedure TSynCSSyn.EnumUserSettings(settings: TStrings);
 begin
   { returns the user settings that exist in the registry }
-  with TBetterRegistry.Create do
+  with TRegistry.Create do
   begin
     try
       RootKey := HKEY_LOCAL_MACHINE;
@@ -1860,8 +1886,8 @@ function TSynCSSyn.UseUserSettings(settingIndex: Integer): Boolean;
 // Possible parameter values:
 //   index into TStrings returned by EnumUserSettings
 // Possible return values:
-//   True : settings were read and used
-//   False: problem reading settings or invalid version specified - old settings
+//   true : settings were read and used
+//   false: problem reading settings or invalid version specified - old settings
 //          were preserved
 
   function ReadCPPBSettings(settingIndex: Integer): Boolean;
@@ -1870,27 +1896,26 @@ function TSynCSSyn.UseUserSettings(settingIndex: Integer): Boolean;
 
       function ReadCPPB1(settingTag: string; attri: TSynHighlighterAttributes; name: string): Boolean;
       var
-        i: Integer;
+        I: Integer;
       begin
-        for i := 1 to Length(name) do
-          if name[i] = ' ' then name[i] := '_';
+        for I := 1 to Length(name) do
+          if name[I] = ' ' then name[I] := '_';
         Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
-             '\SOFTWARE\Borland\C++Builder\' + settingTag + '\Highlight', name, True);
+             '\SOFTWARE\Borland\C++Builder\'+settingTag+'\Highlight',name, True);
       end; { ReadCPPB1 }
 
       function ReadCPPB3OrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean;
       begin
         Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
-                 '\Software\Borland\C++Builder\' + settingTag + '\Editor\Highlight',
+                 '\Software\Borland\C++Builder\'+settingTag+'\Editor\Highlight',
                  key, False);
       end; { ReadCPPB3OrMore }
 
     begin { ReadCPPBSetting }
       try
-        if (settingTag[1] = '1') then
-          Result := ReadCPPB1(settingTag,attri,key)
-        else
-          Result := ReadCPPB3OrMore(settingTag,attri,key);
+        if (settingTag[1] = '1')
+          then Result := ReadCPPB1(settingTag,attri,key)
+          else Result := ReadCPPB3OrMore(settingTag,attri,key);
       except
         Result := False;
       end;
@@ -1913,7 +1938,8 @@ function TSynCSSyn.UseUserSettings(settingIndex: Integer): Boolean;
     s := TStringList.Create;
     try
       EnumUserSettings(s);
-      if settingIndex >= s.Count then Result := False
+      if settingIndex >= s.Count then
+        Result := False
       else begin
         tmpStringAttri    := TSynHighlighterAttributes.Create('', '');
         tmpNumberAttri    := TSynHighlighterAttributes.Create('', '');
@@ -1925,40 +1951,40 @@ function TSynCSSyn.UseUserSettings(settingIndex: Integer): Boolean;
         tmpInvalidAttri   := TSynHighlighterAttributes.Create('', '');
         tmpSpaceAttri     := TSynHighlighterAttributes.Create('', '');
         tmpDirecAttri     := TSynHighlighterAttributes.Create('', '');
-        tmpStringAttri    .Assign(FStringAttri);
-        tmpNumberAttri    .Assign(FNumberAttri);
-        tmpKeyAttri       .Assign(FKeyAttri);
-        tmpSymbolAttri    .Assign(FSymbolAttri);
-        tmpAsmAttri       .Assign(FAsmAttri);
-        tmpCommentAttri   .Assign(FCommentAttri);
-        tmpIdentifierAttri.Assign(FIdentifierAttri);
-        tmpInvalidAttri   .Assign(FInvalidAttri);
-        tmpSpaceAttri     .Assign(FSpaceAttri);
-        tmpDirecAttri     .Assign(FDirecAttri);
+        tmpStringAttri    .Assign(fStringAttri);
+        tmpNumberAttri    .Assign(fNumberAttri);
+        tmpKeyAttri       .Assign(fKeyAttri);
+        tmpSymbolAttri    .Assign(fSymbolAttri);
+        tmpAsmAttri       .Assign(fAsmAttri);
+        tmpCommentAttri   .Assign(fCommentAttri);
+        tmpIdentifierAttri.Assign(fIdentifierAttri);
+        tmpInvalidAttri   .Assign(fInvalidAttri);
+        tmpSpaceAttri     .Assign(fSpaceAttri);
+        tmpDirecAttri     .Assign(fDirecAttri);
         if s[settingIndex][1] = '1'
-          then Result := ReadCPPBSetting(s[settingIndex],FAsmAttri,'Plain text')
-          else Result := ReadCPPBSetting(s[settingIndex],FAsmAttri,'Assembler');
+          then Result := ReadCPPBSetting(s[settingIndex],fAsmAttri,'Plain text')
+          else Result := ReadCPPBSetting(s[settingIndex],fAsmAttri,'Assembler');
         Result := Result                                                         and
-                  ReadCPPBSetting(s[settingIndex],FCommentAttri,'Comment')       and
-                  ReadCPPBSetting(s[settingIndex],FIdentifierAttri,'Identifier') and
-                  ReadCPPBSetting(s[settingIndex],FInvalidAttri,'Illegal Char')  and
-                  ReadCPPBSetting(s[settingIndex],FKeyAttri,'Reserved word')     and
-                  ReadCPPBSetting(s[settingIndex],FNumberAttri,'Integer')        and
-                  ReadCPPBSetting(s[settingIndex],FSpaceAttri,'Whitespace')      and
-                  ReadCPPBSetting(s[settingIndex],FStringAttri,'String')         and
-                  ReadCPPBSetting(s[settingIndex],FSymbolAttri,'Symbol')         and
-                  ReadCPPBSetting(s[settingIndex],FDirecAttri,'Preprocessor');
+                  ReadCPPBSetting(s[settingIndex],fCommentAttri,'Comment')       and
+                  ReadCPPBSetting(s[settingIndex],fIdentifierAttri,'Identifier') and
+                  ReadCPPBSetting(s[settingIndex],fInvalidAttri,'Illegal Char')  and 
+                  ReadCPPBSetting(s[settingIndex],fKeyAttri,'Reserved word')     and
+                  ReadCPPBSetting(s[settingIndex],fNumberAttri,'Integer')        and
+                  ReadCPPBSetting(s[settingIndex],fSpaceAttri,'Whitespace')      and
+                  ReadCPPBSetting(s[settingIndex],fStringAttri,'String')         and
+                  ReadCPPBSetting(s[settingIndex],fSymbolAttri,'Symbol')         and
+                  ReadCPPBSetting(s[settingIndex],fDirecAttri,'Preprocessor');
         if not Result then begin
-          FStringAttri    .Assign(tmpStringAttri);
-          FNumberAttri    .Assign(tmpNumberAttri);
-          FKeyAttri       .Assign(tmpKeyAttri);
-          FSymbolAttri    .Assign(tmpSymbolAttri);
-          FAsmAttri       .Assign(tmpAsmAttri);
-          FCommentAttri   .Assign(tmpCommentAttri);
-          FIdentifierAttri.Assign(tmpIdentifierAttri);
-          FInvalidAttri.Assign(tmpInvalidAttri);
-          FSpaceAttri     .Assign(tmpSpaceAttri);
-          FDirecAttri     .Assign(tmpDirecAttri);
+          fStringAttri    .Assign(tmpStringAttri);
+          fNumberAttri    .Assign(tmpNumberAttri);
+          fKeyAttri       .Assign(tmpKeyAttri);
+          fSymbolAttri    .Assign(tmpSymbolAttri);
+          fAsmAttri       .Assign(tmpAsmAttri);
+          fCommentAttri   .Assign(tmpCommentAttri);
+          fIdentifierAttri.Assign(tmpIdentifierAttri);
+          fInvalidAttri.Assign(tmpInvalidAttri);
+          fSpaceAttri     .Assign(tmpSpaceAttri);
+          fDirecAttri     .Assign(tmpDirecAttri);
         end;
         tmpStringAttri    .Free;
         tmpNumberAttri    .Free;
@@ -1978,7 +2004,7 @@ function TSynCSSyn.UseUserSettings(settingIndex: Integer): Boolean;
   Result := ReadCPPBSettings(settingIndex);
 end; { TSynCSSyn.UseUserSettings }
 
-function TSynCSSyn.GetSampleSource: UnicodeString;
+function TSynCSSyn.GetSampleSource: string;
 begin
   Result := '/* Syntax Highlighting */'#13#10 +
 				'int num = 12345;'#13#10 +
@@ -1993,7 +2019,7 @@ class function TSynCSSyn.GetLanguageName: string;
 
 function TSynCSSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterCS;
+  Result := fDefaultFilter <> SYNS_FilterCS;
 end;
 
 class function TSynCSSyn.GetCapabilities: TSynHighlighterCapabilities;
@@ -2001,13 +2027,11 @@ class function TSynCSSyn.GetCapabilities: TSynHighlighterCapabilities;
   Result := inherited GetCapabilities + [hcUserSettings];
 end;
 
-class function TSynCSSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynCSSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangCS;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynCSSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterCache.pas b/Ext/SynEdit/Source/SynHighlighterCache.pas
index 17c4af4..217f4fc 100644
--- a/Ext/SynEdit/Source/SynHighlighterCache.pas
+++ b/Ext/SynEdit/Source/SynHighlighterCache.pas
@@ -27,13 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterCache.pas,v 1.13.2.6 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a Cache object script files highlighter for SynEdit)
@@ -63,7 +56,7 @@ interface
     tkNumber, tkDirective, tkSpace, tkString, tkSymbol, tkIndirect, tkLabel,
     tkMacro, tkUserFunction, tkEmbedSQL, tkEmbedText, tkUnknown);
 
-  TRangeState = (rsUnknown, rsSQL, rsHTML, rsCommand);
+  TRangeState = (rsUnKnown, rsSQL, rsHTML, rsCommand);
 
   PIdentFuncTableFunc = ^TIdentFuncTableFunc;
   TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
@@ -71,27 +64,27 @@ interface
 type
   TSynCacheSyn = class(TSynCustomHighlighter)
   private
-    FBrace: LongInt;
-    FFirstBrace: Boolean;
-    FRange: TRangeState;
+    fBrace: Integer;
+    fFirstBrace: Boolean;
+    fRange: TRangeState;
     FTokenID: TtkTokenKind;
-    FIdentFuncTable: array[0..1996] of TIdentFuncTableFunc;
-    FClassAttri: TSynHighlighterAttributes;
-    FCommentAttri: TSynHighlighterAttributes;
-    FFunctionAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FDirectiveAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FIndirectAttri: TSynHighlighterAttributes;
-    FLabelAttri: TSynHighlighterAttributes;
-    FMacroAttri: TSynHighlighterAttributes;
-    FUserFunctionAttri: TSynHighlighterAttributes;
-    FEmbedSQLAttri: TSynHighlighterAttributes;
-    FEmbedTextAttri: TSynHighlighterAttributes;
+    fIdentFuncTable: array[0..1996] of TIdentFuncTableFunc;
+    fClassAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fFunctionAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fDirectiveAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    fIndirectAttri: TSynHighlighterAttributes;
+    fLabelAttri: TSynHighlighterAttributes;
+    fMacroAttri: TSynHighlighterAttributes;
+    fUserFunctionAttri: TSynHighlighterAttributes;
+    fEmbedSQLAttri: TSynHighlighterAttributes;
+    fEmbedTextAttri: TSynHighlighterAttributes;
     FCanKey: Boolean;    // if true, the next token can be a keyword
     function AltFunc(Index: Integer): TtkTokenKind;
     function KeyWordFunc(Index: Integer): TtkTokenKind;
@@ -118,7 +111,7 @@   TSynCacheSyn = class(TSynCustomHighlighter)
     function IsFilterStored: Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -133,37 +126,37 @@   TSynCacheSyn = class(TSynCustomHighlighter)
     procedure SetRange(Value: Pointer); override;
     procedure ResetRange; override;
   published
-    property ClassAttri: TSynHighlighterAttributes read FClassAttri
-      write FClassAttri;
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property FunctionAttri: TSynHighlighterAttributes read FFunctionAttri
-      write FFunctionAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property PreprocesorAttri: TSynHighlighterAttributes read FDirectiveAttri
-      write FDirectiveAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
-    property IndirectAttri: TSynHighlighterAttributes read FIndirectAttri
-      write FIndirectAttri;
-    property LabelAttri: TSynHighlighterAttributes read FLabelAttri
-      write FLabelAttri;
-    property MacroAttri: TSynHighlighterAttributes read FMacroAttri
-      write FMacroAttri;
+    property ClassAttri: TSynHighlighterAttributes read fClassAttri
+      write fClassAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property FunctionAttri: TSynHighlighterAttributes read fFunctionAttri
+      write fFunctionAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property PreprocesorAttri: TSynHighlighterAttributes read fDirectiveAttri
+      write fDirectiveAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
+    property IndirectAttri: TSynHighlighterAttributes read fIndirectAttri
+      write fIndirectAttri;
+    property LabelAttri: TSynHighlighterAttributes read fLabelAttri
+      write fLabelAttri;
+    property MacroAttri: TSynHighlighterAttributes read fMacroAttri
+      write fMacroAttri;
     property UserFunctionAttri: TSynHighlighterAttributes
-      read FUserFunctionAttri write FUserFunctionAttri;
+      read fUserFunctionAttri write fUserFunctionAttri;
     property EmbededSQLandHTMLAttri: TSynHighlighterAttributes
-      read FEmbedSQLAttri write FEmbedSQLAttri;
-    property EmbededTextAttri: TSynHighlighterAttributes read FEmbedTextAttri
-      write FEmbedTextAttri;
+      read fEmbedSQLAttri write fEmbedSQLAttri;
+    property EmbededTextAttri: TSynHighlighterAttributes read fEmbedTextAttri
+      write fEmbedTextAttri;
   end;
 
 implementation
@@ -172,7 +165,7 @@ implementation
   SynEditStrConst;
 
 const
-  KeyWords: array[0..274] of UnicodeString = (
+  KeyWords: array[0..274] of string = (
     '$a', '$ascii', '$c', '$char', '$d', '$data', '$device', '$e', '$ec', 
     '$ecode', '$es', '$estack', '$et', '$etrap', '$extract', '$f', '$find', 
     '$fn', '$fnumber', '$g', '$get', '$h', '$horolog', '$i', '$in', 
@@ -331,7 +324,7 @@ function TSynCacheSyn.HashKey(Str: PWideChar): Cardinal;
     Inc(Str);
   end;
   Result := Result mod 1997;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -339,28 +332,28 @@ function TSynCacheSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
 
 procedure TSynCacheSyn.InitIdent;
 var
-  i: Integer;
+  I: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
+  for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do
+    if KeyIndices[I] = -1 then
+      fIdentFuncTable[I] := AltFunc;
 
-  FIdentFuncTable[379] := Func38html;
-  FIdentFuncTable[1125] := Func38sql;
+  fIdentFuncTable[379] := Func38html;
+  fIdentFuncTable[1125] := Func38sql;
 
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if @FIdentFuncTable[i] = nil then
-      FIdentFuncTable[i] := KeyWordFunc;
+  for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do
+    if @fIdentFuncTable[I] = nil then
+      fIdentFuncTable[I] := KeyWordFunc;
 end;
 
 function TSynCacheSyn.AltFunc(Index: Integer): TtkTokenKind;
@@ -381,7 +374,7 @@ function TSynCacheSyn.Func38html(Index: Integer): TtkTokenKind;
   if IsCurrentToken(KeyWords[Index]) then
   begin
     Result := tkEmbedSQL;
-    FRange := rsHTML;
+    fRange := rsHTML;
   end
   else
     Result := tkIdentifier;
@@ -392,7 +385,7 @@ function TSynCacheSyn.Func38sql(Index: Integer): TtkTokenKind;
   if IsCurrentToken(KeyWords[Index]) then
   begin
     Result := tkEmbedSQL;
-    FRange := rsSQL;
+    fRange := rsSQL;
   end
   else
     Result := tkIdentifier;
@@ -402,61 +395,61 @@ constructor TSynCacheSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
-
-  FClassAttri := TSynHighlighterAttributes.Create(SYNS_AttrClass, SYNS_FriendlyAttrClass);
-  AddAttribute(FClassAttri);
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  AddAttribute(FCommentAttri);
-  FFunctionAttri := TSynHighlighterAttributes.Create(SYNS_AttrFunction, SYNS_FriendlyAttrFunction);
-  AddAttribute(FFunctionAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-  FDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDir, SYNS_FriendlyAttrDir);
-  AddAttribute(FDirectiveAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
-  FIndirectAttri := TSynHighlighterAttributes.Create(SYNS_AttrIndirect, SYNS_FriendlyAttrIndirect);
-  AddAttribute(FIndirectAttri);
-  FLabelAttri := TSynHighlighterAttributes.Create(SYNS_AttrLabel, SYNS_FriendlyAttrLabel);
-  AddAttribute(FLabelAttri);
-  FMacroAttri := TSynHighlighterAttributes.Create(SYNS_AttrMacro, SYNS_FriendlyAttrMacro);
-  AddAttribute(FMacroAttri);
-  FUserFunctionAttri := TSynHighlighterAttributes.Create(SYNS_AttrUserFunction, SYNS_FriendlyAttrUserFunction);
-  AddAttribute(FUserFunctionAttri);
-  FEmbedSQLAttri := TSynHighlighterAttributes.Create(SYNS_AttrEmbedSQL, SYNS_FriendlyAttrEmbedSQL);
-  AddAttribute(FEmbedSQLAttri);
-  FEmbedTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrEmbedText, SYNS_FriendlyAttrEmbedText);
-  AddAttribute(FEmbedTextAttri);
+  fCaseSensitive := False;
+
+  fClassAttri := TSynHighlighterAttributes.Create(SYNS_AttrClass, SYNS_FriendlyAttrClass);
+  AddAttribute(fClassAttri);
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  AddAttribute(fCommentAttri);
+  fFunctionAttri := TSynHighlighterAttributes.Create(SYNS_AttrFunction, SYNS_FriendlyAttrFunction);
+  AddAttribute(fFunctionAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style := [fsBold];
+  AddAttribute(fKeyAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
+  fDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDir, SYNS_FriendlyAttrDir);
+  AddAttribute(fDirectiveAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
+  fIndirectAttri := TSynHighlighterAttributes.Create(SYNS_AttrIndirect, SYNS_FriendlyAttrIndirect);
+  AddAttribute(fIndirectAttri);
+  fLabelAttri := TSynHighlighterAttributes.Create(SYNS_AttrLabel, SYNS_FriendlyAttrLabel);
+  AddAttribute(fLabelAttri);
+  fMacroAttri := TSynHighlighterAttributes.Create(SYNS_AttrMacro, SYNS_FriendlyAttrMacro);
+  AddAttribute(fMacroAttri);
+  fUserFunctionAttri := TSynHighlighterAttributes.Create(SYNS_AttrUserFunction, SYNS_FriendlyAttrUserFunction);
+  AddAttribute(fUserFunctionAttri);
+  fEmbedSQLAttri := TSynHighlighterAttributes.Create(SYNS_AttrEmbedSQL, SYNS_FriendlyAttrEmbedSQL);
+  AddAttribute(fEmbedSQLAttri);
+  fEmbedTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrEmbedText, SYNS_FriendlyAttrEmbedText);
+  AddAttribute(fEmbedTextAttri);
 
   SetAttributesOnChange(DefHighlightChange);
   InitIdent;
-  FDefaultFilter := SYNS_FilterCache;
-  FRange := rsUnknown;
+  fDefaultFilter := SYNS_FilterCache;
+  fRange := rsUnknown;
 end;
 
 procedure TSynCacheSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run] = #10 then Inc(Run);
+  if fLine[Run] = #10 then Inc(Run);
   FRange := rsUnknown;
 end;
 
 procedure TSynCacheSyn.CommentProc;
 begin
-  FTokenID := tkComment;
-  if FLine[Run+1]=';' then FTokenID := tkEmbedText;
+  fTokenID := tkComment;
+  if FLine[Run+1]=';' then fTokenID := tkEmbedText;
 
   while FLine[Run] <> #0 do  begin
     case FLine[Run] of
@@ -473,40 +466,40 @@ procedure TSynCacheSyn.IdentProc;
 var
   fir: WideChar;
 begin
-  if FTokenPos=0 then FTokenID := tkLabel
+  if FTokenPos=0 then fTokenID := tkLabel
   else begin
     fir := FLine[Run];
-    if fir = '^' then FCanKey := true;
+    if fir = '^' then FCanKey := True;
 
     FRange := rsUnknown;
     if FCanKey then
-      FTokenID := IdentKind(FLine + Run)
+      fTokenID := IdentKind(fLine + Run)
     else
     begin
-      FTokenID := tkIdentifier;
-      while IsIdentChar(FLine[Run]) do Inc(Run);
+      fTokenID := tkIdentifier;
+      while IsIdentChar(fLine[Run]) do Inc(Run);
       Exit;
     end;
     FRange := rsCommand;
-    Inc(Run, FStringLen);
-    if not (IsLineEnd(Run) or CharInSet(FLine[Run], [#32, ':'])) and (fir <> '^') then
+    Inc(Run, fStringLen);
+    if not (IsLineEnd(Run) or CharInSet(fLine[Run], [#32, ':'])) and (fir <> '^') then
     begin
-      FTokenID := tkIdentifier;
+      fTokenID := tkIdentifier;
     end
   end;
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
 end;
 
 procedure TSynCacheSyn.LFProc;
 begin
-  FTokenID := tkSpace;
-  FCanKey := true;
+  fTokenID := tkSpace;
+  FCanKey := True;
   Inc(Run);
 end;
 
 procedure TSynCacheSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -514,7 +507,7 @@ procedure TSynCacheSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', '.', 'e', 'E':
         Result := True;
       else
@@ -523,22 +516,20 @@ procedure TSynCacheSyn.NumberProc;
   end;
 
 begin
-  if (FTokenPos = 0) and CharInSet(FLine[Run], ['0'..'9']) then
+  if (fTokenPos = 0) and CharInSet(FLine[Run], ['0'..'9']) then
   begin
-    FTokenID := tkLabel;
-    while IsIdentChar(FLine[Run]) do Inc(Run);
+    fTokenID := tkLabel;
+    while IsIdentChar(fLine[Run]) do Inc(Run);
     FCanKey := False;
     Exit;
   end;
 
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar do
   begin
     case FLine[Run] of
-      '.':
-        if FLine[Run + 1] = '.' then
-          Break;
+      '.':  if FLine[Run + 1] = '.' then Break;
     end;
     Inc(Run);
   end;
@@ -551,21 +542,20 @@ procedure TSynCacheSyn.SpaceProc;
 begin
   x := Run;
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
-  FCanKey := true;
+  FCanKey := True;
   if FRange = rsCommand then
     FCanKey := (Run - x > 1);
 end;
 
 procedure TSynCacheSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2);
   repeat
     case FLine[Run] of
-      #0, #10, #13:
-        Break;
+      #0, #10, #13: Break;
     end;
     Inc(Run);
   until FLine[Run] = #34;
@@ -576,19 +566,19 @@ procedure TSynCacheSyn.StringProc;
 procedure TSynCacheSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynCacheSyn.Next;
 begin
-  FTokenPos := Run;
+  fTokenPos := Run;
   if FLine[Run] = #0 then NullProc
   else
-    case FRange of
+    case fRange of
       rsSQL,
       rsHTML: EmbeddedProc;
       else
-        case FLine[Run] of
+        case fLine[Run] of
           #13: CRProc;
           ';': CommentProc;
           'A'..'Z', 'a'..'z', '%', '^': IdentProc;
@@ -612,10 +602,10 @@ procedure TSynCacheSyn.Next;
 function TSynCacheSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -623,61 +613,61 @@ function TSynCacheSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttrib
 
 function TSynCacheSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynCacheSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 function TSynCacheSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynCacheSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
   case GetTokenID of
-    tkClass: Result := FClassAttri;
-    tkComment: Result := FCommentAttri;
-    tkFunction: Result := FFunctionAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkDirective: Result := FDirectiveAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkIndirect: Result := FIndirectAttri;
-    tkUnknown: Result := FIdentifierAttri;
-    tkLabel: Result := FLabelAttri;
-    tkMacro: Result := FMacroAttri;
-    tkUserFunction: Result := FUserFunctionAttri;
-    tkEmbedSQL: Result := FEmbedSQLAttri;
-    tkEmbedText: Result := FEmbedTextAttri;
+    tkClass: Result := fClassAttri;
+    tkComment: Result := fCommentAttri;
+    tkFunction: Result := fFunctionAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkDirective: Result := fDirectiveAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkIndirect: Result := fIndirectAttri;
+    tkUnknown: Result := fIdentifierAttri;
+    tkLabel: Result := fLabelAttri;
+    tkMacro: Result := fMacroAttri;
+    tkUserFunction: Result := fUserFunctionAttri;
+    tkEmbedSQL: Result := fEmbedSQLAttri;
+    tkEmbedText: Result := fEmbedTextAttri;
   else Result := nil;
   end;
 end;
 
 function TSynCacheSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
 procedure TSynCacheSyn.ResetRange;
 begin
-  FRange := rsUnknown;
+  fRange := rsUnknown;
 end;
 
 procedure TSynCacheSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 function TSynCacheSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterCache;
+  Result := fDefaultFilter <> SYNS_FilterCache;
 end;
 
 function TSynCacheSyn.IsIdentChar(AChar: WideChar): Boolean;
@@ -700,7 +690,7 @@ class function TSynCacheSyn.GetLanguageName: string;
 //------------------------------------------------------------------------------
 procedure TSynCacheSyn.IndirectProc;
 begin
-  FTokenID := tkIndirect;
+  fTokenID := tkIndirect;
   Inc(Run);
   while IsIdentChar(FLine[Run]) do Inc(Run);
   FRange := rsUnknown;
@@ -711,7 +701,7 @@ procedure TSynCacheSyn.IndirectProc;
 //------------------------------------------------------------------------------
 procedure TSynCacheSyn.SymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
   FRange := rsUnknown;
 end;
@@ -725,19 +715,19 @@ procedure TSynCacheSyn.FuncProc;
 begin
   case FLine[Run] of
     '$': case FLine[Run + 1] of
-           '$': case FLine[Run + 2] of
-                  '$': FTokenID := tkMacro;
-                  else FTokenID := tkUserFunction;
+           '$': case Fline[Run + 2] of
+                  '$': fTokenID := tkMacro;
+                  else fTokenID := tkUserFunction;
                 end;
            else begin
-                  FTokenID := IdentKind((FLine + Run));
-                  Inc(Run, FStringLen);
-                  if FTokenID = tkKey then FTokenID := tkFunction;
+                  fTokenID := IdentKind((fLine + Run));
+                  Inc(Run, fStringLen);
+                  if fTokenID = tkKey then fTokenID := tkFunction;
                 end;
          end;
-    else FTokenID := tkIdentifier;
+    else fTokenID := tkIdentifier;
   end;
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
   FRange := rsUnknown;
 end;
 
@@ -748,25 +738,25 @@ procedure TSynCacheSyn.FuncProc;
 //------------------------------------------------------------------------------
 procedure TSynCacheSyn.DirectiveProc;
 var
-  i: Integer;
+  I: Integer;
 begin
   if FLine[Run + 1] = '#' then
-    FTokenID := tkClass
+    fTokenID := tkClass
   else
   begin
-    for i := FTokenPos downto 0 do
-      if not CharInSet(FLine[i], [#32, '#']) then
+    for I := fTokenPos downto 0 do
+      if not CharInSet(FLine[I], [#32, '#']) then
       begin
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
         Inc(Run);
         Exit;
       end;
 
-    FTokenID := tkDirective
+    fTokenID := tkDirective
   end;
 
   Inc(Run);
-  while IsIdentChar(FLine[Run]) or (FLine[Run] = '#') do Inc(Run);
+  while IsIdentChar(fLine[Run]) or (FLine[Run] = '#') do Inc(Run);
   FRange := rsUnknown;
 end;
 
@@ -777,52 +767,50 @@ procedure TSynCacheSyn.DirectiveProc;
 //------------------------------------------------------------------------------
 procedure TSynCacheSyn.EmbeddedProc;
 begin
-  case FRange of
+  case fRange of
     rsUnknown, rsCommand: begin
-                 FTokenID := IdentKind( (FLine + Run) );
-                 if FTokenID <> tkEmbedSQL then begin
-                   FTokenID := tkSymbol;
+                 fTokenID := IdentKind( (fLine + Run) );
+                 if fTokenID <> tkEmbedSQL then begin
+                   fTokenID := tkSymbol;
                    Inc( Run );
                  end else begin
-                   FBrace := 1;
-                   FFirstBrace := true;
-                   Inc( Run, FStringLen );
+                   fBrace := 1;
+                   fFirstBrace := True;
+                   Inc( Run, fStringLen );
                  end;
                end;
     rsSQL: begin
-             FTokenID := tkEmbedSQL;
-             while (FLine[Run] <> #0) and (FBrace<>0) do begin
+             fTokenID := tkEmbedSQL;
+             while (FLine[Run] <> #0) and (fBrace<>0) do begin
                case FLine[Run] of
-                 '(': if not FFirstBrace then Inc(FBrace)
-                      else FFirstBrace := False;
-                 ')': Dec(FBrace);
+                 '(': if not fFirstBrace then Inc(fBrace)
+                      else fFirstBrace := False;
+                 ')': Dec(fBrace);
                end;
                Inc(Run);
              end;
-             if FBrace = 0 then FRange := rsUnknown;
+             if fBrace=0 then fRange := rsUnknown;
            end;
     rsHTML: begin
-              FTokenID := tkEmbedSQL;
-              while (FLine[Run] <> #0) and (FBrace<>0) do begin
+              fTokenID := tkEmbedSQL;
+              while (FLine[Run] <> #0) and (fBrace<>0) do begin
                 case FLine[Run] of
-                  '<': if not FFirstBrace then Inc(FBrace)
-                       else FFirstBrace := False;
-                  '>': Dec(FBrace);
+                  '<': if not fFirstBrace then Inc(fBrace)
+                       else fFirstBrace := False;
+                  '>': Dec(fBrace);
                 end;
                 Inc(Run);
               end;
-              if FBrace = 0 then FRange := rsUnknown;
+              if fBrace=0 then fRange := rsUnknown;
             end;
   end;
 end;
 
-class function TSynCacheSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynCacheSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangCache;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynCacheSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterCobol.pas b/Ext/SynEdit/Source/SynHighlighterCobol.pas
index 91e2b4b..477c4d2 100644
--- a/Ext/SynEdit/Source/SynHighlighterCobol.pas
+++ b/Ext/SynEdit/Source/SynHighlighterCobol.pas
@@ -28,12 +28,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterCobol.pas,v 1.5.2.7 2008/09/14 16:24:59 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
 -------------------------------------------------------------------------------}
 
 unit SynHighlighterCobol;
@@ -43,28 +37,31 @@
 interface
 
 uses
-  Graphics,
+  System.SysUtils,
+  System.Classes,
+  System.Generics.Defaults,
+  System.Generics.Collections,
+  Vcl.Graphics,
   SynEditTypes,
   SynEditHighlighter,
-  SynHighlighterHashEntries,
-  SynUnicode,
-  SysUtils,
-  Classes;
+  System.RegularExpressions,
+  SynEditCodeFolding;
 
 type
   TtkTokenKind = (
+    tkBracket,
+    tkKey,
+    tkIndicator,
     tkComment,
     tkIdentifier,
     tkAIdentifier,
     tkPreprocessor,
-    tkKey,
     tkBoolean,
     tkNull,
     tkNumber,
     tkSpace,
     tkString,
     tkSequence,
-    tkIndicator,
     tkTagArea,
     tkDebugLines,
     tkUnknown);
@@ -72,35 +69,38 @@ interface
   TRangeState = (rsUnknown,
                  rsQuoteString, rsApostString,
                  rsPseudoText,
-                 rsQuoteStringMayBe, rsApostStringMayBe);
+                 rsQuoteStringMayBe, rsApostStringMayBe,
+                 rsComment, rsDebug);
 
 type
-  TSynCobolSyn = class(TSynCustomHighlighter)
+  TSynCobolSyn = class(TSynCustomCodeFoldingHighlighter)
   private
-    FRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    FIndicator: WideChar;
-
-    FCodeStartPos: LongInt;
-    FCodeMediumPos: LongInt;
-    FCodeEndPos: LongInt;
-
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FAIdentifierAttri: TSynHighlighterAttributes;
-    FPreprocessorAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FBooleanAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSequenceAttri: TSynHighlighterAttributes;
-    FIndicatorAttri: TSynHighlighterAttributes;
-    FTagAreaAttri: TSynHighlighterAttributes;
-    FDebugLinesAttri: TSynHighlighterAttributes;
-    FKeywords: TSynHashEntryList;
-    procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
-    function HashKey(Str: PWideChar): Integer;
+    fRange: TRangeState;
+    fTokenID: TtkTokenKind;
+    fIndicator: WideChar;
+
+    fCodeStartPos: Integer;
+    fCodeMediumPos: Integer;
+    fCodeEndPos: Integer;
+
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fAIdentifierAttri: TSynHighlighterAttributes;
+    fPreprocessorAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fBooleanAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSequenceAttri: TSynHighlighterAttributes;
+    fIndicatorAttri: TSynHighlighterAttributes;
+    fTagAreaAttri: TSynHighlighterAttributes;
+    fDebugLinesAttri: TSynHighlighterAttributes;
+    fBracketAttri: TSynHighlighterAttributes;
+    FKeywords: TDictionary;
+    RE_BlockBegin: TRegEx;
+    RE_BlockEnd: TRegEx;
+    procedure DoAddKeyword(AKeyword: string; AKind: Integer);
     function IdentKind(MayBe: PWideChar): TtkTokenKind;
     procedure IdentProc;
     procedure UnknownProc;
@@ -116,20 +116,22 @@   TSynCobolSyn = class(TSynCustomHighlighter)
     procedure FirstCharsProc;
     procedure LastCharsProc;
     procedure CommentProc;
+    procedure InlineCommentProc;
     procedure DebugProc;
+    procedure BracketProc;
   protected
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     function IsFilterStored: Boolean; override;
     procedure NextProcedure;
 
-    procedure SetCodeStartPos(Value: LongInt);
-    procedure SetCodeMediumPos(Value: LongInt);
-    procedure SetCodeEndPos(Value: LongInt);
+    procedure SetCodeStartPos(Value: Integer);
+    procedure SetCodeMediumPos(Value: Integer);
+    procedure SetCodeEndPos(Value: Integer);
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
     function GetRange: Pointer; override;
     procedure ResetRange; override;
     procedure SetRange(Value: Pointer); override;
@@ -140,219 +142,290 @@   TSynCobolSyn = class(TSynCustomHighlighter)
     function GetTokenKind: Integer; override;
     function IsIdentChar(AChar: WideChar): Boolean; override;
     procedure Next; override;
+//++ CodeFolding
+    procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges;
+      LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override;
+//-- CodeFolding
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri;
-    property AreaAIdentifierAttri: TSynHighlighterAttributes read FAIdentifierAttri write FAIdentifierAttri;
-    property PreprocessorAttri: TSynHighlighterAttributes read FPreprocessorAttri write FPreprocessorAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri;
-    property BooleanAttri: TSynHighlighterAttributes read FBooleanAttri write FBooleanAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri;
-    property SequenceAttri: TSynHighlighterAttributes read FSequenceAttri write FSequenceAttri;
-    property IndicatorAttri: TSynHighlighterAttributes read FIndicatorAttri write FIndicatorAttri;
-    property TagAreaAttri: TSynHighlighterAttributes read FTagAreaAttri write FTagAreaAttri;
-    property DebugLinesAttri: TSynHighlighterAttributes read FDebugLinesAttri write FDebugLinesAttri;
-
-    property AreaAStartPos: LongInt read FCodeStartPos write SetCodeStartPos;
-    property AreaBStartPos: LongInt read FCodeMediumPos write SetCodeMediumPos;
-    property CodeEndPos: LongInt read FCodeEndPos write SetCodeEndPos;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri;
+    property AreaAIdentifierAttri: TSynHighlighterAttributes read fAIdentifierAttri write fAIdentifierAttri;
+    property PreprocessorAttri: TSynHighlighterAttributes read fPreprocessorAttri write fPreprocessorAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri;
+    property BooleanAttri: TSynHighlighterAttributes read fBooleanAttri write fBooleanAttri;
+    property BracketAttri: TSynHighlighterAttributes read fBracketAttri write fBracketAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri;
+    property SequenceAttri: TSynHighlighterAttributes read fSequenceAttri write fSequenceAttri;
+    property IndicatorAttri: TSynHighlighterAttributes read fIndicatorAttri write fIndicatorAttri;
+    property TagAreaAttri: TSynHighlighterAttributes read fTagAreaAttri write fTagAreaAttri;
+    property DebugLinesAttri: TSynHighlighterAttributes read fDebugLinesAttri write fDebugLinesAttri;
+
+    property AreaAStartPos: Integer read fCodeStartPos write SetCodeStartPos;
+    property AreaBStartPos: Integer read fCodeMediumPos write SetCodeMediumPos;
+    property CodeEndPos: Integer read fCodeEndPos write SetCodeEndPos;
   end;
 
 implementation
 
 uses
+  SynEditMiscProcs,
   SynEditStrConst;
 
 const
-  BooleanWords: UnicodeString =
+  BooleanWords: string =
     'false, true';
 
-  KeyWords: UnicodeString =
-    'accept, access, acquire, add, address, advancing, after, all, allowing, ' +
-    'alphabet, alphabetic, alphabetic-lower, alphabetic-upper, alphanumeric, ' +
-    'alphanumeric-edited, also, alter, alternate, and, any, apply, are, ' +
-    'area, areas, area-value, arithmetic, ascending, assign, at, author, ' +
-    'auto, automatic, auto-skip, background-color, background-colour, ' +
-    'backward, b-and, beep, before, beginning, bell, b-exor, binary, bit, ' +
-    'bits, blank, b-less, blink, block, b-not, boolean, b-or, bottom, by, ' +
-    'call, cancel, cd, cf, ch, chain, chaining, changed, character, ' +
-    'characters, class, clock-units, close, cobol, code, code-set, col, ' +
-    'collating, color, column, comma, command-line, commit, commitment, ' +
-    'common, communication, comp, comp-0, comp-1, comp-2, comp-3, comp-4, ' +
-    'comp-5, comp-6, comp-7, comp-8, comp-9, computational, computational-0, ' +
-    'computational-1, computational-2, computational-3, computational-4, ' +
-    'computational-5, computational-6, computational-7, computational-8, ' +
-    'computational-9, computational-x, compute, comp-x, com-reg, ' +
-    'configuration, connect, console, contained, contains, content, ' +
-    'continue, control-area, controls, converting, corr, corresponding, ' +
-    'count, crt, crt-under, currency, current, cursor, cycle, data, date, ' +
-    'date-compiled, date-written, day, day-of-week, db, ' +
-    'db-access-control-key, dbcs, db-data-name, db-exception, ' +
-    'db-format-name, db-record-name, db-set-name, db-status, de, ' +
-    'debug-contents, debugging, debug-item, debug-line, debug-name, ' +
-    'debug-sub-1, debug-sub-2, debug-sub-3, decimal-point, declaratives, ' +
-    'default, delimited, delimiter, depending, descending, destination, ' +
-    'detail, disable, disconnect, disk, display, display-1, display-2, ' +
-    'display-3, display-4, display-5, display-6, display-7, display-8, ' +
-    'display-9, divide, division, down, drop, duplicate, duplicates, ' +
-    'dynamic, egcs, egi, else, emi, empty, empty-check, enable, end, ' +
-    'end-accept, end-add, end-call, end-compute, end-delete, end-disable, ' +
-    'end-divide, end-enable, end-evaluate, end-if, ending, end-multiply, ' +
-    'end-of-page, end-perform, end-read, end-receive, end-return, ' +
-    'end-rewrite, end-search, end-send, end-start, end-string, end-subtract, ' +
-    'end-transceive, end-unstring, end-write, enter, entry, environment, ' +
-    'eop, equal, equals, erase, error, escape, esi, evaluate, every, exact, ' +
-    'exceeds, exception, excess-3, exclusive, exec, execute, exhibit, exit, ' +
-    'extend, external, externally-described-key, fd, fetch, file, ' +
-    'file-control, file-id, filler, final, find, finish, first, fixed, ' +
-    'footing, for, foreground-color, foreground-colour, form, format, free, ' +
-    'from, full, function, generate, get, giving, global, go, goback, ' +
-    'greater, group, heading, highlight, id, identification, if, in, index, ' +
-    'index-1, index-2, index-3, index-4, index-5, index-6, index-7, index-8, ' +
-    'index-9, indexed, indic, indicate, indicator, indicators, initial, ' +
-    'initialize, initiate, input, input-output, inspect, installation, into, ' +
-    'invalid, i-o, i-o-control, is, japanese, just, justified, kanji, keep, ' +
-    'kept, key, keyboard, last, ld, leading, left, left-justify, length, ' +
-    'length-check, less, like, limit, limits, linage, linage-counter, line, ' +
-    'line-counter, lines, linkage, locally, lock, manual, member, memory, ' +
-    'merge, message, mode, modified, modify, modules, more-labels, move, ' +
-    'multiple, multiply, name, native, negative, next, no, no-echo, none, ' +
-    'normal, not, number, numeric, numeric-edited, object-computer, occurs, ' +
-    'of, off, omitted, on, only, open, optional, or, order, organization, ' +
-    'other, output, overflow, owner, packed-decimal, padding, page, ' +
-    'page-counter, palette, paragraph, password, perform, pf, ph, pic, ' +
-    'picture, plus, pointer, position, positive, present, previous, printer, ' +
-    'printer-1, printing, print-switch, prior, procedure, procedures, ' +
-    'proceed, process, processing, program, program-id, prompt, protected, ' +
-    'purge, queue, random, range, rd, read, realm, receive, reconnect, ' +
-    'record, recording, record-name, records, redefines, reel, reference, ' +
-    'references, relation, relative, release, remainder, removal, renames, ' +
-    'repeated, replacing, report, reporting, reports, required, rerun, ' +
-    'reserve, retaining, retrieval, return, return-code, reversed, ' +
-    'reverse-video, rewind, rewrite, rf, rh, right, right-justify, rollback, ' +
-    'rolling, rounded, run, same, screen, sd, search, section, secure, ' +
-    'security, segment, segment-limit, select, send, sentence, separate, ' +
-    'sequence, sequential, session-id, set, shared, shift-in, shift-out, ' +
-    'sign, size, sort, sort-control, sort-core-size, sort-file-size, ' +
-    'sort-merge, sort-message, sort-mode-size, sort-return, source, ' +
-    'source-computer, space-fill, special-names, standard, standard-1, ' +
-    'standard-2, standard-3, standard-4, start, starting, status, stop, ' +
-    'store, string, subfile, subprogram, sub-queue-1, sub-queue-2, ' +
-    'sub-queue-3, sub-schema, subtract, sum, suppress, switch, switch-1, ' +
-    'switch-2, switch-3, switch-4, switch-5, switch-6, switch-7, switch-8, ' +
-    'symbolic, sync, synchronized, table, tally, tallying, tape, tenant, ' +
-    'terminal, terminate, test, text, than, then, through, thru, time, ' +
-    'timeout, times, to, top, trailing, trailing-sign, transaction, ' +
-    'transceive, type, underline, unequal, unit, unlock, unstring, until, ' +
-    'up, update, upon, usage, usage-mode, user, using, valid, validate, ' +
-    'value, values, variable, varying, wait, when, when-compiled, with, ' +
-    'within, words, working-storage, write, write-only, zero-fill';
-
-  PreprocessorWords: UnicodeString =
-    'basis, cbl, control, copy, delete, eject, insert, ready, reload, ' +
-    'replace, reset, service, skip1, skip2, skip3, title, trace, use';
-
-  StringWords: UnicodeString =
-    'high-value, high-values, low-value, low-values, null, nulls, quote, ' +
-    'quotes, space, spaces, zero, zeroes, zeros';
+  KeyWords: string =
+	'3d, absent, abstract, accept, access, acquire, action, action-copy, ' +
+	'action-current-page, action-cut, action-delete, action-first-page, ' +
+	'action-hide-drag, action-last-page, action-next, action-next-page, ' +
+	'action-paste, action-previous, action-previous-page, action-undo, active-class, ' +
+	'actual, add, address, adjustable-columns, advancing, afp-5a, after, aligned, ' +
+	'alignment, all, allocate, allow, allowing, alphabet, alphabetic, ' +
+	'alphabetic-lower, alphabetic-upper, alphanumeric, alphanumeric-edited, also, ' +
+	'alter, alternate, and, any, apply, are, area, areas, area-value, arithmetic, ' +
+	'as, ascending, assembly-attributes, assembly-name, assign, at, attribute, ' +
+	'attributes, author, auto, auto-decimal, auto-hyphen-skip, automatic, ' +
+	'auto-minimize, auto-resize, auto-skip, auto-spin, autoterminate, ' +
+	'background-color, background-colour, background-high, background-low, ' +
+	'background-standard, backward, b-and, bar, based, beep, before, beginning, ' +
+	'bell, b-exor, binary, binary-double, binary-char, binary-long, binary-short, ' +
+	'bind, bit, bitmap, bitmap-end, bitmap-frame, bitmap-handle, bitmap-load, ' +
+	'bitmap-number, bitmap-start, bitmap-timer, bitmap-trailing, bitmap-width, bits, ' +
+	'blank, b-left, b-less, blink, blinking, blob, blob-file, blob-locator, block, ' +
+	'b-not, bold, boolean, b-or, bottom, box, boxed, b-right, browser, browsing, ' +
+	'bulk-addition, busy, buttons, b-xor, by, c01, c02, c03, c04, c05, c06, c07, ' +
+	'c08, c09, c10, c11, c12, calendar-font, call, called, cancel, cancel-button, ' +
+	'card-punch, card-reader, case, cassette, catch, cbl-ctr, ccol, cd, cell, ' +
+	'cell-color, cell-data, cell-font, cell-protection, cells, center, centered, ' +
+	'centered-headings, century-date, century-day, cf, class, class-attributes, ' +
+	'class-control, class-id, class-name, class-object, clear-selection, cline, ' +
+	'clines, clob, clob-file, clob-locator, clock-units, close, cobol, code, ' +
+	'code-set, coercion, col, collating, color, colors, colour, cols, column, ' +
+	'column-color, column-dividers, column-font, column-headings, column-protection, ' +
+	'columns, combo-box, comma, command-line, commit, commitment, common, ' +
+	'communication, comp, comp-0, comp-1, comp-2, comp-3, comp-4, comp-5, comp-6, ' +
+	'comp-7, comp-8, comp-9, comp-n, compression, computational, computational-0, ' +
+	'computational-1, computational-2, computational-3, computational-4, ' +
+	'computational-5, computational-6, computational-7, computational-8, ' +
+	'computational-9, computational-n, computational-x, compute, comp-x, com-reg, ' +
+	'condition-value, configuration, connect, console, constant, constrain, ' +
+	'constraints, constructor, contained, contains, content, continue, control-area, ' +
+	'controls, conversion, convert, converting, copy-selection, core-index, corr, ' +
+	'corresponding, count, create, creating, crt, crt-under, csize, csp, culture, ' +
+	'currency, current, current-date, cursor, cursor-col, cursor-color, ' +
+	'cursor-frame-width, cursor-row, cursor-x, cursor-y, custom-attribute, ' +
+	'custom-print-template, cycle, cyl-index, cyl-overflow, dashed, data, ' +
+	'database-key, database-key-long, data-columns, data-pointer, date, ' +
+	'date-and-time, date-compiled, date-entry, date-record, date-written, ' +
+	'davf-hhmmss, davf-hhmmsshh, davf-yymmdd, davf-yyyymmdd, davf-yyyymmddhhmmsshh, ' +
+	'day, day-and-time, day-of-week, db, db-access-control-key, dbclob, dbclob-file, ' +
+	'dbclob-locator, dbcs, db-data-name, db-exception, db-format-name, ' +
+	'db-record-name, db-set-name, db-status, dd, de, debug, debug-contents, ' +
+	'debugging, debug-item, debug-line, debug-name, debug-sub-1, debug-sub-2, ' +
+	'debug-sub-3, decimal, decimal-point, declaratives, default, default-button, ' +
+	'definition, delegate, delegate-id, delimited, delimiter, depending, descending, ' +
+	'descriptor, destination, destroy, detail, disable, disc, disconnect, ' +
+	'disjoining, disk, disp, display, display-1, display-2, display-3, display-4, ' +
+	'display-5, display-6, display-7, display-8, display-9, display-columns, ' +
+	'display-format, display-st, divide, divider-color, dividers, division, ' +
+	'dot-dash, dotted, double, down, drag-color, draw, drop, drop-down, drop-list, ' +
+	'duplicate, duplicates, dynamic, ebcdic, egcs, egi, echo, element, else, emi, ' +
+	'empty, empty-check, enable, enabled, encoding, encryption, end, end-accept, ' +
+	'end-add, end-call, end-compute, end-delete, end-disable, end-display, ' +
+	'end-divide, end-enable, end-evaluate, end-exec, end-chain, endif, end-if, ' +
+	'ending, end-invoke, end-modify, end-move, end-multiply, end-of-page, ' +
+	'end-perform, end-read, end-receive, end-return, end-rewrite, end-search, ' +
+	'end-send, end-set, end-start, end-string, end-subtract, end-transceive, ' +
+	'end-try, end-unstring, end-use, end-wait, end-write, end-xml, engraved, ' +
+	'ensure-visible, enter, entry, entry-field, entry-reason, enum, enum-id, ' +
+	'environment, environment-name, environment-value, eol, eop, eos, equal, equals, ' +
+	'error, escape, escape-button, esi, evaluate, event, event-action-fail, ' +
+	'event-pointer, event-type, every, exact, examine, exceeds, exception, ' +
+	'exception-object, exception-value, excess-3, exclusive, exec, execute, exhibit, ' +
+	'exit, exit-pushed, expand, expands, extend, extended, extended-search, ' +
+	'external, external-form, externally-described-key, f, factory, fd, fetch, ' +
+	'fh--fcd, fh--keydef, file, file-control, file-id, file-name, file-path, ' +
+	'file-pos, file-prefix, fill-color, fill-color2, filler, fill-percent, final, ' +
+	'finally, find, finish, finish-reason, first, fixed, flat, flat-buttons, float, ' +
+	'float-extended, floating, float-long, float-short, font, footing, for, ' +
+	'foreground-color, foreground-colour, forever, form, format, frame, framed, ' +
+	'free, from, full, full-height, function, function-id, function-pointer, ' +
+	'generate, get, giving, global, go, goback, go-back, goforward, go-forward, ' +
+	'gohome, go-home, gosearch, go-search, graphical, grdsrch-found, ' +
+	'grdsrch-not-found, grdsrch-wrapped, greater, grid, grid-searchall, ' +
+	'grid-searchcolumn, grid-searchforwards, grid-searchhidden, grid-searchignore, ' +
+	'grid-searchmatch, grid-searchmoves, grid-searchskip, grid-searchvisible, ' +
+	'grid-searchwrap, grip, group, group-usage, group-value, handle, has-childen, ' +
+	'heading, heading-color, heading-divider-color, heading-font, headings, heavy, ' +
+	'height, help-id, hidden-data, high, high-color, highlight, horizontal, ' +
+	'hot-track, hscroll, hscroll-pos, ch, chain, chaining, changed, char, character, ' +
+	'characters, chart, char-varying, check-box, checked, checking, icon, id, ' +
+	'identification, identified, if, ignore, ignoring, implements, in, include, ' +
+	'independent, index, index-1, index-2, index-3, index-4, index-5, index-6, ' +
+	'index-7, index-8, index-9, indexed, indic, indicate, indicator, indicators, ' +
+	'inheriting, inherits, initial, initialize, initialized, initiate, input, ' +
+	'input-output, inquire, insertion-index, insert-rows, inspect, installation, ' +
+	'instance, interface, interface-id, internal, into, intrinsic, invalid, invoke, ' +
+	'invoked, i-o, i-o-control, is, item, item-text, item-to-add, item-to-delete, ' +
+	'item-to-empty, item-value, japanese, jcllib, job, joining, just, justified, ' +
+	'kanji, keep, kept, key, keyboard, key-yy, label, label-offset, last, last-row, ' +
+	'layout-data, layout-manager, ld, leading, leading-shift, leave, left, ' +
+	'left-justify, leftline, left-text, length, length-check, less, like, lin, ' +
+	'linage, linage-counter, line, line-counter, lines, lines-at-root, link, ' +
+	'linkage, list-box, locale, locally, local-storage, lock, lock-holding, locking, ' +
+	'long-date, long-varbinary, long-varchar, low, low-color, lower, lowered, ' +
+	'lowlight, magnetic-tape, manual, mass-update, master-index, max-lines, ' +
+	'max-text, max-val, max-value, member, memory, menu, merge, message, messages, ' +
+	'metaclass, method, method-id, methods, min-val, min-value, mixed, modal, mode, ' +
+	'modeless, modified, modify, modless, module, modules, monitor-pointer, ' +
+	'more-labels, move, msg-begin-entry, multiline, multiple, multiply, multline, ' +
+	'mutex-pointer, name, named, namespace, namespace-prefix, national, ' +
+	'national-edited, native, navigate, negative, nested, new, newable, next, ' +
+	'next-item, nextpage, nchar, no, no-auto-default, no-autosel, no-box, ' +
+	'no-dividers, no-echo, no-f4, no-focus, no-group-tab, no-key-letter, nominal, ' +
+	'none, nonnumeric, normal, no-search, not, no-tab, note, notify, ' +
+	'notify-dblclick, notify-change, notify-selchange, no-updown, nstd-reels, null, ' +
+	'nulls, number, num-col-headings, num-columns, numeric, numeric-edited, ' +
+	'numeric-fill, num-rows, object, object-computer, object-id, object-reference, ' +
+	'object-storage, occurs, of, off, o-fill, ok-button, omitted, on, only, ' +
+	'oostackptr, open, operator, operator-id, optional, options, or, order, ' +
+	'organization, other, others, otherwise, output, overflow, overlapped, overline, ' +
+	'override, owner, packed-decimal, padding, page, page-counter, paged, ' +
+	'paged-at-end, paged-at-start, paged-empty, page-setup, page-size, palette, ' +
+	'panel-index, panel-style, panel-text, panel-widht, paragraph, parse, partial, ' +
+	'password, pend, perform, pf, ph, pic, picture, pixel, pixels, placement, ' +
+	'pl-sort-default, pl-sort-native, pl-sort-native-ignore-case, pl-sort-none, ' +
+	'plus, pointer, pop-up, pos, position, positioning, position-shift, positive, ' +
+	'prefixing, present, previous, print, print-control, printer, printer-1, ' +
+	'printing, print-no-prompt, print-preview, print-switch, prior, priority, ' +
+	'private, proc, procedure, procedure-pointer, procedures, proceed, process, ' +
+	'processing, profile, program, program-id, program-pointer, prompt, properties, ' +
+	'property, protected, prototype, public, purge, push-button, query-index, queue, ' +
+	'quote, quotes, radio-button, raise, raised, raising, random, range, rd, read, ' +
+	'readers, reading, read-only, realm, receive, reconnect, record, record-data, ' +
+	'recording, record-name, record-overflow, record-position, records, ' +
+	'record-to-add, record-to-delete, recover, recovery, recursive, redefine, ' +
+	'redefines, redefinition, reel, reference, references, refresh, region-color, ' +
+	'relation, relative, release, remainder, remarks, removal, renames, ' +
+	'reorg-criteria, repeated, replacing, report, reporting, reports, repository, ' +
+	'required, reread, rerun, reserve, reset, reset-grid, reset-list, reset-tabs, ' +
+	'resident, resizable, resource, restricted, result-set-locator, resume, ' +
+	'retaining, retrieval, retry, return, return-code, returning, return-unsigned, ' +
+	'reverse, reversed, reverse-video, rewind, rewrite, rf, rh, right, right-align, ' +
+	'right-justify, right-text, rimmed, rollback, rolling, rounded, row-color, ' +
+	'row-color-pattern, row-dividers, row-font, row-headings, rowid, row-protection, ' +
+	'run, s, s01, s02, s03, s04, s05, same, save-as, save-as-no-prompt, screen, ' +
+	'scroll, scroll-bar, sd, search, search-options, search-text, seconds, section, ' +
+	'secure, security, seek, segment, segment-limit, select, select-all, ' +
+	'selection-index, selection-text, selective, self, self-act, selfclass, ' +
+	'semaphore-pointer, send, sentence, separate, separation, separator, sequence, ' +
+	'sequential, session-id, set, shading, shadow, shared, sharing, shift-in, ' +
+	'shift-out, short-date, show-lines, show-none, show-sel-always, sign, signed, ' +
+	'signed-int, signed-long, signed-short, singleline, size, solid, sort, ' +
+	'sort-control, sort-core-size, sort-file-size, sort-merge, sort-message, ' +
+	'sort-mode-size, sort-option, sort-order, sort-return, sort-tape, sort-tapes, ' +
+	'sort-work, source, source-computer, sources, space-fill, special-names, ' +
+	'spinner, sql, square, standard, standard-1, standard-2, standard-3, standard-4, ' +
+	'start, starting, start-x, start-y, static, static-list, status, status-bar, ' +
+	'step, stop, stop-browser, store, string, strong, strong-name, style, subfile, ' +
+	'subprogram, sub-queue-1, sub-queue-2, sub-queue-3, sub-schema, subtract, ' +
+	'subwindow, suffixing, sum, super, suppress, switch, switch-1, switch-2, ' +
+	'switch-3, switch-4, switch-5, switch-6, switch-7, switch-8, symbol, symbolic, ' +
+	'sync, synchronized, sysin, sysipt, syslist, syslst, sysout, syspch, syspunch, ' +
+	'system, system-default, system-info, tab, table, tabs, tab-to-add, ' +
+	'tab-to-delete, tally, tallying, tape, tapes, tenant, terminal, terminal-info, ' +
+	'terminate, termination, termination-value, test, text, than, then, thread, ' +
+	'thread-local, thread-local-storage, thread-pointer, threads, through, thru, ' +
+	'thumb-position, tiled-headings, time, time-of-day, timeout, time-out, ' +
+	'time-record, times, timestamp, timestamp-offset, timestamp-offset-record, ' +
+	'timestamp-record, title, title-bar, title-position, to, tool-bar, top, totaled, ' +
+	'totaling, trace, track-area, track-limit, tracks, track-thumb, trailing, ' +
+	'trailing-shift, trailing-sign, transaction, transaction-status, transceive, ' +
+	'transform, transparent, transparent-color, tree-view, try, tvni-first-visible, ' +
+	'tvni-child, tvni-next, tvni-next-visible, tvni-parent, tvni-previous, ' +
+	'tvni-previous-visible, tvni-root, tvplace-first, tvplace-last, tvplace-sort, ' +
+	'type, typedef, u, ucs-4, unbounded, underline, underlined, unequal, unframed, ' +
+	'unit, units, universal, unlock, unsigned, unsigned-int, unsigned-long, ' +
+	'unsigned-short, unsorted, unstring, until, up, update, updaters, upon, upper, ' +
+	'upsi-0, upsi-1, upsi-2, upsi-3, upsi-4, upsi-5, upsi-6, upsi-7, usage, ' +
+	'usage-mode, use, user, user-default, use-return, use-tab, using, utf-16, utf-8, ' +
+	'v, valid, validate, validating, value, value-default, value-format, ' +
+	'value-multiple, value-picture, valuetype, valuetype-id, value-variable, ' +
+	'varbinary, variable, varying, version, vertical, very-heavy, virtual-width, ' +
+	'visible, vpadding, vscroll, vscroll-bar, vscrool-pos, vtop, wait, when, ' +
+	'when-compiled, wide, width, window, with, within, words, working-storage, wrap, ' +
+	'write, write-only, writers, write-verify, writing, xml, xml-code, ' +
+	'xml-declaration, xml-event, xml-ntext, xml-schema, xml-text, yyyyddd, yyyymmdd, ' +
+	'zero-fill';
+  PreprocessorWords: string =
+    'basis, cbl, control, copy, delete, eject, erase,  ready, reload, ' +
+    'replace, skip1, skip2, skip3';
+
+  StringWords: string =
+    'file-limit, file-limits, high-value, high-values, limit, limits, low-value, low-values, ' +
+    'space, spaces, values, zero, zeroes, zeros';
 
   // Ambigious means that a simple string comparision is not enough
-  AmbigiousWords: UnicodeString =
-    'label';
+  AmbigiousWords: string =
+    '';
 
 const
-  StringChars: array[TRangeState] of WideChar = (#0, '"', '''', '=',  '"', '''');
-
-procedure TSynCobolSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
-var
-  HashValue: Integer;
-begin
-  HashValue := HashKey(PWideChar(AKeyword));
-  FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
-end;
-
-function TSynCobolSyn.HashKey(Str: PWideChar): Integer;
-var
-  InternalRun: LongInt;
-
-  function GetOrd: Integer;
-  begin
-    case Str^ of
-      'a'..'z': Result := 1 + Ord(Str^) - Ord('a');
-      'A'..'Z': Result := 1 + Ord(Str^) - Ord('A');
-      '0'..'9': Result := 28 + Ord(Str^) - Ord('0');
-      '-': Result := 27;
-      else Result := 0;
-    end
-  end;
+  StringChars: array[TRangeState] of WideChar = (#0, '"', '''', '=',  '"', '''', #0, #0);
 
+procedure TSynCobolSyn.DoAddKeyword(AKeyword: string; AKind: Integer);
 begin
-  InternalRun := Run;
-  Result := 0;
-
-  while IsIdentChar(Str^) and (InternalRun <= FCodeEndPos) do
-  begin
-{$IFOPT Q-}
-    Result := 7 * Result + GetOrd;
-{$ELSE}
-    Result := (7 * Result + GetOrd) and $FFFFFF;
-{$ENDIF}
-    Inc(Str);
-    Inc(InternalRun);
-  end;
-
-  Result := Result and $FF; // 255
-  FStringLen := Str - FToIdent;
+  if not FKeywords.ContainsKey(AKeyword) then
+    FKeywords.Add(AKeyword, TtkTokenKind(AKind));
 end;
 
 function TSynCobolSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
-  Entry: TSynHashEntry;
   I: Integer;
+  LRun: Integer;
+  S: string;
 begin
-  FToIdent := MayBe;
-  Entry := FKeywords[HashKey(MayBe)];
-  while Assigned(Entry) do
+  fToIdent := MayBe;
+  LRun := Run;
+  while IsIdentChar(MayBe^) and (LRun <= fCodeEndPos) do
   begin
-    if Entry.KeywordLen > FStringLen then
-      Break
-    else if Entry.KeywordLen = FStringLen then
-      if IsCurrentToken(Entry.Keyword) then
+    Inc(MayBe);
+    Inc(LRun);
+  end;
+  fStringLen := Maybe - fToIdent;
+  SetString(S, fToIdent, fStringLen);
+  if FKeywords.ContainsKey(S) then
+  begin
+    Result := FKeywords[S];
+    if Result = tkUnknown then // handling of "ambigious" words
+    begin
+      if IsCurrentToken('label') then
       begin
-        Result := TtkTokenKind(Entry.Kind);
-
-        if Result = tkUnknown then // handling of "ambigious" words 
-        begin
-          if IsCurrentToken('label') then
-          begin
-            I := Run + Length('label');
-            while FLine[I] = ' ' do
-              Inc(I);
-            if (WStrLComp(PWideChar(@FLine[I]), 'record', Length('record')) = 0)
-              and (I + Length('record') - 1 <= FCodeEndPos) then
-                Result := tkKey
-              else
-                Result := tkPreprocessor;
-          end
+        I := Run + Length('label');
+        while fLine[I] = ' ' do
+          Inc(I);
+        if (AnsiStrLComp(PWideChar(@fLine[I]), 'record', Length('record')) = 0)
+          and (I + Length('record') - 1 <= fCodeEndPos) then
+            Result := tkKey
           else
-            Result := tkIdentifier;
-        end;
-        
-        Exit;
-      end;
-    Entry := Entry.Next;
-  end;
-  Result := tkIdentifier;
+            Result := tkPreprocessor;
+      end
+      else
+        Result := tkIdentifier;
+    end;
+  end
+  else
+    Result := tkIdentifier;
 end;
 
 procedure TSynCobolSyn.SpaceProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   repeat
     Inc(Run);
-  until not CharInSet(FLine[Run], [#1..#32]);
+  until not CharInSet(fLine[Run], [#1..#32]);
 end;
 
 procedure TSynCobolSyn.FirstCharsProc;
@@ -361,26 +434,28 @@ procedure TSynCobolSyn.FirstCharsProc;
 begin
   if IsLineEnd(Run) then
     NextProcedure
-  else if Run < FCodeStartPos - 1 then
+  else if Run < fCodeStartPos - 1 then
   begin
-    FTokenID := tkSequence;
+    fTokenID := tkSequence;
     repeat
       Inc(Run);
-    until (Run = FCodeStartPos - 1) or IsLineEnd(Run);
+    until (Run = fCodeStartPos - 1) or IsLineEnd(Run);
   end
   else
   begin
-    FTokenID := tkIndicator;
-    case FLine[Run] of
-      '*', '/', 'D', 'd': FIndicator := FLine[Run];
-      '-': if FRange in [rsQuoteStringMayBe, rsApostStringMayBe] then
+    fTokenID := tkIndicator;
+    case fLine[Run] of
+      '*', '/': fRange := rsComment;                                            //JaFi
+      'D', 'd': fRange := rsDebug;                                              //JaFi
+//      '*', '/', 'D', 'd': fIndicator := fLine[Run];                           //JaFi
+      '-': if fRange in [rsQuoteStringMayBe, rsApostStringMayBe] then
            begin
              I := Run + 1;
-             while FLine[I] = ' ' do
+             while fLine[I] = ' ' do
                Inc(I);
-             if (WStrLComp(PWideChar(@FLine[I]), PWideChar(UnicodeStringOfChar(StringChars[FRange], 2)), 2) <> 0)
-               or (I + 1 > FCodeEndPos) then
-                 FRange := rsUnknown;
+             if (AnsiStrLComp(PWideChar(@fLine[I]), PWideChar(StringOfChar(StringChars[fRange], 2)), 2) <> 0)
+               or (I + 1 > fCodeEndPos) then
+                 fRange := rsUnknown;
            end;
     end;
     Inc(Run);
@@ -393,7 +468,7 @@ procedure TSynCobolSyn.LastCharsProc;
     NextProcedure
   else
   begin
-    FTokenID := tkTagArea;
+    fTokenID := tkTagArea;
     repeat
       Inc(Run);
     until IsLineEnd(Run);
@@ -402,37 +477,53 @@ procedure TSynCobolSyn.LastCharsProc;
 
 procedure TSynCobolSyn.CommentProc;
 begin
-  FIndicator := #0;
-
+  fIndicator := #0;
+  fRange := rsUnknown;
   if IsLineEnd(Run) then
     NextProcedure
   else
   begin
-    FTokenID := tkComment;
+    fTokenID := tkComment;
     repeat
       Inc(Run);
-    until IsLineEnd(Run) or (Run > FCodeEndPos);
+    until IsLineEnd(Run); // or (Run > fCodeEndPos);
   end;
 end;
 
-procedure TSynCobolSyn.DebugProc;
+procedure TSynCobolSyn.InlineCommentProc;
 begin
-  FIndicator := #0;
+  Inc(Run);
+  fTokenID := tkUnknown;
+  if fLine[Run] = '>' then
+  begin
+    fTokenID := tkComment;
+    repeat
+      Inc(Run);
+    until IsLineEnd(Run);
+  end
+  else
+  if not IsLineEnd(Run) then
+    UnknownProc;
+end;
 
+procedure TSynCobolSyn.DebugProc;
+begin
+  fIndicator := #0;
+  fRange := rsUnknown;
   if IsLineEnd(Run) then
     NextProcedure
   else
   begin
-    FTokenID := tkDebugLines;
+    fTokenID := tkDebugLines;
     repeat
       Inc(Run);
-    until IsLineEnd(Run) or (Run > FCodeEndPos);
+    until IsLineEnd(Run) or (Run > fCodeEndPos);
   end;
 end;
 
 procedure TSynCobolSyn.PointProc;
 begin
-  if (Run < FCodeEndPos) and CharInSet(FLine[Run + 1], ['0'..'9', 'e', 'E']) then
+  if (Run < fCodeEndPos) and CharInSet(FLine[Run + 1], ['0'..'9', 'e', 'E']) then
     NumberProc
   else
     UnknownProc;
@@ -442,7 +533,7 @@ procedure TSynCobolSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', '.', 'e', 'E', '-', '+':
         Result := True;
       else
@@ -453,11 +544,11 @@ procedure TSynCobolSyn.NumberProc;
 var
   fFloat: Boolean;
 begin
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   Inc(Run);
   fFloat := False;
 
-  while IsNumberChar and (Run <= FCodeEndPos) do
+  while IsNumberChar and (Run <= fCodeEndPos) do
   begin
     case FLine[Run] of
       '.':
@@ -481,33 +572,33 @@ procedure TSynCobolSyn.NumberProc;
 
 procedure TSynCobolSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
 procedure TSynCobolSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run] = #10 then
+  if fLine[Run] = #10 then
     Inc(Run);
 end;
 
 procedure TSynCobolSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynCobolSyn.StringOpenProc;
 begin
-  case FLine[Run] of
-    '"': FRange := rsQuoteString;
-    '''': FRange := rsApostString;
+  case fLine[Run] of
+    '"': fRange := rsQuoteString;
+    '''': fRange := rsApostString;
     else
-      if FLine[Run + 1] = '=' then
+      if fLine[Run + 1] = '=' then
       begin
-        FRange := rsPseudoText;
+        fRange := rsPseudoText;
         Inc(Run);
       end
       else
@@ -519,28 +610,30 @@ procedure TSynCobolSyn.StringOpenProc;
 
   Inc(Run);
   StringProc;
-  FTokenID := tkString;
+//  fTokenID := tkString;
 end;
 
 procedure TSynCobolSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
 
-  if Run <= FCodeEndPos then
+  if Run <= fCodeEndPos then
   repeat
-    if (FLine[Run] = StringChars[FRange])
-      and ((FLine[Run] <> '=') or ((Run > 0) and (FLine[Run - 1] = '='))) then
+    if (fLine[Run] = StringChars[fRange])
+      and ((fLine[Run] <> '=') or ((Run > 0) and (fLine[Run - 1] = '='))) then
     begin
-      if (Run = FCodeEndPos) and (FRange in [rsQuoteString, rsApostString]) then
-        Inc(FRange, 3)
+      if (Run = fCodeEndPos) and (fRange in [rsQuoteString, rsApostString]) then
+        Inc(fRange, 3)
       else
-        FRange := rsUnknown;
+      begin
+        fRange := rsUnknown;
+      end;
       Inc(Run);
       Break;
     end;
     if not IsLineEnd(Run) then
       Inc(Run);
-  until IsLineEnd(Run) or (Run > FCodeEndPos);
+  until IsLineEnd(Run) or (Run > fCodeEndPos);
 end;
 
 procedure TSynCobolSyn.StringEndProc;
@@ -549,23 +642,23 @@ procedure TSynCobolSyn.StringEndProc;
     NextProcedure
   else
   begin
-    FTokenID := tkString;
+    fTokenID := tkString;
 
-    if (FRange <> rsPseudoText) and (Run <= FCodeEndPos) then
+    if (fRange <> rsPseudoText) and (Run <= fCodeEndPos) then
     repeat
-      if (FLine[Run] = StringChars[FRange]) then
+      if (fLine[Run] = StringChars[fRange]) then
       begin
-        if FRange in [rsQuoteString, rsApostString] then
+        if fRange in [rsQuoteString, rsApostString] then
           Inc(Run)
         else
         begin
           Inc(Run, 2);
-          Dec(FRange, 3);
+          Dec(fRange, 3);
         end;
         Break;
       end;
       Inc(Run);
-    until IsLineEnd(Run) or (Run > FCodeEndPos);
+    until IsLineEnd(Run) or (Run > fCodeEndPos);
 
     StringProc;
   end;
@@ -575,129 +668,241 @@ constructor TSynCobolSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
+  fCaseSensitive := False;
+
+  // Create the keywords dictionary case-insensitive
+  FKeywords := TDictionary.Create(TIStringComparer.Ordinal);
 
-  FKeywords := TSynHashEntryList.Create;
+  fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  fCommentAttri.Foreground := clGray;
+  AddAttribute(fCommentAttri);
 
-  FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  FCommentAttri.Foreground := clGray;
-  AddAttribute(FCommentAttri);
+  fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
 
-  FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
+  fAIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrAreaAIdentifier, SYNS_FriendlyAttrAreaAIdentifier);
+  fAIdentifierAttri.Foreground := clTeal;
+  fAIdentifierAttri.Style := [fsBold];
+  AddAttribute(fAIdentifierAttri);
 
-  FAIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrAreaAIdentifier, SYNS_FriendlyAttrAreaAIdentifier);
-  FAIdentifierAttri.Foreground := clTeal;
-  FAIdentifierAttri.Style := [fsBold];
-  AddAttribute(FAIdentifierAttri);
+  fPreprocessorAttri := TSynHighLighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
+  fPreprocessorAttri.Foreground := clMaroon;
+  AddAttribute(fPreprocessorAttri);
 
-  FPreprocessorAttri := TSynHighLighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
-  FPreprocessorAttri.Foreground := clMaroon;
-  AddAttribute(FPreprocessorAttri);
+  fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style := [fsBold];
+  AddAttribute(fKeyAttri);
 
-  FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
+  fNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  fNumberAttri.Foreground := clGreen;
+  AddAttribute(fNumberAttri);
 
-  FNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  FNumberAttri.Foreground := clGreen;
-  AddAttribute(FNumberAttri);
+  fBooleanAttri := TSynHighLighterAttributes.Create(SYNS_AttrBoolean, SYNS_FriendlyAttrBoolean);
+  fBooleanAttri.Foreground := clGreen;
+  AddAttribute(fBooleanAttri);
 
-  FBooleanAttri := TSynHighLighterAttributes.Create(SYNS_AttrBoolean, SYNS_FriendlyAttrBoolean);
-  FBooleanAttri.Foreground := clGreen;
-  AddAttribute(FBooleanAttri);
+  fBracketAttri := TSynHighLighterAttributes.Create(SYNS_AttrBrackets, SYNS_AttrBrackets);
+  AddAttribute(fBracketAttri);
 
-  FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
+  fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
 
-  FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  FStringAttri.Foreground := clBlue;
-  AddAttribute(FStringAttri);
+  fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  fStringAttri.Foreground := clBlue;
+  AddAttribute(fStringAttri);
 
-  FSequenceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSequence, SYNS_FriendlyAttrSequence);
-  FSequenceAttri.Foreground := clDkGray;
-  AddAttribute(FSequenceAttri);
+  fSequenceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSequence, SYNS_FriendlyAttrSequence);
+  fSequenceAttri.Foreground := clDkGray;
+  AddAttribute(fSequenceAttri);
 
-  FIndicatorAttri := TSynHighLighterAttributes.Create(SYNS_AttrIndicator, SYNS_FriendlyAttrIndicator);
-  FIndicatorAttri.Foreground := clRed;
-  AddAttribute(FIndicatorAttri);
+  fIndicatorAttri := TSynHighLighterAttributes.Create(SYNS_AttrIndicator, SYNS_FriendlyAttrIndicator);
+  fIndicatorAttri.Foreground := clRed;
+  AddAttribute(fIndicatorAttri);
 
-  FTagAreaAttri := TSynHighLighterAttributes.Create(SYNS_AttrTagArea, SYNS_FriendlyAttrTagArea);
-  FTagAreaAttri.Foreground := clMaroon;
-  AddAttribute(FTagAreaAttri);
+  fTagAreaAttri := TSynHighLighterAttributes.Create(SYNS_AttrTagArea, SYNS_FriendlyAttrTagArea);
+  fTagAreaAttri.Foreground := clMaroon;
+  AddAttribute(fTagAreaAttri);
 
-  FDebugLinesAttri := TSynHighLighterAttributes.Create(SYNS_AttrDebugLines, SYNS_FriendlyAttrDebugLines);
-  FDebugLinesAttri.Foreground := clDkGray;
-  AddAttribute(FDebugLinesAttri);
+  fDebugLinesAttri := TSynHighLighterAttributes.Create(SYNS_AttrDebugLines, SYNS_FriendlyAttrDebugLines);
+  fDebugLinesAttri.Foreground := clDkGray;
+  AddAttribute(fDebugLinesAttri);
   SetAttributesOnChange(DefHighlightChange);
 
-  FDefaultFilter := SYNS_FilterCOBOL;
-  FRange := rsUnknown;
-  FIndicator := #0;
+  fDefaultFilter := SYNS_FilterCOBOL;
+  fRange := rsUnknown;
+  fIndicator := #0;
 
-  FCodeStartPos := 7;
-  FCodeMediumPos := 11;
-  FCodeEndPos := 71;
+  fCodeStartPos := 7;
+  fCodeMediumPos := 11;
+  fCodeEndPos := 71;
 
   EnumerateKeywords(Ord(tkBoolean), BooleanWords, IsIdentChar, DoAddKeyword);
   EnumerateKeywords(Ord(tkKey), KeyWords, IsIdentChar, DoAddKeyword);
   EnumerateKeywords(Ord(tkPreprocessor), PreprocessorWords, IsIdentChar, DoAddKeyword);
   EnumerateKeywords(Ord(tkString), StringWords, IsIdentChar, DoAddKeyword);
   EnumerateKeywords(Ord(tkUnknown), AmbigiousWords, IsIdentChar, DoAddKeyword);
+
+  RE_BlockBegin := CompiledRegEx('\b^(IF |EVALUATE |EXEC |READ |WRITE |PERFORM |STRING |ACCEPT )\b', [roIgnoreCase]);
+  RE_BlockEnd := CompiledRegEx('(END\-IF|END\-EVALUATE|END\-EXEC|END\-READ|END\-WRITE|END\-PERFORM|END\-STRING|END\-ACCEPT)', [roIgnoreCase]);
+end;
+
+const
+  FT_Standard = 1;  // begin end, class end, record end
+  FT_Comment = 11;
+  FT_CodeDeclaration = 16;
+  FT_CodeDeclarationWithBody = 17;
+  FT_Implementation = 18;
+  FT_Region: Integer = 99;
+
+procedure TSynCobolSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges;
+      LinesToScan: TStrings; FromLine: Integer; ToLine: Integer);
+var
+  Line: Integer;
+  iList: TList;
+  CurLine: string;
+  ok: Boolean;
+  IsLastDot: Boolean;
+
+  function BlockDelimiter(Line: Integer): Boolean;
+  var
+    Index: Integer;
+    mcb: TMatchCollection;
+    mce: TMatchCollection;
+    match: TMatch;
+  begin
+    Result := False;
+
+    mcb := RE_BlockBegin.Matches(CurLine);
+    if mcb.Count > 0 then
+    begin
+      // Char must have proper highlighting (ignore stuff inside comments...)
+      Index :=  mcb.Item[0].Index;
+      if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then
+      begin
+        ok := False;
+        // And ignore lines with both opening and closing chars in them
+        for match in Re_BlockEnd.Matches(CurLine) do
+          if (match.Index > Index) then
+          begin
+            OK := True;
+            Break;
+          end;
+        // line ends with dot - it replaces END-XXX
+        if not OK and IsLastDot then
+          OK := True;
+
+        if not OK then begin
+          FoldRanges.StartFoldRange(Line + 1, FT_Standard);
+          Result := True;
+        end;
+      end;
+    end
+    else
+    begin
+      mce := RE_BlockEnd.Matches(CurLine);
+      if (mce.Count > 0) or IsLastDot then
+      begin
+        Index := 0;
+        if mce.Count > 0 then
+          Index :=  mce.Item[0].Index;
+        if IsLastDot or (GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri) then
+        begin
+          FoldRanges.StopFoldRange(Line + 1, FT_Standard);
+          Result := True;
+        end;
+      end;
+    end;
+  end;
+
+begin
+  iList := TList.Create;
+
+  for Line := 0 to LinesToScan.Count - 1 do
+  begin
+    CurLine := Trim(LinesToScan[Line]);
+    IsLastDot := Copy(CurLine, Length(CurLine), 1) = '.';
+
+    // Divisions
+    if Pos(' DIVISION.', UpperCase(CurLine)) > 0 then
+    begin
+      FoldRanges.StopFoldRange(Line+1, FT_CodeDeclarationWithBody, 0);
+      FoldRanges.StartFoldRange(Line + 1, FT_CodeDeclarationWithBody, 0);
+    end
+    else
+    // Sections
+    if Pos(' SECTION.', UpperCase(CurLine)) > 0 then
+    begin
+      FoldRanges.StopFoldRange(Line, FT_CodeDeclarationWithBody, 1);
+      FoldRanges.StartFoldRange(Line +1, FT_CodeDeclarationWithBody, 1);
+    end
+    else
+    // Standard XXX ... END-XXX ranges
+    if not BlockDelimiter(Line) then
+      FoldRanges.NoFoldInfo(Line + 1);
+
+  end;
+  // finally we end all open ranges
+  FoldRanges.StopFoldRange(LinesToScan.Count, FT_CodeDeclarationWithBody, 1);
+  FoldRanges.StopFoldRange(LinesToScan.Count, FT_CodeDeclarationWithBody, 0);
+
+  iList.Free;
 end;
 
 destructor TSynCobolSyn.Destroy;
 begin
-  FKeywords.Free;
+  fKeywords.Free;
   inherited Destroy;
 end;
 
 procedure TSynCobolSyn.IdentProc;
 begin
-  if CharInSet(FLine[Run], ['x', 'g', 'X', 'G'])
-    and (Run < FCodeEndPos) and CharInSet(FLine[Run + 1], ['"', '''']) then
+  if CharInSet(fLine[Run], ['x', 'g', 'X', 'G'])
+    and (Run < fCodeEndPos) and CharInSet(fLine[Run + 1], ['"', '''']) then
   begin
     Inc(Run);
     StringOpenProc;
   end
   else
   begin
-    FTokenID := IdentKind((FLine + Run));
-    if (FTokenID = tkIdentifier) and (Run < FCodeMediumPos) then
-      FTokenID := tkAIdentifier;
-    Inc(Run, FStringLen);
+    fTokenID := IdentKind((fLine + Run));
+    if (fTokenID = tkIdentifier) and (Run < fCodeMediumPos) then
+      fTokenID := tkAIdentifier;
+    Inc(Run, fStringLen);
 
-    while IsIdentChar(FLine[Run]) and (Run <= FCodeEndPos) do
+    while IsIdentChar(fLine[Run]) and (Run <= fCodeEndPos) do
       Inc(Run);
   end;
 end;
 
 procedure TSynCobolSyn.UnknownProc;
 begin
+  fTokenID := tkUnknown;
   Inc(Run);
-  FTokenID := tkUnknown;
 end;
 
 procedure TSynCobolSyn.Next;
 begin
-  FTokenPos := Run;
+  fTokenPos := Run;
 
-  if FTokenPos < FCodeStartPos then
+  if fTokenPos < fCodeStartPos then
     FirstCharsProc
   else
-    case FIndicator of
-      '*', '/': CommentProc;
-      'D', 'd': DebugProc;
+//    case fIndicator of
+//      '*', '/': CommentProc;
+//      'D', 'd': DebugProc;
+    case fRange of
+        rsComment: CommentProc;
+        rsDebug: DebugProc;
       else
-        if FTokenPos > FCodeEndPos then
+        if fTokenPos > fCodeEndPos then
           LastCharsProc
         else
-          case FRange of
+          case fRange of
             rsQuoteString..rsApostStringMayBe: StringEndProc;
           else
             begin
-              FRange := rsUnknown;
+              fRange := rsUnknown;
               NextProcedure;
             end;
           end;
@@ -707,7 +912,7 @@ procedure TSynCobolSyn.Next;
 
 procedure TSynCobolSyn.NextProcedure;
 begin
-  case FLine[Run] of
+  case fLine[Run] of
     #0: NullProc;
     #10: LFProc;
     #13: CRProc;
@@ -717,7 +922,9 @@ procedure TSynCobolSyn.NextProcedure;
     #1..#9, #11, #12, #14..#32: SpaceProc;
     '.': PointProc;
     '0'..'9': NumberProc;
-    'A'..'Z', 'a'..'z': IdentProc;
+    '-', 'A'..'Z', 'a'..'z': IdentProc;
+    '(', ')': BracketProc;
+    '*': InlineCommentProc;  // comment *> to end of line
     else UnknownProc;
   end;
 end;
@@ -725,11 +932,11 @@ procedure TSynCobolSyn.NextProcedure;
 function TSynCobolSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER:  Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER:  Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
   else
     Result := nil;
   end;
@@ -737,31 +944,32 @@ function TSynCobolSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttrib
 
 function TSynCobolSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynCobolSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynCobolSyn.GetTokenAttribute: TSynHighLighterAttributes;
 begin
   case GetTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkAIdentifier: Result := FAIdentifierAttri;
-    tkPreprocessor: Result := FPreprocessorAttri;
-    tkKey: Result := FKeyAttri;
-    tkBoolean: Result := FBooleanAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSequence: Result := FSequenceAttri;
-    tkIndicator: Result := FIndicatorAttri;
-    tkTagArea: Result := FTagAreaAttri;
-    tkDebugLines: Result := FDebugLinesAttri;
-    tkUnknown: Result := FIdentifierAttri;
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkAIdentifier: Result := fAIdentifierAttri;
+    tkPreprocessor: Result := fPreprocessorAttri;
+    tkKey: Result := fKeyAttri;
+    tkBoolean: Result := fBooleanAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSequence: Result := fSequenceAttri;
+    tkIndicator: Result := fIndicatorAttri;
+    tkTagArea: Result := fTagAreaAttri;
+    tkDebugLines: Result := fDebugLinesAttri;
+    tkUnknown: Result := fIdentifierAttri;
+    tkBracket: Result := fBracketAttri;
   else
     Result := nil;
   end;
@@ -769,10 +977,10 @@ function TSynCobolSyn.GetTokenAttribute: TSynHighLighterAttributes;
 
 function TSynCobolSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
-function TSynCobolSyn.GetSampleSource: UnicodeString;
+function TSynCobolSyn.GetSampleSource: string;
 begin
   Result := '000100* This is a sample file to be used to show all TSynCobolSyn''s'#13#10 +
             '000200* features.'#13#10 +
@@ -818,9 +1026,9 @@ function TSynCobolSyn.GetSampleSource: UnicodeString;
             '004200     03  WSV-PRICES              PIC 9(4)V99 COMP-3 VALUE 0000.33. 		'#13#10 +
             '004300     03  WSV-Z-PRICES            PIC Z(5)9.99- VALUE -2.12. 		'#13#10 +
             '004400     03  WSV-STORE-DATE          PIC 9(4)V99E99 VALUE 0001.33E02.'#13#10 +
-            '004500* 1.11 Strings.'#13#10 +
-            '004600*    The following types of strings are supported:'#13#10 +
-            '004700*    1.11.1 Quoted strings.'#13#10 +
+            '004500* 1.11 String.'#13#10 +
+            '004600*    The following types of string are supported:'#13#10 +
+            '004700*    1.11.1 Quoted string.'#13#10 +
             '004800         MOVE "The name of field is ""PRODUCT""" TO WS-ERR-MESS.'#13#10 +
             '004900         MOVE ''The name of field is ''''PRODUCT'''''' TO WS-ERR-MESS.'#13#10 +
             '005000*    1.11.2 Pseudo-text.'#13#10 +
@@ -859,43 +1067,43 @@ function TSynCobolSyn.GetSampleSource: UnicodeString;
 
 function TSynCobolSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterCOBOL;
+  Result := fDefaultFilter <> SYNS_FilterCOBOL;
 end;
 
 function TSynCobolSyn.IsIdentChar(AChar: WideChar): Boolean;
 begin
   case AChar of
-    '-', '0'..'9', 'a'..'z', 'A'..'Z':
+    '-', '_', '0'..'9', 'a'..'z', 'A'..'Z':
       Result := True;
     else
-      Result := False;              
+      Result := False;
   end;
 end;
 
-procedure TSynCobolSyn.SetCodeStartPos(Value: LongInt);
+procedure TSynCobolSyn.SetCodeStartPos(Value: Integer);
 begin
-  if Value < FCodeMediumPos then
-    FCodeStartPos := Value
+  if Value <= fCodeMediumPos then
+    fCodeStartPos := Value
   else
-    FCodeStartPos := FCodeMediumPos;
+    fCodeStartPos := fCodeMediumPos;
 end;
 
-procedure TSynCobolSyn.SetCodeMediumPos(Value: LongInt);
+procedure TSynCobolSyn.SetCodeMediumPos(Value: Integer);
 begin
-  if (FCodeStartPos <= Value) and (Value <= FCodeEndPos) then
-    FCodeMediumPos := Value
+  if (fCodeStartPos <= Value) and (Value <= fCodeEndPos) then
+    fCodeMediumPos := Value
   else
-    if Value > FCodeEndPos
-    then FCodeMediumPos := FCodeEndPos
-    else FCodeMediumPos := FCodeStartPos;
+    if Value > fCodeEndPos
+    then fCodeMediumPos := fCodeEndPos
+    else fCodeMediumPos := fCodeStartPos;
 end;
 
-procedure TSynCobolSyn.SetCodeEndPos(Value: LongInt);
+procedure TSynCobolSyn.SetCodeEndPos(Value: Integer);
 begin
-  if Value > FCodeMediumPos then
-    FCodeEndPos := Value
+  if Value > fCodeMediumPos then
+    fCodeEndPos := Value
   else
-    FCodeEndPos := FCodeMediumPos;
+    fCodeEndPos := fCodeMediumPos;
 end;
 
 class function TSynCobolSyn.GetLanguageName: string;
@@ -905,26 +1113,30 @@ class function TSynCobolSyn.GetLanguageName: string;
 
 procedure TSynCobolSyn.ResetRange;
 begin
-  FRange := rsUnknown;
+  fRange := rsUnknown;
 end;
 
 procedure TSynCobolSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 function TSynCobolSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
-class function TSynCobolSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynCobolSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangCOBOL;
 end;
 
+procedure TSynCobolSyn.BracketProc;
+begin
+  Inc(Run);
+  fTokenID := tkBracket;
+end;
+
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynCobolSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterCpp.pas b/Ext/SynEdit/Source/SynHighlighterCpp.pas
index 9e782f8..d258a08 100644
--- a/Ext/SynEdit/Source/SynHighlighterCpp.pas
+++ b/Ext/SynEdit/Source/SynHighlighterCpp.pas
@@ -27,13 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterCpp.pas,v 1.22.2.9 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a C++ syntax highlighter for SynEdit)
@@ -54,13 +47,14 @@ interface
   Graphics,
   SynEditTypes,
   SynEditHighlighter,
-  SynUnicode,
   SysUtils,
-  Classes;
+  SynUnicode,
+  Classes,
+  SynEditCodeFolding;
 
 type
-  TtkTokenKind = (tkAsm, tkComment, tkDirective, tkIdentifier, tkKey, tkNull,
-    tkNumber, tkSpace, tkString, tkSymbol, tkUnknown,
+  TtkTokenKind = (tkBracket, tkKey, tkSymbol, tkAsm, tkComment, tkDirective, tkIdentifier, tkNull,
+    tkNumber, tkSpace, tkString, tkUnknown,
     tkChar, tkFloat, tkHex, tkOctal);
 
   TxtkTokenKind = (
@@ -76,33 +70,36 @@ interface
     xtkXorAssign);
 
   TRangeState = (rsUnknown, rsAnsiC, rsAnsiCAsm, rsAnsiCAsmBlock, rsAsm,
-    rsAsmBlock, rsDirective, rsDirectiveComment, rsMultiLineString,
-    rsMultiLineDirective);
+    rsAsmBlock, rsDirective, rsDirectiveComment, rsString34, rsString39,
+    rsMultiLineString, rsMultiLineDirective);
 
   PIdentFuncTableFunc = ^TIdentFuncTableFunc;
   TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
 
-  TSynCppSyn = class(TSynCustomHighlighter)
+//  TSynCppSyn = class(TSynCustomHighlighter)
+  TSynCppSyn = class(TSynCustomCodeFoldingHighlighter)
   private
-    FAsmStart: Boolean;
-    FRange: TRangeState;
+    fAsmStart: Boolean;
+    fRange: TRangeState;
     FTokenID: TtkTokenKind;
     FExtTokenID: TxtkTokenKind;
-    FIdentFuncTable: array[0..342] of TIdentFuncTableFunc;
-    FAsmAttri: TSynHighlighterAttributes;
-    FCommentAttri: TSynHighlighterAttributes;
-    FDirecAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FInvalidAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FFloatAttri: TSynHighlighterAttributes;
-    FHexAttri: TSynHighlighterAttributes;
-    FOctalAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FCharAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
+    fIdentFuncTable: array[0..640] of TIdentFuncTableFunc;
+    fAsmAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fDirecAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fInvalidAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fFloatAttri: TSynHighlighterAttributes;
+    fHexAttri: TSynHighlighterAttributes;
+    fOctalAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fCharAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    fBracketAttri: TSynHighlighterAttributes;
+    FNewPreprocesorStyle: Boolean;
     function AltFunc(Index: Integer): TtkTokenKind;
     function KeyWordFunc(Index: Integer): TtkTokenKind;
     function FuncAsm(Index: Integer): TtkTokenKind;
@@ -147,14 +144,15 @@   TSynCppSyn = class(TSynCustomHighlighter)
     procedure XOrSymbolProc;
     procedure UnknownProc;
     procedure StringEndProc;
+    procedure SetNewPreprocesorStyle(const Value: Boolean);
   protected
     function GetExtTokenID: TxtkTokenKind;
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     function IsFilterStored: Boolean; override;
   public
     class function GetCapabilities: TSynHighlighterCapabilities; override;
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -169,81 +167,96 @@   TSynCppSyn = class(TSynCustomHighlighter)
     procedure ResetRange; override;
     function UseUserSettings(settingIndex: Integer): Boolean; override;
     procedure EnumUserSettings(settings: TStrings); override;
-
     property ExtTokenID: TxtkTokenKind read GetExtTokenID;
+    property NewPreprocesorStyle: Boolean read FNewPreprocesorStyle write SetNewPreprocesorStyle;
+//++ CodeFolding
+    procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges;
+      LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override;
+//-- CodeFolding
   published
-    property AsmAttri: TSynHighlighterAttributes read FAsmAttri write FAsmAttri;
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property DirecAttri: TSynHighlighterAttributes read FDirecAttri
-      write FDirecAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri
-      write FInvalidAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property FloatAttri: TSynHighlighterAttributes read FFloatAttri
-      write FFloatAttri;
-    property HexAttri: TSynHighlighterAttributes read FHexAttri
-      write FHexAttri;
-    property OctalAttri: TSynHighlighterAttributes read FOctalAttri
-      write FOctalAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property CharAttri: TSynHighlighterAttributes read FCharAttri
-      write FCharAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
+    property AsmAttri: TSynHighlighterAttributes read fAsmAttri write fAsmAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri;
+    property BracketAttri: TSynHighlighterAttributes read fBracketAttri write fBracketAttri;
+    property DirecAttri: TSynHighlighterAttributes read fDirecAttri write fDirecAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri;
+    property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri write fInvalidAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri;
+    property FloatAttri: TSynHighlighterAttributes read fFloatAttri write fFloatAttri;
+    property HexAttri: TSynHighlighterAttributes read fHexAttri write fHexAttri;
+    property OctalAttri: TSynHighlighterAttributes read fOctalAttri write fOctalAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri;
+    property CharAttri: TSynHighlighterAttributes read fCharAttri write fCharAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri;
   end;
 
 implementation
 
 uses
   Windows,
+  Registry,
   SynEditStrConst;
 
 const
-  KeyWords: array[0..94] of UnicodeString = (
-    '__asm', '__automated', '__cdecl', '__classid', '__closure', '__declspec', 
-    '__dispid', '__except', '__export', '__fastcall', '__finally', '__import', 
-    '__int16', '__int32', '__int64', '__int8', '__pascal', '__property', 
-    '__published', '__rtti', '__stdcall', '__thread', '__try', '_asm', '_cdecl', 
-    '_export', '_fastcall', '_import', '_pascal', '_stdcall', 'asm', 'auto', 
-    'bool', 'break', 'case', 'catch', 'cdecl', 'char', 'class', 'const', 
-    'const_cast', 'continue', 'default', 'delete', 'do', 'double', 
-    'dynamic_cast', 'else', 'enum', 'explicit', 'extern', 'false', 'float', 
-    'for', 'friend', 'goto', 'if', 'inline', 'int', 'interface', 'long', 
-    'mutable', 'namespace', 'new', 'operator', 'pascal', 'private', 'protected', 
-    'public', 'register', 'reinterpret_cast', 'return', 'short', 'signed', 
-    'sizeof', 'static', 'static_cast', 'struct', 'switch', 'template', 'this', 
-    'throw', 'true', 'try', 'typedef', 'typeid', 'typename', 'union', 
-    'unsigned', 'using', 'virtual', 'void', 'volatile', 'wchar_t', 'while' 
+  KeyWords: array[0..129] of string = (
+    '__asm', '__automated', '__cdecl', '__classid', '__closure', '__declspec',
+    '__dispid', '__except', '__export', '__fastcall', '__finally', '__import',
+    '__int16', '__int32', '__int64', '__int8', '__pascal', '__property',
+    '__published', '__rtti', '__stdcall', '__thread', '__try', '_Alignas',
+    '_Alignof', '_asm', '_Atomic', '_Bool', '_cdecl', '_Complex', '_export',
+    '_fastcall', '_Generic', '_Imaginary', '_import', '_Noreturn', '_pascal',
+    '_Pragma', '_Static_assert', '_stdcall', '_Thread_local', 'alignas',
+    'alignof', 'and', 'and_eq', 'asm', 'auto', 'bitand', 'bitor', 'bool',
+    'break', 'case', 'catch', 'cdecl', 'class', 'compl', 'const', 'const_cast',
+    'constexpr', 'continue', 'decltype', 'default', 'delete', 'do', 'double',
+    'dynamic_cast', 'else', 'enum', 'explicit', 'extern', 'false', 'final',
+    'float', 'for', 'friend', 'goto', 'char', 'char16_t', 'char32_t', 'if',
+    'inline', 'int', 'interface', 'long', 'mutable', 'namespace', 'new',
+    'noexcept', 'not', 'not_eq', 'nullptr', 'operator', 'or', 'or_eq',
+    'override', 'pascal', 'private', 'protected', 'public', 'register',
+    'reinterpret_cast', 'restrict', 'return', 'short', 'signed', 'sizeof',
+    'static', 'static_assert', 'static_cast', 'struct', 'switch', 'template',
+    'this', 'thread_local', 'throw', 'true', 'try', 'typedef', 'typeid',
+    'typename', 'union', 'unsigned', 'using', 'virtual', 'void', 'volatile',
+    'while', 'wchar_t', 'xor', 'xor_eq'
   );
 
-  KeyIndices: array[0..342] of Integer = (
-    -1, 34, -1, -1, 57, 72, -1, 39, -1, 9, -1, 86, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 88, -1, 12, 66, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, 56, 51, 
-    40, 87, 77, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, 41, 
-    -1, 63, 6, -1, -1, -1, -1, -1, -1, -1, -1, 55, 65, 0, -1, -1, -1, -1, -1, 
-    -1, 26, 83, -1, 38, 92, -1, -1, 93, 33, -1, -1, -1, -1, -1, -1, -1, 35, -1, 
-    -1, -1, -1, -1, -1, -1, 79, 27, -1, -1, -1, 43, -1, -1, 20, -1, -1, 31, -1, 
-    -1, -1, -1, -1, 89, -1, -1, -1, -1, 59, -1, 58, -1, -1, 46, -1, -1, 3, -1, 
-    -1, 17, -1, 54, -1, 45, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, 1, -1, -1, 
-    -1, -1, 44, 90, 32, -1, -1, -1, -1, -1, -1, 91, 13, -1, -1, -1, 60, -1, -1, 
-    -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, 75, -1, -1, 76, -1, -1, -1, -1, 30, 
-    68, 23, 82, -1, 15, -1, -1, 2, -1, 70, -1, -1, -1, 73, 18, -1, -1, -1, -1, 
-    -1, 47, 24, 52, 14, 84, -1, -1, -1, -1, -1, 25, -1, -1, -1, 80, 69, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, 19, -1, -1, -1, 
-    -1, -1, -1, 74, -1, -1, -1, 29, -1, -1, -1, 67, -1, 7, -1, -1, -1, 50, 61, 
-    -1, -1, -1, 4, -1, 94, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    81, -1, -1, -1, -1, -1, 10, 16, -1, -1, 36, 37, -1, -1, -1, 8, -1, 22, -1, 
-    -1, -1, -1, 78, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 71, -1, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, 11, -1, 48, 
-    -1 
+  KeyIndices: array[0..640] of Integer = (
+    68, -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, 1, -1, -1, 17, -1, -1, -1, -1, 97, -1, -1, -1, -1,
+    -1, 62, -1, 28, -1, -1, -1, -1, -1, -1, 64, 21, 90, -1, -1, -1, -1, 108, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 15, 81, -1, 3, -1, 69, -1,
+    -1, -1, -1, -1, 127, -1, 98, 54, -1, -1, -1, -1, -1, -1, 101, -1, -1, -1,
+    65, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, -1, -1, -1, -1,
+    -1, -1, -1, -1, 75, -1, -1, 93, 121, 99, -1, -1, 12, -1, -1, -1, -1, -1, -1,
+    -1, 100, -1, -1, 57, 120, 4, -1, 86, -1, -1, -1, -1, 44, -1, -1, -1, -1, 56,
+    -1, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, 50, -1, -1, -1, 112,
+    -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, -1,
+    -1, -1, -1, 41, -1, -1, -1, 55, 109, 89, -1, 9, 114, 128, -1, 123, -1, 8,
+    -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, 34, -1, 103, -1, -1, 22, -1, 20, -1,
+    -1, -1, -1, -1, 94, -1, 83, -1, 51, -1, 33, -1, -1, -1, -1, -1, 47, -1, -1,
+    -1, -1, 74, -1, -1, -1, -1, -1, -1, -1, -1, 116, 91, -1, 6, -1, -1, -1, -1,
+    -1, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 129, -1, -1, 35, -1,
+    -1, -1, -1, -1, -1, -1, 92, -1, -1, -1, 7, -1, 23, -1, -1, -1, -1, -1, -1,
+    59, -1, -1, -1, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, 119, 67, -1, -1, 60,
+    -1, -1, -1, 38, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 88,
+    -1, -1, -1, -1, -1, 80, -1, 42, -1, -1, -1, -1, -1, 25, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, 95, 26, -1, -1, -1, -1, -1, -1, -1, 61, -1, -1, -1,
+    32, 46, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, -1, -1, -1,
+    -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, -1,
+    -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, 72, -1, -1, -1, -1, -1, -1, -1, 0,
+    -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, 43, 24, 105, -1, -1,
+    -1, -1, -1, -1, -1, 118, -1, -1, -1, -1, -1, -1, -1, -1, 45, 49, -1, -1, -1,
+    14, -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, 82, -1, -1, 125, 70, -1, -1, -1,
+    -1, -1, -1, -1, 29, -1, -1, -1, -1, -1, -1, -1, 113, -1, -1, -1, -1, -1, -1,
+    -1, -1, -1, 16, -1, -1, -1, 11, -1, -1, 104, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, 30, -1, -1,
+    -1, -1, -1, -1, -1, 27, -1, -1, 84, -1, -1, -1, -1, -1, 106, -1, 126, -1,
+    -1, -1, -1, 13, -1, -1, -1, -1, -1, -1, 52, -1, -1, 107, -1, 37, -1, -1, -1,
+    -1, -1, -1, -1, 115, 87, -1, -1, 85, -1, -1, -1, -1, -1, -1, -1, 31, 19,
+    102, 79, -1, -1, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
+    -1, -1, 10, -1, -1, -1, -1, -1, -1, 63, -1, 96, -1, -1, -1, 76, -1, -1, -1
   );
 
 {$Q-}
@@ -252,11 +265,11 @@ function TSynCppSyn.HashKey(Str: PWideChar): Cardinal;
   Result := 0;
   while IsIdentChar(Str^) do
   begin
-    Result := Result * 179 + Ord(Str^) * 44;
+    Result := Result * 61 + Ord(Str^) * 145;
     Inc(Str);
   end;
-  Result := Result mod 343;
-  FStringLen := Str - FToIdent;
+  Result := Result mod 641;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -264,10 +277,10 @@ function TSynCppSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
@@ -276,17 +289,17 @@ procedure TSynCppSyn.InitIdent;
 var
   i: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
     if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
+      fIdentFuncTable[i] := AltFunc;
 
-  FIdentFuncTable[70] := FuncAsm;
-  FIdentFuncTable[191] := FuncAsm;
-  FIdentFuncTable[189] := FuncAsm;
+  fIdentFuncTable[352] := FuncAsm;
+  fIdentFuncTable[433] := FuncAsm;
+  fIdentFuncTable[467] := FuncAsm;
 
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if @FIdentFuncTable[i] = nil then
-      FIdentFuncTable[i] := KeyWordFunc;
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
+    if @fIdentFuncTable[i] = nil then
+      fIdentFuncTable[i] := KeyWordFunc;
 end;
 
 function TSynCppSyn.AltFunc(Index: Integer): TtkTokenKind;
@@ -307,8 +320,8 @@ function TSynCppSyn.FuncAsm(Index: Integer): TtkTokenKind;
   if IsCurrentToken(KeyWords[Index]) then
   begin
     Result := tkKey;
-    FRange := rsAsm;
-    FAsmStart := True;
+    fRange := rsAsm;
+    fAsmStart := True;
   end
   else
     Result := tkIdentifier
@@ -318,94 +331,96 @@ constructor TSynCppSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := True;
-
-  FAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler);
-  AddAttribute(FAsmAttri);
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style:= [fsItalic];
-  AddAttribute(FCommentAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
-  AddAttribute(FInvalidAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style:= [fsBold];
-  AddAttribute(FKeyAttri);
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-  FCharAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter);
-  AddAttribute(FCharAttri);
-  FFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat);
-  AddAttribute(FFloatAttri);
-  FHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal);
-  AddAttribute(FHexAttri);
-  FOctalAttri := TSynHighlighterAttributes.Create(SYNS_AttrOctal, SYNS_FriendlyAttrOctal);
-  AddAttribute(FOctalAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
-  FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
-  AddAttribute(FDirecAttri);
+  fCaseSensitive := True;
+  FNewPreprocesorStyle := False;
+
+  fAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler);
+  AddAttribute(fAsmAttri);
+  fBracketAttri := TSynHighLighterAttributes.Create(SYNS_AttrBrackets, SYNS_AttrBrackets);
+  AddAttribute(fBracketAttri);
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style:= [fsItalic];
+  AddAttribute(fCommentAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
+  AddAttribute(fInvalidAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style:= [fsBold];
+  AddAttribute(fKeyAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
+  fCharAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter);
+  AddAttribute(fCharAttri);
+  fFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat);
+  AddAttribute(fFloatAttri);
+  fHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal);
+  AddAttribute(fHexAttri);
+  fOctalAttri := TSynHighlighterAttributes.Create(SYNS_AttrOctal, SYNS_FriendlyAttrOctal);
+  AddAttribute(fOctalAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
+  fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
+  AddAttribute(fDirecAttri);
   SetAttributesOnChange(DefHighlightChange);
   InitIdent;
-  FRange := rsUnknown;
-  FAsmStart := False;
-  FDefaultFilter := SYNS_FilterCPP;
+  fRange := rsUnknown;
+  fAsmStart := False;
+  fDefaultFilter := SYNS_FilterCPP;
 end;
 
 procedure TSynCppSyn.AnsiCProc;
 begin
-  FTokenID := tkComment;
+  fTokenID := tkComment;
   case FLine[Run] of
     #0:
       begin
         NullProc;
-        Exit;
+        exit;
       end;
     #10:
       begin
         LFProc;
-        Exit;
+        exit;
       end;
     #13:
       begin
         CRProc;
-        Exit;
+        exit;
       end;
   end;
 
   while FLine[Run] <> #0 do
     case FLine[Run] of
       '*':
-        if FLine[Run + 1] = '/' then
+        if fLine[Run + 1] = '/' then
         begin
           Inc(Run, 2);
-          if FRange = rsAnsiCAsm then
-            FRange := rsAsm
-          else if FRange = rsAnsiCAsmBlock then
-            FRange := rsAsmBlock
-          else if (FRange = rsDirectiveComment) and
+          if fRange = rsAnsiCAsm then
+            fRange := rsAsm
+          else if fRange = rsAnsiCAsmBlock then
+            fRange := rsAsmBlock
+          else if (fRange = rsDirectiveComment) and
             not IsLineEnd(Run) then
-              FRange := rsMultiLineDirective
+              fRange := rsMultiLineDirective
           else
-            FRange := rsUnknown;
+            fRange := rsUnKnown;
           Break;
         end else
           Inc(Run);
-      #10, #13:
-        Break;
-      else
-        Inc(Run);
+      #10: Break;
+      #13: Break;
+    else Inc(Run);
     end;
 end;
 
 procedure TSynCppSyn.AndSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {and assign}
       begin
@@ -427,54 +442,54 @@ procedure TSynCppSyn.AndSymbolProc;
 
 procedure TSynCppSyn.AsciiCharProc;
 begin
-  FTokenID := tkChar;
+  fTokenID := tkChar;
   repeat
-    if FLine[Run] = '\' then begin
-      if CharInSet(FLine[Run + 1], [#39, '\']) then
+    if fLine[Run] = '\' then begin
+      if CharInSet(fLine[Run + 1], [#39, '\']) then
         Inc(Run);
     end;
     Inc(Run);
-  until IsLineEnd(Run) or (FLine[Run] = #39);
-  if FLine[Run] = #39 then
+  until IsLineEnd(Run) or (fLine[Run] = #39);
+  if fLine[Run] = #39 then
     Inc(Run);
 end;
 
 procedure TSynCppSyn.AtSymbolProc;
 begin
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
   Inc(Run);
 end;
 
 procedure TSynCppSyn.BraceCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkBracket;
   FExtTokenID := xtkBraceClose;
-  if FRange = rsAsmBlock then FRange := rsUnknown;
+  if fRange = rsAsmBlock then fRange := rsUnknown;
 end;
 
 procedure TSynCppSyn.BraceOpenProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkBracket;
   FExtTokenID := xtkBraceOpen;
-  if FRange = rsAsm then
+  if fRange = rsAsm then
   begin
-    FRange := rsAsmBlock;
-    FAsmStart := True;
+    fRange := rsAsmBlock;
+    fAsmStart := True;
   end;
 end;
 
 procedure TSynCppSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run + 1] = #10 then Inc(Run);
+  if fLine[Run + 1] = #10 then Inc(Run);
 end;
 
 procedure TSynCppSyn.ColonProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     ':':                               {scope resolution operator}
       begin
@@ -492,47 +507,68 @@ procedure TSynCppSyn.ColonProc;
 procedure TSynCppSyn.CommaProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkComma;
 end;
 
 procedure TSynCppSyn.DirectiveProc;
+var
+  WasWord: Boolean;
 begin
-  if WideTrim(FLine)[1] <> '#' then // '#' is not first char on the line, treat it as an invalid char
+  if FNewPreprocesorStyle then
   begin
-    FTokenID := tkUnknown;
-    Inc(Run);
-    Exit;
-  end;
-  FTokenID := tkDirective;
-  repeat
-    if FLine[Run] = '/' then // comment?
+    if Trim(fLine)[1] <> '#' then
     begin
-      if FLine[Run + 1] = '/' then // is end of directive as well
-      begin
-        FRange := rsUnknown;
-        Exit;
-      end
-      else
-        if FLine[Run + 1] = '*' then // might be embedded only
-        begin
-          FRange := rsDirectiveComment;
-          Exit;
-        end;
+      fTokenID := tkUnknown;
+      Inc(Run);
+      Exit;
     end;
-    if (FLine[Run] = '\') and (FLine[Run +1 ] = #0) then // a multiline directive
+    WasWord := False;
+    fTokenID := tkDirective;
+    fRange := rsUnknown;
+    repeat
+      if not WasWord and IsIdentChar(FLine[Run]) then WasWord := True;
+      Inc(Run);
+    until IsLineEnd(Run) or (fLine[Run] = ' ') and WasWord;
+  end
+  else
+  begin
+    if Trim(fLine)[1] <> '#' then // '#' is not first char on the line, treat it as an invalid char
     begin
+      fTokenID := tkUnknown;
       Inc(Run);
-      FRange := rsMultiLineDirective;
       Exit;
     end;
-    Inc(Run);
-  until IsLineEnd(Run)
+    fTokenID := tkDirective;
+    repeat
+      if fLine[Run] = '/' then // comment?
+      begin
+        if fLine[Run + 1] = '/' then // is end of directive as well
+        begin
+          fRange := rsUnknown;
+          Exit;
+        end
+        else
+          if fLine[Run + 1] = '*' then // might be embedded only
+          begin
+            fRange := rsDirectiveComment;
+            Exit;
+          end;
+      end;
+      if (fLine[Run] = '\') and (fLine[Run +1 ] = #0) then // a multiline directive
+      begin
+        Inc(Run);
+        fRange := rsMultiLineDirective;
+        Exit;
+      end;
+      Inc(Run);
+    until IsLineEnd(Run)
+  end;
 end;
 
 procedure TSynCppSyn.DirectiveEndProc;
 begin
-  FTokenID := tkDirective;
+  fTokenID := tkDirective;
   case FLine[Run] of
     #0:
       begin
@@ -550,31 +586,31 @@ procedure TSynCppSyn.DirectiveEndProc;
         Exit;
       end;
   end;
-  FRange := rsUnknown;
+  fRange := rsUnknown;
   repeat
     case FLine[Run] of
       #0, #10, #13: Break;
       '/': // comment?
         begin
-          case FLine[Run + 1] of
+          case fLine[Run + 1] of
             '/': // is end of directive as well
               begin
-                FRange := rsUnknown;
+                fRange := rsUnknown;
                 Exit;
               end;
             '*': // might be embedded only
               begin
-                FRange := rsDirectiveComment;
+                fRange := rsDirectiveComment;
                 Exit;
               end;
           end;
         end;
       '\': // yet another line?
         begin
-          if FLine[Run + 1] = #0 then
+          if fLine[Run + 1] = #0 then
           begin
             Inc(Run);
-            FRange := rsMultiLineDirective;
+            fRange := rsMultiLineDirective;
             Exit;
           end;
         end;
@@ -585,7 +621,7 @@ procedure TSynCppSyn.DirectiveEndProc;
 
 procedure TSynCppSyn.EqualProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {logical equal}
       begin
@@ -602,7 +638,7 @@ procedure TSynCppSyn.EqualProc;
 
 procedure TSynCppSyn.GreaterProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {greater than or equal to}
       begin
@@ -632,27 +668,27 @@ procedure TSynCppSyn.GreaterProc;
 
 procedure TSynCppSyn.QuestionProc;
 begin
-  FTokenID := tkSymbol;                {conditional}
+  fTokenID := tkSymbol;                {conditional}
   FExtTokenID := xtkQuestion;
   Inc(Run);
 end;
 
 procedure TSynCppSyn.IdentProc;
 begin
-  FTokenID := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  fTokenID := IdentKind((fLine + Run));
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
 end;
 
 procedure TSynCppSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynCppSyn.LowerProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {less than or equal to}
       begin
@@ -682,7 +718,7 @@ procedure TSynCppSyn.LowerProc;
 
 procedure TSynCppSyn.MinusProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {subtract assign}
       begin
@@ -709,7 +745,7 @@ procedure TSynCppSyn.MinusProc;
 
 procedure TSynCppSyn.ModSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {mod assign}
       begin
@@ -726,7 +762,7 @@ procedure TSynCppSyn.ModSymbolProc;
 
 procedure TSynCppSyn.NotSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {not equal}
       begin
@@ -743,7 +779,7 @@ procedure TSynCppSyn.NotSymbolProc;
 
 procedure TSynCppSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -751,7 +787,7 @@ procedure TSynCppSyn.NumberProc;
 
   function IsNumberChar(Run: Integer): Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X', '-', '+':
         Result := True;
       else
@@ -761,7 +797,7 @@ procedure TSynCppSyn.NumberProc;
 
   function IsDigitPlusMinusChar(Run: Integer): Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', '+', '-':
         Result := True;
       else
@@ -771,7 +807,7 @@ procedure TSynCppSyn.NumberProc;
 
   function IsHexDigit(Run: Integer): Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'a'..'f', 'A'..'F':
         Result := True;
       else
@@ -781,7 +817,7 @@ procedure TSynCppSyn.NumberProc;
 
   function IsAlphaUncerscore(Run: Integer): Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       'A'..'Z', 'a'..'z', '_':
         Result := True;
       else
@@ -795,7 +831,7 @@ procedure TSynCppSyn.NumberProc;
 begin
   idx1 := Run;
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar(Run) do
   begin
     case FLine[Run] of
@@ -803,104 +839,104 @@ procedure TSynCppSyn.NumberProc;
         if FLine[Succ(Run)] = '.' then
           Break
         else
-          if (FTokenID <> tkHex) then
-            FTokenID := tkFloat
+          if (fTokenID <> tkHex) then
+            fTokenID := tkFloat
           else // invalid
           begin
-            FTokenID := tkUnknown;
+            fTokenID := tkUnknown;
             Exit;
           end;
       '-', '+':
         begin
-          if FTokenID <> tkFloat then // number <> float. an arithmetic operator
+          if fTokenID <> tkFloat then // number <> float. an arithmetic operator
             Exit;
           if not CharInSet(FLine[Pred(Run)], ['e', 'E']) then
             Exit; // number = float, but no exponent. an arithmetic operator
           if not IsDigitPlusMinusChar(Succ(Run)) then // invalid
           begin
             Inc(Run);
-            FTokenID := tkUnknown;
+            fTokenID := tkUnknown;
             Exit;
           end
         end;
       '0'..'7':
         if (Run = Succ(idx1)) and (FLine[idx1] = '0') then // octal number
-          FTokenID := tkOctal;
+          fTokenID := tkOctal;
       '8', '9':
         if (FLine[idx1] = '0') and
-           ((FTokenID <> tkHex) and (FTokenID <> tkFloat)) then // invalid octal char
-             FTokenID := tkUnknown;
+           ((fTokenID <> tkHex) and (fTokenID <> tkFloat)) then // invalid octal char
+             fTokenID := tkUnknown;
       'a'..'d', 'A'..'D':
-        if FTokenID <> tkHex then // invalid char
+        if fTokenID <> tkHex then // invalid char
           Break;
       'e', 'E':
-        if (FTokenID <> tkHex) then
+        if (fTokenID <> tkHex) then
           if CharInSet(FLine[Pred(Run)], ['0'..'9']) then // exponent
           begin
             for i := idx1 to Pred(Run) do
               if CharInSet(FLine[i], ['e', 'E']) then // too many exponents
               begin
-                FTokenID := tkUnknown;
+                fTokenID := tkUnknown;
                 Exit;
               end;
             if not IsDigitPlusMinusChar(Succ(Run)) then
               Break
             else
-              FTokenID := tkFloat
+              fTokenID := tkFloat
           end
           else // invalid char
             Break;
       'f', 'F':
-        if FTokenID <> tkHex then
+        if fTokenID <> tkHex then
         begin
           for i := idx1 to Pred(Run) do
             if CharInSet(FLine[i], ['f', 'F']) then // declaration syntax error
             begin
-              FTokenID := tkUnknown;
+              fTokenID := tkUnknown;
               Exit;
             end;
-          if FTokenID = tkFloat then
+          if fTokenID = tkFloat then
           begin
-            if CharInSet(FLine[Pred(Run)], ['l', 'L']) then // can't mix
+            if CharInSet(fLine[Pred(Run)], ['l', 'L']) then // can't mix
               Break;
           end
           else
-            FTokenID := tkFloat;
+            fTokenID := tkFloat;
         end;
       'l', 'L':
         begin
           for i := idx1 to Run - 2 do
             if CharInSet(FLine[i], ['l', 'L']) then // declaration syntax error
             begin
-              FTokenID := tkUnknown;
+              fTokenID := tkUnknown;
               Exit;
             end;
-          if FTokenID = tkFloat then
-            if CharInSet(FLine[Pred(Run)], ['f', 'F']) then // can't mix
+          if fTokenID = tkFloat then
+            if CharInSet(fLine[Pred(Run)], ['f', 'F']) then // can't mix
               Break;
         end;
       'u', 'U':
-        if FTokenID = tkFloat then // not allowed
+        if fTokenID = tkFloat then // not allowed
           Break
         else
           for i := idx1 to Pred(Run) do
             if CharInSet(FLine[i], ['u', 'U']) then // declaration syntax error
             begin
-              FTokenID := tkUnknown;
+              fTokenID := tkUnknown;
               Exit;
             end;
       'x', 'X':
         if (Run = Succ(idx1)) and   // 0x... 'x' must be second char
            (FLine[idx1] = '0') and  // 0x...
            IsHexDigit(Succ(Run)) then // 0x... must be continued with a number
-             FTokenID := tkHex
+             fTokenID := tkHex
            else // invalid char
            begin
-             if not IsIdentChar(FLine[Succ(Run)]) and
+             if not IsIdentChar(fLine[Succ(Run)]) and
                 CharInSet(FLine[Succ(idx1)], ['x', 'X']) then
              begin
                Inc(Run); // highlight 'x' too
-               FTokenID := tkUnknown;
+               fTokenID := tkUnknown;
              end;
              Break;
            end;
@@ -908,12 +944,12 @@ procedure TSynCppSyn.NumberProc;
     Inc(Run);
   end; // while
   if IsAlphaUncerscore(Run) then
-    FTokenID := tkUnknown;
+    fTokenID := tkUnknown;
 end;
 
 procedure TSynCppSyn.OrSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {or assign}
       begin
@@ -935,7 +971,7 @@ procedure TSynCppSyn.OrSymbolProc;
 
 procedure TSynCppSyn.PlusProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {add assign}
       begin
@@ -957,7 +993,7 @@ procedure TSynCppSyn.PlusProc;
 
 procedure TSynCppSyn.PointProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
     begin                              {ellipse}
       Inc(Run, 3);
@@ -979,23 +1015,138 @@ procedure TSynCppSyn.PointProc;
 procedure TSynCppSyn.RoundCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkBracket;
   FExtTokenID := xtkRoundClose;
 end;
 
 procedure TSynCppSyn.RoundOpenProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkBracket;
   FExtTokenID := xtkRoundOpen;
 end;
 
+procedure TSynCppSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges;
+  LinesToScan: TStrings; FromLine, ToLine: Integer);
+var
+  CurLine: string;
+  Line: Integer;
+
+  function InsideComment(Line: Integer; Col: Integer): Boolean;
+  begin
+    Result := GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) = fCommentAttri;
+  end;
+
+  function LineHasChar(Line: Integer; character: char;
+  StartCol: Integer): Boolean; // faster than Pos!
+  var
+    I: Integer;
+  begin
+    Result := False;
+    for I := StartCol to Length(CurLine) do begin
+      if CurLine[I] = character then begin
+        // Char must have proper highlighting (ignore stuff inside comments...)
+        if not InsideComment(Line, I) then begin
+          Result := True;
+          Break;
+        end;
+      end;
+    end;
+  end;
+
+  function FindBraces(Line: Integer): Boolean;
+  var
+    Col: Integer;
+  begin
+    Result := False;
+
+    for Col := 1 to Length(CurLine) do
+    begin
+      // We've found a starting character
+      if CurLine[col] = '{' then
+      begin
+        // Char must have proper highlighting (ignore stuff inside comments...)
+        if not InsideComment(Line, Col) then
+        begin
+          // And ignore lines with both opening and closing chars in them
+          if not LineHasChar(Line, '}', col + 1) then begin
+            FoldRanges.StartFoldRange(Line + 1, 1);
+            Result := True;
+          end;
+          // Skip until a newline
+          Break;
+        end;
+      end else if CurLine[col] = '}' then
+      begin
+        // Char must have symbol attri too
+        if not InsideComment(Line, Col) then
+        begin
+          // And ignore lines with both opening and closing chars in them
+          if not LineHasChar(Line, '{', col + 1) then begin
+            FoldRanges.StopFoldRange(Line + 1, 1);
+            Result := True;
+          end;
+          // Skip until a newline
+          Break;
+        end;
+      end;
+    end; // for Col
+  end;
+
+  function FoldRegion(Line: Integer): Boolean;
+  var
+    S: string;
+  begin
+    Result := False;
+    S := TrimLeft(CurLine);
+    if Uppercase(Copy(S, 1, 14)) = '#PRAGMA REGION' then
+    begin
+      FoldRanges.StartFoldRange(Line + 1, FoldRegionType);
+      Result := True;
+    end
+    else if Uppercase(Copy(S, 1, 17)) = '#PRAGMA ENDREGION' then
+    begin
+      FoldRanges.StopFoldRange(Line + 1, FoldRegionType);
+      Result := True;
+    end;
+  end;
+
+begin
+  for Line := FromLine to ToLine do
+  begin
+    // Deal first with Multiline comments (Fold Type 2)
+    if TRangeState(GetLineRange(LinesToScan, Line)) = rsANSIc then
+    begin
+      if TRangeState(GetLineRange(LinesToScan, Line - 1)) <> rsANSIc then
+        FoldRanges.StartFoldRange(Line + 1, 2)
+      else
+        FoldRanges.NoFoldInfo(Line + 1);
+      Continue;
+    end
+    else if TRangeState(GetLineRange(LinesToScan, Line - 1)) = rsANSIc then
+    begin
+      FoldRanges.StopFoldRange(Line + 1, 2);
+      Continue;
+    end;
+
+    // Find Fold regions
+    CurLine := LinesToScan[Line];
+    if FoldRegion(Line) then
+      Continue;
+
+    // Find an braces on this line  (Fold Type 1)
+    CurLine := LinesToScan[Line];
+    if not FindBraces(Line) then
+      FoldRanges.NoFoldInfo(Line + 1);
+  end; // while Line
+end;
+
 procedure TSynCppSyn.SemiColonProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkSemiColon;
-  if FRange = rsAsm then FRange := rsUnknown;
+  if fRange = rsAsm then fRange := rsUnknown;
 end;
 
 procedure TSynCppSyn.SlashProc;
@@ -1003,43 +1154,43 @@ procedure TSynCppSyn.SlashProc;
   case FLine[Run + 1] of
     '/':                               {c++ style comments}
       begin
-        FTokenID := tkComment;
+        fTokenID := tkComment;
         Inc(Run, 2);
         while not IsLineEnd(Run) do Inc(Run);
       end;
     '*':                               {c style comments}
       begin
-        FTokenID := tkComment;
-        if FRange = rsAsm then
-          FRange := rsAnsiCAsm
-        else if FRange = rsAsmBlock then
-          FRange := rsAnsiCAsmBlock
-        else if FRange <> rsDirectiveComment then
-          FRange := rsAnsiC;
+        fTokenID := tkComment;
+        if fRange = rsAsm then
+          fRange := rsAnsiCAsm
+        else if fRange = rsAsmBlock then
+          fRange := rsAnsiCAsmBlock
+        else if fRange <> rsDirectiveComment then
+          fRange := rsAnsiC;
         Inc(Run, 2);
-        while FLine[Run] <> #0 do
-          case FLine[Run] of
+        while fLine[Run] <> #0 do
+          case fLine[Run] of
             '*':
-              if FLine[Run + 1] = '/' then
+              if fLine[Run + 1] = '/' then
               begin
                 Inc(Run, 2);
-                if FRange = rsDirectiveComment then
-                  FRange := rsMultiLineDirective
-                else if FRange = rsAnsiCAsm then
-                  FRange := rsAsm
+                if fRange = rsDirectiveComment then
+                  fRange := rsMultiLineDirective
+                else if fRange = rsAnsiCAsm then
+                  fRange := rsAsm
                 else
                   begin
-                  if FRange = rsAnsiCAsmBlock then
-                    FRange := rsAsmBlock
+                  if fRange = rsAnsiCAsmBlock then
+                    fRange := rsAsmBlock
                   else
-                    FRange := rsUnknown;
+                    fRange := rsUnKnown;
                   end;
                 Break;
               end else Inc(Run);
             #10, #13:
               begin
-                if FRange = rsDirectiveComment then
-                  FRange := rsAnsiC;
+                if fRange = rsDirectiveComment then
+                  fRange := rsAnsiC;
                 Break;
               end;
           else Inc(Run);
@@ -1048,13 +1199,13 @@ procedure TSynCppSyn.SlashProc;
     '=':                               {divide assign}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
         FExtTokenID := xtkDivideAssign;
       end;
   else                                 {divide}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
       FExtTokenID := xtkDivide;
     end;
   end;
@@ -1063,27 +1214,27 @@ procedure TSynCppSyn.SlashProc;
 procedure TSynCppSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynCppSyn.SquareCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkBracket;
   FExtTokenID := xtkSquareClose;
 end;
 
 procedure TSynCppSyn.SquareOpenProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkBracket;
   FExtTokenID := xtkSquareOpen;
 end;
 
 procedure TSynCppSyn.StarProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {multiply assign}
       begin
@@ -1100,29 +1251,29 @@ procedure TSynCppSyn.StarProc;
 
 procedure TSynCppSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
-    if FLine[Run] = '\' then begin
-      case FLine[Run + 1] of
+    if fLine[Run] = '\' then begin
+      case fLine[Run + 1] of
         #34, '\':
           Inc(Run);
         #00:
           begin
             Inc(Run);
-            FRange := rsMultilineString;
+            fRange := rsMultilineString;
             Exit;
           end;
       end;
     end;
     Inc(Run);
-  until IsLineEnd(Run) or (FLine[Run] = #34);
+  until IsLineEnd(Run) or (fLine[Run] = #34);
   if FLine[Run] = #34 then
     Inc(Run);
 end;
 
 procedure TSynCppSyn.StringEndProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
 
   case FLine[Run] of
     #0:
@@ -1142,20 +1293,20 @@ procedure TSynCppSyn.StringEndProc;
       end;
   end;
 
-  FRange := rsUnknown;
+  fRange := rsUnknown;
 
   repeat
     case FLine[Run] of
       #0, #10, #13: Break;
       '\':
         begin
-          case FLine[Run + 1] of
+          case fLine[Run + 1] of
             #34, '\':
               Inc(Run);
             #00:
               begin
                 Inc(Run);
-                FRange := rsMultilineString;
+                fRange := rsMultilineString;
                 Exit;
               end;
           end;
@@ -1163,7 +1314,7 @@ procedure TSynCppSyn.StringEndProc;
       #34: Break;
     end;
     Inc(Run);
-  until IsLineEnd(Run) or (FLine[Run] = #34);
+  until IsLineEnd(Run) or (fLine[Run] = #34);
   if FLine[Run] = #34 then
     Inc(Run);
 end;
@@ -1171,13 +1322,13 @@ procedure TSynCppSyn.StringEndProc;
 procedure TSynCppSyn.TildeProc;
 begin
   Inc(Run);                            {bitwise complement}
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
   FExtTokenID := xtkBitComplement;
 end;
 
 procedure TSynCppSyn.XOrSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
   	'=':                               {xor assign}
       begin
@@ -1195,21 +1346,22 @@ procedure TSynCppSyn.XOrSymbolProc;
 procedure TSynCppSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynCppSyn.Next;
 begin
-  FAsmStart := False;
-  FTokenPos := Run;
-  case FRange of
+  fAsmStart := False;
+  fTokenPos := Run;
+  case fRange of
     rsAnsiC, rsAnsiCAsm,
     rsAnsiCAsmBlock, rsDirectiveComment: AnsiCProc;
     rsMultiLineDirective: DirectiveEndProc;
     rsMultilineString: StringEndProc;
   else
     begin
-      case FLine[Run] of
+//      fRange := rsUnknown;
+      case fLine[Run] of
         '&': AndSymbolProc;
         #39: AsciiCharProc;
         '@': AtSymbolProc;
@@ -1254,12 +1406,12 @@ procedure TSynCppSyn.Next;
 function TSynCppSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -1267,19 +1419,19 @@ function TSynCppSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribut
 
 function TSynCppSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynCppSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 function TSynCppSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
-  if ((FRange = rsAsm) or (FRange = rsAsmBlock)) and not FAsmStart
-    and not (FTokenID in [tkComment, tkSpace, tkNull])
+  Result := fTokenId;
+  if ((fRange = rsAsm) or (fRange = rsAsmBlock)) and not fAsmStart
+    and not (fTokenId in [tkComment, tkSpace, tkNull])
   then
     Result := tkAsm;
 end;
@@ -1291,22 +1443,23 @@ function TSynCppSyn.GetExtTokenID: TxtkTokenKind;
 
 function TSynCppSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  FTokenID := GetTokenID;
-  case FTokenID of
-    tkAsm: Result := FAsmAttri;
-    tkComment: Result := FCommentAttri;
-    tkDirective: Result := FDirecAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkFloat: Result := FFloatAttri;
-    tkHex: Result := FHexAttri;
-    tkOctal: Result := FOctalAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkChar: Result := FCharAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkUnknown: Result := FInvalidAttri;
+  fTokenID := GetTokenID;
+  case fTokenID of
+    tkAsm: Result := fAsmAttri;
+    tkComment: Result := fCommentAttri;
+    tkDirective: Result := fDirecAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkFloat: Result := fFloatAttri;
+    tkHex: Result := fHexAttri;
+    tkOctal: Result := fOctalAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkChar: Result := fCharAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkUnknown: Result := fInvalidAttri;
+    tkBracket: Result := fBracketAttri;
     else Result := nil;
   end;
 end;
@@ -1318,18 +1471,18 @@ function TSynCppSyn.GetTokenKind: Integer;
 
 procedure TSynCppSyn.ResetRange;
 begin
-  FRange:= rsUnknown;
+  fRange:= rsUnknown;
 end;
 
 procedure TSynCppSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 procedure TSynCppSyn.EnumUserSettings(settings: TStrings);
 begin
   { returns the user settings that exist in the registry }
-  with TBetterRegistry.Create do
+  with TRegistry.Create do
   begin
     try
       RootKey := HKEY_LOCAL_MACHINE;
@@ -1351,8 +1504,8 @@ function TSynCppSyn.UseUserSettings(settingIndex: Integer): Boolean;
 // Possible parameter values:
 //   index into TStrings returned by EnumUserSettings
 // Possible return values:
-//   True : settings were read and used
-//   False: problem reading settings or invalid version specified - old settings
+//   true : settings were read and used
+//   false: problem reading settings or invalid version specified - old settings
 //          were preserved
 
   function ReadCPPBSettings(settingIndex: Integer): Boolean;
@@ -1361,27 +1514,26 @@ function TSynCppSyn.UseUserSettings(settingIndex: Integer): Boolean;
 
       function ReadCPPB1(settingTag: string; attri: TSynHighlighterAttributes; name: string): Boolean;
       var
-        i: Integer;
+        I: Integer;
       begin
-        for i := 1 to Length(name) do
-          if name[i] = ' ' then name[i] := '_';
+        for I := 1 to Length(name) do
+          if name[I] = ' ' then name[I] := '_';
         Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
-             '\SOFTWARE\Borland\C++Builder\' + settingTag + '\Highlight', name, True);
+             '\SOFTWARE\Borland\C++Builder\'+settingTag+'\Highlight',name, True);
       end; { ReadCPPB1 }
 
       function ReadCPPB3OrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean;
       begin
         Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER,
-          '\Software\Borland\C++Builder\' + settingTag + '\Editor\Highlight',
-          key, False);
+                 '\Software\Borland\C++Builder\'+settingTag+'\Editor\Highlight',
+                 key, False);
       end; { ReadCPPB3OrMore }
 
     begin { ReadCPPBSetting }
       try
-        if (settingTag[1] = '1') then
-          Result := ReadCPPB1(settingTag,attri,key)
-        else
-          Result := ReadCPPB3OrMore(settingTag,attri,key);
+        if (settingTag[1] = '1')
+          then Result := ReadCPPB1(settingTag,attri,key)
+          else Result := ReadCPPB3OrMore(settingTag,attri,key);
       except
         Result := False;
       end;
@@ -1410,8 +1562,7 @@ function TSynCppSyn.UseUserSettings(settingIndex: Integer): Boolean;
       EnumUserSettings(s);
       if settingIndex >= s.Count then
         Result := False
-      else
-      begin
+      else begin
         tmpStringAttri    := TSynHighlighterAttributes.Create('', '');
         tmpCharAttri      := TSynHighlighterAttributes.Create('', '');
         tmpNumberAttri    := TSynHighlighterAttributes.Create('', '');
@@ -1426,54 +1577,52 @@ function TSynCppSyn.UseUserSettings(settingIndex: Integer): Boolean;
         tmpInvalidAttri   := TSynHighlighterAttributes.Create('', '');
         tmpSpaceAttri     := TSynHighlighterAttributes.Create('', '');
         tmpDirecAttri     := TSynHighlighterAttributes.Create('', '');
-        tmpStringAttri    .Assign(FStringAttri);
-        tmpCharAttri      .Assign(FCharAttri);
-        tmpNumberAttri    .Assign(FNumberAttri);
-        tmpFloatAttri     .Assign(FFloatAttri);
-        tmpHexAttri       .Assign(FHexAttri);
-        tmpOctalAttri     .Assign(FOctalAttri);
-        tmpKeyAttri       .Assign(FKeyAttri);
-        tmpSymbolAttri    .Assign(FSymbolAttri);
-        tmpAsmAttri       .Assign(FAsmAttri);
-        tmpCommentAttri   .Assign(FCommentAttri);
-        tmpIdentifierAttri.Assign(FIdentifierAttri);
-        tmpInvalidAttri   .Assign(FInvalidAttri);
-        tmpSpaceAttri     .Assign(FSpaceAttri);
-        tmpDirecAttri     .Assign(FDirecAttri);
-        if s[settingIndex][1] = '1' then
-          Result := ReadCPPBSetting(s[settingIndex],FAsmAttri,'Plain text')
-        else
-          Result := ReadCPPBSetting(s[settingIndex],FAsmAttri,'Assembler');
+        tmpStringAttri    .Assign(fStringAttri);
+        tmpCharAttri      .Assign(fCharAttri);
+        tmpNumberAttri    .Assign(fNumberAttri);
+        tmpFloatAttri     .Assign(fFloatAttri);
+        tmpHexAttri       .Assign(fHexAttri);
+        tmpOctalAttri     .Assign(fOctalAttri);
+        tmpKeyAttri       .Assign(fKeyAttri);
+        tmpSymbolAttri    .Assign(fSymbolAttri);
+        tmpAsmAttri       .Assign(fAsmAttri);
+        tmpCommentAttri   .Assign(fCommentAttri);
+        tmpIdentifierAttri.Assign(fIdentifierAttri);
+        tmpInvalidAttri   .Assign(fInvalidAttri);
+        tmpSpaceAttri     .Assign(fSpaceAttri);
+        tmpDirecAttri     .Assign(fDirecAttri);
+        if s[settingIndex][1] = '1'
+          then Result := ReadCPPBSetting(s[settingIndex],fAsmAttri,'Plain text')
+          else Result := ReadCPPBSetting(s[settingIndex],fAsmAttri,'Assembler');
         Result := Result                                                         and
-                  ReadCPPBSetting(s[settingIndex],FCommentAttri,'Comment')       and
-                  ReadCPPBSetting(s[settingIndex],FIdentifierAttri,'Identifier') and
-                  ReadCPPBSetting(s[settingIndex],FInvalidAttri,'Illegal Char')  and
-                  ReadCPPBSetting(s[settingIndex],FKeyAttri,'Reserved word')     and
-                  ReadCPPBSetting(s[settingIndex],FNumberAttri,'Integer')        and
-                  ReadCPPBSetting(s[settingIndex],FFloatAttri,'Float')           and
-                  ReadCPPBSetting(s[settingIndex],FHexAttri,'Hex')               and
-                  ReadCPPBSetting(s[settingIndex],FOctalAttri,'Octal')           and
-                  ReadCPPBSetting(s[settingIndex],FSpaceAttri,'Whitespace')      and
-                  ReadCPPBSetting(s[settingIndex],FStringAttri,'String')         and
-                  ReadCPPBSetting(s[settingIndex],FCharAttri,'Character')             and
-                  ReadCPPBSetting(s[settingIndex],FSymbolAttri,'Symbol')         and
-                  ReadCPPBSetting(s[settingIndex],FDirecAttri,'Preprocessor');
-        if not Result then
-        begin
-          FStringAttri    .Assign(tmpStringAttri);
-          FCharAttri      .Assign(tmpCharAttri);
-          FNumberAttri    .Assign(tmpNumberAttri);
-          FFloatAttri     .Assign(tmpFloatAttri);
-          FHexAttri       .Assign(tmpHexAttri);
-          FOctalAttri     .Assign(tmpOctalAttri);
-          FKeyAttri       .Assign(tmpKeyAttri);
-          FSymbolAttri    .Assign(tmpSymbolAttri);
-          FAsmAttri       .Assign(tmpAsmAttri);
-          FCommentAttri   .Assign(tmpCommentAttri);
-          FIdentifierAttri.Assign(tmpIdentifierAttri);
-          FInvalidAttri   .Assign(tmpInvalidAttri);
-          FSpaceAttri     .Assign(tmpSpaceAttri);
-          FDirecAttri     .Assign(tmpDirecAttri);
+                  ReadCPPBSetting(s[settingIndex],fCommentAttri,'Comment')       and
+                  ReadCPPBSetting(s[settingIndex],fIdentifierAttri,'Identifier') and
+                  ReadCPPBSetting(s[settingIndex],fInvalidAttri,'Illegal Char')  and
+                  ReadCPPBSetting(s[settingIndex],fKeyAttri,'Reserved word')     and
+                  ReadCPPBSetting(s[settingIndex],fNumberAttri,'Integer')        and
+                  ReadCPPBSetting(s[settingIndex],fFloatAttri,'Float')           and
+                  ReadCPPBSetting(s[settingIndex],fHexAttri,'Hex')               and
+                  ReadCPPBSetting(s[settingIndex],fOctalAttri,'Octal')           and
+                  ReadCPPBSetting(s[settingIndex],fSpaceAttri,'Whitespace')      and
+                  ReadCPPBSetting(s[settingIndex],fStringAttri,'String')         and
+                  ReadCPPBSetting(s[settingIndex],fCharAttri,'Character')             and
+                  ReadCPPBSetting(s[settingIndex],fSymbolAttri,'Symbol')         and
+                  ReadCPPBSetting(s[settingIndex],fDirecAttri,'Preprocessor');
+        if not Result then begin
+          fStringAttri    .Assign(tmpStringAttri);
+          fCharAttri      .Assign(tmpCharAttri);
+          fNumberAttri    .Assign(tmpNumberAttri);
+          fFloatAttri     .Assign(tmpFloatAttri);
+          fHexAttri       .Assign(tmpHexAttri);
+          fOctalAttri     .Assign(tmpOctalAttri);
+          fKeyAttri       .Assign(tmpKeyAttri);
+          fSymbolAttri    .Assign(tmpSymbolAttri);
+          fAsmAttri       .Assign(tmpAsmAttri);
+          fCommentAttri   .Assign(tmpCommentAttri);
+          fIdentifierAttri.Assign(tmpIdentifierAttri);
+          fInvalidAttri   .Assign(tmpInvalidAttri);
+          fSpaceAttri     .Assign(tmpSpaceAttri);
+          fDirecAttri     .Assign(tmpDirecAttri);
         end;
         tmpStringAttri    .Free;
         tmpCharAttri      .Free;
@@ -1490,9 +1639,7 @@ function TSynCppSyn.UseUserSettings(settingIndex: Integer): Boolean;
         tmpSpaceAttri     .Free;
         tmpDirecAttri     .Free;
       end;
-    finally
-      s.Free;
-    end;
+    finally s.Free; end;
   end; { ReadCPPBSettings }
 
 begin
@@ -1501,7 +1648,7 @@ function TSynCppSyn.UseUserSettings(settingIndex: Integer): Boolean;
 
 function TSynCppSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterCPP;
+  Result := fDefaultFilter <> SYNS_FilterCPP;
 end;
 
 class function TSynCppSyn.GetLanguageName: string;
@@ -1514,39 +1661,46 @@ class function TSynCppSyn.GetCapabilities: TSynHighlighterCapabilities;
   Result := inherited GetCapabilities + [hcUserSettings];
 end;
 
-function TSynCppSyn.GetSampleSource: UnicodeString;
-begin
-  Result :=
-    '// Syntax Highlighting'#13#10+
-    'void __fastcall TForm1::Button1Click(TObject *Sender)'#13#10+
-    '{'#13#10+
-    '  int number = 123456;'#13#10+
-    '  char c = ''a'';'#13#10+
-    '  Caption = "The number is " + IntToStr(i);'#13#10+
-    '  for (int i = 0; i <= number; i++)'#13#10+
-    '  {'#13#10+
-    '    x -= 0xff;'#13#10+
-    '    x -= 023;'#13#10+
-    '    x += 1.0;'#13#10+
-    '    x += @; /* illegal character */'#13#10+
-    '  }'#13#10+
-    '  #ifdef USE_ASM'#13#10+
-    '    asm'#13#10+
-    '    {'#13#10+
-    '      ASM MOV AX, 0x1234'#13#10+
-    '      ASM MOV i, AX'#13#10+
-    '    }'#13#10+
-    '  #endif'#13#10+
-    '}';
+function TSynCppSyn.GetSampleSource: string;
+begin
+  Result := '// Syntax Highlighting'#13#10+
+            'void __fastcall TForm1::Button1Click(TObject *Sender)'#13#10+
+            '{'#13#10+
+            '  int number = 123456;'#13#10+
+            '  char c = ''a'';'#13#10+
+            '  Caption = "The number is " + IntToStr(i);'#13#10+
+            '  for (int i = 0; i <= number; i++)'#13#10+
+            '  {'#13#10+
+            '    x -= 0xff;'#13#10+
+            '    x -= 023;'#13#10+
+            '    x += 1.0;'#13#10+
+            '    x += @; /* illegal character */'#13#10+
+            '  }'#13#10+
+            '  #ifdef USE_ASM'#13#10+
+            '    asm'#13#10+
+            '    {'#13#10+
+            '      ASM MOV AX, 0x1234'#13#10+
+            '      ASM MOV i, AX'#13#10+
+            '    }'#13#10+
+            '  #endif'#13#10+
+            '}';
+
 end;
 
-class function TSynCppSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynCppSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangCPP;
 end;
 
+procedure TSynCppSyn.SetNewPreprocesorStyle(const Value: Boolean);
+begin
+  if FNewPreprocesorStyle <> Value then
+  begin
+    FNewPreprocesorStyle := Value;
+    ResetRange;
+  end;
+end;
+
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynCppSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterCss.pas b/Ext/SynEdit/Source/SynHighlighterCss.pas
index 362dcba..c3f7632 100644
--- a/Ext/SynEdit/Source/SynHighlighterCss.pas
+++ b/Ext/SynEdit/Source/SynHighlighterCss.pas
@@ -58,13 +58,13 @@
 interface
 
 uses
-  Graphics,
+  System.SysUtils,
+  System.Classes,
+  System.Generics.Defaults,
+  System.Generics.Collections,
+  Vcl.Graphics,
   SynEditTypes,
-  SynEditHighlighter,
-  SynHighlighterHashEntries,
-  SynUnicode,
-  SysUtils,
-  Classes;
+  SynEditHighlighter;
 
 type
   TtkTokenKind = (tkComment, tkAtRule, tkProperty, tkSelector, tkSelectorAttrib,
@@ -76,27 +76,26 @@ interface
 
   TSynCssSyn = class(TSynCustomHighlighter)
   private
-    FRange: TRangeState;
-    FCommentRange: TRangeState;
-    FParameterRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    FCommentAttri: TSynHighlighterAttributes;
-    FPropertyAttri: TSynHighlighterAttributes;
-    FAttributeAttri: TSynHighlighterAttributes;
-    FSelectorAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FColorAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FTextAttri: TSynHighlighterAttributes;
-    FValueAttri: TSynHighlighterAttributes;
-    FUndefPropertyAttri: TSynHighlighterAttributes;
-    FImportantPropertyAttri: TSynHighlighterAttributes;
-    FAtRuleAttri: TSynHighlighterAttributes;
-    FKeywords: TSynHashEntryList;
-    procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
-    function HashKey(Str: PWideChar): Integer;
+    fRange: TRangeState;
+    fCommentRange: TRangeState;
+    fParameterRange: TRangeState;
+    fTokenID: TtkTokenKind;
+    fCommentAttri: TSynHighlighterAttributes;
+    fPropertyAttri: TSynHighlighterAttributes;
+    fAttributeAttri: TSynHighlighterAttributes;
+    fSelectorAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fColorAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    fTextAttri: TSynHighlighterAttributes;
+    fValueAttri: TSynHighlighterAttributes;
+    fUndefPropertyAttri: TSynHighlighterAttributes;
+    fImportantPropertyAttri: TSynHighlighterAttributes;
+    fAtRuleAttri: TSynHighlighterAttributes;
+    FKeywords: TDictionary;
+    procedure DoAddKeyword(AKeyword: string; AKind: Integer);
     function IdentKind(MayBe: PWideChar): TtkTokenKind;
     procedure AtRuleProc;
     procedure SelectorProc;
@@ -123,17 +122,16 @@   TSynCssSyn = class(TSynCustomHighlighter)
     procedure PlusProc;
     procedure TildeProc;
     procedure PipeProc;
-    procedure CircumflexProc;
-    procedure AttrContainProc;
+    procedure WildCardProc;
     procedure EqualProc;
     procedure ExclamProc;
   protected
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     function IsFilterStored: Boolean; override;
     procedure NextDeclaration;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
@@ -148,43 +146,44 @@   TSynCssSyn = class(TSynCustomHighlighter)
     procedure SetRange(Value: Pointer); override;
     procedure ResetRange; override;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property PropertyAttri: TSynHighlighterAttributes read FPropertyAttri
-      write FPropertyAttri;
-    property ColorAttri: TSynHighlighterAttributes read FColorAttri
-      write FColorAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property AtRuleAttri: TSynHighlighterAttributes read FAtRuleAttri
-      write FAtRuleAttri;
-    property SelectorAttri: TSynHighlighterAttributes read FSelectorAttri
-      write FSelectorAttri;
-    property AttributeAttri: TSynHighlighterAttributes read FAttributeAttri
-      write FAttributeAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
-    property TextAttri: TSynHighlighterAttributes read FTextAttri
-      write FTextAttri;
-    property ValueAttri: TSynHighlighterAttributes read FValueAttri
-      write FValueAttri;
-    property UndefPropertyAttri: TSynHighlighterAttributes read FUndefPropertyAttri
-      write FUndefPropertyAttri;
-    property ImportantPropertyAttri: TSynHighlighterAttributes read FImportantPropertyAttri
-      write FImportantPropertyAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property PropertyAttri: TSynHighlighterAttributes read fPropertyAttri
+      write fPropertyAttri;
+    property ColorAttri: TSynHighlighterAttributes read fColorAttri
+      write fColorAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property AtRuleAttri: TSynHighlighterAttributes read fAtRuleAttri
+      write fAtRuleAttri;
+    property SelectorAttri: TSynHighlighterAttributes read fSelectorAttri
+      write fSelectorAttri;
+    property AttributeAttri: TSynHighlighterAttributes read fAttributeAttri
+      write fAttributeAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
+    property TextAttri: TSynHighlighterAttributes read fTextAttri
+      write fTextAttri;
+    property ValueAttri: TSynHighlighterAttributes read fValueAttri
+      write fValueAttri;
+    property UndefPropertyAttri: TSynHighlighterAttributes read fUndefPropertyAttri
+      write fUndefPropertyAttri;
+    property ImportantPropertyAttri: TSynHighlighterAttributes read fImportantPropertyAttri
+      write fImportantPropertyAttri;
   end;
 
 implementation
 
 uses
+  SynEditMiscProcs,
   SynEditStrConst;
 
 const
-   Properties_CSS1 : UnicodeString =
+   Properties_CSS1: string =
                       'background'
                      +',background-attachment'
                      +',background-color'
@@ -246,7 +245,7 @@ implementation
                      +',white-space'
                      +',width'
                      +',word-spacing';
-   Properties_CSS2 : UnicodeString =
+   Properties_CSS2: string =
                       'border-collapse'
                      +',border-spacing'
                      +',bottom'
@@ -281,7 +280,7 @@ implementation
                      +',visibility'
                      +',widows'
                      +',z-index';
-   Properties_CSS2_Aural : UnicodeString =
+   Properties_CSS2_Aural: string =
                       'azimuth'
                      +',cue'
                      +',cue-after'
@@ -302,7 +301,7 @@ implementation
                      +',stress'
                      +',voice-family'
                      +',volume';
-   Properties_CSS3 : UnicodeString =
+   Properties_CSS3: string =
                       '@font-face'
                      +',@font-feature-values'
                      +',@keyframes'
@@ -500,120 +499,90 @@ implementation
 
 { TSynCssSyn }
 
-{$Q-}
-function TSynCssSyn.HashKey(Str: PWideChar): Integer;
-begin
-  Result := 0;
-  while CharInSet(Str^, ['a'..'z', 'A'..'Z', '_', '-']) do
-  begin
-    if Str^ <> '-' then
-    case Str^ of
-      '_': Inc(Result, 27);
-      '-': Inc(Result, 28);
-      else Inc(Result, Ord(SynWideUpperCase(Str^)[1]) - 64);
-    end;
-    Inc(Str);
-  end;
-  while CharInSet(Str^, ['0'..'9']) do
-  begin
-    Inc(Result, Ord(Str^) - Ord('0'));
-    Inc(Str);
-  end;
-  FStringLen := Str - FToIdent;
-end;
-{$Q+}
-
 function TSynCssSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
-  Entry: TSynHashEntry;
+  S: string;
 begin
-  FToIdent := MayBe;
-  Entry := FKeywords[HashKey(MayBe)];
-  while Assigned(Entry) do
-  begin
-    if Entry.KeywordLen > FStringLen then
-      Break
-    else if Entry.KeywordLen = FStringLen then
-      if IsCurrentToken(Entry.Keyword) then
-      begin
-        Result := TtkTokenKind(Entry.Kind);
-        Exit;
-      end;
-    Entry := Entry.Next;
-  end;
-  Result := tkUndefProperty;
+  fToIdent := MayBe;
+  while IsIdentChar(MayBe^) do
+    Inc(Maybe);
+  fStringLen := Maybe - fToIdent;
+  SetString(S, fToIdent, fStringLen);
+  if FKeywords.ContainsKey(S) then
+    Result := FKeywords[S]
+  else
+    Result := tkUndefProperty;
 end;
 
-procedure TSynCssSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
-var
-  HashValue: Integer;
+procedure TSynCssSyn.DoAddKeyword(AKeyword: string; AKind: Integer);
 begin
-  HashValue := HashKey(PWideChar(AKeyword));
-  FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
+  if not FKeywords.ContainsKey(AKeyword) then
+    FKeywords.Add(AKeyword, TtkTokenKind(AKind));
 end;
 
 constructor TSynCssSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
+  fCaseSensitive := False;
 
-  FKeywords := TSynHashEntryList.Create;
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  AddAttribute(FCommentAttri);
+  // Create the keywords dictionary case-insensitive
+  FKeywords := TDictionary.Create(TIStringComparer.Ordinal);
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  AddAttribute(fCommentAttri);
 
-  FPropertyAttri := TSynHighlighterAttributes.Create(SYNS_AttrProperty, SYNS_FriendlyAttrProperty);
-  FPropertyAttri.Style := [fsBold];
-  AddAttribute(FPropertyAttri);
+  fPropertyAttri := TSynHighlighterAttributes.Create(SYNS_AttrProperty, SYNS_FriendlyAttrProperty);
+  fPropertyAttri.Style := [fsBold];
+  AddAttribute(fPropertyAttri);
 
-  FSelectorAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FSelectorAttri.Style := [fsBold];
-  FSelectorAttri.Foreground := $00ff0080;
-  AddAttribute(FSelectorAttri);
+  fSelectorAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fSelectorAttri.Style := [fsBold];
+  fSelectorAttri.Foreground := $00ff0080;
+  AddAttribute(fSelectorAttri);
 
-  FAttributeAttri := TSynHighlighterAttributes.Create(SYNS_AttrAttribute, SYNS_FriendlyAttrAttribute);
-  FAttributeAttri.Style := [];
-  FAttributeAttri.Foreground := $00ff0080;
-  AddAttribute(FAttributeAttri);
+  fAttributeAttri := TSynHighlighterAttributes.Create(SYNS_AttrAttribute, SYNS_FriendlyAttrAttribute);
+  fAttributeAttri.Style := [];
+  fAttributeAttri.Foreground := $00ff0080;
+  AddAttribute(fAttributeAttri);
 
-  FAtRuleAttri := TSynHighlighterAttributes.Create(SYNS_AttrAtRules, SYNS_FriendlyAttrAttribute);
-  FAtRuleAttri.Style := [];
-  FAtRuleAttri.Foreground := $00808000;
-  AddAttribute(FAtRuleAttri);
+  fAtRuleAttri := TSynHighlighterAttributes.Create(SYNS_AttrAtRules, SYNS_FriendlyAttrAttribute);
+  fAtRuleAttri.Style := [];
+  fAtRuleAttri.Foreground := $00808000;
+  AddAttribute(fAtRuleAttri);
 
-  FUndefPropertyAttri := TSynHighlighterAttributes.Create(
+  fUndefPropertyAttri := TSynHighlighterAttributes.Create(
     SYNS_AttrUndefinedProperty, SYNS_FriendlyAttrUndefinedProperty);
-  FUndefPropertyAttri.Style := [fsBold];
-  FUndefPropertyAttri.Foreground := $00ff0080;
-  AddAttribute(FUndefPropertyAttri);
+  fUndefPropertyAttri.Style := [fsBold];
+  fUndefPropertyAttri.Foreground := $00ff0080;
+  AddAttribute(fUndefPropertyAttri);
 
-  FImportantPropertyAttri := TSynHighlighterAttributes.Create(
+  fImportantPropertyAttri := TSynHighlighterAttributes.Create(
     'Important', 'Important Marker');
-  FImportantPropertyAttri.Style := [fsBold];
-  FImportantPropertyAttri.Foreground := clRed;
-  AddAttribute(FImportantPropertyAttri);
+  fImportantPropertyAttri.Style := [fsBold];
+  fImportantPropertyAttri.Foreground := clRed;
+  AddAttribute(fImportantPropertyAttri);
 
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
 
-  FColorAttri := TSynHighlighterAttributes.Create(SYNS_AttrColor, SYNS_FriendlyAttrColor);
-  AddAttribute(FColorAttri);
+  fColorAttri := TSynHighlighterAttributes.Create(SYNS_AttrColor, SYNS_FriendlyAttrColor);
+  AddAttribute(fColorAttri);
 
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
 
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
 
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
 
-  FTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText);
-  AddAttribute(FTextAttri);
+  fTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText);
+  AddAttribute(fTextAttri);
 
-  FValueAttri := TSynHighlighterAttributes.Create(SYNS_AttrValue, SYNS_FriendlyAttrValue);
-  FValueAttri.Foreground := $00ff8000;
-  AddAttribute(FValueAttri);
+  fValueAttri := TSynHighlighterAttributes.Create(SYNS_AttrValue, SYNS_FriendlyAttrValue);
+  fValueAttri.Foreground := $00ff8000;
+  AddAttribute(fValueAttri);
 
   SetAttributesOnChange(DefHighlightChange);
 
@@ -623,13 +592,13 @@ constructor TSynCssSyn.Create(AOwner: TComponent);
   EnumerateKeywords(Ord(tkProperty), Properties_CSS2_Aural, IsIdentChar, DoAddKeyword);
   EnumerateKeywords(Ord(tkProperty), Properties_CSS3, IsIdentChar, DoAddKeyword);
 
-  FRange := rsSelector;
-  FDefaultFilter := SYNS_FilterCSS;
+  fRange := rsSelector;
+  fDefaultFilter := SYNS_FilterCSS;
 end;
 
 destructor TSynCssSyn.Destroy;
 begin
-  FKeywords.Free;
+  fKeywords.Free;
   inherited Destroy;
 end;
 
@@ -637,7 +606,7 @@ procedure TSynCssSyn.AttributeProc;
 
   function IsStopChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       #0..#31, ']', '~', '^', '$', '*', '|', '=':
         Result := True;
       else
@@ -648,82 +617,71 @@ procedure TSynCssSyn.AttributeProc;
 begin
   if IsStopChar then
   begin
-    case FLine[Run] of
-      #0..#31, '{', '/': NextDeclaration;
+    case fLine[Run] of
+      #0..#31: NextDeclaration;
       ']': BracketCloseProc;
       '~': TildeProc;
       '|': PipeProc;
       '=': EqualProc;
-      '^': CircumflexProc;
-      '*': AttrContainProc;
+      '^', '*', '$': WildCardProc;
     end;
     Exit;
   end;
 
-  FTokenID := tkSelectorAttrib;
+  fTokenID := tkSelectorAttrib;
   while not IsStopChar do
     Inc(Run);
 end;
 
 procedure TSynCssSyn.BraceCloseProc;
 begin
-  FRange := rsSelector;
-  FTokenID := tkSymbol;
+  fRange := rsSelector;
+  fTokenId := tkSymbol;
   Inc(Run);
 end;
 
 procedure TSynCssSyn.BraceOpenProc;
 begin
   Inc(Run);
-  FRange := rsDeclaration;
-  FTokenID := tkSymbol;
+  fRange := rsDeclaration;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynCssSyn.BracketCloseProc;
 begin
-  FTokenID := tkSymbol;
-  FRange := rsSelector;
+  fTokenID := tkSymbol;
+  fRange := rsSelector;
   Inc(Run);
 end;
 
 procedure TSynCssSyn.BracketOpenProc;
 begin
   Inc(Run);
-  FRange := rsAttrib;
-  FTokenID := tkSymbol;
+  fRange := rsAttrib;
+  fTokenID := tkSymbol;
 end;
 
-procedure TSynCssSyn.CircumflexProc;
+procedure TSynCssSyn.WildCardProc;
 begin
   Inc(Run);
-  if FLine[Run] = '=' then
+  if fLine[Run] = '=' then
   begin
     Inc(Run);
-    FTokenID := tkSymbol;
-  end;
-end;
-
-procedure TSynCssSyn.AttrContainProc;
-begin
-  Inc(Run);
-  if FLine[Run] = '=' then
-  begin
-    Inc(Run);
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynCssSyn.CommentProc;
 begin
-  if FLine[Run] = #0 then
+  if fLine[Run] = #0 then
     NullProc
   else
   begin
-    FTokenID := tkComment;
+    fTokenID := tkComment;
     repeat
-      if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then
+      if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then
       begin
-        FRange := FCommentRange;
+        fRange := fCommentRange;
         Inc(Run, 2);
         Break;
       end;
@@ -734,22 +692,22 @@ procedure TSynCssSyn.CommentProc;
 
 procedure TSynCssSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run] = #10 then Inc(Run);
+  if fLine[Run] = #10 then Inc(Run);
 end;
 
 procedure TSynCssSyn.SemiProc;
 begin
-  FRange := rsUnknown;
-  FTokenID := tkSymbol;
+  fRange := rsUnknown;
+  fTokenID := tkSymbol;
   Inc(Run);
 end;
 
 procedure TSynCssSyn.StartValProc;
 begin
-  FRange := rsValue;
-  FTokenID := tkSymbol;
+  fRange := rsValue;
+  fTokenID := tkSymbol;
   Inc(Run);
 end;
 
@@ -760,7 +718,7 @@ procedure TSynCssSyn.NumberProc;
   else
   begin
     Inc(Run);
-    FTokenID := tkNumber;
+    fTokenID := tkNumber;
     while CharInSet(FLine[Run], ['0'..'9', '.']) do
     begin
       case FLine[Run] of
@@ -774,74 +732,74 @@ procedure TSynCssSyn.NumberProc;
 
 procedure TSynCssSyn.ParenCloseProc;
 begin
-  FRange := FParameterRange;
-  FTokenID := tkSymbol;
+  fRange := fParameterRange;
+  fTokenID := tkSymbol;
   Inc(Run);
 end;
 
 procedure TSynCssSyn.ParenOpenProc;
 begin
   Inc(Run);
-  FParameterRange := FRange;
-  FRange := rsParameter;
-  FTokenID := tkSymbol;
+  fParameterRange := fRange;
+  fRange := rsParameter;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynCssSyn.PipeProc;
 begin
   Inc(Run);
-  if FLine[Run] = '=' then
+  if fLine[Run] = '=' then
   begin
     Inc(Run);
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynCssSyn.PlusProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynCssSyn.IdentProc;
 begin
-  case FRange of
+  case fRange of
     rsProperty:
       begin
-        FRange := rsDeclaration;
-        FTokenID := tkSelector;
-        Inc(Run, FStringLen);
+        fRange := rsDeclaration;
+        fTokenID := tkSelector;
+        Inc(Run, fStringLen);
       end;
     rsValue, rsParameter:
       begin
-        FTokenID := tkValue;
+        fTokenID := tkValue;
 
         while not IsLineEnd(Run) and
-          not CharInSet(FLine[Run], ['(', ')', '}', ';', ',', ' ']) do
+          not CharInSet(fLine[Run], ['(', ')', '}', ';', ',', ' ']) do
         begin
           Inc(Run);
         end;
 
-        if IsLineEnd(Run) or CharInSet(FLine[Run], ['}', ';']) then
-          FRange := rsDeclaration;
+        if IsLineEnd(Run) or CharInSet(fLine[Run], ['}', ';']) then
+          fRange := rsDeclaration;
       end;
     else
-      FTokenID := IdentKind((FLine + Run));
+      fTokenID := IdentKind((fLine + Run));
       repeat
         Inc(Run);
-      until (FLine[Run] <= #32) or CharInSet(FLine[Run], [':', '"', '}', ';']);
+      until (fLine[Run] <= #32) or CharInSet(fLine[Run], [':', '"', '}', ';']);
   end;
 end;
 
 procedure TSynCssSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynCssSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -849,7 +807,7 @@ procedure TSynCssSyn.AtRuleProc;
 
   function IsStopChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       #0..#31, '{', ';':
         Result := True;
       else
@@ -860,13 +818,13 @@ procedure TSynCssSyn.AtRuleProc;
 begin
   if IsStopChar then
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       #0..#31, '{', ';': SelectorProc;
     end;
     Exit;
   end;
 
-  FTokenID := tkAtRule;
+  fTokenID := tkAtRule;
   while not IsStopChar do
     Inc(Run);
 end;
@@ -875,7 +833,7 @@ procedure TSynCssSyn.SelectorProc;
 
   function IsStopChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       #0..#31, '{', '/', '[', ']', '>', '+', '~':
         Result := True;
       else
@@ -884,14 +842,14 @@ procedure TSynCssSyn.SelectorProc;
   end;
 
 begin
-  if FLine[Run] = '}' then
+  if fLine[Run] = '}' then
   begin
     Inc(Run);
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
     Exit;
   end;
 
-  if FLine[Run] = '@' then
+  if fLine[Run] = '@' then
   begin
     Inc(Run);
     AtRuleProc;
@@ -900,7 +858,7 @@ procedure TSynCssSyn.SelectorProc;
 
   if IsStopChar then
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       #0..#31, '{', '/': NextDeclaration;
       '[': BracketOpenProc;
       ']': BracketCloseProc;
@@ -911,7 +869,7 @@ procedure TSynCssSyn.SelectorProc;
     Exit;
   end;
 
-  FTokenID := tkSelector;
+  fTokenID := tkSelector;
   while not IsStopChar do
     Inc(Run);
 end;
@@ -919,33 +877,33 @@ procedure TSynCssSyn.SelectorProc;
 procedure TSynCssSyn.TildeProc;
 begin
   Inc(Run);
-  if FLine[Run] = '=' then
+  if fLine[Run] = '=' then
   begin
     Inc(Run);
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynCssSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynCssSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   Inc(Run);  // first '"'
-  while not (IsLineEnd(Run) or (FLine[Run] = '"')) do Inc(Run);
-  if FLine[Run] = '"' then Inc(Run);  // last '"'
+  while not (IsLineEnd(Run) or (fLine[Run] = '"')) do Inc(Run);
+  if fLine[Run] = '"' then Inc(Run);  // last '"'
 end;
 
 procedure TSynCssSyn.HashProc;
 
   function IsHexChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f':
         Result := True;
       else
@@ -954,7 +912,7 @@ procedure TSynCssSyn.HashProc;
   end;
 
 begin
-  FTokenID := tkColor;
+  fTokenID := tkColor;
   Inc(Run);  // '#'
   while IsHexChar do Inc(Run);
 end;
@@ -962,22 +920,22 @@ procedure TSynCssSyn.HashProc;
 procedure TSynCssSyn.EqualProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynCssSyn.ExclamProc;
 begin
-  if (FLine[Run + 1] = 'i') and
-    (FLine[Run + 2] = 'm') and
-    (FLine[Run + 3] = 'p') and
-    (FLine[Run + 4] = 'o') and
-    (FLine[Run + 5] = 'r') and
-    (FLine[Run + 6] = 't') and
-    (FLine[Run + 7] = 'a') and
-    (FLine[Run + 8] = 'n') and
-    (FLine[Run + 9] = 't') then
+  if (fLine[Run + 1] = 'i') and
+    (fLine[Run + 2] = 'm') and
+    (fLine[Run + 3] = 'p') and
+    (fLine[Run + 4] = 'o') and
+    (fLine[Run + 5] = 'r') and
+    (fLine[Run + 6] = 't') and
+    (fLine[Run + 7] = 'a') and
+    (fLine[Run + 8] = 'n') and
+    (fLine[Run + 9] = 't') then
   begin
-    FTokenID := tkImportant;
+    fTokenID := tkImportant;
     Inc(Run, 10);
   end
   else
@@ -987,23 +945,23 @@ procedure TSynCssSyn.ExclamProc;
 procedure TSynCssSyn.SlashProc;
 begin
   Inc(Run);
-  if FLine[Run] = '*' then
+  if fLine[Run] = '*' then
   begin
-    FTokenID := tkComment;
-    FCommentRange := FRange;
-    FRange := rsComment;
+    fTokenID := tkComment;
+    fCommentRange := fRange;
+    fRange := rsComment;
     Inc(Run);
     if not IsLineEnd(Run) then
       CommentProc;
   end
   else
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
 end;
 
 procedure TSynCssSyn.Next;
 begin
-  FTokenPos := Run;
-  case FRange of
+  fTokenPos := Run;
+  case fRange of
     rsSelector:
       SelectorProc;
     rsAttrib:
@@ -1013,13 +971,12 @@ procedure TSynCssSyn.Next;
     else
       NextDeclaration;
   end;
-
   inherited;
 end;
 
 procedure TSynCssSyn.NextDeclaration;
 begin
-  case FLine[Run] of
+  case fLine[Run] of
     #0: NullProc;
     #10: LFProc;
     #13: CRProc;
@@ -1042,72 +999,72 @@ procedure TSynCssSyn.NextDeclaration;
 function TSynCssSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_KEYWORD: Result := FSelectorAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_KEYWORD: Result := fSelectorAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
     else Result := nil;
   end;
 end;
 
 function TSynCssSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynCssSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynCssSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  case FTokenID of
-    tkComment: Result := FCommentAttri;
-    tkAtRule: Result := FAtRuleAttri;
-    tkProperty: Result := FPropertyAttri;
-    tkSelector: Result := FSelectorAttri;
-    tkSelectorAttrib: Result := FAttributeAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkText: Result := FTextAttri;
-    tkUndefProperty: Result := FUndefPropertyAttri;
-    tkImportant: Result := FImportantPropertyAttri;
-    tkValue: Result := FValueAttri;
-    tkColor: Result := FColorAttri;
-    tkNumber: Result := FNumberAttri;
+  case fTokenID of
+    tkComment: Result := fCommentAttri;
+    tkAtRule: Result := fAtRuleAttri;
+    tkProperty: Result := fPropertyAttri;
+    tkSelector: Result := fSelectorAttri;
+    tkSelectorAttrib: Result := fAttributeAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkText: Result := fTextAttri;
+    tkUndefProperty: Result := fUndefPropertyAttri;
+    tkImportant: Result := fImportantPropertyAttri;
+    tkValue: Result := fValueAttri;
+    tkColor: Result := fColorAttri;
+    tkNumber: Result := fNumberAttri;
     else Result := nil;
   end;
 end;
 
 function TSynCssSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
 procedure TSynCssSyn.GreaterProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 function TSynCssSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 procedure TSynCssSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 procedure TSynCssSyn.ResetRange;
 begin
-  FRange:= rsSelector;
+  fRange:= rsSelector;
 end;
 
-function TSynCssSyn.GetSampleSource: UnicodeString;
+function TSynCssSyn.GetSampleSource: string;
 begin
   Result := '/* Syntax Highlighting */'#13#10 +
         'body { font-family: Tahoma, Verdana, Arial, Helvetica, sans-serif; font-size: 8pt }'#13#10 +
@@ -1121,7 +1078,7 @@ class function TSynCssSyn.GetLanguageName: string;
 
 function TSynCssSyn.IsFilterStored: boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterCSS;
+  Result := fDefaultFilter <> SYNS_FilterCSS;
 end;
 
 function TSynCssSyn.IsIdentChar(AChar: WideChar): Boolean;
@@ -1134,13 +1091,11 @@ function TSynCssSyn.IsIdentChar(AChar: WideChar): Boolean;
   end;
 end;
 
-class function TSynCssSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynCssSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangCSS;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynCssSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterDOT.pas b/Ext/SynEdit/Source/SynHighlighterDOT.pas
index 68b743e..0467c97 100644
--- a/Ext/SynEdit/Source/SynHighlighterDOT.pas
+++ b/Ext/SynEdit/Source/SynHighlighterDOT.pas
@@ -27,12 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterDOT.pas,v 1.3.2.7 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a ATT DOT highlighter for SynEdit)
@@ -75,7 +69,7 @@ interface
     tkValue,
     tkSymbol);
 
-  TRangeState = (rsUnknown, rsCStyleComment, rsString);
+  TRangeState = (rsUnKnown, rsCStyleComment, rsString);
 
   PIdentFuncTableFunc = ^TIdentFuncTableFunc;
   TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
@@ -83,20 +77,20 @@ interface
 type
   TSynDOTSyn = class(TSynCustomHighlighter)
   private
-    FRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    FIdentFuncTable: array[0..786] of TIdentFuncTableFunc;
-    FArrowHeadAttri: TSynHighlighterAttributes;
-    FAttributeAttri: TSynHighlighterAttributes;
-    FCommentAttri: TSynHighlighterAttributes;
-    FDirectionsAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FShapeAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FValueAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
+    fRange: TRangeState;
+    fTokenID: TtkTokenKind;
+    fIdentFuncTable: array[0..786] of TIdentFuncTableFunc;
+    fArrowHeadAttri: TSynHighlighterAttributes;
+    fAttributeAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fDirectionsAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fShapeAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fValueAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
     function AltFunc(Index: Integer): TtkTokenKind;
     function FuncAll(Index: Integer): TtkTokenKind;
     function FuncAppendix(Index: Integer): TtkTokenKind;
@@ -260,35 +254,35 @@   TSynDOTSyn = class(TSynCustomHighlighter)
     procedure SymbolProc;
     procedure DirectionsProc;
   protected
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     function IsFilterStored: Boolean; override;
   public
     constructor Create(AOwner: TComponent); override;
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
     function GetRange: Pointer; override;
     procedure ResetRange; override;
     procedure SetRange(Value: Pointer); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override;
     function GetEol: Boolean; override;
-    function GetKeyWords(TokenKind: Integer): UnicodeString; override;
+    function GetKeyWords(TokenKind: Integer): string; override;
     function GetTokenID: TtkTokenKind;
     function GetTokenAttribute: TSynHighlighterAttributes; override;
     function GetTokenKind: Integer; override;
      function IsIdentChar(AChar: WideChar): Boolean; override;
     procedure Next; override;
   published
-    property ArrowHeadAttri: TSynHighlighterAttributes read FArrowHeadAttri write FArrowHeadAttri;
-    property AttributeAttri: TSynHighlighterAttributes read FAttributeAttri write FAttributeAttri;
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
-    property DirectionsAttri: TSynHighlighterAttributes read FDirectionsAttri write FDirectionsAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property ShapeAttri: TSynHighlighterAttributes read FShapeAttri write FShapeAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri;
-    property ValueAttri: TSynHighlighterAttributes read FValueAttri write FValueAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri;
+    property ArrowHeadAttri: TSynHighlighterAttributes read fArrowHeadAttri write fArrowHeadAttri;
+    property AttributeAttri: TSynHighlighterAttributes read fAttributeAttri write fAttributeAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri;
+    property DirectionsAttri: TSynHighlighterAttributes read fDirectionsAttri write fDirectionsAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property ShapeAttri: TSynHighlighterAttributes read fShapeAttri write fShapeAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri;
+    property ValueAttri: TSynHighlighterAttributes read fValueAttri write fValueAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri;
   end;
 
 implementation
@@ -297,7 +291,7 @@ implementation
   SynEditStrConst;
 
 const
-  KeyWords: array[0..145] of UnicodeString = (
+  KeyWords: array[0..145] of string = (
     'all', 'appendix', 'arrowhead', 'arrowsize', 'arrowtail', 'auto', 'back', 
     'bgcolor', 'bold', 'both', 'bottomlabel', 'box', 'center', 'circle', 
     'clusterrank', 'color', 'comment', 'compound', 'concentrate', 'constraint', 
@@ -377,7 +371,7 @@ function TSynDOTSyn.HashKey(Str: PWideChar): Cardinal;
     Inc(Str);
   end;
   Result := Result mod 787;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -385,10 +379,10 @@ function TSynDOTSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
@@ -397,156 +391,156 @@ procedure TSynDOTSyn.InitIdent;
 var
   i: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
     if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
-
-  FIdentFuncTable[132] := FuncAll;
-  FIdentFuncTable[509] := FuncAppendix;
-  FIdentFuncTable[188] := FuncArrowhead;
-  FIdentFuncTable[72] := FuncArrowsize;
-  FIdentFuncTable[65] := FuncArrowtail;
-  FIdentFuncTable[149] := FuncAuto;
-  FIdentFuncTable[752] := FuncBack;
-  FIdentFuncTable[130] := FuncBgcolor;
-  FIdentFuncTable[536] := FuncBold;
-  FIdentFuncTable[266] := FuncBoth;
-  FIdentFuncTable[169] := FuncBottomlabel;
-  FIdentFuncTable[4] := FuncBox;
-  FIdentFuncTable[206] := FuncCenter;
-  FIdentFuncTable[666] := FuncCircle;
-  FIdentFuncTable[533] := FuncClusterrank;
-  FIdentFuncTable[85] := FuncColor;
-  FIdentFuncTable[327] := FuncComment;
-  FIdentFuncTable[278] := FuncCompound;
-  FIdentFuncTable[481] := FuncConcentrate;
-  FIdentFuncTable[425] := FuncConstraint;
-  FIdentFuncTable[573] := FuncDecorate;
-  FIdentFuncTable[302] := FuncDiamond;
-  FIdentFuncTable[272] := FuncDigraph;
-  FIdentFuncTable[79] := FuncDir;
-  FIdentFuncTable[621] := FuncDistortion;
-  FIdentFuncTable[726] := FuncDot;
-  FIdentFuncTable[419] := FuncDotted;
-  FIdentFuncTable[104] := FuncDoublecircle;
-  FIdentFuncTable[90] := FuncDoubleoctagon;
-  FIdentFuncTable[377] := FuncE;
-  FIdentFuncTable[783] := FuncEdge;
-  FIdentFuncTable[614] := FuncEgg;
-  FIdentFuncTable[319] := FuncEllipse;
-  FIdentFuncTable[409] := FuncFalse;
-  FIdentFuncTable[641] := FuncFill;
-  FIdentFuncTable[461] := FuncFillcolor;
-  FIdentFuncTable[631] := FuncFilled;
-  FIdentFuncTable[508] := FuncFixedsize;
-  FIdentFuncTable[237] := FuncFontcolor;
-  FIdentFuncTable[435] := FuncFontname;
-  FIdentFuncTable[60] := FuncFontpath;
-  FIdentFuncTable[685] := FuncFontsize;
-  FIdentFuncTable[235] := FuncForward;
-  FIdentFuncTable[141] := FuncGlobal;
-  FIdentFuncTable[693] := FuncGraph;
-  FIdentFuncTable[730] := FuncGroup;
-  FIdentFuncTable[212] := FuncHeadlabel;
-  FIdentFuncTable[171] := FuncHeadport;
-  FIdentFuncTable[749] := FuncHeadurl;
-  FIdentFuncTable[78] := FuncHeight;
-  FIdentFuncTable[51] := FuncHexagon;
-  FIdentFuncTable[701] := FuncHouse;
-  FIdentFuncTable[177] := FuncId;
-  FIdentFuncTable[603] := FuncInv;
-  FIdentFuncTable[280] := FuncInvdot;
-  FIdentFuncTable[660] := FuncInvhouse;
-  FIdentFuncTable[261] := FuncInvodot;
-  FIdentFuncTable[467] := FuncInvtrapezium;
-  FIdentFuncTable[258] := FuncInvtriangle;
-  FIdentFuncTable[628] := FuncLabel;
-  FIdentFuncTable[557] := FuncLabelangle;
-  FIdentFuncTable[507] := FuncLabeldistance;
-  FIdentFuncTable[575] := FuncLabelfloat;
-  FIdentFuncTable[584] := FuncLabelfontcolor;
-  FIdentFuncTable[192] := FuncLabelfontname;
-  FIdentFuncTable[650] := FuncLabelfontsize;
-  FIdentFuncTable[724] := FuncLabeljust;
-  FIdentFuncTable[625] := FuncLabelloc;
-  FIdentFuncTable[172] := FuncLayer;
-  FIdentFuncTable[315] := FuncLayers;
-  FIdentFuncTable[464] := FuncLhead;
-  FIdentFuncTable[341] := FuncLtail;
-  FIdentFuncTable[469] := FuncMargin;
-  FIdentFuncTable[274] := FuncMax;
-  FIdentFuncTable[699] := FuncMcircle;
-  FIdentFuncTable[253] := FuncMclimit;
-  FIdentFuncTable[391] := FuncMdiamond;
-  FIdentFuncTable[399] := FuncMerged;
-  FIdentFuncTable[92] := FuncMin;
-  FIdentFuncTable[423] := FuncMinimum;
-  FIdentFuncTable[589] := FuncMinlen;
-  FIdentFuncTable[493] := FuncMrecord;
-  FIdentFuncTable[705] := FuncMsquare;
-  FIdentFuncTable[472] := FuncMultiples;
-  FIdentFuncTable[208] := FuncN;
-  FIdentFuncTable[102] := FuncNe;
-  FIdentFuncTable[75] := FuncNode;
-  FIdentFuncTable[202] := FuncNodesep;
-  FIdentFuncTable[50] := FuncNone;
-  FIdentFuncTable[386] := FuncNormal;
-  FIdentFuncTable[70] := FuncNslimit;
-  FIdentFuncTable[551] := FuncNw;
-  FIdentFuncTable[81] := FuncOctagon;
-  FIdentFuncTable[364] := FuncOdot;
-  FIdentFuncTable[663] := FuncOnto;
-  FIdentFuncTable[565] := FuncOrdering;
-  FIdentFuncTable[300] := FuncOrientation;
-  FIdentFuncTable[135] := FuncPage;
-  FIdentFuncTable[706] := FuncPagedir;
-  FIdentFuncTable[252] := FuncParallelogram;
-  FIdentFuncTable[723] := FuncPeripheries;
-  FIdentFuncTable[167] := FuncPlaintext;
-  FIdentFuncTable[256] := FuncPoint;
-  FIdentFuncTable[117] := FuncPolygon;
-  FIdentFuncTable[402] := FuncQuantum;
-  FIdentFuncTable[753] := FuncRank;
-  FIdentFuncTable[246] := FuncRankdir;
-  FIdentFuncTable[773] := FuncRanksep;
-  FIdentFuncTable[369] := FuncRatio;
-  FIdentFuncTable[460] := FuncRecord;
-  FIdentFuncTable[74] := FuncRegular;
-  FIdentFuncTable[363] := FuncRemincross;
-  FIdentFuncTable[281] := FuncRotate;
-  FIdentFuncTable[289] := FuncS;
-  FIdentFuncTable[652] := FuncSame;
-  FIdentFuncTable[439] := FuncSamehead;
-  FIdentFuncTable[316] := FuncSametail;
-  FIdentFuncTable[354] := FuncSamplepoints;
-  FIdentFuncTable[483] := FuncSe;
-  FIdentFuncTable[372] := FuncSearchsize;
-  FIdentFuncTable[599] := FuncSection;
-  FIdentFuncTable[588] := FuncShape;
-  FIdentFuncTable[87] := FuncShapefile;
-  FIdentFuncTable[757] := FuncSides;
-  FIdentFuncTable[195] := FuncSink;
-  FIdentFuncTable[540] := FuncSize;
-  FIdentFuncTable[333] := FuncSkew;
-  FIdentFuncTable[248] := FuncSource;
-  FIdentFuncTable[640] := FuncStrict;
-  FIdentFuncTable[520] := FuncStyle;
-  FIdentFuncTable[477] := FuncSubgraph;
-  FIdentFuncTable[145] := FuncSw;
-  FIdentFuncTable[174] := FuncTaillabel;
-  FIdentFuncTable[756] := FuncTailport;
-  FIdentFuncTable[580] := FuncTailurl;
-  FIdentFuncTable[596] := FuncToplabel;
-  FIdentFuncTable[570] := FuncTrapezium;
-  FIdentFuncTable[351] := FuncTriangle;
-  FIdentFuncTable[514] := FuncTripleoctagon;
-  FIdentFuncTable[624] := FuncTrue;
-  FIdentFuncTable[115] := FuncUrl;
-  FIdentFuncTable[39] := FuncW;
-  FIdentFuncTable[128] := FuncWeight;
-  FIdentFuncTable[241] := FuncWhen;
-  FIdentFuncTable[702] := FuncWidth;
-  FIdentFuncTable[245] := FuncZ;
+      fIdentFuncTable[i] := AltFunc;
+
+  fIdentFuncTable[132] := FuncAll;
+  fIdentFuncTable[509] := FuncAppendix;
+  fIdentFuncTable[188] := FuncArrowhead;
+  fIdentFuncTable[72] := FuncArrowsize;
+  fIdentFuncTable[65] := FuncArrowtail;
+  fIdentFuncTable[149] := FuncAuto;
+  fIdentFuncTable[752] := FuncBack;
+  fIdentFuncTable[130] := FuncBgcolor;
+  fIdentFuncTable[536] := FuncBold;
+  fIdentFuncTable[266] := FuncBoth;
+  fIdentFuncTable[169] := FuncBottomlabel;
+  fIdentFuncTable[4] := FuncBox;
+  fIdentFuncTable[206] := FuncCenter;
+  fIdentFuncTable[666] := FuncCircle;
+  fIdentFuncTable[533] := FuncClusterrank;
+  fIdentFuncTable[85] := FuncColor;
+  fIdentFuncTable[327] := FuncComment;
+  fIdentFuncTable[278] := FuncCompound;
+  fIdentFuncTable[481] := FuncConcentrate;
+  fIdentFuncTable[425] := FuncConstraint;
+  fIdentFuncTable[573] := FuncDecorate;
+  fIdentFuncTable[302] := FuncDiamond;
+  fIdentFuncTable[272] := FuncDigraph;
+  fIdentFuncTable[79] := FuncDir;
+  fIdentFuncTable[621] := FuncDistortion;
+  fIdentFuncTable[726] := FuncDot;
+  fIdentFuncTable[419] := FuncDotted;
+  fIdentFuncTable[104] := FuncDoublecircle;
+  fIdentFuncTable[90] := FuncDoubleoctagon;
+  fIdentFuncTable[377] := FuncE;
+  fIdentFuncTable[783] := FuncEdge;
+  fIdentFuncTable[614] := FuncEgg;
+  fIdentFuncTable[319] := FuncEllipse;
+  fIdentFuncTable[409] := FuncFalse;
+  fIdentFuncTable[641] := FuncFill;
+  fIdentFuncTable[461] := FuncFillcolor;
+  fIdentFuncTable[631] := FuncFilled;
+  fIdentFuncTable[508] := FuncFixedsize;
+  fIdentFuncTable[237] := FuncFontcolor;
+  fIdentFuncTable[435] := FuncFontname;
+  fIdentFuncTable[60] := FuncFontpath;
+  fIdentFuncTable[685] := FuncFontsize;
+  fIdentFuncTable[235] := FuncForward;
+  fIdentFuncTable[141] := FuncGlobal;
+  fIdentFuncTable[693] := FuncGraph;
+  fIdentFuncTable[730] := FuncGroup;
+  fIdentFuncTable[212] := FuncHeadlabel;
+  fIdentFuncTable[171] := FuncHeadport;
+  fIdentFuncTable[749] := FuncHeadurl;
+  fIdentFuncTable[78] := FuncHeight;
+  fIdentFuncTable[51] := FuncHexagon;
+  fIdentFuncTable[701] := FuncHouse;
+  fIdentFuncTable[177] := FuncId;
+  fIdentFuncTable[603] := FuncInv;
+  fIdentFuncTable[280] := FuncInvdot;
+  fIdentFuncTable[660] := FuncInvhouse;
+  fIdentFuncTable[261] := FuncInvodot;
+  fIdentFuncTable[467] := FuncInvtrapezium;
+  fIdentFuncTable[258] := FuncInvtriangle;
+  fIdentFuncTable[628] := FuncLabel;
+  fIdentFuncTable[557] := FuncLabelangle;
+  fIdentFuncTable[507] := FuncLabeldistance;
+  fIdentFuncTable[575] := FuncLabelfloat;
+  fIdentFuncTable[584] := FuncLabelfontcolor;
+  fIdentFuncTable[192] := FuncLabelfontname;
+  fIdentFuncTable[650] := FuncLabelfontsize;
+  fIdentFuncTable[724] := FuncLabeljust;
+  fIdentFuncTable[625] := FuncLabelloc;
+  fIdentFuncTable[172] := FuncLayer;
+  fIdentFuncTable[315] := FuncLayers;
+  fIdentFuncTable[464] := FuncLhead;
+  fIdentFuncTable[341] := FuncLtail;
+  fIdentFuncTable[469] := FuncMargin;
+  fIdentFuncTable[274] := FuncMax;
+  fIdentFuncTable[699] := FuncMcircle;
+  fIdentFuncTable[253] := FuncMclimit;
+  fIdentFuncTable[391] := FuncMdiamond;
+  fIdentFuncTable[399] := FuncMerged;
+  fIdentFuncTable[92] := FuncMin;
+  fIdentFuncTable[423] := FuncMinimum;
+  fIdentFuncTable[589] := FuncMinlen;
+  fIdentFuncTable[493] := FuncMrecord;
+  fIdentFuncTable[705] := FuncMsquare;
+  fIdentFuncTable[472] := FuncMultiples;
+  fIdentFuncTable[208] := FuncN;
+  fIdentFuncTable[102] := FuncNe;
+  fIdentFuncTable[75] := FuncNode;
+  fIdentFuncTable[202] := FuncNodesep;
+  fIdentFuncTable[50] := FuncNone;
+  fIdentFuncTable[386] := FuncNormal;
+  fIdentFuncTable[70] := FuncNslimit;
+  fIdentFuncTable[551] := FuncNw;
+  fIdentFuncTable[81] := FuncOctagon;
+  fIdentFuncTable[364] := FuncOdot;
+  fIdentFuncTable[663] := FuncOnto;
+  fIdentFuncTable[565] := FuncOrdering;
+  fIdentFuncTable[300] := FuncOrientation;
+  fIdentFuncTable[135] := FuncPage;
+  fIdentFuncTable[706] := FuncPagedir;
+  fIdentFuncTable[252] := FuncParallelogram;
+  fIdentFuncTable[723] := FuncPeripheries;
+  fIdentFuncTable[167] := FuncPlaintext;
+  fIdentFuncTable[256] := FuncPoint;
+  fIdentFuncTable[117] := FuncPolygon;
+  fIdentFuncTable[402] := FuncQuantum;
+  fIdentFuncTable[753] := FuncRank;
+  fIdentFuncTable[246] := FuncRankdir;
+  fIdentFuncTable[773] := FuncRanksep;
+  fIdentFuncTable[369] := FuncRatio;
+  fIdentFuncTable[460] := FuncRecord;
+  fIdentFuncTable[74] := FuncRegular;
+  fIdentFuncTable[363] := FuncRemincross;
+  fIdentFuncTable[281] := FuncRotate;
+  fIdentFuncTable[289] := FuncS;
+  fIdentFuncTable[652] := FuncSame;
+  fIdentFuncTable[439] := FuncSamehead;
+  fIdentFuncTable[316] := FuncSametail;
+  fIdentFuncTable[354] := FuncSamplepoints;
+  fIdentFuncTable[483] := FuncSe;
+  fIdentFuncTable[372] := FuncSearchsize;
+  fIdentFuncTable[599] := FuncSection;
+  fIdentFuncTable[588] := FuncShape;
+  fIdentFuncTable[87] := FuncShapefile;
+  fIdentFuncTable[757] := FuncSides;
+  fIdentFuncTable[195] := FuncSink;
+  fIdentFuncTable[540] := FuncSize;
+  fIdentFuncTable[333] := FuncSkew;
+  fIdentFuncTable[248] := FuncSource;
+  fIdentFuncTable[640] := FuncStrict;
+  fIdentFuncTable[520] := FuncStyle;
+  fIdentFuncTable[477] := FuncSubgraph;
+  fIdentFuncTable[145] := FuncSw;
+  fIdentFuncTable[174] := FuncTaillabel;
+  fIdentFuncTable[756] := FuncTailport;
+  fIdentFuncTable[580] := FuncTailurl;
+  fIdentFuncTable[596] := FuncToplabel;
+  fIdentFuncTable[570] := FuncTrapezium;
+  fIdentFuncTable[351] := FuncTriangle;
+  fIdentFuncTable[514] := FuncTripleoctagon;
+  fIdentFuncTable[624] := FuncTrue;
+  fIdentFuncTable[115] := FuncUrl;
+  fIdentFuncTable[39] := FuncW;
+  fIdentFuncTable[128] := FuncWeight;
+  fIdentFuncTable[241] := FuncWhen;
+  fIdentFuncTable[702] := FuncWidth;
+  fIdentFuncTable[245] := FuncZ;
 end;
 
 function TSynDOTSyn.AltFunc(Index: Integer): TtkTokenKind;
@@ -1731,76 +1725,76 @@ function TSynDOTSyn.FuncZ(Index: Integer): TtkTokenKind;
 procedure TSynDOTSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynDOTSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
 procedure TSynDOTSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run] = #10 then
+  if fLine[Run] = #10 then
     Inc(Run);
 end;
 
 procedure TSynDOTSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynDOTSyn.DirectionsProc;
 begin
   Inc(Run);
-  if (FLine[Run] = '>') or (FLine[Run] = '-') then
+  if (fLine[Run] = '>') or (fLine[Run] = '-') then
   begin
-    FTokenID := tkDirections;
+    fTokenID := tkDirections;
     Inc(Run);
   end
   else
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
 end;
 
 procedure TSynDOTSyn.CStyleCommentOpenProc;
 begin
   Inc(Run);
-  if FLine[Run] = '/' then
+  if fLine[Run] = '/' then
   begin
-    FTokenID := tkComment;
+    fTokenID := tkComment;
     Inc(Run, 2);
     while not IsLineEnd(Run) do Inc(Run);
     Exit;
   end;
-  if FLine[Run] = '*' then
+  if fLine[Run] = '*' then
   begin
-    FRange := rsCStyleComment;
+    fRange := rsCStyleComment;
     CStyleCommentProc;
-    FTokenID := tkComment;
+    fTokenID := tkComment;
   end
   else
-    FTokenID := tkIdentifier;
+    fTokenID := tkIdentifier;
 end;
 
 procedure TSynDOTSyn.CStyleCommentProc;
 begin
-  case FLine[Run] of
+  case fLine[Run] of
      #0: NullProc;
     #10: LFProc;
     #13: CRProc;
     else
     begin
-      FTokenID := tkComment;
+      fTokenID := tkComment;
       repeat
-        if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then
+        if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then
         begin
           Inc(Run, 2);
-          FRange := rsUnknown;
+          fRange := rsUnKnown;
           Break;
         end;
         if not IsLineEnd(Run) then
@@ -1813,19 +1807,19 @@ procedure TSynDOTSyn.CStyleCommentProc;
 procedure TSynDOTSyn.StringOpenProc;
 begin
   Inc(Run);
-  FRange := rsString;
+  fRange := rsString;
   StringProc;
-  FTokenID := tkString;
+  fTokenID := tkString;
 end;
 
 procedure TSynDOTSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
-    if FLine[Run] = '''' then
+    if fLine[Run] = '''' then
     begin
       Inc(Run, 1);
-      FRange := rsUnknown;
+      fRange := rsUnKnown;
       Break;
     end;
     if not IsLineEnd(Run) then
@@ -1837,88 +1831,88 @@ constructor TSynDOTSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
+  fCaseSensitive := False;
 
-  FArrowHeadAttri := TSynHighLighterAttributes.Create(SYNS_AttrArrowHead, SYNS_FriendlyAttrArrowHead);
-  FArrowHeadAttri.Foreground := clRed;
-  AddAttribute(FArrowHeadAttri);
+  fArrowHeadAttri := TSynHighLighterAttributes.Create(SYNS_AttrArrowHead, SYNS_FriendlyAttrArrowHead);
+  fArrowHeadAttri.Foreground := clRed;
+  AddAttribute(fArrowHeadAttri);
 
-  FAttributeAttri := TSynHighLighterAttributes.Create(SYNS_AttrAttribute, SYNS_FriendlyAttrAttribute);
-  AddAttribute(FAttributeAttri);
+  fAttributeAttri := TSynHighLighterAttributes.Create(SYNS_AttrAttribute, SYNS_FriendlyAttrAttribute);
+  AddAttribute(fAttributeAttri);
 
-  FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  FCommentAttri.Foreground := clNavy;
-  AddAttribute(FCommentAttri);
+  fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  fCommentAttri.Foreground := clNavy;
+  AddAttribute(fCommentAttri);
 
-  FDirectionsAttri := TSynHighLighterAttributes.Create(SYNS_AttrDirections, SYNS_FriendlyAttrDirections);
-  FDirectionsAttri.Style := [fsBold];
-  FDirectionsAttri.Foreground := clYellow;
-  AddAttribute(FDirectionsAttri);
+  fDirectionsAttri := TSynHighLighterAttributes.Create(SYNS_AttrDirections, SYNS_FriendlyAttrDirections);
+  fDirectionsAttri.Style := [fsBold];
+  fDirectionsAttri.Foreground := clYellow;
+  AddAttribute(fDirectionsAttri);
 
-  FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
+  fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
 
-  FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
+  fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style := [fsBold];
+  AddAttribute(fKeyAttri);
 
-  FShapeAttri := TSynHighLighterAttributes.Create(SYNS_AttrShape, SYNS_FriendlyAttrShape);
-  FShapeAttri.Style := [fsBold];
-  FShapeAttri.Foreground := clRed;
-  AddAttribute(FShapeAttri);
+  fShapeAttri := TSynHighLighterAttributes.Create(SYNS_AttrShape, SYNS_FriendlyAttrShape);
+  fShapeAttri.Style := [fsBold];
+  fShapeAttri.Foreground := clRed;
+  AddAttribute(fShapeAttri);
 
-  FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
+  fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
 
-  FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
+  fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
 
-  FValueAttri := TSynHighLighterAttributes.Create(SYNS_AttrValue, SYNS_FriendlyAttrValue);
-  FValueAttri.Style := [fsItalic];
-  FValueAttri.Foreground := clRed;
-  AddAttribute(FValueAttri);
+  fValueAttri := TSynHighLighterAttributes.Create(SYNS_AttrValue, SYNS_FriendlyAttrValue);
+  fValueAttri.Style := [fsItalic];
+  fValueAttri.Foreground := clRed;
+  AddAttribute(fValueAttri);
 
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  FSymbolAttri.Style := [fsBold];
-  FSymbolAttri.Foreground := clGreen;
-  AddAttribute(FSymbolAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  fSymbolAttri.Style := [fsBold];
+  fSymbolAttri.Foreground := clGreen;
+  AddAttribute(fSymbolAttri);
 
   SetAttributesOnChange(DefHighlightChange);
   InitIdent;
-  FDefaultFilter := SYNS_FilterDOT;
-  FRange := rsUnknown;
+  fDefaultFilter := SYNS_FilterDOT;
+  fRange := rsUnknown;
 end;
 
 procedure TSynDOTSyn.IdentProc;
 begin
-  FTokenID := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do
+  fTokenID := IdentKind((fLine + Run));
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do
     Inc(Run);
 end;
 
 procedure TSynDOTSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynDOTSyn.SymbolProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
 end;
 
 procedure TSynDOTSyn.Next;
 begin
-  FTokenPos := Run;
-  case FRange of
+  fTokenPos := Run;
+  case fRange of
     rsCStyleComment: CStyleCommentProc;
   else
     begin
-      FRange := rsUnknown;
-      case FLine[Run] of
+      fRange := rsUnknown;
+      case fLine[Run] of
         #0: NullProc;
         #10: LFProc;
         #13: CRProc;
@@ -1938,12 +1932,12 @@ procedure TSynDOTSyn.Next;
 function TSynDOTSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -1951,10 +1945,10 @@ function TSynDOTSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttribut
 
 function TSynDOTSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
-function TSynDOTSyn.GetKeyWords(TokenKind: Integer): UnicodeString;
+function TSynDOTSyn.GetKeyWords(TokenKind: Integer): string;
 begin
   Result :=
     '--,->,all,appendix,arrowhead,arrowsize,arrowtail,auto,back,bgcolor,bo' +
@@ -1978,24 +1972,24 @@ function TSynDOTSyn.GetKeyWords(TokenKind: Integer): UnicodeString;
 
 function TSynDOTSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynDOTSyn.GetTokenAttribute: TSynHighLighterAttributes;
 begin
   case GetTokenID of
-    tkArrowHead: Result := FArrowHeadAttri;
-    tkAttribute: Result := FAttributeAttri;
-    tkComment: Result := FCommentAttri;
-    tkDirections: Result := FDirectionsAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkShape: Result := FShapeAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkValue: Result := FValueAttri;
-    tkUnknown: Result := FIdentifierAttri;
-    tkSymbol: Result := FSymbolAttri;
+    tkArrowHead: Result := fArrowHeadAttri;
+    tkAttribute: Result := fAttributeAttri;
+    tkComment: Result := fCommentAttri;
+    tkDirections: Result := fDirectionsAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkShape: Result := fShapeAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkValue: Result := fValueAttri;
+    tkUnknown: Result := fIdentifierAttri;
+    tkSymbol: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -2003,10 +1997,10 @@ function TSynDOTSyn.GetTokenAttribute: TSynHighLighterAttributes;
 
 function TSynDOTSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
-function TSynDOTSyn.GetSampleSource: UnicodeString;
+function TSynDOTSyn.GetSampleSource: string;
 begin
   Result :=
     '// ATT DOT Graphic description language'#13#10 +
@@ -2053,7 +2047,7 @@ function TSynDOTSyn.GetSampleSource: UnicodeString;
 
 function TSynDOTSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterDOT;
+  Result := fDefaultFilter <> SYNS_FilterDOT;
 end;
 
 function TSynDOTSyn.IsIdentChar(AChar: WideChar): Boolean;
@@ -2073,26 +2067,24 @@ class function TSynDOTSyn.GetLanguageName: string;
 
 procedure TSynDOTSyn.ResetRange;
 begin
-  FRange := rsUnknown;
+  fRange := rsUnknown;
 end;
 
 procedure TSynDOTSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 function TSynDOTSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
-class function TSynDOTSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynDOTSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangDOT;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynDOTSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterDWS.pas b/Ext/SynEdit/Source/SynHighlighterDWS.pas
index ee6bd98..17297e6 100644
--- a/Ext/SynEdit/Source/SynHighlighterDWS.pas
+++ b/Ext/SynEdit/Source/SynHighlighterDWS.pas
@@ -28,11 +28,6 @@
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
 
-$Id: SynHighlighterDWS.pas,v 1.11 2011/12/28 09:24:20 Egg Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
 Known Issues:
 -------------------------------------------------------------------------------}
 {
@@ -46,28 +41,26 @@
 interface
 
 uses
-  Windows,
-  Graphics,
+  Winapi.Windows,
+  Vcl.Graphics,
   SynEditTypes,
   SynEditHighlighter,
-  SysUtils,
-  Classes,
-{$IFDEF SYN_CodeFolding}
+  System.SysUtils,
+  System.Classes,
   SynEditCodeFolding,
-  SynRegExpr,
-{$ENDIF}
-  Character;
+  System.RegularExpressions,
+  System.Character;
 
 type
   TtkTokenKind = (tkAsm, tkComment, tkIdentifier, tkKey, tkNull, tkNumber,
     tkSpace, tkString, tkSymbol, tkUnknown, tkFloat, tkHex, tkDirec, tkChar);
 
-  TRangeState = (rsANil, rsCommentAnsi, rsCommentC, rsAsm, rsAsmCommentC,
-    rsCommentBor, rsProperty, rsExports, rsDirective, rsAsmDirective,
-    rsStringSingle, rsStringDouble, rsType, rsUnit, rsUnknown);
+  TRangeState = (rsANil, rsAnsi, rsAnsiAsm, rsAsm, rsBor, rsBorAsm, rsProperty,
+    rsExports, rsDirective, rsDirectiveAsm, rsHereDocSingle, rsHereDocDouble,
+    rsType, rsUnit, rsUnknown);
 
   PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function : TtkTokenKind of object;
+  TIdentFuncTableFunc = function: TtkTokenKind of object;
 
 type
    TAnsiStringList = class(TStringList)
@@ -75,40 +68,35 @@    TAnsiStringList = class(TStringList)
    end;
 
 type
-{$IFDEF SYN_CodeFolding}
   TSynDWSSyn = class(TSynCustomCodeFoldingHighlighter)
-{$ELSE}
-  TSynDWSSyn = class(TSynCustomHighlighter)
-{$ENDIF}
   private
-    FAsmStart: Boolean;
-    FRange: TRangeState;
-    FCommentClose: Char;
-    FIdentFuncTable: array[0..388] of TIdentFuncTableFunc;
-    FKeywords: TAnsiStringList;
+    fAsmStart: Boolean;
+    fRange: TRangeState;
+    fCommentClose: Char;
+    fIdentFuncTable: array[0..388] of TIdentFuncTableFunc;
+    fKeyWords: TAnsiStringList;
     FKeywordsUnitScoped: TAnsiStringList;
     FKeywordsPropertyScoped: TAnsiStringList;
     FKeywordsTypeScoped: TAnsiStringList;
-    FTokenID: TtkTokenKind;
-    FStringAttri: TSynHighlighterAttributes;
-    FCharAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FFloatAttri: TSynHighlighterAttributes;
-    FHexAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FAsmAttri: TSynHighlighterAttributes;
-    FCommentAttri: TSynHighlighterAttributes;
-    FDirecAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-{$IFDEF SYN_CodeFolding}
-    RE_BlockBegin : TRegExpr;
-    RE_BlockEnd : TRegExpr;
-    RE_Code: TRegExpr;
-{$ENDIF}
+    fTokenID: TtkTokenKind;
+    fStringAttri: TSynHighlighterAttributes;
+    fCharAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fFloatAttri: TSynHighlighterAttributes;
+    fHexAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    fAsmAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fDirecAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    RE_BlockBegin: TRegEx;
+    RE_BlockEnd: TRegEx;
+    RE_Code: TRegEx;
+    RE_ControlFlow: TRegEx;
     function AltFunc: TtkTokenKind;
-    function KeywordFunc: TtkTokenKind;
+    function KeyWordFunc: TtkTokenKind;
     function FuncAsm: TtkTokenKind;
     function FuncEnd: TtkTokenKind;
     function FuncUnitScoped: TtkTokenKind;
@@ -122,10 +110,10 @@   TSynDWSSyn = class(TSynCustomHighlighter)
     procedure InitIdent;
     procedure AddressOpProc;
     procedure AsciiCharProc;
-    procedure CommentBorProc;
+    procedure AnsiProc;
+    procedure BorProc;
     procedure BraceOpenProc;
     procedure ColonOrGreaterProc;
-    procedure CommentAnsiProc;
     procedure CRProc;
     procedure IdentProc;
     procedure IntegerProc;
@@ -144,14 +132,14 @@   TSynDWSSyn = class(TSynCustomHighlighter)
     procedure SymbolProc;
     procedure UnknownProc;
   protected
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     function IsFilterStored: Boolean; override;
-    function IsCurrentToken(const Token: UnicodeString): Boolean; override;
+    function IsCurrentToken(const Token: string): Boolean; override;
 
   public
     class function GetCapabilities: TSynHighlighterCapabilities; override;
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
 
   public
     constructor Create(AOwner: TComponent); override;
@@ -174,45 +162,46 @@   TSynDWSSyn = class(TSynCustomHighlighter)
     // and highlighting. It modifies the basic TSynDWSSyn to reproduce
     // the most recent Delphi editor highlighting.
 
-{$IFDEF SYN_CodeFolding}
     procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges;
       LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override;
     procedure AdjustFoldRanges(FoldRanges: TSynFoldRanges;
       LinesToScan: TStrings); override;
-{$ENDIF}
+    function FlowControlAtLine(Lines: TStrings; Line: Integer): TSynFlowControl; override;
   published
-    property AsmAttri: TSynHighlighterAttributes read FAsmAttri write FAsmAttri;
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property DirectiveAttri: TSynHighlighterAttributes read FDirecAttri
-      write FDirecAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property FloatAttri: TSynHighlighterAttributes read FFloatAttri
-      write FFloatAttri;
-    property HexAttri: TSynHighlighterAttributes read FHexAttri
-      write FHexAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property CharAttri: TSynHighlighterAttributes read FCharAttri
-      write FCharAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
+    property AsmAttri: TSynHighlighterAttributes read fAsmAttri write fAsmAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property DirectiveAttri: TSynHighlighterAttributes read fDirecAttri
+      write fDirecAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property FloatAttri: TSynHighlighterAttributes read fFloatAttri
+      write fFloatAttri;
+    property HexAttri: TSynHighlighterAttributes read fHexAttri
+      write fHexAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property CharAttri: TSynHighlighterAttributes read fCharAttri
+      write fCharAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
   end;
 
 implementation
 
 uses
-  SynEditStrConst;
+  System.Math,
+  SynEditStrConst,
+  SynEditMiscProcs;
 
 const
    // if the language is case-insensitive keywords *must* be in lowercase
-   cKeywords: array[1..94] of UnicodeString = (
+   cKeyWords: array[1..95] of string = (
       'abstract', 'and', 'array', 'as', 'asm',
       'begin', 'break', 'case', 'cdecl', 'class', 'const', 'constructor',
       'continue', 'deprecated', 'destructor',
@@ -221,27 +210,27 @@ implementation
       'finally', 'for', 'forward', 'function', 'helper', 'if',
       'implementation', 'implements', 'implies', 'in', 'inherited',
       'initialization', 'inline', 'interface', 'is', 'lambda', 'lazy', 'library',
-      'method', 'mod', 'new', 'nil', 'not', 'object', 'of', 'old', 'on', 
-      'operator', 'or', 'overload', 'override', 'pascal', 'partial', 'private', 
-      'procedure', 'program', 'property', 'protected', 'public', 'published', 
-      'raise', 'record', 'register', 'reintroduce', 'repeat', 'require', 
-      'resourcestring', 'sar', 'sealed', 'set', 'shl', 'shr', 'static', 
-      'strict', 'then', 'to', 'try', 'type', 'unit', 'until', 'uses', 'var', 
-      'virtual', 'while', 'xor'
+      'method', 'mod', 'new', 'nil', 'not', 'object', 'of', 'old', 'on',
+      'operator', 'or', 'overload', 'override', 'pascal', 'partial', 'private',
+      'procedure', 'program', 'property', 'protected', 'public', 'published',
+      'raise', 'record', 'register', 'reintroduce', 'repeat', 'require',
+      'resourcestring', 'sar', 'sealed', 'set', 'shl', 'shr', 'static',
+      'step', 'strict', 'then', 'to', 'try', 'type', 'unit', 'until', 'uses',
+      'var', 'virtual', 'while', 'xor'
   );
-  cKeywordsUnitScoped: array [0..0] of UnicodeString = (
+  cKeywordsUnitScoped: array [0..0] of string = (
       'namespace'
   );
-  cKeywordsPropertyScoped: array [0..4] of UnicodeString = (
+  cKeywordsPropertyScoped: array [0..4] of string = (
       'default', 'index', 'read', 'stored', 'write'
   );
-  cKeywordsTypeScoped: array [0..1] of UnicodeString = (
+  cKeywordsTypeScoped: array [0..1] of string = (
       'enum', 'flag'
   );
 
 function TAnsiStringList.CompareStrings(const S1, S2: string): Integer;
 begin
-  Result := CompareText(S1, S2);
+   Result:=CompareText(S1, S2);
 end;
 
 
@@ -251,7 +240,6 @@ constructor TSynDWSSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
   FCaseSensitive := True; // bypass automatic lowercase, we handle it here
-  FCommentClose := ')';
 
   FAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler);
   FAsmAttri.Foreground := RGB(128, 0, 0);
@@ -312,19 +300,10 @@ constructor TSynDWSSyn.Create(AOwner: TComponent);
   FAsmStart := False;
   FDefaultFilter := SYNS_FilterDWS;
 
-{$IFDEF SYN_CodeFolding}
-  RE_BlockBegin := TRegExpr.Create;
-  RE_BlockBegin.Expression := '\b(begin|record|class)\b';
-  RE_BlockBegin.ModifierI := True;
-
-  RE_BlockEnd := TRegExpr.Create;
-  RE_BlockEnd.Expression := '\bend\b';
-  RE_BlockEnd.ModifierI := True;
-
-  RE_Code := TRegExpr.Create;
-  RE_Code.Expression := '^\s*(function|procedure)\b';
-  RE_Code.ModifierI := True;
-{$ENDIF}
+  RE_BlockBegin := CompiledRegEx('\b(begin|record|class|case|try)\b', [roNotEmpty, roIgnoreCase]);
+  RE_BlockEnd := CompiledRegEx('\bend\b', [roNotEmpty, roIgnoreCase]);
+  RE_Code := CompiledRegEx('^\s*(function|procedure|constructor|destructor)\b', [roNotEmpty, roIgnoreCase]);
+  RE_ControlFlow := CompiledRegEx('\b((break)|(continue)|(exit))\b', [roIgnoreCase]);
 end;
 
 // Destroy
@@ -336,79 +315,78 @@ destructor TSynDWSSyn.Destroy;
   FKeywordsUnitScoped.Free;
   FKeywordsPropertyScoped.Free;
   FKeywordsTypeScoped.Free;
-{$IFDEF SYN_CodeFolding}
-  RE_BlockBegin.Free;
-  RE_BlockEnd.Free;
-  RE_Code.Free;
-{$ENDIF}
 end;
 
+{$IFOPT Q+}
+  {$OVERFLOWCHECKS OFF}
+  {$DEFINE OVERFLOWCHECK_ON}
+{$ENDIF}
 function TSynDWSSyn.HashKey(Str: PWideChar): Cardinal;
 var
-  c: Word;
+  C: Word;
 begin
-  Result := 0;
+  Result:=0;
   while IsIdentChar(Str^) do
   begin
-    c := Ord(Str^);
-    if c in [Ord('A')..Ord('Z')] then
-      c := c + (Ord('a') - Ord('A'));
-    Result := Result * 692 + c * 171;
-    Inc(Str);
-  end;
-  FStringLen := Str - FToIdent;
-  Result := Result mod Cardinal(Length(FIdentFuncTable));
+      C:=Ord(Str^);
+      if C in [Ord('A')..Ord('Z')] then
+         C := C + (Ord('a')-Ord('A'));
+      Result := Result * 692 + C * 171;
+      Inc(Str);
+   end;
+   fStringLen := Str - fToIdent;
+   Result := Result mod Cardinal(Length(fIdentFuncTable));
 end;
+{$IFDEF OVERFLOWCHECK_ON}
+  {$OVERFLOWCHECKS ON}
+  {$UNDEF OVERFLOWCHECK_ON}
+{$ENDIF}
 
 function TSynDWSSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key]
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key]
   else
     Result := tkIdentifier;
 end;
 
 procedure TSynDWSSyn.InitIdent;
 
-   procedure SetIdentFunc(h : Integer; const func : TIdentFuncTableFunc);
-   begin
-      FIdentFuncTable[h] := func;
-   end;
+  procedure SetIdentFunc(h: Integer; const func: TIdentFuncTableFunc);
+  begin
+    fIdentFuncTable[h]:=func;
+  end;
 
 var
-  i : Integer;
+  I: Integer;
 begin
-  for i := Low(cKeywords) to High(cKeywords) do
+  for I := Low(cKeywords) to High(cKeywords) do
   begin
-    SetIdentFunc(HashKey(@cKeywords[i][1]), KeywordFunc);
-    FKeywords.Add(cKeywords[i]);
-  end;
-  
-  for i := 0 to High(cKeywordsUnitScoped) do
+    SetIdentFunc(HashKey(@cKeyWords[I][1]), KeyWordFunc);
+    fKeyWords.Add(cKeyWords[I]);
+   end;
+  for I := 0 to High(cKeywordsUnitScoped) do
   begin
-    SetIdentFunc(HashKey(@cKeywordsUnitScoped[i][1]), FuncUnitScoped);
-    FKeywordsUnitScoped.Add(cKeywordsUnitScoped[i]);
+    SetIdentFunc(HashKey(@cKeywordsUnitScoped[I][1]), FuncUnitScoped);
+    FKeywordsUnitScoped.Add(cKeywordsUnitScoped[I]);
   end;
-
-  for i := 0 to High(cKeywordsPropertyScoped) do
+  for I := 0 to High(cKeywordsPropertyScoped) do
   begin
-    SetIdentFunc(HashKey(@cKeywordsPropertyScoped[i][1]), FuncPropertyScoped);
-    FKeywordsPropertyScoped.Add(cKeywordsPropertyScoped[i]);
+    SetIdentFunc(HashKey(@cKeywordsPropertyScoped[I][1]), FuncPropertyScoped);
+    FKeywordsPropertyScoped.Add(cKeywordsPropertyScoped[I]);
   end;
-
-  for i := 0 to High(cKeywordsTypeScoped) do
+  for I := 0 to High(cKeywordsTypeScoped) do
   begin
-    SetIdentFunc(HashKey(@cKeywordsTypeScoped[i][1]), FuncTypeScoped);
-    FKeywordsTypeScoped.Add(cKeywordsTypeScoped[i]);
+    SetIdentFunc(HashKey(@cKeywordsTypeScoped[I][1]), FuncTypeScoped);
+    FKeywordsTypeScoped.Add(cKeywordsTypeScoped[I]);
   end;
-
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if @FIdentFuncTable[i] = nil then
-      FIdentFuncTable[i] := AltFunc;
+  for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do
+    if @fIdentFuncTable[I] = nil then
+      fIdentFuncTable[I] := AltFunc;
 
   SetIdentFunc(HashKey('asm'), FuncAsm);
   SetIdentFunc(HashKey('end'), FuncEnd);
@@ -416,7 +394,7 @@ procedure TSynDWSSyn.InitIdent;
   SetIdentFunc(HashKey('unit'), FuncUnit);
   SetIdentFunc(HashKey('type'), FuncType);
 
-  FKeywords.Sorted := True;
+  fKeyWords.Sorted:=True;
 end;
 
 function TSynDWSSyn.AltFunc: TtkTokenKind;
@@ -424,45 +402,68 @@ function TSynDWSSyn.AltFunc: TtkTokenKind;
   Result := tkIdentifier
 end;
 
-function TSynDWSSyn.KeywordFunc: TtkTokenKind;
+function TSynDWSSyn.KeyWordFunc: TtkTokenKind;
 var
-   buf : String;
+   buf: string;
 begin
-   SetString(buf, FToIdent, FStringLen);
-   if (FKeywords.IndexOf(buf) >= 0) and (FLine[Run - 1] <> '&') then
+   SetString(buf, fToIdent, fStringLen);
+   if (fKeyWords.IndexOf(buf)>=0) and (FLine[Run - 1] <> '&') then
       Result := tkKey
    else Result := tkIdentifier
 end;
 
+function TSynDWSSyn.FlowControlAtLine(Lines: TStrings;
+  Line: Integer): TSynFlowControl;
+var
+  Match: TMatch;
+begin
+  Result := fcNone;
+
+  Match := RE_ControlFlow.Match(Lines[Line - 1]);
+  if Match.Success then
+  begin
+    if Match.Groups[2].Length > 0 then
+      Result := fcBreak
+    else if Match.Groups[3].Length > 0 then
+      Result := fcContinue
+    else
+      Result := fcExit;
+
+    if GetHighlighterAttriAtRowCol(Lines, Line - 1, Match.Index) <> KeyAttri
+    then
+      Result := fcNone;
+  end;
+end;
+
 function TSynDWSSyn.FuncAsm: TtkTokenKind;
 begin
    if IsCurrentToken('asm') then begin
       Result := tkKey;
-      FRange := rsAsm;
-      FAsmStart := True;
-   end else Result := KeywordFunc;
+      fRange := rsAsm;
+      fAsmStart := True;
+   end else Result:=KeyWordFunc;
 end;
 
 function TSynDWSSyn.FuncEnd: TtkTokenKind;
 begin
-  if IsCurrentToken('end') then begin
+   if IsCurrentToken('end') then begin
     if (FLine[Run - 1] <> '&') then
     begin
       Result := tkKey;
-      FRange := rsUnknown;
+      fRange := rsUnknown;
     end
     else
       Result := tkIdentifier;
-  end else Result := KeywordFunc;
+   end else Result:=KeyWordFunc;
 end;
 
 function TSynDWSSyn.FuncTypeScoped: TtkTokenKind;
 var
-   buf: String;
+   buf: string;
 begin
-  SetString(buf, FToIdent, FStringLen);
+   SetString(buf, fToIdent, fStringLen);
   if (FRange = rsType) and (FKeywordsTypeScoped.IndexOf(buf) >= 0) then
-    Result := tkKey
+      Result:=tkKey
   else
     Result := KeywordFunc;
 end;
@@ -472,18 +473,18 @@ function TSynDWSSyn.FuncType: TtkTokenKind;
   if IsCurrentToken('type') then
   begin
     if (FLine[Run - 1] <> '&') then
-    begin
+begin
       Result := tkKey;
       FRange := rsType;
     end
     else
       Result := tkIdentifier;
-  end else Result := KeywordFunc;
+   end else Result:=KeyWordFunc;
 end;
 
 function TSynDWSSyn.FuncPropertyScoped: TtkTokenKind;
 var
-   buf: String;
+   buf: string;
 begin
   SetString(buf, FToIdent, FStringLen);
   if (FRange = rsProperty) and (FKeywordsPropertyScoped.IndexOf(buf) >= 0) then
@@ -494,7 +495,7 @@ function TSynDWSSyn.FuncPropertyScoped: TtkTokenKind;
 
 function TSynDWSSyn.FuncUnitScoped: TtkTokenKind;
 var
-   buf: String;
+   buf: string;
 begin
   SetString(buf, FToIdent, FStringLen);
   if (FRange = rsUnit) and (FKeywordsUnitScoped.IndexOf(buf) >= 0) then
@@ -527,16 +528,16 @@ function TSynDWSSyn.FuncUnit: TtkTokenKind;
 
 procedure TSynDWSSyn.AddressOpProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
-  if FLine[Run] = '@' then Inc(Run);
+  if fLine[Run] = '@' then Inc(Run);
 end;
 
 procedure TSynDWSSyn.AsciiCharProc;
 
   function IsAsciiChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', '$', 'A'..'F', 'a'..'f':
         Result := True;
       else
@@ -545,9 +546,9 @@ procedure TSynDWSSyn.AsciiCharProc;
   end;
 
 begin
-  FTokenID := tkChar;
+  fTokenID := tkChar;
   Inc(Run);
-  if FLine[run]='''' then
+  if fLine[run]='''' then
       StringAposMultiProc
   else begin
      while IsAsciiChar do
@@ -555,26 +556,26 @@ procedure TSynDWSSyn.AsciiCharProc;
   end;
 end;
 
-procedure TSynDWSSyn.CommentBorProc;
+procedure TSynDWSSyn.BorProc;
 begin
-  case FLine[Run] of
+  case fLine[Run] of
      #0: NullProc;
     #10: LFProc;
     #13: CRProc;
   else
     begin
-      if FRange in [rsDirective, rsAsmDirective] then
-        FTokenID := tkDirec
+      if fRange in [rsDirective, rsDirectiveAsm] then
+        fTokenID := tkDirec
       else
-        FTokenID := tkComment;
+        fTokenID := tkComment;
       repeat
-        if FLine[Run] = '}' then
+        if fLine[Run] = '}' then
         begin
           Inc(Run);
-          if FRange in [rsAsmDirective] then
-            FRange := rsAsm
+          if fRange in [rsBorAsm, rsDirectiveAsm] then
+            fRange := rsAsm
           else
-            FRange := rsUnknown;
+            fRange := rsUnKnown;
           Break;
         end;
         Inc(Run);
@@ -585,47 +586,43 @@ procedure TSynDWSSyn.CommentBorProc;
 
 procedure TSynDWSSyn.BraceOpenProc;
 begin
-  if (FLine[Run + 1] = '$') then
+  if (fLine[Run + 1] = '$') then
   begin
-    if FRange = rsAsm then
-      FRange := rsAsmDirective
+    if fRange = rsAsm then
+      fRange := rsDirectiveAsm
     else
-      FRange := rsDirective;
+      fRange := rsDirective;
   end
   else
   begin
-    if FRange = rsAsm then
-    begin
-      FTokenID := tkSymbol;
-      Inc(Run);
-      Exit;
-    end
+    if fRange = rsAsm then
+      fRange := rsBorAsm
     else
-      FRange := rsCommentBor;
+      fRange := rsBor;
   end;
-  CommentBorProc;
+  BorProc;
 end;
 
 procedure TSynDWSSyn.ColonOrGreaterProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
-  if FLine[Run] = '=' then Inc(Run);
+  if fLine[Run] = '=' then Inc(Run);
 end;
 
 procedure TSynDWSSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run] = #10 then
+  if fLine[Run] = #10 then
     Inc(Run);
 end;
 
 procedure TSynDWSSyn.IdentProc;
 begin
-  FTokenID := IdentKind(FLine + Run);
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do
+  fTokenID := IdentKind(fLine + Run);
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do
     Inc(Run);
 end;
 
@@ -633,7 +630,7 @@ procedure TSynDWSSyn.IntegerProc;
 
   function IsIntegerChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f':
         Result := True;
       else
@@ -643,47 +640,48 @@ procedure TSynDWSSyn.IntegerProc;
 
 begin
   Inc(Run);
-  FTokenID := tkHex;
+  fTokenID := tkHex;
   while IsIntegerChar do
     Inc(Run);
 end;
 
 procedure TSynDWSSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynDWSSyn.LoadDelphiStyle;
 
-   procedure AddKeyword(const AName : string);
+
+   procedure AddKeyword( const AName: string );
    var
-     I : Integer;
+     I: Integer;
    begin
      I := HashKey( @AName[1] );
-     FIdentFuncTable[I] := KeywordFunc;
-     FKeywords.Add(AName);
+     fIdentFuncTable[I]:= KeyWordFunc;
+     fKeyWords.Add(AName);
    end;
 
-   procedure RemoveKeyword(const AName : string);
+   procedure RemoveKeyword( const AName: string );
    var
-     I : Integer;
+     I: Integer;
    begin
-     I := FKeywords.IndexOf(AName);
+     I := fKeyWords.IndexOf(AName);
      if I <> -1 then
-       FKeywords.Delete(I);
+       fKeywords.Delete( I );
    end;
 
 const
   clID = clNavy;
   clString = clBlue;
   clComment = clGreen;
-  cKeywordsToAdd: array[0..0] of UnicodeString = (
+  cKeywordsToAdd: array[0..0] of string = (
       'string');
-  cKeywordsToRemove: array[0..1] of UnicodeString = (
+  cKeywordsToRemove: array[0..1] of string = (
       'break', 'exit');
 var
-  i : Integer;
+  I: Integer;
 begin
   // This routine can be called to install a Delphi style of colors
   // and highlighting. It modifies the basic TSynDWSSyn to reproduce
@@ -695,25 +693,25 @@ procedure TSynDWSSyn.LoadDelphiStyle;
   CommentAttri.Foreground := clComment;
 
   // These are keywords highlighted in Delphi but not in TSynDWSSyn ..
-  for i := Low(cKeywordsToAdd) to High(cKeywordsToAdd) do
-    AddKeyword(cKeywordsToAdd[i]);
+  for I:=Low(cKeywordsToAdd) to High(cKeywordsToAdd) do
+    AddKeyword( cKeywordsToAdd[I] );
 
   // These are keywords highlighted in TSynDWSSyn but not in Delphi...
-  for i := Low(cKeywordsToRemove) to High(cKeywordsToRemove) do
-    RemoveKeyword(cKeywordsToRemove[i]);
+  for I:=Low(cKeywordsToRemove) to High(cKeywordsToRemove) do
+    RemoveKeyword( cKeywordsToRemove[I] );
 end;
 
 procedure TSynDWSSyn.LowerProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
-  if (FLine[Run] = '=') or (FLine[Run] = '>') then
+  if (fLine[Run] = '=') or (fLine[Run] = '>') then
     Inc(Run);
 end;
 
 procedure TSynDWSSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -721,7 +719,7 @@ procedure TSynDWSSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', '.', 'e', 'E', '-', '+':
         Result := True;
       else
@@ -731,19 +729,19 @@ procedure TSynDWSSyn.NumberProc;
 
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar do
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '.':
-        if FLine[Run + 1] = '.' then
+        if fLine[Run + 1] = '.' then
           Break
         else
-          FTokenID := tkFloat;
-      'e', 'E': FTokenID := tkFloat;
+          fTokenID := tkFloat;
+      'e', 'E': fTokenID := tkFloat;
       '-', '+':
         begin
-          if FTokenID <> tkFloat then // arithmetic
+          if fTokenID <> tkFloat then // arithmetic
             Break;
           if (FLine[Run - 1] <> 'e') and (FLine[Run - 1] <> 'E') then
             Break; //float, but it ends here
@@ -755,27 +753,27 @@ procedure TSynDWSSyn.NumberProc;
 
 procedure TSynDWSSyn.PointProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
-  if (FLine[Run] = '.') or (FLine[Run - 1] = ')') then
+  if (fLine[Run] = '.') or (fLine[Run - 1] = ')') then
     Inc(Run);
 end;
 
-procedure TSynDWSSyn.CommentAnsiProc;
+procedure TSynDWSSyn.AnsiProc;
 begin
-  case FLine[Run] of
+  case fLine[Run] of
      #0: NullProc;
     #10: LFProc;
     #13: CRProc;
   else
-    FTokenID := tkComment;
+    fTokenID := tkComment;
     repeat
-      if (FLine[Run] = '*') and (FLine[Run + 1] = FCommentClose) then begin
+      if (fLine[Run] = '*') and (fLine[Run + 1] = fCommentClose) then begin
         Inc(Run, 2);
-        if FRange in [rsAsmCommentC] then
-          FRange := rsAsm
+        if fRange = rsAnsiAsm then
+          fRange := rsAsm
         else
-          FRange := rsUnknown;
+          fRange := rsUnKnown;
         Break;
       end;
       Inc(Run);
@@ -786,47 +784,43 @@ procedure TSynDWSSyn.CommentAnsiProc;
 procedure TSynDWSSyn.RoundOpenProc;
 begin
   Inc(Run);
-  case FLine[Run] of
+  case fLine[Run] of
     '*':
       begin
         Inc(Run);
-        if FRange = rsAsm then
-        begin
-          Inc(Run);
-          FTokenID := tkSymbol;
-          Exit;
-        end
+        if fRange = rsAsm then
+          fRange := rsAnsiAsm
         else
-          FRange := rsCommentAnsi;
-        FTokenID := tkComment;
-        FCommentClose := ')';
+          fRange := rsAnsi;
+        fTokenID := tkComment;
+        fCommentClose := ')';
         if not IsLineEnd(Run) then
-          CommentAnsiProc;
+          AnsiProc;
       end;
     '.':
       begin
         Inc(Run);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynDWSSyn.SemicolonProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
-  if FRange in [rsUnit, rsProperty, rsExports] then
-    FRange := rsUnknown;
+  fTokenID := tkSymbol;
+  if fRange in [rsProperty, rsExports] then
+    fRange := rsUnknown;
 end;
 
 procedure TSynDWSSyn.SlashProc;
 begin
   Inc(Run);
-  case FLine[Run] of
+  case fLine[Run] of
     '/': begin
-      FTokenID := tkComment;
+      fTokenID := tkComment;
       repeat
         Inc(Run);
       until IsLineEnd(Run);
@@ -834,36 +828,36 @@ procedure TSynDWSSyn.SlashProc;
     '*':
       begin
         Inc(Run);
-        if FRange = rsAsm then
-          FRange := rsAsmCommentC
+        if fRange = rsAsm then
+          fRange := rsAnsiAsm
         else
-          FRange := rsCommentC;
-        FTokenID := tkComment;
-        FCommentClose := '/';
+          fRange := rsAnsi;
+        fTokenID := tkComment;
+        fCommentClose := '/';
         if not IsLineEnd(Run) then
-          CommentAnsiProc;
+          AnsiProc;
       end;
   else
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynDWSSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynDWSSyn.StringAposProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   Inc(Run);
   while not IsLineEnd(Run) do
   begin
-    if FLine[Run] = #39 then begin
+    if fLine[Run] = #39 then begin
       Inc(Run);
-      if FLine[Run] <> #39 then
+      if fLine[Run] <> #39 then
         Break;
     end;
     Inc(Run);
@@ -872,16 +866,16 @@ procedure TSynDWSSyn.StringAposProc;
 
 procedure TSynDWSSyn.StringAposMultiProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   if (Run>0) or IsLineEnd(Run+1) then
      Inc(Run);
-  FRange := rsStringSingle;
+  fRange := rsHereDocSingle;
   while not IsLineEnd(Run) do
   begin
-    if FLine[Run] = '''' then begin
+    if fLine[Run] = '''' then begin
       Inc(Run);
-      if FLine[Run] <> '''' then begin
-        FRange := rsUnknown;
+      if fLine[Run] <> '''' then begin
+        fRange := rsUnknown;
         Break;
       end;
     end;
@@ -891,10 +885,10 @@ procedure TSynDWSSyn.StringAposMultiProc;
 
 procedure TSynDWSSyn.StringQuoteProc;
 begin
-  FTokenID := tkString;
-  if FRange <> rsStringDouble then
+  fTokenID := tkString;
+  if fRange <> rsHereDocDouble then
   begin
-    FRange := rsStringDouble;
+    fRange := rsHereDocDouble;
     Inc(Run);
   end else
   begin
@@ -907,12 +901,12 @@ procedure TSynDWSSyn.StringQuoteProc;
 
   while not IsLineEnd(Run) do
   begin
-    if FLine[Run] = '"' then
+    if fLine[Run] = '"' then
     begin
       Inc(Run);
-      if FLine[Run] <> '"' then
+      if fLine[Run] <> '"' then
       begin
-        FRange := rsUnknown;
+        fRange := rsUnknown;
         Break;
       end;
     end;
@@ -923,75 +917,75 @@ procedure TSynDWSSyn.StringQuoteProc;
 procedure TSynDWSSyn.SymbolProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynDWSSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynDWSSyn.Next;
 begin
-  FAsmStart := False;
-  FTokenPos := Run;
-  case FRange of
-    rsCommentAnsi, rsCommentC, rsAsmCommentC:
-        CommentAnsiProc;
-    rsCommentBor, rsDirective, rsAsmDirective:
-       CommentBorProc;
-    rsStringSingle:
-       StringAposMultiProc;
-    rsStringDouble:
-       StringQuoteProc;
-  else
-    case FLine[Run] of
-       #0: NullProc;
-       #10: LFProc;
-       #13: CRProc;
-       #1..#9, #11, #12, #14..#32: SpaceProc;
-       '#': AsciiCharProc;
-       '$': IntegerProc;
-       #39: StringAposProc;
-       '"': StringQuoteProc;
-       '0'..'9': NumberProc;
-       'A'..'Z', 'a'..'z', '_': IdentProc;
-       '{': BraceOpenProc;
-       '}', '!', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~': begin
-          case FLine[Run] of
-             '(': RoundOpenProc;
-             '.': PointProc;
-             ';': SemicolonProc;
-             '/': SlashProc;
-             ':', '>': ColonOrGreaterProc;
-             '<': LowerProc;
-             '@': AddressOpProc;
-          else
-             SymbolProc;
-          end;
-       end;
-       #$0080..#$FFFF :
-          if {$IFDEF SYN_COMPILER_18_UP}Char(FLine[Run]).IsLetterOrDigit{$ELSE}TCharacter.IsLetterOrDigit(FLine[Run]){$ENDIF} then
-             IdentProc
-          else UnknownProc;
-    else
-       UnknownProc;
-    end;
-  end;
-  inherited;
+   fAsmStart := False;
+   fTokenPos := Run;
+   case fRange of
+      rsAnsi, rsAnsiAsm:
+         AnsiProc;
+      rsBor, rsBorAsm, rsDirective, rsDirectiveAsm:
+         BorProc;
+      rsHereDocSingle:
+         StringAposMultiProc;
+      rsHereDocDouble:
+         StringQuoteProc;
+   else
+      case fLine[Run] of
+         #0: NullProc;
+         #10: LFProc;
+         #13: CRProc;
+         #1..#9, #11, #12, #14..#32: SpaceProc;
+         '#': AsciiCharProc;
+         '$': IntegerProc;
+         #39: StringAposProc;
+         '"': StringQuoteProc;
+         '0'..'9': NumberProc;
+         'A'..'Z', 'a'..'z', '_': IdentProc;
+         '{': BraceOpenProc;
+         '}', '!', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~': begin
+            case fLine[Run] of
+               '(': RoundOpenProc;
+               '.': PointProc;
+               ';': SemicolonProc;
+               '/': SlashProc;
+               ':', '>': ColonOrGreaterProc;
+               '<': LowerProc;
+               '@': AddressOpProc;
+            else
+               SymbolProc;
+            end;
+         end;
+         #$0080..#$FFFF :
+            if Char(fLine[Run]).IsLetterOrDigit then
+               IdentProc
+            else UnknownProc;
+      else
+         UnknownProc;
+      end;
+   end;
+   inherited;
 end;
 
 function TSynDWSSyn.GetDefaultAttribute(Index: Integer):
   TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -999,35 +993,35 @@ function TSynDWSSyn.GetDefaultAttribute(Index: Integer):
 
 function TSynDWSSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynDWSSyn.GetTokenID: TtkTokenKind;
 begin
-  if not FAsmStart and (FRange = rsAsm)
-    and not (FTokenID in [tkNull, tkComment, tkDirec, tkSpace])
+  if not fAsmStart and (fRange = rsAsm)
+    and not (fTokenId in [tkNull, tkComment, tkDirec, tkSpace])
   then
     Result := tkAsm
   else
-    Result := FTokenID;
+    Result := fTokenId;
 end;
 
 function TSynDWSSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
   case GetTokenID of
-    tkAsm: Result := FAsmAttri;
-    tkComment: Result := FCommentAttri;
-    tkDirec: Result := FDirecAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkFloat: Result := FFloatAttri;
-    tkHex: Result := FHexAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkChar: Result := FCharAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkUnknown: Result := FSymbolAttri;
+    tkAsm: Result := fAsmAttri;
+    tkComment: Result := fCommentAttri;
+    tkDirec: Result := fDirecAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkFloat: Result := fFloatAttri;
+    tkHex: Result := fHexAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkChar: Result := fCharAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkUnknown: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -1040,19 +1034,18 @@ function TSynDWSSyn.GetTokenKind: Integer;
 
 function TSynDWSSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
-{$IFDEF SYN_CodeFolding}
 type
   TRangeStates = set of TRangeState;
 
-Const
+const
   FT_Standard = 1;  // begin end, class end, record end
   FT_Comment = 11;
   FT_Asm = 12;
-  FT_StringDouble = 13;
-  FT_StringSingle = 14;
+  FT_HereDocDouble = 13;
+  FT_HereDocSingle = 14;
   FT_ConditionalDirective = 15;
   FT_CodeDeclaration = 16;
   FT_CodeDeclarationWithBody = 17;
@@ -1061,37 +1054,58 @@ function TSynDWSSyn.GetRange: Pointer;
 procedure TSynDWSSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges;
   LinesToScan: TStrings; FromLine, ToLine: Integer);
 var
-  CurLine: String;
+  CurLine: string;
   Line: Integer;
 
   function BlockDelimiter(Line: Integer): Boolean;
   var
-    Index: Integer;
+    BeginIndex: Integer;
+    EndIndex: Integer;
+    Match: TMatch;
+    MatchValue: string;
+    StructureHighlight: Boolean;
   begin
-    Result := False;
+    BeginIndex := 0;
+    EndIndex := 0;
+    StructureHighlight := False;
 
-    if RE_BlockBegin.Exec(CurLine) then
+    Match := RE_BlockBegin.Match(CurLine);
+    if Match.Success then
     begin
       // Char must have proper highlighting (ignore stuff inside comments...)
-      Index := RE_BlockBegin.MatchPos[0];
-      if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then
+      BeginIndex :=  Match.Index;
+      if GetHighlighterAttriAtRowCol(LinesToScan, Line, BeginIndex) <> fKeyAttri then
+        BeginIndex := -1
+      else
       begin
-        // And ignore lines with both opening and closing chars in them
-        Re_BlockEnd.InputString := CurLine;
-        if not RE_BlockEnd.Exec(Index + 1) then begin
-          FoldRanges.StartFoldRange(Line + 1, FT_Standard);
-          Result := True;
-        end;
+        MatchValue := LowerCase(Match.Value);
+        StructureHighlight := (MatchValue = 'begin') or
+          (MatchValue = 'case') or (MatchValue = 'try');
       end;
-    end else if RE_BlockEnd.Exec(CurLine) then
-    begin
-      Index := RE_BlockEnd.MatchPos[0];
-      if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then
+    end;
+
+    Match := RE_BlockEnd.Match(CurLine);
+    if Match.Success then begin
       begin
-        FoldRanges.StopFoldRange(Line + 1, FT_Standard);
-        Result := True;
+        EndIndex :=  Match.Index;
+        if GetHighlighterAttriAtRowCol(LinesToScan, Line, EndIndex) <> fKeyAttri then
+          EndIndex := -1;
       end;
     end;
+
+    Result := True;
+    if (BeginIndex <= 0) and (EndIndex <= 0) then
+      Result := False
+    else if (BeginIndex > 0) and (EndIndex <= 0) then
+      FoldRanges.StartFoldRange(Line + 1, FT_Standard,
+      IfThen(StructureHighlight,
+      LeftSpaces(CurLine, True, TabWidth(LinesToScan)), 0))
+    else if (BeginIndex <= 0) and (EndIndex > 0) then
+      FoldRanges.StopFoldRange(Line + 1, FT_Standard)
+    else if EndIndex >= BeginIndex then
+      Result := False  // begin end on the same line - ignore
+    else // end begin  as in "end else begin"
+      FoldRanges.StopStartFoldRange(Line + 1, FT_Standard);
   end;
 
   function FoldRegion(Line: Integer): Boolean;
@@ -1124,14 +1138,19 @@ procedure TSynDWSSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges;
       Result := True;
     end
     else if Uppercase(Copy(S, 1, 7)) = '{$ENDIF' then
+    begin
+      FoldRanges.StopFoldRange(Line + 1, FT_ConditionalDirective);
+      Result := True;
+    end
+    else if Uppercase(Copy(S, 1, 7)) = '{$IFEND' then
     begin
       FoldRanges.StopFoldRange(Line + 1, FT_ConditionalDirective);
       Result := True;
     end;
   end;
 
-  function IsMultiLineStatement(Line : integer; Ranges: TRangeStates;
-     Fold : Boolean; FoldType: Integer = 1): Boolean;
+  function IsMultiLineStatement(Line: Integer; Ranges: TRangeStates;
+     Fold: Boolean; FoldType: Integer = 1): Boolean;
   begin
     Result := True;
     if TRangeState(GetLineRange(LinesToScan, Line)) in Ranges then
@@ -1152,10 +1171,12 @@ procedure TSynDWSSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges;
   for Line := FromLine to ToLine do
   begin
     // Deal first with Multiline statements
-    if IsMultiLineStatement(Line, [rsCommentAnsi, rsCommentC, rsCommentBor], True, FT_Comment) or
-       IsMultiLineStatement(Line, [rsAsm, rsAsmCommentC, rsAsmDirective], True, FT_Asm) or
-       IsMultiLineStatement(Line, [rsStringDouble], True, FT_StringDouble) or
-       IsMultiLineStatement(Line, [rsStringSingle], True, FT_StringSingle) or
+    if IsMultiLineStatement(Line, [rsAnsi], True, FT_Comment) or
+       IsMultiLineStatement(Line, [rsAsm, rsAnsiAsm, rsBorAsm, rsDirectiveAsm], True, FT_Asm) or
+       IsMultiLineStatement(Line, [rsHereDocDouble], True, FT_HereDocDouble)  or
+       IsMultiLineStatement(Line, [rsHereDocSingle], True, FT_HereDocSingle)  or
+       IsMultiLineStatement(Line, [rsHereDocSingle], True, FT_HereDocSingle)  or
+       IsMultiLineStatement(Line, [rsBor], True, FT_Comment) or
        IsMultiLineStatement(Line, [rsDirective], False)
     then
       Continue;
@@ -1180,7 +1201,7 @@ procedure TSynDWSSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges;
     if Uppercase(TrimLeft(CurLine)) = 'IMPLEMENTATION' then
       FoldRanges.StartFoldRange(Line +1, FT_Implementation)
     // Functions and procedures
-    else if RE_Code.Exec(CurLine) then
+    else if RE_Code.IsMatch(CurLine) then
       FoldRanges.StartFoldRange(Line +1, FT_CodeDeclaration)
     // Find begin or end  (Fold Type 1)
     else if not BlockDelimiter(Line) then
@@ -1193,58 +1214,62 @@ procedure TSynDWSSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges;
 {
    Provide folding for procedures and functions included nested ones.
 }
-Var
-  i, j, SkipTo: Integer;
+var
+  I, j, SkipTo: Integer;
   ImplementationIndex: Integer;
   FoldRange: TSynFoldRange;
+  Match: TMatch;
 begin
   ImplementationIndex := - 1;
-  for i  := FoldRanges.Ranges.Count - 1 downto 0 do
+  for I  := FoldRanges.Ranges.Count - 1 downto 0 do
   begin
-    if FoldRanges.Ranges.List[i].FoldType = FT_Implementation then
-      ImplementationIndex := i
-    else if FoldRanges.Ranges.List[i].FoldType = FT_CodeDeclaration then
+    if FoldRanges.Ranges.List[I].FoldType = FT_Implementation then
+      ImplementationIndex := I
+    else if FoldRanges.Ranges.List[I].FoldType = FT_CodeDeclaration then
     begin
       if ImplementationIndex >= 0 then begin
         // Code declaration in the Interface part of a unit
-        FoldRanges.Ranges.Delete(i);
+        FoldRanges.Ranges.Delete(I);
         Dec(ImplementationIndex);
-        continue;
+        Continue;
       end;
       // Examine the following ranges
       SkipTo := 0;
-      j := i + 1;
+      j := I + 1;
       while J < FoldRanges.Ranges.Count do begin
         FoldRange := FoldRanges.Ranges.List[j];
         Inc(j);
         case FoldRange.FoldType of
-          // Nested procedure or function
           FT_CodeDeclarationWithBody:
+            // Nested procedure or function
             begin
               SkipTo := FoldRange.ToLine;
-              continue;
+              Continue;
             end;
           FT_Standard:
-          // possibly begin end;
+            // possibly begin end;
             if FoldRange.ToLine <= SkipTo then
               Continue
-            else if RE_BlockBegin.Exec(LinesToScan[FoldRange.FromLine - 1]) then
-            begin
-              if LowerCase(RE_BlockBegin.Match[0]) = 'begin' then
+            else begin
+              Match := RE_BlockBegin.Match(LinesToScan[FoldRange.FromLine - 1]);
+              if Match.Success then
               begin
-                // function or procedure followed by begin end block
-                // Adjust ToLine
-                FoldRanges.Ranges.List[i].ToLine := FoldRange.ToLine;
-                FoldRanges.Ranges.List[i].FoldType := FT_CodeDeclarationWithBody;
-                break
+                if LowerCase(Match.Value) = 'begin' then
+                begin
+                  // function or procedure followed by begin end block
+                  // Adjust ToLine
+                  FoldRanges.Ranges.List[I].ToLine := FoldRange.ToLine;
+                  FoldRanges.Ranges.List[I].FoldType := FT_CodeDeclarationWithBody;
+                  Break
+                end else
+                begin
+                  // class or record declaration follows, so
+                  FoldRanges.Ranges.Delete(I);
+                  Break;
+                 end;
               end else
-              begin
-                // class or record declaration follows, so
-                FoldRanges.Ranges.Delete(i);
-                break;
-               end;
-            end else
-              Assert(False, 'TSynDWSSyn.AdjustFoldRanges');
+                Assert(False, 'TSynDWSSyn.AdjustFoldRanges');
+            end;
         else
           begin
             if FoldRange.ToLine <= SkipTo then
@@ -1252,8 +1277,8 @@ procedure TSynDWSSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges;
             else begin
               // Otherwise delete
               // eg. function definitions within a class definition
-              FoldRanges.Ranges.Delete(i);
-              break
+              FoldRanges.Ranges.Delete(I);
+              Break
             end;
           end;
         end;
@@ -1265,80 +1290,78 @@ procedure TSynDWSSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges;
     //FoldRanges.Ranges.List[ImplementationIndex].ToLine := LinesToScan.Count;
     FoldRanges.Ranges.Delete(ImplementationIndex);
 end;
-{$ENDIF}
 
 procedure TSynDWSSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 procedure TSynDWSSyn.ResetRange;
 begin
-  FRange := rsUnknown;
+  fRange:= rsUnknown;
 end;
 
-function TSynDWSSyn.GetSampleSource: UnicodeString;
+function TSynDWSSyn.GetSampleSource: string;
 begin
-  Result := 
-    '{ Syntax highlighting }'#13#10 +
-    'procedure TForm1.Button1Click(Sender: TObject);'#13#10 +
-    'var'#13#10 +
-    '  Number, I, X: Integer;'#13#10 +
-    'begin'#13#10 +
-    '  Number := 123456;'#13#10 +
-    '  Caption := ''The Number is'' + #32 + IntToStr(Number);'#13#10 +
-    '  for I := 0 to Number do'#13#10 +
-    '  begin'#13#10 +
-    '    Inc(X);'#13#10 +
-    '    Dec(X);'#13#10 +
-    '    X := X + 1.0;'#13#10 +
-    '    X := X - $5E;'#13#10 +
-    '  end;'#13#10 +
-    '  {$R+}'#13#10 +
-    '  asm'#13#10 +
-    '    mov AX, 1234H'#13#10 +
-    '    mov Number, AX'#13#10 +
-    '  end;'#13#10 +
-    '  {$R-}'#13#10 +
-    'end;';
+  Result := '{ Syntax highlighting }'#13#10 +
+             'procedure TForm1.Button1Click(Sender: TObject);'#13#10 +
+             'var'#13#10 +
+             '  Number, I, X: Integer;'#13#10 +
+             'begin'#13#10 +
+             '  Number := 123456;'#13#10 +
+             '  Caption := ''The Number is'' + #32 + IntToStr(Number);'#13#10 +
+             '  for I := 0 to Number do'#13#10 +
+             '  begin'#13#10 +
+             '    Inc(X);'#13#10 +
+             '    Dec(X);'#13#10 +
+             '    X := X + 1.0;'#13#10 +
+             '    X := X - $5E;'#13#10 +
+             '  end;'#13#10 +
+             '  {$R+}'#13#10 +
+             '  asm'#13#10 +
+             '    mov AX, 1234H'#13#10 +
+             '    mov Number, AX'#13#10 +
+             '  end;'#13#10 +
+             '  {$R-}'#13#10 +
+             'end;';
 end;
 
 
 class function TSynDWSSyn.GetLanguageName: string;
 begin
-  Result := SYNS_LangPascal;
+  Result := SYNS_LangDWScript;
 end;
 
 class function TSynDWSSyn.GetCapabilities: TSynHighlighterCapabilities;
 begin
-  Result := inherited GetCapabilities + [hcUserSettings];
+  Result := inherited GetCapabilities + [hcUserSettings, hcStructureHighlight];
 end;
 
 function TSynDWSSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterPascal;
+  Result := fDefaultFilter <> SYNS_FilterPascal;
 end;
 
 // IsCurrentToken
 //
-function TSynDWSSyn.IsCurrentToken(const Token: UnicodeString): Boolean;
+function TSynDWSSyn.IsCurrentToken(const Token: string): Boolean;
 var
-  i: Integer;
-  temp: PWideChar;
+   I: Integer;
+   temp: PWideChar;
 begin
-  temp := FToIdent;
+   temp := fToIdent;
   if Length(Token) = FStringLen then
   begin
-    Result := True;
-    for i := 1 to FStringLen do
+      Result := True;
+    for I := 1 to FStringLen do
     begin
-      if (temp^ <> Token[i]) and ((temp^>'z') or (UpCase(temp^) <> UpCase(Token[i]))) then
+      if (temp^ <> Token[I]) and ((temp^>'z') or (UpCase(temp^) <> UpCase(Token[I]))) then
       begin
-        Result := False;
-        Break;
+            Result := False;
+            Break;
+         end;
+         Inc(temp);
       end;
-      Inc(temp);
-    end;
   end
   else
     Result := False;
@@ -1348,21 +1371,19 @@ function TSynDWSSyn.IsCurrentToken(const Token: UnicodeString): Boolean;
 //
 function TSynDWSSyn.IsIdentChar(AChar: WideChar): Boolean;
 begin
-  if Ord(AChar) <= $7F then
-    Result := AnsiChar(AChar) in ['_', '0'..'9', 'A'..'Z', 'a'..'z']
-  else
-    Result := {$IFDEF SYN_COMPILER_18_UP}AChar.IsLetterOrDigit{$ELSE}TCharacter.IsLetterOrDigit(AChar){$ENDIF};
+   if Ord(AChar)<=$7F then
+      Result := AnsiChar(AChar) in ['_', '0'..'9', 'A'..'Z', 'a'..'z']
+   else
+      Result := AChar.IsLetterOrDigit;
 end;
 
-class function TSynDWSSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynDWSSyn.GetFriendlyLanguageName: string;
 begin
-  Result := SYNS_FriendlyLangPascal;
+  Result := SYNS_FriendlyLangDWScript;
 end;
 
 initialization
-
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynDWSSyn);
-{$ENDIF}
 
 end.
+
diff --git a/Ext/SynEdit/Source/SynHighlighterDfm.pas b/Ext/SynEdit/Source/SynHighlighterDfm.pas
index 685cc50..42fb908 100644
--- a/Ext/SynEdit/Source/SynHighlighterDfm.pas
+++ b/Ext/SynEdit/Source/SynHighlighterDfm.pas
@@ -27,13 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterDfm.pas,v 1.16.2.7 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a Delphi Form Source highlighter for SynEdit)
@@ -62,20 +55,20 @@ interface
   TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
     tkString, tkSymbol, tkUnknown);
 
-  TRangeState = (rsANil, rsComment, rsUnknown);
+  TRangeState = (rsANil, rsComment, rsUnKnown);
 
 type
   TSynDfmSyn = class(TSynCustomHighlighter)
   private
-    FRange: TRangeState;
+    fRange: TRangeState;
     FTokenID: TtkTokenKind;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
     procedure AltProc;
     procedure AsciiCharProc;
     procedure BraceCloseProc;
@@ -94,11 +87,11 @@   TSynDfmSyn = class(TSynCustomHighlighter)
     procedure SymbolProc;
     procedure UnknownProc;
   protected
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     function IsFilterStored: Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -112,33 +105,25 @@   TSynDfmSyn = class(TSynCustomHighlighter)
     procedure SetRange(Value: Pointer); override;
     procedure ResetRange; override;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
   end;
 
-function LoadDFMFile2Strings(const AFile: UnicodeString; AStrings: TUnicodeStrings;
-  var WasText: Boolean): Integer; {$IFNDEF UNICODE} overload; {$ENDIF}
-{$IFNDEF UNICODE}
 function LoadDFMFile2Strings(const AFile: string; AStrings: TStrings;
-  var WasText: Boolean): Integer; overload;
-{$ENDIF}
-function SaveStrings2DFMFile(AStrings: TUnicodeStrings;
-  const AFile: UnicodeString): Integer; {$IFNDEF UNICODE} overload; {$ENDIF}
-{$IFNDEF UNICODE}
+  var WasText: Boolean): Integer;
 function SaveStrings2DFMFile(AStrings: TStrings;
-  const AFile: string): Integer; overload;
-{$ENDIF}
+  const AFile: string): Integer;
 
 implementation
 
@@ -147,61 +132,23 @@ implementation
 
 { A couple of useful Delphi Form functions }
 
-function LoadDFMFile2Strings(const AFile: UnicodeString; AStrings: TUnicodeStrings;
-  var WasText: Boolean): Integer;
-var
-  Src, Dest: TStream;
-  origFormat: TStreamOriginalFormat;
-begin
-  Result := 0;
-  WasText := FALSE;
-  AStrings.Clear;
-  try
-    Src := TWideFileStream.Create(AFile, fmOpenRead or fmShareDenyWrite);
-    try
-      Dest := TMemoryStream.Create;
-      try
-        origFormat := sofUnknown;
-        ObjectResourceToText(Src, Dest, origFormat);
-        WasText := origFormat = sofText;
-        Dest.Seek(0, soFromBeginning);
-        AStrings.LoadFromStream(Dest);
-      finally
-        Dest.Free;
-      end;
-    finally
-      Src.Free;
-    end;
-  except
-    on E: EInOutError do Result := -E.ErrorCode;
-    else Result := -1;
-  end;
-end;
-
-{$IFNDEF UNICODE}
 function LoadDFMFile2Strings(const AFile: string; AStrings: TStrings;
   var WasText: Boolean): Integer;
 var
   Src, Dest: TStream;
-{$IFDEF SYN_COMPILER_5_UP}
   origFormat: TStreamOriginalFormat;
-{$ENDIF}
 begin
   Result := 0;
-  WasText := FALSE;
+  WasText := False;
   AStrings.Clear;
   try
     Src := TFileStream.Create(AFile, fmOpenRead or fmShareDenyWrite);
     try
       Dest := TMemoryStream.Create;
       try
-{$IFDEF SYN_COMPILER_5_UP}
         origFormat := sofUnknown;
         ObjectResourceToText(Src, Dest, origFormat);
         WasText := origFormat = sofText;
-{$ELSE}
-        ObjectResourceToText(Src, Dest);
-{$ENDIF}
         Dest.Seek(0, soFromBeginning);
         AStrings.LoadFromStream(Dest);
       finally
@@ -215,44 +162,7 @@ function LoadDFMFile2Strings(const AFile: string; AStrings: TStrings;
     else Result := -1;
   end;
 end;
-{$ENDIF}
-
-function SaveStrings2DFMFile(AStrings: TUnicodeStrings; const AFile: UnicodeString): Integer;
-var
-  Src, Dest: TStream;
-{$IFNDEF UNICODE}
-  OldSaveUnicode: Boolean;
-{$ENDIF}
-begin
-  Result := 0;
-  try
-    Src := TMemoryStream.Create;
-    try
-{$IFNDEF UNICODE}
-      OldSaveUnicode := AStrings.SaveUnicode;
-      AStrings.SaveUnicode := False;
-{$ENDIF}
-      AStrings.SaveToStream(Src);
-{$IFNDEF UNICODE}
-      AStrings.SaveUnicode := OldSaveUnicode;
-{$ENDIF}
-      Src.Seek(0, soFromBeginning);
-      Dest := TWideFileStream.Create(AFile, fmCreate);
-      try
-        ObjectTextToResource(Src, Dest);
-      finally
-        Dest.Free;
-      end;
-    finally
-      Src.Free;
-    end;
-  except
-    on E: EInOutError do Result := -E.ErrorCode;
-    else Result := -1;
-  end;
-end;
 
-{$IFNDEF UNICODE}
 function SaveStrings2DFMFile(AStrings: TStrings; const AFile: string): Integer;
 var
   Src, Dest: TStream;
@@ -277,7 +187,6 @@ function SaveStrings2DFMFile(AStrings: TStrings; const AFile: string): Integer;
     else Result := -1;
   end;
 end;
-{$ENDIF}
 
 { TSynDfmSyn }
 
@@ -285,66 +194,66 @@ constructor TSynDfmSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
-
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  AddAttribute(FCommentAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey);
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
+  fCaseSensitive := False;
+
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  AddAttribute(fCommentAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey);
+  fKeyAttri.Style := [fsBold];
+  AddAttribute(fKeyAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
   SetAttributesOnChange(DefHighlightChange);
-  FDefaultFilter := SYNS_FilterDFM;
-  FRange := rsUnknown;
+  fDefaultFilter := SYNS_FilterDFM;
+  fRange := rsUnknown;
 end;
 
 procedure TSynDfmSyn.AltProc;
 begin
-  FTokenID := tkIdentifier;
+  fTokenID := tkIdentifier;
   repeat
     Inc(Run);
-  until not IsIdentChar(FLine[Run]);
+  until not IsIdentChar(fLine[Run]);
 end;
 
 procedure TSynDfmSyn.AsciiCharProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
     Inc(Run);
-  until not CharInSet(FLine[Run], ['0'..'9']);
+  until not CharInSet(fLine[Run], ['0'..'9']);
 end;
 
 procedure TSynDfmSyn.BraceCloseProc;
 begin
   Inc(Run);
-  FRange := rsUnknown;
-  FTokenID := tkIdentifier;
+  fRange := rsUnknown;
+  fTokenId := tkIdentifier;
 end;
 
 procedure TSynDfmSyn.BraceOpenProc;
 begin
-  FRange := rsComment;
+  fRange := rsComment;
   CommentProc;
 end;
 
 procedure TSynDfmSyn.CommentProc;
 begin
-  FTokenID := tkComment;
+  fTokenID := tkComment;
   repeat
     Inc(Run);
-    if FLine[Run] = '}' then begin
+    if fLine[Run] = '}' then begin
       Inc(Run);
-      FRange := rsUnknown;
+      fRange := rsUnknown;
       Break;
     end;
   until IsLineEnd(Run);
@@ -352,19 +261,19 @@ procedure TSynDfmSyn.CommentProc;
 
 procedure TSynDfmSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if (FLine[Run] = #10) then Inc(Run);
+  if (fLine[Run] = #10) then Inc(Run);
 end;
 
 procedure TSynDfmSyn.EndProc;
 begin
-  if CharInSet(FLine[Run + 1], ['n', 'N']) and
-     CharInSet(FLine[Run + 2], ['d', 'D']) and
-     not IsIdentChar(FLine[Run + 3])
+  if CharInSet(fLine[Run + 1], ['n', 'N']) and
+     CharInSet(fLine[Run + 2], ['d', 'D']) and
+     not IsIdentChar(fLine[Run + 3])
   then
   begin
-    FTokenID := tkKey;
+    fTokenID := tkKey;
     Inc(Run, 3);
   end
   else
@@ -375,7 +284,7 @@ procedure TSynDfmSyn.IntegerProc;
 
   function IsIntegerChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f':
         Result := True;
       else
@@ -384,7 +293,7 @@ procedure TSynDfmSyn.IntegerProc;
   end;
 
 begin
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   repeat
     Inc(Run);
   until not IsIntegerChar;
@@ -392,13 +301,13 @@ procedure TSynDfmSyn.IntegerProc;
 
 procedure TSynDfmSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynDfmSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -406,7 +315,7 @@ procedure TSynDfmSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'e', 'E':
         Result := True;
       else
@@ -415,12 +324,12 @@ procedure TSynDfmSyn.NumberProc;
   end;
 
 begin
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   repeat
     Inc(Run);
-    if FLine[Run] = '.' then
+    if fLine[Run] = '.' then
     begin
-      if FLine[Run + 1] <> '.' then Inc(Run);
+      if fLine[Run + 1] <> '.' then Inc(Run);
       Break;
     end;
   until not IsNumberChar;
@@ -428,15 +337,15 @@ procedure TSynDfmSyn.NumberProc;
 
 procedure TSynDfmSyn.ObjectProc;
 begin
-  if CharInSet(FLine[Run + 1], ['b', 'B']) and
-     CharInSet(FLine[Run + 2], ['j', 'J']) and
-     CharInSet(FLine[Run + 3], ['e', 'E']) and
-     CharInSet(FLine[Run + 4], ['c', 'C']) and
-     CharInSet(FLine[Run + 5], ['t', 'T']) and
-     not IsIdentChar(FLine[Run + 6])
+  if CharInSet(fLine[Run + 1], ['b', 'B']) and
+     CharInSet(fLine[Run + 2], ['j', 'J']) and
+     CharInSet(fLine[Run + 3], ['e', 'E']) and
+     CharInSet(fLine[Run + 4], ['c', 'C']) and
+     CharInSet(fLine[Run + 5], ['t', 'T']) and
+     not IsIdentChar(fLine[Run + 6])
   then
   begin
-    FTokenID := tkKey;
+    fTokenID := tkKey;
     Inc(Run, 6);
   end
   else
@@ -445,29 +354,29 @@ procedure TSynDfmSyn.ObjectProc;
 
 procedure TSynDfmSyn.InheritedProc;
 begin
-  if CharInSet(FLine[Run + 1], ['n', 'N']) and
-     CharInSet(FLine[Run + 2], ['h', 'H']) and
-     CharInSet(FLine[Run + 3], ['e', 'E']) and
-     CharInSet(FLine[Run + 4], ['r', 'R']) and
-     CharInSet(FLine[Run + 5], ['i', 'I']) and
-     CharInSet(FLine[Run + 6], ['t', 'T']) and
-     CharInSet(FLine[Run + 7], ['e', 'E']) and
-     CharInSet(FLine[Run + 8], ['d', 'D']) and
-     not IsIdentChar(FLine[Run + 9])
+  if CharInSet(fLine[Run + 1], ['n', 'N']) and
+     CharInSet(fLine[Run + 2], ['h', 'H']) and
+     CharInSet(fLine[Run + 3], ['e', 'E']) and
+     CharInSet(fLine[Run + 4], ['r', 'R']) and
+     CharInSet(fLine[Run + 5], ['i', 'I']) and
+     CharInSet(fLine[Run + 6], ['t', 'T']) and
+     CharInSet(fLine[Run + 7], ['e', 'E']) and
+     CharInSet(fLine[Run + 8], ['d', 'D']) and
+     not IsIdentChar(fLine[Run + 9])
   then
   begin
-    FTokenID := tkKey;
+    fTokenID := tkKey;
     Inc(Run, 9);
   end
-  else if CharInSet(FLine[Run + 1], ['n', 'N']) and
-          CharInSet(FLine[Run + 2], ['l', 'L']) and
-          CharInSet(FLine[Run + 3], ['i', 'I']) and
-          CharInSet(FLine[Run + 4], ['n', 'N']) and
-          CharInSet(FLine[Run + 5], ['e', 'E']) and
-          not IsIdentChar(FLine[Run + 6])
+  else if CharInSet(fLine[Run + 1], ['n', 'N']) and
+          CharInSet(fLine[Run + 2], ['l', 'L']) and
+          CharInSet(fLine[Run + 3], ['i', 'I']) and
+          CharInSet(fLine[Run + 4], ['n', 'N']) and
+          CharInSet(fLine[Run + 5], ['e', 'E']) and
+          not IsIdentChar(fLine[Run + 6])
   then
   begin
-    FTokenID := tkKey;
+    fTokenID := tkKey;
     Inc(Run, 6);
   end
   else
@@ -476,22 +385,20 @@ procedure TSynDfmSyn.InheritedProc;
 
 procedure TSynDfmSyn.SpaceProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   repeat
     Inc(Run);
-  until (FLine[Run] > #32) or IsLineEnd(Run);
+  until (fLine[Run] > #32) or IsLineEnd(Run);
 end;
 
 procedure TSynDfmSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
     Inc(Run);
-    if FLine[Run] = '''' then
-    begin
+    if fLine[Run] = '''' then begin
       Inc(Run);
-      if FLine[Run] <> '''' then
-        Break
+      if fLine[Run] <> '''' then Break
     end;
   until IsLineEnd(Run);
 end;
@@ -499,37 +406,37 @@ procedure TSynDfmSyn.StringProc;
 procedure TSynDfmSyn.SymbolProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynDfmSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynDfmSyn.Next;
 begin
-  FTokenPos := Run;
-  if FRange = rsComment then
+  fTokenPos := Run;
+  if fRange = rsComment then
   begin
-    if FLine[Run] = #0 then
+    if fLine[Run] = #0 then
       NullProc
     else
       CommentProc;
   end
   else
-    case FLine[Run] of
+    case fLine[Run] of
       '#': AsciiCharProc;
       '}': BraceCloseProc;
       '{': BraceOpenProc;
       #13: CRProc;
       'A'..'Z', 'a'..'z', '_':
-        if CharInSet(FLine[Run], ['e', 'E']) then
+        if CharInSet(fLine[Run], ['e', 'E']) then
           EndProc
-        else if CharInSet(FLine[Run], ['o', 'O']) then
+        else if CharInSet(fLine[Run], ['o', 'O']) then
           ObjectProc
-        else if CharInSet(FLine[Run], ['i', 'I']) then
+        else if CharInSet(fLine[Run], ['i', 'I']) then
           InheritedProc
         else
           AltProc;
@@ -548,12 +455,12 @@ procedure TSynDfmSyn.Next;
 function TSynDfmSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -561,52 +468,52 @@ function TSynDfmSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribut
 
 function TSynDfmSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynDfmSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 function TSynDfmSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynDfmSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  case FTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkUnknown: Result := FIdentifierAttri;
+  case fTokenID of
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkUnknown: Result := fIdentifierAttri;
     else Result := nil;
   end;
 end;
 
 function TSynDfmSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenID);
 end;
 
 procedure TSynDfmSyn.ResetRange;
 begin
-  FRange := rsUnknown;
+  fRange := rsUnknown;
 end;
 
 procedure TSynDfmSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 function TSynDfmSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterDFM;
+  Result := fDefaultFilter <> SYNS_FilterDFM;
 end;
 
 class function TSynDfmSyn.GetLanguageName: string;
@@ -614,7 +521,7 @@ class function TSynDfmSyn.GetLanguageName: string;
   Result := SYNS_LangDfm;
 end;
 
-function TSynDfmSyn.GetSampleSource: UnicodeString;
+function TSynDfmSyn.GetSampleSource: string;
 begin
   Result := '{ Delphi/C++ Builder Form Definitions }'#13#10 +
             'object TestForm: TTestForm'#13#10 +
@@ -624,13 +531,11 @@ function TSynDfmSyn.GetSampleSource: UnicodeString;
             'end';
 end; { GetSampleSource }
 
-class function TSynDfmSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynDfmSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangDfm;
 end;
 
-{$IFNDEF SYN_CPPB_1}
 initialization
   RegisterPlaceableHighlighter(TSynDfmSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterDml.pas b/Ext/SynEdit/Source/SynHighlighterDml.pas
index 52a1eb7..873c266 100644
--- a/Ext/SynEdit/Source/SynHighlighterDml.pas
+++ b/Ext/SynEdit/Source/SynHighlighterDml.pas
@@ -28,11 +28,6 @@
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
 
-$Id: SynHighlighterDml.pas,v 1.11.2.7 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
 Known Issues:
   - There are no metadata qualifiers.
 -------------------------------------------------------------------------------}
@@ -63,29 +58,29 @@ interface
     tkNull, tkNumber, tkQualifier, tkSpace, tkSpecial, tkString, tkSymbol,
     tkUnknown, tkVariable);
 
-  TRangeState = (rsANil, rsAdd, rsFind, rsUnknown);
+  TRangeState = (rsANil, rsAdd, rsFind, rsUnKnown);
 
   PIdentFuncTableFunc = ^TIdentFuncTableFunc;
   TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
 
   TSynDmlSyn = class(TSynCustomHighlighter)
   private
-    FRange: TRangeState;
-    FIdentFuncTable: array[0..2438] of TIdentFuncTableFunc;
+    fRange: TRangeState;
+    fIdentFuncTable: array[0..2438] of TIdentFuncTableFunc;
     FTokenID: TtkTokenKind;
-    FFormAttri: TSynHighlighterAttributes;
-    FBlockAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FQualiAttri: TSynHighlighterAttributes;
-    FCommentAttri: TSynHighlighterAttributes;
-    FFunctionAttri: TSynHighlighterAttributes;
-    FVariableAttri: TSynHighlighterAttributes;
-    FSpecialAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
+    fFormAttri: TSynHighlighterAttributes;
+    fBlockAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fQualiAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fFunctionAttri: TSynHighlighterAttributes;
+    fVariableAttri: TSynHighlighterAttributes;
+    fSpecialAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
     function AltFunc(Index: Integer): TtkTokenKind;
     function FuncAbs(Index: Integer): TtkTokenKind;
     function FuncAbsolute_position(Index: Integer): TtkTokenKind;
@@ -375,7 +370,7 @@   TSynDmlSyn = class(TSynCustomHighlighter)
     function IsFilterStored: Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -389,31 +384,31 @@   TSynDmlSyn = class(TSynCustomHighlighter)
     procedure SetRange(Value: Pointer); override;
     procedure ResetRange; override;
   published
-    property BlockAttri: TSynHighlighterAttributes read FBlockAttri
-      write FBlockAttri;
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property FormAttri: TSynHighlighterAttributes read FFormAttri
-      write FFormAttri;
-    property FunctionAttri: TSynHighlighterAttributes read FFunctionAttri
-      write FFunctionAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property QualiAttri: TSynHighlighterAttributes read FQualiAttri
-      write FQualiAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property SpecialAttri: TSynHighlighterAttributes read FSpecialAttri
-      write FSpecialAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
-    property VariableAttri: TSynHighlighterAttributes read FVariableAttri
-      write FVariableAttri;
+    property BlockAttri: TSynHighlighterAttributes read fBlockAttri
+      write fBlockAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property FormAttri: TSynHighlighterAttributes read fFormAttri
+      write fFormAttri;
+    property FunctionAttri: TSynHighlighterAttributes read fFunctionAttri
+      write fFunctionAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property QualiAttri: TSynHighlighterAttributes read fQualiAttri
+      write fQualiAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property SpecialAttri: TSynHighlighterAttributes read fSpecialAttri
+      write fSpecialAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
+    property VariableAttri: TSynHighlighterAttributes read fVariableAttri
+      write fVariableAttri;
   end;
 
 implementation
@@ -422,7 +417,7 @@ implementation
   SynEditStrConst;
 
 const
-  KeyWords: array[0..263] of UnicodeString = (
+  KeyWords: array[0..263] of string = (
     'abs', 'absolute_position', 'account', 'acos', 'actual_break', 'add', 
     'add_form', 'alternate_form', 'ascii', 'asin', 'atan', 'atan2', 
     'attributes', 'back', 'base', 'batch', 'begin_block', 'begin_case', 
@@ -613,7 +608,7 @@ function TSynDmlSyn.HashKey(Str: PWideChar): Cardinal;
     Inc(Str);
   end;
   Result := Result mod 2439;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -621,10 +616,10 @@ function TSynDmlSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
@@ -633,288 +628,288 @@ procedure TSynDmlSyn.InitIdent;
 var
   i: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
     if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
-
-  FIdentFuncTable[435] := FuncAbs;
-  FIdentFuncTable[41] := FuncAbsolute_position;
-  FIdentFuncTable[13] := FuncAccount;
-  FIdentFuncTable[2405] := FuncAcos;
-  FIdentFuncTable[1707] := FuncActual_break;
-  FIdentFuncTable[300] := FuncAdd;
-  FIdentFuncTable[486] := FuncAdd_form;
-  FIdentFuncTable[839] := FuncAlternate_form;
-  FIdentFuncTable[735] := FuncAscii;
-  FIdentFuncTable[1265] := FuncAsin;
-  FIdentFuncTable[2300] := FuncAtan;
-  FIdentFuncTable[1065] := FuncAtan2;
-  FIdentFuncTable[1930] := FuncAttributes;
-  FIdentFuncTable[1202] := FuncBack;
-  FIdentFuncTable[464] := FuncBase;
-  FIdentFuncTable[1118] := FuncBatch;
-  FIdentFuncTable[1948] := FuncBegin_block;
-  FIdentFuncTable[2124] := FuncBegin_case;
-  FIdentFuncTable[2068] := FuncBegin_disable_trigger;
-  FIdentFuncTable[1385] := FuncBegin_row;
-  FIdentFuncTable[387] := FuncBegin_signal_to_status;
-  FIdentFuncTable[1061] := FuncBell;
-  FIdentFuncTable[166] := FuncBinary_to_poly;
-  FIdentFuncTable[776] := FuncBottom_line;
-  FIdentFuncTable[1391] := FuncBreak;
-  FIdentFuncTable[1524] := FuncBreak0;
-  FIdentFuncTable[2380] := FuncCall;
-  FIdentFuncTable[2044] := FuncCase;
-  FIdentFuncTable[337] := FuncCeil;
-  FIdentFuncTable[644] := FuncCheck;
-  FIdentFuncTable[1918] := FuncCheck_domain;
-  FIdentFuncTable[1512] := FuncChr;
-  FIdentFuncTable[1454] := FuncClear_buffer;
-  FIdentFuncTable[1305] := FuncCli;
-  FIdentFuncTable[1761] := FuncClose;
-  FIdentFuncTable[908] := FuncClose_text;
-  FIdentFuncTable[1179] := FuncCol;
-  FIdentFuncTable[1114] := FuncColumn_heading_row;
-  FIdentFuncTable[2183] := FuncColumn_headings;
-  FIdentFuncTable[1007] := FuncColumn_spacing;
-  FIdentFuncTable[697] := FuncCommit;
-  FIdentFuncTable[521] := FuncCommit_rate;
-  FIdentFuncTable[591] := FuncCompile;
-  FIdentFuncTable[1068] := FuncCompress;
-  FIdentFuncTable[1359] := FuncCompress_all;
-  FIdentFuncTable[1637] := FuncConfirm;
-  FIdentFuncTable[89] := FuncConnect;
-  FIdentFuncTable[898] := FuncContinue;
-  FIdentFuncTable[1200] := FuncCos;
-  FIdentFuncTable[1747] := FuncCosh;
-  FIdentFuncTable[954] := FuncCross_reference;
-  FIdentFuncTable[1630] := FuncDate;
-  FIdentFuncTable[320] := FuncDate_seconds;
-  FIdentFuncTable[368] := FuncDay_of_week;
-  FIdentFuncTable[1447] := FuncDays;
-  FIdentFuncTable[2394] := FuncDcl;
-  FIdentFuncTable[1583] := FuncDefault_tag;
-  FIdentFuncTable[820] := FuncDelete;
-  FIdentFuncTable[261] := FuncDelete_form;
-  FIdentFuncTable[608] := FuncDescription;
-  FIdentFuncTable[2142] := FuncDir;
-  FIdentFuncTable[1915] := FuncDisconnect;
-  FIdentFuncTable[1889] := FuncDisplay;
-  FIdentFuncTable[1520] := FuncDisplay_length;
-  FIdentFuncTable[2390] := FuncDocumentation;
-  FIdentFuncTable[76] := FuncDomain;
-  FIdentFuncTable[1387] := FuncEdit;
-  FIdentFuncTable[1414] := FuncElse;
-  FIdentFuncTable[801] := FuncElse_if;
-  FIdentFuncTable[1158] := FuncEnd_block;
-  FIdentFuncTable[1514] := FuncEnd_case;
-  FIdentFuncTable[1734] := FuncEnd_disable_trigger;
-  FIdentFuncTable[1043] := FuncEnd_execute;
-  FIdentFuncTable[2119] := FuncEnd_form;
-  FIdentFuncTable[224] := FuncEnd_if;
-  FIdentFuncTable[842] := FuncEnd_row;
-  FIdentFuncTable[1484] := FuncEnd_signal_to_status;
-  FIdentFuncTable[338] := FuncEnd_while;
-  FIdentFuncTable[893] := FuncErase;
-  FIdentFuncTable[392] := FuncError;
-  FIdentFuncTable[503] := FuncExecute;
-  FIdentFuncTable[253] := FuncExit;
-  FIdentFuncTable[1280] := FuncExit_forward;
-  FIdentFuncTable[1146] := FuncExpand;
-  FIdentFuncTable[206] := FuncExternal;
-  FIdentFuncTable[455] := FuncFacility;
-  FIdentFuncTable[176] := FuncFailure;
-  FIdentFuncTable[263] := FuncFetch;
-  FIdentFuncTable[2106] := FuncFiles;
-  FIdentFuncTable[1191] := FuncFind;
-  FIdentFuncTable[1492] := FuncFind_form;
-  FIdentFuncTable[1868] := FuncFinish;
-  FIdentFuncTable[651] := FuncFirst;
-  FIdentFuncTable[2081] := FuncFloor;
-  FIdentFuncTable[2267] := FuncFooting;
-  FIdentFuncTable[2269] := FuncFooting_form;
-  FIdentFuncTable[210] := FuncForm;
-  FIdentFuncTable[516] := FuncGenerate;
-  FIdentFuncTable[2196] := FuncGoto;
-  FIdentFuncTable[1401] := FuncGrouped_by;
-  FIdentFuncTable[711] := FuncHeading;
-  FIdentFuncTable[1173] := FuncHeading_form;
-  FIdentFuncTable[194] := FuncHeight;
-  FIdentFuncTable[461] := FuncIdentifier;
-  FIdentFuncTable[459] := FuncIf;
-  FIdentFuncTable[483] := FuncIn;
-  FIdentFuncTable[2151] := FuncInput_block;
-  FIdentFuncTable[947] := FuncInput_mask;
-  FIdentFuncTable[586] := FuncInput_row_height;
-  FIdentFuncTable[420] := FuncInt;
-  FIdentFuncTable[1579] := FuncInvoke;
-  FIdentFuncTable[134] := FuncItem;
-  FIdentFuncTable[824] := FuncItem_block;
-  FIdentFuncTable[1575] := FuncItem_if;
-  FIdentFuncTable[1988] := FuncJoined_to;
-  FIdentFuncTable[583] := FuncLeft;
-  FIdentFuncTable[393] := FuncLen;
-  FIdentFuncTable[1698] := FuncLfooting;
-  FIdentFuncTable[142] := FuncLheading;
-  FIdentFuncTable[439] := FuncLine;
-  FIdentFuncTable[218] := FuncLines_after;
-  FIdentFuncTable[1460] := FuncLines_before;
-  FIdentFuncTable[259] := FuncList;
-  FIdentFuncTable[193] := FuncLoad;
-  FIdentFuncTable[124] := FuncLock;
-  FIdentFuncTable[2361] := FuncLog;
-  FIdentFuncTable[807] := FuncLog10;
-  FIdentFuncTable[2406] := FuncLov;
-  FIdentFuncTable[2043] := FuncLov_auto_select;
-  FIdentFuncTable[1806] := FuncLov_col;
-  FIdentFuncTable[1921] := FuncLov_data;
-  FIdentFuncTable[467] := FuncLov_first;
-  FIdentFuncTable[1673] := FuncLov_height;
-  FIdentFuncTable[1499] := FuncLov_noheading;
-  FIdentFuncTable[70] := FuncLov_nosearch;
-  FIdentFuncTable[2134] := FuncLov_reduced_to;
-  FIdentFuncTable[2208] := FuncLov_row;
-  FIdentFuncTable[1788] := FuncLov_secondary;
-  FIdentFuncTable[2381] := FuncLov_selection;
-  FIdentFuncTable[1107] := FuncLov_sorted_by;
-  FIdentFuncTable[1268] := FuncLov_width;
-  FIdentFuncTable[1779] := FuncLov_with;
-  FIdentFuncTable[538] := FuncLowercase;
-  FIdentFuncTable[631] := FuncLtrim;
-  FIdentFuncTable[2233] := FuncMail;
-  FIdentFuncTable[2296] := FuncMenu;
-  FIdentFuncTable[743] := FuncMenu_block;
-  FIdentFuncTable[255] := FuncMenu_form;
-  FIdentFuncTable[1824] := FuncMessage;
-  FIdentFuncTable[858] := FuncMid;
-  FIdentFuncTable[588] := FuncMod;
-  FIdentFuncTable[729] := FuncModify_form;
-  FIdentFuncTable[1770] := FuncNew;
-  FIdentFuncTable[1176] := FuncNo_domain;
-  FIdentFuncTable[208] := FuncNobell;
-  FIdentFuncTable[1756] := FuncNoclear_buffer;
-  FIdentFuncTable[1858] := FuncNodeadlock_exit;
-  FIdentFuncTable[135] := FuncNoerase;
-  FIdentFuncTable[2073] := FuncNoerror;
-  FIdentFuncTable[1092] := FuncNoexit_forward;
-  FIdentFuncTable[1811] := FuncNoheading;
-  FIdentFuncTable[656] := FuncNolov_data;
-  FIdentFuncTable[1959] := FuncNorepeat;
-  FIdentFuncTable[1319] := FuncNostatus;
-  FIdentFuncTable[907] := FuncNototals;
-  FIdentFuncTable[2427] := FuncNounderlines;
-  FIdentFuncTable[632] := FuncNowait;
-  FIdentFuncTable[1560] := FuncOpen;
-  FIdentFuncTable[2226] := FuncOpen_text;
-  FIdentFuncTable[1941] := FuncOpt;
-  FIdentFuncTable[290] := FuncOptions;
-  FIdentFuncTable[491] := FuncOutput;
-  FIdentFuncTable[1952] := FuncOutput_block;
-  FIdentFuncTable[2108] := FuncOutput_mask;
-  FIdentFuncTable[1539] := FuncPause;
-  FIdentFuncTable[1182] := FuncPause_block;
-  FIdentFuncTable[214] := FuncPerform;
-  FIdentFuncTable[1294] := FuncPoly_to_binary;
-  FIdentFuncTable[219] := FuncPos;
-  FIdentFuncTable[1569] := FuncPrint;
-  FIdentFuncTable[1719] := FuncProcedure_form;
-  FIdentFuncTable[1105] := FuncPrompt;
-  FIdentFuncTable[488] := FuncProtect;
-  FIdentFuncTable[66] := FuncQuery;
-  FIdentFuncTable[2344] := FuncQuery_form;
-  FIdentFuncTable[575] := FuncRandom;
-  FIdentFuncTable[1396] := FuncRead_line;
-  FIdentFuncTable[885] := FuncRead_only;
-  FIdentFuncTable[1353] := FuncReceive;
-  FIdentFuncTable[1571] := FuncReceive_arguments;
-  FIdentFuncTable[2137] := FuncReceive_data;
-  FIdentFuncTable[264] := FuncReceive_table;
-  FIdentFuncTable[410] := FuncReduced_to;
-  FIdentFuncTable[1269] := FuncRelease;
-  FIdentFuncTable[303] := FuncRemain;
-  FIdentFuncTable[1784] := FuncRepeat;
-  FIdentFuncTable[452] := FuncReport;
-  FIdentFuncTable[2315] := FuncReport_form;
-  FIdentFuncTable[2025] := FuncReposition;
-  FIdentFuncTable[1259] := FuncRewind_text;
-  FIdentFuncTable[1938] := FuncRfooting;
-  FIdentFuncTable[2331] := FuncRheading;
-  FIdentFuncTable[1932] := FuncRight;
-  FIdentFuncTable[1849] := FuncRollback;
-  FIdentFuncTable[553] := FuncRound;
-  FIdentFuncTable[1581] := FuncRow;
-  FIdentFuncTable[2407] := FuncRow_height;
-  FIdentFuncTable[1525] := FuncSearch;
-  FIdentFuncTable[151] := FuncSecondary;
-  FIdentFuncTable[1475] := FuncSeconds;
-  FIdentFuncTable[744] := FuncSelection;
-  FIdentFuncTable[1490] := FuncSend;
-  FIdentFuncTable[845] := FuncSend_data;
-  FIdentFuncTable[85] := FuncSend_message;
-  FIdentFuncTable[720] := FuncSend_table;
-  FIdentFuncTable[2275] := FuncSequence;
-  FIdentFuncTable[2038] := FuncSeverity;
-  FIdentFuncTable[60] := FuncSin;
-  FIdentFuncTable[1763] := FuncSinh;
-  FIdentFuncTable[1909] := FuncSorted_by;
-  FIdentFuncTable[1775] := FuncSource;
-  FIdentFuncTable[1474] := FuncSource_if;
-  FIdentFuncTable[2141] := FuncSqrt;
-  FIdentFuncTable[79] := FuncStart_stream;
-  FIdentFuncTable[604] := FuncStart_transaction;
-  FIdentFuncTable[639] := FuncStatistic;
-  FIdentFuncTable[654] := FuncStatus;
-  FIdentFuncTable[1816] := FuncStream_name;
-  FIdentFuncTable[1368] := FuncString;
-  FIdentFuncTable[1064] := FuncSuccess;
-  FIdentFuncTable[39] := FuncSwitch;
-  FIdentFuncTable[803] := FuncSwitch_base;
-  FIdentFuncTable[1212] := FuncSystem;
-  FIdentFuncTable[2335] := FuncTable;
-  FIdentFuncTable[934] := FuncTable_form;
-  FIdentFuncTable[1759] := FuncTable_search;
-  FIdentFuncTable[1074] := FuncTag;
-  FIdentFuncTable[705] := FuncTag_length;
-  FIdentFuncTable[1095] := FuncTan;
-  FIdentFuncTable[382] := FuncTanh;
-  FIdentFuncTable[975] := FuncTarget;
-  FIdentFuncTable[229] := FuncText;
-  FIdentFuncTable[2007] := FuncText_only;
-  FIdentFuncTable[307] := FuncTitle;
-  FIdentFuncTable[2430] := FuncTo;
-  FIdentFuncTable[795] := FuncTop_line;
-  FIdentFuncTable[68] := FuncTotal;
-  FIdentFuncTable[2000] := FuncTransfer;
-  FIdentFuncTable[333] := FuncTrigger;
-  FIdentFuncTable[2341] := FuncTrim;
-  FIdentFuncTable[2301] := FuncTsuppress;
-  FIdentFuncTable[2029] := FuncUnload;
-  FIdentFuncTable[844] := FuncUppercase;
-  FIdentFuncTable[1437] := FuncUse_if;
-  FIdentFuncTable[1736] := FuncUser_key;
-  FIdentFuncTable[353] := FuncUsing;
-  FIdentFuncTable[2305] := FuncUtilities;
-  FIdentFuncTable[1485] := FuncWait;
-  FIdentFuncTable[1159] := FuncWhile;
-  FIdentFuncTable[1452] := FuncWidth;
-  FIdentFuncTable[1476] := FuncWith;
-  FIdentFuncTable[27] := FuncWrite;
-  FIdentFuncTable[92] := FuncWrite_line;
-  FIdentFuncTable[2350] := FuncYesno_block;
-end;
-
-function TSynDmlSyn.IsQuali: Boolean;
+      fIdentFuncTable[i] := AltFunc;
+
+  fIdentFuncTable[435] := FuncAbs;
+  fIdentFuncTable[41] := FuncAbsolute_position;
+  fIdentFuncTable[13] := FuncAccount;
+  fIdentFuncTable[2405] := FuncAcos;
+  fIdentFuncTable[1707] := FuncActual_break;
+  fIdentFuncTable[300] := FuncAdd;
+  fIdentFuncTable[486] := FuncAdd_form;
+  fIdentFuncTable[839] := FuncAlternate_form;
+  fIdentFuncTable[735] := FuncAscii;
+  fIdentFuncTable[1265] := FuncAsin;
+  fIdentFuncTable[2300] := FuncAtan;
+  fIdentFuncTable[1065] := FuncAtan2;
+  fIdentFuncTable[1930] := FuncAttributes;
+  fIdentFuncTable[1202] := FuncBack;
+  fIdentFuncTable[464] := FuncBase;
+  fIdentFuncTable[1118] := FuncBatch;
+  fIdentFuncTable[1948] := FuncBegin_block;
+  fIdentFuncTable[2124] := FuncBegin_case;
+  fIdentFuncTable[2068] := FuncBegin_disable_trigger;
+  fIdentFuncTable[1385] := FuncBegin_row;
+  fIdentFuncTable[387] := FuncBegin_signal_to_status;
+  fIdentFuncTable[1061] := FuncBell;
+  fIdentFuncTable[166] := FuncBinary_to_poly;
+  fIdentFuncTable[776] := FuncBottom_line;
+  fIdentFuncTable[1391] := FuncBreak;
+  fIdentFuncTable[1524] := FuncBreak0;
+  fIdentFuncTable[2380] := FuncCall;
+  fIdentFuncTable[2044] := FuncCase;
+  fIdentFuncTable[337] := FuncCeil;
+  fIdentFuncTable[644] := FuncCheck;
+  fIdentFuncTable[1918] := FuncCheck_domain;
+  fIdentFuncTable[1512] := FuncChr;
+  fIdentFuncTable[1454] := FuncClear_buffer;
+  fIdentFuncTable[1305] := FuncCli;
+  fIdentFuncTable[1761] := FuncClose;
+  fIdentFuncTable[908] := FuncClose_text;
+  fIdentFuncTable[1179] := FuncCol;
+  fIdentFuncTable[1114] := FuncColumn_heading_row;
+  fIdentFuncTable[2183] := FuncColumn_headings;
+  fIdentFuncTable[1007] := FuncColumn_spacing;
+  fIdentFuncTable[697] := FuncCommit;
+  fIdentFuncTable[521] := FuncCommit_rate;
+  fIdentFuncTable[591] := FuncCompile;
+  fIdentFuncTable[1068] := FuncCompress;
+  fIdentFuncTable[1359] := FuncCompress_all;
+  fIdentFuncTable[1637] := FuncConfirm;
+  fIdentFuncTable[89] := FuncConnect;
+  fIdentFuncTable[898] := FuncContinue;
+  fIdentFuncTable[1200] := FuncCos;
+  fIdentFuncTable[1747] := FuncCosh;
+  fIdentFuncTable[954] := FuncCross_reference;
+  fIdentFuncTable[1630] := FuncDate;
+  fIdentFuncTable[320] := FuncDate_seconds;
+  fIdentFuncTable[368] := FuncDay_of_week;
+  fIdentFuncTable[1447] := FuncDays;
+  fIdentFuncTable[2394] := FuncDcl;
+  fIdentFuncTable[1583] := FuncDefault_tag;
+  fIdentFuncTable[820] := FuncDelete;
+  fIdentFuncTable[261] := FuncDelete_form;
+  fIdentFuncTable[608] := FuncDescription;
+  fIdentFuncTable[2142] := FuncDir;
+  fIdentFuncTable[1915] := FuncDisconnect;
+  fIdentFuncTable[1889] := FuncDisplay;
+  fIdentFuncTable[1520] := FuncDisplay_length;
+  fIdentFuncTable[2390] := FuncDocumentation;
+  fIdentFuncTable[76] := FuncDomain;
+  fIdentFuncTable[1387] := FuncEdit;
+  fIdentFuncTable[1414] := FuncElse;
+  fIdentFuncTable[801] := FuncElse_if;
+  fIdentFuncTable[1158] := FuncEnd_block;
+  fIdentFuncTable[1514] := FuncEnd_case;
+  fIdentFuncTable[1734] := FuncEnd_disable_trigger;
+  fIdentFuncTable[1043] := FuncEnd_execute;
+  fIdentFuncTable[2119] := FuncEnd_form;
+  fIdentFuncTable[224] := FuncEnd_if;
+  fIdentFuncTable[842] := FuncEnd_row;
+  fIdentFuncTable[1484] := FuncEnd_signal_to_status;
+  fIdentFuncTable[338] := FuncEnd_while;
+  fIdentFuncTable[893] := FuncErase;
+  fIdentFuncTable[392] := FuncError;
+  fIdentFuncTable[503] := FuncExecute;
+  fIdentFuncTable[253] := FuncExit;
+  fIdentFuncTable[1280] := FuncExit_forward;
+  fIdentFuncTable[1146] := FuncExpand;
+  fIdentFuncTable[206] := FuncExternal;
+  fIdentFuncTable[455] := FuncFacility;
+  fIdentFuncTable[176] := FuncFailure;
+  fIdentFuncTable[263] := FuncFetch;
+  fIdentFuncTable[2106] := FuncFiles;
+  fIdentFuncTable[1191] := FuncFind;
+  fIdentFuncTable[1492] := FuncFind_form;
+  fIdentFuncTable[1868] := FuncFinish;
+  fIdentFuncTable[651] := FuncFirst;
+  fIdentFuncTable[2081] := FuncFloor;
+  fIdentFuncTable[2267] := FuncFooting;
+  fIdentFuncTable[2269] := FuncFooting_form;
+  fIdentFuncTable[210] := FuncForm;
+  fIdentFuncTable[516] := FuncGenerate;
+  fIdentFuncTable[2196] := FuncGoto;
+  fIdentFuncTable[1401] := FuncGrouped_by;
+  fIdentFuncTable[711] := FuncHeading;
+  fIdentFuncTable[1173] := FuncHeading_form;
+  fIdentFuncTable[194] := FuncHeight;
+  fIdentFuncTable[461] := FuncIdentifier;
+  fIdentFuncTable[459] := FuncIf;
+  fIdentFuncTable[483] := FuncIn;
+  fIdentFuncTable[2151] := FuncInput_block;
+  fIdentFuncTable[947] := FuncInput_mask;
+  fIdentFuncTable[586] := FuncInput_row_height;
+  fIdentFuncTable[420] := FuncInt;
+  fIdentFuncTable[1579] := FuncInvoke;
+  fIdentFuncTable[134] := FuncItem;
+  fIdentFuncTable[824] := FuncItem_block;
+  fIdentFuncTable[1575] := FuncItem_if;
+  fIdentFuncTable[1988] := FuncJoined_to;
+  fIdentFuncTable[583] := FuncLeft;
+  fIdentFuncTable[393] := FuncLen;
+  fIdentFuncTable[1698] := FuncLfooting;
+  fIdentFuncTable[142] := FuncLheading;
+  fIdentFuncTable[439] := FuncLine;
+  fIdentFuncTable[218] := FuncLines_after;
+  fIdentFuncTable[1460] := FuncLines_before;
+  fIdentFuncTable[259] := FuncList;
+  fIdentFuncTable[193] := FuncLoad;
+  fIdentFuncTable[124] := FuncLock;
+  fIdentFuncTable[2361] := FuncLog;
+  fIdentFuncTable[807] := FuncLog10;
+  fIdentFuncTable[2406] := FuncLov;
+  fIdentFuncTable[2043] := FuncLov_auto_select;
+  fIdentFuncTable[1806] := FuncLov_col;
+  fIdentFuncTable[1921] := FuncLov_data;
+  fIdentFuncTable[467] := FuncLov_first;
+  fIdentFuncTable[1673] := FuncLov_height;
+  fIdentFuncTable[1499] := FuncLov_noheading;
+  fIdentFuncTable[70] := FuncLov_nosearch;
+  fIdentFuncTable[2134] := FuncLov_reduced_to;
+  fIdentFuncTable[2208] := FuncLov_row;
+  fIdentFuncTable[1788] := FuncLov_secondary;
+  fIdentFuncTable[2381] := FuncLov_selection;
+  fIdentFuncTable[1107] := FuncLov_sorted_by;
+  fIdentFuncTable[1268] := FuncLov_width;
+  fIdentFuncTable[1779] := FuncLov_with;
+  fIdentFuncTable[538] := FuncLowercase;
+  fIdentFuncTable[631] := FuncLtrim;
+  fIdentFuncTable[2233] := FuncMail;
+  fIdentFuncTable[2296] := FuncMenu;
+  fIdentFuncTable[743] := FuncMenu_block;
+  fIdentFuncTable[255] := FuncMenu_form;
+  fIdentFuncTable[1824] := FuncMessage;
+  fIdentFuncTable[858] := FuncMid;
+  fIdentFuncTable[588] := FuncMod;
+  fIdentFuncTable[729] := FuncModify_form;
+  fIdentFuncTable[1770] := FuncNew;
+  fIdentFuncTable[1176] := FuncNo_domain;
+  fIdentFuncTable[208] := FuncNobell;
+  fIdentFuncTable[1756] := FuncNoclear_buffer;
+  fIdentFuncTable[1858] := FuncNodeadlock_exit;
+  fIdentFuncTable[135] := FuncNoerase;
+  fIdentFuncTable[2073] := FuncNoerror;
+  fIdentFuncTable[1092] := FuncNoexit_forward;
+  fIdentFuncTable[1811] := FuncNoheading;
+  fIdentFuncTable[656] := FuncNolov_data;
+  fIdentFuncTable[1959] := FuncNorepeat;
+  fIdentFuncTable[1319] := FuncNostatus;
+  fIdentFuncTable[907] := FuncNototals;
+  fIdentFuncTable[2427] := FuncNounderlines;
+  fIdentFuncTable[632] := FuncNowait;
+  fIdentFuncTable[1560] := FuncOpen;
+  fIdentFuncTable[2226] := FuncOpen_text;
+  fIdentFuncTable[1941] := FuncOpt;
+  fIdentFuncTable[290] := FuncOptions;
+  fIdentFuncTable[491] := FuncOutput;
+  fIdentFuncTable[1952] := FuncOutput_block;
+  fIdentFuncTable[2108] := FuncOutput_mask;
+  fIdentFuncTable[1539] := FuncPause;
+  fIdentFuncTable[1182] := FuncPause_block;
+  fIdentFuncTable[214] := FuncPerform;
+  fIdentFuncTable[1294] := FuncPoly_to_binary;
+  fIdentFuncTable[219] := FuncPos;
+  fIdentFuncTable[1569] := FuncPrint;
+  fIdentFuncTable[1719] := FuncProcedure_form;
+  fIdentFuncTable[1105] := FuncPrompt;
+  fIdentFuncTable[488] := FuncProtect;
+  fIdentFuncTable[66] := FuncQuery;
+  fIdentFuncTable[2344] := FuncQuery_form;
+  fIdentFuncTable[575] := FuncRandom;
+  fIdentFuncTable[1396] := FuncRead_line;
+  fIdentFuncTable[885] := FuncRead_only;
+  fIdentFuncTable[1353] := FuncReceive;
+  fIdentFuncTable[1571] := FuncReceive_arguments;
+  fIdentFuncTable[2137] := FuncReceive_data;
+  fIdentFuncTable[264] := FuncReceive_table;
+  fIdentFuncTable[410] := FuncReduced_to;
+  fIdentFuncTable[1269] := FuncRelease;
+  fIdentFuncTable[303] := FuncRemain;
+  fIdentFuncTable[1784] := FuncRepeat;
+  fIdentFuncTable[452] := FuncReport;
+  fIdentFuncTable[2315] := FuncReport_form;
+  fIdentFuncTable[2025] := FuncReposition;
+  fIdentFuncTable[1259] := FuncRewind_text;
+  fIdentFuncTable[1938] := FuncRfooting;
+  fIdentFuncTable[2331] := FuncRheading;
+  fIdentFuncTable[1932] := FuncRight;
+  fIdentFuncTable[1849] := FuncRollback;
+  fIdentFuncTable[553] := FuncRound;
+  fIdentFuncTable[1581] := FuncRow;
+  fIdentFuncTable[2407] := FuncRow_height;
+  fIdentFuncTable[1525] := FuncSearch;
+  fIdentFuncTable[151] := FuncSecondary;
+  fIdentFuncTable[1475] := FuncSeconds;
+  fIdentFuncTable[744] := FuncSelection;
+  fIdentFuncTable[1490] := FuncSend;
+  fIdentFuncTable[845] := FuncSend_data;
+  fIdentFuncTable[85] := FuncSend_message;
+  fIdentFuncTable[720] := FuncSend_table;
+  fIdentFuncTable[2275] := FuncSequence;
+  fIdentFuncTable[2038] := FuncSeverity;
+  fIdentFuncTable[60] := FuncSin;
+  fIdentFuncTable[1763] := FuncSinh;
+  fIdentFuncTable[1909] := FuncSorted_by;
+  fIdentFuncTable[1775] := FuncSource;
+  fIdentFuncTable[1474] := FuncSource_if;
+  fIdentFuncTable[2141] := FuncSqrt;
+  fIdentFuncTable[79] := FuncStart_stream;
+  fIdentFuncTable[604] := FuncStart_transaction;
+  fIdentFuncTable[639] := FuncStatistic;
+  fIdentFuncTable[654] := FuncStatus;
+  fIdentFuncTable[1816] := FuncStream_name;
+  fIdentFuncTable[1368] := FuncString;
+  fIdentFuncTable[1064] := FuncSuccess;
+  fIdentFuncTable[39] := FuncSwitch;
+  fIdentFuncTable[803] := FuncSwitch_base;
+  fIdentFuncTable[1212] := FuncSystem;
+  fIdentFuncTable[2335] := FuncTable;
+  fIdentFuncTable[934] := FuncTable_form;
+  fIdentFuncTable[1759] := FuncTable_search;
+  fIdentFuncTable[1074] := FuncTag;
+  fIdentFuncTable[705] := FuncTag_length;
+  fIdentFuncTable[1095] := FuncTan;
+  fIdentFuncTable[382] := FuncTanh;
+  fIdentFuncTable[975] := FuncTarget;
+  fIdentFuncTable[229] := FuncText;
+  fIdentFuncTable[2007] := FuncText_only;
+  fIdentFuncTable[307] := FuncTitle;
+  fIdentFuncTable[2430] := FuncTo;
+  fIdentFuncTable[795] := FuncTop_line;
+  fIdentFuncTable[68] := FuncTotal;
+  fIdentFuncTable[2000] := FuncTransfer;
+  fIdentFuncTable[333] := FuncTrigger;
+  fIdentFuncTable[2341] := FuncTrim;
+  fIdentFuncTable[2301] := FuncTsuppress;
+  fIdentFuncTable[2029] := FuncUnload;
+  fIdentFuncTable[844] := FuncUppercase;
+  fIdentFuncTable[1437] := FuncUse_if;
+  fIdentFuncTable[1736] := FuncUser_key;
+  fIdentFuncTable[353] := FuncUsing;
+  fIdentFuncTable[2305] := FuncUtilities;
+  fIdentFuncTable[1485] := FuncWait;
+  fIdentFuncTable[1159] := FuncWhile;
+  fIdentFuncTable[1452] := FuncWidth;
+  fIdentFuncTable[1476] := FuncWith;
+  fIdentFuncTable[27] := FuncWrite;
+  fIdentFuncTable[92] := FuncWrite_line;
+  fIdentFuncTable[2350] := FuncYesno_block;
+end;
+
+function TSynDmlSyn.IsQuali: boolean;
 begin
   Result:= False;
   if Run > 0 then
-    if FLine[Run - 1] = '/' then Result:= True;
+    if fLine[Run - 1] = '/' then Result:= True;
 end;
 
 function TSynDmlSyn.IsSpecial: Boolean;
 begin
   Result:= False;
   if Run > 0 then
-    if FLine[Run - 1] = '%' then Result:= True;
+    if fLine[Run - 1] = '%' then Result:= True;
 end;
 
 function TSynDmlSyn.FuncAbs(Index: Integer): TtkTokenKind;
@@ -966,7 +961,7 @@ function TSynDmlSyn.FuncAdd(Index: Integer): TtkTokenKind;
     else
     begin
       Result := tkKey;
-      FRange := rsAdd;
+      fRange := rsAdd;
     end;
   end
   else
@@ -1665,7 +1660,7 @@ function TSynDmlSyn.FuncFind(Index: Integer): TtkTokenKind;
   if IsCurrentToken(KeyWords[Index]) then
   begin
     Result := tkKey;
-    FRange := rsFind;
+    fRange := rsFind;
   end
   else
     Result := tkIdentifier;
@@ -1798,10 +1793,10 @@ function TSynDmlSyn.FuncIf(Index: Integer): TtkTokenKind;
 
 function TSynDmlSyn.FuncIn(Index: Integer): TtkTokenKind;
 begin
-  if IsCurrentToken(KeyWords[Index]) and (FRange = rsFind) then
+  if IsCurrentToken(KeyWords[Index]) and (fRange = rsFind) then
   begin
     Result := tkKey;
-    FRange := rsUnknown;
+    fRange := rsUnKnown;
   end
   else
     Result := tkIdentifier;
@@ -2963,10 +2958,10 @@ function TSynDmlSyn.FuncTitle(Index: Integer): TtkTokenKind;
 
 function TSynDmlSyn.FuncTo(Index: Integer): TtkTokenKind;
 begin
-  if IsCurrentToken(KeyWords[Index]) and (FRange = rsAdd) then
+  if IsCurrentToken(KeyWords[Index]) and (fRange = rsAdd) then
   begin
     Result := tkKey;
-    FRange := rsUnknown;
+    fRange := rsUnKnown;
   end
   else
     Result := tkIdentifier;
@@ -3133,62 +3128,62 @@ constructor TSynDmlSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
-
-  FFormAttri:= TSynHighlighterAttributes.Create(SYNS_AttrForm, SYNS_FriendlyAttrForm);
-  FFormAttri.Style:= [fsBold];
-  FFormAttri.Foreground:= clBlue;
-  AddAttribute(FFormAttri);
-  FBlockAttri:= TSynHighlighterAttributes.Create(SYNS_AttrBlock, SYNS_FriendlyAttrBlock);
-  FBlockAttri.Style:= [fsBold];
-  FBlockAttri.Foreground:= clGreen;
-  AddAttribute(FBlockAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey);
-  FKeyAttri.Style:= [fsBold];
-  AddAttribute(FKeyAttri);
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style:= [fsBold];
-  FCommentAttri.Foreground:= clRed;
-  AddAttribute(FCommentAttri);
-  FQualiAttri:= TSynHighlighterAttributes.Create(SYNS_AttrQualifier, SYNS_FriendlyAttrQualifier);
-  FQualiAttri.Style:= [fsItalic];
-  FQualiAttri.Foreground:= clGreen;
-  AddAttribute(FQualiAttri);
-  FFunctionAttri:= TSynHighlighterAttributes.Create(SYNS_AttrFunction, SYNS_FriendlyAttrFunction);
-  FFunctionAttri.Style:= [fsItalic];
-  FFunctionAttri.Foreground:= clBlack;
-  AddAttribute(FFunctionAttri);
-  FVariableAttri:= TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
-  FVariableAttri.Style:= [fsBold, fsItalic];
-  FVariableAttri.Foreground:= clBlack;
-  AddAttribute(FVariableAttri);
-  FSpecialAttri:= TSynHighlighterAttributes.Create(SYNS_AttrSpecialVariable, SYNS_FriendlyAttrSpecialVariable);
-  FSpecialAttri.Style:= [fsItalic];
-  FSpecialAttri.Foreground:= clBlack;
-  AddAttribute(FSpecialAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
+  fCaseSensitive := False;
+
+  fFormAttri:= TSynHighlighterAttributes.Create(SYNS_AttrForm, SYNS_FriendlyAttrForm);
+  fFormAttri.Style:= [fsBold];
+  fFormAttri.Foreground:= clBlue;
+  AddAttribute(fFormAttri);
+  fBlockAttri:= TSynHighlighterAttributes.Create(SYNS_AttrBlock, SYNS_FriendlyAttrBlock);
+  fBlockAttri.Style:= [fsBold];
+  fBlockAttri.Foreground:= clGreen;
+  AddAttribute(fBlockAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey);
+  fKeyAttri.Style:= [fsBold];
+  AddAttribute(fKeyAttri);
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style:= [fsBold];
+  fCommentAttri.Foreground:= clRed;
+  AddAttribute(fCommentAttri);
+  fQualiAttri:= TSynHighlighterAttributes.Create(SYNS_AttrQualifier, SYNS_FriendlyAttrQualifier);
+  fQualiAttri.Style:= [fsItalic];
+  fQualiAttri.Foreground:= clGreen;
+  AddAttribute(fQualiAttri);
+  fFunctionAttri:= TSynHighlighterAttributes.Create(SYNS_AttrFunction, SYNS_FriendlyAttrFunction);
+  fFunctionAttri.Style:= [fsItalic];
+  fFunctionAttri.Foreground:= clBlack;
+  AddAttribute(fFunctionAttri);
+  fVariableAttri:= TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable);
+  fVariableAttri.Style:= [fsBold, fsItalic];
+  fVariableAttri.Foreground:= clBlack;
+  AddAttribute(fVariableAttri);
+  fSpecialAttri:= TSynHighlighterAttributes.Create(SYNS_AttrSpecialVariable, SYNS_FriendlyAttrSpecialVariable);
+  fSpecialAttri.Style:= [fsItalic];
+  fSpecialAttri.Foreground:= clBlack;
+  AddAttribute(fSpecialAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
   SetAttributesOnChange(DefHighlightChange);
 
   InitIdent;
-  FRange := rsUnknown;
+  fRange := rsUnknown;
 
-  FDefaultFilter := SYNS_FilterGembase;
+  fDefaultFilter := SYNS_FilterGembase;
 end;
 
 procedure TSynDmlSyn.AddressOpProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
-  if FLine[Run] = '@' then Inc(Run);
+  if fLine[Run] = '@' then Inc(Run);
 end;
 
 procedure TSynDmlSyn.AsciiCharProc;
@@ -3205,7 +3200,7 @@ procedure TSynDmlSyn.AsciiCharProc;
 
 begin
   // variables...
-  FTokenID := tkVariable;
+  fTokenID := tkVariable;
   repeat
     Inc(Run);
   until not IsAsciiChar;
@@ -3214,59 +3209,58 @@ procedure TSynDmlSyn.AsciiCharProc;
 procedure TSynDmlSyn.SymbolProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
 end;
 
 procedure TSynDmlSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
   if FLine[Run] = #10 then Inc(Run);
 end;
 
 procedure TSynDmlSyn.GreaterProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
   if FLine[Run] = '=' then Inc(Run);
 end;
 
 procedure TSynDmlSyn.IdentProc;
 begin
-  FTokenID := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  fTokenID := IdentKind((fLine + Run));
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
 end;
 
 procedure TSynDmlSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynDmlSyn.LowerProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
-  if (FLine[Run]= '=') or (FLine[Run]= '>') then Inc(Run);
+  if (fLine[Run]= '=') or (fLine[Run]= '>') then Inc(Run);
 end;
 
 procedure TSynDmlSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
 procedure TSynDmlSyn.NumberProc;
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while CharInSet(FLine[Run], ['0'..'9', '.']) do
   begin
     case FLine[Run] of
       '.':
-        if FLine[Run + 1] = '.' then
-          Break;
+        if FLine[Run + 1] = '.' then Break;
     end;
     Inc(Run);
   end;
@@ -3274,28 +3268,28 @@ procedure TSynDmlSyn.NumberProc;
 
 procedure TSynDmlSyn.PointProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
-  if (FLine[Run]='.') or (FLine[Run]=')') then Inc(Run);
+  if (fLine[Run]='.') or (fLine[Run]=')') then Inc(Run);
 end;
 
 procedure TSynDmlSyn.RemProc;
 var
   p: PWideChar;
 begin
-  p := PWideChar(@FLine[Run - 1]);
-  while p >= FLine do
+  p := PWideChar(@fLine[Run - 1]);
+  while p >= fLine do
   begin
     if not CharInSet(p^, [#9, #32]) then
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
       Exit;
     end;
     Dec(p);
   end;
   // it is a comment...
-  FTokenID := tkComment;
+  fTokenID := tkComment;
   repeat
     Inc(Run);
   until IsLineEnd(Run);
@@ -3303,13 +3297,13 @@ procedure TSynDmlSyn.RemProc;
 
 procedure TSynDmlSyn.SpaceProc;
 begin
-  FTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
+  fTokenID := tkSpace;
+  while (fLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynDmlSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   if (FLine[Run + 1] = '"') and (FLine[Run + 2] = '"') then Inc(Run, 2);
   repeat
     Inc(Run);
@@ -3321,13 +3315,13 @@ procedure TSynDmlSyn.StringProc;
 procedure TSynDmlSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynDmlSyn.Next;
 begin
-  FTokenPos := Run;
-   case FLine[Run] of
+  fTokenPos := Run;
+   case fLine[Run] of
     #0: NullProc;
     #10: LFProc;
     #13: CRProc;
@@ -3356,12 +3350,12 @@ procedure TSynDmlSyn.Next;
 function TSynDmlSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -3369,31 +3363,31 @@ function TSynDmlSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribut
 
 function TSynDmlSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynDmlSyn.GetTokenID: TtkTokenKind;
 begin
-  Result:= FTokenID;
+  Result:= fTokenId;
 end;
 
 function TSynDmlSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
   case GetTokenID of
-    tkForm: Result := FFormAttri;
-    tkBlock: Result := FBlockAttri;
-    tkKey: Result := FKeyAttri;
-    tkComment: Result := FCommentAttri;
-    tkQualifier: Result := FQualiAttri;
-    tkFunction: Result := FFunctionAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpecial: Result := FSpecialAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkVariable: Result := FVariableAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkUnknown: Result := FSymbolAttri;
+    tkForm: Result := fFormAttri;
+    tkBlock: Result := fBlockAttri;
+    tkKey: Result := fKeyAttri;
+    tkComment: Result := fCommentAttri;
+    tkQualifier: Result := fQualiAttri;
+    tkFunction: Result := fFunctionAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpecial: Result := fSpecialAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkVariable: Result := fVariableAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkUnknown: Result := fSymbolAttri;
     else Result := nil;
   end;
 end;
@@ -3405,22 +3399,22 @@ function TSynDmlSyn.GetTokenKind: Integer;
 
 function TSynDmlSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 procedure TSynDmlSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 procedure TSynDmlSyn.ResetRange;
 begin
-  FRange:= rsUnknown;
+  fRange:= rsUnknown;
 end;
 
 function TSynDmlSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterGembase;
+  Result := fDefaultFilter <> SYNS_FilterGembase;
 end;
 
 class function TSynDmlSyn.GetLanguageName: string;
@@ -3428,13 +3422,11 @@ class function TSynDmlSyn.GetLanguageName: string;
   Result := SYNS_LangGembase;
 end;
 
-class function TSynDmlSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynDmlSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangGembase;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynDmlSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterECMAScript.pas b/Ext/SynEdit/Source/SynHighlighterECMAScript.pas
deleted file mode 100644
index 34cad81..0000000
--- a/Ext/SynEdit/Source/SynHighlighterECMAScript.pas
+++ /dev/null
@@ -1,889 +0,0 @@
-{-------------------------------------------------------------------------------
-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.
-
-Code template generated with SynGen.
-The original code is: C:\Users\Public\Code\SynEdit\SynGen\Test ECMAScript\SynHighlighterECMAScript.pas, released 2020-06-21.
-Description: ECMA Script Syntax Highlighter
-The initial author of this file is Christian-W. Budde.
-Copyright (c) 2020, all rights reserved.
-
-Contributors to the SynEdit and mwEdit projects are listed in the
-Contributors.txt file.
-
-Alternatively, the contents of this file may be used under the terms of the
-GNU General Public License Version 2 or later (the "GPL"), in which case
-the provisions of the GPL are applicable instead of those above.
-If you wish to allow use of your version of this file only under the terms
-of the GPL and not to allow others to use your version of this file
-under the MPL, indicate your decision by deleting the provisions above and
-replace them with the notice and other provisions required by the GPL.
-If you do not delete the provisions above, a recipient may use your version
-of this file under either the MPL or the GPL.
-
-$Id: $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
--------------------------------------------------------------------------------}
-
-unit SynHighlighterECMAScript;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (
-    tkComment,
-    tkIdentifier,
-    tkKey,
-    tkReserved,
-    tkStrict,
-    tkNull,
-    tkNumber,
-    tkSpace,
-    tkString,
-    tkSymbol,
-    tkUnknown);
-
-  TRangeState = (rsUnknown, rsMultiLineComment, rsSingleLineComment,
-    rsDoubleQuotedString, rsSingleQuotedString);
-
-  TProcTableProc = procedure of object;
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-type
-  TSynECMAScriptSyn = class(TSynCustomHighlighter)
-  private
-    FRange: TRangeState;
-    FTokenId: TtkTokenKind;
-    FIdentFuncTable: array[0..108] of TIdentFuncTableFunc;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function FuncKeyWord(Index: Integer): TtkTokenKind;
-    function FuncReservedWord(Index: Integer): TtkTokenKind;
-    function FuncStrictMode(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure AndSymbolProc;
-    procedure BackslashProc;
-    procedure CRProc;
-    procedure CoalesceProc;
-    procedure EqualsProc;
-    procedure GreaterProc;
-    procedure Hex4DigitProc;
-    procedure InitIdent;
-    procedure IdentProc;
-    procedure LessProc;
-    procedure LFProc;
-    procedure MinusProc;
-    procedure ModSymbolProc;
-    procedure MultiLineCommentProc;
-    procedure NotProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure OrSymbolProc;
-    procedure PlusProc;
-    procedure DotProc;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure StarProc;
-    procedure StringProc;
-    procedure SymbolProc;
-    procedure UnknownProc;
-    procedure XorSymbolProc;
-  protected
-    function GetSampleSource: UnicodeString; override;
-    function IsFilterStored: Boolean; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
-    class function GetLanguageName: string; override;
-    function GetRange: Pointer; override;
-    procedure ResetRange; override;
-    procedure SetRange(Value: Pointer); override;
-    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override;
-    function GetEol: Boolean; override;
-    function GetKeyWords(TokenKind: Integer): UnicodeString; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: Integer; override;
-    function IsIdentChar(AChar: WideChar): Boolean; override;
-    procedure Next; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-resourcestring
-  SYNS_FilterECMAScript = 'JavaScript files (*.js)|*.js';
-  SYNS_LangECMAScript = 'ECMA Script';
-  SYNS_FriendlyLangECMAScript = 'ECMA Script';
-
-const
-  // as this language is case-insensitive keywords *must* be in lowercase
-  KeyWords: array[0..52] of UnicodeString = (
-    'as', 'async', 'await', 'break', 'case', 'catch', 'class', 'const',
-    'continue', 'debugger', 'default', 'delete', 'do', 'else', 'enum', 'export',
-    'extends', 'false', 'finally', 'for', 'from', 'function', 'get', 'if',
-    'implements', 'import', 'in', 'instance', 'interface', 'let', 'new', 'null',
-    'of', 'package', 'private', 'protected', 'public', 'return', 'set',
-    'static', 'super', 'switch', 'target', 'this', 'throw', 'true', 'try',
-    'typeof', 'var', 'void', 'while', 'with', 'yield'
-  );
-
-  KeyIndices: array[0..108] of Integer = (
-    -1, 25, -1, 42, -1, 52, 48, 10, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1,
-    4, 46, -1, 5, 30, -1, -1, 27, 20, -1, -1, 32, 51, -1, 38, 13, -1, 28, 12,
-    -1, -1, 19, 41, -1, 3, -1, -1, -1, 9, 6, -1, 24, 34, -1, -1, 36, 16, 49, -1,
-    22, 17, -1, -1, 35, -1, 21, 0, -1, -1, -1, -1, 50, 11, -1, 40, 18, -1, 7,
-    -1, -1, 39, 44, -1, -1, 47, 31, 43, 26, -1, -1, -1, -1, 33, 23, 29, 14, -1,
-    45, 37, -1, 8, -1, -1, -1, -1, -1, -1, 1, -1, 15
-  );
-
-constructor TSynECMAScriptSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-  FCaseSensitive := False;
-
-  FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  FCommentAttri.Foreground := clNavy;
-  AddAttribute(FCommentAttri);
-
-  FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-
-  FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
-
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-
-  FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-
-  FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
-
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  FDefaultFilter := SYNS_FilterECMAScript;
-  FRange := rsUnknown;
-end;
-
-procedure TSynECMAScriptSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
-
-  FIdentFuncTable[12] := FuncReservedWord;
-  FIdentFuncTable[65] := FuncKeyWord;
-  FIdentFuncTable[106] := FuncKeyWord;
-  FIdentFuncTable[43] := FuncReservedWord;
-  FIdentFuncTable[19] := FuncReservedWord;
-  FIdentFuncTable[22] := FuncReservedWord;
-  FIdentFuncTable[48] := FuncReservedWord;
-  FIdentFuncTable[76] := FuncReservedWord;
-  FIdentFuncTable[99] := FuncReservedWord;
-  FIdentFuncTable[47] := FuncReservedWord;
-  FIdentFuncTable[7] := FuncReservedWord;
-  FIdentFuncTable[71] := FuncReservedWord;
-  FIdentFuncTable[37] := FuncReservedWord;
-  FIdentFuncTable[34] := FuncReservedWord;
-  FIdentFuncTable[94] := FuncReservedWord;
-  FIdentFuncTable[108] := FuncReservedWord;
-  FIdentFuncTable[55] := FuncReservedWord;
-  FIdentFuncTable[59] := FuncReservedWord;
-  FIdentFuncTable[74] := FuncReservedWord;
-  FIdentFuncTable[40] := FuncReservedWord;
-  FIdentFuncTable[27] := FuncKeyWord;
-  FIdentFuncTable[64] := FuncReservedWord;
-  FIdentFuncTable[58] := FuncKeyWord;
-  FIdentFuncTable[92] := FuncReservedWord;
-  FIdentFuncTable[50] := FuncStrictMode;
-  FIdentFuncTable[1] := FuncReservedWord;
-  FIdentFuncTable[86] := FuncReservedWord;
-  FIdentFuncTable[26] := FuncReservedWord;
-  FIdentFuncTable[36] := FuncStrictMode;
-  FIdentFuncTable[93] := FuncStrictMode;
-  FIdentFuncTable[23] := FuncReservedWord;
-  FIdentFuncTable[84] := FuncReservedWord;
-  FIdentFuncTable[30] := FuncKeyWord;
-  FIdentFuncTable[91] := FuncStrictMode;
-  FIdentFuncTable[51] := FuncStrictMode;
-  FIdentFuncTable[62] := FuncStrictMode;
-  FIdentFuncTable[54] := FuncStrictMode;
-  FIdentFuncTable[97] := FuncReservedWord;
-  FIdentFuncTable[33] := FuncKeyWord;
-  FIdentFuncTable[79] := FuncStrictMode;
-  FIdentFuncTable[73] := FuncReservedWord;
-  FIdentFuncTable[41] := FuncReservedWord;
-  FIdentFuncTable[3] := FuncKeyWord;
-  FIdentFuncTable[85] := FuncReservedWord;
-  FIdentFuncTable[80] := FuncReservedWord;
-  FIdentFuncTable[96] := FuncReservedWord;
-  FIdentFuncTable[20] := FuncReservedWord;
-  FIdentFuncTable[83] := FuncReservedWord;
-  FIdentFuncTable[6] := FuncReservedWord;
-  FIdentFuncTable[56] := FuncReservedWord;
-  FIdentFuncTable[70] := FuncReservedWord;
-  FIdentFuncTable[31] := FuncReservedWord;
-  FIdentFuncTable[5] := FuncReservedWord;
-end;
-
-{$Q-}
-function TSynECMAScriptSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 474 + Ord(Str^) * 408;
-    Inc(Str);
-  end;
-  Result := Result mod 109;
-  FStringLen := Str - FToIdent;
-end;
-{$Q+}
-
-function TSynECMAScriptSyn.FuncReservedWord(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkReserved
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynECMAScriptSyn.FuncStrictMode(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkStrict
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynECMAScriptSyn.FuncKeyWord(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynECMAScriptSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-procedure TSynECMAScriptSyn.AndSymbolProc;
-begin
-  FTokenID := tkSymbol;
-  Inc(Run);
-  if CharInSet(FLine[Run], ['=', '&']) then
-    Inc(Run);
-end;
-
-function TSynECMAScriptSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
-var
-  Key: Cardinal;
-begin
-  FToIdent := MayBe;
-  Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
-  else
-    Result := tkIdentifier;
-end;
-
-procedure TSynECMAScriptSyn.SpaceProc;
-begin
-  Inc(Run);
-  FTokenId := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do
-    Inc(Run);
-end;
-
-procedure TSynECMAScriptSyn.CoalesceProc;
-begin
-  FTokenID := tkSymbol;
-  Inc(Run);
-  if FLine[Run] = '?' then
-    Inc(Run);
-end;
-
-procedure TSynECMAScriptSyn.NotProc;
-begin
-  FTokenID := tkSymbol;
-  Inc(Run);
-  if FLine[Run] = '=' then
-  begin
-    Inc(Run);
-    if FLine[Run] = '=' then
-      Inc(Run);
-  end;
-end;
-
-procedure TSynECMAScriptSyn.NullProc;
-begin
-  FTokenId := tkNull;
-  Inc(Run);
-end;
-
-procedure TSynECMAScriptSyn.CRProc;
-begin
-  FTokenId := tkSpace;
-  Inc(Run);
-  if FLine[Run] = #10 then
-    Inc(Run);
-end;
-
-procedure TSynECMAScriptSyn.LFProc;
-begin
-  FTokenId := tkSpace;
-  Inc(Run);
-end;
-
-procedure TSynECMAScriptSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case FLine[Run] of
-      '0'..'9', '.', 'a'..'f', 'A'..'F', 'x', 'X':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-  function IsHexChar(Run: Integer): Boolean;
-  begin
-    case FLine[Run] of
-      '0'..'9', 'a'..'f', 'A'..'F':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-var
-  idx1: Integer; // token[1]
-  isHex: Boolean;
-begin
-  FTokenID := tkNumber;
-  isHex := False;
-  idx1 := Run;
-  Inc(Run);
-  while IsNumberChar do
-  begin
-    case FLine[Run] of
-      '.':
-        if FLine[Succ(Run)] = '.' then
-          Break;
-      'a'..'f', 'A'..'F':
-        if not isHex then
-          Break;
-      'x', 'X':
-        begin
-          if (FLine[idx1] <> '0') or (Run > Succ(idx1)) then
-            Break;
-          if not IsHexChar(Succ(Run)) then
-            Break;
-          isHex := True;
-        end;
-    end;
-    Inc(Run);
-  end;
-end;
-
-procedure TSynECMAScriptSyn.OrSymbolProc;
-begin
-  FTokenID := tkSymbol;
-  Inc(Run);
-  if CharInSet(FLine[Run], ['=', '|']) then Inc(Run);
-end;
-
-procedure TSynECMAScriptSyn.EqualsProc;
-begin
-  FTokenID := tkSymbol;
-  Inc(Run);
-  case FLine[Run] of
-    '=':
-      begin
-        Inc(Run);
-        if FLine[Run] = '=' then
-          Inc(Run);
-      end;
-    '>':
-      Inc(Run);
-  end;
-end;
-
-procedure TSynECMAScriptSyn.GreaterProc;
-begin
-  FTokenID := tkSymbol;
-  Inc(Run);
-  case FLine[Run] of
-    '=':
-      Inc(Run);
-    '>':
-      begin
-        Inc(Run);
-        case FLine[Run] of
-          '=':
-            Inc(Run);
-          '>':
-            begin
-              Inc(Run);
-              if FLine[Run] = '=' then
-                Inc(Run);
-            end;
-        end;
-      end;
-  end;
-end;
-
-procedure TSynECMAScriptSyn.LessProc;
-begin
-  FTokenID := tkSymbol;
-  Inc(Run);
-  case FLine[Run] of
-    '=':
-      Inc(Run);
-    '<':
-      begin
-        Inc(Run);
-        if FLine[Run] = '=' then
-          Inc(Run);
-      end;
-  end;
-end;
-
-procedure TSynECMAScriptSyn.PlusProc;
-begin
-  FTokenID := tkSymbol;
-  Inc(Run);
-  if CharInSet(FLine[Run], ['=', '+']) then
-    Inc(Run);
-end;
-
-procedure TSynECMAScriptSyn.DotProc;
-begin
-  FTokenID := tkSymbol;
-  Inc(Run);
-  if (FLine[Run] = '.') and (FLine[Run + 1] = '.') then Inc(Run, 2);
-end;
-
-procedure TSynECMAScriptSyn.SlashProc;
-begin
-  Inc(Run);
-  case FLine[Run] of
-    '/':
-      begin
-        FTokenId := tkComment;
-        FRange := rsSingleLineComment;
-        repeat
-          Inc(Run);
-        until IsLineEnd(Run);
-        FTokenId := tkComment;
-      end;
-    '*':
-      begin
-        Inc(Run, 1);
-        FRange := rsMultiLineComment;
-        FTokenId := tkComment;
-        repeat
-          Inc(Run);
-           if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then
-           begin
-             FRange := rsUnknown;
-             Inc(Run, 2);
-             Break;
-           end;
-         until IsLineEnd(Run);
-      end;
-    '=':
-      begin
-        Inc(Run);
-        FTokenID := tkSymbol;
-      end;
-  end;
-end;
-
-procedure TSynECMAScriptSyn.MultiLineCommentProc;
-begin
-  case FLine[Run] of
-     #0: NullProc;
-    #10: LFProc;
-    #13: CRProc;
-  else
-    begin
-      FTokenId := tkComment;
-      repeat
-        if (FLine[Run] = '*') and
-           (FLine[Run + 1] = '/') then
-        begin
-          Inc(Run, 2);
-          FRange := rsUnknown;
-          Break;
-        end;
-        if not IsLineEnd(Run) then
-          Inc(Run);
-      until IsLineEnd(Run);
-    end;
-  end;
-end;
-
-procedure TSynECMAScriptSyn.StarProc;
-begin
-  FTokenID := tkSymbol;
-  Inc(Run);
-  case FLine[Run] of
-    '=':
-      Inc(Run);
-    '*':
-      begin
-        Inc(Run);
-        if FLine[Run] = '=' then
-          Inc(Run);
-      end;
-  end;
-end;
-
-procedure TSynECMAScriptSyn.StringProc;
-var
-  QuoteChar: UnicodeString;
-begin
-  FTokenID := tkString;
-  QuoteChar := FLine[Run];   // We could have '"' or #39
-  if (FLine[Run + 1] = QuoteChar) and (FLine[Run + 2] = QuoteChar) then Inc(Run, 2);
-  repeat
-    if IsLineEnd(Run) then
-      Break;
-    Inc(Run);
-  until (FLine[Run] = QuoteChar) and (FLine[Pred(Run)] <> '\');
-  if not IsLineEnd(Run) then
-    Inc(Run);
-end;
-
-procedure TSynECMAScriptSyn.IdentProc;
-begin
-  FTokenID := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do
-    Inc(Run);
-end;
-
-procedure TSynECMAScriptSyn.Hex4DigitProc;
-var
-  i: Integer;
-
-  function IsHexDigit(AChar: WideChar): Boolean;
-  begin
-    case FLine[Run] of
-      '0'..'9', 'a'..'f', 'A'..'F':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  for i := 0 to 3 do
-  begin
-    if not IsHexDigit(FLine[Run]) then
-    begin
-      FTokenId := tkUnknown;
-      Exit;
-    end;
-    Inc(Run);
-  end;
-end;
-
-procedure TSynECMAScriptSyn.BackslashProc;
-begin
-  Inc(Run);
-  if FLine[Run] = 'u' then
-  begin
-    Inc(Run);
-    Hex4DigitProc;
-  end
-  else
-    FTokenId := tkUnknown;
-end;
-
-procedure TSynECMAScriptSyn.MinusProc;
-begin
-  FTokenID := tkSymbol;
-  Inc(Run);
-  if CharInSet(FLine[Run], ['=', '-', '>']) then Inc(Run);
-end;
-
-procedure TSynECMAScriptSyn.ModSymbolProc;
-begin
-  FTokenID := tkSymbol;
-  Inc(Run);
-  if FLine[Run] = '=' then Inc(Run);
-end;
-
-procedure TSynECMAScriptSyn.SymbolProc;
-begin
-  Inc(Run);
-  FTokenID := tkSymbol;
-end;
-
-procedure TSynECMAScriptSyn.UnknownProc;
-begin
-  Inc(Run);
-  FTokenId := tkUnknown;
-end;
-
-procedure TSynECMAScriptSyn.XorSymbolProc;
-begin
-  FTokenID := tkSymbol;
-  Inc(Run);
-  if FLine[Run] = '=' then
-    Inc(Run);
-end;
-
-procedure TSynECMAScriptSyn.Next;
-begin
-  FTokenPos := Run;
-  case FRange of
-    rsMultiLineComment: MultiLineCommentProc;
-  else
-    case FLine[Run] of
-      #0:
-        NullProc;
-      #10:
-        LFProc;
-      #13:
-        CRProc;
-      #1..#9, #11, #12, #14..#32:
-        SpaceProc;
-      '"', #39:
-        StringProc;
-      '%':
-        ModSymbolProc;
-      '&':
-        AndSymbolProc;
-      '.':
-        DotProc;
-      '/':
-        SlashProc;
-      '-':
-        MinusProc;
-      '\':
-        BackslashProc;
-      '|':
-        OrSymbolProc;
-      '(', ')':
-        SymbolProc;
-      '*':
-        StarProc;
-      '+':
-        PlusProc;
-      '=':
-        EqualsProc;
-      '>':
-        GreaterProc;
-      '<':
-        LessProc;
-      '!':
-        NotProc;
-      '?':
-        CoalesceProc;
-      '^':
-        XorSymbolProc;
-      '~', ',', '[', ']', ':', ';', '{', '}':
-        SymbolProc;
-      '0'..'9':
-        NumberProc;
-      'A'..'Z', 'a'..'z', '_', '$', #$AA, #$B5, #$BA, #$C0..#$D6, #$D8..#$F6,
-      #$0F8..#$2C1:
-        IdentProc;
-    else
-      UnknownProc;
-    end;
-  end;
-  inherited;
-end;
-
-function TSynECMAScriptSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes;
-begin
-  case Index of
-    SYN_ATTR_COMMENT:
-      Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER:
-      Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD:
-      Result := FKeyAttri;
-    SYN_ATTR_STRING:
-      Result := FStringAttri;
-    SYN_ATTR_WHITESPACE:
-      Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL:
-      Result := FSymbolAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynECMAScriptSyn.GetEol: Boolean;
-begin
-  Result := Run = FLineLen + 1;
-end;
-
-function TSynECMAScriptSyn.GetKeyWords(TokenKind: Integer): UnicodeString;
-begin
-  Result :=
-    'as,async,await,break,case,catch,class,const,continue,debugger,default,' +
-    'delete,do,else,enum,export,extends,false,finally,for,from,function,' +
-    'get,if,implements,import,in,instance,interface,let,new,null,of,package,' +
-    'private,protected,public,return,set,static,super,switch,target,this,' +
-    'throw,true,try,typeof,var,void,while,with,yield';
-end;
-
-function TSynECMAScriptSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := FTokenId;
-end;
-
-function TSynECMAScriptSyn.GetTokenAttribute: TSynHighLighterAttributes;
-begin
-  case GetTokenID of
-    tkComment:
-      Result := FCommentAttri;
-    tkIdentifier:
-      Result := FIdentifierAttri;
-    tkKey:
-      Result := FKeyAttri;
-    tkReserved:
-      Result := FKeyAttri;
-    tkNumber:
-      Result := FNumberAttri;
-    tkStrict:
-      Result := FKeyAttri;
-    tkSpace:
-      Result := FSpaceAttri;
-    tkString:
-      Result := FStringAttri;
-    tkSymbol:
-      Result := FSymbolAttri;
-    tkUnknown:
-      Result := FIdentifierAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynECMAScriptSyn.GetTokenKind: Integer;
-begin
-  Result := Ord(FTokenId);
-end;
-
-function TSynECMAScriptSyn.IsIdentChar(AChar: WideChar): Boolean;
-begin
-  case AChar of
-    'A'..'Z', 'a'..'z', '_', '$', #$AA, #$B5, #$BA, #$C0..#$D6, #$D8..#$F6,
-    #$0F8..#$2C1:
-      Result := True;
-    else
-      Result := False;
-  end;
-end;
-
-function TSynECMAScriptSyn.GetSampleSource: UnicodeString;
-begin
-  Result :=
-    '// Syntax highlighting'#13#10 +
-    'function printNumber()'#13#10 +
-    '{'#13#10 +
-    '  var number = 1234;'#13#10 +
-    '  var x;'#13#10 +
-    '  document.write("The number is " + number);'#13#10 +
-    '  for (var i = 0; i <= number; i++)'#13#10 +
-    '  {'#13#10 +
-    '    x++;'#13#10 +
-    '    x--;'#13#10 +
-    '    x += 1.0;'#13#10 +
-    '  }'#13#10 +
-    '  i += @; // illegal character'#13#10 +
-    '}'#13#10 +
-    'body.onLoad = printNumber;';
-end;
-
-function TSynECMAScriptSyn.IsFilterStored: Boolean;
-begin
-  Result := FDefaultFilter <> SYNS_FilterECMAScript;
-end;
-
-class function TSynECMAScriptSyn.GetFriendlyLanguageName: UnicodeString;
-begin
-  Result := SYNS_FriendlyLangECMAScript;
-end;
-
-class function TSynECMAScriptSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangECMAScript;
-end;
-
-procedure TSynECMAScriptSyn.ResetRange;
-begin
-  FRange := rsUnknown;
-end;
-
-procedure TSynECMAScriptSyn.SetRange(Value: Pointer);
-begin
-  FRange := TRangeState(Value);
-end;
-
-function TSynECMAScriptSyn.GetRange: Pointer;
-begin
-  Result := Pointer(FRange);
-end;
-
-initialization
-  RegisterPlaceableHighlighter(TSynECMAScriptSyn);
-
-end.
diff --git a/Ext/SynEdit/Source/SynHighlighterEiffel.pas b/Ext/SynEdit/Source/SynHighlighterEiffel.pas
index 9a31789..fee4e0b 100644
--- a/Ext/SynEdit/Source/SynHighlighterEiffel.pas
+++ b/Ext/SynEdit/Source/SynHighlighterEiffel.pas
@@ -27,12 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterEiffel.pas,v 1.3.2.8 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides an Eiffel highlighter for SynEdit)
@@ -71,7 +65,7 @@ interface
     tkString,
     tkUnknown);
 
-  TRangeState = (rsUnknown, rsEiffelComment, rsString, rsOperatorAndSymbolProc);
+  TRangeState = (rsUnKnown, rsEiffelComment, rsString, rsOperatorAndSymbolProc);
 
   PIdentFuncTableFunc = ^TIdentFuncTableFunc;
   TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
@@ -79,19 +73,19 @@ interface
 type
   TSynEiffelSyn = class(TSynCustomHighlighter)
   private
-    FRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    FIdentFuncTable: array[0..502] of TIdentFuncTableFunc;
-    FBasicTypesAttri: TSynHighlighterAttributes;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FLaceAttri: TSynHighlighterAttributes;
-    FOperatorAndSymbolsAttri: TSynHighlighterAttributes;
-    FPredefinedAttri: TSynHighlighterAttributes;
-    FResultValueAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
+    fRange: TRangeState;
+    fTokenID: TtkTokenKind;
+    fIdentFuncTable: array[0..502] of TIdentFuncTableFunc;
+    fBasicTypesAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fLaceAttri: TSynHighlighterAttributes;
+    fOperatorAndSymbolsAttri: TSynHighlighterAttributes;
+    fPredefinedAttri: TSynHighlighterAttributes;
+    fResultValueAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
     function AltFunc(Index: Integer): TtkTokenKind;
     function OperatorFunc(Index: Integer): TtkTokenKind;
     function Func37u(Index: Integer): TtkTokenKind;
@@ -202,34 +196,34 @@   TSynEiffelSyn = class(TSynCustomHighlighter)
     procedure StringOpenProc;
     procedure StringProc;
   protected
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     function IsFilterStored: Boolean; override;
   public
     constructor Create(AOwner: TComponent); override;
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
     function GetRange: Pointer; override;
     procedure ResetRange; override;
     procedure SetRange(Value: Pointer); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override;
     function GetEol: Boolean; override;
-    function GetKeyWords(TokenKind: Integer): UnicodeString; override;
+    function GetKeyWords(TokenKind: Integer): string; override;
     function GetTokenID: TtkTokenKind;
     function GetTokenAttribute: TSynHighlighterAttributes; override;
     function GetTokenKind: Integer; override;
     procedure Next; override;
     function IsOperatorChar(AChar: WideChar): Boolean;
   published
-    property BasicTypesAttri: TSynHighlighterAttributes read FBasicTypesAttri write FBasicTypesAttri;
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property LaceAttri: TSynHighlighterAttributes read FLaceAttri write FLaceAttri;
-    property OperatorAndSymbolsAttri: TSynHighlighterAttributes read FOperatorAndSymbolsAttri write FOperatorAndSymbolsAttri;
-    property PredefinedAttri: TSynHighlighterAttributes read FPredefinedAttri write FPredefinedAttri;
-    property ResultValueAttri: TSynHighlighterAttributes read FResultValueAttri write FResultValueAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri;
+    property BasicTypesAttri: TSynHighlighterAttributes read fBasicTypesAttri write fBasicTypesAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property LaceAttri: TSynHighlighterAttributes read fLaceAttri write fLaceAttri;
+    property OperatorAndSymbolsAttri: TSynHighlighterAttributes read fOperatorAndSymbolsAttri write fOperatorAndSymbolsAttri;
+    property PredefinedAttri: TSynHighlighterAttributes read fPredefinedAttri write fPredefinedAttri;
+    property ResultValueAttri: TSynHighlighterAttributes read fResultValueAttri write fResultValueAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri;
   end;
 
 implementation
@@ -238,7 +232,7 @@ implementation
   SynEditStrConst;
 
 const
-  KeyWords: array[0..118] of UnicodeString = (
+  KeyWords: array[0..118] of string = (
     '-', '!', '#', '$', '%u', '&', '(', ')', '*', '.', '/', '//', '/=', ':', 
     ':=', ';', '@', '[', '\\', ']', '^', '|', '+', '<', '<>', '=', '>', 'adapt', 
     'alias', 'all', 'and', 'array', 'as', 'assertion', 'bit', 'boolean', 
@@ -296,7 +290,7 @@ function TSynEiffelSyn.HashKey(Str: PWideChar): Cardinal;
     Inc(Str);
   end;
   Result := Result mod 503;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -304,10 +298,10 @@ function TSynEiffelSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
@@ -316,129 +310,129 @@ procedure TSynEiffelSyn.InitIdent;
 var
   i: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
     if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
-
-  FIdentFuncTable[34] := OperatorFunc;
-  FIdentFuncTable[92] := OperatorFunc;
-  FIdentFuncTable[250] := OperatorFunc;
-  FIdentFuncTable[329] := OperatorFunc;
-  FIdentFuncTable[413] := Func37u;
-  FIdentFuncTable[487] := OperatorFunc;
-  FIdentFuncTable[142] := OperatorFunc;
-  FIdentFuncTable[221] := OperatorFunc;
-  FIdentFuncTable[300] := OperatorFunc;
-  FIdentFuncTable[113] := OperatorFunc;
-  FIdentFuncTable[192] := OperatorFunc;
-  FIdentFuncTable[327] := OperatorFunc;
-  FIdentFuncTable[427] := OperatorFunc;
-  FIdentFuncTable[55] := OperatorFunc;
-  FIdentFuncTable[480] := OperatorFunc;
-  FIdentFuncTable[134] := OperatorFunc;
-  FIdentFuncTable[26] := OperatorFunc;
-  FIdentFuncTable[147] := OperatorFunc;
-  FIdentFuncTable[212] := OperatorFunc;
-  FIdentFuncTable[305] := OperatorFunc;
-  FIdentFuncTable[384] := OperatorFunc;
-  FIdentFuncTable[239] := OperatorFunc;
-  FIdentFuncTable[379] := OperatorFunc;
-  FIdentFuncTable[213] := OperatorFunc;
-  FIdentFuncTable[340] := OperatorFunc;
-  FIdentFuncTable[292] := OperatorFunc;
-  FIdentFuncTable[371] := OperatorFunc;
-  FIdentFuncTable[261] := FuncAdapt;
-  FIdentFuncTable[462] := FuncAlias;
-  FIdentFuncTable[402] := FuncAll;
-  FIdentFuncTable[54] := FuncAnd;
-  FIdentFuncTable[105] := FuncArray;
-  FIdentFuncTable[224] := FuncAs;
-  FIdentFuncTable[266] := FuncAssertion;
-  FIdentFuncTable[252] := FuncBit;
-  FIdentFuncTable[217] := FuncBoolean;
-  FIdentFuncTable[380] := FuncCharacter;
-  FIdentFuncTable[14] := FuncCheck;
-  FIdentFuncTable[432] := FuncClass;
-  FIdentFuncTable[420] := FuncCluster;
-  FIdentFuncTable[417] := FuncColon;
-  FIdentFuncTable[259] := FuncComma;
-  FIdentFuncTable[387] := FuncCreation;
-  FIdentFuncTable[311] := FuncCurrent;
-  FIdentFuncTable[268] := FuncDebug;
-  FIdentFuncTable[425] := FuncDefault;
-  FIdentFuncTable[301] := FuncDeferred;
-  FIdentFuncTable[334] := FuncDo;
-  FIdentFuncTable[463] := FuncDouble;
-  FIdentFuncTable[1] := FuncElse;
-  FIdentFuncTable[270] := FuncElseif;
-  FIdentFuncTable[139] := FuncEnd;
-  FIdentFuncTable[399] := FuncEnsure;
-  FIdentFuncTable[320] := FuncExclude;
-  FIdentFuncTable[368] := FuncExecutable;
-  FIdentFuncTable[150] := FuncExpanded;
-  FIdentFuncTable[167] := FuncExport;
-  FIdentFuncTable[474] := FuncExternal;
-  FIdentFuncTable[85] := FuncFalse;
-  FIdentFuncTable[174] := FuncFeature;
-  FIdentFuncTable[411] := FuncFrom;
-  FIdentFuncTable[63] := FuncFrozen;
-  FIdentFuncTable[172] := FuncGenerate;
-  FIdentFuncTable[17] := FuncIdentifier;
-  FIdentFuncTable[333] := FuncIf;
-  FIdentFuncTable[211] := FuncIgnore;
-  FIdentFuncTable[37] := FuncImplies;
-  FIdentFuncTable[331] := FuncInclude;
-  FIdentFuncTable[120] := FuncInclude95path;
-  FIdentFuncTable[6] := FuncIndexing;
-  FIdentFuncTable[496] := FuncInfix;
-  FIdentFuncTable[324] := FuncInherit;
-  FIdentFuncTable[431] := FuncInspect;
-  FIdentFuncTable[397] := FuncInteger;
-  FIdentFuncTable[382] := FuncInvariant;
-  FIdentFuncTable[354] := FuncIs;
-  FIdentFuncTable[71] := FuncLike;
-  FIdentFuncTable[160] := FuncLocal;
-  FIdentFuncTable[378] := FuncLoop;
-  FIdentFuncTable[181] := FuncMake;
-  FIdentFuncTable[245] := FuncNo;
-  FIdentFuncTable[353] := FuncNot;
-  FIdentFuncTable[25] := FuncObject;
-  FIdentFuncTable[191] := FuncObsolete;
-  FIdentFuncTable[319] := FuncOld;
-  FIdentFuncTable[7] := FuncOnce;
-  FIdentFuncTable[32] := FuncOptimize;
-  FIdentFuncTable[306] := FuncOption;
-  FIdentFuncTable[121] := FuncOr;
-  FIdentFuncTable[498] := FuncPointer;
-  FIdentFuncTable[240] := FuncPrecompiled;
-  FIdentFuncTable[42] := FuncPrecursor;
-  FIdentFuncTable[19] := FuncPrefix;
-  FIdentFuncTable[296] := FuncReal;
-  FIdentFuncTable[414] := FuncRedefine;
-  FIdentFuncTable[193] := FuncRename;
-  FIdentFuncTable[144] := FuncRequire;
-  FIdentFuncTable[5] := FuncRescue;
-  FIdentFuncTable[43] := FuncResult;
-  FIdentFuncTable[389] := FuncRetry;
-  FIdentFuncTable[362] := FuncRoot;
-  FIdentFuncTable[469] := FuncSelect;
-  FIdentFuncTable[302] := FuncSeparate;
-  FIdentFuncTable[242] := FuncString;
-  FIdentFuncTable[282] := FuncStrip;
-  FIdentFuncTable[135] := FuncSystem;
-  FIdentFuncTable[11] := FuncThen;
-  FIdentFuncTable[330] := FuncTrace;
-  FIdentFuncTable[24] := FuncTrue;
-  FIdentFuncTable[452] := FuncUndefine;
-  FIdentFuncTable[90] := FuncUnique;
-  FIdentFuncTable[501] := FuncUntil;
-  FIdentFuncTable[262] := FuncUse;
-  FIdentFuncTable[195] := FuncVariant;
-  FIdentFuncTable[344] := FuncVisible;
-  FIdentFuncTable[372] := FuncVoid;
-  FIdentFuncTable[348] := FuncWhen;
-  FIdentFuncTable[156] := FuncXor;
-  FIdentFuncTable[471] := FuncYes;
+      fIdentFuncTable[i] := AltFunc;
+
+  fIdentFuncTable[34] := OperatorFunc;
+  fIdentFuncTable[92] := OperatorFunc;
+  fIdentFuncTable[250] := OperatorFunc;
+  fIdentFuncTable[329] := OperatorFunc;
+  fIdentFuncTable[413] := Func37u;
+  fIdentFuncTable[487] := OperatorFunc;
+  fIdentFuncTable[142] := OperatorFunc;
+  fIdentFuncTable[221] := OperatorFunc;
+  fIdentFuncTable[300] := OperatorFunc;
+  fIdentFuncTable[113] := OperatorFunc;
+  fIdentFuncTable[192] := OperatorFunc;
+  fIdentFuncTable[327] := OperatorFunc;
+  fIdentFuncTable[427] := OperatorFunc;
+  fIdentFuncTable[55] := OperatorFunc;
+  fIdentFuncTable[480] := OperatorFunc;
+  fIdentFuncTable[134] := OperatorFunc;
+  fIdentFuncTable[26] := OperatorFunc;
+  fIdentFuncTable[147] := OperatorFunc;
+  fIdentFuncTable[212] := OperatorFunc;
+  fIdentFuncTable[305] := OperatorFunc;
+  fIdentFuncTable[384] := OperatorFunc;
+  fIdentFuncTable[239] := OperatorFunc;
+  fIdentFuncTable[379] := OperatorFunc;
+  fIdentFuncTable[213] := OperatorFunc;
+  fIdentFuncTable[340] := OperatorFunc;
+  fIdentFuncTable[292] := OperatorFunc;
+  fIdentFuncTable[371] := OperatorFunc;
+  fIdentFuncTable[261] := FuncAdapt;
+  fIdentFuncTable[462] := FuncAlias;
+  fIdentFuncTable[402] := FuncAll;
+  fIdentFuncTable[54] := FuncAnd;
+  fIdentFuncTable[105] := FuncArray;
+  fIdentFuncTable[224] := FuncAs;
+  fIdentFuncTable[266] := FuncAssertion;
+  fIdentFuncTable[252] := FuncBit;
+  fIdentFuncTable[217] := FuncBoolean;
+  fIdentFuncTable[380] := FuncCharacter;
+  fIdentFuncTable[14] := FuncCheck;
+  fIdentFuncTable[432] := FuncClass;
+  fIdentFuncTable[420] := FuncCluster;
+  fIdentFuncTable[417] := FuncColon;
+  fIdentFuncTable[259] := FuncComma;
+  fIdentFuncTable[387] := FuncCreation;
+  fIdentFuncTable[311] := FuncCurrent;
+  fIdentFuncTable[268] := FuncDebug;
+  fIdentFuncTable[425] := FuncDefault;
+  fIdentFuncTable[301] := FuncDeferred;
+  fIdentFuncTable[334] := FuncDo;
+  fIdentFuncTable[463] := FuncDouble;
+  fIdentFuncTable[1] := FuncElse;
+  fIdentFuncTable[270] := FuncElseif;
+  fIdentFuncTable[139] := FuncEnd;
+  fIdentFuncTable[399] := FuncEnsure;
+  fIdentFuncTable[320] := FuncExclude;
+  fIdentFuncTable[368] := FuncExecutable;
+  fIdentFuncTable[150] := FuncExpanded;
+  fIdentFuncTable[167] := FuncExport;
+  fIdentFuncTable[474] := FuncExternal;
+  fIdentFuncTable[85] := FuncFalse;
+  fIdentFuncTable[174] := FuncFeature;
+  fIdentFuncTable[411] := FuncFrom;
+  fIdentFuncTable[63] := FuncFrozen;
+  fIdentFuncTable[172] := FuncGenerate;
+  fIdentFuncTable[17] := FuncIdentifier;
+  fIdentFuncTable[333] := FuncIf;
+  fIdentFuncTable[211] := FuncIgnore;
+  fIdentFuncTable[37] := FuncImplies;
+  fIdentFuncTable[331] := FuncInclude;
+  fIdentFuncTable[120] := FuncInclude95path;
+  fIdentFuncTable[6] := FuncIndexing;
+  fIdentFuncTable[496] := FuncInfix;
+  fIdentFuncTable[324] := FuncInherit;
+  fIdentFuncTable[431] := FuncInspect;
+  fIdentFuncTable[397] := FuncInteger;
+  fIdentFuncTable[382] := FuncInvariant;
+  fIdentFuncTable[354] := FuncIs;
+  fIdentFuncTable[71] := FuncLike;
+  fIdentFuncTable[160] := FuncLocal;
+  fIdentFuncTable[378] := FuncLoop;
+  fIdentFuncTable[181] := FuncMake;
+  fIdentFuncTable[245] := FuncNo;
+  fIdentFuncTable[353] := FuncNot;
+  fIdentFuncTable[25] := FuncObject;
+  fIdentFuncTable[191] := FuncObsolete;
+  fIdentFuncTable[319] := FuncOld;
+  fIdentFuncTable[7] := FuncOnce;
+  fIdentFuncTable[32] := FuncOptimize;
+  fIdentFuncTable[306] := FuncOption;
+  fIdentFuncTable[121] := FuncOr;
+  fIdentFuncTable[498] := FuncPointer;
+  fIdentFuncTable[240] := FuncPrecompiled;
+  fIdentFuncTable[42] := FuncPrecursor;
+  fIdentFuncTable[19] := FuncPrefix;
+  fIdentFuncTable[296] := FuncReal;
+  fIdentFuncTable[414] := FuncRedefine;
+  fIdentFuncTable[193] := FuncRename;
+  fIdentFuncTable[144] := FuncRequire;
+  fIdentFuncTable[5] := FuncRescue;
+  fIdentFuncTable[43] := FuncResult;
+  fIdentFuncTable[389] := FuncRetry;
+  fIdentFuncTable[362] := FuncRoot;
+  fIdentFuncTable[469] := FuncSelect;
+  fIdentFuncTable[302] := FuncSeparate;
+  fIdentFuncTable[242] := FuncString;
+  fIdentFuncTable[282] := FuncStrip;
+  fIdentFuncTable[135] := FuncSystem;
+  fIdentFuncTable[11] := FuncThen;
+  fIdentFuncTable[330] := FuncTrace;
+  fIdentFuncTable[24] := FuncTrue;
+  fIdentFuncTable[452] := FuncUndefine;
+  fIdentFuncTable[90] := FuncUnique;
+  fIdentFuncTable[501] := FuncUntil;
+  fIdentFuncTable[262] := FuncUse;
+  fIdentFuncTable[195] := FuncVariant;
+  fIdentFuncTable[344] := FuncVisible;
+  fIdentFuncTable[372] := FuncVoid;
+  fIdentFuncTable[348] := FuncWhen;
+  fIdentFuncTable[156] := FuncXor;
+  fIdentFuncTable[471] := FuncYes;
 end;
 
 function TSynEiffelSyn.AltFunc(Index: Integer): TtkTokenKind;
@@ -1201,72 +1195,72 @@ function TSynEiffelSyn.FuncYes(Index: Integer): TtkTokenKind;
 procedure TSynEiffelSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynEiffelSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
 procedure TSynEiffelSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run] = #10 then
+  if fLine[Run] = #10 then
     Inc(Run);
 end;
 
 procedure TSynEiffelSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynEiffelSyn.OperatorAndSymbolProc;
 begin
-  FTokenID := tkIdentifier;
-  if FLine[Run] = #33 then
+  fTokenID := tkIdentifier;
+  if fLine[Run] = #33 then
     begin
-      FRange := rsOperatorAndSymbolProc;
-      FTokenID := tkOperatorAndSymbols;
+      fRange := rsOperatorAndSymbolProc;
+      fTokenID := tkOperatorAndSymbols;
       Inc(Run);
       Exit;
     end;
-  if CharInSet(FLine[Run], [#35..#44]) then
+  if CharInSet(fLine[Run], [#35..#44]) then
     begin
-      FRange := rsOperatorAndSymbolProc;
-      FTokenID := tkOperatorAndSymbols;
+      fRange := rsOperatorAndSymbolProc;
+      fTokenID := tkOperatorAndSymbols;
       Inc(Run);
       Exit;
     end;
-  if CharInSet(FLine[Run], [#46..#47]) then
+  if CharInSet(fLine[Run], [#46..#47]) then
     begin
-      FRange := rsOperatorAndSymbolProc;
-      FTokenID := tkOperatorAndSymbols;
+      fRange := rsOperatorAndSymbolProc;
+      fTokenID := tkOperatorAndSymbols;
       Inc(Run);
       Exit;
     end;
-  if CharInSet(FLine[Run], [#58..#64]) then
+  if CharInSet(fLine[Run], [#58..#64]) then
     begin
-      FRange := rsOperatorAndSymbolProc;
-      FTokenID := tkOperatorAndSymbols;
+      fRange := rsOperatorAndSymbolProc;
+      fTokenID := tkOperatorAndSymbols;
       Inc(Run);
       Exit;
     end;
-  if CharInSet(FLine[Run], [#91..#96]) then
+  if CharInSet(fLine[Run], [#91..#96]) then
     begin
-      FRange := rsOperatorAndSymbolProc;
-      FTokenID := tkOperatorAndSymbols;
+      fRange := rsOperatorAndSymbolProc;
+      fTokenID := tkOperatorAndSymbols;
       Inc(Run);
       Exit;
     end;
-  if CharInSet(FLine[Run], [#123..#127]) then
+  if CharInSet(fLine[Run], [#123..#127]) then
     begin
-      FRange := rsOperatorAndSymbolProc;
-      FTokenID := tkOperatorAndSymbols;
+      fRange := rsOperatorAndSymbolProc;
+      fTokenID := tkOperatorAndSymbols;
       Inc(Run);
       Exit;
     end;
@@ -1275,19 +1269,19 @@ procedure TSynEiffelSyn.OperatorAndSymbolProc;
 procedure TSynEiffelSyn.EiffelCommentOpenProc;
 begin
   Inc(Run);
-  if (FLine[Run - 1] = '-') and (FLine[Run] = '-') then
+  if (fLine[Run - 1] = '-') and (fLine[Run] = '-') then
     begin
-      FRange := rsEiffelComment;
+      fRange := rsEiffelComment;
       EiffelCommentProc;
-      FTokenID := tkComment;
+      fTokenID := tkComment;
     end
   else
-    FTokenID := tkOperatorAndSymbols;
+    fTokenID := tkOperatorAndSymbols;
 end;
 
 procedure TSynEiffelSyn.EiffelCommentProc;
 begin
-  FTokenID := tkComment;
+  fTokenID := tkComment;
   repeat
     if not IsLineEnd(Run) then
       Inc(Run);
@@ -1297,19 +1291,19 @@ procedure TSynEiffelSyn.EiffelCommentProc;
 procedure TSynEiffelSyn.StringOpenProc;
 begin
   Inc(Run);
-  FRange := rsString;
+  fRange := rsString;
   StringProc;
-  FTokenID := tkString;
+  fTokenID := tkString;
 end;
 
 procedure TSynEiffelSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
-    if (FLine[Run] = '"') then
+    if (fLine[Run] = '"') then
       begin
         Inc(Run, 1);
-        FRange := rsUnknown;
+        fRange := rsUnKnown;
         Break;
       end;
     if not IsLineEnd(Run) then
@@ -1321,80 +1315,80 @@ constructor TSynEiffelSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
+  fCaseSensitive := False;
 
-  FBasicTypesAttri := TSynHighLighterAttributes.Create(SYNS_AttrBasicTypes, SYNS_FriendlyAttrBasicTypes);
-  FBasicTypesAttri.Style := [fsBold];
-  FBasicTypesAttri.Foreground := clBlue;
-  AddAttribute(FBasicTypesAttri);
+  fBasicTypesAttri := TSynHighLighterAttributes.Create(SYNS_AttrBasicTypes, SYNS_FriendlyAttrBasicTypes);
+  fBasicTypesAttri.Style := [fsBold];
+  fBasicTypesAttri.Foreground := clBlue;
+  AddAttribute(fBasicTypesAttri);
 
-  FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  FCommentAttri.Foreground := clTeal;
-  AddAttribute(FCommentAttri);
+  fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  fCommentAttri.Foreground := clTeal;
+  AddAttribute(fCommentAttri);
 
-  FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  FIdentifierAttri.Foreground := clMaroon;
-  AddAttribute(FIdentifierAttri);
+  fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  fIdentifierAttri.Foreground := clMaroon;
+  AddAttribute(fIdentifierAttri);
 
-  FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style := [fsBold];
-  FKeyAttri.Foreground := clNavy;
-  AddAttribute(FKeyAttri);
+  fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style := [fsBold];
+  fKeyAttri.Foreground := clNavy;
+  AddAttribute(fKeyAttri);
 
-  FLaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrLace, SYNS_FriendlyAttrLace);
-  FLaceAttri.Style := [fsBold];
-  FLaceAttri.Foreground := clNavy;
-  AddAttribute(FLaceAttri);
+  fLaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrLace, SYNS_FriendlyAttrLace);
+  fLaceAttri.Style := [fsBold];
+  fLaceAttri.Foreground := clNavy;
+  AddAttribute(fLaceAttri);
 
-  FOperatorAndSymbolsAttri := TSynHighLighterAttributes.Create(SYNS_AttrOperatorAndSymbols, SYNS_FriendlyAttrOperatorAndSymbols);
-  FOperatorAndSymbolsAttri.Style := [fsBold];
-  FOperatorAndSymbolsAttri.Foreground := clOlive;
-  AddAttribute(FOperatorAndSymbolsAttri);
+  fOperatorAndSymbolsAttri := TSynHighLighterAttributes.Create(SYNS_AttrOperatorAndSymbols, SYNS_FriendlyAttrOperatorAndSymbols);
+  fOperatorAndSymbolsAttri.Style := [fsBold];
+  fOperatorAndSymbolsAttri.Foreground := clOlive;
+  AddAttribute(fOperatorAndSymbolsAttri);
 
-  FPredefinedAttri := TSynHighLighterAttributes.Create(SYNS_AttrPredefined, SYNS_FriendlyAttrPredefined);
-  FPredefinedAttri.Style := [fsBold];
-  FPredefinedAttri.Foreground := clRed;
-  AddAttribute(FPredefinedAttri);
+  fPredefinedAttri := TSynHighLighterAttributes.Create(SYNS_AttrPredefined, SYNS_FriendlyAttrPredefined);
+  fPredefinedAttri.Style := [fsBold];
+  fPredefinedAttri.Foreground := clRed;
+  AddAttribute(fPredefinedAttri);
 
-  FResultValueAttri := TSynHighLighterAttributes.Create(SYNS_AttrResultValue, SYNS_FriendlyAttrResultValue);
-  FResultValueAttri.Style := [fsBold];
-  FResultValueAttri.Foreground := clPurple;
-  AddAttribute(FResultValueAttri);
+  fResultValueAttri := TSynHighLighterAttributes.Create(SYNS_AttrResultValue, SYNS_FriendlyAttrResultValue);
+  fResultValueAttri.Style := [fsBold];
+  fResultValueAttri.Foreground := clPurple;
+  AddAttribute(fResultValueAttri);
 
-  FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
+  fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
 
-  FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  FStringAttri.Style := [fsItalic];
-  FStringAttri.Foreground := clGray;
-  AddAttribute(FStringAttri);
+  fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  fStringAttri.Style := [fsItalic];
+  fStringAttri.Foreground := clGray;
+  AddAttribute(fStringAttri);
 
   SetAttributesOnChange(DefHighlightChange);
   InitIdent;
-  FDefaultFilter := SYNS_FilterEiffel;
-  FRange := rsUnknown;
+  fDefaultFilter := SYNS_FilterEiffel;
+  fRange := rsUnknown;
 end;
 
 procedure TSynEiffelSyn.IdentProc;
 begin
-  FTokenID := IdentKind(FLine + Run);
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do
+  fTokenID := IdentKind(fLine + Run);
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do
     Inc(Run);
 end;
 
 procedure TSynEiffelSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynEiffelSyn.Next;
 begin
-  FTokenPos := Run;
-  FRange := rsUnknown;
-  case FLine[Run] of
+  fTokenPos := Run;
+  fRange := rsUnknown;
+  case fLine[Run] of
     #33, #35..#44, #46..#47, #58..#64, #91..#96, #123..#127: OperatorAndSymbolProc;
     #0: NullProc;
     #10: LFProc;
@@ -1411,21 +1405,21 @@ procedure TSynEiffelSyn.Next;
 function TSynEiffelSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
     else Result := nil;
   end;
 end;
 
 function TSynEiffelSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
-function TSynEiffelSyn.GetKeyWords(TokenKind: Integer): UnicodeString;
+function TSynEiffelSyn.GetKeyWords(TokenKind: Integer): string;
 begin
   Result :=
     '-,!,#,$,%U,&,(,),*,.,/,//,/=,:,:=,;,@,[,\\,],^,|,+,<,<>,=,>,adapt,ali' +
@@ -1442,33 +1436,33 @@ function TSynEiffelSyn.GetKeyWords(TokenKind: Integer): UnicodeString;
 
 function TSynEiffelSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynEiffelSyn.GetTokenAttribute: TSynHighLighterAttributes;
 begin
   case GetTokenID of
-    tkBasicTypes: Result := FBasicTypesAttri;
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkLace: Result := FLaceAttri;
-    tkOperatorAndSymbols: Result := FOperatorAndSymbolsAttri;
-    tkPredefined: Result := FPredefinedAttri;
-    tkResultValue: Result := FResultValueAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkUnknown: Result := FIdentifierAttri;
+    tkBasicTypes: Result := fBasicTypesAttri;
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkLace: Result := fLaceAttri;
+    tkOperatorAndSymbols: Result := fOperatorAndSymbolsAttri;
+    tkPredefined: Result := fPredefinedAttri;
+    tkResultValue: Result := fResultValueAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkUnknown: Result := fIdentifierAttri;
     else Result := nil;
   end;
 end;
 
 function TSynEiffelSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
-function TSynEiffelSyn.GetSampleSource: UnicodeString;
+function TSynEiffelSyn.GetSampleSource: string;
 begin
   Result := '-- Eiffel sample source from SmartEiffel'#13#10 +
     'class FIBONACCI'#13#10 +
@@ -1509,7 +1503,7 @@ function TSynEiffelSyn.GetSampleSource: UnicodeString;
 
 function TSynEiffelSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterEiffel;
+  Result := fDefaultFilter <> SYNS_FilterEiffel;
 end;
 
 class function TSynEiffelSyn.GetLanguageName: string;
@@ -1519,17 +1513,17 @@ class function TSynEiffelSyn.GetLanguageName: string;
 
 procedure TSynEiffelSyn.ResetRange;
 begin
-  FRange := rsUnknown;
+  fRange := rsUnknown;
 end;
 
 procedure TSynEiffelSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 function TSynEiffelSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 function TSynEiffelSyn.IsOperatorChar(AChar: WideChar): Boolean;
@@ -1543,13 +1537,11 @@ function TSynEiffelSyn.IsOperatorChar(AChar: WideChar): Boolean;
   end;
 end;
 
-class function TSynEiffelSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynEiffelSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangEiffel;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynEiffelSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterFortran.pas b/Ext/SynEdit/Source/SynHighlighterFortran.pas
index 63074f7..85c4d08 100644
--- a/Ext/SynEdit/Source/SynHighlighterFortran.pas
+++ b/Ext/SynEdit/Source/SynHighlighterFortran.pas
@@ -27,13 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterFortran.pas,v 1.15.2.9 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a Fortran syntax highlighter for SynEdit)
@@ -69,14 +62,14 @@ interface
   TSynFortranSyn = class(TSynCustomHighlighter)
   private
     FTokenID: TtkTokenKind;
-    FIdentFuncTable: array[0..192] of TIdentFuncTableFunc;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
+    fIdentFuncTable: array[0..192] of TIdentFuncTableFunc;
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
     function AltFunc(Index: Integer): TtkTokenKind;
     function KeyWordFunc(Index: Integer): TtkTokenKind;
     function HashKey(Str: PWideChar): Cardinal;
@@ -110,7 +103,7 @@   TSynFortranSyn = class(TSynCustomHighlighter)
     function IsFilterStored: Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -121,19 +114,19 @@   TSynFortranSyn = class(TSynCustomHighlighter)
     function GetTokenKind: Integer; override;
     procedure Next; override;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
   end;
 
 implementation
@@ -142,7 +135,7 @@ implementation
   SynEditStrConst;
 
 const
-  KeyWords: array[0..69] of UnicodeString = (
+  KeyWords: array[0..69] of string = (
     'allocatable', 'allocate', 'allocated', 'associated', 'call', 'case', 
     'character', 'close', 'common', 'complex', 'contains', 'continue', 'cycle', 
     'data', 'deallocate', 'default', 'define', 'dimension', 'do', 'else', 
@@ -179,7 +172,7 @@ function TSynFortranSyn.HashKey(Str: PWideChar): Cardinal;
     Inc(Str);
   end;
   Result := Result mod 193;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -187,10 +180,10 @@ function TSynFortranSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
@@ -199,13 +192,13 @@ procedure TSynFortranSyn.InitIdent;
 var
   i: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
     if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
+      fIdentFuncTable[i] := AltFunc;
 
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if @FIdentFuncTable[i] = nil then
-      FIdentFuncTable[i] := KeyWordFunc;
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
+    if @fIdentFuncTable[i] = nil then
+      fIdentFuncTable[i] := KeyWordFunc;
 end;
 
 function TSynFortranSyn.AltFunc(Index: Integer): TtkTokenKind;
@@ -225,36 +218,35 @@ constructor TSynFortranSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
-
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  AddAttribute(FCommentAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
+  fCaseSensitive := False;
+
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  AddAttribute(fCommentAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style := [fsBold];
+  AddAttribute(fKeyAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
   SetAttributesOnChange(DefHighlightChange);
   InitIdent;
-  FDefaultFilter := SYNS_FilterFortran;
+  fDefaultFilter := SYNS_FilterFortran;
 end;
 
 procedure TSynFortranSyn.AsciiCharProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
     case FLine[Run] of
-      #0, #10, #13:
-        Break;
+      #0, #10, #13: Break;
     end;
     Inc(Run);
   until FLine[Run] = #39;
@@ -263,15 +255,15 @@ procedure TSynFortranSyn.AsciiCharProc;
 
 procedure TSynFortranSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run] = #10 then Inc(Run);
+  if fLine[Run] = #10 then Inc(Run);
 end;
 
 procedure TSynFortranSyn.CommaProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFortranSyn.EqualProc;
@@ -280,12 +272,12 @@ procedure TSynFortranSyn.EqualProc;
     '=':                               {logical equal}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {assign}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
@@ -293,12 +285,11 @@ procedure TSynFortranSyn.EqualProc;
 procedure TSynFortranSyn.ExclamationProc;
 begin
   Inc(Run, 1);                        {Fortran Comments}
-  FTokenID := tkComment;
+  fTokenID := tkComment;
   while FLine[Run] <> #0 do
   begin
     case FLine[Run] of
-      #10, #13:
-        Break;
+      #10, #13: Break;
     end;
     Inc(Run);
   end;
@@ -306,11 +297,11 @@ procedure TSynFortranSyn.ExclamationProc;
 
 procedure TSynFortranSyn.GreaterProc;
 begin
-  case FLine[Run + 1] of
+  Case FLine[Run + 1] of
     '=':                               {greater than or equal to}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
     '>':
       begin
@@ -318,12 +309,12 @@ procedure TSynFortranSyn.GreaterProc;
           Inc(Run, 3)
         else                           {shift right}
           Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {greater than}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
@@ -336,16 +327,16 @@ procedure TSynFortranSyn.IdentProc;
     CommentProc;
   end
   else begin
-    FTokenID := IdentKind(FLine + Run);
-    Inc(Run, FStringLen);
-    while IsIdentChar(FLine[Run]) do Inc(Run);
+    fTokenID := IdentKind(fLine + Run);
+    Inc(Run, fStringLen);
+    while IsIdentChar(fLine[Run]) do Inc(Run);
   end;
 end;
 
 procedure TSynFortranSyn.LFProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
 end;
 
 procedure TSynFortranSyn.LowerProc;
@@ -354,7 +345,7 @@ procedure TSynFortranSyn.LowerProc;
     '=':                               {less than or equal to}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
     '<':
       begin
@@ -362,12 +353,12 @@ procedure TSynFortranSyn.LowerProc;
           Inc(Run, 3)
         else                           {shift left}
           Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {less than}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
@@ -376,19 +367,19 @@ procedure TSynFortranSyn.MinusProc;
 begin
   {subtract}
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFortranSyn.ModSymbolProc;
 begin
   {mod}
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFortranSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -396,7 +387,7 @@ procedure TSynFortranSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', '.', 'x', 'X', 'e', 'E', 'f', 'F':
         Result := True;
       else
@@ -406,13 +397,12 @@ procedure TSynFortranSyn.NumberProc;
 
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar do
   begin
     case FLine[Run] of
       '.':
-        if FLine[Run + 1] = '.' then
-          Break;
+        if FLine[Run + 1] = '.' then Break;
     end;
     Inc(Run);
   end;
@@ -422,62 +412,62 @@ procedure TSynFortranSyn.PlusProc;
 begin
   {subtract}
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFortranSyn.PointProc;
 begin
-  if (((SynWideUpperCase(FLine[Run + 1]) = 'G') and CharInSet(SynWideUpperCase(FLine[Run + 2])[1], ['E', 'T'])) {.ge. .gt.}
-       or ((SynWideUpperCase(FLine[Run + 1]) = 'L') and CharInSet(SynWideUpperCase(FLine[Run + 2])[1], ['E', 'T'])) {.le. .lt.}
-       or ((SynWideUpperCase(FLine[Run + 1]) = 'N') and (SynWideUpperCase(FLine[Run + 2]) = 'E')) {.ne.}
-       or ((SynWideUpperCase(FLine[Run + 1]) = 'E') and (SynWideUpperCase(FLine[Run + 2]) = 'Q')) {.eq.}
-       or ((SynWideUpperCase(FLine[Run + 1]) = 'O') and (SynWideUpperCase(FLine[Run + 2]) = 'R'))){.or.}
+  if (((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'G') and CharInSet(SysUtils.AnsiUpperCase(FLine[Run + 2])[1], ['E', 'T'])) {.ge. .gt.}
+       or ((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'L') and CharInSet(SysUtils.AnsiUpperCase(FLine[Run + 2])[1], ['E', 'T'])) {.le. .lt.}
+       or ((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'N') and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'E')) {.ne.}
+       or ((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'E') and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'Q')) {.eq.}
+       or ((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'O') and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'R'))){.or.}
      and (FLine[Run + 3] = '.') then
     begin
       Inc(Run, 4);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end
-  else if (((SynWideUpperCase(FLine[Run + 1]) = 'A')
-              and (SynWideUpperCase(FLine[Run + 2]) = 'N')
-              and (SynWideUpperCase(FLine[Run + 3]) = 'D'))    {.and.}
-           or ((SynWideUpperCase(FLine[Run + 1]) = 'N')
-              and (SynWideUpperCase(FLine[Run + 2]) = 'O')
-              and (SynWideUpperCase(FLine[Run + 3]) = 'T')))    {.not.}
+  else if (((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'A')
+              and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'N')
+              and (SysUtils.AnsiUpperCase(FLine[Run + 3]) = 'D'))    {.and.}
+           or ((SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'N')
+              and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'O')
+              and (SysUtils.AnsiUpperCase(FLine[Run + 3]) = 'T')))    {.not.}
           and (FLine[Run + 4] = '.') then
     begin
       Inc(Run, 5);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end
-  else if (SynWideUpperCase(FLine[Run + 1]) = 'T')
-          and (SynWideUpperCase(FLine[Run + 2]) = 'R')
-          and (SynWideUpperCase(FLine[Run + 3]) = 'U')
-          and (SynWideUpperCase(FLine[Run + 4]) = 'E')
+  else if (SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'T')
+          and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'R')
+          and (SysUtils.AnsiUpperCase(FLine[Run + 3]) = 'U')
+          and (SysUtils.AnsiUpperCase(FLine[Run + 4]) = 'E')
           and (FLine[Run + 5] = '.') then  {.true.}
     begin
       Inc(Run, 6);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end
-  else if (SynWideUpperCase(FLine[Run + 1]) = 'F')
-          and (SynWideUpperCase(FLine[Run + 2]) = 'A')
-          and (SynWideUpperCase(FLine[Run + 3]) = 'L')
-          and (SynWideUpperCase(FLine[Run + 4]) = 'S')
-          and (SynWideUpperCase(FLine[Run + 5]) = 'E')
+  else if (SysUtils.AnsiUpperCase(FLine[Run + 1]) = 'F')
+          and (SysUtils.AnsiUpperCase(FLine[Run + 2]) = 'A')
+          and (SysUtils.AnsiUpperCase(FLine[Run + 3]) = 'L')
+          and (SysUtils.AnsiUpperCase(FLine[Run + 4]) = 'S')
+          and (SysUtils.AnsiUpperCase(FLine[Run + 5]) = 'E')
           and (FLine[Run + 6] = '.') then  {.false.}
     begin
       Inc(Run, 7);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end
   else                                 {point}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
 end;
 
 procedure TSynFortranSyn.RoundCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFortranSyn.RoundOpenProc;
@@ -489,20 +479,20 @@ procedure TSynFortranSyn.RoundOpenProc;
 procedure TSynFortranSyn.SemiColonProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFortranSyn.SlashProc;
 begin
   {division}
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFortranSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
@@ -515,18 +505,17 @@ procedure TSynFortranSyn.StarProc;
   else begin
     {star}
     Inc(Run);
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynFortranSyn.CommentProc;
 begin
-  FTokenID := tkComment;
+  fTokenID := tkComment;
   while FLine[Run] <> #0 do
   begin
     case FLine[Run] of
-      #10, #13:
-        Break;
+      #10, #13: Break;
     end; //case
     Inc(Run);
   end; //while
@@ -534,12 +523,11 @@ procedure TSynFortranSyn.CommentProc;
 
 procedure TSynFortranSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2);
   repeat
     case FLine[Run] of
-      #0, #10, #13:
-        Break;
+      #0, #10, #13: Break;
       #92:
         if FLine[Run + 1] = #10 then Inc(Run);
     end;
@@ -551,13 +539,13 @@ procedure TSynFortranSyn.StringProc;
 procedure TSynFortranSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynFortranSyn.Next;
 begin
-  FTokenPos := Run;
-  case FLine[Run] of
+  fTokenPos := Run;
+  case fLine[Run] of
     #39: AsciiCharProc;
     #13: CRProc;
     ',': CommaProc;
@@ -588,12 +576,12 @@ procedure TSynFortranSyn.Next;
 function TSynFortranSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -601,37 +589,37 @@ function TSynFortranSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttr
 
 function TSynFortranSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynFortranSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynFortranSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
   case GetTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkUnknown: Result := FIdentifierAttri;
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkUnknown: Result := fIdentifierAttri;
     else Result := nil;
   end;
 end;
 
 function TSynFortranSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
 function TSynFortranSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterFortran;
+  Result := fDefaultFilter <> SYNS_FilterFortran;
 end;
 
 class function TSynFortranSyn.GetLanguageName: string;
@@ -639,13 +627,11 @@ class function TSynFortranSyn.GetLanguageName: string;
   Result := SYNS_LangFortran;
 end;
 
-class function TSynFortranSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynFortranSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangFortran;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynFortranSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterFoxpro.pas b/Ext/SynEdit/Source/SynHighlighterFoxpro.pas
index e820631..c67616d 100644
--- a/Ext/SynEdit/Source/SynHighlighterFoxpro.pas
+++ b/Ext/SynEdit/Source/SynHighlighterFoxpro.pas
@@ -28,11 +28,6 @@
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
 
-$Id: SynHighlighterFoxpro.pas,v 1.12.2.10 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
 Known Issues:
 -------------------------------------------------------------------------------}
 {
@@ -51,37 +46,39 @@
 interface
 
 uses
-  Graphics,
+  System.SysUtils,
+  System.Classes,
+  System.Generics.Defaults,
+  System.Generics.Collections,
+  Vcl.Graphics,
   SynEditTypes,
   SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
+  System.RegularExpressions,
+  SynEditCodeFolding;
 
 type
-  TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace,
-    tkString, tkSymbol, tkUnknown);
+  TtkTokenKind = (tkSymbol, tkKey, tkComment, tkIdentifier, tkNull, tkNumber, tkSpace,
+    tkString, tkUnknown);
 
   PIdentFuncTableFunc = ^TIdentFuncTableFunc;
   TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
 
 type
-  TSynFoxproSyn = class(TSynCustomHighlighter)
+  TSynFoxproSyn = class(TSynCustomCodeFoldingHighlighter)
   private
     FTokenID: TtkTokenKind;
-    FIdentFuncTable: array[0..17908] of TIdentFuncTableFunc;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    function KeyWordFunc(Index: Integer): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    FKeywords: TDictionary;
+    RE_BlockBegin: TRegEx;
+    RE_BlockEnd: TRegEx;
+    procedure DoAddKeyword(AKeyword: string; AKind: Integer);
     function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
     procedure AndSymbolProc;
     procedure AsciiCharProc;
     procedure AtSymbolProc;
@@ -116,12 +113,14 @@   TSynFoxproSyn = class(TSynCustomHighlighter)
     procedure XOrSymbolProc;
     procedure UnknownProc;
   protected
+    function GetSampleSource: string; override;
     function IsFilterStored: Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
+    destructor Destroy; override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
       override;
     function GetEol: Boolean; override;
@@ -129,1175 +128,361 @@   TSynFoxproSyn = class(TSynCustomHighlighter)
     function GetTokenAttribute: TSynHighlighterAttributes; override;
     function GetTokenKind: Integer; override;
     procedure Next; override;
+    procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges;
+      LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override;
+    procedure AdjustFoldRanges(FoldRanges: TSynFoldRanges;
+      LinesToScan: TStrings); override;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
   end;
 
 implementation
 
 uses
+  SynEditMiscProcs,
   SynEditStrConst;
 
 const
-  KeyWords: array[0..809] of UnicodeString = (
-    '_curobj', '_msysmenu', '_pageno', '_screen', '_vfp', 'abs', 'accept', 
-    'aclass', 'acopy', 'acos', 'acti', 'activate', 'adatabases', 'adbobjects', 
-    'add', 'additive', 'adel', 'adir', 'aelement', 'aerror', 'afields', 'afont', 
-    'after', 'again', 'ains', 'ainstance', 'alen', 'alias', 'alines', 'all', 
-    'alltrim', 'alt', 'alter', 'alternate', 'amembers', 'and', 'ansi', 
-    'ansitooem', 'any', 'aplabout', 'appe', 'append', 'application', 
-    'aprinters', 'array', 'as', 'asc', 'ascan', 'ascending', 'ascii', 'aselobj', 
-    'asin', 'asort', 'assert', 'asubscript', 'at', 'at_c', 'atan', 'atc', 
-    'atcc', 'atcline', 'atline', 'atn2', 'aused', 'autosave', 'average', 'avg', 
-    'backcolor', 'bar', 'barcount', 'barprompt', 'baseclass', 'before', 'begin', 
-    'bell', 'between', 'bintoc', 'bitand', 'bitclear', 'bitlshift', 'bitnot', 
-    'bitor', 'bitrshift', 'bitset', 'bittest', 'bitxor', 'blan', 'blank', 
-    'blink', 'blocksize', 'bof', 'border', 'bott', 'bottom', 'box', 'brow', 
-    'browse', 'brstatus', 'build', 'by', 'calculate', 'call', 'cancel', 
-    'candidate', 'capslock', 'caption', 'carry', 'case', 'cd', 'cdow', 
-    'ceiling', 'century', 'change', 'char', 'chdir', 'check', 'chr', 'chrsaw', 
-    'chrtran', 'chrtranc', 'class', 'classlib', 'clear', 'clock', 'clos', 
-    'close', 'cls', 'cmonth', 'cnt', 'cntbar', 'cntpad', 'codepage', 'col', 
-    'collate', 'color', 'colorscheme', 'comm', 'command', 'commands', 'comment', 
-    'compact', 'compatible', 'compile', 'compobj', 'confirm', 'connection', 
-    'connstring', 'console', 'continue', 'copy', 'cos', 'count', 'cpconvert', 
-    'cpcurrent', 'cpdbf', 'cpdialog', 'cpnotrans', 'create', 'createobject', 
-    'createoffline', 'ctobin', 'ctod', 'ctot', 'curdir', 'currency', 'cursor', 
-    'curval', 'custom', 'database', 'databases', 'datasession', 'dateformat', 
-    'datemark', 'datetime', 'day', 'dbalias', 'dbc', 'dbused', 'debug', 
-    'debugout', 'decimals', 'declare', 'default', 'define', 'dele', 'delete', 
-    'deleted', 'delimite', 'delimited', 'delimiters', 'descending', 'desktop', 
-    'development', 'device', 'difference', 'dim', 'dimension', 'dir', 
-    'directory', 'diskspace', 'display', 'displayvalue', 'distinct', 'dlls', 
-    'dmy', 'do', 'dodefault', 'dohistory', 'double', 'dow', 'drop', 'dtoc', 
-    'dtor', 'dtos', 'dtot', 'each', 'echo', 'edit', 'eject', 'else', 'empty', 
-    'end', 'endcase', 'enddefine', 'enddo', 'endfor', 'endfunc', 'endif', 
-    'endprintjob', 'endproc', 'endscan', 'endtext', 'endwith', 'environment', 
-    'eof', 'erase', 'error', 'escape', 'evaluate', 'event', 'eventhandler', 
-    'events', 'exact', 'except', 'exclusive', 'exists', 'exit', 'exp', 'export', 
-    'expression', 'extended', 'external', 'fchsize', 'fclose', 'fcount', 
-    'fcreate', 'fdow', 'feof', 'ferror', 'fetch', 'fflush', 'fgets', 'field', 
-    'fields', 'file', 'files', 'fill', 'filter', 'find', 'fixed', 'float', 
-    'flock', 'floor', 'flush', 'font', 'footer', 'fopen', 'for', 'force', 
-    'foreign', 'form', 'format', 'found', 'fox2x', 'fputs', 'free', 'freeze', 
-    'from', 'fseek', 'fsize', 'fullpath', 'func', 'functi', 'function', 'fv', 
-    'fw2', 'fweek', 'fwrite', 'gath', 'gather', 'general', 'get', 'getbar', 
-    'getcolor', 'getcp', 'getdir', 'getenv', 'getexpr', 'getfile', 
-    'getfldstate', 'getfont', 'getnextmodified', 'getobject', 'getpad', 
-    'getpict', 'getprinter', 'gets', 'global', 'go', 'gomonth', 'gotfocus', 
-    'goto', 'group', 'grow', 'having', 'headings', 'help', 'helpcontextid', 
-    'helpfilter', 'hidden', 'highlight', 'hour', 'hours', 'icon', 'id', 
-    'idxcollate', 'if', 'ifdef', 'ifndef', 'iif', 'import', 'in', 'include', 
-    'indbc', 'index', 'indexes', 'inkey', 'inlist', 'input', 'insert', 
-    'insmode', 'int', 'integer', 'intensity', 'interval', 'into', 'is', 
-    'isalpha', 'iscolor', 'isdigit', 'isexclusive', 'isflocked', 'islower', 
-    'isnull', 'isreadonly', 'isrlocked', 'isupper', 'join', 'key', 'keyboard', 
-    'keycomp', 'keymatch', 'label', 'last', 'lastkey', 'ledit', 'left', 'leftc', 
-    'len', 'lenc', 'level', 'library', 'like', 'line', 'lineno', 'linked', 
-    'list', 'loadpicture', 'local', 'locate', 'locfile', 'lock', 'lockscreen', 
-    'log', 'log10', 'logerrors', 'logout', 'long', 'lookup', 'loop', 'lower', 
-    'lparameter', 'lparameters', 'lpartition', 'ltrim', 'lupdate', 'macdesktop', 
-    'machelp', 'mackey', 'macros', 'margin', 'mark', 'master', 'max', 'mcol', 
-    'md', 'mdown', 'mdx', 'mdy', 'memlines', 'memo', 'memory', 'memos', 
-    'memowidth', 'memvar', 'menu', 'menus', 'message', 'messagebox', 'messages', 
-    'middle', 'min', 'minimize', 'minute', 'mkdir', 'mline', 'mod', 'modal', 
-    'modi', 'modify', 'module', 'month', 'mouse', 'movable', 'move', 'moved', 
-    'mrkbar', 'mrkpad', 'mrow', 'mton', 'multilocks', 'multiselect', 'mvcount', 
-    'name', 'ndx', 'near', 'negotiate', 'network', 'newobject', 'next', 
-    'noalias', 'noappend', 'noclear', 'noclose', 'noconsole', 'nocptrans', 
-    'nodata', 'nodebug', 'nodefault', 'nodelete', 'noedit', 'noeject', 
-    'noenvironment', 'nofloat', 'noinit', 'nolink', 'nolock', 'nomargin', 
-    'nomdi', 'nomenu', 'nominimize', 'nomodify', 'nomouse', 'none', 
-    'nooptimize', 'nooverwrite', 'noprompt', 'noread', 'norefresh', 'norequery', 
-    'normal', 'normalize', 'nosave', 'noshadow', 'noshow', 'nospace', 'not', 
-    'note', 'notify', 'noupdate', 'novalidate', 'noverify', 'nowait', 
-    'nowindow', 'nowrap', 'nozoom', 'npv', 'ntom', 'null', 'nulldisplay', 
-    'numlock', 'nvl', 'objnum', 'objtoclient', 'objvar', 'occurs', 'odometer', 
-    'oemtoansi', 'of', 'off', 'oldval', 'oleclass', 'olecontrol', 'olepublic', 
-    'on', 'only', 'open', 'optimize', 'or', 'order', 'os', 'otherwise', 'outer', 
-    'overwrite', 'pack', 'pad', 'padc', 'padr', 'palette', 'para', 'parameter', 
-    'parameters', 'path', 'payment', 'pcol', 'pdox', 'pdsetup', 'pen', 'pi', 
-    'pictres', 'picture', 'pixels', 'plain', 'play', 'point', 'pop', 'popup', 
-    'preference', 'preview', 'primary', 'print', 'printer', 'printjob', 
-    'printstatus', 'private', 'proc', 'proced', 'procedure', 'procedures', 
-    'program', 'project', 'prompt', 'proper', 'protected', 'prow', 'prtinfo', 
-    'public', 'push', 'putfile', 'pv', 'query', 'quit', 'rand', 'range', 'rat', 
-    'ratc', 'ratline', 'rd', 'rdlevel', 'read', 'readborder', 'recall', 
-    'reccount', 'recno', 'record', 'recover', 'recsize', 'references', 
-    'refresh', 'region', 'regional', 'reindex', 'rela', 'relati', 'relation', 
-    'release', 'remote', 'rename', 'repl', 'repla', 'replace', 'replicate', 
-    'report', 'reprocess', 'requery', 'reset', 'resizable', 'resize', 
-    'resource', 'resources', 'rest', 'restore', 'resume', 'retry', 'retu', 
-    'return', 'rgb', 'rgbscheme', 'right', 'rightc', 'rightclick', 
-    'righttoleft', 'rlock', 'rmdir', 'rollback', 'round', 'row', 'rtod', 
-    'rtrim', 'run', 'runscript', 'runtime', 'safety', 'same', 'save', 'say', 
-    'scan', 'scat', 'scatt', 'scatter', 'scheme', 'schemes', 'scols', 
-    'scoreboard', 'screen', 'sdf', 'second', 'seek', 'sele', 'select', 
-    'selected', 'selection', 'separator', 'set', 'shadows', 'shape', 'show', 
-    'shutdown', 'sign', 'sin', 'single', 'sizable', 'size', 'skip', 'skpbar', 
-    'skppad', 'some', 'sort', 'sorted', 'soundex', 'space', 'sql', 'sqlcommit', 
-    'sqlrollback', 'sqlstringconnect', 'sqrt', 'srows', 'status', 
-    'statusbartext', 'std', 'step', 'sticky', 'store', 'str', 'strconv', 
-    'string', 'strtran', 'structure', 'stuff', 'stuffc', 'style', 'substr', 
-    'substrc', 'sum', 'summary', 'suspend', 'sylk', 'sys', 'sysformats', 
-    'sysmenu', 'sysmenus', 'sysmetric', 'system', 'tab', 'tabindex', 'table', 
-    'tablerevert', 'tables', 'tableupdate', 'tabstop', 'tag', 'talk', 'target', 
-    'text', 'textmerge', 'textwidth', 'this', 'thisform', 'thisformset', 'time', 
-    'timeout', 'timer', 'titles', 'to', 'top', 'topic', 'total', 'transaction', 
-    'transform', 'trap', 'trbetween', 'trigger', 'trim', 'ttoc', 'ttod', 
-    'txnlevel', 'txtwidth', 'type', 'typeahead', 'udfparms', 'undefine', 
-    'union', 'unique', 'unlock', 'unpack', 'update', 'updated', 'upper', 'use', 
-    'used', 'val', 'valid', 'validate', 'value', 'values', 'var', 'varread', 
-    'vartype', 'version', 'view', 'views', 'volume', 'wait', 'wchild', 'wcols', 
-    'week', 'wexist', 'wfont', 'when', 'while', 'window', 'windowlist', 
-    'windows', 'with', 'wk1', 'wk3', 'wks', 'wlast', 'wlcol', 'wlrow', 'wontop', 
-    'workarea', 'woutput', 'wparent', 'wr1', 'wread', 'writeexpression', 
-    'writemethod', 'wrk', 'wrows', 'wtitle', 'wvisible', 'xcmdfile', 'xl5', 
-    'xls', 'year', 'zap', 'zoom', 'zorder', 'zorderset' 
-  );
-
-  KeyIndices: array[0..17908] of Integer = (
-    -1, -1, -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, 485, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 416, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 315, -1, -1, -1, -1, -1, -1, 523, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 776, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 664, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    698, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 216, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 499, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 427, -1, -1, -1, -1, -1, -1, -1, -1, 205, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 124, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 724, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 700, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 246, 125, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 703, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 800, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 621, -1, 
-    509, -1, -1, -1, -1, -1, -1, -1, -1, -1, 172, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 579, -1, -1, -1, -1, -1, -1, -1, 592, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 528, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 596, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 50, -1, -1, 150, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 759, -1, -1, 665, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 181, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 324, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 537, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 745, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 728, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 250, -1, -1, -1, -1, -1, -1, -1, 467, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 530, -1, -1, 414, -1, 282, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 685, -1, -1, -1, -1, -1, -1, -1, -1, -1, 326, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 756, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 561, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 232, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    500, -1, -1, -1, -1, -1, -1, -1, -1, 332, -1, -1, -1, -1, -1, 372, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 273, -1, -1, -1, 
-    -1, -1, -1, 582, -1, -1, -1, -1, -1, -1, -1, -1, -1, 540, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 734, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 446, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    61, -1, -1, -1, -1, -1, -1, 680, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 173, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 343, -1, 218, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 366, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 717, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 751, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 56, 618, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 713, -1, -1, -1, -1, -1, -1, 
-    329, -1, -1, -1, 491, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 238, -1, -1, -1, -1, -1, -1, -1, 513, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, 121, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 688, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 514, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 193, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 264, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 395, -1, -1, -1, 806, -1, 475, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 648, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 54, -1, -1, 483, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 322, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 245, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 320, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, 
-    -1, 186, -1, -1, -1, -1, -1, -1, 422, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 615, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 515, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 746, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 750, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 139, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 521, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 420, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 284, 167, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    170, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 591, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, -1, 
-    325, 641, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 452, 363, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 137, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    716, -1, -1, -1, -1, -1, 438, -1, -1, -1, -1, -1, 619, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 151, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 673, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 290, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, 402, -1, -1, -1, 508, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 276, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 267, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 798, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    696, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 211, -1, -1, -1, 
-    -1, -1, -1, -1, 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 128, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 601, 
-    352, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 730, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 637, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 461, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 241, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 236, -1, -1, -1, -1, -1, -1, -1, -1, -1, 638, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 770, -1, -1, 357, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 613, -1, -1, 778, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    684, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    140, -1, -1, -1, 142, -1, 425, -1, -1, -1, 598, -1, -1, 465, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 367, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 780, 
-    -1, -1, -1, -1, 674, 131, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 265, -1, -1, -1, 490, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 184, -1, -1, 112, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 549, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 558, -1, 658, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 616, -1, -1, -1, 
-    148, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 194, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 484, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 606, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    532, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 492, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 669, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 522, -1, -1, -1, -1, -1, -1, -1, -1, -1, 474, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 145, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 720, -1, -1, -1, 298, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 364, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 144, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 449, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 225, -1, 
-    -1, -1, -1, -1, -1, -1, 333, -1, 634, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 695, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 574, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 277, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 252, -1, -1, -1, -1, 581, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    489, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, -1, -1, -1, 578, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 256, -1, -1, -1, -1, -1, -1, -1, -1, 645, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 257, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 725, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 541, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 546, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 468, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 754, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 693, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, 753, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 767, -1, -1, -1, -1, -1, 434, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 773, -1, -1, -1, -1, -1, -1, 795, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 293, -1, 
-    588, -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 662, -1, -1, -1, 310, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 552, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 677, 
-    386, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 607, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 202, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 255, 266, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 271, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 371, 25, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 149, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 460, -1, -1, -1, -1, 599, -1, 
-    -1, -1, -1, -1, -1, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 380, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 136, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, 
-    -1, -1, -1, -1, 542, -1, -1, -1, -1, -1, -1, 334, -1, -1, -1, -1, -1, 171, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 344, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 699, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 604, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    104, -1, 370, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 739, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    130, -1, -1, -1, -1, -1, 470, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 466, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 342, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 694, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 453, -1, -1, -1, -1, 
-    726, -1, -1, -1, -1, -1, 428, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 175, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 249, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 198, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 404, -1, -1, -1, -1, -1, -1, -1, 539, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 433, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 176, 226, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 804, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 731, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 473, -1, -1, -1, -1, -1, -1, -1, 47, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 764, 630, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 97, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 444, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 126, -1, 203, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 127, -1, -1, -1, -1, -1, 556, -1, -1, -1, -1, 
-    -1, 228, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 338, -1, -1, -1, -1, 336, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 486, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 763, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    456, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 206, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 612, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    545, -1, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 262, -1, -1, -1, -1, -1, -1, -1, -1, 369, 
-    -1, -1, -1, -1, 302, 316, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 261, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 649, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 337, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    48, -1, 118, -1, -1, -1, -1, -1, 224, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 190, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 29, 
-    809, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 503, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 235, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 603, -1, 678, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    76, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 493, 
-    -1, -1, -1, 741, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 494, -1, -1, -1, -1, 547, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 305, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 631, -1, -1, 623, 676, 383, 335, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 681, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 429, -1, -1, 7, -1, -1, -1, -1, 
-    781, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 722, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, -1, 
-    451, -1, -1, -1, -1, -1, 207, -1, -1, -1, -1, -1, -1, -1, -1, -1, 346, -1, 
-    -1, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 223, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 306, -1, -1, -1, 280, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 760, -1, -1, -1, -1, 
-    -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 747, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    308, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    748, -1, 617, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 462, -1, 178, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    243, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 103, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 791, -1, -1, -1, -1, -1, -1, -1, 
-    323, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 571, -1, -1, 587, -1, -1, 
-    -1, -1, 690, -1, -1, -1, -1, -1, -1, -1, -1, 701, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 304, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 705, 406, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 593, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 350, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 398, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 692, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, 240, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 636, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 102, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 683, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 217, -1, 691, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 793, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 711, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 99, -1, -1, 743, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 101, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 505, -1, -1, -1, -1, 718, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 672, -1, -1, -1, -1, -1, -1, 355, -1, -1, -1, -1, -1, 91, -1, 742, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, 
-    -1, -1, 286, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    614, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 379, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    421, -1, -1, -1, 242, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    113, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 784, -1, -1, 761, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 501, -1, -1, -1, -1, -1, -1, -1, 710, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 555, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 704, -1, -1, -1, -1, 504, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 744, -1, -1, -1, 360, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 464, -1, -1, -1, -1, 38, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 585, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 670, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 254, 187, 459, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 92, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    507, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 5, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 365, -1, -1, -1, -1, -1, -1, 643, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 432, -1, -1, -1, -1, -1, -1, 733, 
-    -1, -1, -1, -1, -1, -1, 792, -1, -1, 668, -1, 156, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 769, -1, -1, -1, 
-    -1, 283, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 437, -1, -1, -1, -1, 749, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 659, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 597, 655, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 610, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 575, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 624, -1, -1, -1, 417, -1, -1, 
-    -1, -1, -1, 212, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, 785, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    799, -1, -1, -1, 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 303, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 115, -1, -1, -1, 
-    -1, -1, 341, 679, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 384, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 650, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 714, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    418, 666, -1, -1, -1, -1, 213, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    215, 535, -1, 312, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, -1, 
-    -1, 497, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 209, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 757, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 331, -1, -1, 234, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 155, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 251, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 740, -1, -1, -1, -1, -1, 712, -1, -1, -1, -1, -1, -1, -1, 
-    765, -1, -1, -1, -1, -1, -1, -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 697, -1, -1, 42, -1, -1, -1, -1, -1, -1, 
-    -1, 594, -1, -1, -1, -1, -1, -1, -1, -1, 538, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 321, -1, 478, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 405, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 354, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 516, -1, -1, -1, 472, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 165, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 214, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 656, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 263, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    774, -1, -1, -1, -1, -1, 299, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 388, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 381, -1, -1, -1, -1, -1, 
-    -1, -1, 351, -1, -1, -1, 476, -1, -1, -1, -1, -1, -1, -1, -1, 375, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 736, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 790, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 620, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 752, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 390, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 732, 419, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 221, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 510, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 654, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 177, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 738, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 275, 768, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    560, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    15, -1, -1, 307, -1, -1, 107, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 219, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 448, -1, -1, -1, -1, 628, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 644, -1, -1, 396, -1, -1, -1, -1, 349, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 376, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 244, -1, -1, -1, 719, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 27, -1, -1, -1, -1, -1, -1, -1, 482, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 328, -1, -1, 368, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 301, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 311, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 572, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 356, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 253, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 138, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 455, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 180, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 347, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 300, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 394, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 447, -1, -1, -1, -1, -1, -1, -1, 789, -1, 393, -1, 639, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 646, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 682, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 210, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 605, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 525, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 544, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 651, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, 285, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 297, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 227, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 583, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 667, -1, -1, 270, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 410, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 382, -1, -1, -1, -1, -1, -1, 463, -1, 
-    -1, -1, -1, -1, -1, -1, 317, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 608, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 96, -1, 723, -1, -1, -1, -1, 762, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 260, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 502, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 577, -1, -1, -1, -1, -1, -1, -1, 39, -1, 
-    -1, 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 222, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    519, 11, -1, -1, -1, -1, -1, -1, -1, 562, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 686, -1, 
-    -1, -1, 520, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 536, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 239, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 78, 123, 445, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, 
-    -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 632, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 660, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 584, -1, -1, -1, -1, 506, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 557, -1, -1, 498, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 626, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 22, -1, 259, -1, -1, 88, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 314, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 129, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, 146, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 169, -1, -1, 339, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 590, -1, -1, -1, -1, -1, -1, -1, -1, -1, 495, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 663, -1, -1, -1, -1, -1, -1, -1, 34, 
-    -1, -1, -1, 289, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 548, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 230, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 362, -1, -1, -1, 
-    -1, -1, -1, -1, 779, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 318, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 627, -1, 141, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 517, -1, 327, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 424, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 721, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 653, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 182, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 183, 479, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    652, -1, -1, -1, 805, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 387, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 565, -1, -1, -1, -1, -1, -1, -1, -1, 675, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 348, -1, -1, -1, -1, 622, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 518, -1, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 496, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 231, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 435, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 319, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 122, -1, 345, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 185, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, -1, 
-    766, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 373, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 708, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 635, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 378, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 204, -1, -1, 133, -1, 258, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 625, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, 
-    28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 487, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 77, -1, -1, -1, -1, -1, 559, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 707, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 794, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    609, -1, -1, -1, -1, -1, -1, 439, 431, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 647, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 340, -1, 413, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 309, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 208, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 568, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 602, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 527, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 160, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 233, 566, -1, 
-    -1, -1, -1, -1, -1, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 279, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    385, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 330, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 450, 
-    -1, -1, -1, -1, -1, -1, -1, 788, 787, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 727, -1, -1, -1, -1, 550, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 281, 531, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 163, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 567, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 229, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, 661, 64, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 755, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    3, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 758, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 772, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    440, -1, -1, -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 397, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 512, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 237, -1, -1, 389, -1, -1, 
-    -1, -1, -1, 458, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 801, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 580, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 477, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 361, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    201, -1, -1, -1, 67, 715, 803, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 100, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    220, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 441, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 807, -1, -1, -1, 526, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 702, -1, -1, -1, -1, 132, 
-    -1, -1, -1, -1, -1, -1, 480, -1, -1, -1, -1, -1, -1, -1, -1, -1, 195, -1, 
-    -1, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 430, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 199, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 737, -1, -1, -1, -1, -1, -1, -1, -1, -1, 161, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 268, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, 
-    -1, -1, -1, -1, 576, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 633, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 775, 529, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 296, -1, 
-    287, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 569, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, 
-    -1, -1, 573, 511, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 797, -1, 415, -1, -1, -1, -1, -1, -1, -1, 782, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 409, -1, -1, -1, -1, -1, 403, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    454, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 247, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 600, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 400, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 689, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 543, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 706, 32, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 423, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 374, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 533, 408, -1, -1, -1, -1, 808, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 313, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 377, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 640, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, 564, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 174, -1, -1, -1, -1, -1, 553, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 563, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    269, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 589, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 358, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 143, -1, -1, -1, -1, -1, -1, -1, -1, 278, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 248, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 687, 
-    426, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 488, -1, -1, -1, 8, 412, -1, 14, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 671, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 524, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 411, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 401, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, 
-    -1, 551, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, 629, -1, -1, -1, -1, -1, 274, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 164, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    135, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    196, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 469, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, 295, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 86, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, -1, 802, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 399, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, 166, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 291, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, 188, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    158, -1, -1, -1, -1, -1, -1, -1, -1, -1, 595, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 642, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 586, -1, -1, -1, -1, 73, 
-    -1, -1, 353, -1, -1, -1, -1, 570, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 443, -1, -1, -1, -1, 
-    481, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, 771, -1, -1, -1, -1, -1, -1, -1, 147, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 436, -1, -1, -1, -1, -1, -1, 442, -1, -1, -1, -1, -1, -1, 
-    79, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 611, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 534, -1, -1, -1, -1, -1, -1, 51, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 735, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 783, -1, 
-    -1, -1, 13, -1, -1, -1, -1, -1, -1, 729, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 391, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 294, -1, -1, -1, 197, -1, -1, -1, -1, -1, -1, -1, 777, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 457, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 796, -1, -1, -1, 709, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 407, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, 
-    -1, -1, 657, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 288, -1, 471, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, 392, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    554, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, 786, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1 
-  );
-
-{$Q-}
-function TSynFoxproSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 934 + Ord(Str^) * 420;
-    Inc(Str);
-  end;
-  Result := Result mod 17909;
-  FStringLen := Str - FToIdent;
-end;
-{$Q+}
-
-function TSynFoxproSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
+  KeyWords: string =
+    '_curobj, _msysmenu, _pageno, _screen, _vfp, abs, accept, aclass, acopy, acos, ' +
+    'acti, activate, adatabases, adbobjects, add, additive, adel, adir, aelement, ' +
+    'aerror, afields, afont, after, again, ains, ainstance, alen, alias, alines, ' +
+    'all, alltrim, alt, alter, alternate, amembers, and, ansi, ansitooem, any, ' +
+    'aplabout, app, appe, append, application, aprinters, array, as, asc, ascan, ' +
+    'ascending, ascii, aselobj, asin, asort, assert, asserts, assist, asubscript, ' +
+    'at, at_c, atan, atc, atcc, atcline, atline, atn2, aused, auto, autoincerror, ' +
+    'autosave, average, avg, backcolor, bar, barcount, barprompt, baseclass, before,' +
+     'begin, bell, between, bintoc, bitand, bitclear, bitlshift, bitnot, bitor, ' +
+    'bitrshift, bitset, bittest, bitxor, blan, blank, blink, blocksize, bof, border, ' +
+     'bott, bottom, box, brow, browse, browseime, brstatus, build, by, calculate, ' +
+    'call, cancel, candidate, capslock, caption, carry, case, catch, cd, cdow, cdx, ' +
+    'ceiling, century, class, classlib, clear, clock, clos, close, cls, cmonth, cnt, ' +
+     'cntbar, cntpad, codepage, col, collate, color, colorscheme, comm, command, ' +
+    'commands, comment, compact, compatible, compile, compobj, confirm, connection, ' +
+    'connections, connstring, console, continue, copy, cos, count, coverage, ' +
+    'cpcompile, cpconvert, cpcurrent, cpdbf, cpdialog, cpnotrans, create, ' +
+    'createobject, createoffline, ctobin, ctod, ctot, curdir, currency, cursor, ' +
+    'curval, custom, cycle, database, databases, datasession, date, ' +
+    'dateformat, datemark, datetime, day, dbalias, dbc, dbf, dbused, ddeaborttrans, ' +
+    'ddeadvise, ddeenabled, ddeexecute, ddeinitiate, ddelasterror, ddepoke, ' +
+    'dderequest, ddesetoption, ddesetservice, ddesettopic, ddeterminate, deactivate, ' +
+     'debug, debugout, decimals, declare, default, define, dele, delete, ' +
+     'deleted, delimite, delimited, delimiters, descending, desktop, development, ' +
+    'device, dif, difference, dim, dimension, dir, directory, disable, ' +
+    'diskspace, display, displayvalue, distinct, dll, dlls, dmy, do, dock, ' +
+    'dodefault, doevents, dohistory, double, dow, drop, dtoc, dtor, dtos, dtot, ' +
+    'each, edit, echo, eject, else, empty, enable, end, endcase, ' +
+    'enddefine, enddo, endfor, endfunc, endif, endprintjob, endproc, endscan, ' +
+    'endtext, endwith, enginebehavior, environment, eof, erase, error, escape, ' +
+    'evaluate, event, eventhandler, eventlist, events, eventtracking, exact, except, ' +
+     'exclusive, exe, exists, exit, exp, export, expression, extended, external, ' +
+    'false, fclose, fcount, fcreate, fdow, feof, ferror, fetch, fflush, fgets, fchsize, ' +
+    'field, fields, file, files, fill, filter, finally, find, fixed, fklabel, fkmax, ' +
+     'float, flock, floor, flush, font, fontmetric, footer, fopen, for, force, ' +
+    'foreign, form, format, found, fox2x, foxplus, foxpro), fputs, fread, free, ' +
+    'freeze, from, fseek, fsize, fullpath, func, functi, function, fv, fw2, fweek, ' +
+    'fwrite, gath, gather, general, get, getbar, getcolor, getcp, getdir, getenv, ' +
+    'getexpr, getfile, getfldstate, getfont, getnextmodified, getobject, getpad, ' +
+    'getpict, getprinter, gets, global, go, gomonth, gotfocus, goto, group, grow, ' +
+    'halfheight, having, header, heading, headings, height, help, helpcontextid, ' +
+    'helpfilter, hidden, hide, highlight, hour, hours, change, char, chdir, ' +
+    'check, chr, chrsaw, chrtran, chrtranc, icon, id, idxcollate, if, ifdef, ifndef, ' +
+     'iif, import, in, include, indbc, index, indexes, inkey, inlist, input, insert, ' +
+     'insmode, int, integer, intensity, interval, into, is, isalpha, iscolor, ' +
+    'isdigit, isexclusive, isflocked, islower, isnull, isreadonly, isrlocked, ' +
+    'isupper, join, key, keyboard, keycomp, keymatch, label, last, lastkey, ledit, ' +
+    'left, leftc, len, lenc, level, library, like, line, lineno, linked, list, ' +
+     'load, loadpicture, local, locate, locfile, lock, lockscreen, log, log10, ' +
+    'logerrors, logout, long, lookup, loop, lower, lparameter, lparameters, ' +
+    'lpartition, ltrim, lupdate, macdesktop, mackey, macro, macros, machelp, margin, ' +
+     'mark, master, max, mcol, md, mdown, mdx, mdy, memlines, memo, memory, memos, ' +
+    'memowidth, memvar, menu, menus, message, messagebox, messages, middle, min, ' +
+    'minimize, minute, mkdir, mline, mod, modal, modi, modify, module, month, mouse, ' +
+     'movable, move, moved, mover, mrkbar, mrkpad, mrow, mtdll, mton, multilocks, ' +
+    'multiselect, mvcount, mwindow, name, ndx, near, negotiate, network, newobject, ' +
+    'next, noalias, noappend, noclear, noclose, noconsole, nocptrans, nodata, ' +
+    'nodebug, nodefault, nodelete, noedit, noeject, noenvironment, nofloat, nogrow, ' +
+    'noinit, nolgrid, nolink, nolock, nomargin, nomdi, nomenu, nominimize, nomodify, ' +
+     'nomouse, none, nooptimize, nooverwrite, noprompt, noread, norefresh, ' +
+    'norequery, norgrid, normal, normalize, nosave, noshadow, noshow, nospace, not, ' +
+    'note, notify, noupdate, novalidate, noverify, nowait, nowindow, nowrap, nozoom, ' +
+     'npv, ntom, null, nulldisplay, number, numlock, nvl, object, objects, ' +
+    'objnum, objtoclient, objvar, occurs, odometer, oemtoansi, of, off, oldval, ' +
+    'oleclass, olecontrol, oleobject, olepublic, on, only, open, optimize, or, ' +
+    'order, os, otherwise, outer, overview, overwrite, pack, pad, padc, padl, padr, ' +
+    'page, palette, panel, para, parameter, parameters, partition, path, payment, ' +
+    'pcol, pdox, pdsetup, pen, pi, pictres, picture, pixels, plain, play, point, ' +
+    'pop, popup, popups, preference, preview, primary, print, printer, printjob, ' +
+    'printstatus, private, prmbar, prmpad, proc, proced, procedure, procedures, ' +
+    'production, program, project, prompt, proper, protected, prow, prtinfo, public, ' +
+     'push, putfile, pv, query, quit, rand, range, rat, ratc, ratline, rd, rdlevel, ' +
+    'read, readborder, readerror, readkey, recall, reccount, recno, record, recover, ' +
+     'recsize, redit, reference, references, refresh, region, regional, reindex, ' +
+    'rela, relati, relation, relative, release, remote, remove, rename, repl, repla, ' +
+     'replace, replicate, report, reprocess, requery, reset, resizable, resize, ' +
+    'resource, resources, rest, restore, resume, retry, retu, return, rgb, ' +
+    'rgbscheme, right, rightc, rightclick, righttoleft, rlock, rmdir, rollback, ' +
+    'round, row, rtod, rtrim, run, runscript, runtime, safety, same, save, say, ' +
+    'scan, scat, scatt, scatter, scols, scoreboard, screen, scroll, sdf, ' +
+    'second, seconds, seek, sele, select, selected, selection, separator, ' +
+    'set, shadow, shadows, shape, show, shutdown, scheme, ' +
+    'schemes, sign, sin, single, sizable, size, skip, skpbar, skppad, some, sort, ' +
+    'sorted, soundex, space, sql, sqlcommit, sqlrollback, sqlstringconnect, sqrt, ' +
+    'srows, status, statusbartext, std, step, sticky, store, str, strconv, ' +
+    'strictdate, string, strtran, structure, stuff, stuffc, style, sub, substr, substrc, ' +
+    'sum, summary, suspend, sylk, sys, sysformats, sysmenu, sysmenus, sysmetric, ' +
+    'system, tab, tabindex, table, tablerevert, tables, tableupdate, tablevalidate, ' +
+    'tabstop, tag, talk, tan, target, text, textmerge, textwidth, then, this, thisform, ' +
+    'thisformset, time, timeout, timer, title, titles, to, top, topic, total, ' +
+    'transaction, transform, trap, trbetween, trigger, trim, true, try, ttoc, ttod, ' +
+    'txnlevel, txtwidth, type, typeahead, udfparms, undefine, union, unique, unlock, ' +
+     'unpack, until, update, updated, upper, use, used, val, valid, validate, value, ' +
+    'values, var, varread, vartype, version, view, views, volume, wait, wborder, ' +
+    'wcols, week, wexist, wfont, when, where, while, wchild, width, window, ' +
+    'windowlist, windows, with, wk1, wk3, wks, wlast, wlcol, wlrow, wontop, ' +
+    'workarea, woutput, wparent, wr1, wrap, wread, writeexpression, writemethod, ' +
+    'wrk, wrows, wtitle, wvisible, xcmdfile, xl5, xls, year, zap, zoom, zorder, ' +
+    'zorderset';
+
+function TSynFoxProSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
-  Key: Cardinal;
-begin
-  FToIdent := MayBe;
-  Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  S: string;
+begin
+  fToIdent := MayBe;
+  while IsIdentChar(MayBe^) do
+    Inc(Maybe);
+  fStringLen := Maybe - fToIdent;
+  SetString(S, fToIdent, fStringLen);
+  if FKeywords.ContainsKey(S) then
+    Result := FKeywords[S]
   else
     Result := tkIdentifier;
 end;
 
-procedure TSynFoxproSyn.InitIdent;
-var
-  i: Integer;
+constructor TSynFoxproSyn.Create(AOwner: TComponent);
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
+  inherited Create(AOwner);
 
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if @FIdentFuncTable[i] = nil then
-      FIdentFuncTable[i] := KeyWordFunc;
-end;
+  fCaseSensitive := False;
+  // Create the keywords dictionary case-insensitive
+  FKeywords := TDictionary.Create(TIStringComparer.Ordinal);
+
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  AddAttribute(fCommentAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  AddAttribute(fKeyAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
+  SetAttributesOnChange(DefHighlightChange);
+  fDefaultFilter := SYNS_FilterFoxpro;
 
-function TSynFoxproSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
+  EnumerateKeywords(Ord(tkKey), KeyWords, IsIdentChar, DoAddKeyword);
+  RE_BlockBegin := CompiledRegEx('\b(function |procedure )\b', [roIgnoreCase]);
+  RE_BlockEnd := CompiledRegEx('\b(endproc|endfunc)\b', [roIgnoreCase]);
 end;
 
-function TSynFoxproSyn.KeyWordFunc(Index: Integer): TtkTokenKind;
+const
+  FT_Standard = 1;  // begin end, class end, record end
+  FT_Comment = 11;
+  FT_CodeDeclaration = 16;
+  FT_CodeDeclarationWithBody = 17;
+  FT_Implementation = 18;
+
+procedure TSynFoxproSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges;
+      LinesToScan: TStrings; FromLine: Integer; ToLine: Integer);
+var
+  CurLine: string;
+  Line: Integer;
+  ok: Boolean;
+
+  function BlockDelimiter(Line: Integer): Boolean;
+  var
+    Index: Integer;
+    mcb: TMatchCollection;
+    mce: TMatchCollection;
+    match: TMatch;
+  begin
+    Result := False;
+
+    mcb := RE_BlockBegin.Matches(CurLine);
+    if mcb.Count > 0 then
+    begin
+      // Char must have proper highlighting (ignore stuff inside comments...)
+      Index :=  mcb.Item[0].Index;
+      if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then
+      begin
+        ok := False;
+        // And ignore lines with both opening and closing chars in them
+        for match in Re_BlockEnd.Matches(CurLine) do
+          if match.Index > Index then
+          begin
+            OK := True;
+            Break;
+          end;
+        if not OK then begin
+          FoldRanges.StartFoldRange(Line + 1, FT_Standard);
+          Result := True;
+        end;
+      end;
+    end
+    else
+    begin
+      mce := RE_BlockEnd.Matches(CurLine);
+      if mce.Count > 0 then
+      begin
+        Index :=  mce.Item[0].Index;
+        if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then
+        begin
+          FoldRanges.StopFoldRange(Line + 1, FT_Standard);
+          Result := True;
+        end;
+      end;
+    end;
+  end;
+
+  function FoldRegion(Line: Integer): Boolean;
+  var
+    S: string;
+  begin
+    Result := False;
+    S := TrimLeft(CurLine);
+    if Uppercase(Copy(S, 1, 7)) = '*REGION' then
+    begin
+      FoldRanges.StartFoldRange(Line + 1, FoldRegionType);
+      Result := True;
+    end
+    else if Uppercase(Copy(S, 1, 11)) = '*ENDREGION' then
+    begin
+      FoldRanges.StopFoldRange(Line + 1, FoldRegionType);
+      Result := True;
+    end;
+  end;
+
 begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier
+  for Line := FromLine to ToLine do
+  begin
+    // Deal first with Multiline statements
+
+    CurLine := LinesToScan[Line];
+
+    // Skip empty lines
+    if CurLine = '' then begin
+      FoldRanges.NoFoldInfo(Line + 1);
+      Continue;
+    end;
+
+    // Find Fold regions
+    if FoldRegion(Line) then
+      Continue;
+
+    // Find begin or end  (Fold Type 1)
+    if not BlockDelimiter(Line) then
+      FoldRanges.NoFoldInfo(Line + 1);
+  end; //for Line
 end;
 
-constructor TSynFoxproSyn.Create(AOwner: TComponent);
+procedure TSynFoxproSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges;
+      LinesToScan: TStrings);
+{
+   Provide folding for procedures and functions included nested ones.
+}
+var
+  I, J, SkipTo: Integer;
+  ImplementationIndex: Integer;
+  FoldRange: TSynFoldRange;
+  mc: TMatchCollection;
 begin
-  inherited Create(AOwner);
-
-  FCaseSensitive := False;
-
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  AddAttribute(FCommentAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  AddAttribute(FKeyAttri);
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  FDefaultFilter := SYNS_FilterFoxpro;
+  ImplementationIndex := - 1;
+  for I  := FoldRanges.Ranges.Count - 1 downto 0 do
+  begin
+    if FoldRanges.Ranges.List[I].FoldType = FT_Implementation then
+      ImplementationIndex := I
+    else
+    if FoldRanges.Ranges.List[I].FoldType = FT_CodeDeclaration then
+    begin
+      if ImplementationIndex >= 0 then begin
+        // Code declaration in the Interface part of a unit
+        FoldRanges.Ranges.Delete(I);
+        Dec(ImplementationIndex);
+        Continue;
+      end;
+      // Examine the following ranges
+      SkipTo := 0;
+      J := I + 1;
+      while J < FoldRanges.Ranges.Count do begin
+        FoldRange := FoldRanges.Ranges.List[J];
+        Inc(J);
+        case FoldRange.FoldType of
+          // Nested procedure or function
+          FT_CodeDeclarationWithBody:
+            begin
+              SkipTo := FoldRange.ToLine;
+              Continue;
+            end;
+          FT_Standard:
+          // possibly begin end;
+            if FoldRange.ToLine <= SkipTo then
+              Continue
+            else
+            begin
+              mc := RE_BlockBegin.Matches(LinesToScan[FoldRange.FromLine - 1]);
+              if mc.Count > 0 then
+              begin
+                if mc.Item[0].Value.ToLower = 'begin' then
+                begin
+                  // function or procedure followed by begin end block
+                  // Adjust ToLine
+                  FoldRanges.Ranges.List[I].ToLine := FoldRange.ToLine;
+                  FoldRanges.Ranges.List[I].FoldType := FT_CodeDeclarationWithBody;
+                  Break
+                end else
+                begin
+                  // class or record declaration follows, so
+                  FoldRanges.Ranges.Delete(I);
+                  Break;
+                 end;
+              end else
+                Assert(False, 'TSynVBSSyn.AdjustFoldRanges');
+            end;
+        else
+          begin
+            if FoldRange.ToLine <= SkipTo then
+              Continue
+            else begin
+              // Otherwise delete
+              // eg. function definitions within a class definition
+              FoldRanges.Ranges.Delete(I);
+              Break
+            end;
+          end;
+        end;
+      end;
+    end;
+  end;
+  if ImplementationIndex >= 0 then
+    // Looks better without it
+    //FoldRanges.Ranges.List[ImplementationIndex].ToLine := LinesToScan.Count;
+    FoldRanges.Ranges.Delete(ImplementationIndex);
 end;
 
 procedure TSynFoxproSyn.AndSymbolProc;
@@ -1306,12 +491,11 @@ procedure TSynFoxproSyn.AndSymbolProc;
     '&':                               {Comments}
       begin
         Inc(Run, 2);
-        FTokenID := tkComment;
+        fTokenID := tkComment;
         while FLine[Run] <> #0 do
         begin
           case FLine[Run] of
-            #10, #13:
-              Break;
+            #10, #13: Break;
           end; //case
           Inc(Run);
         end;
@@ -1319,18 +503,17 @@ procedure TSynFoxproSyn.AndSymbolProc;
   else                                 {and}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
 
 procedure TSynFoxproSyn.AsciiCharProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
     case FLine[Run] of
-      #0, #10, #13:
-        Break;
+      #0, #10, #13: Break;
     end;
     Inc(Run);
   until FLine[Run] = #39;
@@ -1339,17 +522,16 @@ procedure TSynFoxproSyn.AsciiCharProc;
 
 procedure TSynFoxproSyn.AtSymbolProc;
 begin
-  FTokenID := tkKey;
+  fTokenID := tkKey;
   Inc(Run);
 end;
 
 procedure TSynFoxproSyn.BraceOpenProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
     case FLine[Run] of
-      #0, #10, #13:
-        Break;
+      #0, #10, #13: Break;
       #92:
         if FLine[Run + 1] = #10 then Inc(Run);
     end;
@@ -1360,24 +542,36 @@ procedure TSynFoxproSyn.BraceOpenProc;
 
 procedure TSynFoxproSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   case FLine[Run + 1] of
     #10: Inc(Run, 2);
     else Inc(Run);
   end;
 end;
 
+destructor TSynFoxproSyn.Destroy;
+begin
+  fKeywords.Free;
+  inherited;
+end;
+
+procedure TSynFoxproSyn.DoAddKeyword(AKeyword: string; AKind: Integer);
+begin
+  if not FKeywords.ContainsKey(AKeyword) then
+    FKeywords.Add(AKeyword, TtkTokenKind(AKind));
+end;
+
 procedure TSynFoxproSyn.ColonProc;
 begin
   {colon}
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.CommaProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.EqualProc;
@@ -1386,23 +580,23 @@ procedure TSynFoxproSyn.EqualProc;
     '=':                               {logical equal}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {assign}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
 
 procedure TSynFoxproSyn.GreaterProc;
 begin
-  case FLine[Run + 1] of
+  Case FLine[Run + 1] of
     '=':                               {greater than or equal to}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
     '>':
       begin
@@ -1410,26 +604,26 @@ procedure TSynFoxproSyn.GreaterProc;
           Inc(Run, 3)
         else                           {shift right}
           Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {greater than}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
 
 procedure TSynFoxproSyn.IdentProc;
 begin
-  FTokenID := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  fTokenID := IdentKind((fLine + Run));
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
 end;
 
 procedure TSynFoxproSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
@@ -1439,7 +633,7 @@ procedure TSynFoxproSyn.LowerProc;
     '=':                               {less than or equal to}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
     '<':
       begin
@@ -1447,12 +641,12 @@ procedure TSynFoxproSyn.LowerProc;
           Inc(Run, 3)
         else                           {shift left}
           Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
       end;
   else                                 {less than}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
     end;
   end;
 end;
@@ -1461,26 +655,26 @@ procedure TSynFoxproSyn.MinusProc;
 begin
   {subtract}
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.ModSymbolProc;
 begin
   {mod}
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.NotSymbolProc;
 begin
   {not}
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -1488,7 +682,7 @@ procedure TSynFoxproSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', '.', 'x', 'X', 'e', 'E', 'f', 'F':
         Result := True;
       else
@@ -1498,13 +692,12 @@ procedure TSynFoxproSyn.NumberProc;
 
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar do
   begin
     case FLine[Run] of
       '.':
-        if FLine[Run + 1] = '.' then
-          Break;
+        if FLine[Run + 1] = '.' then Break;
     end;
     Inc(Run);
   end;
@@ -1514,111 +707,110 @@ procedure TSynFoxproSyn.OrSymbolProc;
 begin
   {or}
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.PlusProc;
 begin
   {subtract}
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.PointProc;
 begin
-  if ((SynWideUpperCase(FLine[Run + 1]) = 'T') or      {.t.}
-    (SynWideUpperCase(FLine[Run + 1]) = 'F')) and     {.f.}
+  if ((UpperCase(FLine[Run + 1]) = 'T') or      {.t.}
+    (UpperCase(FLine[Run + 1]) = 'F')) and     {.f.}
     (FLine[Run + 2] = '.') then
   begin
     Inc(Run, 3);
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
   end
-  else if (((SynWideUpperCase(FLine[Run + 1]) = 'A') and
-    (SynWideUpperCase(FLine[Run + 2]) = 'N') and
-    (SynWideUpperCase(FLine[Run + 3]) = 'D')) or   {.and.}
-    ((SynWideUpperCase(FLine[Run + 1]) = 'N') and
-    (SynWideUpperCase(FLine[Run + 2]) = 'O') and
-    (SynWideUpperCase(FLine[Run + 3]) = 'T'))) and   {.not.}
+  else if (((UpperCase(FLine[Run + 1]) = 'A') and
+    (UpperCase(FLine[Run + 2]) = 'N') and
+    (UpperCase(FLine[Run + 3]) = 'D')) or   {.and.}
+    ((UpperCase(FLine[Run + 1]) = 'N') and
+    (UpperCase(FLine[Run + 2]) = 'O') and
+    (UpperCase(FLine[Run + 3]) = 'T'))) and   {.not.}
     (FLine[Run + 4] = '.') then
   begin
     Inc(Run, 5);
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
   end
-  else if (SynWideUpperCase(FLine[Run + 1]) = 'O') and
-    (SynWideUpperCase(FLine[Run + 2]) = 'R') and
+  else if (UpperCase(FLine[Run + 1]) = 'O') and
+    (UpperCase(FLine[Run + 2]) = 'R') and
     (FLine[Run + 3] = '.') then  {.or.}
   begin
     Inc(Run, 4);
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
   end
   else                                 {point}
   begin
     Inc(Run);
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynFoxproSyn.QuestionProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.RoundCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.RoundOpenProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.SemiColonProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.SlashProc;
 begin
   {division}
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynFoxproSyn.SquareCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.SquareOpenProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.StarProc;
 begin
-  if (Run = 0) or (WideTrim(Copy(FLine, 1, Run)) = '') then
+  if (Run = 0) or (Trim(Copy(fLine, 1, Run)) = '') then
   begin                        {Foxpro Comments}
     Inc(Run);
-    FTokenID := tkComment;
+    fTokenID := tkComment;
     while FLine[Run] <> #0 do
     begin
       case FLine[Run] of
-        #10, #13:
-          Break;
+        #10, #13: Break;
       end;
       Inc(Run);
     end;
@@ -1627,21 +819,19 @@ procedure TSynFoxproSyn.StarProc;
   begin
     {star}
     Inc(Run);
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynFoxproSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2);
   repeat
     case FLine[Run] of
-      #0, #10, #13:
-        Break;
+      #0, #10, #13: Break;
       #92:
-        if FLine[Run + 1] = #10 then
-          Inc(Run);
+        if FLine[Run + 1] = #10 then Inc(Run);
     end;
     Inc(Run);
   until FLine[Run] = #34;
@@ -1651,26 +841,26 @@ procedure TSynFoxproSyn.StringProc;
 procedure TSynFoxproSyn.TildeProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.XOrSymbolProc;
 begin
   {xor}
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
 end;
 
 procedure TSynFoxproSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynFoxproSyn.Next;
 begin
-  FTokenPos := Run;
-  case FLine[Run] of
+  fTokenPos := Run;
+  case fLine[Run] of
     '&': AndSymbolProc;
     #39: AsciiCharProc;
     '@': AtSymbolProc;
@@ -1711,12 +901,12 @@ procedure TSynFoxproSyn.Next;
 function TSynFoxproSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -1724,52 +914,92 @@ function TSynFoxproSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttri
 
 function TSynFoxproSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynFoxproSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynFoxproSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
   case GetTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkUnknown: Result := FIdentifierAttri;
-    else
-      Result := nil;
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkUnknown: Result := fIdentifierAttri;
+    else Result := nil;
   end;
 end;
 
 function TSynFoxproSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
 function TSynFoxproSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterFoxpro;
-end;
-
-class function TSynFoxproSyn.GetLanguageName: string;                    
+  Result := fDefaultFilter <> SYNS_FilterFoxpro;
+end;
+
+function TSynFoxproSyn.GetSampleSource: string;
+begin
+  Result :=
+    '* Some sample Foxpro code to test highlighting' + #13#10 +
+    'CLEAR ALL' + #13#10 +
+    'SET CONFIRM  ON' + #13#10 +
+    '' + #13#10 +
+    'PROCEDURE ErrTrap' + #13#10 +
+    'LPARAMETERS nLine, cProg, cMessage, cMessage1' + #13#10 +
+    'OnError = ON("Error")' + #13#10 +
+    'ON ERROR' + #13#10 +
+    'IF NOT FILE ( [ERRORS.DBF] )' + #13#10 +
+    '  CREATE TABLE ERRORS (  ;' + #13#10 +
+    '  Date   Date,     ;' + #13#10 +
+    '  Time   Char(5),   ;' + #13#10 +
+    '  LineNum Integer,   ;' + #13#10 +
+    '  ProgName Char(30),   ;' + #13#10 +
+    '  Msg   Char(240),  ;' + #13#10 +
+    '  CodeLine Char(240)   )' + #13#10 +
+    'ENDIF' + #13#10 +
+    'IF NOT USED ( [Errors] )' + #13#10 +
+    '  USE ERRORS IN 0' + #13#10 +
+    'ENDIF' + #13#10 +
+    'SELECT Errors' + #13#10 +
+    'INSERT INTO Errors VALUES ( ;' + #13#10 +
+    ' DATE(), LEFT(TIME(),5), nLine, cProg, cMessage, cMessage1 )' + #13#10 +
+    'USE IN Errors' + #13#10 +
+    'cStr = [Error at line ] + TRANSFORM(nLine) + [ of ] + cprog + [:] + CHR(13)  ;' + #13#10 +
+    '   + cMessage + CHR(13) + [Code that caused the error:] + CHR(13) + cMessage1' + #13#10 +
+    'IF MESSAGEBOX( cStr, 292, [Continue] ) <> 6' + #13#10 +
+    '  SET SYSMENU TO DEFAULT' + #13#10 +
+    '  IF TYPE ( [_Screen.Title1] ) <> [U]' + #13#10 +
+    '   _Screen.RemoveObject ( [Title2] )' + #13#10 +
+    '   _Screen.RemoveObject ( [Title1] )' + #13#10 +
+    '  ENDIF' + #13#10 +
+    '  CLOSE ALL' + #13#10 +
+    '  RELEASE ALL' + #13#10 +
+    '  CANCEL' + #13#10 +
+    ' ELSE' + #13#10 +
+    '  ON ERROR &OnError' + #13#10 +
+    'ENDIF';
+end;
+
+class function TSynFoxproSyn.GetLanguageName: string;
 begin
   Result := SYNS_LangFoxpro;
 end;
 
-class function TSynFoxproSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynFoxproSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangFoxpro;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynFoxproSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterGLSL.pas b/Ext/SynEdit/Source/SynHighlighterGLSL.pas
deleted file mode 100644
index a6aa6e2..0000000
--- a/Ext/SynEdit/Source/SynHighlighterGLSL.pas
+++ /dev/null
@@ -1,1623 +0,0 @@
-{-------------------------------------------------------------------------------
-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: SynHighlighterCpp.pas, released 2000-04-10.
-The Original Code is based on the dcjCppSyn.pas file from the
-mwEdit component suite by Martin Waldenburg and other developers, the Initial
-Author of this file is Michael Trier.
-Unicode translation by Maël Hörz.
-All Rights Reserved.
-
-Contributors to the SynEdit and mwEdit projects are listed in the
-Contributors.txt file.
-
-Alternatively, the contents of this file may be used under the terms of the
-GNU General Public License Version 2 or later (the "GPL"), in which case
-the provisions of the GPL are applicable instead of those above.
-If you wish to allow use of your version of this file only under the terms
-of the GPL and not to allow others to use your version of this file
-under the MPL, indicate your decision by deleting the provisions above and
-replace them with the notice and other provisions required by the GPL.
-If you do not delete the provisions above, a recipient may use your version
-of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterCpp.pas,v 1.22.2.9 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-{
-@abstract(Provides a C++ syntax highlighter for SynEdit)
-@author(Michael Trier)
-@created(1998)
-@lastmod(2001-11-21)
-The SynHighlighterCpp unit provides SynEdit with a C++ syntax highlighter.
-Thanks to Martin Waldenburg.
-}
-
-unit SynHighlighterGLSL;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (tkComment, tkDirective, tkIdentifier, tkInterfaceQualifier,
-    tkInternalFunction, tkKey, tkNull, tkNumber, tkSpace, tkString, tkSymbol,
-    tkUnknown, tkChar, tkFloat, tkHex, tkOctal);
-
-  TxtkTokenKind = (
-    xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkArrow, xtkAssign,
-    xtkBitComplement, xtkBraceClose, xtkBraceOpen, xtkColon, xtkComma,
-    xtkDecrement, xtkDivide, xtkDivideAssign, xtkEllipse, xtkGreaterThan,
-    xtkGreaterThanEqual, xtkIncOr, xtkIncOrAssign, xtkIncrement, xtkLessThan,
-    xtkLessThanEqual, xtkLogAnd, xtkLogComplement, xtkLogEqual, xtkLogOr,
-    xtkMod, xtkModAssign, xtkMultiplyAssign, xtkNotEqual, xtkPoint, xtkQuestion,
-    xtkRoundClose, xtkRoundOpen, xtkScopeResolution, xtkSemiColon, xtkShiftLeft,
-    xtkShiftLeftAssign, xtkShiftRight, xtkShiftRightAssign, xtkSquareClose,
-    xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor,
-    xtkXorAssign);
-
-  TRangeState = (rsUnknown, rsAnsiC, rsDirective, rsDirectiveComment,
-    rsMultiLineString, rsMultiLineDirective);
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer; MayBe: PWideChar): TtkTokenKind of object;
-
-  TSynGLSLSyn = class(TSynCustomHighlighter)
-  private
-    FAsmStart: Boolean;
-    FRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    FExtTokenID: TxtkTokenKind;
-    FIdentFuncTable: array[0..2010] of TIdentFuncTableFunc;
-    FInternalFuncTable: array[0..1050] of TIdentFuncTableFunc;
-    FInterfaceQualifierAttri: TSynHighlighterAttributes;
-    FInternalFunctionsAttri: TSynHighlighterAttributes;
-    FCommentAttri: TSynHighlighterAttributes;
-    FDirecAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FInvalidAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FFloatAttri: TSynHighlighterAttributes;
-    FHexAttri: TSynHighlighterAttributes;
-    FOctalAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FCharAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    function AltFunc(Index: Integer; Maybe: PWideChar): TtkTokenKind;
-    function AltFinalFunc(Index: Integer; Maybe: PWideChar): TtkTokenKind;
-    function InternalFunc(Index: Integer; MayBe: PWideChar): TtkTokenKind;
-    function KeyWordFunc(Index: Integer; MayBe: PWideChar): TtkTokenKind;
-    function InterfaceQualifierFunc(Index: Integer; MayBe: PWideChar): TtkTokenKind;
-    function HashKey(Str: PWideChar): Cardinal;
-    function HashInternal(Str: PWideChar): Cardinal;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure InitIdent;
-    procedure AnsiCProc;
-    procedure AndSymbolProc;
-    procedure AsciiCharProc;
-    procedure AtSymbolProc;
-    procedure BraceCloseProc;
-    procedure BraceOpenProc;
-    procedure CRProc;
-    procedure ColonProc;
-    procedure CommaProc;
-    procedure DirectiveProc;
-    procedure DirectiveEndProc;
-    procedure EqualProc;
-    procedure GreaterProc;
-    procedure IdentProc;
-    procedure LFProc;
-    procedure LowerProc;
-    procedure MinusProc;
-    procedure ModSymbolProc;
-    procedure NotSymbolProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure OrSymbolProc;
-    procedure PlusProc;
-    procedure PointProc;
-    procedure QuestionProc;
-    procedure RoundCloseProc;
-    procedure RoundOpenProc;
-    procedure SemiColonProc;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure SquareCloseProc;
-    procedure SquareOpenProc;
-    procedure StarProc;
-    procedure StringProc;
-    procedure TildeProc;
-    procedure XOrSymbolProc;
-    procedure UnknownProc;
-    procedure StringEndProc;
-  protected
-    function GetExtTokenID: TxtkTokenKind;
-    function GetSampleSource: UnicodeString; override;
-    function IsFilterStored: Boolean; override;
-  public
-    class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
-      override;
-    function GetEol: Boolean; override;
-    function GetRange: Pointer; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: Integer; override;
-    procedure Next; override;
-    procedure SetRange(Value: Pointer); override;
-    procedure ResetRange; override;
-
-    property ExtTokenID: TxtkTokenKind read GetExtTokenID;
-  published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property DirecAttri: TSynHighlighterAttributes read FDirecAttri
-      write FDirecAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property InterfaceQualifierAttri: TSynHighlighterAttributes
-      read FInterfaceQualifierAttri write FInterfaceQualifierAttri;
-    property InternalFunctions: TSynHighlighterAttributes
-      read FInternalFunctionsAttri write FInternalFunctionsAttri;
-    property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri
-      write FInvalidAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property FloatAttri: TSynHighlighterAttributes read FFloatAttri
-      write FFloatAttri;
-    property HexAttri: TSynHighlighterAttributes read FHexAttri
-      write FHexAttri;
-    property OctalAttri: TSynHighlighterAttributes read FOctalAttri
-      write FOctalAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property CharAttri: TSynHighlighterAttributes read FCharAttri
-      write FCharAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
-  end;
-
-implementation
-
-uses
-  Windows,
-  SynEditStrConst;
-
-const
-  // as this language is case-insensitive keywords *must* be in lowercase
-  GKeyWords: array[0..239] of UnicodeString = (
-    'active', 'asm', 'atomic_uint', 'attribute', 'bool', 'break', 'buffer',
-    'bvec2', 'bvec3', 'bvec4', 'case', 'cast', 'centroid', 'class', 'coherent',
-    'common', 'const', 'continue', 'def', 'default', 'discard', 'dmat2',
-    'dmat2x2', 'dmat2x3', 'dmat2x4', 'dmat3', 'dmat3x2', 'dmat3x3', 'dmat3x4',
-    'dmat4', 'dmat4x2', 'dmat4x3', 'dmat4x4', 'do', 'double', 'dvec2', 'dvec3',
-    'dvec4', 'else', 'enum', 'extern', 'external', 'false', 'filter', 'fixed',
-    'flat', 'float', 'for', 'fvec2', 'fvec3', 'fvec4', 'goto', 'half', 'highp',
-    'hvec2', 'hvec3', 'hvec4', 'if', 'iimage1d', 'iimage1darray', 'iimage2d',
-    'iimage2darray', 'iimage2dms', 'iimage2dmsarray', 'iimage2drect',
-    'iimage3d', 'iimagebuffer', 'iimagecube', 'iimagecubearray', 'image1d',
-    'image1darray', 'image2d', 'image2darray', 'image2dms', 'image2dmsarray',
-    'image2drect', 'image3d', 'imagebuffer', 'imagecubearray', 'in', 'inline',
-    'inout', 'input', 'int', 'interface', 'invariant', 'isampler1d',
-    'isampler1darray', 'isampler2d', 'isampler2darray', 'isampler2dms',
-    'isampler2dmsarray', 'isampler2drect', 'isampler3d', 'isamplerbuffer',
-    'isamplercube', 'isamplercubearray', 'isubpassinput', 'isubpassinputms',
-    'itexture1d', 'itexture1darray', 'itexture2d', 'itexture2darray',
-    'itexture2dms', 'itexture2dmsarray', 'itexture2drect', 'itexture3d',
-    'itexturebuffer', 'itexturecube', 'itexturecubearray', 'ivec2', 'ivec3',
-    'ivec4', 'layout', 'long', 'lowp', 'mat2', 'mat2x2', 'mat2x3', 'mat2x4',
-    'mat3', 'mat3x2', 'mat3x3', 'mat3x4', 'mat4', 'mat4x2', 'mat4x3', 'mat4x4',
-    'mediump', 'namespace', 'noinline', 'noperspective', 'out', 'output',
-    'partition', 'patch', 'precise', 'precision', 'public', 'readonly',
-    'resource', 'restrict', 'return', 'sample', 'sampler', 'sampler1d',
-    'sampler1darray', 'sampler1darrayshadow', 'sampler1dshadow', 'sampler2d',
-    'sampler2darray', 'sampler2darrayshadow', 'sampler2dms', 'sampler2dmsarray',
-    'sampler2drectshadow', 'sampler2dshadow', 'sampler3d', 'sampler3drect',
-    'samplerbuffer', 'samplercubearray', 'samplercubearrayshadow',
-    'samplercubeshadow', 'samplershadow', 'shared', 'short', 'sizeof', 'smooth',
-    'static', 'struct', 'subpassinput', 'subpassinputms', 'subroutine',
-    'superp', 'switch', 'template', 'texture1d', 'texture1darray', 'texture2d',
-    'texture2darray', 'texture2dms', 'texture2dmsarray', 'texture2drect',
-    'texture3d', 'texturebuffer', 'texturecube', 'texturecubearray', 'this',
-    'true', 'type', 'uimage1d', 'uimage1darray', 'uimage2d', 'uimage2darray',
-    'uimage2dms', 'uimage2dmsarray', 'uimage2drect', 'uimage3dimagecube',
-    'uimagebuffer', 'uimagecube', 'uimagecubearray', 'uint', 'uniform', 'union',
-    'unsigned', 'usampler1d', 'usampler1darray', 'usampler2d',
-    'usampler2darraysampler2drect', 'usampler2dms', 'usampler2dmsarray',
-    'usampler2drect', 'usampler3dsamplercube', 'usamplerbuffer', 'usamplercube',
-    'usamplercubearray', 'using', 'usubpassinput', 'usubpassinputms',
-    'utexture1d', 'utexture1darray', 'utexture2d', 'utexture2darray',
-    'utexture2dms', 'utexture2dmsarray', 'utexture2drect', 'utexture3d',
-    'utexturebuffer', 'utexturecube', 'utexturecubearray', 'uvec2', 'uvec3',
-    'uvec4', 'varying', 'vec2', 'vec3', 'vec4', 'void', 'volatile', 'while',
-    'writeonly'
-  );
-
-  GInternalFunctions: array[0..160] of UnicodeString = (
-    'abs', 'acos', 'all', 'allinvocations', 'allinvocationsequal', 'any',
-    'anyinvocation', 'asin', 'atan', 'atomicadd', 'atomicand', 'atomiccompswap',
-    'atomiccounter', 'atomiccounteradd', 'atomiccounterand',
-    'atomiccountercompswap', 'atomiccounterdecrement', 'atomiccounterexchange',
-    'atomiccounterincrement', 'atomiccountermax', 'atomiccountermin',
-    'atomiccounteror', 'atomiccountersubtract', 'atomiccounterxor',
-    'atomicexchange', 'atomicmax', 'atomicmin', 'atomicor', 'atomicxor',
-    'barrier', 'bitcount', 'bitfieldextract', 'bitfieldinsert',
-    'bitfieldreverse', 'ceil', 'clamp', 'cos', 'cross', 'degrees',
-    'determinant', 'dfdx', 'dfdxcoarse', 'dfdxfine', 'dfdy', 'dfdycoarse',
-    'dfdyfine', 'distance', 'dot', 'emitstreamvertex', 'emitvertex',
-    'endprimitive', 'endstreamprimitive', 'equal', 'exp', 'exp2', 'faceforward',
-    'findlsb', 'findmsb', 'floor', 'fract', 'ftransform', 'fwidth',
-    'fwidthcoarse', 'fwidthfine', 'greaterthan', 'greaterthanequal',
-    'groupmemorybarrier', 'imageatomicadd', 'imageatomicand',
-    'imageatomiccompswap', 'imageatomicexchange', 'imageatomicmax',
-    'imageatomicmin', 'imageatomicor', 'imageatomicxor', 'imageload',
-    'imagesamples', 'imagesize', 'imagestore', 'imulextended',
-    'interpolateatcentroid', 'interpolateatoffset', 'interpolateatsample',
-    'inverse', 'inversesqrt', 'length', 'lessthan', 'lessthanequal', 'log',
-    'log2', 'matrixcompmult', 'max', 'memorybarrier',
-    'memorybarrieratomiccounter', 'memorybarrierbuffer', 'memorybarrierimage',
-    'memorybarriershared', 'min', 'mix', 'mod', 'noise1', 'noise2', 'noise3',
-    'noise4', 'normalize', 'not', 'notequal', 'outerproduct', 'pow', 'radians',
-    'reflect', 'refract', 'shadow2d', 'shadow2dproj', 'shadowld',
-    'shadowldproj', 'sign', 'sin', 'smoothstep', 'sqrt', 'step', 'subpassload',
-    'tan', 'texelfetch', 'texelfetchoffset', 'texture', 'texture1d',
-    'texture1dlod', 'texture1dproj', 'texture1dprojlod', 'texture2d',
-    'texture2dlod', 'texture2dproj', 'texture2dprojlod', 'texture3d',
-    'texture3dlod', 'texture3dproj', 'texture3dprojlod', 'texturecube',
-    'texturecubelod', 'texturegather', 'texturegatheroffset',
-    'texturegatheroffsets', 'texturegrad', 'texturegradoffset', 'texturelod',
-    'texturelodoffset', 'textureoffset', 'textureproj', 'textureprojgrad',
-    'textureprojgradoffset', 'textureprojlod', 'textureprojlodoffset',
-    'textureprojoffset', 'texturequerylevels', 'texturequerylod', 'texturesize',
-    'transpose', 'uaddcarry', 'umulextended', 'usubborrow'
-  );
-
-  GKeyIndices: array[0..2010] of Integer = (
-    -1, -1, 22, -1, -1, 65, -1, -1, -1, -1, -1, 129, 8, -1, 177, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 226, 23, -1, -1, -1, 182, -1, 33, 98, -1, -1, 9, -1, -1,
-    -1, 200, -1, -1, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, 108, 72, -1, -1, -1, -1, -1, -1, -1, -1, 163, 69, -1, 195, -1,
-    -1, 85, -1, -1, -1, -1, -1, -1, 79, 186, -1, 71, -1, -1, -1, -1, 68, -1, -1,
-    2, -1, 146, 96, -1, -1, -1, 76, -1, -1, -1, -1, 215, 219, -1, 30, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 204, 51,
-    -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, 206, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 239,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, 95, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 180, -1, -1,
-    -1, 172, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 211, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 61, 145, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, 149, -1, -1, -1, -1, 114, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, 197, -1, -1, -1, -1, -1, 192, -1, -1, -1, -1, -1, -1, -1, 1, 228, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 221, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, 75, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, -1,
-    -1, -1, 99, -1, -1, -1, -1, -1, 125, 135, -1, -1, -1, -1, -1, -1, -1, 101,
-    -1, -1, -1, -1, -1, -1, -1, -1, 187, -1, 0, -1, -1, 126, 106, -1, -1, -1,
-    -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1, 91, -1, -1, -1, -1, -1, -1, 127,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 167, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 113, -1, -1, -1,
-    -1, 118, -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, 150, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 115,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 232, -1, 130, -1, 165,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, 12, 46, -1, -1, -1, -1, -1, -1, -1, 155, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 222, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 86, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 88, -1, -1, 171, -1, 15, -1,
-    -1, -1, -1, -1, -1, 77, -1, -1, 93, -1, -1, -1, 217, -1, -1, -1, -1, -1, 41,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, 223, -1, -1, -1, -1, -1, -1, -1, -1, -1, 199, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 176, -1, -1, -1, -1, -1, 208, -1, -1,
-    -1, 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 159, -1,
-    -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, 64, -1, -1, -1, -1, 168, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, -1, -1,
-    -1, -1, 16, -1, 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 92, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 87, -1, 236, 166, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1,
-    -1, -1, -1, -1, 131, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, 160, -1, -1, -1, -1, -1, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 196, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1,
-    -1, 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    138, 112, -1, -1, -1, -1, -1, -1, -1, -1, 26, -1, -1, -1, -1, -1, -1, -1,
-    109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 27, -1, -1,
-    134, -1, -1, -1, -1, 107, -1, -1, 178, -1, -1, -1, -1, 147, -1, -1, -1, -1,
-    -1, 136, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    229, -1, 173, -1, -1, -1, -1, 139, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 230, 54, 66, -1, 233, -1, 14, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, 152, -1, -1, -1, 18, -1, -1, 231, 55, -1, -1, 234, -1, -1, -1,
-    -1, -1, -1, -1, -1, 94, -1, 194, -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, -1,
-    235, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 89, -1, -1, -1,
-    -1, 44, -1, -1, -1, -1, -1, 120, -1, -1, 193, 20, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 153, -1, 124, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, 39, -1, -1, -1, -1, -1, -1, -1, 148, -1, -1, -1, -1, -1, -1,
-    207, -1, -1, -1, -1, -1, -1, -1, -1, -1, 227, 104, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 132, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 161,
-    -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 19, -1, -1, 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, 4, -1, -1, 213, 121, 214, -1, 157, 170, -1, -1, -1,
-    -1, 181, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, -1, 48, -1, 122, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49,
-    -1, 123, -1, -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, -1, 164, -1, -1, -1,
-    78, -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    144, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 10, -1, -1, -1, -1, -1, 162, 169, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, -1,
-    -1, -1, -1, -1, -1, -1, -1, 90, -1, 43, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    205, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 184, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 141, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 47,
-    -1, -1, -1, -1, 183, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, -1, -1,
-    -1, -1, -1, 102, -1, -1, -1, -1, -1, 189, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, 36, -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, 224, -1, -1, -1, -1, -1,
-    -1, 203, -1, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, 188, -1, -1, 34, -1, 62, -1, -1, -1, -1, -1, -1,
-    -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 128, -1, 84, -1,
-    42, 209, 185, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    137, -1, 198, -1, -1, -1, -1, -1, -1, -1, -1, 210, -1, -1, 151, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 216, -1,
-    5, 174, -1, -1, -1, 143, -1, 52, 74, -1, -1, 201, -1, -1, -1, -1, -1, -1,
-    -1, 237, -1, 190, -1, -1, -1, 202, -1, -1, -1, -1, -1, -1, -1, 11, 154, 218,
-    -1, -1, -1, -1, -1, -1, -1, 57, -1, -1, -1, -1, -1, -1, 220, -1, 133, -1,
-    -1, -1, -1, -1, -1, 97, -1, -1, -1, -1, -1, 225, -1, -1, -1, -1, 212, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, 21, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 238, -1, -1, -1, -1, -1, -1, -1, 25,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, 29, 7, 60, -1, -1, -1, -1, -1, -1, -1, -1, 175
-  );
-
-  GInternalFunctionIndices: array[0..1050] of Integer = (
-    -1, -1, -1, -1, -1, -1, -1, 50, 63, -1, 34, -1, 5, -1, 118, -1, 17, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, 11, -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, 65,
-    -1, -1, 19, -1, 141, -1, 137, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 48,
-    -1, 40, 99, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1,
-    -1, -1, 24, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    145, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, 25, -1, -1,
-    -1, 52, 109, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, 159, -1, -1, -1,
-    -1, -1, -1, -1, -1, 98, 90, 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, -1, 87, -1, -1, -1, -1, 42, -1, -1,
-    -1, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, 155, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, 45, -1, -1, 68, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 108, 39, 160, 9, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 138, -1, -1, -1, -1, -1, -1, -1, 10, -1,
-    -1, -1, -1, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, -1, 31,
-    -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, 101, -1, 130, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, 102, -1, -1, 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 103,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 128, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 147, -1, -1, -1, -1, 127,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 143, -1, -1, -1, 2, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 133, -1, -1, -1, 29, -1, 96,
-    -1, -1, -1, 53, -1, -1, -1, -1, -1, 131, -1, -1, -1, -1, -1, 12, 88, -1, -1,
-    -1, -1, 41, -1, -1, -1, -1, -1, -1, -1, -1, -1, 111, 125, -1, -1, -1, 150,
-    -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, 116,
-    -1, -1, 139, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 92, 66, -1,
-    -1, 135, -1, -1, -1, -1, 82, 115, 16, -1, -1, 91, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, 89, -1, 124, -1, 72, -1, -1, -1, -1, -1, -1, 77, 123,
-    47, -1, -1, 151, -1, -1, -1, 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, 33, -1,
-    -1, -1, -1, -1, -1, 136, 27, -1, 44, -1, -1, -1, -1, -1, -1, 85, -1, 26, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, 76, -1, -1, -1, -1, -1, -1, -1,
-    55, -1, 81, -1, -1, -1, -1, -1, 46, -1, -1, -1, 8, 61, -1, -1, -1, -1, -1,
-    -1, 126, -1, -1, 80, -1, -1, -1, -1, 22, -1, -1, -1, 78, -1, -1, -1, 54, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 114, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, 154, -1, 149, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 58,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 94, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1,
-    -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, 148, -1, -1, -1, -1, -1, -1, 121,
-    -1, -1, -1, -1, 140, -1, -1, -1, -1, -1, 156, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, 95, -1, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, -1, 23, -1, -1, -1,
-    -1, -1, -1, -1, 62, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, 38, 153, -1,
-    -1, -1, 74, -1, -1, -1, -1, 122, 75, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1,
-    -1, -1, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, 84, -1, 36, 158, -1, -1, -1, -1, -1, -1, -1, 86, -1, 4, -1,
-    113, -1, -1, -1, -1, -1, -1, 152, -1, -1, -1, -1, -1, -1, -1, -1, -1, 129,
-    -1, 57, 112, -1, -1, -1, 83, -1, -1, 105, -1, -1, 32, -1, -1, -1, -1, -1,
-    -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, 70, -1, -1, 144, -1,
-    -1, -1, -1, 15, -1, -1, -1, -1, -1, -1, 132, -1, 107, -1, -1, -1, -1, -1,
-    -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, -1, -1, 146, 79,
-    69
-  );
-
-{$Q-}
-function TSynGLSLSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 875 + Ord(Str^) * 23;
-    inc(Str);
-  end;
-  Result := Result mod 2011;
-  FStringLen := Str - FToIdent;
-end;
-
-function TSynGLSLSyn.HashInternal(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 703 + Ord(Str^) * 16;
-    inc(Str);
-  end;
-  Result := Result mod 1051;
-  FStringLen := Str - FToIdent;
-end;
-{$Q+}
-
-function TSynGLSLSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
-var
-  Key: Cardinal;
-begin
-  FToIdent := MayBe;
-  Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](GKeyIndices[Key], Maybe)
-  else
-  begin
-    Key := HashInternal(MayBe);
-    if Key <= High(FInternalFuncTable) then
-      Result := FInternalFuncTable[Key](GInternalFunctionIndices[Key], Maybe)
-    else
-      Result := tkIdentifier;
-  end;
-end;
-
-procedure TSynGLSLSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if GKeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
-
-  for i := Low(FInternalFuncTable) to High(FInternalFuncTable) do
-    if GInternalFunctionIndices[i] = -1 then
-      FInternalFuncTable[i] := AltFinalFunc;
-
-  FIdentFuncTable[83] := InterfaceQualifierFunc;
-  FIdentFuncTable[143] := InterfaceQualifierFunc;
-  FIdentFuncTable[460] := InterfaceQualifierFunc;
-  FIdentFuncTable[1312] := InterfaceQualifierFunc;
-  FIdentFuncTable[1878] := InterfaceQualifierFunc;
-
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if @FIdentFuncTable[i] = nil then
-      FIdentFuncTable[i] := KeyWordFunc;
-
-  for i := Low(FInternalFuncTable) to High(FInternalFuncTable) do
-    if @FInternalFuncTable[i] = nil then
-      FInternalFuncTable[i] := InternalFunc;
-end;
-
-function TSynGLSLSyn.InterfaceQualifierFunc(Index: Integer; Maybe: PWideChar): TtkTokenKind;
-begin
-  if IsCurrentToken(GKeyWords[Index]) then
-    Result := tkInterfaceQualifier
-  else
-    Result := tkIdentifier
-end;
-
-function TSynGLSLSyn.AltFinalFunc(Index: Integer;
-  Maybe: PWideChar): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-function TSynGLSLSyn.AltFunc(Index: Integer; Maybe: PWideChar): TtkTokenKind;
-var
-  Key: Cardinal;
-begin
-  Key := HashInternal(MayBe);
-  if Key <= High(FInternalFuncTable) then
-    Result := FInternalFuncTable[Key](GInternalFunctionIndices[Key], Maybe)
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGLSLSyn.KeyWordFunc(Index: Integer; Maybe: PWideChar): TtkTokenKind;
-begin
-  if IsCurrentToken(GKeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier
-end;
-
-function TSynGLSLSyn.InternalFunc(Index: Integer; Maybe: PWideChar): TtkTokenKind;
-begin
-  if IsCurrentToken(GInternalFunctions[Index]) then
-    Result := tkInternalFunction
-  else
-    Result := tkIdentifier
-end;
-
-constructor TSynGLSLSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-
-  FCaseSensitive := True;
-
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style:= [fsItalic];
-  FCommentAttri.Foreground := clGray;
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  FInterfaceQualifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrInterfaceQualifier, SYNS_FriendlyAttrInterfaceQualifier);
-  FInterfaceQualifierAttri.Style:= [fsBold];
-  FInternalFunctionsAttri := TSynHighlighterAttributes.Create(SYNS_AttrInternalFunction, SYNS_FriendlyAttrInternalFunction);
-  FInternalFunctionsAttri.Foreground := clGreen;
-  FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Foreground := clNavy;
-  FKeyAttri.Style:= [fsBold];
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  FNumberAttri.Foreground := clMaroon;
-  FCharAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter);
-  FFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat);
-  FFloatAttri.Foreground := clOlive;
-  FHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal);
-  FOctalAttri := TSynHighlighterAttributes.Create(SYNS_AttrOctal, SYNS_FriendlyAttrOctal);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
-
-  AddAttribute(FCommentAttri);
-  AddAttribute(FIdentifierAttri);
-  AddAttribute(FInterfaceQualifierAttri);
-  AddAttribute(FInternalFunctionsAttri);
-  AddAttribute(FInvalidAttri);
-  AddAttribute(FKeyAttri);
-  AddAttribute(FNumberAttri);
-  AddAttribute(FCharAttri);
-  AddAttribute(FFloatAttri);
-  AddAttribute(FHexAttri);
-  AddAttribute(FOctalAttri);
-  AddAttribute(FSpaceAttri);
-  AddAttribute(FStringAttri);
-  AddAttribute(FDirecAttri);
-  AddAttribute(FSymbolAttri);
-
-  SetAttributesOnChange(DefHighlightChange);
-
-  InitIdent;
-  FRange := rsUnknown;
-  FAsmStart := False;
-  FDefaultFilter := SYNS_FilterGLSL;
-end;
-
-procedure TSynGLSLSyn.AnsiCProc;
-begin
-  FTokenID := tkComment;
-  case FLine[Run] of
-    #0:
-      begin
-        NullProc;
-        Exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        Exit;
-      end;
-    #13:
-      begin
-        CRProc;
-        Exit;
-      end;
-  end;
-
-  while FLine[Run] <> #0 do
-    case FLine[Run] of
-      '*':
-        if FLine[Run + 1] = '/' then
-        begin
-          Inc(Run, 2);
-          if (FRange = rsDirectiveComment) and
-            not IsLineEnd(Run) then
-              FRange := rsMultiLineDirective
-          else
-            FRange := rsUnknown;
-          Break;
-        end else
-          Inc(Run);
-      #10, #13:
-        Break;
-      else
-        Inc(Run);
-    end;
-end;
-
-procedure TSynGLSLSyn.AndSymbolProc;
-begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {and assign}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkAndAssign;
-      end;
-    '&':                               {logical and}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkLogAnd;
-      end;
-  else                                 {and}
-    begin
-      Inc(Run);
-      FExtTokenID := xtkAnd;
-    end;
-  end;
-end;
-
-procedure TSynGLSLSyn.AsciiCharProc;
-begin
-  FTokenID := tkChar;
-  repeat
-    if FLine[Run] = '\' then begin
-      if CharInSet(FLine[Run + 1], [#39, '\']) then
-        Inc(Run);
-    end;
-    Inc(Run);
-  until IsLineEnd(Run) or (FLine[Run] = #39);
-  if FLine[Run] = #39 then
-    Inc(Run);
-end;
-
-procedure TSynGLSLSyn.AtSymbolProc;
-begin
-  FTokenID := tkUnknown;
-  Inc(Run);
-end;
-
-procedure TSynGLSLSyn.BraceCloseProc;
-begin
-  Inc(Run);
-  FTokenID := tkSymbol;
-  FExtTokenID := xtkBraceClose;
-end;
-
-procedure TSynGLSLSyn.BraceOpenProc;
-begin
-  Inc(Run);
-  FTokenID := tkSymbol;
-  FExtTokenID := xtkBraceOpen;
-end;
-
-procedure TSynGLSLSyn.CRProc;
-begin
-  FTokenID := tkSpace;
-  Inc(Run);
-  if FLine[Run + 1] = #10 then Inc(Run);
-end;
-
-procedure TSynGLSLSyn.ColonProc;
-begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    ':':                               {scope resolution operator}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkScopeResolution;
-      end;
-  else                                 {colon}
-    begin
-      Inc(Run);
-      FExtTokenID := xtkColon;
-    end;
-  end;
-end;
-
-procedure TSynGLSLSyn.CommaProc;
-begin
-  Inc(Run);
-  FTokenID := tkSymbol;
-  FExtTokenID := xtkComma;
-end;
-
-procedure TSynGLSLSyn.DirectiveProc;
-begin
-  if WideTrim(FLine)[1] <> '#' then // '#' is not first char on the line, treat it as an invalid char
-  begin
-    FTokenID := tkUnknown;
-    Inc(Run);
-    Exit;
-  end;
-  FTokenID := tkDirective;
-  repeat
-    if FLine[Run] = '/' then // comment?
-    begin
-      if FLine[Run + 1] = '/' then // is end of directive as well
-      begin
-        FRange := rsUnknown;
-        Exit;
-      end
-      else
-        if FLine[Run + 1] = '*' then // might be embedded only
-        begin
-          FRange := rsDirectiveComment;
-          Exit;
-        end;
-    end;
-    if (FLine[Run] = '\') and (FLine[Run +1 ] = #0) then // a multiline directive
-    begin
-      Inc(Run);
-      FRange := rsMultiLineDirective;
-      Exit;
-    end;
-    Inc(Run);
-  until IsLineEnd(Run)
-end;
-
-procedure TSynGLSLSyn.DirectiveEndProc;
-begin
-  FTokenID := tkDirective;
-  case FLine[Run] of
-    #0:
-      begin
-        NullProc;
-        Exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        Exit;
-      end;
-    #13:
-      begin
-        CRProc;
-        Exit;
-      end;
-  end;
-  FRange := rsUnknown;
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: Break;
-      '/': // comment?
-        begin
-          case FLine[Run + 1] of
-            '/': // is end of directive as well
-              begin
-                FRange := rsUnknown;
-                Exit;
-              end;
-            '*': // might be embedded only
-              begin
-                FRange := rsDirectiveComment;
-                Exit;
-              end;
-          end;
-        end;
-      '\': // yet another line?
-        begin
-          if FLine[Run + 1] = #0 then
-          begin
-            Inc(Run);
-            FRange := rsMultiLineDirective;
-            Exit;
-          end;
-        end;
-    end;
-    Inc(Run);
-  until IsLineEnd(Run);
-end;
-
-procedure TSynGLSLSyn.EqualProc;
-begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {logical equal}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkLogEqual;
-      end;
-  else                                 {assign}
-    begin
-      Inc(Run);
-      FExtTokenID := xtkAssign;
-    end;
-  end;
-end;
-
-procedure TSynGLSLSyn.GreaterProc;
-begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {greater than or equal to}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkGreaterThanEqual;
-      end;
-    '>':
-      begin
-        if FLine[Run + 2] = '=' then   {shift right assign}
-        begin
-          Inc(Run, 3);
-          FExtTokenID := xtkShiftRightAssign;
-        end
-        else                           {shift right}
-        begin
-          Inc(Run, 2);
-          FExtTokenID := xtkShiftRight;
-        end;
-      end;
-  else                                 {greater than}
-    begin
-      Inc(Run);
-      FExtTokenID := xtkGreaterThan;
-    end;
-  end;
-end;
-
-procedure TSynGLSLSyn.QuestionProc;
-begin
-  FTokenID := tkSymbol;                {conditional}
-  FExtTokenID := xtkQuestion;
-  Inc(Run);
-end;
-
-procedure TSynGLSLSyn.IdentProc;
-begin
-  FTokenID := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do Inc(Run);
-end;
-
-procedure TSynGLSLSyn.LFProc;
-begin
-  FTokenID := tkSpace;
-  Inc(Run);
-end;
-
-procedure TSynGLSLSyn.LowerProc;
-begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {less than or equal to}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkLessThanEqual;
-      end;
-    '<':
-      begin
-        if FLine[Run + 2] = '=' then   {shift left assign}
-        begin
-          Inc(Run, 3);
-          FExtTokenID := xtkShiftLeftAssign;
-        end
-        else                           {shift left}
-        begin
-          Inc(Run, 2);
-          FExtTokenID := xtkShiftLeft;
-        end;
-      end;
-  else                                 {less than}
-    begin
-      Inc(Run);
-      FExtTokenID := xtkLessThan;
-    end;
-  end;
-end;
-
-procedure TSynGLSLSyn.MinusProc;
-begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {subtract assign}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkSubtractAssign;
-      end;
-    '-':                               {decrement}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkDecrement;
-      end;
-    '>':                               {arrow}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkArrow;
-      end;
-  else                                 {subtract}
-    begin
-      Inc(Run);
-      FExtTokenID := xtkSubtract;
-    end;
-  end;
-end;
-
-procedure TSynGLSLSyn.ModSymbolProc;
-begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {mod assign}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkModAssign;
-      end;
-  else                                 {mod}
-    begin
-      Inc(Run);
-      FExtTokenID := xtkMod;
-    end;
-  end;
-end;
-
-procedure TSynGLSLSyn.NotSymbolProc;
-begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {not equal}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkNotEqual;
-      end;
-  else                                 {not}
-    begin
-      Inc(Run);
-      FExtTokenID := xtkLogComplement;
-    end;
-  end;
-end;
-
-procedure TSynGLSLSyn.NullProc;
-begin
-  FTokenID := tkNull;
-  Inc(Run);
-end;
-
-procedure TSynGLSLSyn.NumberProc;
-
-  function IsNumberChar(Run: Integer): Boolean;
-  begin
-    case FLine[Run] of
-      '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X', '-', '+':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-  function IsDigitPlusMinusChar(Run: Integer): Boolean;
-  begin
-    case FLine[Run] of
-      '0'..'9', '+', '-':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-  function IsHexDigit(Run: Integer): Boolean;
-  begin
-    case FLine[Run] of
-      '0'..'9', 'a'..'f', 'A'..'F':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-  function IsAlphaUncerscore(Run: Integer): Boolean;
-  begin
-    case FLine[Run] of
-      'A'..'Z', 'a'..'z', '_':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-var
-  idx1: Integer; // token[1]
-  i: Integer;
-begin
-  idx1 := Run;
-  Inc(Run);
-  FTokenID := tkNumber;
-  while IsNumberChar(Run) do
-  begin
-    case FLine[Run] of
-      '.':
-        if FLine[Succ(Run)] = '.' then
-          Break
-        else
-          if (FTokenID <> tkHex) then
-            FTokenID := tkFloat
-          else // invalid
-          begin
-            FTokenID := tkUnknown;
-            Exit;
-          end;
-      '-', '+':
-        begin
-          if FTokenID <> tkFloat then // number <> float. an arithmetic operator
-            Exit;
-          if not CharInSet(FLine[Pred(Run)], ['e', 'E']) then
-            Exit; // number = float, but no exponent. an arithmetic operator
-          if not IsDigitPlusMinusChar(Succ(Run)) then // invalid
-          begin
-            Inc(Run);
-            FTokenID := tkUnknown;
-            Exit;
-          end
-        end;
-      '0'..'7':
-        if (Run = Succ(idx1)) and (FLine[idx1] = '0') then // octal number
-          FTokenID := tkOctal;
-      '8', '9':
-        if (FLine[idx1] = '0') and
-           ((FTokenID <> tkHex) and (FTokenID <> tkFloat)) then // invalid octal char
-             FTokenID := tkUnknown;
-      'a'..'d', 'A'..'D':
-        if FTokenID <> tkHex then // invalid char
-          Break;
-      'e', 'E':
-        if (FTokenID <> tkHex) then
-          if CharInSet(FLine[Pred(Run)], ['0'..'9']) then // exponent
-          begin
-            for i := idx1 to Pred(Run) do
-              if CharInSet(FLine[i], ['e', 'E']) then // too many exponents
-              begin
-                FTokenID := tkUnknown;
-                Exit;
-              end;
-            if not IsDigitPlusMinusChar(Succ(Run)) then
-              Break
-            else
-              FTokenID := tkFloat
-          end
-          else // invalid char
-            Break;
-      'f', 'F':
-        if FTokenID <> tkHex then
-        begin
-          for i := idx1 to Pred(Run) do
-            if CharInSet(FLine[i], ['f', 'F']) then // declaration syntax error
-            begin
-              FTokenID := tkUnknown;
-              Exit;
-            end;
-          if FTokenID = tkFloat then
-          begin
-            if CharInSet(FLine[Pred(Run)], ['l', 'L']) then // can't mix
-              Break;
-          end
-          else
-            FTokenID := tkFloat;
-        end;
-      'l', 'L':
-        begin
-          for i := idx1 to Run - 2 do
-            if CharInSet(FLine[i], ['l', 'L']) then // declaration syntax error
-            begin
-              FTokenID := tkUnknown;
-              Exit;
-            end;
-          if FTokenID = tkFloat then
-            if CharInSet(FLine[Pred(Run)], ['f', 'F']) then // can't mix
-              Break;
-        end;
-      'u', 'U':
-        if FTokenID = tkFloat then // not allowed
-          Break
-        else
-          for i := idx1 to Pred(Run) do
-            if CharInSet(FLine[i], ['u', 'U']) then // declaration syntax error
-            begin
-              FTokenID := tkUnknown;
-              Exit;
-            end;
-      'x', 'X':
-        if (Run = Succ(idx1)) and   // 0x... 'x' must be second char
-           (FLine[idx1] = '0') and  // 0x...
-           IsHexDigit(Succ(Run)) then // 0x... must be continued with a number
-             FTokenID := tkHex
-           else // invalid char
-           begin
-             if not IsIdentChar(FLine[Succ(Run)]) and
-                CharInSet(FLine[Succ(idx1)], ['x', 'X']) then
-             begin
-               Inc(Run); // highlight 'x' too
-               FTokenID := tkUnknown;
-             end;
-             Break;
-           end;
-    end; // case
-    Inc(Run);
-  end; // while
-  if IsAlphaUncerscore(Run) then
-    FTokenID := tkUnknown;
-end;
-
-procedure TSynGLSLSyn.OrSymbolProc;
-begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {or assign}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkIncOrAssign;
-      end;
-    '|':                               {logical or}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkLogOr;
-      end;
-  else                                 {or}
-    begin
-      Inc(Run);
-      FExtTokenID := xtkIncOr;
-    end;
-  end;
-end;
-
-procedure TSynGLSLSyn.PlusProc;
-begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {add assign}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkAddAssign;
-      end;
-    '+':                               {increment}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkIncrement;
-      end;
-  else                                 {add}
-    begin
-      Inc(Run);
-      FExtTokenID := xtkAdd;
-    end;
-  end;
-end;
-
-procedure TSynGLSLSyn.PointProc;
-begin
-  FTokenID := tkSymbol;
-  if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
-    begin                              {ellipse}
-      Inc(Run, 3);
-      FExtTokenID := xtkEllipse;
-    end
-  else
-    if CharInSet(FLine[Run + 1], ['0'..'9']) then // float
-    begin
-      Dec(Run); // numberproc must see the point
-      NumberProc;
-    end
-  else                                 {point}
-    begin
-      Inc(Run);
-      FExtTokenID := xtkPoint;
-    end;
-end;
-
-procedure TSynGLSLSyn.RoundCloseProc;
-begin
-  Inc(Run);
-  FTokenID := tkSymbol;
-  FExtTokenID := xtkRoundClose;
-end;
-
-procedure TSynGLSLSyn.RoundOpenProc;
-begin
-  Inc(Run);
-  FTokenID := tkSymbol;
-  FExtTokenID := xtkRoundOpen;
-end;
-
-procedure TSynGLSLSyn.SemiColonProc;
-begin
-  Inc(Run);
-  FTokenID := tkSymbol;
-  FExtTokenID := xtkSemiColon;
-end;
-
-procedure TSynGLSLSyn.SlashProc;
-begin
-  case FLine[Run + 1] of
-    '/':                               {c++ style comments}
-      begin
-        FTokenID := tkComment;
-        Inc(Run, 2);
-        while not IsLineEnd(Run) do Inc(Run);
-      end;
-    '*':                               {c style comments}
-      begin
-        FTokenID := tkComment;
-        if FRange <> rsDirectiveComment then
-          FRange := rsAnsiC;
-        Inc(Run, 2);
-        while FLine[Run] <> #0 do
-          case FLine[Run] of
-            '*':
-              if FLine[Run + 1] = '/' then
-              begin
-                Inc(Run, 2);
-                if FRange = rsDirectiveComment then
-                  FRange := rsMultiLineDirective
-                else
-                  FRange := rsUnknown;
-                Break;
-              end else Inc(Run);
-            #10, #13:
-              begin
-                if FRange = rsDirectiveComment then
-                  FRange := rsAnsiC;
-                Break;
-              end;
-          else Inc(Run);
-          end;
-      end;
-    '=':                               {divide assign}
-      begin
-        Inc(Run, 2);
-        FTokenID := tkSymbol;
-        FExtTokenID := xtkDivideAssign;
-      end;
-  else                                 {divide}
-    begin
-      Inc(Run);
-      FTokenID := tkSymbol;
-      FExtTokenID := xtkDivide;
-    end;
-  end;
-end;
-
-procedure TSynGLSLSyn.SpaceProc;
-begin
-  Inc(Run);
-  FTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
-end;
-
-procedure TSynGLSLSyn.SquareCloseProc;
-begin
-  Inc(Run);
-  FTokenID := tkSymbol;
-  FExtTokenID := xtkSquareClose;
-end;
-
-procedure TSynGLSLSyn.SquareOpenProc;
-begin
-  Inc(Run);
-  FTokenID := tkSymbol;
-  FExtTokenID := xtkSquareOpen;
-end;
-
-procedure TSynGLSLSyn.StarProc;
-begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
-    '=':                               {multiply assign}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkMultiplyAssign;
-      end;
-  else                                 {star}
-    begin
-      Inc(Run);
-      FExtTokenID := xtkStar;
-    end;
-  end;
-end;
-
-procedure TSynGLSLSyn.StringProc;
-begin
-  FTokenID := tkString;
-  repeat
-    if FLine[Run] = '\' then begin
-      case FLine[Run + 1] of
-        #34, '\':
-          Inc(Run);
-        #00:
-          begin
-            Inc(Run);
-            FRange := rsMultilineString;
-            Exit;
-          end;
-      end;
-    end;
-    Inc(Run);
-  until IsLineEnd(Run) or (FLine[Run] = #34);
-  if FLine[Run] = #34 then
-    Inc(Run);
-end;
-
-procedure TSynGLSLSyn.StringEndProc;
-begin
-  FTokenID := tkString;
-
-  case FLine[Run] of
-    #0:
-      begin
-        NullProc;
-        Exit;
-      end;
-    #10:
-      begin
-        LFProc;
-        Exit;
-      end;
-    #13:
-      begin
-        CRProc;
-        Exit;
-      end;
-  end;
-
-  FRange := rsUnknown;
-
-  repeat
-    case FLine[Run] of
-      #0, #10, #13: Break;
-      '\':
-        begin
-          case FLine[Run + 1] of
-            #34, '\':
-              Inc(Run);
-            #00:
-              begin
-                Inc(Run);
-                FRange := rsMultilineString;
-                Exit;
-              end;
-          end;
-        end;
-      #34: Break;
-    end;
-    Inc(Run);
-  until IsLineEnd(Run) or (FLine[Run] = #34);
-  if FLine[Run] = #34 then
-    Inc(Run);
-end;
-
-procedure TSynGLSLSyn.TildeProc;
-begin
-  Inc(Run);                            {bitwise complement}
-  FTokenID := tkSymbol;
-  FExtTokenID := xtkBitComplement;
-end;
-
-procedure TSynGLSLSyn.XOrSymbolProc;
-begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
-  	'=':                               {xor assign}
-      begin
-        Inc(Run, 2);
-        FExtTokenID := xtkXorAssign;
-      end;
-  else                                 {xor}
-    begin
-      Inc(Run);
-      FExtTokenID := xtkXor;
-    end;
-  end;
-end;
-
-procedure TSynGLSLSyn.UnknownProc;
-begin
-  Inc(Run);
-  FTokenID := tkUnknown;
-end;
-
-procedure TSynGLSLSyn.Next;
-begin
-  FAsmStart := False;
-  FTokenPos := Run;
-  case FRange of
-    rsAnsiC, rsDirectiveComment: AnsiCProc;
-    rsMultiLineDirective: DirectiveEndProc;
-    rsMultilineString: StringEndProc;
-  else
-    begin
-      case FLine[Run] of
-        '&': AndSymbolProc;
-        #39: AsciiCharProc;
-        '@': AtSymbolProc;
-        '}': BraceCloseProc;
-        '{': BraceOpenProc;
-        #13: CRProc;
-        ':': ColonProc;
-        ',': CommaProc;
-        '#': DirectiveProc;
-        '=': EqualProc;
-        '>': GreaterProc;
-        '?': QuestionProc;
-        'A'..'Z', 'a'..'z', '_': IdentProc;
-        #10: LFProc;
-        '<': LowerProc;
-        '-': MinusProc;
-        '%': ModSymbolProc;
-        '!': NotSymbolProc;
-        #0: NullProc;
-        '0'..'9': NumberProc;
-        '|': OrSymbolProc;
-        '+': PlusProc;
-        '.': PointProc;
-        ')': RoundCloseProc;
-        '(': RoundOpenProc;
-        ';': SemiColonProc;
-        '/': SlashProc;
-        #1..#9, #11, #12, #14..#32: SpaceProc;
-        ']': SquareCloseProc;
-        '[': SquareOpenProc;
-        '*': StarProc;
-        #34: StringProc;
-        '~': TildeProc;
-        '^': XOrSymbolProc;
-        else UnknownProc;
-      end;
-    end;
-  end;
-  inherited;
-end;
-
-function TSynGLSLSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
-begin
-  case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynGLSLSyn.GetEol: Boolean;
-begin
-  Result := Run = FLineLen + 1;
-end;
-
-function TSynGLSLSyn.GetRange: Pointer;
-begin
-  Result := Pointer(FRange);
-end;
-
-function TSynGLSLSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := FTokenID;
-end;
-
-function TSynGLSLSyn.GetExtTokenID: TxtkTokenKind;
-begin
-  Result := FExtTokenID;
-end;
-
-function TSynGLSLSyn.GetTokenAttribute: TSynHighlighterAttributes;
-begin
-  FTokenID := GetTokenID;
-  case FTokenID of
-    tkComment: Result := FCommentAttri;
-    tkDirective: Result := FDirecAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkInterfaceQualifier: Result := FInterfaceQualifierAttri;
-    tkInternalFunction: Result := FInternalFunctionsAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkFloat: Result := FFloatAttri;
-    tkHex: Result := FHexAttri;
-    tkOctal: Result := FOctalAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkChar: Result := FCharAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkUnknown: Result := FInvalidAttri;
-    else Result := nil;
-  end;
-end;
-
-function TSynGLSLSyn.GetTokenKind: Integer;
-begin
-  Result := Ord(GetTokenID);
-end;
-
-procedure TSynGLSLSyn.ResetRange;
-begin
-  FRange:= rsUnknown;
-end;
-
-procedure TSynGLSLSyn.SetRange(Value: Pointer);
-begin
-  FRange := TRangeState(Value);
-end;
-
-function TSynGLSLSyn.IsFilterStored: Boolean;
-begin
-  Result := FDefaultFilter <> SYNS_FilterGLSL;
-end;
-
-class function TSynGLSLSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangGLSL;
-end;
-
-function TSynGLSLSyn.GetSampleSource: UnicodeString;
-begin
-  Result :=
-    'const int foo = 5;'#13#10 +
-    'uniform vec2 bar;'#13#10 +
-    'uniform sampler2d tex;'#13#10#13#10 +
-    'float rand(vec2 co){'#13#10 +
-    'return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);'#13#10 +
-    '}'#13#10#13#10 +
-    'void main()'#13#10 +
-    '{'#13#10 +
-    '  uint value = 21; // comment'#13#10 +
-    '  float number = abs(bar.x);'#13#10 +
-    '  if (foo < sin(3.14 * value))'#13#10 +
-    '    value = cos(12 * value);'#13#10 +
-    '  vec4 colors = texture(tex, bar.xy);'#13#10 +
-    '  for(int i = bar.x; i < bar.y; ++i)'#13#10 +
-    '  {'#13#10 +
-    '  }'#13#10 +
-    '}';
-end;
-
-class function TSynGLSLSyn.GetFriendlyLanguageName: UnicodeString;
-begin
-  Result := SYNS_FriendlyLangGLSL;
-end;
-
-initialization
-{$IFNDEF SYN_GLSLB_1}
-  RegisterPlaceableHighlighter(TSynGLSLSyn);
-{$ENDIF}
-end.
diff --git a/Ext/SynEdit/Source/SynHighlighterGWS.pas b/Ext/SynEdit/Source/SynHighlighterGWS.pas
index 0eb1524..192c6db 100644
--- a/Ext/SynEdit/Source/SynHighlighterGWS.pas
+++ b/Ext/SynEdit/Source/SynHighlighterGWS.pas
@@ -27,12 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterGWS.pas,v 1.13.2.7 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
 -------------------------------------------------------------------------------}
 
 unit SynHighlighterGWS;
@@ -75,25 +69,25 @@ interface
     xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor,
     xtkXorAssign);
 
-  TRangeState = (rsAnsiC, rsUnknown);
+  TRangeState = (rsAnsiC, rsUnKnown);
 
   PIdentFuncTableFunc = ^TIdentFuncTableFunc;
   TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
 
   TSynGWScriptSyn = class(TSynCustomHighlighter)
   private
-    FRange: TRangeState;
+    fRange: TRangeState;
     FTokenID: TtkTokenKind;
     FExtTokenID: TxtkTokenKind;
-    FIdentFuncTable: array[0..12] of TIdentFuncTableFunc;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FInvalidAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
+    fIdentFuncTable: array[0..12] of TIdentFuncTableFunc;
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fInvalidAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
     function AltFunc(Index: Integer): TtkTokenKind;
     function FuncBool(Index: Integer): TtkTokenKind;
     function FuncBreak(Index: Integer): TtkTokenKind;
@@ -152,7 +146,7 @@   TSynGWScriptSyn = class(TSynCustomHighlighter)
   public
     constructor Create(AOwner: TComponent); override;
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
     function GetDefaultAttribute (Index: Integer): TSynHighlighterAttributes; override;
     function GetEol: Boolean; override;
     function GetRange: Pointer; override;
@@ -165,14 +159,14 @@   TSynGWScriptSyn = class(TSynCustomHighlighter)
 
     property ExtTokenID: TxtkTokenKind read GetExtTokenID;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri;
-    property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri write FInvalidAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri;
+    property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri write fInvalidAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri;
   end;
 
 implementation
@@ -181,7 +175,7 @@ implementation
   SynEditStrConst;
 
 const
-  KeyWords: array[0..12] of UnicodeString = (
+  KeyWords: array[0..12] of string = (
     'bool', 'break', 'char', 'do', 'else', 'false', 'for', 'if', 'int', 
     'return', 'string', 'true', 'while' 
   );
@@ -200,7 +194,7 @@ function TSynGWScriptSyn.HashKey(Str: PWideChar): Cardinal;
     Inc(Str);
   end;
   Result := Result mod 13;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -208,23 +202,23 @@ procedure TSynGWScriptSyn.InitIdent;
 var
   i: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
     if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
-
-  FIdentFuncTable[6] := FuncBool;
-  FIdentFuncTable[4] := FuncBreak;
-  FIdentFuncTable[7] := FuncChar;
-  FIdentFuncTable[11] := FuncDo;
-  FIdentFuncTable[9] := FuncElse;
-  FIdentFuncTable[1] := FuncFalse;
-  FIdentFuncTable[10] := FuncFor;
-  FIdentFuncTable[12] := FuncIf;
-  FIdentFuncTable[0] := FuncInt;
-  FIdentFuncTable[8] := FuncReturn;
-  FIdentFuncTable[5] := FuncString;
-  FIdentFuncTable[2] := FuncTrue;
-  FIdentFuncTable[3] := FuncWhile;
+      fIdentFuncTable[i] := AltFunc;
+
+  fIdentFuncTable[6] := FuncBool;
+  fIdentFuncTable[4] := FuncBreak;
+  fIdentFuncTable[7] := FuncChar;
+  fIdentFuncTable[11] := FuncDo;
+  fIdentFuncTable[9] := FuncElse;
+  fIdentFuncTable[1] := FuncFalse;
+  fIdentFuncTable[10] := FuncFor;
+  fIdentFuncTable[12] := FuncIf;
+  fIdentFuncTable[0] := FuncInt;
+  fIdentFuncTable[8] := FuncReturn;
+  fIdentFuncTable[5] := FuncString;
+  fIdentFuncTable[2] := FuncTrue;
+  fIdentFuncTable[3] := FuncWhile;
 end;
 
 function TSynGWScriptSyn.AltFunc(Index: Integer): TtkTokenKind;
@@ -342,10 +336,10 @@ function TSynGWScriptSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
@@ -354,37 +348,37 @@ constructor TSynGWScriptSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := True;
-
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style:= [fsItalic];
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style:= [fsBold];
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-
-  AddAttribute(FCommentAttri);
-  AddAttribute(FIdentifierAttri);
-  AddAttribute(FInvalidAttri);
-  AddAttribute(FKeyAttri);
-  AddAttribute(FNumberAttri);
-  AddAttribute(FSpaceAttri);
-  AddAttribute(FStringAttri);
-  AddAttribute(FSymbolAttri);
+  fCaseSensitive := True;
+
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style:= [fsItalic];
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style:= [fsBold];
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+
+  AddAttribute(fCommentAttri);
+  AddAttribute(fIdentifierAttri);
+  AddAttribute(fInvalidAttri);
+  AddAttribute(fKeyAttri);
+  AddAttribute(fNumberAttri);
+  AddAttribute(fSpaceAttri);
+  AddAttribute(fStringAttri);
+  AddAttribute(fSymbolAttri);
 
   SetAttributesOnChange(DefHighlightChange);
   InitIdent;
-  FRange         := rsUnknown;
-  FDefaultFilter := SYNS_FilterGWS;
+  fRange         := rsUnknown;
+  fDefaultFilter := SYNS_FilterGWS;
 end; { Create }
 
 procedure TSynGWScriptSyn.AnsiCProc;
 begin
-  FTokenID := tkComment;
+  fTokenID := tkComment;
   case FLine[Run] of
     #0:
       begin
@@ -406,10 +400,9 @@ procedure TSynGWScriptSyn.AnsiCProc;
   while FLine[Run] <> #0 do
     case FLine[Run] of
       '*':
-        if FLine[Run + 1] = '/' then
-        begin
+        if fLine[Run + 1] = '/' then begin
           Inc(Run, 2);
-          FRange := rsUnknown;
+          fRange := rsUnKnown;
           Break;
         end else
           Inc(Run);
@@ -421,7 +414,7 @@ procedure TSynGWScriptSyn.AnsiCProc;
 
 procedure TSynGWScriptSyn.AndSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {and assign}
       begin
@@ -443,50 +436,50 @@ procedure TSynGWScriptSyn.AndSymbolProc;
 
 procedure TSynGWScriptSyn.AsciiCharProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
-    if FLine[Run] = '\' then begin
-      if CharInSet(FLine[Run + 1], [#39, '\']) then
+    if fLine[Run] = '\' then begin
+      if CharInSet(fLine[Run + 1], [#39, '\']) then
         Inc(Run);
     end;
     Inc(Run);
-  until IsLineEnd(Run) or (FLine[Run] = #39);
-  if FLine[Run] = #39 then
+  until IsLineEnd(Run) or (fLine[Run] = #39);
+  if fLine[Run] = #39 then
     Inc(Run);
 end;
 
 procedure TSynGWScriptSyn.AtSymbolProc;
 begin
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
   Inc(Run);
 end;
 
 procedure TSynGWScriptSyn.BraceCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
   FExtTokenID := xtkBraceClose;
-  FRange := rsUnknown;
+  fRange := rsUnknown;
 end;
 
 procedure TSynGWScriptSyn.BraceOpenProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
   FExtTokenID := xtkBraceOpen;
 end;
 
 procedure TSynGWScriptSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run + 1] = #10 then Inc(Run);
+  if fLine[Run + 1] = #10 then Inc(Run);
 end;
 
 procedure TSynGWScriptSyn.ColonProc;
 begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
+  fTokenID := tkSymbol;
+  Case FLine[Run + 1] of
     ':':                               {scope resolution operator}
       begin
         Inc(Run, 2);
@@ -503,13 +496,13 @@ procedure TSynGWScriptSyn.ColonProc;
 procedure TSynGWScriptSyn.CommaProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkComma;
 end;
 
 procedure TSynGWScriptSyn.EqualProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {logical equal}
       begin
@@ -526,8 +519,8 @@ procedure TSynGWScriptSyn.EqualProc;
 
 procedure TSynGWScriptSyn.GreaterProc;
 begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
+  fTokenID := tkSymbol;
+  Case FLine[Run + 1] of
     '=':                               {greater than or equal to}
       begin
         Inc(Run, 2);
@@ -556,27 +549,27 @@ procedure TSynGWScriptSyn.GreaterProc;
 
 procedure TSynGWScriptSyn.QuestionProc;
 begin
-  FTokenID := tkSymbol;                {conditional}
+  fTokenID := tkSymbol;                {conditional}
   FExtTokenID := xtkQuestion;
   Inc(Run);
 end;
 
 procedure TSynGWScriptSyn.IdentProc;
 begin
-  FTokenID := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  fTokenID := IdentKind((fLine + Run));
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
 end;
 
 procedure TSynGWScriptSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynGWScriptSyn.LowerProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {less than or equal to}
       begin
@@ -606,7 +599,7 @@ procedure TSynGWScriptSyn.LowerProc;
 
 procedure TSynGWScriptSyn.MinusProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {subtract assign}
       begin
@@ -633,7 +626,7 @@ procedure TSynGWScriptSyn.MinusProc;
 
 procedure TSynGWScriptSyn.ModSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {mod assign}
       begin
@@ -650,7 +643,7 @@ procedure TSynGWScriptSyn.ModSymbolProc;
 
 procedure TSynGWScriptSyn.NotSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {not equal}
       begin
@@ -667,7 +660,7 @@ procedure TSynGWScriptSyn.NotSymbolProc;
 
 procedure TSynGWScriptSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -675,7 +668,7 @@ procedure TSynGWScriptSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X':
         Result := True;
       else
@@ -685,7 +678,7 @@ procedure TSynGWScriptSyn.NumberProc;
 
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar do
   begin
     case FLine[Run] of
@@ -698,7 +691,7 @@ procedure TSynGWScriptSyn.NumberProc;
 
 procedure TSynGWScriptSyn.OrSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {or assign}
       begin
@@ -720,7 +713,7 @@ procedure TSynGWScriptSyn.OrSymbolProc;
 
 procedure TSynGWScriptSyn.PlusProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {add assign}
       begin
@@ -742,7 +735,7 @@ procedure TSynGWScriptSyn.PlusProc;
 
 procedure TSynGWScriptSyn.PointProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
     begin                              {ellipse}
       Inc(Run, 3);
@@ -758,7 +751,7 @@ procedure TSynGWScriptSyn.PointProc;
 procedure TSynGWScriptSyn.RoundCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkRoundClose;
 end;
 
@@ -772,9 +765,9 @@ procedure TSynGWScriptSyn.RoundOpenProc;
 procedure TSynGWScriptSyn.SemiColonProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkSemiColon;
-  FRange := rsUnknown;
+  fRange := rsUnknown;
 end;
 
 procedure TSynGWScriptSyn.SlashProc;
@@ -782,22 +775,22 @@ procedure TSynGWScriptSyn.SlashProc;
   case FLine[Run + 1] of
     '/':                               {c++ style comments}
       begin
-        FTokenID := tkComment;
+        fTokenID := tkComment;
         Inc(Run, 2);
        while not IsLineEnd(Run) do Inc(Run);
       end;
     '*':                               {c style comments}
       begin
-        FTokenID := tkComment;
-        FRange := rsAnsiC;
+        fTokenID := tkComment;
+        fRange := rsAnsiC;
         Inc(Run, 2);
-        while FLine[Run] <> #0 do
-          case FLine[Run] of
+        while fLine[Run] <> #0 do
+          case fLine[Run] of
             '*':
-              if FLine[Run + 1] = '/' then
+              if fLine[Run + 1] = '/' then
               begin
                 Inc(Run, 2);
-                FRange := rsUnknown;
+                fRange := rsUnKnown;
                 Break;
               end else Inc(Run);
             #10: Break;
@@ -808,13 +801,13 @@ procedure TSynGWScriptSyn.SlashProc;
     '=':                               {divide assign}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
         FExtTokenID := xtkDivideAssign;
       end;
   else                                 {divide}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
       FExtTokenID := xtkDivide;
     end;
   end;
@@ -823,27 +816,27 @@ procedure TSynGWScriptSyn.SlashProc;
 procedure TSynGWScriptSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynGWScriptSyn.SquareCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkSquareClose;
 end;
 
 procedure TSynGWScriptSyn.SquareOpenProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkSquareOpen;
 end;
 
 procedure TSynGWScriptSyn.StarProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {multiply assign}
       begin
@@ -860,7 +853,7 @@ procedure TSynGWScriptSyn.StarProc;
 
 procedure TSynGWScriptSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2);
   repeat
     case FLine[Run] of
@@ -879,14 +872,14 @@ procedure TSynGWScriptSyn.StringProc;
 procedure TSynGWScriptSyn.TildeProc;
 begin
   Inc(Run);                            {bitwise complement}
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
   FExtTokenID := xtkBitComplement;
 end;
 
 procedure TSynGWScriptSyn.XOrSymbolProc;
 begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
+  fTokenID := tkSymbol;
+  Case FLine[Run + 1] of
   	'=':                               {xor assign}
       begin
         Inc(Run, 2);
@@ -903,18 +896,18 @@ procedure TSynGWScriptSyn.XOrSymbolProc;
 procedure TSynGWScriptSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynGWScriptSyn.Next;
 begin
-  FTokenPos := Run;
-  case FRange of
+  fTokenPos := Run;
+  case fRange of
     rsAnsiC : AnsiCProc;
   else
     begin
-      FRange := rsUnknown;
-      case FLine[Run] of
+      fRange := rsUnknown;
+      case fLine[Run] of
         '&': AndSymbolProc;
         #39: AsciiCharProc;
         '@': AtSymbolProc;
@@ -957,17 +950,17 @@ procedure TSynGWScriptSyn.Next;
 
 function TSynGWScriptSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynGWScriptSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 function TSynGWScriptSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynGWScriptSyn.GetExtTokenID: TxtkTokenKind;
@@ -977,15 +970,15 @@ function TSynGWScriptSyn.GetExtTokenID: TxtkTokenKind;
 
 function TSynGWScriptSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  case FTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkUnknown: Result := FInvalidAttri;
+  case fTokenID of
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkUnknown: Result := fInvalidAttri;
     else Result := nil;
   end;
 end;
@@ -997,17 +990,17 @@ function TSynGWScriptSyn.GetTokenKind: Integer;
 
 procedure TSynGWScriptSyn.ResetRange;
 begin
-  FRange:= rsUnknown;
+  fRange:= rsUnknown;
 end;
 
 procedure TSynGWScriptSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 function TSynGWScriptSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterGWS;
+  Result := fDefaultFilter <> SYNS_FilterGWS;
 end;
 
 class function TSynGWScriptSyn.GetLanguageName: string;
@@ -1018,24 +1011,22 @@ class function TSynGWScriptSyn.GetLanguageName: string;
 function TSynGWScriptSyn.GetDefaultAttribute (Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT    : Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER : Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD    : Result := FKeyAttri;
-    SYN_ATTR_STRING     : Result := FStringAttri;
-    SYN_ATTR_WHITESPACE : Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL     : Result := FSymbolAttri;
+    SYN_ATTR_COMMENT    : Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER : Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD    : Result := fKeyAttri;
+    SYN_ATTR_STRING     : Result := fStringAttri;
+    SYN_ATTR_WHITESPACE : Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL     : Result := fSymbolAttri;
   else
     Result := nil;
   end;
 end;
 
-class function TSynGWScriptSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynGWScriptSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangGWS;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter (TSynGWScriptSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterGalaxy.pas b/Ext/SynEdit/Source/SynHighlighterGalaxy.pas
index c9ac44d..74a5a4d 100644
--- a/Ext/SynEdit/Source/SynHighlighterGalaxy.pas
+++ b/Ext/SynEdit/Source/SynHighlighterGalaxy.pas
@@ -27,13 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterGalaxy.pas,v 1.12.2.8 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a Galaxy highlighter for SynEdit)
@@ -62,20 +55,20 @@ interface
   TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkSpace, tkMessage,
     tkUnknown);
 
-  TRangeState = (rsUnknown, rsMessageStyle);
+  TRangeState = (rsUnKnown, rsMessageStyle);
 
 type
   TSynGalaxySyn = class(TSynCustomHighlighter)
   private
-    FRange: TRangeState;
+    fRange: TRangeState;
     FTokenID: TtkTokenKind;
-    FMessageAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FCommentAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyWords: TUnicodeStrings;
+    fMessageAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyWords: TStrings;
     procedure PointCommaProc;
     procedure CRProc;
     procedure IdentProc;
@@ -85,12 +78,12 @@   TSynGalaxySyn = class(TSynCustomHighlighter)
     procedure StringProc;
     procedure UnknownProc;
     procedure MessageStyleProc;
-    procedure SetKeyWords(const Value: TUnicodeStrings);
+    procedure SetKeyWords(const Value: TStrings);
   protected
     function IsFilterStored: Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
@@ -102,29 +95,29 @@   TSynGalaxySyn = class(TSynCustomHighlighter)
     function GetTokenAttribute: TSynHighlighterAttributes; override;
     function GetTokenKind: Integer; override;
     function IsIdentChar(AChar: WideChar): Boolean; override;
-    function IsKeyword(const AKeyword: UnicodeString): Boolean; override;
+    function IsKeyword(const AKeyword: string): Boolean; override;
     procedure Next; override;
     procedure SetRange(Value: Pointer); override;
     procedure ResetRange; override;
-
     function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; override;
     function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; override;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property KeyWords: TUnicodeStrings read FKeyWords write SetKeyWords;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property MessageAttri: TSynHighlighterAttributes read FMessageAttri
-      write FMessageAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property KeyWords: TStrings read fKeyWords write SetKeyWords;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property MessageAttri: TSynHighlighterAttributes read fMessageAttri
+      write fMessageAttri;
   end;
 
 implementation
 
 uses
+  Registry,
   SynEditStrConst;
 
 function TSynGalaxySyn.IsIdentChar(AChar: WideChar): Boolean;
@@ -137,19 +130,19 @@ function TSynGalaxySyn.IsIdentChar(AChar: WideChar): Boolean;
   end;
 end;
 
-function TSynGalaxySyn.IsKeyword(const AKeyword: UnicodeString): Boolean;
+function TSynGalaxySyn.IsKeyword(const AKeyword: string): Boolean;
 var
   First, Last, I, Compare: Integer;
-  Token: UnicodeString;
+  Token: string;
 begin
   First := 0;
-  Last := FKeyWords.Count - 1;
+  Last := fKeywords.Count - 1;
   Result := False;
-  Token := SynWideUpperCase(AKeyword);
+  Token := SysUtils.AnsiUpperCase(AKeyword);
   while First <= Last do
   begin
     I := (First + Last) shr 1;
-    Compare := WideCompareStr(FKeyWords[i], Token);
+    Compare := CompareStr(fKeywords[i], Token);
     if Compare = 0 then
     begin
       Result := True;
@@ -163,46 +156,46 @@ constructor TSynGalaxySyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
+  fCaseSensitive := False;
 
-  FKeyWords := TUnicodeStringList.Create;
-  TUnicodeStringList(FKeyWords).Sorted := True;
-  TUnicodeStringList(FKeyWords).Duplicates := dupIgnore;
-  TUnicodeStringList(FKeyWords).CommaText :=
+  fKeyWords := TStringList.Create;
+  TStringList(fKeyWords).Sorted := True;
+  TStringList(fKeyWords).Duplicates := dupIgnore;
+  TStringList(fKeyWords).CommaText :=
     '#end,#galaxy,a,anonymous,autounload,b,battleprotocol,c,cap,cargo,col,' +
     'compress,d,drive,e,emp,f,fleet,fleettables,g,galaxytv,gplus,groupforecast,' +
     'h,i,j,l,m,machinereport,mat,n,namecase,no,o,options,p,planetforecast,' +
     'prodtable,produce,q,r,routesforecast,s,send,shields,shiptypeforecast,' +
     'sortgroups,t,twocol,u,underscores,v,w,war,weapons,x,y,z';
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  AddAttribute(FCommentAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FMessageAttri := TSynHighlighterAttributes.Create(SYNS_AttrMessage, SYNS_FriendlyAttrMessage);
-  AddAttribute(FMessageAttri);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  AddAttribute(fCommentAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style := [fsBold];
+  AddAttribute(fKeyAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fMessageAttri := TSynHighlighterAttributes.Create(SYNS_AttrMessage, SYNS_FriendlyAttrMessage);
+  AddAttribute(fMessageAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
   SetAttributesOnChange(DefHighlightChange);
 
-  FRange := rsUnknown;
-  FDefaultFilter := SYNS_FilterGalaxy;
+  fRange := rsUnknown;
+  fDefaultFilter := SYNS_FilterGalaxy;
 end; { Create }
 
 destructor TSynGalaxySyn.Destroy;
 begin
-  FKeyWords.Free;
+  fKeyWords.Free;
   inherited Destroy;
 end; { Destroy }
 
 procedure TSynGalaxySyn.MessageStyleProc;
 begin
-  FTokenID := tkMessage;
+  fTokenID := tkMessage;
   case FLine[Run] of
     #0:
       begin
@@ -222,9 +215,8 @@ procedure TSynGalaxySyn.MessageStyleProc;
       end;
   end;
 
-  if (Run = 0) and (FLine[Run] = '@') then
-  begin
-    FRange := rsUnknown;
+  if (Run = 0) and (FLine[Run] = '@') then begin
+    fRange := rsUnKnown;
     Inc(Run);
   end else
     while FLine[Run] <> #0 do
@@ -233,56 +225,56 @@ procedure TSynGalaxySyn.MessageStyleProc;
 
 procedure TSynGalaxySyn.PointCommaProc;                                         
 begin
-  FTokenID := tkComment;
-  FRange := rsUnknown;
+  fTokenID := tkComment;
+  fRange := rsUnknown;
   repeat
     Inc(Run);
-  until FLine[Run] = #0;
+  until fLine[Run] = #0;
 end;
 
 procedure TSynGalaxySyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run] = #10 then
+  if fLine[Run] = #10 then
     Inc(Run);
 end;
 
 procedure TSynGalaxySyn.IdentProc;
 begin
-  while IsIdentChar(FLine[Run]) do
+  while IsIdentChar(fLine[Run]) do
     Inc(Run);
   if IsKeyWord(GetToken) then
-    FTokenID := tkKey
+    fTokenId := tkKey
   else
-    FTokenID := tkIdentifier;
+    fTokenId := tkIdentifier;
 end;
 
 procedure TSynGalaxySyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynGalaxySyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
 procedure TSynGalaxySyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynGalaxySyn.StringProc;
 begin
-  if (Run = 0) and (FTokenID <> tkMessage) then
+  if (Run = 0) and (fTokenID <> tkMessage) then
   begin
-    FTokenID := tkMessage;
-    FRange := rsMessageStyle;
+    fTokenID := tkMessage;
+    fRange := rsMessageStyle;
   end;
   Inc(Run);
 end;
@@ -290,16 +282,16 @@ procedure TSynGalaxySyn.StringProc;
 procedure TSynGalaxySyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnKnown;
+  fTokenID := tkUnKnown;
 end;
 
 procedure TSynGalaxySyn.Next;
 begin
-  FTokenPos := Run;
-  if FRange = rsMessageStyle then
+  fTokenPos := Run;
+  if fRange = rsMessageStyle then
     MessageStyleProc
   else
-    case FLine[Run] of
+    case fLine[Run] of
       ';': PointCommaProc;                                      
       #13: CRProc;
       '#','A'..'Z', 'a'..'z', '_': IdentProc;
@@ -315,11 +307,11 @@ procedure TSynGalaxySyn.Next;
 function TSynGalaxySyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -327,28 +319,28 @@ function TSynGalaxySyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttri
 
 function TSynGalaxySyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynGalaxySyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 function TSynGalaxySyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynGalaxySyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  case FTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkMessage: Result := FMessageAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkUnknown: Result := FSymbolAttri;
+  case fTokenID of
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkMessage: Result := fMessageAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkUnknown: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -356,20 +348,20 @@ function TSynGalaxySyn.GetTokenAttribute: TSynHighlighterAttributes;
 
 function TSynGalaxySyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
 procedure TSynGalaxySyn.ResetRange;
 begin
-  FRange := rsUnknown;
+  fRange := rsUnknown;
 end;
 
 procedure TSynGalaxySyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
-procedure TSynGalaxySyn.SetKeyWords(const Value: TUnicodeStrings);
+procedure TSynGalaxySyn.SetKeyWords(const Value: TStrings);
 var
   i: Integer;
 begin
@@ -377,16 +369,16 @@ procedure TSynGalaxySyn.SetKeyWords(const Value: TUnicodeStrings);
     begin
       Value.BeginUpdate;
       for i := 0 to Value.Count - 1 do
-        Value[i] := SynWideUpperCase(Value[i]);
+        Value[i] := SysUtils.AnsiUpperCase(Value[i]);
       Value.EndUpdate;
     end;
-  FKeyWords.Assign(Value);
+  fKeyWords.Assign(Value);
   DefHighLightChange(nil);
 end;
 
 function TSynGalaxySyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterGalaxy;
+  Result := fDefaultFilter <> SYNS_FilterGalaxy;
 end;
 
 class function TSynGalaxySyn.GetLanguageName: string;
@@ -396,9 +388,9 @@ class function TSynGalaxySyn.GetLanguageName: string;
 
 function TSynGalaxySyn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean;
 var
-  r: TBetterRegistry;
+  r: TRegistry;
 begin
-  r := TBetterRegistry.Create;
+  r:= TRegistry.Create;
   try
     r.RootKey := RootKey;
     if r.OpenKeyReadOnly(Key) then
@@ -415,16 +407,13 @@ function TSynGalaxySyn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean;
 
 function TSynGalaxySyn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean;
 var
-  r: TBetterRegistry;
+  r: TRegistry;
 begin
-  r := TBetterRegistry.Create;
+  r:= TRegistry.Create;
   try
     r.RootKey := RootKey;
-    if r.OpenKey(Key,true) then
+    if r.OpenKey(Key, True) then
     begin
-      {$IFNDEF SYN_COMPILER_25_UP}
-      Result := true;
-      {$ENDIF}
       r.WriteString('KeyWords', KeyWords.Text);
       Result := inherited SaveToRegistry(RootKey, Key);
     end
@@ -435,13 +424,11 @@ function TSynGalaxySyn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean;
   end;
 end;
 
-class function TSynGalaxySyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynGalaxySyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangGalaxy;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynGalaxySyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterGeneral.pas b/Ext/SynEdit/Source/SynHighlighterGeneral.pas
index e188d80..1f6474e 100644
--- a/Ext/SynEdit/Source/SynHighlighterGeneral.pas
+++ b/Ext/SynEdit/Source/SynHighlighterGeneral.pas
@@ -28,13 +28,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterGeneral.pas,v 1.12 2011/04/14 15:12:54 Egg Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a customizable highlighter for SynEdit)
@@ -67,11 +60,11 @@ interface
     csCPPStyle);
   TCommentStyles = set of TCommentStyle;
 
-  TRangeState = (rsANil, rsAnsi, rsPasStyle, rsCStyle, rsString, rsUnknown);
+  TRangeState = (rsANil, rsAnsi, rsPasStyle, rsCStyle, rsUnKnown);
 
   TStringDelim = (sdSingleQuote, sdDoubleQuote, sdSingleAndDoubleQuote);
 
-  TGetTokenAttributeEvent = procedure (attribute : TSynHighlighterAttributes) of object;
+  TGetTokenAttributeEvent = procedure (attribute: TSynHighlighterAttributes) of object;
 
 const
    cDefaultIdentChars = '_0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ' +
@@ -80,24 +73,23 @@ interface
 type
   TSynGeneralSyn = class(TSynCustomHighlighter)
   private
-    FIdentChars: UnicodeString;
-    FRange: TRangeState;
-    FTokenID: TtkTokenKind;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FPreprocessorAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FKeyWords: TUnicodeStrings;
-    FComments: TCommentStyles;
-    FStringDelim: TStringDelim;
-    FDetectPreprocessor: Boolean;
-    FOnGetTokenAttribute: TGetTokenAttributeEvent;
-    FStringMultiLine : Boolean;
-    FStringDelimChar: WideChar;
+    fIdentChars: string;
+    fRange: TRangeState;
+    fTokenID: TtkTokenKind;
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fPreprocessorAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    fKeyWords: TStrings;
+    fComments: TCommentStyles;
+    fStringDelim: TStringDelim;
+    fDetectPreprocessor: Boolean;
+    fOnGetTokenAttribute: TGetTokenAttributeEvent;
+    FStringMultiLine: Boolean;
     procedure AsciiCharProc;
     procedure BraceOpenProc;
     procedure PointCommaProc;
@@ -115,19 +107,18 @@   TSynGeneralSyn = class(TSynCustomHighlighter)
     procedure AnsiProc;
     procedure PasStyleProc;
     procedure CStyleProc;
-    procedure SetKeyWords(const Value: TUnicodeStrings);
+    procedure SetKeyWords(const Value: TStrings);
     procedure SetComments(Value: TCommentStyles);
     function GetStringDelim: TStringDelim;
     procedure SetStringDelim(const Value: TStringDelim);
-    function GetIdentifierChars: UnicodeString;
-    procedure SetIdentifierChars(const Value: UnicodeString);
-    function StoreIdentChars : Boolean;
+    function GetIdentifierChars: string;
+    procedure SetIdentifierChars(const Value: string);
+    function StoreIdentChars: Boolean;
     procedure SetDetectPreprocessor(Value: Boolean);
-    procedure SetStringMultiLine(const Value: Boolean);
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
-    function IsStringDelim(aChar : WideChar) : Boolean;
+    class function GetFriendlyLanguageName: string; override;
+    function IsStringDelim(aChar: WideChar): Boolean;
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
@@ -136,106 +127,78 @@   TSynGeneralSyn = class(TSynCustomHighlighter)
     function GetEol: Boolean; override;
     function GetRange: Pointer; override;
     function GetTokenID: TtkTokenKind;
-    function GetCharBeforeToken(offset : Integer = -1) : WideChar;
-    function GetCharAfterToken(offset : Integer = 1) : WideChar;
+    function GetCharBeforeToken(offset: Integer = -1): WideChar;
+    function GetCharAfterToken(offset: Integer = 1): WideChar;
     function GetTokenAttribute: TSynHighlighterAttributes; override;
     function GetTokenKind: Integer; override;
     function IsIdentChar(AChar: WideChar): Boolean; override;
-    function IsKeyword(const AKeyword: UnicodeString): Boolean; override;
+    function IsKeyword(const AKeyword: string): Boolean; override;
     function IsWordBreakChar(AChar: WideChar): Boolean; override;
     procedure Next; override;
     procedure ResetRange; override;
     procedure SetRange(Value: Pointer); override;
-
     function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; override;
     function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; override;
-
-    property OnGetTokenAttribute : TGetTokenAttributeEvent read FOnGetTokenAttribute write FOnGetTokenAttribute;
+    property OnGetTokenAttribute: TGetTokenAttributeEvent read fOnGetTokenAttribute write fOnGetTokenAttribute;
+    property StringMultiLine: Boolean read FStringMultiLine write FStringMultiLine;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri;
-    property Comments: TCommentStyles read FComments write SetComments default [];
-    property DetectPreprocessor: Boolean read FDetectPreprocessor write SetDetectPreprocessor;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri;
-    property IdentifierChars: UnicodeString read GetIdentifierChars write SetIdentifierChars stored StoreIdentChars;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property KeyWords: TUnicodeStrings read FKeyWords write SetKeyWords;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri;
-    property PreprocessorAttri: TSynHighlighterAttributes read FPreprocessorAttri write FPreprocessorAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri;
-    property StringDelim: TStringDelim read GetStringDelim write SetStringDelim default sdSingleQuote;
-    property StringMultiLine: Boolean read FStringMultiLine write SetStringMultiLine;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property Comments: TCommentStyles read fComments write SetComments default [];
+    property DetectPreprocessor: Boolean read fDetectPreprocessor
+      write SetDetectPreprocessor;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property IdentifierChars: string read GetIdentifierChars
+      write SetIdentifierChars stored StoreIdentChars;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property KeyWords: TStrings read fKeyWords write SetKeyWords;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property PreprocessorAttri: TSynHighlighterAttributes
+      read fPreprocessorAttri write fPreprocessorAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
+    property StringDelim: TStringDelim read GetStringDelim write SetStringDelim
+      default sdSingleQuote;
   end;
 
 implementation
 
 uses
+  Registry,
   SynEditStrConst;
 
-constructor TSynGeneralSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-  FKeyWords := TUnicodeStringList.Create;
-  TUnicodeStringList(FKeyWords).Sorted := True;
-  TUnicodeStringList(FKeyWords).Duplicates := dupIgnore;
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  AddAttribute(FCommentAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style := [fsBold];
-  AddAttribute(FKeyAttri);
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
-  FPreprocessorAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
-  AddAttribute(FPreprocessorAttri);
-  SetAttributesOnChange(DefHighlightChange);
-
-  FStringDelim := sdSingleQuote;
-  FIdentChars := cDefaultIdentChars;
-  FRange := rsUnknown;
-end; { Create }
-
-destructor TSynGeneralSyn.Destroy;
-begin
-  FKeyWords.Free;
-  inherited Destroy;
-end; { Destroy }
-
 function TSynGeneralSyn.IsIdentChar(AChar: WideChar): Boolean;
 var
   i: Integer;
 begin
   Result := False;
-  for i := 1 to Length(FIdentChars) do
-    if AChar = FIdentChars[i] then
+  for i := 1 to Length(fIdentChars) do
+    if AChar = fIdentChars[i] then
     begin
       Result := True;
       Exit;
     end;
 end;
 
-function TSynGeneralSyn.IsKeyword(const AKeyword: UnicodeString): Boolean;
+function TSynGeneralSyn.IsKeyword(const AKeyword: string): Boolean;
 var
   First, Last, I, Compare: Integer;
-  Token: UnicodeString;
+  Token: string;
 begin
   First := 0;
-  Last := FKeyWords.Count - 1;
+  Last := fKeywords.Count - 1;
   Result := False;
-  Token := SynWideUpperCase(AKeyword);
+  Token := SysUtils.AnsiUpperCase(AKeyword);
   while First <= Last do
   begin
     I := (First + Last) shr 1;
-    Compare := WideCompareText(FKeyWords[i], Token);
+    Compare := CompareText(fKeywords[i], Token);
     if Compare = 0 then
     begin
       Result := True;
@@ -253,18 +216,55 @@ function TSynGeneralSyn.IsWordBreakChar(AChar: WideChar): Boolean;
   Result := inherited IsWordBreakChar(AChar) and not IsIdentChar(AChar);
 end;
 
+constructor TSynGeneralSyn.Create(AOwner: TComponent);
+begin
+  inherited Create(AOwner);
+  fKeyWords := TStringList.Create;
+  TStringList(fKeyWords).Sorted := True;
+  TStringList(fKeyWords).Duplicates := dupIgnore;
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  AddAttribute(fCommentAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style := [fsBold];
+  AddAttribute(fKeyAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
+  fPreprocessorAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
+  AddAttribute(fPreprocessorAttri);
+  SetAttributesOnChange(DefHighlightChange);
+
+  fStringDelim := sdSingleQuote;
+  fIdentChars := cDefaultIdentChars;
+  fRange := rsUnknown;
+end; { Create }
+
+destructor TSynGeneralSyn.Destroy;
+begin
+  fKeyWords.Free;
+  inherited Destroy;
+end; { Destroy }
+
 procedure TSynGeneralSyn.AnsiProc;
 begin
-  case FLine[Run] of
+  case fLine[Run] of
      #0: NullProc;
     #10: LFProc;
     #13: CRProc;
   else
-    FTokenID := tkComment;
+    fTokenID := tkComment;
     repeat
-      if (FLine[Run] = '*') and (FLine[Run + 1] = ')') then
+      if (fLine[Run] = '*') and (fLine[Run + 1] = ')') then
       begin
-        FRange := rsUnknown;
+        fRange := rsUnKnown;
         Inc(Run, 2);
         Break;
       end;
@@ -275,16 +275,16 @@ procedure TSynGeneralSyn.AnsiProc;
 
 procedure TSynGeneralSyn.PasStyleProc;
 begin
-  case FLine[Run] of
+  case fLine[Run] of
      #0: NullProc;
     #10: LFProc;
     #13: CRProc;
   else
-    FTokenID := tkComment;
+    fTokenID := tkComment;
     repeat
-      if FLine[Run] = '}' then
+      if fLine[Run] = '}' then
       begin
-        FRange := rsUnknown;
+        fRange := rsUnKnown;
         Inc(Run);
         Break;
       end;
@@ -295,16 +295,16 @@ procedure TSynGeneralSyn.PasStyleProc;
 
 procedure TSynGeneralSyn.CStyleProc;
 begin
-  case FLine[Run] of
+  case fLine[Run] of
      #0: NullProc;
     #10: LFProc;
     #13: CRProc;
   else
-    FTokenID := tkComment;
+    fTokenID := tkComment;
     repeat
-      if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then
+      if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then
       begin
-        FRange := rsUnknown;
+        fRange := rsUnKnown;
         Inc(Run, 2);
         Break;
       end;
@@ -315,39 +315,40 @@ procedure TSynGeneralSyn.CStyleProc;
 
 procedure TSynGeneralSyn.AsciiCharProc;
 begin
-  if FDetectPreprocessor then
+  if fDetectPreprocessor then
   begin
-    FTokenID := tkPreprocessor;
+    fTokenID := tkPreprocessor;
     repeat
       Inc(Run);
     until IsLineEnd(Run);
   end
   else
   begin
-    FTokenID := tkString;
+    fTokenID := tkString;
     repeat
       Inc(Run);
-    until not CharInSet(FLine[Run], ['0'..'9']);
+    until not CharInSet(fLine[Run], ['0'..'9']);
   end;
 end;
 
 procedure TSynGeneralSyn.BraceOpenProc;
 begin
-  if csPasStyle in FComments then
+  if csPasStyle in fComments then
   begin
-    FTokenID := tkComment;
-    FRange := rsPasStyle;
+    fTokenID := tkComment;
+    fRange := rsPasStyle;
     Inc(Run);
     while FLine[Run] <> #0 do
       case FLine[Run] of
         '}':
           begin
-            FRange := rsUnknown;
+            fRange := rsUnKnown;
             Inc(Run);
             Break;
           end;
-        #10, #13:
-          Break;
+        #10: Break;
+
+        #13: Break;
       else
         Inc(Run);
       end;
@@ -355,51 +356,51 @@ procedure TSynGeneralSyn.BraceOpenProc;
   else
   begin
     Inc(Run);
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynGeneralSyn.PointCommaProc;
 begin
-  if (csASmStyle in FComments) or (csBasStyle in FComments) then
+  if (csASmStyle in fComments) or (csBasStyle in fComments) then
   begin
-    FTokenID := tkComment;
-    FRange := rsUnknown;
+    fTokenID := tkComment;
+    fRange := rsUnknown;
     Inc(Run);
     while FLine[Run] <> #0 do
     begin
-      FTokenID := tkComment;
+      fTokenID := tkComment;
       Inc(Run);
     end;
   end
   else
   begin
     Inc(Run);
-    FTokenID := tkSymbol;
+    fTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynGeneralSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run] = #10 then Inc(Run);
+  if fLine[Run] = #10 then Inc(Run);
 end;
 
 procedure TSynGeneralSyn.IdentProc;
 begin
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
   if IsKeyWord(GetToken) then
-    FTokenID := tkKey
+    fTokenId := tkKey
   else
-    FTokenID := tkIdentifier;
+    fTokenId := tkIdentifier;
 end;
 
 procedure TSynGeneralSyn.IntegerProc;
 
   function IsIntegerChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f':
         Result := True;
       else
@@ -409,19 +410,19 @@ procedure TSynGeneralSyn.IntegerProc;
 
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsIntegerChar do Inc(Run);
 end;
 
 procedure TSynGeneralSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynGeneralSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -429,7 +430,7 @@ procedure TSynGeneralSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', '.', 'e', 'E', 'x':
         Result := True;
       else
@@ -439,15 +440,14 @@ procedure TSynGeneralSyn.NumberProc;
 
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar do
   begin
     case FLine[Run] of
-      'x':
-        begin // handle C style hex numbers
-          IntegerProc;
-          Break;
-        end;
+      'x': begin // handle C style hex numbers
+             IntegerProc;
+             Break;
+           end;
       '.':
         if FLine[Run + 1] = '.' then Break;
     end;
@@ -458,40 +458,39 @@ procedure TSynGeneralSyn.NumberProc;
 procedure TSynGeneralSyn.RoundOpenProc;
 begin
   Inc(Run);
-  if csAnsiStyle in FComments then
+  if csAnsiStyle in fComments then
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '*':
         begin
-          FTokenID := tkComment;
-          FRange := rsAnsi;
+          fTokenID := tkComment;
+          fRange := rsAnsi;
           Inc(Run);
-          while FLine[Run] <> #0 do
-            case FLine[Run] of
+          while fLine[Run] <> #0 do
+            case fLine[Run] of
               '*':
-                if FLine[Run + 1] = ')' then
+                if fLine[Run + 1] = ')' then
                 begin
-                  FRange := rsUnknown;
+                  fRange := rsUnKnown;
                   Inc(Run, 2);
                   Break;
                 end else Inc(Run);
-              #10, #13:
-                Break;
-              else
-                Inc(Run);
+              #10: Break;
+              #13: Break;
+            else Inc(Run);
             end;
         end;
       '.':
         begin
           Inc(Run);
-          FTokenID := tkSymbol;
+          fTokenID := tkSymbol;
         end;
     else
       begin
         FTokenID := tkSymbol;
       end;
     end;
-  end else FTokenID := tkSymbol;
+  end else fTokenId := tkSymbol;
 end;
 
 procedure TSynGeneralSyn.SlashProc;
@@ -500,9 +499,9 @@ procedure TSynGeneralSyn.SlashProc;
   case FLine[Run] of
     '/':
       begin
-        if csCPPStyle in FComments then
+        if csCPPStyle in fComments then
         begin
-          FTokenID := tkComment;
+          fTokenID := tkComment;
           Inc(Run);
           while FLine[Run] <> #0 do
           begin
@@ -513,21 +512,21 @@ procedure TSynGeneralSyn.SlashProc;
           end;
         end
         else
-          FTokenID := tkSymbol;
+          fTokenId := tkSymbol;
       end;
     '*':
       begin
-        if csCStyle in FComments then
+        if csCStyle in fComments then
         begin
-          FTokenID := tkComment;
-          FRange := rsCStyle;
+          fTokenID := tkComment;
+          fRange := rsCStyle;
           Inc(Run);
-          while FLine[Run] <> #0 do
-            case FLine[Run] of
+          while fLine[Run] <> #0 do
+            case fLine[Run] of
               '*':
-                if FLine[Run + 1] = '/' then
+                if fLine[Run + 1] = '/' then
                 begin
-                  FRange := rsUnknown;
+                  fRange := rsUnKnown;
                   Inc(Run, 2);
                   Break;
                 end else Inc(Run);
@@ -538,99 +537,69 @@ procedure TSynGeneralSyn.SlashProc;
             end;
         end
         else
-          FTokenID := tkSymbol;
+          fTokenId := tkSymbol;
       end;
     else
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynGeneralSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynGeneralSyn.StringProc;
+var
+   delim: WideChar;
 begin
-  FTokenID := tkString;
-  FRange := rsString;
-  if IsStringDelim(FLine[Run + 1]) and IsStringDelim(FLine[Run + 2]) then
+  fTokenID := tkString;
+  if IsStringDelim(fLine[Run + 1]) and IsStringDelim(fLine[Run + 2]) then
     Inc(Run, 2);
-
-  // eventualy store the string delimiter
-  if FStringDelimChar = #0 then
-    FStringDelimChar := FLine[Run];
-
-  Inc(Run);
-  while not IsLineEnd(Run) do
-  begin
-    if FLine[Run] = FStringDelimChar then
-    begin
-      Inc(Run);
-      if FLine[Run] <> FStringDelimChar then
-      begin
-        FRange := rsUnknown;
-        FStringDelimChar := #0;
-        Break;
-      end;
+  delim:=fLine[Run];
+  repeat
+    case FLine[Run] of
+      #0:  Break;
+      #10, #13: if not StringMultiLine then Break;
     end;
     Inc(Run);
-  end;
-
-  if IsLineEnd(Run) and (not FStringMultiLine) then
-  begin
-    FRange := rsUnknown;
-    FStringDelimChar := #0;
-  end;
+  until FLine[Run] = delim;
+  if FLine[Run] <> #0 then Inc(Run);
 end;
 
 procedure TSynGeneralSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynGeneralSyn.Next;
 begin
-  FTokenPos := Run;
-  case FRange of
+  fTokenPos := Run;
+  case fRange of
     rsAnsi: AnsiProc;
     rsPasStyle: PasStyleProc;
     rsCStyle: CStyleProc;
-    rsString: StringProc;
   else
-    if IsStringDelim(FLine[Run]) then
+    if IsStringDelim(fLine[Run]) then
       StringProc
     else
-      case FLine[Run] of
-        '#':
-          AsciiCharProc;
-        '{':
-          BraceOpenProc;
-        ';':
-          PointCommaProc;
-        #13:
-          CRProc;
-        'A'..'Z', 'a'..'z', '_':
-          IdentProc;
-        '$':
-          IntegerProc;
-        #10:
-          LFProc;
-        #0:
-          NullProc;
-        '0'..'9':
-          NumberProc;
-        '(':
-          RoundOpenProc;
-        '/':
-          SlashProc;
-        #1..#9, #11, #12, #14..#32:
-          SpaceProc;
-        else
-          UnknownProc;
+      case fLine[Run] of
+        '#': AsciiCharProc;
+        '{': BraceOpenProc;
+        ';': PointCommaProc;
+        #13: CRProc;
+        'A'..'Z', 'a'..'z', '_': IdentProc;
+        '$': IntegerProc;
+        #10: LFProc;
+        #0: NullProc;
+        '0'..'9': NumberProc;
+        '(': RoundOpenProc;
+        '/': SlashProc;
+        #1..#9, #11, #12, #14..#32: SpaceProc;
+        else UnknownProc;
       end;
   end;
   inherited;
@@ -639,12 +608,12 @@ procedure TSynGeneralSyn.Next;
 function TSynGeneralSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -652,94 +621,93 @@ function TSynGeneralSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttr
 
 function TSynGeneralSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynGeneralSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 function TSynGeneralSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 // GetCharBeforeToken
 //
 function TSynGeneralSyn.GetCharBeforeToken(offset: Integer = -1): WideChar;
 begin
-  if FTokenPos + offset >= 0 then
-    Result := FLine[FTokenPos + offset]
-  else
-    Result := #0;
+   if fTokenPos+offset>=0 then
+      Result:=FLine[fTokenPos+offset]
+   else Result:=#0;
 end;
 
 // GetCharAfterToken
 //
 function TSynGeneralSyn.GetCharAfterToken(offset: Integer = 1): WideChar;
 begin
-  Result := FLine[FTokenPos + offset];
+   Result:=FLine[fTokenPos+offset];
 end;
 
 function TSynGeneralSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  case FTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkPreprocessor: Result := FPreprocessorAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkUnknown: Result := FSymbolAttri;
+  case fTokenID of
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkPreprocessor: Result := fPreprocessorAttri;                         
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkUnknown: Result := fSymbolAttri;
   else
     Result := nil;
   end;
-  if Assigned(FOnGetTokenAttribute) then
-    FOnGetTokenAttribute(Result);
+  if Assigned(fOnGetTokenAttribute) then
+    fOnGetTokenAttribute(Result);
 end;
 
 function TSynGeneralSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
 procedure TSynGeneralSyn.ResetRange;
 begin
-  FRange := rsUnknown;
+  fRange := rsUnknown;
 end;
 
 procedure TSynGeneralSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
-procedure TSynGeneralSyn.SetKeyWords(const Value: TUnicodeStrings);
+procedure TSynGeneralSyn.SetKeyWords(const Value: TStrings);
 var
   i: Integer;
 begin
   if Value <> nil then
-  begin
-    Value.BeginUpdate;
-    for i := 0 to Value.Count - 1 do
-      Value[i] := SynWideUpperCase(Value[i]);
-    Value.EndUpdate;
-  end;
+    begin 
+      Value.BeginUpdate;
+      for i := 0 to Value.Count - 1 do
+        Value[i] := SysUtils.AnsiUpperCase(Value[i]);
+      Value.EndUpdate;
+    end;
 
-  TUnicodeStringList(FKeyWords).Sorted := False;
-  FKeyWords.Assign(Value);
-  TUnicodeStringList(FKeyWords).Sorted := True;
+  TStringList(fKeyWords).Sorted:=False;
+  fKeyWords.Assign(Value);
+  TStringList(fKeyWords).Sorted:=True;
 
   DefHighLightChange(nil);
 end;
 
 procedure TSynGeneralSyn.SetComments(Value: TCommentStyles);
 begin
-  if FComments <> Value then
+  if fComments <> Value then
   begin
-    FComments := Value;
+    fComments := Value;
     DefHighLightChange(Self);
   end;
 end;
@@ -751,111 +719,88 @@ class function TSynGeneralSyn.GetLanguageName: string;
 
 function TSynGeneralSyn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean;
 var
-  r: TBetterRegistry;
+  Reg: TRegistry;
 begin
-  r := TBetterRegistry.Create;
+  Reg:= TRegistry.Create;
   try
-    r.RootKey := RootKey;
-    if r.OpenKeyReadOnly(Key) then begin
-      if r.ValueExists('KeyWords') then KeyWords.Text:= r.ReadString('KeyWords');
+    Reg.RootKey := RootKey;
+    if Reg.OpenKeyReadOnly(Key) then begin
+      if Reg.ValueExists('KeyWords') then KeyWords.Text:= Reg.ReadString('KeyWords');
       Result := inherited LoadFromRegistry(RootKey, Key);
     end
     else
       Result := False;
-  finally
-    r.Free;
-  end;
+  finally Reg.Free; end;
 end;
 
 function TSynGeneralSyn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean;
 var
-  r: TBetterRegistry;
+  Reg: TRegistry;
 begin
-  r := TBetterRegistry.Create;
+  Reg:= TRegistry.Create;
   try
-    r.RootKey := RootKey;
-    if r.OpenKey(Key,true) then begin
-      {$IFNDEF SYN_COMPILER_25_UP}
-      Result := true;
-      {$ENDIF}
-      r.WriteString('KeyWords', KeyWords.Text);
+    Reg.RootKey := RootKey;
+    if Reg.OpenKey(Key, True) then
+    begin
+      Reg.WriteString('KeyWords', KeyWords.Text);
       Result := inherited SaveToRegistry(RootKey, Key);
     end
     else
       Result := False;
-  finally
-    r.Free;
-  end;
+  finally Reg.Free; end;
 end;
 
 function TSynGeneralSyn.GetStringDelim: TStringDelim;
 begin
-  Result := FStringDelim;
+  Result:=fStringDelim;
 end;
 
 procedure TSynGeneralSyn.SetStringDelim(const Value: TStringDelim);
 begin
-  if FStringDelim <> Value then
-  begin
-    FStringDelim := Value;
-    DefHighLightChange(Self);
-  end;
-end;
-
-procedure TSynGeneralSyn.SetStringMultiLine(const Value: Boolean);
-begin
-  if FStringMultiLine <> Value then
-  begin
-    FStringMultiLine := Value;
-    DefHighLightChange(Self);
-  end;
+   fStringDelim:=Value;
 end;
 
-function TSynGeneralSyn.GetIdentifierChars: UnicodeString;
+function TSynGeneralSyn.GetIdentifierChars: string;
 begin
-  Result := FIdentChars;
+  Result := fIdentChars;
 end;
 
-procedure TSynGeneralSyn.SetIdentifierChars(const Value: UnicodeString);
+procedure TSynGeneralSyn.SetIdentifierChars(const Value: string);
 begin
-  FIdentChars := Value;
+  fIdentChars := Value;
 end;
 
-function TSynGeneralSyn.StoreIdentChars : Boolean;
+function TSynGeneralSyn.StoreIdentChars: Boolean;
 begin
-  Result := (FIdentChars <> cDefaultIdentChars);
+   Result := (fIdentChars<>cDefaultIdentChars);
 end;
 
 procedure TSynGeneralSyn.SetDetectPreprocessor(Value: Boolean);
 begin
-  if Value <> FDetectPreprocessor then
+  if Value <> fDetectPreprocessor then
   begin
-    FDetectPreprocessor := Value;
+    fDetectPreprocessor := Value;
     DefHighlightChange(Self);
   end;
 end;
 
-class function TSynGeneralSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynGeneralSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangGeneral;
 end;
 
 // IsStringDelim
 //
-function TSynGeneralSyn.IsStringDelim(aChar : WideChar): Boolean;
+function TSynGeneralSyn.IsStringDelim(aChar: WideChar): Boolean;
 begin
-  case FStringDelim of
-    sdSingleQuote:
-      Result := (aChar = '''');
-    sdDoubleQuote:
-      Result := (aChar = '"');
-  else
-    Result := (aChar = '''') or (aChar = '"');
-  end;
+   case fStringDelim of
+      sdSingleQuote: Result:=(aChar='''');
+      sdDoubleQuote: Result:=(aChar='"');
+   else
+      Result:=(aChar='''') or (aChar='"');
+   end;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}                                                    
   RegisterPlaceableHighlighter(TSynGeneralSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterGo.pas b/Ext/SynEdit/Source/SynHighlighterGo.pas
deleted file mode 100644
index 37c073d..0000000
--- a/Ext/SynEdit/Source/SynHighlighterGo.pas
+++ /dev/null
@@ -1,959 +0,0 @@
-{-------------------------------------------------------------------------------
-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.
-
-Code template generated with SynGen.
-The original code is: SynHighlighterGo.pas, released 2017-06-01.
-Description: Syntax Parser/Highlighter
-The initial author of this file is Christian-W. Budde.
-Copyright (c) 2017, all rights reserved.
-
-Contributors to the SynEdit and mwEdit projects are listed in the
-Contributors.txt file.
-
-Alternatively, the contents of this file may be used under the terms of the
-GNU General Public License Version 2 or later (the "GPL"), in which case
-the provisions of the GPL are applicable instead of those above.
-If you wish to allow use of your version of this file only under the terms
-of the GPL and not to allow others to use your version of this file
-under the MPL, indicate your decision by deleting the provisions above and
-replace them with the notice and other provisions required by the GPL.
-If you do not delete the provisions above, a recipient may use your version
-of this file under either the MPL or the GPL.
-
-$Id: $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
--------------------------------------------------------------------------------}
-
-unit SynHighlighterGo;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  Graphics,
-  SynEditTypes,
-  SynEditHighlighter,
-  SynUnicode,
-  SysUtils,
-  Classes;
-
-type
-  TtkTokenKind = (
-    tkComment,
-    tkIdentifier,
-    tkFloat,
-    tkKey,
-    tkNull,
-    tkNumber,
-    tkSpace,
-    tkString,
-    tkSymbol,
-    tkUnknown);
-
-  TRangeState = (rsUnknown, rsSingleString, rsDoubleString, rsExtraString);
-
-  TProcTableProc = procedure of object;
-
-  PIdentFuncTableFunc = ^TIdentFuncTableFunc;
-  TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
-
-type
-  TSynGoSyn = class(TSynCustomHighlighter)
-  private
-    fRange: TRangeState;
-    fTokenID: TtkTokenKind;
-    fIdentFuncTable: array[0..88] of TIdentFuncTableFunc;
-    fCommentAttri: TSynHighlighterAttributes;
-    fNumberAttri: TSynHighlighterAttributes;
-    fIdentifierAttri: TSynHighlighterAttributes;
-    fKeyAttri: TSynHighlighterAttributes;
-    fSpaceAttri: TSynHighlighterAttributes;
-    fStringAttri: TSynHighlighterAttributes;
-    fSymbolAttri: TSynHighlighterAttributes;
-    function HashKey(Str: PWideChar): Cardinal;
-    function FuncBool(Index: Integer): TtkTokenKind;
-    function FuncBreak(Index: Integer): TtkTokenKind;
-    function FuncByte(Index: Integer): TtkTokenKind;
-    function FuncCase(Index: Integer): TtkTokenKind;
-    function FuncChan(Index: Integer): TtkTokenKind;
-    function FuncComplex128(Index: Integer): TtkTokenKind;
-    function FuncComplex64(Index: Integer): TtkTokenKind;
-    function FuncConst(Index: Integer): TtkTokenKind;
-    function FuncContinue(Index: Integer): TtkTokenKind;
-    function FuncDefault(Index: Integer): TtkTokenKind;
-    function FuncDefer(Index: Integer): TtkTokenKind;
-    function FuncElse(Index: Integer): TtkTokenKind;
-    function FuncFallthrough(Index: Integer): TtkTokenKind;
-    function FuncFloat32(Index: Integer): TtkTokenKind;
-    function FuncFloat64(Index: Integer): TtkTokenKind;
-    function FuncFor(Index: Integer): TtkTokenKind;
-    function FuncFunc(Index: Integer): TtkTokenKind;
-    function FuncGo(Index: Integer): TtkTokenKind;
-    function FuncGoto(Index: Integer): TtkTokenKind;
-    function FuncIf(Index: Integer): TtkTokenKind;
-    function FuncImport(Index: Integer): TtkTokenKind;
-    function FuncInt(Index: Integer): TtkTokenKind;
-    function FuncInt16(Index: Integer): TtkTokenKind;
-    function FuncInt32(Index: Integer): TtkTokenKind;
-    function FuncInt64(Index: Integer): TtkTokenKind;
-    function FuncInt8(Index: Integer): TtkTokenKind;
-    function FuncInterface(Index: Integer): TtkTokenKind;
-    function FuncMap(Index: Integer): TtkTokenKind;
-    function FuncPackage(Index: Integer): TtkTokenKind;
-    function FuncRange(Index: Integer): TtkTokenKind;
-    function FuncReturn(Index: Integer): TtkTokenKind;
-    function FuncRune(Index: Integer): TtkTokenKind;
-    function FuncSelect(Index: Integer): TtkTokenKind;
-    function FuncString(Index: Integer): TtkTokenKind;
-    function FuncStruct(Index: Integer): TtkTokenKind;
-    function FuncSwitch(Index: Integer): TtkTokenKind;
-    function FuncType(Index: Integer): TtkTokenKind;
-    function FuncUint(Index: Integer): TtkTokenKind;
-    function FuncUint16(Index: Integer): TtkTokenKind;
-    function FuncUint32(Index: Integer): TtkTokenKind;
-    function FuncUint64(Index: Integer): TtkTokenKind;
-    function FuncUint8(Index: Integer): TtkTokenKind;
-    function FuncUintptr(Index: Integer): TtkTokenKind;
-    function FuncVar(Index: Integer): TtkTokenKind;
-    procedure IdentProc;
-    procedure UnknownProc;
-    function AltFunc(Index: Integer): TtkTokenKind;
-    procedure InitIdent;
-    function IdentKind(MayBe: PWideChar): TtkTokenKind;
-    procedure CRProc;
-    procedure LFProc;
-    procedure NullProc;
-    procedure NumberProc;
-    procedure SlashProc;
-    procedure SpaceProc;
-    procedure StringProc;
-    procedure SymbolProc;
-  protected
-    function GetSampleSource: UnicodeString; override;
-    function IsFilterStored: Boolean; override;
-  public
-    constructor Create(AOwner: TComponent); override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
-    class function GetLanguageName: string; override;
-    function GetRange: Pointer; override;
-    procedure ResetRange; override;
-    procedure SetRange(Value: Pointer); override;
-    function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override;
-    function GetEol: Boolean; override;
-    function GetKeyWords(TokenKind: Integer): UnicodeString; override;
-    function GetTokenID: TtkTokenKind;
-    function GetTokenAttribute: TSynHighlighterAttributes; override;
-    function GetTokenKind: Integer; override;
-    function IsIdentChar(AChar: WideChar): Boolean; override;
-    procedure Next; override;
-  published
-    property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri;
-    property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
-    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri;
-  end;
-
-implementation
-
-uses
-  SynEditStrConst;
-
-const
-  // as this language is case-insensitive keywords *must* be in lowercase
-  KeyWords: array[0..43] of UnicodeString = (
-    'bool', 'break', 'byte', 'case', 'chan', 'complex128', 'complex64', 'const', 
-    'continue', 'default', 'defer', 'else', 'fallthrough', 'float32', 'float64', 
-    'for', 'func', 'go', 'goto', 'if', 'import', 'int', 'int16', 'int32', 
-    'int64', 'int8', 'interface', 'map', 'package', 'range', 'return', 'rune', 
-    'select', 'string', 'struct', 'switch', 'type', 'uint', 'uint16', 'uint32', 
-    'uint64', 'uint8', 'uintptr', 'var' 
-  );
-
-  KeyIndices: array[0..88] of Integer = (
-    29, 24, -1, -1, -1, 7, -1, 37, 11, -1, 22, 14, -1, 21, 1, -1, -1, -1, 39, 
-    31, -1, -1, -1, 28, -1, -1, 17, -1, -1, -1, 32, 30, 26, 41, 23, -1, 34, -1, 
-    -1, -1, -1, -1, -1, 9, 13, 20, -1, 35, -1, 3, -1, -1, 15, -1, -1, 25, -1, 
-    27, 4, 6, -1, 5, -1, -1, 10, 2, 16, -1, -1, -1, 43, -1, -1, 8, 40, 36, 33, 
-    -1, -1, -1, -1, 18, 19, 38, -1, 42, 12, -1, 0 
-  );
-
-procedure TSynGoSyn.InitIdent;
-var
-  i: Integer;
-begin
-  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      fIdentFuncTable[i] := AltFunc;
-
-  fIdentFuncTable[88] := FuncBool;
-  fIdentFuncTable[14] := FuncBreak;
-  fIdentFuncTable[65] := FuncByte;
-  fIdentFuncTable[49] := FuncCase;
-  fIdentFuncTable[58] := FuncChan;
-  fIdentFuncTable[61] := FuncComplex128;
-  fIdentFuncTable[59] := FuncComplex64;
-  fIdentFuncTable[5] := FuncConst;
-  fIdentFuncTable[73] := FuncContinue;
-  fIdentFuncTable[43] := FuncDefault;
-  fIdentFuncTable[64] := FuncDefer;
-  fIdentFuncTable[8] := FuncElse;
-  fIdentFuncTable[86] := FuncFallthrough;
-  fIdentFuncTable[44] := FuncFloat32;
-  fIdentFuncTable[11] := FuncFloat64;
-  fIdentFuncTable[52] := FuncFor;
-  fIdentFuncTable[66] := FuncFunc;
-  fIdentFuncTable[26] := FuncGo;
-  fIdentFuncTable[81] := FuncGoto;
-  fIdentFuncTable[82] := FuncIf;
-  fIdentFuncTable[45] := FuncImport;
-  fIdentFuncTable[13] := FuncInt;
-  fIdentFuncTable[10] := FuncInt16;
-  fIdentFuncTable[34] := FuncInt32;
-  fIdentFuncTable[1] := FuncInt64;
-  fIdentFuncTable[55] := FuncInt8;
-  fIdentFuncTable[32] := FuncInterface;
-  fIdentFuncTable[57] := FuncMap;
-  fIdentFuncTable[23] := FuncPackage;
-  fIdentFuncTable[0] := FuncRange;
-  fIdentFuncTable[31] := FuncReturn;
-  fIdentFuncTable[19] := FuncRune;
-  fIdentFuncTable[30] := FuncSelect;
-  fIdentFuncTable[76] := FuncString;
-  fIdentFuncTable[36] := FuncStruct;
-  fIdentFuncTable[47] := FuncSwitch;
-  fIdentFuncTable[75] := FuncType;
-  fIdentFuncTable[7] := FuncUint;
-  fIdentFuncTable[83] := FuncUint16;
-  fIdentFuncTable[18] := FuncUint32;
-  fIdentFuncTable[74] := FuncUint64;
-  fIdentFuncTable[33] := FuncUint8;
-  fIdentFuncTable[85] := FuncUintptr;
-  fIdentFuncTable[70] := FuncVar;
-end;
-
-{$Q-}
-function TSynGoSyn.HashKey(Str: PWideChar): Cardinal;
-begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-    Result := Result * 345 + Ord(Str^) * 670;
-    inc(Str);
-  end;
-  Result := Result mod 89;
-  fStringLen := Str - fToIdent;
-end;
-{$Q+}
-
-function TSynGoSyn.FuncBool(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncBreak(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncByte(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncCase(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncChan(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncComplex128(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncComplex64(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncConst(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncContinue(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncDefault(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncDefer(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncElse(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncFallthrough(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncFloat32(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncFloat64(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncFor(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncFunc(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncGo(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncGoto(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncIf(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncImport(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncInt(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncInt16(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncInt32(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncInt64(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncInt8(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncInterface(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncMap(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncPackage(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncRange(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncReturn(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncRune(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncSelect(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncString(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncStruct(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncSwitch(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncType(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncUint(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncUint16(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncUint32(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncUint64(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncUint8(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncUintptr(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.FuncVar(Index: Integer): TtkTokenKind;
-begin
-  if IsCurrentToken(KeyWords[Index]) then
-    Result := tkKey
-  else
-    Result := tkIdentifier;
-end;
-
-function TSynGoSyn.AltFunc(Index: Integer): TtkTokenKind;
-begin
-  Result := tkIdentifier;
-end;
-
-function TSynGoSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
-var
-  Key: Cardinal;
-begin
-  fToIdent := MayBe;
-  Key := HashKey(MayBe);
-  if Key <= High(fIdentFuncTable) then
-    Result := fIdentFuncTable[Key](KeyIndices[Key])
-  else
-    Result := tkIdentifier;
-end;
-
-procedure TSynGoSyn.SpaceProc;
-begin
-  inc(Run);
-  fTokenID := tkSpace;
-  while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run);
-end;
-
-procedure TSynGoSyn.StringProc;
-var
-  StringChar: WideChar;
-begin
-  fTokenID := tkString;
-  StringChar := fLine[Run];
-  repeat
-    inc(Run);
-  until IsLineEnd(Run) or (fLine[Run] = StringChar);
-
-  if FLine[Run] = #34 then
-    inc(Run);
-end;
-
-procedure TSynGoSyn.NullProc;
-begin
-  fTokenID := tkNull;
-  inc(Run);
-end;
-
-procedure TSynGoSyn.CRProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-  if fLine[Run] = #10 then
-    inc(Run);
-end;
-
-procedure TSynGoSyn.LFProc;
-begin
-  fTokenID := tkSpace;
-  inc(Run);
-end;
-
-procedure TSynGoSyn.SlashProc;
-begin
-  case FLine[Run + 1] of
-    '/':
-      begin
-        fTokenID := tkComment;
-        inc(Run, 2);
-        while not IsLineEnd(Run) do Inc(Run);
-      end;
-    '*':
-      begin
-        fTokenID := tkComment;
-        inc(Run, 2);
-        while fLine[Run] <> #0 do
-          case fLine[Run] of
-            '*':
-              if fLine[Run + 1] = '/' then
-              begin
-                inc(Run, 2);
-                break;
-              end else inc(Run);
-            #10, #13:
-                break;
-          else inc(Run);
-          end;
-      end;
-    '=':
-      begin
-        inc(Run, 2);
-        fTokenID := tkSymbol;
-      end;
-  else
-    begin
-      inc(Run);
-      fTokenID := tkSymbol;
-    end;
-  end;
-end;
-
-constructor TSynGoSyn.Create(AOwner: TComponent);
-begin
-  inherited Create(AOwner);
-  fCaseSensitive := False;
-
-  fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  fCommentAttri.Style := [fsItalic];
-  fCommentAttri.Foreground := clNavy;
-  AddAttribute(fCommentAttri);
-
-  fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(fIdentifierAttri);
-
-  fNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  fNumberAttri.Foreground := $666666;
-  AddAttribute(fNumberAttri);
-
-  fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  fKeyAttri.Foreground := $214195;
-  AddAttribute(fKeyAttri);
-
-  fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(fSpaceAttri);
-
-  fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  fStringAttri.Foreground := $619121;
-  AddAttribute(fStringAttri);
-
-  fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  fSymbolAttri.Foreground := $666666;
-  AddAttribute(fSymbolAttri);
-
-  SetAttributesOnChange(DefHighlightChange);
-  InitIdent;
-  fDefaultFilter := SYNS_FilterGo;
-  fRange := rsUnknown;
-end;
-
-procedure TSynGoSyn.NumberProc;
-
-  function IsNumberChar: Boolean;
-  begin
-    case fLine[Run] of
-      '0'..'9', '.', 'e', 'E', '-', '+':
-        Result := True;
-      else
-        Result := False;
-    end;
-  end;
-
-begin
-  Inc(Run);
-  fTokenID := tkNumber;
-  while IsNumberChar do
-  begin
-    case fLine[Run] of
-      '.':
-        if fLine[Run + 1] = '.' then
-          Break
-        else
-          fTokenID := tkFloat;
-      'e', 'E': fTokenID := tkFloat;
-      '-', '+':
-        begin
-          if fTokenID <> tkFloat then // arithmetic
-            Break;
-          if (FLine[Run - 1] <> 'e') and (FLine[Run - 1] <> 'E') then
-            Break; //float, but it ends here
-        end;
-    end;
-    Inc(Run);
-  end;
-end;
-
-procedure TSynGoSyn.IdentProc;
-begin
-  fTokenID := IdentKind((fLine + Run));
-  inc(Run, fStringLen);
-  while IsIdentChar(fLine[Run]) do inc(Run);
-end;
-
-procedure TSynGoSyn.SymbolProc;
-begin
-  inc(Run);
-  fTokenID := tkSymbol;
-end;
-
-procedure TSynGoSyn.UnknownProc;
-begin
-  inc(Run);
-  fTokenID := tkUnknown;
-end;
-
-procedure TSynGoSyn.Next;
-begin
-  fTokenPos := Run;
-  case fLine[Run] of
-    #0:
-      NullProc;
-    #10:
-      LFProc;
-    #13:
-      CRProc;
-    '/':
-      SlashProc;
-    #34:
-      StringProc;
-    #39:
-      StringProc;
-    #180:
-      StringProc;
-    #1..#9, #11, #12, #14..#32:
-      SpaceProc;
-    '0'..'9':
-      NumberProc;
-    'A'..'Z', 'a'..'z', '_':
-      IdentProc;
-    ':', '=', '+', '-', '.', ',':
-      SymbolProc;
-    '(', ')', '[', ']', '{', '}':
-      UnknownProc;
-  else
-    UnknownProc;
-  end;
-
-  inherited;
-end;
-
-function TSynGoSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes;
-begin
-  case Index of
-    SYN_ATTR_COMMENT: Result := fCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := fKeyAttri;
-    SYN_ATTR_STRING: Result := fStringAttri;
-    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
-    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynGoSyn.GetEol: Boolean;
-begin
-  Result := Run = fLineLen + 1;
-end;
-
-function TSynGoSyn.GetKeyWords(TokenKind: Integer): UnicodeString;
-begin
-  Result := 
-    'bool,break,byte,case,chan,complex128,complex64,const,continue,default' +
-    ',defer,else,fallthrough,float32,float64,for,func,go,goto,if,import,int' +
-    ',int16,int32,int64,int8,interface,map,package,range,return,rune,select' +
-    ',string,struct,switch,type,uint,uint16,uint32,uint64,uint8,uintptr,var';
-end;
-
-function TSynGoSyn.GetTokenID: TtkTokenKind;
-begin
-  Result := fTokenId;
-end;
-
-function TSynGoSyn.GetTokenAttribute: TSynHighLighterAttributes;
-begin
-  case GetTokenID of
-    tkComment:
-      Result := fCommentAttri;
-    tkIdentifier:
-      Result := fIdentifierAttri;
-    tkNumber, tkFloat:
-      Result := fNumberAttri;
-    tkKey:
-      Result := fKeyAttri;
-    tkSpace:
-      Result := fSpaceAttri;
-    tkString:
-      Result := fStringAttri;
-    tkSymbol:
-      Result := fSymbolAttri;
-    tkUnknown:
-      Result := fIdentifierAttri;
-  else
-    Result := nil;
-  end;
-end;
-
-function TSynGoSyn.GetTokenKind: Integer;
-begin
-  Result := Ord(fTokenId);
-end;
-
-function TSynGoSyn.IsIdentChar(AChar: WideChar): Boolean;
-begin
-  case AChar of
-    '_', '0'..'9', 'a'..'z', 'A'..'Z':
-      Result := True;
-    else
-      Result := False;
-  end;
-end;
-
-function TSynGoSyn.GetSampleSource: UnicodeString;
-begin
-  Result := 
-    #13#10 +
-    '/* Sample source for the go highlighter */'#13#10 +
-    #13#10 +
-    'package main'#13#10 +
-    #13#10 +
-    'import "fmt"'#13#10 +
-    #13#10 +
-    'func main() {'#13#10 +
-    '  fmt.Println("hello world")'#13#10+'}';
-end;
-
-function TSynGoSyn.IsFilterStored: Boolean;
-begin
-  Result := fDefaultFilter <> SYNS_FilterGo;
-end;
-
-class function TSynGoSyn.GetFriendlyLanguageName: UnicodeString;
-begin
-  Result := SYNS_FriendlyLangGo;
-end;
-
-class function TSynGoSyn.GetLanguageName: string;
-begin
-  Result := SYNS_LangGo;
-end;
-
-procedure TSynGoSyn.ResetRange;
-begin
-  fRange := rsUnknown;
-end;
-
-procedure TSynGoSyn.SetRange(Value: Pointer);
-begin
-  fRange := TRangeState(Value);
-end;
-
-function TSynGoSyn.GetRange: Pointer;
-begin
-  Result := Pointer(fRange);
-end;
-
-initialization
-{$IFNDEF SYN_CPPB_1}
-  RegisterPlaceableHighlighter(TSynGoSyn);
-{$ENDIF}
-end.
diff --git a/Ext/SynEdit/Source/SynHighlighterHC11.pas b/Ext/SynEdit/Source/SynHighlighterHC11.pas
index 37cbff7..9e6ca55 100644
--- a/Ext/SynEdit/Source/SynHighlighterHC11.pas
+++ b/Ext/SynEdit/Source/SynHighlighterHC11.pas
@@ -27,13 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterHC11.pas,v 1.13.2.5 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a 68HC11 Assembler Language syntax highlighter for SynEdit)
@@ -52,13 +45,13 @@
 interface
 
 uses
-  Graphics,
-  SynEditHighlighter,
+  System.SysUtils,
+  System.Classes,
+  System.Generics.Defaults,
+  System.Generics.Collections,
+  Vcl.Graphics,
   SynEditTypes,
-  SynHighlighterHashEntries,
-  SynUnicode,
-  SysUtils,
-  Classes;
+  SynEditHighlighter;
 
 type
   TtkTokenKind = (tkComment, tkDirective, tkIdentifier, tkKey, tkNull, tkNumber,
@@ -66,30 +59,21 @@ interface
 
   TkwKeyWordType = (kwNone, kwOperand, kwOperandOver, kwNoOperand);
 
-  PHashListEntry = ^THashListEntry;
-  THashListEntry = record
-    Next: PHashListEntry;
-    Token: UnicodeString;
-    Kind: TtkTokenKind;
-    Op: Boolean;
-  end;
-
   TSynHC11Syn = class(TSynCustomHighLighter)
   private
     FTokenID: TtkTokenKind;
     FKeyWordType: TkwKeyWordType;
-    FCommentAttri: TSynHighlighterAttributes;
-    FDirecAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FInvalidAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FKeywords: TSynHashEntryList;
-    procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
-    function HashKey(Str: PWideChar): Integer;
+    fCommentAttri: TSynHighlighterAttributes;
+    fDirecAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fInvalidAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    FKeywords: TDictionary;
+    procedure DoAddKeyword(AKeyword: string; AKind: Integer);
     function IdentKind(MayBe: PWideChar): TtkTokenKind;
     procedure SymAsciiCharProc;
     procedure SymbolProc;
@@ -105,11 +89,11 @@   TSynHC11Syn = class(TSynCustomHighLighter)
     procedure SymStringProc;
     procedure SymUnknownProc;
   protected
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     function IsFilterStored: Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
@@ -121,28 +105,29 @@   TSynHC11Syn = class(TSynCustomHighLighter)
     function GetTokenKind: Integer; override;
     procedure Next; override;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property DirecAttri: TSynHighlighterAttributes read FDirecAttri
-      write FDirecAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri
-      write FInvalidAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property DirecAttri: TSynHighlighterAttributes read fDirecAttri
+      write fDirecAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri
+      write fInvalidAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
   end;
 
 implementation
 
 uses
+  SynEditMiscProcs,
   SynEditStrConst;
 
 const
@@ -151,7 +136,7 @@ implementation
     Also the SampleSource uses EQU_ and EQU, so it isn't clear what is
     the correct syntax: with other without the underscores.
   }
-  KeyWords: UnicodeString = (
+  KeyWords: string = (
     'ABA,ABX,ABY,ADCA_,ADCB_,ADDA_,ADDB_,ADDD_,ANDA_,ANDB_,ASLA,ASLB,' +
     'ASL_,ASLD,ASRA,ASRB,ASR_,BCC_,BCLR_,BCS_,BEQ_,BGE_,BGT_,BHI_,BHS' +
     '_,BITA_,BITB_,BLE_,BLO_,BLS_,BLT_,BMI_,BNE_,BPL_,BRA_,BRCLR_,BRN' +
@@ -167,110 +152,76 @@ implementation
     'FCC_,FCB_,BSZ_,FDB_' // codegenerating directives
   );
 
-  Directives: UnicodeString = (
+  Directives: string = (
     'EQU_,OPT_,PAGE,ORG_,RMB_,END'  // directives
   );
 
-procedure TSynHC11Syn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer);
-var
-  HashValue: Integer;
-begin
-  HashValue := HashKey(PWideChar(AKeyword));
-  FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind);
-end;
-
-function TSynHC11Syn.HashKey(Str: PWideChar): Integer;
-
-  function GetOrd: Integer;
-  begin
-    case Str^ of
-      'a'..'z': Result := 1 + Ord(Str^) - Ord('a');
-      'A'..'Z': Result := 1 + Ord(Str^) - Ord('A');
-      '0'..'9': Result := 28 + Ord(Str^) - Ord('0');
-      '_': Result := 27;
-      else Result := 0;
-    end
-  end;
-
+procedure TSynHC11Syn.DoAddKeyword(AKeyword: string; AKind: Integer);
 begin
-  Result := 0;
-  while IsIdentChar(Str^) do
-  begin
-{$IFOPT Q-}
-    Result := 7 * Result + GetOrd;
-{$ELSE}
-    Result := (7 * Result + GetOrd) and $FFFFFF;
-{$ENDIF}
-    Inc(Str);
-  end;
-  Result := Result and $FF; // 255
-  FStringLen := Str - FToIdent;
+  if not FKeywords.ContainsKey(AKeyword) then
+    FKeywords.Add(AKeyword, TtkTokenKind(AKind));
 end;
 
 function TSynHC11Syn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
-  Entry: TSynHashEntry;
+  S: string;
 begin
-  FToIdent := MayBe;
-  Entry := FKeywords[HashKey(MayBe)];
-  while Assigned(Entry) do
-  begin
-    if Entry.KeywordLen > FStringLen then
-      Break
-    else if Entry.KeywordLen = FStringLen then
-      if IsCurrentToken(Entry.Keyword) then
-      begin
-        Result := TtkTokenKind(Entry.Kind);
-        Exit;
-      end;
-    Entry := Entry.Next;
-  end;
-  Result := tkIdentifier;
+  fToIdent := MayBe;
+  while IsIdentChar(MayBe^) do
+    Inc(Maybe);
+  fStringLen := Maybe - fToIdent;
+  SetString(S, fToIdent, fStringLen);
+  if FKeywords.ContainsKey(S) then
+    Result := FKeywords[S]
+  else
+    Result := tkIdentifier;
 end;
 
 constructor TSynHC11Syn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := True;
-
-  FKeywords := TSynHashEntryList.Create;
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style:= [fsItalic];
-  AddAttribute(FCommentAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
-  AddAttribute(FInvalidAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style:= [fsBold];
-  AddAttribute(FKeyAttri);
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
-  FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
-  AddAttribute(FDirecAttri);
+  fCaseSensitive := True;
+
+  // Create the keywords dictionary case-sensitive
+  FKeywords := TDictionary.Create;
+
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style:= [fsItalic];
+  AddAttribute(fCommentAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar);
+  AddAttribute(fInvalidAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style:= [fsBold];
+  AddAttribute(fKeyAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
+  fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor);
+  AddAttribute(fDirecAttri);
   SetAttributesOnChange(DefHighlightChange);
 
   EnumerateKeywords(Ord(tkKey), Keywords, IsIdentChar, DoAddKeyword);
   EnumerateKeywords(Ord(tkDirective), Directives, IsIdentChar, DoAddKeyword);
-  FDefaultFilter := SYNS_FilterAsm68HC11;
+  fDefaultFilter := SYNS_FilterAsm68HC11;
 end; { Create }
 
 destructor TSynHC11Syn.Destroy;
 begin
-  FKeywords.Free;
+  fKeywords.Free;
   inherited Destroy;
 end;
 
 procedure TSynHC11Syn.SymAsciiCharProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then Inc(Run, 2);
   repeat
     case FLine[Run] of
@@ -287,13 +238,13 @@ procedure TSynHC11Syn.SymAsciiCharProc;
 
 procedure TSynHC11Syn.SymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   Inc(Run);
 end;
 
 procedure TSynHC11Syn.SymDollarProc;
 begin
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   Inc(Run);
   while CharInSet(FLine[Run], ['0'..'9', 'A'..'F', 'a'..'f']) do
   begin
@@ -303,44 +254,44 @@ procedure TSynHC11Syn.SymDollarProc;
 
 procedure TSynHC11Syn.SymCRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   FKeyWordType := kwNone;
   Inc(Run);
-  if FLine[Run] = #10 then Inc(Run);
+  if fLine[Run] = #10 then Inc(Run);
 end;
 
 procedure TSynHC11Syn.SymIdentProc;
 begin
-  FTokenID := IdentKind(FLine + Run);
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  fTokenID := IdentKind(fLine + Run);
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
 end;
 
 procedure TSynHC11Syn.SymLFProc;
 begin
   FKeyWordType := kwNone;
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynHC11Syn.SymPercentProc;
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while CharInSet(FLine[Run], ['0'..'1']) do
     Inc(Run);
 end;
 
 procedure TSynHC11Syn.SymNullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
 procedure TSynHC11Syn.SymNumberProc;
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while CharInSet(FLine[Run], ['0'..'9']) do
     Inc(Run);
 end;
@@ -351,7 +302,7 @@ procedure TSynHC11Syn.SymSpaceProc;
   if FKeyWordType in [kwOperandOver, kwNoOperand] then
   begin
     FKeyWordType := kwNone;
-    FTokenID := tkComment;
+    fTokenID := tkComment;
     while not IsLineEnd(Run) do
       Inc(Run);
   end
@@ -359,8 +310,8 @@ procedure TSynHC11Syn.SymSpaceProc;
   begin
     if FKeyWordType = kwOperand then
       FKeyWordType := kwOperandOver;
-    FTokenID := tkSpace;
-    while (FLine[Run] <= #32) and not IsLineEnd(Run) do
+    fTokenID := tkSpace;
+    while (fLine[Run] <= #32) and not IsLineEnd(Run) do
       Inc(Run);
   end;
 end;
@@ -369,10 +320,10 @@ procedure TSynHC11Syn.SymStarProc;
 begin
   Inc(Run);
   if FKeyWordType = kwOperandOver then
-    FTokenID := tkSymbol
+    fTokenID := tkSymbol
   else
   begin
-    FTokenID := tkComment;
+    fTokenID := tkComment;
     while not IsLineEnd(Run) do
       Inc(Run);
   end;
@@ -380,12 +331,11 @@ procedure TSynHC11Syn.SymStarProc;
 
 procedure TSynHC11Syn.SymStringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2);
   repeat
     case FLine[Run] of
-      #0, #10, #13:
-        Break;
+      #0, #10, #13: Break;
     end;
     Inc(Run);
   until FLine[Run] = #34;
@@ -395,13 +345,13 @@ procedure TSynHC11Syn.SymStringProc;
 procedure TSynHC11Syn.SymUnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynHC11Syn.Next;
 begin
-  FTokenPos := Run;
-  case FLine[Run] of
+  fTokenPos := Run;
+  case fLine[Run] of
     #39: SymAsciiCharProc;
     '$': SymDollarProc;
     #13: SymCRProc;
@@ -422,12 +372,12 @@ procedure TSynHC11Syn.Next;
 function TSynHC11Syn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -435,38 +385,38 @@ function TSynHC11Syn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribu
 
 function TSynHC11Syn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynHC11Syn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  case FTokenID of
-    tkComment: Result := FCommentAttri;
-    tkDirective: Result := FDirecAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkUnknown: Result := FIdentifierAttri;
+  case fTokenID of
+    tkComment: Result := fCommentAttri;
+    tkDirective: Result := fDirecAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkUnknown: Result := fIdentifierAttri;
     else Result := nil;
   end;
 end;
 
 function TSynHC11Syn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
 function TSynHC11Syn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynHC11Syn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterAsm68HC11;
+  Result := fDefaultFilter <> SYNS_FilterAsm68HC11;
 end;
 
 class function TSynHC11Syn.GetLanguageName: string;
@@ -474,7 +424,7 @@ class function TSynHC11Syn.GetLanguageName: string;
   Result := SYNS_Lang68HC11;
 end;
 
-function TSynHC11Syn.GetSampleSource: UnicodeString;
+function TSynHC11Syn.GetSampleSource: string;
 begin
   Result :=
     '* TX.ASM'#13#10 +
@@ -484,18 +434,16 @@ function TSynHC11Syn.GetSampleSource: UnicodeString;
     '        STAA    SCCR2'#13#10 +
     'loop:'#13#10 +
     '        LDAA    #$05'#13#10 +
-    '	BRA	loop		;Do it again'#13#10 +
+    '	BRA_	loop		;Do it again'#13#10 +
     '	ORG	$FFFE		;Reset vector interrupt setup'#13#10 +
     '	END';
 end;
 
-class function TSynHC11Syn.GetFriendlyLanguageName: UnicodeString;
+class function TSynHC11Syn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLang68HC11;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynHC11Syn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterHP48.pas b/Ext/SynEdit/Source/SynHighlighterHP48.pas
index c6adbfb..44996a8 100644
--- a/Ext/SynEdit/Source/SynHighlighterHP48.pas
+++ b/Ext/SynEdit/Source/SynHighlighterHP48.pas
@@ -27,13 +27,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterHP48.pas,v 1.10.2.9 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides SynEdit with a HP48 assembler syntax highlighter.)
@@ -51,6 +44,7 @@ interface
 
 uses
   Windows,
+  Registry,
   Graphics,
   SynEditHighlighter,
   SynUnicode,
@@ -65,13 +59,13 @@   TSpeedStringList = class;
 
   TSpeedListObject = class
   protected
-    FName: UnicodeString;
+    FName: string;
     FSpeedList: TSpeedStringList;
     FObject: TObject;
-    procedure SetName(const Value: UnicodeString); virtual;
+    procedure SetName(const Value: string); virtual;
   public
-    property Name: UnicodeString read FName write SetName;
-    constructor Create(name: UnicodeString);
+    property Name: string read FName write SetName;
+    constructor Create(name: string);
     destructor Destroy; override;
     property SpeedList: TSpeedStringList read FSpeedList write FSpeedList;
     property Pointer: TObject read FObject write FObject;
@@ -82,39 +76,39 @@   TSpeedListObject = class
 
   TSpeedStringList = class
   private
-    function GetText: UnicodeString;
-    procedure SetText(const Value: UnicodeString);
+    function GetText: string;
+    procedure SetText(const Value: string);
     function GetInObject(Index: Integer): TObject;
     procedure SetInObject(Index: Integer; const Value: TObject);
   protected
     FOnChange: TNotifyEvent;
-    FSumOfUsed: array[0..NbSubList - 1] of Integer;
-    FDatasUsed: array[0..NbSubList - 1] of Integer;
-    FDatas: array[0..NbSubList - 1] of PSpeedListObjects;
-    FLengthDatas: array[0..NbSubList - 1] of Integer;
+    SumOfUsed: array[0..NbSubList - 1] of Integer;
+    DatasUsed: array[0..NbSubList - 1] of Integer;
+    Datas: array[0..NbSubList - 1] of PSpeedListObjects;
+    LengthDatas: array[0..NbSubList - 1] of Integer;
     procedure Changed; virtual;
-    function Get(Index: Integer): UnicodeString; virtual;
+    function Get(Index: Integer): string; virtual;
     function GetObject(Index: Integer): TSpeedListObject;
     function GetCount: Integer;
-    function GetStringList: TUnicodeStrings;
-    procedure SetStringList(const Value: TUnicodeStrings);
+    function GetStringList: TStrings;
+    procedure SetStringList(const Value: TStrings);
   public
-    procedure NameChange(const obj: TSpeedListObject; const NewName: UnicodeString);
+    procedure NameChange(const obj: TSpeedListObject; const NewName: string);
     procedure ObjectDeleted(const obj: TSpeedListObject);
 
     destructor Destroy; override;
     constructor Create;
     function AddObj(const Value: TSpeedListObject): Integer;
-    function Add(const Value: UnicodeString): TSpeedListObject;
+    function Add(const Value: string): TSpeedListObject;
     procedure Clear;
-    function Find(const Name: UnicodeString): TSpeedListObject;
+    function Find(const Name: string): TSpeedListObject;
     property OnChange: TNotifyEvent read FOnChange write FOnChange;
     property Objects[Index: Integer]: TSpeedListObject read GetObject;
     property InObject[Index: Integer]: TObject read GetInObject write SetInObject;
-    property Strings[Index: Integer]: UnicodeString read Get; default;
+    property Strings[Index: Integer]: string read Get; default;
     property Count: Integer read GetCount;
-    property StringList: TUnicodeStrings read GetStringList write SetStringList;
-    property Text: UnicodeString read GetText write SetText;
+    property StringList: TStrings read GetStringList write SetStringList;
+    property Text: string read GetText write SetText;
   end;
 
   TtkTokenKind = (tkNull, tkAsmKey, tkAsm, tkAsmComment, tksAsmKey, tksAsm,
@@ -125,9 +119,9 @@   TSpeedStringList = class
 
   TSynHP48Syn = class(TSynCustomHighLighter)
   private
-    FTockenKind: TtkTokenKind;
-    FRange: TRangeState;
-    FAttribs: array[TtkTokenKind] of TSynHighlighterAttributes;
+    fTockenKind: TtkTokenKind;
+    fRange: TRangeState;
+    Attribs: array[TtkTokenKind] of TSynHighlighterAttributes;
     FRplKeyWords: TSpeedStringList;
     FAsmKeyWords: TSpeedStringList;
     FSAsmNoField: TSpeedStringList;
@@ -154,32 +148,30 @@   TSynHP48Syn = class(TSynCustomHighLighter)
     function StarProc: TtkTokenKind;
   protected
     function GetAttribCount: Integer; override;
-    function GetAttribute(idx: Integer): TSynHighlighterAttributes; override;
+    function GetAttribute(Idx: Integer): TSynHighlighterAttributes; override;
     function IsFilterStored: Boolean; override;
     function IsLineEnd(Run: Integer): Boolean; override;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     destructor Destroy; override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
       override;
     function GetEol: Boolean; override;
-    procedure DoSetLine(const Value: UnicodeString; LineNumber: Integer); override;
+    procedure DoSetLine(const Value: string; LineNumber: Integer); override;
     procedure Next; override;
 
-    function GetToken: UnicodeString; override;
+    function GetToken: string; override;
     function GetTokenAttribute: TSynHighlighterAttributes; override;
     function GetTokenKind: Integer; override;
 
     function GetRange: Pointer; override;
     procedure SetRange(Value: Pointer); override;
     procedure ResetRange; override;
-
     function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; override;
     function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; override;
-
     procedure Assign(Source: TPersistent); override;
     property AsmKeyWords: TSpeedStringList read FAsmKeyWords;
     property SAsmFoField: TSpeedStringList read FSAsmNoField;
@@ -209,19 +201,16 @@   TSynHP48Syn = class(TSynCustomHighLighter)
 implementation
 
 uses
-{$IFDEF UNICODE}
-  WideStrUtils,
-{$ENDIF}
   SynEditStrConst;
 
 const
-  DefaultAsmKeyWords: UnicodeString = '!RPL'#13#10'ENDCODE'#13#10'{'#13#10'}'#13#10 +
+  DefaultAsmKeyWords: string = '!RPL'#13#10'ENDCODE'#13#10'{'#13#10'}'#13#10 +
   'GOTO'#13#10'GOSUB'#13#10'GOSBVL'#13#10'GOVLNG'#13#10'GOLONG'#13#10'SKIP' +
     #13#10'SKIPYES' + #13#10'->'#13#10'SKUB'#13#10'SKUBL'#13#10'SKC'#13#10'SKNC'#13#10'SKELSE' +
     #13#10'SKEC'#13#10'SKENC'#13#10'SKLSE'#13#10 + 'GOTOL'#13#10'GOSUBL'#13#10 +
     'RTN'#13#10'RTNC'#13#10'RTNNC'#13#10'RTNSC'#13#10'RTNCC'#13#10'RTNSXM'#13#10'RTI';
-  OtherAsmKeyWords: array[0..5] of UnicodeString = ('UP', 'EXIT', 'UPC', 'EXITC', 'UPNC', 'EXITNC');
-  DefaultRplKeyWords: UnicodeString =
+  OtherAsmKeyWords: array[0..5] of string = ('UP', 'EXIT', 'UPC', 'EXITC', 'UPNC', 'EXITNC');
+  DefaultRplKeyWords: string =
     'CODEM'#13#10'ASSEMBLEM'#13#10'CODE'#13#10'ASSEMBLE'#13#10'IT'#13#10'ITE'#13#10'case'#13#10'::'#13#10';'#13#10'?SEMI'#13#10''''#13#10'#=case'#13#10'{'#13#10'}'#13#10'NAMELESS'#13#10'LOCAL'#13#10'LOCALNAME'#13#10'LABEL'#13#10 +
     'LOCALLABEL'#13#10'xNAME'#13#10'tNAME' + 'COLA'#13#10'NULLNAME'#13#10'xROMID'#13#10'#0=ITE'#13#10'#ITE'#13#10'2''RCOLARPITE'#13#10'ANDITE'#13#10'COLAITE'#13#10'COLARPITE'#13#10'DUP#0=ITE'#13#10 +
     'EQITE'#13#10'ITE'#13#10'RPITE'#13#10'SysITE'#13#10'UNxSYMRPITE'#13#10'UserITE'#13#10'snnSYMRPITE'#13#10'snsSYMRPITE'#13#10'ssnSYMRPITE'#13#10'sssSYMRPITE'#13#10'$_EXIT'#13#10'DA1OK?NOTIT'#13#10'DA2aOK?NOTIT'#13#10 +
@@ -237,7 +226,7 @@ implementation
     'dMATRIXcase'#13#10'dREALNcase'#13#10'dREALcase'#13#10'dZINTNcase'#13#10'delimcase'#13#10'estcase'#13#10'idntcase'#13#10'idntlamcase'#13#10'j#-1=case'#13#10'j#0=case'#13#10'j#1=case'#13#10'j%-1=case'#13#10'j%0=case'#13#10 +
     'j%1=case'#13#10'jEQcase'#13#10'jZ-1=case'#13#10'jZ0=case'#13#10'jZ1=case'#13#10'namelscase'#13#10'need''case'#13#10'negrealcase'#13#10'ngsizecase'#13#10'nonopcase'#13#10'nonrmcase'#13#10'num#-1=case'#13#10'num#0=case'#13#10 +
     'num#1=case'#13#10'num-1=case'#13#10'num0=case'#13#10'num0case'#13#10'num1=case'#13#10'num2=case'#13#10'numb1stcase'#13#10'rebuildcase'#13#10'tok=casedrop'#13#10'wildcase'#13#10'zerdercase'#13#10;
-  SasmNoField: UnicodeString = 'LOOP'#13#10'RTNSXM'#13#10'RTN'#13#10'RTNSC'#13#10'RTNCC'#13#10'SETDEC'#13#10'SETHEX'#13#10'RSTK=C'#13#10'C=RSTK'#13#10'CLRST'#13#10'C=ST'#13#10'ST=C'#13#10'CSTEX'#13#10 +
+  SasmNoField: string = 'LOOP'#13#10'RTNSXM'#13#10'RTN'#13#10'RTNSC'#13#10'RTNCC'#13#10'SETDEC'#13#10'SETHEX'#13#10'RSTK=C'#13#10'C=RSTK'#13#10'CLRST'#13#10'C=ST'#13#10'ST=C'#13#10'CSTEX'#13#10 +
   'RTI'#13#10'R0=A'#13#10'R1=A'#13#10'R2=A'#13#10'R3=A'#13#10'R4=A'#13#10'R0=C'#13#10'R1=C'#13#10'R2=C'#13#10'R3=C'#13#10'R4=C'#13#10'A=R0'#13#10'A=R1'#13#10'A=R2'#13#10'A=R3'#13#10'A=R4'#13#10 +
     'C=R0'#13#10'C=R1'#13#10'C=R2'#13#10'C=R3'#13#10'C=R4'#13#10'AR0EX'#13#10'AR1EX'#13#10'AR2EX'#13#10'AR3EX'#13#10'AR4EX'#13#10'CR0EX'#13#10'CR1EX'#13#10'CR2EX'#13#10'CR3EX'#13#10'CR4EX'#13#10 +
     'D0=A'#13#10'D0=C'#13#10'D1=A'#13#10'D1=C'#13#10'AD0EX'#13#10'AD1EX'#13#10'CD0EX'#13#10'CD1EX'#13#10'D0=AS'#13#10'D1=AS'#13#10'D0=CS'#13#10'D1=CD'#13#10'CD1XS'#13#10'CD0XS'#13#10'AD1XS'#13#10'AD0XS'#13#10 +
@@ -246,33 +235,33 @@ implementation
     'A=PC'#13#10'C=PC'#13#10'APCEX'#13#10'CPCEX'#13#10'XM=0'#13#10'SB=0'#13#10'SR=0'#13#10'MP=0'#13#10'CLRHST'#13#10'?XM=0'#13#10'?SR=0'#13#10'?MP=0'#13#10'?SB=0'#13#10'RTNYES'#13#10'SKIPYES{'#13#10'{'#13#10'}'#13#10'UP'#13#10'EXIT'#13#10'EXITNC'#13#10'EXITC'#13#10'UPC'#13#10'UPNC' +
     '}SKELSE{'#13#10'SKC{'#13#10'SKNC{'#13#10'SKUB{'#13#10'SKUBL{'#13#10'SKIPC{'#13#10'SKIPNC{'#13#10'EXIT2'#13#10'EXIT3'#13#10'UP2'#13#10'UP3'#13#10'}SKLSE{'#13#10'}SKEC{'#13#10'}SKENC{'#13#10;
 
-function StringCrc(S: UnicodeString): Integer;
+function StringCrc(S: string): Integer;
 var
-  i: Integer;
+  I: Integer;
 begin
   Result := 0;
-  for i := 1 to length(s) do begin
-    Result := (Result shr 4) xor (((Result xor ord(s[i])) and $F) * $1081);
-    Result := (Result shr 4) xor (((Result xor (ord(s[i]) shr 4)) and $F) * $1081);
+  for I := 1 to length(s) do begin
+    Result := (Result shr 4) xor (((Result xor ord(s[I])) and $F) * $1081);
+    Result := (Result shr 4) xor (((Result xor (ord(s[I]) shr 4)) and $F) * $1081);
   end;
 end;
 
 { TSpeedListObject }
 
-constructor TSpeedListObject.create(name: UnicodeString);
+constructor TSpeedListObject.create(name: string);
 begin
   inherited create;
   FName := name;
 end;
 
-destructor TSpeedListObject.destroy;
+destructor TSpeedListObject.Destroy;
 begin
   if Assigned(FSpeedList) then
     FSpeedList.ObjectDeleted(Self);
   inherited destroy;
 end;
 
-procedure TSpeedListObject.SetName(const Value: UnicodeString);
+procedure TSpeedListObject.SetName(const Value: string);
 begin
   FName := Value;
   if FSpeedList <> nil then
@@ -283,24 +272,23 @@ procedure TSpeedListObject.SetName(const Value: UnicodeString);
 
 function TSpeedStringList.AddObj(const Value: TSpeedListObject): Integer;
 var
-  crc: Integer;
-  i: Integer;
+  Crc: Integer;
+  I: Integer;
 begin
-  crc := StringCrc(Value.Name) mod High(FDatas) + 1;
-  if FDatasUsed[crc] = FLengthDatas[crc] then
-  begin
-    ReallocMem(FDatas[crc], (FLengthDatas[crc] * 2 + 1) * SizeOf(FDatas[1][0]));
-    FLengthDatas[crc] := FLengthDatas[crc] * 2 + 1;
+  Crc := StringCrc(Value.Name) mod High(Datas) + 1;
+  if DatasUsed[Crc] = lengthDatas[Crc] then begin
+    ReallocMem(datas[Crc], (lengthDatas[Crc] * 2 + 1) * SizeOf(datas[1][0]));
+    lengthDatas[Crc] := lengthDatas[Crc] * 2 + 1;
   end;
-  FDatas[crc][FDatasUsed[crc]] := Value;
-  Result := FSumOfUsed[crc] + FDatasUsed[crc];
-  Inc(FDatasUsed[crc]);
-  for i := crc + 1 to High(FSumOfUsed) do
-    Inc(FSumOfUsed[i]);
+  Datas[Crc][DatasUsed[Crc]] := Value;
+  Result := SumOfUsed[Crc] + DatasUsed[Crc];
+  Inc(DatasUsed[Crc]);
+  for I := Crc + 1 to High(SumOfUsed) do
+    Inc(SumOfUsed[I]);
   Value.SpeedList := Self;
 end;
 
-function TSpeedStringList.Add(const Value: UnicodeString): TSpeedListObject;
+function TSpeedStringList.Add(const Value: string): TSpeedListObject;
 begin
   Result := TSpeedListObject.Create(value);
   AddObj(Result);
@@ -314,31 +302,29 @@ procedure TSpeedStringList.Changed;
 
 procedure TSpeedStringList.Clear;
 var
-  i, j: Integer;
-begin
-  for i := Low(FDatas) to High(FDatas) do
-  begin
-    for j := 0 to FDatasUsed[i] - 1 do
-      FDatas[i][j].Free;
-    FDatasUsed[i] := 0;
-    ReallocMem(FDatas[i], 0);
-    FLengthDatas[i] := 0;
-    FSumOfUsed[i] := 0;
+  I, J: Integer;
+begin
+  for I := Low(datas) to High(datas) do begin
+    for J := 0 to DatasUsed[I] - 1 do
+      datas[I][J].free;
+    datasUsed[I] := 0;
+    ReallocMem(datas[I], 0);
+    lengthDatas[I] := 0;
+    SumOfUsed[I] := 0;
   end;
   Changed;
 end;
 
-constructor TSpeedStringList.create;
+constructor TSpeedStringList.Create;
 var
-  i: Integer;
+  I: Integer;
 begin
   inherited Create;
-  for i := Low(FDatas) to high(FDatas) do
-  begin
-    FSumOfUsed[i] := 0;
-    FDatasUsed[i] := 0;
-    FLengthDatas[i] := 0;
-    FDatas[i] := nil;
+  for I := Low(Datas) to High(datas) do begin
+    SumOfUsed[I] := 0;
+    DatasUsed[I] := 0;
+    lengthDatas[I] := 0;
+    datas[I] := nil;
   end;
 end;
 
@@ -348,27 +334,27 @@ destructor TSpeedStringList.Destroy;
   inherited destroy;
 end;
 
-function TSpeedStringList.Find(const name: UnicodeString): TSpeedListObject;
+function TSpeedStringList.Find(const name: string): TSpeedListObject;
 var
-  crc: Integer;
-  i: Integer;
+  Crc: Integer;
+  I: Integer;
 begin
-  crc := StringCrc(name) mod High(FDatas) + 1;
-  for i := 0 to FDatasUsed[crc] - 1 do
-    if FDatas[crc][i].name = name then begin
-      Result := FDatas[crc][i];
+  Crc := StringCrc(name) mod High(Datas) + 1;
+  for I := 0 to DatasUsed[Crc] - 1 do
+    if Datas[Crc][I].name = name then begin
+      Result := Datas[Crc][I];
       Exit;
     end;
   Result := nil;
 end;
 
-function TSpeedStringList.Get(Index: Integer): UnicodeString;
+function TSpeedStringList.Get(Index: Integer): string;
 var
-  i: Integer;
+  I: Integer;
 begin
-  for i := Low(FSumOfUsed) + 1 to High(FSumOfUsed) do
-    if Index > FSumOfUsed[i] then begin
-      Result := FDatas[i - 1][Index - FSumOfUsed[i - 1]].name;
+  for I := Low(SumOfUsed) + 1 to High(SumOfUsed) do
+    if Index > SumOfUsed[I] then begin
+      Result := Datas[I - 1][Index - SumOfUsed[I - 1]].name;
       Exit;
     end;
   Result := '';
@@ -376,16 +362,16 @@ function TSpeedStringList.Get(Index: Integer): UnicodeString;
 
 function TSpeedStringList.GetCount: Integer;
 begin
-  Result := FSumOfUsed[High(FDatas)] + FDatasUsed[High(FDatas)];
+  Result := SumOfUsed[High(datas)] + DatasUsed[High(Datas)];
 end;
 
 function TSpeedStringList.GetInObject(Index: Integer): TObject;
 var
-  i: Integer;
+  I: Integer;
 begin
-  for i := Low(FSumOfUsed) + 1 to High(FSumOfUsed) do
-    if Index > FSumOfUsed[i] then begin
-      Result := FDatas[i - 1][Index - FSumOfUsed[i - 1]].Pointer;
+  for I := Low(SumOfUsed) + 1 to High(SumOfUsed) do
+    if Index > SumOfUSed[I] then begin
+      Result := Datas[I - 1][Index - SumOfUsed[I - 1]].pointer;
       Exit;
     end;
   Result := nil;
@@ -393,50 +379,50 @@ function TSpeedStringList.GetInObject(Index: Integer): TObject;
 
 function TSpeedStringList.GetObject(Index: Integer): TSpeedListObject;
 var
-  i: Integer;
+  I: Integer;
 begin
-  for i := Low(FSumOfUsed) + 1 to High(FSumOfUsed) do
-    if Index > FSumOfUsed[i] then begin
-      Result := FDatas[i - 1][Index - FSumOfUsed[i - 1]];
+  for I := Low(SumOfUsed) + 1 to High(SumOfUsed) do
+    if Index > SumOfUSed[I] then begin
+      Result := Datas[I - 1][Index - SumOfUsed[I - 1]];
       Exit;
     end;
   Result := nil;
 end;
 
-function TSpeedStringList.GetStringList: TUnicodeStrings;
+function TSpeedStringList.GetStringList: TStrings;
 var
-  i, j: Integer;
+  I, J: Integer;
 begin
-  Result := TUnicodeStringList.Create;
-  for i := Low(FDatas) to High(FDatas) do
-    for j := 0 to FDatasUsed[i] - 1 do
-      Result.add(FDatas[i][j].name);
+  Result := TStringList.Create;
+  for I := Low(Datas) to High(Datas) do
+    for J := 0 to DatasUsed[I] - 1 do
+      Result.add(datas[I][J].name);
 end;
 
-function TSpeedStringList.GetText: UnicodeString;
+function TSpeedStringList.GetText: string;
 begin
   with StringList do begin
     Result := Text;
-    Free;
+    free;
   end;
 end;
 
-procedure TSpeedStringList.NameChange(const Obj: TSpeedListObject; const NewName: UnicodeString);
+procedure TSpeedStringList.NameChange(const Obj: TSpeedListObject; const NewName: string);
 var
-  crc: Integer;
-  i: Integer;
-  j: Integer;
-begin
-  crc := StringCrc(obj.Name) mod High(FDatas) + 1;
-  for i := 0 to FDatasUsed[crc] - 1 do
-    if FDatas[crc][i] = Obj then begin
-      for j := i + 1 to FDatasUsed[crc] - 1 do
-        FDatas[i - 1] := FDatas[i];
-      for j := crc + 1 to High(FDatas) do
-        Dec(FSumOfUsed[j]);
-      if FDatasUsed[crc] < FLengthDatas[crc] div 2 then begin
-        ReallocMem(FDatas[crc], FDatasUsed[crc] * SizeOf(FDatas[crc][0]));
-        FLengthDatas[crc] := FDatasUsed[crc];
+  Crc: Integer;
+  I: Integer;
+  J: Integer;
+begin
+  Crc := StringCrc(obj.Name) mod High(Datas) + 1;
+  for I := 0 to DatasUsed[Crc] - 1 do
+    if Datas[Crc][I] = Obj then begin
+      for J := I + 1 to DatasUsed[Crc] - 1 do
+        Datas[I - 1] := Datas[I];
+      for J := Crc + 1 to High(Datas) do
+        Dec(SumOfUsed[J]);
+      if DatasUsed[Crc] < lengthDatas[Crc] div 2 then begin
+        ReallocMem(Datas[Crc], DatasUsed[Crc] * SizeOf(Datas[Crc][0]));
+        lengthDatas[Crc] := DatasUsed[Crc];
       end;
       AddObj(Obj);
       Exit;
@@ -445,18 +431,18 @@ procedure TSpeedStringList.NameChange(const Obj: TSpeedListObject; const NewName
 
 procedure TSpeedStringList.ObjectDeleted(const obj: TSpeedListObject);
 var
-  crc: Integer;
-  i: Integer;
-  j: Integer;
-begin
-  crc := StringCrc(obj.Name) mod High(FDatas) + 1;
-  for i := 0 to FDatasUsed[crc] - 1 do
-    if FDatas[crc][i] = Obj then begin
-      for j := i + 1 to FDatasUsed[crc] - 1 do
-        if i > 0 then
-          FDatas[i - 1] := FDatas[i];
-      for j := crc + 1 to High(FDatas) do
-        Dec(FSumOfUsed[j]);
+  Crc: Integer;
+  I: Integer;
+  J: Integer;
+begin
+  Crc := StringCrc(obj.Name) mod High(Datas) + 1;
+  for I := 0 to DatasUsed[Crc] - 1 do
+    if Datas[Crc][I] = Obj then begin
+      for J := I + 1 to DatasUsed[Crc] - 1 do
+        if I > 0 then
+          Datas[I - 1] := Datas[I];
+      for J := Crc + 1 to High(Datas) do
+        Dec(SumOfUsed[J]);
       Obj.FSpeedList := nil;
       Exit;
     end;
@@ -465,34 +451,34 @@ procedure TSpeedStringList.ObjectDeleted(const obj: TSpeedListObject);
 procedure TSpeedStringList.SetInObject(Index: Integer;
   const Value: TObject);
 var
-  i: Integer;
+  I: Integer;
 begin
-  for i := Low(FSumOfUsed) + 1 to High(FSumOfUsed) do
-    if Index > FSumOfUsed[i] then begin
-      FDatas[i - 1][Index - FSumOfUsed[i - 1]].Pointer := value;
+  for I := Low(SumOfUsed) + 1 to High(SumOfUsed) do
+    if Index > SumOfUSed[I] then begin
+      Datas[I - 1][Index - SumOfUsed[I - 1]].pointer := value;
       Exit;
     end;
 end;
 
-procedure TSpeedStringList.SetStringList(const value: TUnicodeStrings);
+procedure TSpeedStringList.SetStringList(const value: TStrings);
 var
-  i: Integer;
+  I: Integer;
 begin
   clear;
-  for i := 0 to Value.Count - 1 do
-    AddObj(TSpeedListObject.Create(value[i]));
+  for I := 0 to Value.Count - 1 do
+    AddObj(TSpeedListObject.Create(value[I]));
 end;
 
-procedure TSpeedStringList.SetText(const Value: UnicodeString);
+procedure TSpeedStringList.SetText(const Value: string);
 var
-  s: TUnicodeStrings;
+  SL: TStrings;
 begin
-  s := TUnicodeStringList.Create;
+  SL := TStringList.Create;
   try
-    s.Text := Value;
-    StringList := s;
+    SL.Text := Value;
+    StringList := SL;
   finally
-    s.Free;
+    SL.Free;
   end;
 end;
 
@@ -500,62 +486,62 @@ procedure TSpeedStringList.SetText(const Value: UnicodeString);
 
 constructor TSynHP48Syn.Create(AOwner: TComponent);
 var
-  j, k: Integer;
-begin
-  FAttribs[tkNull] := TSynHighlighterAttributes.Create(SYNS_AttrNull, SYNS_FriendlyAttrNull);
-  FAttribs[tkAsmKey] := TSynHighlighterAttributes.Create(SYNS_AttrAsmKey, SYNS_FriendlyAttrAsmKey);
-  FAttribs[tkAsm] := TSynHighlighterAttributes.Create(SYNS_AttrAsm, SYNS_FriendlyAttrAsm);
-  FAttribs[tkAsmComment] := TSynHighlighterAttributes.Create(SYNS_AttrAsmComment, SYNS_FriendlyAttrAsmComment);
-  FAttribs[tksAsmKey] := TSynHighlighterAttributes.Create(SYNS_AttrSASMKey, SYNS_FriendlyAttrSASMKey);
-  FAttribs[tksAsm] := TSynHighlighterAttributes.Create(SYNS_AttrSASM, SYNS_FriendlyAttrSASM);
-  FAttribs[tksAsmComment] := TSynHighlighterAttributes.Create(SYNS_AttrSASMComment, SYNS_FriendlyAttrSASMComment);
-  FAttribs[tkRplKey] := TSynHighlighterAttributes.Create(SYNS_AttrRplKey, SYNS_FriendlyAttrRplKey);
-  FAttribs[tkRpl] := TSynHighlighterAttributes.Create(SYNS_AttrRpl, SYNS_FriendlyAttrRpl);
-  FAttribs[tkRplComment] := TSynHighlighterAttributes.Create(SYNS_AttrRplComment, SYNS_FriendlyAttrRplComment);
+  J, K: Integer;
+begin
+  Attribs[tkNull] := TSynHighlighterAttributes.Create(SYNS_AttrNull, SYNS_FriendlyAttrNull);
+  Attribs[tkAsmKey] := TSynHighlighterAttributes.Create(SYNS_AttrAsmKey, SYNS_FriendlyAttrAsmKey);
+  Attribs[tkAsm] := TSynHighlighterAttributes.Create(SYNS_AttrAsm, SYNS_FriendlyAttrAsm);
+  Attribs[tkAsmComment] := TSynHighlighterAttributes.Create(SYNS_AttrAsmComment, SYNS_FriendlyAttrAsmComment);
+  Attribs[tksAsmKey] := TSynHighlighterAttributes.Create(SYNS_AttrSASMKey, SYNS_FriendlyAttrSASMKey);
+  Attribs[tksAsm] := TSynHighlighterAttributes.Create(SYNS_AttrSASM, SYNS_FriendlyAttrSASM);
+  Attribs[tksAsmComment] := TSynHighlighterAttributes.Create(SYNS_AttrSASMComment, SYNS_FriendlyAttrSASMComment);
+  Attribs[tkRplKey] := TSynHighlighterAttributes.Create(SYNS_AttrRplKey, SYNS_FriendlyAttrRplKey);
+  Attribs[tkRpl] := TSynHighlighterAttributes.Create(SYNS_AttrRpl, SYNS_FriendlyAttrRpl);
+  Attribs[tkRplComment] := TSynHighlighterAttributes.Create(SYNS_AttrRplComment, SYNS_FriendlyAttrRplComment);
 
   inherited Create(AOwner);
   SetHighlightChange;
   FAsmKeyWords := TSpeedStringList.Create;
   FAsmKeyWords.Text := DefaultAsmKeyWords;
-  for j := Low(OtherAsmKeyWords) to High(OtherAsmKeyWords) do begin
-    FAsmKeyWords.AddObj(TSpeedListObject.Create(OtherAsmKeyWords[j]));
-    for k := 1 to 8 do
-      FAsmKeyWords.AddObj(TSpeedListObject.Create(OtherAsmKeyWords[j] + IntToStr(k)));
+  for J := Low(OtherAsmKeyWords) to High(OtherAsmKeyWords) do begin
+    FAsmKeyWords.AddObj(TSpeedListObject.Create(OtherAsmKeyWords[J]));
+    for K := 1 to 8 do
+      FAsmKeyWords.AddObj(TSpeedListObject.Create(OtherAsmKeyWords[J] + IntToStr(K)));
   end;
   FRplKeyWords := TSpeedStringList.Create;
   FRplKeyWords.Text := DefaultRplKeyWords;
   FSAsmNoField := TSpeedStringList.Create;
   FSAsmNoField.Text := SAsmNoField;
   BaseRange := rsRpl;
-  FRange := rsRpl;
-  FDefaultFilter := SYNS_FilterHP48;
+  fRange := rsRpl;
+  fDefaultFilter := SYNS_FilterHP48;
 end; { Create }
 
 destructor TSynHP48Syn.Destroy;
 var
-  i: TtkTokenKind;
+  I: TtkTokenKind;
 begin
-  for i := Low(TtkTokenKind) to High(TtkTokenKind) do
-    FAttribs[i].Free;
+  for I := Low(TtkTokenKind) to High(TtkTokenKind) do
+    Attribs[I].Free;
   FAsmKeyWords.Free;
   FRplKeyWords.Free;
-  FSAsmNoField.Free;
+  FSAsmNoField.free;
   inherited Destroy;
 end; { Destroy }
 
 function TSynHP48Syn.AsmComProc(c: WideChar): TtkTokenKind;
 begin
   Result := tkAsmComment;
-  if (Run > Length(FLineStr)) then
+  if (Run > Length(fLineStr)) then
     Result := NullProc
   else
-    while Run <= Length(FLineStr) do
-      if ((Run = 1) or (FLineStr[Run - 1] <= ' ')) and
-        (FLineStr[Run] = '*') and
-        ((Run < Length(FLineStr)) and (FLineStr[Run + 1] = c)) and
-        ((Run + 1 = Length(FLineStr)) or (FLineStr[Run + 2] <= ' ')) then begin
-        Inc(Run, 2);
-        FRange := rsAsm;
+    while Run <= Length(fLineStr) do
+      if ((run = 1) or (fLineStr[run - 1] <= ' ')) and
+        (fLineStr[Run] = '*') and
+        ((run < Length(fLineStr)) and (fLineStr[run + 1] = c)) and
+        ((run + 1 = Length(fLineStr)) or (fLineStr[run + 2] <= ' ')) then begin
+        Inc(run, 2);
+        fRange := rsAsm;
         Break;
       end
       else
@@ -565,13 +551,13 @@ function TSynHP48Syn.AsmComProc(c: WideChar): TtkTokenKind;
 function TSynHP48Syn.RplComProc: TtkTokenKind;
 begin
   Result := tkRplComment;
-  if (Run > Length(FLineStr)) then
+  if (Run > Length(fLineStr)) then
     Result := NullProc
   else
-    while Run <= Length(FLineStr) do
-      if FLineStr[Run] = ')' then begin
-        Inc(Run);
-        FRange := rsRpl;
+    while Run <= Length(fLineStr) do
+      if fLineStr[Run] = ')' then begin
+        Inc(run);
+        fRange := rsRpl;
         Break;
       end
       else
@@ -580,22 +566,22 @@ function TSynHP48Syn.RplComProc: TtkTokenKind;
 
 function TSynHP48Syn.SlashProc: TtkTokenKind;
 begin
-  if FRange = rsRpl then
+  if fRange = rsRpl then
     Result := IdentProc
-  else if ((Run = 1) or (FLineStr[Run - 1] <= ' ')) and
-    (FLineStr[Run] = '/') and
-    (Run < Length(FLineStr)) and
-    (FLineStr[Run + 1] = '*') and
-    ((Run + 1 = Length(FLineStr)) or (FLineStr[Run + 2] <= ' ')) then begin
+  else if ((Run = 1) or (fLineStr[Run - 1] <= ' ')) and
+    (fLineStr[Run] = '/') and
+    (run < Length(fLineStr)) and
+    (fLineStr[run + 1] = '*') and
+    ((run + 1 = Length(fLineStr)) or (fLineStr[Run + 2] <= ' ')) then begin
     Inc(Run, 2);
     Result := tkAsmComment;
-    FRange := rsComAsm2;
+    fRange := rsComAsm2;
   end
-  else if (Run < Length(FLineStr)) and (FLineStr[Run + 1] = '/') then begin
+  else if (run < Length(fLineStr)) and (fLineStr[Run + 1] = '/') then begin
     Inc(Run, 2);
     Result := tkAsmComment;
-    while (Run <= Length(FLineStr)) do
-      if CharInSet(FLineStr[Run], [#10, #13]) then
+    while (run <= Length(fLineStr)) do
+      if CharInSet(fLineStr[Run], [#10, #13]) then
       begin
         Inc(Run);
         Break;
@@ -609,23 +595,23 @@ function TSynHP48Syn.SlashProc: TtkTokenKind;
 
 function TSynHP48Syn.ParOpenProc: TtkTokenKind;
 begin
-  if FRange = rsRpl then
-    if ((Run = 1) and ((Length(FLineStr) = 1) or (FLineStr[Run + 1] <= ' '))) or
-      ((FLineStr[Run - 1] <= ' ') and ((Length(FLineStr) = Run) or (FLineStr[Run + 1] <= ' '))) then begin
+  if fRange = rsRpl then
+    if ((Run = 1) and ((Length(fLineStr) = 1) or (fLineStr[Run + 1] <= ' '))) or
+      ((fLineStr[Run - 1] <= ' ') and ((Length(fLineStr) = Run) or (fLineStr[Run + 1] <= ' '))) then begin
       Inc(Run);
       Result := tkRplComment;
-      FRange := rsComRpl;
+      fRange := rsComRpl;
     end
     else
       Result := IdentProc
-  else if ((Run = 1) or (FLineStr[Run - 1] <= ' ')) and
-    (FLineStr[Run] = '(') and
-    (Run < Length(FLineStr)) and
-    (FLineStr[Run + 1] = '*') and
-    ((Run + 2 > Length(FLineStr)) or (FLineStr[Run + 2] <= ' ')) then begin
+  else if ((run = 1) or (fLineStr[run - 1] <= ' ')) and
+    (fLineStr[Run] = '(') and
+    (run < Length(fLineStr)) and
+    (fLineStr[run + 1] = '*') and
+    ((run + 2 > Length(fLineStr)) or (fLineStr[run + 2] <= ' ')) then begin
     Inc(Run, 2);
     Result := tkAsmComment;
-    FRange := rsComAsm1;
+    fRange := rsComAsm1;
   end
   else
     Result := IdentProc
@@ -633,11 +619,11 @@ function TSynHP48Syn.ParOpenProc: TtkTokenKind;
 
 function TSynHP48Syn.PersentProc: TtkTokenKind;
 begin
-  if FRange = rsAsm then begin
+  if fRange = rsAsm then begin
     Inc(Run);
     Result := tkAsmComment;
-    while (Run <= Length(FLineStr)) do
-      case FLineStr[Run] of
+    while (run <= Length(fLineStr)) do
+      case fLineStr[Run] of
         #10, #13: begin
             Inc(Run);
             Break;
@@ -652,11 +638,11 @@ function TSynHP48Syn.PersentProc: TtkTokenKind;
 
 function TSynHP48Syn.StarProc: TtkTokenKind;
 begin
-  if FRange = rsRpl then begin
+  if fRange = rsRpl then begin
     Inc(Run);
     Result := tkRplComment;
-    while (Run <= Length(FLineStr)) do
-      case FLineStr[Run] of
+    while (run <= Length(fLineStr)) do
+      case fLineStr[Run] of
         #10, #13: begin
             Inc(Run);
             Break;
@@ -671,31 +657,31 @@ function TSynHP48Syn.StarProc: TtkTokenKind;
 
 function TSynHP48Syn.IdentProc: TtkTokenKind;
 var
-  i: Integer;
-  s: UnicodeString;
+  I: Integer;
+  s: string;
 begin
-  i := Run;
+  I := Run;
   EndOfToken;
-  s := Copy(FLineStr, i, Run - i);
-  if FRange = rsAsm then
+  s := Copy(fLineStr, I, run - I);
+  if fRange = rsAsm then
     if FAsmKeyWords.Find(s) <> nil then
       if (s = '!RPL') or (s = 'ENDCODE') then begin
-        FRange := rsRpl;
+        fRange := rsRpl;
         Result := tkAsmKey;
       end
       else
         Result := tkAsmKey
-    else if FLineStr[i] <> '*' then
+    else if fLineStr[I] <> '*' then
       Result := tkAsm
     else
       Result := tkAsmKey
   else if FRplKeyWords.Find(s) <> nil then
     if (s = 'CODEM') or (s = 'ASSEMBLEM') then begin
-      FRange := rsAsm;
+      fRange := rsAsm;
       Result := tkAsmKey;
     end
     else if (s = 'CODE') or (s = 'ASSEMBLE') then begin
-      FRange := rssAsm1;
+      fRange := rssAsm1;
       Result := tksAsmKey;
     end
     else
@@ -706,7 +692,7 @@ function TSynHP48Syn.IdentProc: TtkTokenKind;
 
 function TSynHP48Syn.GetTokenFromRange: TtkTokenKind;
 begin
-  case FRange of
+  case frange of
     rsAsm: Result := tkAsm;
     rssAsm1: Result := tksAsmKey;
     rssAsm2: Result := tksAsm;
@@ -728,37 +714,37 @@ function TSynHP48Syn.NullProc: TtkTokenKind;
 function TSynHP48Syn.SpaceProc: TtkTokenKind;
 begin
   Inc(Run);
-  while (Run <= Length(FLineStr)) and CharInSet(FLineStr[Run], [#1..#32]) do
+  while (Run <= Length(fLineStr)) and CharInSet(fLineStr[Run], [#1..#32]) do
     Inc(Run);
   Result := GetTokenFromRange;
 end;
 
 function TSynHP48Syn.Next1: TtkTokenKind;
 begin
-  FTokenPos := Run - 1;
-  if Run > Length(FLineStr) then
+  fTokenPos := Run - 1;
+  if Run > Length(fLineStr) then
     Result := NullProc
-  else if FRange = rsComRpl then
+  else if fRange = rsComRpl then
     Result := RplComProc
-  else if FRange = rsComAsm1 then
+  else if fRange = rsComAsm1 then
     Result := AsmComProc(')')
-  else if FRange = rsComAsm2 then
+  else if fRange = rsComAsm2 then
     Result := AsmComProc('/')
-  else if FRange = rssasm1 then
+  else if frange = rssasm1 then
     Result := SasmProc1
-  else if FRange = rssasm2 then
+  else if frange = rssasm2 then
     Result := sasmproc2
-  else if FRange = rssasm3 then
+  else if frange = rssasm3 then
     Result := sasmproc3
-  else if CharInSet(FLineStr[Run], [#1..#32]) then
+  else if CharInSet(fLineStr[Run], [#1..#32]) then
     Result := SpaceProc
-  else if FLineStr[Run] = '(' then
+  else if fLineStr[Run] = '(' then
     Result := ParOpenProc
-  else if FLineStr[Run] = '%' then
+  else if fLineStr[Run] = '%' then
     Result := PersentProc
-  else if FLineStr[Run] = '/' then
+  else if fLineStr[Run] = '/' then
     Result := SlashProc
-  else if (Run = 1) and (FRange = rsRpl) and (FLineStr[1] = '*') then
+  else if (run = 1) and (fRange = rsRpl) and (fLineStr[1] = '*') then
     Result := StarProc
   else
     Result := IdentProc;
@@ -766,7 +752,7 @@ function TSynHP48Syn.Next1: TtkTokenKind;
 
 procedure TSynHP48Syn.Next2(tkk: TtkTokenKind);
 begin
-  FTockenKind := tkk;
+  fTockenKind := tkk;
 end;
 
 procedure TSynHP48Syn.Next;
@@ -777,45 +763,45 @@ procedure TSynHP48Syn.Next;
 
 function TSynHP48Syn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 2;
+  Result := Run = fLineLen + 2;
 end;
 
 function TSynHP48Syn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 procedure TSynHP48Syn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 procedure TSynHP48Syn.ResetRange;
 begin
-  FRange := BaseRange;
+  fRange := BaseRange;
 end;
 
 function TSynHP48Syn.GetAttrib(Index: Integer): TSynHighlighterAttributes;
 begin
-  Result := FAttribs[TtkTokenKind(Index)];
+  Result := Attribs[TtkTokenKind(Index)];
 end;
 
 procedure TSynHP48Syn.SetAttrib(Index: Integer; Value: TSynHighlighterAttributes);
 begin
-  FAttribs[TtkTokenKind(Index)].Assign(Value);
+  Attribs[TtkTokenKind(Index)].Assign(Value);
 end;
 
 procedure TSynHP48Syn.EndOfToken;
 begin
-  while (Run <= Length(FLineStr)) and (FLineStr[Run] > ' ') do
+  while (Run <= Length(fLineStr)) and (fLineStr[Run] > ' ') do
     Inc(Run);
 end;
 
 function TSynHP48Syn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean;
 var
-  r: TBetterRegistry;
+  r: TRegistry;
 begin
-  r := TBetterRegistry.Create;
+  r := TRegistry.Create;
   try
     r.RootKey := RootKey;
     if r.OpenKeyReadOnly(Key) then begin
@@ -827,42 +813,38 @@ function TSynHP48Syn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean;
     end
     else
       Result := False;
-  finally
-    r.Free;
+  finally r.Free;
   end;
 end;
 
 function TSynHP48Syn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean;
 var
-  r: TBetterRegistry;
+  r: TRegistry;
 begin
-  r := TBetterRegistry.Create;
+  r := TRegistry.Create;
   try
     r.RootKey := RootKey;
-    if r.OpenKey(Key, true) then begin
-      {$IFNDEF SYN_COMPILER_25_UP}
-      Result := true;
-      {$ENDIF}
+    if r.OpenKey(Key, True) then
+    begin
       r.WriteString('AsmKeyWordList', AsmKeywords.Text);
       r.WriteString('RplKeyWordList', RplKeywords.Text);
       Result := inherited SaveToRegistry(RootKey, Key);
     end
     else
       Result := False;
-  finally
-    r.Free;
+  finally r.Free;
   end;
 end;
 
 procedure TSynHP48Syn.Assign(Source: TPersistent);
 var
-  i: TtkTokenKind;
+  I: TtkTokenKind;
 begin
   if Source is TSynHP48Syn then begin
-    for i := Low(FAttribs) to High(FAttribs) do begin
-      FAttribs[i].Background := TSynHP48Syn(source).FAttribs[i].Background;
-      FAttribs[i].Foreground := TSynHP48Syn(source).FAttribs[i].Foreground;
-      FAttribs[i].Style := TSynHP48Syn(source).FAttribs[i].Style;
+    for I := Low(Attribs) to High(Attribs) do begin
+      Attribs[I].Background := TSynHP48Syn(source).Attribs[I].Background;
+      Attribs[I].Foreground := TSynHP48Syn(source).Attribs[I].Foreground;
+      Attribs[I].Style := TSynHP48Syn(source).Attribs[I].Style;
     end;
     AsmKeyWords.Text := TSynHP48Syn(source).AsmKeyWords.Text;
     RplKeyWords.Text := TSynHP48Syn(source).RplKeyWords.Text;
@@ -873,20 +855,20 @@ procedure TSynHP48Syn.Assign(Source: TPersistent);
 
 function TSynHP48Syn.GetAttribCount: Integer;
 begin
-  Result := Ord(High(FAttribs)) - Ord(Low(FAttribs)) + 1;
+  Result := Ord(High(Attribs)) - Ord(Low(Attribs)) + 1;
 end;
 
-function TSynHP48Syn.GetAttribute(idx: Integer): TSynHighlighterAttributes;
+function TSynHP48Syn.GetAttribute(Idx: Integer): TSynHighlighterAttributes;
 begin // sorted by name
-  if (idx <= Ord(High(TtkTokenKind))) then
-    Result := FAttribs[TtkTokenKind(idx)]
+  if (Idx <= Ord(High(TtkTokenKind))) then
+    Result := Attribs[TtkTokenKind(Idx)]
   else
     Result := nil;
 end;
 
 function TSynHP48Syn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterHP48;
+  Result := fDefaultFilter <> SYNS_FilterHP48;
 end;
 
 class function TSynHP48Syn.GetLanguageName: string;
@@ -896,98 +878,98 @@ class function TSynHP48Syn.GetLanguageName: string;
 
 procedure TSynHP48Syn.SetHighLightChange;
 var
-  i: TtkTokenKind;
+  I: TtkTokenKind;
 begin
-  for i := Low(FAttribs) to High(FAttribs) do begin
-    FAttribs[i].OnChange := DefHighLightChange;
-    FAttribs[i].InternalSaveDefaultValues;
+  for I := Low(Attribs) to High(Attribs) do begin
+    Attribs[I].OnChange := DefHighLightChange;
+    Attribs[I].InternalSaveDefaultValues;
   end;
 end;
 
 function TSynHP48Syn.SasmProc1: TtkTokenKind;
 var
-  i: Integer;
-  s: UnicodeString;
+  I: Integer;
+  s: string;
 begin
   Result := tksAsmKey;
-  if Run > Length(FLineStr) then
+  if run > Length(fLineStr) then
     Exit;
-  if FLineStr[Run] = '*' then begin
-    FRange := rssasm3;
+  if fLineStr[Run] = '*' then begin
+    frange := rssasm3;
     Result := tksAsmComment;
     Exit;
   end;
-  if FLineStr[Run] >= ' ' then begin
-    i := Run;
-    while (Run <= Length(FLineStr)) and (FLineStr[Run] > ' ') do
-      Inc(Run);
-    s := Copy(FLineStr, i, Run - i);
+  if fLineStr[Run] >= ' ' then begin
+    I := run;
+    while (run <= Length(fLineStr)) and (fLineStr[run] > ' ') do
+      Inc(run);
+    s := Copy(fLineStr, I, run - I);
     if (s = 'RPL') or (s = 'ENDCODE') then begin
-      FRange := rsRpl;
+      frange := rsRpl;
       Exit;
     end;
   end;
-  while (Run <= Length(FLineStr)) and (FLineStr[Run] <= ' ') and (FLineStr[Run] <> #10) do
-    Inc(Run);
-  if Run <= Length(FLineStr) then
-    FRange := rssasm2
+  while (run <= Length(fLineStr)) and (fLineStr[run] <= ' ') and (fLineStr[run] <> #10) do
+    Inc(run);
+  if run <= Length(fLineStr) then
+    frange := rssasm2
   else
-    FRange := rssasm1;
+    frange := rssasm1;
 end;
 
 function TSynHP48Syn.SasmProc2: TtkTokenKind;
 var
-  i: Integer;
-  s: UnicodeString;
+  I: Integer;
+  s: string;
 begin
   Result := tksAsm;
-  while (Run <= Length(FLineStr)) and (FLineStr[Run] <= ' ') and (FLineStr[Run] <> #10) do
-    Inc(Run);
-  if Run > 30 then begin
-    FRange := rssasm3;
+  while (run <= Length(fLineStr)) and (fLineStr[run] <= ' ') and (fLineStr[run] <> #10) do
+    Inc(run);
+  if run > 30 then begin
+    frange := rssasm3;
     Exit;
   end;
-  i := Run;
-  while (Run <= Length(FLineStr)) and (FLineStr[Run] > ' ') do
-    Inc(Run);
-  s := Copy(FLineStr, i, Run - i);
+  I := run;
+  while (run <= Length(fLineStr)) and (fLineStr[run] > ' ') do
+    Inc(run);
+  s := Copy(fLineStr, I, run - I);
   if (s = 'ENDCODE') or (s = 'RPL') then begin
-    FRange := rsRpl;
+    frange := rsRpl;
     Result := tksAsmKey;
   end
   else begin
     if FSAsmNoField.Find(s) = nil then begin
-      while (Run <= Length(FLineStr)) and (FLineStr[Run] <= ' ') and (FLineStr[Run] <> #10) do
-        Inc(Run);
-      while (Run <= Length(FLineStr)) and (FLineStr[Run] > ' ') do
-        Inc(Run);
-      while (Run <= Length(FLineStr)) and (FLineStr[Run] <= ' ') and (FLineStr[Run] <> #10) do
-        Inc(Run);
+      while (run <= Length(fLineStr)) and (fLineStr[run] <= ' ') and (fLineStr[run] <> #10) do
+        Inc(run);
+      while (run <= Length(fLineStr)) and (fLineStr[run] > ' ') do
+        Inc(run);
+      while (run <= Length(fLineStr)) and (fLineStr[run] <= ' ') and (fLineStr[run] <> #10) do
+        Inc(run);
     end;
-    if Run <= Length(FLineStr) then
-      FRange := rssasm3
+    if run <= Length(fLineStr) then
+      frange := rssasm3
     else
-      FRange := rssasm1;
+      frange := rssasm1;
   end;
 end;
 
 function TSynHP48Syn.SasmProc3: TtkTokenKind;
 begin
   Result := tksAsmComment;
-  while (Run <= Length(FLineStr)) and (FLineStr[Run] <> #10) do
-    Inc(Run);
-  if Run <= Length(FLineStr) then Inc(Run);
-  FRange := rssasm1;
+  while (run <= Length(fLineStr)) and (fLineStr[run] <> #10) do
+    Inc(run);
+  if run <= Length(fLineStr) then Inc(run);
+  frange := rssasm1;
 end;
 
 function TSynHP48Syn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  Result := GetAttrib(Ord(FTockenKind));
+  Result := GetAttrib(Ord(fTockenKind));
 end;
 
 function TSynHP48Syn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTockenKind);
+  Result := Ord(fTockenKind);
 end;
 
 function TSynHP48Syn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -998,7 +980,7 @@ function TSynHP48Syn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribu
 // reimplement functions to handle the non-standard use of 1-based Run
 // (instead of the standard 0-based Run)
 
-procedure TSynHP48Syn.DoSetLine(const Value: UnicodeString;
+procedure TSynHP48Syn.DoSetLine(const Value: string;
   LineNumber: Integer);
 begin
   inherited;
@@ -1006,28 +988,26 @@ procedure TSynHP48Syn.DoSetLine(const Value: UnicodeString;
   fOldRun := Run;
 end;
 
-function TSynHP48Syn.GetToken: UnicodeString;
+function TSynHP48Syn.GetToken: string;
 var
   Len: Integer;
 begin
-  Len := (Run - 1) - FTokenPos;
+  Len := (Run - 1) - fTokenPos;
   SetLength(Result, Len);
   if Len > 0 then
-    WStrLCopy(@Result[1], fCasedLine + FTokenPos, Len);
+    StrLCopy(@Result[1], fCasedLine + fTokenPos, Len);
 end;
 
 function TSynHP48Syn.IsLineEnd(Run: Integer): Boolean;
 begin
-  Result := (Run - 1 >= FLineLen) or (FLine[Run - 1] = #10) or (FLine[Run - 1] = #13);
+  Result := (Run - 1 >= fLineLen) or (fLine[Run - 1] = #10) or (fLine[Run - 1] = #13);
 end;
 
-class function TSynHP48Syn.GetFriendlyLanguageName: UnicodeString;
+class function TSynHP48Syn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangHP48;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynHP48Syn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterHashEntries.pas b/Ext/SynEdit/Source/SynHighlighterHashEntries.pas
deleted file mode 100644
index 67e9a80..0000000
--- a/Ext/SynEdit/Source/SynHighlighterHashEntries.pas
+++ /dev/null
@@ -1,251 +0,0 @@
-{-------------------------------------------------------------------------------
-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: SynHighlighterHashEntries.pas, released 2000-04-21.
-
-The Initial Author of this file is Michael Hieke.
-Portions created by Michael Hieke are Copyright 2000 Michael Hieke.
-Unicode translation by Maël Hörz.
-All Rights Reserved.
-
-Contributors to the SynEdit project are listed in the Contributors.txt file.
-
-Alternatively, the contents of this file may be used under the terms of the
-GNU General Public License Version 2 or later (the "GPL"), in which case
-the provisions of the GPL are applicable instead of those above.
-If you wish to allow use of your version of this file only under the terms
-of the GPL and not to allow others to use your version of this file
-under the MPL, indicate your decision by deleting the provisions above and
-replace them with the notice and other provisions required by the GPL.
-If you do not delete the provisions above, a recipient may use your version
-of this file under either the MPL or the GPL.
-
-$Id: SynHighlighterHashEntries.pas,v 1.5.2.3 2008/09/14 16:25:00 maelh Exp $
-
-You may retrieve the latest version of this file at the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-Known Issues:
--------------------------------------------------------------------------------}
-
-{
-@abstract(Support classes for SynEdit highlighters that create the keyword lists at runtime.)
-@author(Michael Hieke)
-@created(2000-04-21)
-@lastmod(2001-09-07)
-The classes in this unit can be used to use the hashing algorithm while still
-having the ability to change the set of keywords.
-}
-
-unit SynHighlighterHashEntries;
-
-{$I SynEdit.inc}
-
-interface
-
-uses
-  SynEditTypes,
-  SynUnicode,
-  Classes;
-
-type
-  { Class to hold the keyword to recognize, its length and its token kind. The
-    keywords that have the same hashvalue are stored in a single-linked list,
-    with the Next property pointing to the next entry. The entries are ordered
-    over the keyword length. }
-  TSynHashEntry = class(TObject)
-  protected
-    { Points to the next keyword entry with the same hashvalue. }
-    FNext: TSynHashEntry;
-    { Length of the keyword. }
-    FKeyLen: Integer;
-    { The keyword itself. }
-    FKeyword: UnicodeString;
-    { Keyword token kind, has to be typecasted to the real token kind type. }
-    fKind: Integer;
-  public
-    { Adds a keyword entry with the same hashvalue. Depending on the length of
-      the two keywords it might return Self and store NewEntry in the Next
-      pointer, or return NewEntry and make the Next property of NewEntry point
-      to Self. This way the order of keyword length is preserved. }
-    function AddEntry(NewEntry: TSynHashEntry): TSynHashEntry; virtual;
-    { Creates a keyword entry for the given keyword and token kind. }
-    constructor Create(const AKey: UnicodeString; AKind: Integer);
-    { Destroys the keyword entry and all other keyword entries Next points to. }
-    destructor Destroy; override;
-  public
-    { The keyword itself. }
-    property Keyword: UnicodeString read FKeyword;
-    { Length of the keyword. }
-    property KeywordLen: Integer read FKeyLen;
-    { Keyword token kind, has to be typecasted to the real token kind type. }
-    property Kind: Integer read fKind;
-    { Points to the next keyword entry with the same hashvalue. }
-    property Next: TSynHashEntry read FNext;
-  end;
-
-
-{$IFNDEF SYN_COMPILER_4_UP}
-  {$IFNDEF SYN_CPPB_3}
-    {$DEFINE LIST_CLEAR_NOT_VIRTUAL}
-  {$ENDIF}
-{$ENDIF}
-
-  { A list of keyword entries, stored as single-linked lists under the hashvalue
-    of the keyword. }
-  TSynHashEntryList = class(TList)
-  protected
-    { Returns the first keyword entry for a given hashcalue, or nil. }
-    function Get(HashKey: TListSize): TSynHashEntry;
-    { Adds a keyword entry under its hashvalue. Will grow the list count when
-      necessary, so the maximum hashvalue should be limited outside. The correct
-      order of keyword entries is maintained. }
-    procedure Put(HashKey: TListSize; Entry: TSynHashEntry);
-  public
-{$IFDEF LIST_CLEAR_NOT_VIRTUAL}
-    { Overridden destructor clears the list and frees all contained keyword
-      entries. }
-    destructor Destroy; override;
-    { Clears the list and frees all contained keyword entries. }
-    procedure DeleteEntries;
-{$ELSE}
-    { Clears the list and frees all contained keyword entries. }
-    procedure Clear; override;
-{$ENDIF}
-  public
-    { Type-safe access to the first keyword entry for a hashvalue. }
-    property Items[Index: TListSize]: TSynHashEntry read Get write Put; default;
-  end;
-
-  { Procedural type for adding keyword entries to a TSynHashEntryList when
-    iterating over all the keywords contained in a string. }
-  TEnumerateKeywordEvent = procedure(AKeyword: UnicodeString; AKind: Integer)
-    of object;
-
-{ This procedure will call AKeywordProc for all keywords in KeywordList. A
-  keyword is considered any number of successive chars that are contained in
-  Identifiers, with chars not contained in Identifiers before and after them. }
-procedure EnumerateKeywords(AKind: Integer; KeywordList: UnicodeString;
-  IsIdentChar: TCategoryMethod; AKeywordProc: TEnumerateKeywordEvent);
-
-implementation
-
-uses
-  SysUtils;
-
-procedure EnumerateKeywords(AKind: Integer; KeywordList: UnicodeString;
-  IsIdentChar: TCategoryMethod; AKeywordProc: TEnumerateKeywordEvent);
-var
-  pStart, pEnd: PWideChar;
-  Keyword: UnicodeString;
-begin
-  if Assigned(AKeywordProc) and (KeywordList <> '') then
-  begin
-    pEnd := PWideChar(KeywordList);
-    pStart := pEnd;
-    repeat
-      // skip over chars that are not in Identifiers
-      while (pStart^ <> #0) and not IsIdentChar(pStart^) do
-        Inc(pStart);
-      if pStart^ = #0 then
-        Break;
-      // find the last char that is in Identifiers
-      pEnd := pStart + 1;
-      while (pEnd^ <> #0) and IsIdentChar(pEnd^) do
-        Inc(pEnd);
-      // call the AKeywordProc with the keyword
-      SetString(Keyword, pStart, pEnd - pStart);
-      AKeywordProc(Keyword, AKind);
-      Keyword := '';
-      // pEnd points to a char not in Identifiers, restart after that
-      pStart := pEnd + 1;
-    until (pStart^ = #0) or (pEnd^ = #0);
-  end;
-end;
-
-{ TSynHashEntry }
-
-constructor TSynHashEntry.Create(const AKey: UnicodeString; AKind: Integer);
-begin
-  inherited Create;
-  FKeyLen := Length(AKey);
-  FKeyword := AKey;
-  fKind := AKind;
-end;
-
-destructor TSynHashEntry.Destroy;
-begin
-  FNext.Free;
-  inherited Destroy;
-end;
-
-function TSynHashEntry.AddEntry(NewEntry: TSynHashEntry): TSynHashEntry;
-begin
-  Result := Self;
-  if Assigned(NewEntry) then
-  begin
-    if WideCompareText(NewEntry.Keyword, FKeyword) = 0 then
-      raise Exception.CreateFmt('Keyword "%s" already in list', [FKeyword]);
-    if NewEntry.FKeyLen < FKeyLen then
-    begin
-      NewEntry.FNext := Self;
-      Result := NewEntry;
-    end else if Assigned(FNext) then
-      FNext := FNext.AddEntry(NewEntry)
-    else
-      FNext := NewEntry;
-  end;
-end;
-
-{ TSynHashEntryList }
-
-{$IFDEF LIST_CLEAR_NOT_VIRTUAL}
-destructor TSynHashEntryList.Destroy;
-begin
-  DeleteEntries;
-  inherited Destroy;
-end;
-
-procedure TSynHashEntryList.DeleteEntries;
-{$ELSE}
-procedure TSynHashEntryList.Clear;
-{$ENDIF}
-var
-  i: Integer;
-begin
-  for i := 0 to Count - 1 do
-    TSynHashEntry(Items[i]).Free;
-  inherited Clear;
-end;
-
-function TSynHashEntryList.Get(HashKey: TListSize): TSynHashEntry;
-begin
-  if (HashKey >= 0) and (HashKey < Count) then
-    Result := inherited Items[HashKey]
-  else
-    Result := nil;
-end;
-
-procedure TSynHashEntryList.Put(HashKey: TListSize; Entry: TSynHashEntry);
-var
-  ListEntry: TSynHashEntry;
-begin
-  if HashKey >= Count then
-    Count := HashKey + 1;
-  ListEntry := TSynHashEntry(inherited Items[HashKey]);
-  // if there is already a hashentry for this hashvalue let it decide
-  // where to put the new entry in its single linked list
-  if Assigned(ListEntry) then
-    Entry := ListEntry.AddEntry(Entry);
-  inherited Items[HashKey] := Entry;
-end;
-
-end.
-
diff --git a/Ext/SynEdit/Source/SynHighlighterHaskell.pas b/Ext/SynEdit/Source/SynHighlighterHaskell.pas
index b44a335..cbe6df7 100644
--- a/Ext/SynEdit/Source/SynHighlighterHaskell.pas
+++ b/Ext/SynEdit/Source/SynHighlighterHaskell.pas
@@ -28,13 +28,6 @@
 replace them with the notice and other provisions required by the GPL.
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
-
-You may retrieve the latest version of SynEdit from the SynEdit home page,
-located at http://SynEdit.SourceForge.net
-
-You may retrieve the latest version of this file from
-http://www.ashleybrown.co.uk/synedit/
-
 -------------------------------------------------------------------------------}
 {
 @abstract(Provides a Haskell syntax highlighter for SynEdit)
@@ -87,18 +80,18 @@ interface
 
   TSynHaskellSyn = class(TSynCustomHighlighter)
   private
-    FAsmStart: Boolean;
-    FRange: TRangeState;
+    fAsmStart: Boolean;
+    fRange: TRangeState;
     FTokenID: TtkTokenKind;
     FExtTokenID: TxtkTokenKind;
-    FIdentFuncTable: array[0..28] of TIdentFuncTableFunc;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FNumberAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FStringAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
+    fIdentFuncTable: array[0..28] of TIdentFuncTableFunc;
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fNumberAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fStringAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
     function AltFunc(Index: Integer): TtkTokenKind;
     function KeyWordFunc(Index: Integer): TtkTokenKind;
     function HashKey(Str: PWideChar): Cardinal;
@@ -140,13 +133,13 @@   TSynHaskellSyn = class(TSynCustomHighlighter)
     procedure XOrSymbolProc;
     procedure UnknownProc;
   protected
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     function GetExtTokenID: TxtkTokenKind;
     function IsFilterStored: Boolean; override;
   public
     class function GetCapabilities: TSynHighlighterCapabilities; override;
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -163,29 +156,30 @@   TSynHaskellSyn = class(TSynCustomHighlighter)
     procedure EnumUserSettings(settings: TStrings); override;
     property ExtTokenID: TxtkTokenKind read GetExtTokenID;
   published
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property NumberAttri: TSynHighlighterAttributes read FNumberAttri
-      write FNumberAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property StringAttri: TSynHighlighterAttributes read FStringAttri
-      write FStringAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property NumberAttri: TSynHighlighterAttributes read fNumberAttri
+      write fNumberAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property StringAttri: TSynHighlighterAttributes read fStringAttri
+      write fStringAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
   end;
 
 implementation
 
 uses
   Windows,
+  Registry,
   SynEditStrConst;
 
 const
-  KeyWords: array[0..23] of UnicodeString = (
+  KeyWords: array[0..23] of string = (
     'Bool', 'Char', 'class', 'data', 'deriving', 'Double', 'else', 'False', 
     'Float', 'if', 'import', 'in', 'instance', 'Int', 'Integer', 'IO', 'let', 
     'module', 'otherwise', 'String', 'then', 'True', 'type', 'where' 
@@ -206,7 +200,7 @@ function TSynHaskellSyn.HashKey(Str: PWideChar): Cardinal;
     Inc(Str);
   end;
   Result := Result mod 29;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -214,10 +208,10 @@ function TSynHaskellSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
@@ -226,13 +220,13 @@ procedure TSynHaskellSyn.InitIdent;
 var
   i: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
     if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
+      fIdentFuncTable[i] := AltFunc;
 
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if @FIdentFuncTable[i] = nil then
-      FIdentFuncTable[i] := KeyWordFunc;
+  for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do
+    if @fIdentFuncTable[i] = nil then
+      fIdentFuncTable[i] := KeyWordFunc;
 end;
 
 function TSynHaskellSyn.AltFunc(Index: Integer): TtkTokenKind;
@@ -252,34 +246,34 @@ constructor TSynHaskellSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := True;
-
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  FCommentAttri.Style := [fsItalic];
-  AddAttribute(FCommentAttri);
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  AddAttribute(FIdentifierAttri);
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style:= [fsBold];
-  AddAttribute(FKeyAttri);
-  FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
-  AddAttribute(FNumberAttri);
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
-  FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
-  AddAttribute(FStringAttri);
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  AddAttribute(FSymbolAttri);
+  fCaseSensitive := True;
+
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  fCommentAttri.Style := [fsItalic];
+  AddAttribute(fCommentAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  AddAttribute(fIdentifierAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style:= [fsBold];
+  AddAttribute(fKeyAttri);
+  fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber);
+  AddAttribute(fNumberAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
+  fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString);
+  AddAttribute(fStringAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  AddAttribute(fSymbolAttri);
   SetAttributesOnChange(DefHighlightChange);
   InitIdent;
-  FRange := rsUnknown;
-  FAsmStart := False;
-  FDefaultFilter := SYNS_FilterHaskell;
+  fRange := rsUnknown;
+  fAsmStart := False;
+  fDefaultFilter := SYNS_FilterHaskell;
 end; { Create }
 
 procedure TSynHaskellSyn.AnsiCProc;
 begin
-  FTokenID := tkComment;
+  fTokenID := tkComment;
   case FLine[Run] of
     #0:
       begin
@@ -301,29 +295,29 @@ procedure TSynHaskellSyn.AnsiCProc;
   while FLine[Run] <> #0 do
     case FLine[Run] of
       '*':
-        if FLine[Run + 1] = '/' then
+        if fLine[Run + 1] = '/' then
         begin
           Inc(Run, 2);
-          if FRange = rsAnsiCAsm then
-            FRange := rsAsm
-          else if FRange = rsAnsiCAsmBlock then
-            FRange := rsAsmBlock
-          else if FRange = rsDirectiveComment then
-            FRange := rsDirective
+          if fRange = rsAnsiCAsm then
+            fRange := rsAsm
+          else if fRange = rsAnsiCAsmBlock then
+            fRange := rsAsmBlock
+          else if fRange = rsDirectiveComment then
+            fRange := rsDirective
           else
-            FRange := rsUnknown;
+            fRange := rsUnKnown;
           Break;
         end else
           Inc(Run);
-      #10, #13:
-        Break;
+      #10: Break;
+      #13: Break;
     else Inc(Run);
     end;
 end;
 
 procedure TSynHaskellSyn.AndSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {and assign}
       begin
@@ -345,55 +339,55 @@ procedure TSynHaskellSyn.AndSymbolProc;
 
 procedure TSynHaskellSyn.AsciiCharProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
-    if FLine[Run] = '\' then begin
-      if CharInSet(FLine[Run + 1], [#39, '\']) then
+    if fLine[Run] = '\' then begin
+      if CharInSet(fLine[Run + 1], [#39, '\']) then
         Inc(Run);
     end;
     Inc(Run);
-  until IsLineEnd(Run) or (FLine[Run] = #39);
-  if FLine[Run] = #39 then
+  until IsLineEnd(Run) or (fLine[Run] = #39);
+  if fLine[Run] = #39 then
     Inc(Run);
 end;
 
 procedure TSynHaskellSyn.AtSymbolProc;
 begin
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
   Inc(Run);
 end;
 
 procedure TSynHaskellSyn.BraceCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
   FExtTokenID := xtkBraceClose;
-  if FRange = rsAsmBlock then FRange := rsUnknown;
+  if fRange = rsAsmBlock then fRange := rsUnknown;
 end;
 
 procedure TSynHaskellSyn.BraceOpenProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
   FExtTokenID := xtkBraceOpen;
-  if FRange = rsAsm then
+  if fRange = rsAsm then
   begin
-    FRange := rsAsmBlock;
-    FAsmStart := True;
+    fRange := rsAsmBlock;
+    fAsmStart := True;
   end;
 end;
 
 procedure TSynHaskellSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run + 1] = #10 then Inc(Run);
+  if fLine[Run + 1] = #10 then Inc(Run);
 end;
 
 procedure TSynHaskellSyn.ColonProc;
 begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
+  fTokenID := tkSymbol;
+  Case FLine[Run + 1] of
     ':':                               {scope resolution operator}
       begin
         Inc(Run, 2);
@@ -410,13 +404,13 @@ procedure TSynHaskellSyn.ColonProc;
 procedure TSynHaskellSyn.CommaProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkComma;
 end;
 
 procedure TSynHaskellSyn.EqualProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {logical equal}
       begin
@@ -433,8 +427,8 @@ procedure TSynHaskellSyn.EqualProc;
 
 procedure TSynHaskellSyn.GreaterProc;
 begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
+  fTokenID := tkSymbol;
+  Case FLine[Run + 1] of
     '=':                               {greater than or equal to}
       begin
         Inc(Run, 2);
@@ -463,27 +457,27 @@ procedure TSynHaskellSyn.GreaterProc;
 
 procedure TSynHaskellSyn.QuestionProc;
 begin
-  FTokenID := tkSymbol;                {conditional}
+  fTokenID := tkSymbol;                {conditional}
   FExtTokenID := xtkQuestion;
   Inc(Run);
 end;
 
 procedure TSynHaskellSyn.IdentProc;
 begin
-  FTokenID := IdentKind((FLine + Run));
-  Inc(Run, FStringLen);
-  while IsIdentChar(FLine[Run]) do Inc(Run);
+  fTokenID := IdentKind((fLine + Run));
+  Inc(Run, fStringLen);
+  while IsIdentChar(fLine[Run]) do Inc(Run);
 end;
 
 procedure TSynHaskellSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynHaskellSyn.LowerProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {less than or equal to}
       begin
@@ -513,7 +507,7 @@ procedure TSynHaskellSyn.LowerProc;
 
 procedure TSynHaskellSyn.MinusProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {subtract assign}
       begin
@@ -522,7 +516,7 @@ procedure TSynHaskellSyn.MinusProc;
       end;
     '-':                               {decrement}
       begin
-        FTokenID := tkComment;
+        fTokenID := tkComment;
         Inc(Run, 2);
         while not IsLineEnd(Run) do Inc(Run);
       end;
@@ -541,7 +535,7 @@ procedure TSynHaskellSyn.MinusProc;
 
 procedure TSynHaskellSyn.ModSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {mod assign}
       begin
@@ -558,7 +552,7 @@ procedure TSynHaskellSyn.ModSymbolProc;
 
 procedure TSynHaskellSyn.NotSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {not equal}
       begin
@@ -575,7 +569,7 @@ procedure TSynHaskellSyn.NotSymbolProc;
 
 procedure TSynHaskellSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -583,7 +577,7 @@ procedure TSynHaskellSyn.NumberProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X':
         Result := True;
       else
@@ -593,13 +587,12 @@ procedure TSynHaskellSyn.NumberProc;
 
 begin
   Inc(Run);
-  FTokenID := tkNumber;
+  fTokenID := tkNumber;
   while IsNumberChar do
   begin
     case FLine[Run] of
       '.':
-        if FLine[Run + 1] = '.' then
-          Break;
+        if FLine[Run + 1] = '.' then Break;
     end;
     Inc(Run);
   end;
@@ -607,7 +600,7 @@ procedure TSynHaskellSyn.NumberProc;
 
 procedure TSynHaskellSyn.OrSymbolProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {or assign}
       begin
@@ -629,7 +622,7 @@ procedure TSynHaskellSyn.OrSymbolProc;
 
 procedure TSynHaskellSyn.PlusProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {add assign}
       begin
@@ -651,7 +644,7 @@ procedure TSynHaskellSyn.PlusProc;
 
 procedure TSynHaskellSyn.PointProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then
     begin                              {ellipse}
       Inc(Run, 3);
@@ -667,7 +660,7 @@ procedure TSynHaskellSyn.PointProc;
 procedure TSynHaskellSyn.RoundCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkRoundClose;
 end;
 
@@ -681,9 +674,9 @@ procedure TSynHaskellSyn.RoundOpenProc;
 procedure TSynHaskellSyn.SemiColonProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkSemiColon;
-  if FRange = rsAsm then FRange := rsUnknown;
+  if fRange = rsAsm then fRange := rsUnknown;
 end;
 
 procedure TSynHaskellSyn.SlashProc;
@@ -692,13 +685,13 @@ procedure TSynHaskellSyn.SlashProc;
     '=':                               {divide assign}
       begin
         Inc(Run, 2);
-        FTokenID := tkSymbol;
+        fTokenID := tkSymbol;
         FExtTokenID := xtkDivideAssign;
       end;
   else                                 {divide}
     begin
       Inc(Run);
-      FTokenID := tkSymbol;
+      fTokenID := tkSymbol;
       FExtTokenID := xtkDivide;
     end;
   end;
@@ -707,27 +700,27 @@ procedure TSynHaskellSyn.SlashProc;
 procedure TSynHaskellSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run);
 end;
 
 procedure TSynHaskellSyn.SquareCloseProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkSquareClose;
 end;
 
 procedure TSynHaskellSyn.SquareOpenProc;
 begin
   Inc(Run);
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   FExtTokenID := xtkSquareOpen;
 end;
 
 procedure TSynHaskellSyn.StarProc;
 begin
-  FTokenID := tkSymbol;
+  fTokenID := tkSymbol;
   case FLine[Run + 1] of
     '=':                               {multiply assign}
       begin
@@ -744,14 +737,14 @@ procedure TSynHaskellSyn.StarProc;
 
 procedure TSynHaskellSyn.StringProc;
 begin
-  FTokenID := tkString;
+  fTokenID := tkString;
   repeat
-    if FLine[Run] = '\' then begin
-      if CharInSet(FLine[Run + 1], [#34, '\']) then
+    if fLine[Run] = '\' then begin
+      if CharInSet(fLine[Run + 1], [#34, '\']) then
         Inc(Run);
     end;
     Inc(Run);
-  until IsLineEnd(Run) or (FLine[Run] = #34);
+  until IsLineEnd(Run) or (fLine[Run] = #34);
   if FLine[Run] = #34 then
     Inc(Run);
 end;
@@ -759,14 +752,14 @@ procedure TSynHaskellSyn.StringProc;
 procedure TSynHaskellSyn.TildeProc;
 begin
   Inc(Run);                            {bitwise complement}
-  FTokenID := tkSymbol;
+  fTokenId := tkSymbol;
   FExtTokenID := xtkBitComplement;
 end;
 
 procedure TSynHaskellSyn.XOrSymbolProc;
 begin
-  FTokenID := tkSymbol;
-  case FLine[Run + 1] of
+  fTokenID := tkSymbol;
+  Case FLine[Run + 1] of
     '=':                               {xor assign}
       begin
         Inc(Run, 2);
@@ -783,20 +776,20 @@ procedure TSynHaskellSyn.XOrSymbolProc;
 procedure TSynHaskellSyn.UnknownProc;
 begin
   Inc(Run);
-  FTokenID := tkUnknown;
+  fTokenID := tkUnknown;
 end;
 
 procedure TSynHaskellSyn.Next;
 begin
-  FAsmStart := False;
-  FTokenPos := Run;
-  case FRange of
+  fAsmStart := False;
+  fTokenPos := Run;
+  case fRange of
     rsAnsiC, rsAnsiCAsm,
     rsAnsiCAsmBlock: AnsiCProc;
   else
     begin
-      FRange := rsUnknown;
-      case FLine[Run] of
+      fRange := rsUnknown;
+      case fLine[Run] of
         '&': AndSymbolProc;
         #39: AsciiCharProc;
         '@': AtSymbolProc;
@@ -840,28 +833,28 @@ procedure TSynHaskellSyn.Next;
 function TSynHaskellSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_STRING: Result := FStringAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_STRING: Result := fStringAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
     else Result := nil;
   end;
 end;
 
 function TSynHaskellSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynHaskellSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 function TSynHaskellSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynHaskellSyn.GetExtTokenID: TxtkTokenKind;
@@ -871,14 +864,14 @@ function TSynHaskellSyn.GetExtTokenID: TxtkTokenKind;
 
 function TSynHaskellSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  case FTokenID of
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkNumber: Result := FNumberAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkString: Result := FStringAttri;
-    tkSymbol: Result := FSymbolAttri;
+  case fTokenID of
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkNumber: Result := fNumberAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkString: Result := fStringAttri;
+    tkSymbol: Result := fSymbolAttri;
     else Result := nil;
   end;
 end;
@@ -890,18 +883,18 @@ function TSynHaskellSyn.GetTokenKind: Integer;
 
 procedure TSynHaskellSyn.ResetRange;
 begin
-  FRange:= rsUnknown;
+  fRange:= rsUnknown;
 end;
 
 procedure TSynHaskellSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 procedure TSynHaskellSyn.EnumUserSettings(settings: TStrings);
 begin
   { returns the user settings that exist in the registry }
-  with TBetterRegistry.Create do
+  with TRegistry.Create do
   begin
     try
       RootKey := HKEY_LOCAL_MACHINE;
@@ -921,7 +914,7 @@ procedure TSynHaskellSyn.EnumUserSettings(settings: TStrings);
 
 function TSynHaskellSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterHaskell;
+  Result := fDefaultFilter <> SYNS_FilterHaskell;
 end;
 
 function TSynHaskellSyn.IsIdentChar(AChar: WideChar): Boolean;
@@ -944,22 +937,19 @@ class function TSynHaskellSyn.GetCapabilities: TSynHighlighterCapabilities;
   Result := inherited GetCapabilities + [hcUserSettings];
 end;
 
-function TSynHaskellSyn.GetSampleSource: UnicodeString;
+function TSynHaskellSyn.GetSampleSource: string;
 begin
-  Result :=
-    '-- Haskell Sample Source'#13#10 +
-    'tail :: [a] -> [a]'#13#10 +
-    'tail (x:xs) = xs'#13#10 +
-    '';
+  Result := '-- Haskell Sample Source'#13#10 +
+            'tail :: [a] -> [a]'#13#10 +
+            'tail (x:xs) = xs'#13#10 +
+            '';
 end;
 
-class function TSynHaskellSyn.GetFriendlyLanguageName: UnicodeString;
+class function TSynHaskellSyn.GetFriendlyLanguageName: string;
 begin
   Result := SYNS_FriendlyLangHaskell;
 end;
 
 initialization
-{$IFNDEF SYN_CPPB_1}
   RegisterPlaceableHighlighter(TSynHaskellSyn);
-{$ENDIF}
 end.
diff --git a/Ext/SynEdit/Source/SynHighlighterHtml.pas b/Ext/SynEdit/Source/SynHighlighterHtml.pas
index 428bb5c..e51bbd3 100644
--- a/Ext/SynEdit/Source/SynHighlighterHtml.pas
+++ b/Ext/SynEdit/Source/SynHighlighterHtml.pas
@@ -29,8 +29,6 @@
 If you do not delete the provisions above, a recipient may use your version
 of this file under either the MPL or the GPL.
 
-$Id: SynHighlighterHtml.pas,v 1.24.3 2012/09/13 12:05:00 codehunterworks Exp $
-
 You may retrieve the latest version of this file at the SynEdit home page,
 located at http://SynEdit.SourceForge.net
 
@@ -51,9 +49,6 @@ interface
 {$I SynEdit.inc}
 
 uses
-{$IFDEF UNICODE}
-  WideStrUtils,
-{$ENDIF}
   Graphics,
   SynEditTypes,
   SynEditHighlighter,
@@ -322,27 +317,27 @@ interface
     tkSpace, tkSymbol, tkText, tkUndefKey, tkValue);
 
   TRangeState = (rsAmpersand, rsComment, rsKey, rsParam, rsText,
-    rsUnknown, rsValue, rsQuoteValue, rsDoubleQuoteValue);
+    rsUnKnown, rsValue, rsQuoteValue, rsDoubleQuoteValue);
 
   PIdentFuncTableFunc = ^TIdentFuncTableFunc;
   TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object;
 
   TSynHTMLSyn = class(TSynCustomHighlighter)
   private
-    FAndCode: Integer;
-    FRange: TRangeState;
-//    FIdentFuncTable: array[0..1542] of TIdentFuncTableFunc;
-    FIdentFuncTable: array[0..2178] of TIdentFuncTableFunc;
-    FTokenID: TtkTokenKind;
-    FAndAttri: TSynHighlighterAttributes;
-    FCommentAttri: TSynHighlighterAttributes;
-    FIdentifierAttri: TSynHighlighterAttributes;
-    FKeyAttri: TSynHighlighterAttributes;
-    FSpaceAttri: TSynHighlighterAttributes;
-    FSymbolAttri: TSynHighlighterAttributes;
-    FTextAttri: TSynHighlighterAttributes;
-    FUndefKeyAttri: TSynHighlighterAttributes;
-    FValueAttri: TSynHighlighterAttributes;
+    fAndCode: Integer;
+    fRange: TRangeState;
+//    fIdentFuncTable: array[0..1542] of TIdentFuncTableFunc;
+    fIdentFuncTable: array[0..2178] of TIdentFuncTableFunc;
+    fTokenID: TtkTokenKind;
+    fAndAttri: TSynHighlighterAttributes;
+    fCommentAttri: TSynHighlighterAttributes;
+    fIdentifierAttri: TSynHighlighterAttributes;
+    fKeyAttri: TSynHighlighterAttributes;
+    fSpaceAttri: TSynHighlighterAttributes;
+    fSymbolAttri: TSynHighlighterAttributes;
+    fTextAttri: TSynHighlighterAttributes;
+    fUndefKeyAttri: TSynHighlighterAttributes;
+    fValueAttri: TSynHighlighterAttributes;
     function AltFunc(Index: Integer): TtkTokenKind;
     function KeyWordFunc(Index: Integer): TtkTokenKind;
     function HashKey(Str: PWideChar): Cardinal;
@@ -361,12 +356,12 @@   TSynHTMLSyn = class(TSynCustomHighlighter)
     procedure StringProc;
     procedure AmpersandProc;
   protected
-    function GetSampleSource: UnicodeString; override;
+    function GetSampleSource: string; override;
     function IsFilterStored: Boolean; override;
     procedure NextProcedure;
   public
     class function GetLanguageName: string; override;
-    class function GetFriendlyLanguageName: UnicodeString; override;
+    class function GetFriendlyLanguageName: string; override;
   public
     constructor Create(AOwner: TComponent); override;
     function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
@@ -381,22 +376,22 @@   TSynHTMLSyn = class(TSynCustomHighlighter)
     procedure SetRange(Value: Pointer); override;
     procedure ResetRange; override;
   published
-    property AndAttri: TSynHighlighterAttributes read FAndAttri write FAndAttri;
-    property CommentAttri: TSynHighlighterAttributes read FCommentAttri
-      write FCommentAttri;
-    property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri
-      write FIdentifierAttri;
-    property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri;
-    property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri
-      write FSpaceAttri;
-    property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri
-      write FSymbolAttri;
-    property TextAttri: TSynHighlighterAttributes read FTextAttri
-      write FTextAttri;
-    property UndefKeyAttri: TSynHighlighterAttributes read FUndefKeyAttri
-      write FUndefKeyAttri;
-    property ValueAttri: TSynHighlighterAttributes read FValueAttri
-      write FValueAttri;
+    property AndAttri: TSynHighlighterAttributes read fAndAttri write fAndAttri;
+    property CommentAttri: TSynHighlighterAttributes read fCommentAttri
+      write fCommentAttri;
+    property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri
+      write fIdentifierAttri;
+    property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri;
+    property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri
+      write fSpaceAttri;
+    property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri
+      write fSymbolAttri;
+    property TextAttri: TSynHighlighterAttributes read fTextAttri
+      write fTextAttri;
+    property UndefKeyAttri: TSynHighlighterAttributes read fUndefKeyAttri
+      write fUndefKeyAttri;
+    property ValueAttri: TSynHighlighterAttributes read fValueAttri
+      write fValueAttri;
   end;
 
 implementation
@@ -405,7 +400,7 @@ implementation
   SynEditStrConst;
 
 const
-//  KeyWords: array[0..201] of UnicodeString = (
+//  KeyWords: array[0..201] of string = (
 //    '!doctype', '/a', '/abbr', '/acronym', '/address', '/applet', '/b', '/bdo',
 //    '/big', '/blink', '/blockquote', '/body', '/button', '/caption', '/center',
 //    '/cite', '/code', '/colgroup', '/comment', '/dd', '/del', '/dfn', '/dir',
@@ -519,7 +514,7 @@ implementation
 //    -1, -1, 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
 //  );
 
-  KeyWords: array[0..256] of UnicodeString = (
+  KeyWords: array[0..256] of string = (
     '!doctype', '/!doctype', '/a', '/abbr', '/acronym', '/address', '/applet',
     '/area', '/article', '/aside', '/audio', '/b', '/base', '/basefont', '/bb',
     '/bdo', '/big', '/blockquote', '/body', '/button', '/canvas', '/caption',
@@ -685,7 +680,7 @@ function TSynHTMLSyn.HashKey(Str: PWideChar): Cardinal;
 //    Inc(Str);
 //  end;
 //  Result := Result mod 1543;
-//  FStringLen := Str - FToIdent;
+//  fStringLen := Str - fToIdent;
 
   Result := 0;
   while IsIdentChar(Str^) do
@@ -694,7 +689,7 @@ function TSynHTMLSyn.HashKey(Str: PWideChar): Cardinal;
     Inc(Str);
   end;
   Result := Result mod 2179;
-  FStringLen := Str - FToIdent;
+  fStringLen := Str - fToIdent;
 end;
 {$Q+}
 
@@ -702,25 +697,25 @@ function TSynHTMLSyn.IdentKind(MayBe: PWideChar): TtkTokenKind;
 var
   Key: Cardinal;
 begin
-  FToIdent := MayBe;
+  fToIdent := MayBe;
   Key := HashKey(MayBe);
-  if Key <= High(FIdentFuncTable) then
-    Result := FIdentFuncTable[Key](KeyIndices[Key])
+  if Key <= High(fIdentFuncTable) then
+    Result := fIdentFuncTable[Key](KeyIndices[Key])
   else
     Result := tkIdentifier;
 end;
 
 procedure TSynHTMLSyn.InitIdent;
 var
-  i: Integer;
+  I: Integer;
 begin
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if KeyIndices[i] = -1 then
-      FIdentFuncTable[i] := AltFunc;
+  for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do
+    if KeyIndices[I] = -1 then
+      fIdentFuncTable[I] := AltFunc;
 
-  for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do
-    if @FIdentFuncTable[i] = nil then
-      FIdentFuncTable[i] := KeyWordFunc;
+  for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do
+    if @fIdentFuncTable[I] = nil then
+      fIdentFuncTable[I] := KeyWordFunc;
 end;
 
 function TSynHTMLSyn.AltFunc(Index: Integer): TtkTokenKind;
@@ -740,61 +735,63 @@ constructor TSynHTMLSyn.Create(AOwner: TComponent);
 begin
   inherited Create(AOwner);
 
-  FCaseSensitive := False;
+  fCaseSensitive := False;
 
-  FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
-  AddAttribute(FCommentAttri);
+  fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment);
+  AddAttribute(fCommentAttri);
 
-  FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
-  FIdentifierAttri.Style := [fsBold];
-  AddAttribute(FIdentifierAttri);
+  fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier);
+  fIdentifierAttri.Style := [fsBold];
+  AddAttribute(fIdentifierAttri);
 
-  FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
-  FKeyAttri.Style := [fsBold];
-  FKeyAttri.Foreground := $00ff0080;
-  AddAttribute(FKeyAttri);
+  fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord);
+  fKeyAttri.Style := [fsBold];
+  fKeyAttri.Foreground := $00ff0080;
+  AddAttribute(fKeyAttri);
 
-  FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
-  AddAttribute(FSpaceAttri);
+  fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace);
+  AddAttribute(fSpaceAttri);
 
-  FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
-  FSymbolAttri.Style := [fsBold];
-  AddAttribute(FSymbolAttri);
+  fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol);
+  fSymbolAttri.Style := [fsBold];
+  AddAttribute(fSymbolAttri);
 
-  FTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText);
-  AddAttribute(FTextAttri);
+  fTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText);
+  AddAttribute(fTextAttri);
 
-  FUndefKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrUnknownWord, SYNS_FriendlyAttrUnknownWord);
-  FUndefKeyAttri.Style := [fsBold];
-  FUndefKeyAttri.Foreground := clRed;
-  AddAttribute(FUndefKeyAttri);
+  fUndefKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrUnknownWord, SYNS_FriendlyAttrUnknownWord);
+  fUndefKeyAttri.Style := [fsBold];
+  fUndefKeyAttri.Foreground := clRed;
+  AddAttribute(fUndefKeyAttri);
 
-  FValueAttri := TSynHighlighterAttributes.Create(SYNS_AttrValue, SYNS_FriendlyAttrValue);
-  FValueAttri.Foreground := $00ff8000;
-  AddAttribute(FValueAttri);
+  fValueAttri := TSynHighlighterAttributes.Create(SYNS_AttrValue, SYNS_FriendlyAttrValue);
+  fValueAttri.Foreground := $00ff8000;
+  AddAttribute(fValueAttri);
 
-  FAndAttri := TSynHighlighterAttributes.Create(SYNS_AttrEscapeAmpersand, SYNS_FriendlyAttrEscapeAmpersand);
-  FAndAttri.Style := [fsBold];
-  FAndAttri.Foreground := $0000ff00;
-  AddAttribute(FAndAttri);
+  fAndAttri := TSynHighlighterAttributes.Create(SYNS_AttrEscapeAmpersand, SYNS_FriendlyAttrEscapeAmpersand);
+  fAndAttri.Style := [fsBold];
+  fAndAttri.Foreground := $0000ff00;
+  AddAttribute(fAndAttri);
   SetAttributesOnChange(DefHighlightChange);
 
   InitIdent;
-  FRange := rsText;
-  FDefaultFilter := SYNS_FilterHTML;
-  FAndCode := -1;
+  fRange := rsText;
+  fDefaultFilter := SYNS_FilterHTML;
+  fAndCode := -1;
+
+  fBrackets := '<>()[]{}';
 end;
 
 procedure TSynHTMLSyn.BraceCloseProc;
 begin
-  FRange := rsText;
-  FTokenID := tkSymbol;
+  fRange := rsText;
+  fTokenId := tkSymbol;
   Inc(Run);
 end;
 
 procedure TSynHTMLSyn.CommentProc;
 begin
-  FTokenID := tkComment;
+  fTokenID := tkComment;
 
   if IsLineEnd(Run) then
   begin
@@ -804,9 +801,9 @@ procedure TSynHTMLSyn.CommentProc;
 
   while not IsLineEnd(Run) do
   begin
-    if (FLine[Run] = '>') and (FLine[Run - 1] = '-') and (FLine[Run - 2] = '-') then
+    if (fLine[Run] = '>') and (fLine[Run - 1] = '-') and (fLine[Run - 2] = '-') then
     begin
-      FRange := rsText;
+      fRange := rsText;
       Inc(Run);
       Break;
     end;
@@ -817,68 +814,68 @@ procedure TSynHTMLSyn.CommentProc;
 procedure TSynHTMLSyn.BraceOpenProc;
 begin
   Inc(Run);
-  if (FLine[Run] = '!') and (FLine[Run + 1] = '-') and (FLine[Run + 2] = '-') then
+  if (fLine[Run] = '!') and (fLine[Run + 1] = '-') and (fLine[Run + 2] = '-') then
   begin
-    FRange := rsComment;
-    FTokenID := tkComment;
+    fRange := rsComment;
+    fTokenID := tkComment;
     Inc(Run, 3);
   end
   else
   begin
-    FRange := rsKey;
-    FTokenID := tkSymbol;
+    fRange := rsKey;
+    fTokenID := tkSymbol;
   end;
 end;
 
 procedure TSynHTMLSyn.CRProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
-  if FLine[Run] = #10 then Inc(Run);
+  if fLine[Run] = #10 then Inc(Run);
 end;
 
 procedure TSynHTMLSyn.EqualProc;
 begin
-  FRange := rsValue;
-  FTokenID := tkSymbol;
+  fRange := rsValue;
+  fTokenID := tkSymbol;
   Inc(Run);
 end;
 
 procedure TSynHTMLSyn.IdentProc;
 begin
-  case FRange of
+  case fRange of
   rsKey:
     begin
-      FRange := rsParam;
-      FTokenID := IdentKind((FLine + Run));
-      Inc(Run, FStringLen);
+      fRange := rsParam;
+      fTokenID := IdentKind((fLine + Run));
+      Inc(Run, fStringLen);
     end;
   rsValue:
     begin
-      FRange := rsParam;
-      FTokenID := tkValue;
+      fRange := rsParam;
+      fTokenID := tkValue;
       repeat
         Inc(Run);
-      until (FLine[Run] <= #32) or (FLine[Run] = '>');
+      until (fLine[Run] <= #32) or (fLine[Run] = '>');
     end;
   else
-    FTokenID := tkIdentifier;
+    fTokenID := tkIdentifier;
     repeat
       Inc(Run);
-    until (FLine[Run] <= #32) or (FLine[Run] = '=') or (FLine[Run] = '"') or
-      (FLine[Run] = '>');
+    until (fLine[Run] <= #32) or (fLine[Run] = '=') or (fLine[Run] = '"') or
+      (fLine[Run] = '>');
   end;
 end;
 
 procedure TSynHTMLSyn.LFProc;
 begin
-  FTokenID := tkSpace;
+  fTokenID := tkSpace;
   Inc(Run);
 end;
 
 procedure TSynHTMLSyn.NullProc;
 begin
-  FTokenID := tkNull;
+  fTokenID := tkNull;
   Inc(Run);
 end;
 
@@ -886,7 +883,7 @@ procedure TSynHTMLSyn.TextProc;
 
   function IsStopChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       #0..#31, '<', '&':
         Result := True;
       else
@@ -896,7 +893,7 @@ procedure TSynHTMLSyn.TextProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f':
         Result := True;
       else
@@ -907,48 +904,48 @@ procedure TSynHTMLSyn.TextProc;
 var
   i: Integer;
 begin
-  if CharInSet(FLine[Run], [#0..#31, '<']) then
+  if CharInSet(fLine[Run], [#0..#31, '<']) then
   begin
     NextProcedure;
     Exit;
   end;
 
-  FTokenID := tkText;
+  fTokenID := tkText;
 
   while True do
   begin
     while not IsStopChar do Inc(Run);
 
-    if (FLine[Run] = '&') then
+    if (fLine[Run] = '&') then
     begin
-      if (FLine[Run + 1] = '#') then
+      if (fLine[Run + 1] = '#') then
       begin
-        FAndCode := -1;
+        fAndCode := -1;
         i := Run;
         Inc(Run, 2);
-        if CharInSet(FLine[Run], ['X', 'x']) then
+        if CharInSet(fLine[Run], ['X', 'x']) then
         begin
           Inc(Run);
           while IsNumberChar do
             Inc(Run);
         end
         else
-          while CharInSet(FLine[Run], ['0'..'9']) do
+          while CharInSet(fLine[Run], ['0'..'9']) do
             Inc(Run);
-        if (FLine[Run] = ';') then
+        if (fLine[Run] = ';') then
         begin
           Inc(Run);
           Run := i;
-          FRange := rsAmpersand;
+          fRange := rsAmpersand;
         end;
         Break;
       end
       else
         for i := Low(EscapeAmps) To High(EscapeAmps) do
-          if (WStrLComp((FLine + Run), EscapeAmps[i], WStrLen(EscapeAmps[i])) = 0) then
+          if (AnsiStrLComp((fLine + Run), EscapeAmps[i], Length(EscapeAmps[i])) = 0) then
           begin
-            FAndCode := i;
-            FRange := rsAmpersand;
+            fAndCode := i;
+            fRange := rsAmpersand;
             Exit;
           end;
 
@@ -963,7 +960,7 @@ procedure TSynHTMLSyn.AmpersandProc;
 
   function IsNumberChar: Boolean;
   begin
-    case FLine[Run] of
+    case fLine[Run] of
       '0'..'9', 'A'..'F', 'a'..'f':
         Result := True;
       else
@@ -972,59 +969,58 @@ procedure TSynHTMLSyn.AmpersandProc;
   end;
 
 begin
-  if FRange <> rsAmpersand then
+  if fRange <> rsAmpersand then
   begin
-    if FRange = rsKey then
+    if fRange = rsKey then
     begin
       Inc(Run);
-      FRange := rsText;
-      FTokenID := tkText;
+      fRange := rsText;
+      fTokenID := tkText;
     end
     else
       IdentProc;
     Exit;
   end;
 
-  case FAndCode of
+  case fAndCode of
   Low(EscapeAmps)..High(EscapeAmps):
     begin
-      FTokenID := tkAmpersand;
-      Inc(Run, WStrLen(EscapeAmps[FAndCode]));
+      fTokenID := tkAmpersand;
+      Inc(Run, Length(EscapeAmps[fAndCode]));
     end;
     else begin
-      if (FLine[Run + 1] = '#') then
+      if (fLine[Run + 1] = '#') then
       begin
-        FAndCode := -1;
+        fAndCode := -1;
         Inc(Run, 2);
-        if CharInSet(FLine[Run], ['X', 'x']) then
+        if CharInSet(fLine[Run], ['X', 'x']) then
         begin
           Inc(Run);
           while IsNumberChar do
             Inc(Run);
         end
         else
-          while CharInSet(FLine[Run], ['0'..'9']) do
+          while CharInSet(fLine[Run], ['0'..'9']) do
             Inc(Run);
-        if (FLine[Run] = ';') then begin
+        if (fLine[Run] = ';') then begin
           Inc(Run);
-          FTokenID := tkAmpersand;
+          fTokenID := tkAmpersand;
         end else
-          FTokenID := tkText;
+          fTokenID := tkText;
       end;
     end;
   end;
-  FAndCode := -1;
-  FRange := rsText;
+  fAndCode := -1;
+  fRange := rsText;
 end;
 
 procedure TSynHTMLSyn.SpaceProc;
 begin
   Inc(Run);
-  FTokenID := tkSpace;
-  while FLine[Run] <= #32 do
+  fTokenID := tkSpace;
+  while fLine[Run] <= #32 do
   begin
-    if CharInSet(FLine[Run], [#0, #9, #10, #13]) then
-      Break;
+    if CharInSet(fLine[Run], [#0, #9, #10, #13]) then Break;
     Inc(Run);
   end;
 end;
@@ -1033,27 +1029,27 @@ procedure TSynHTMLSyn.StringProc;
 var
   iOpenChar: WideChar;
 begin
-  case FRange of
+  case fRange of
     rsQuoteValue:
       begin
         iOpenChar := #39;
-        FTokenID := tkValue;
+        fTokenID := tkValue;
       end;
     rsDoubleQuoteValue:
       begin
         iOpenChar := '"';
-        FTokenID := tkValue;
+        fTokenID := tkValue;
       end;
     else
     begin
-      iOpenChar := FLine[Run];
-      if FRange = rsValue then
+      iOpenChar := fLine[Run];
+      if fRange = rsValue then
       begin
         if iOpenChar = '"' then
-          FRange := rsDoubleQuoteValue
+          fRange := rsDoubleQuoteValue
         else
-          FRange := rsQuoteValue;
-        FTokenID := tkValue;
+          fRange := rsQuoteValue;
+        fTokenID := tkValue;
       end else
       begin
         IdentProc;
@@ -1065,13 +1061,13 @@ procedure TSynHTMLSyn.StringProc;
 
   while not IsLineEnd(Run) do
   begin
-    if FLine[Run] = iOpenChar then
+    if fLine[Run] = iOpenChar then
     begin
       Inc(Run);  { jumps over the closing char }
-      if FRange in [rsDoubleQuoteValue, rsQuoteValue] then
-        FRange := rsParam
+      if fRange in [rsDoubleQuoteValue, rsQuoteValue] then
+        fRange := rsParam
       else
-        FRange := rsText;
+        fRange := rsText;
       Break;
     end;
     Inc(Run);
@@ -1091,8 +1087,8 @@ function TSynHTMLSyn.IsIdentChar(AChar: WideChar): Boolean;
 
 procedure TSynHTMLSyn.Next;
 begin
-  FTokenPos := Run;
-  case FRange of
+  fTokenPos := Run;
+  case fRange of
     rsText:
       TextProc;
     rsComment:
@@ -1114,7 +1110,7 @@ procedure TSynHTMLSyn.Next;
 
 procedure TSynHTMLSyn.NextProcedure;
 begin
-  case FLine[Run] of
+  case fLine[Run] of
     #0: NullProc;
     #10: LFProc;
     #13: CRProc;
@@ -1131,11 +1127,11 @@ procedure TSynHTMLSyn.NextProcedure;
 function TSynHTMLSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes;
 begin
   case Index of
-    SYN_ATTR_COMMENT: Result := FCommentAttri;
-    SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri;
-    SYN_ATTR_KEYWORD: Result := FKeyAttri;
-    SYN_ATTR_WHITESPACE: Result := FSpaceAttri;
-    SYN_ATTR_SYMBOL: Result := FSymbolAttri;
+    SYN_ATTR_COMMENT: Result := fCommentAttri;
+    SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri;
+    SYN_ATTR_KEYWORD: Result := fKeyAttri;
+    SYN_ATTR_WHITESPACE: Result := fSpaceAttri;
+    SYN_ATTR_SYMBOL: Result := fSymbolAttri;
   else
     Result := nil;
   end;
@@ -1143,53 +1139,53 @@ function TSynHTMLSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribu
 
 function TSynHTMLSyn.GetEol: Boolean;
 begin
-  Result := Run = FLineLen + 1;
+  Result := Run = fLineLen + 1;
 end;
 
 function TSynHTMLSyn.GetTokenID: TtkTokenKind;
 begin
-  Result := FTokenID;
+  Result := fTokenId;
 end;
 
 function TSynHTMLSyn.GetTokenAttribute: TSynHighlighterAttributes;
 begin
-  case FTokenID of
-    tkAmpersand: Result := FAndAttri;
-    tkComment: Result := FCommentAttri;
-    tkIdentifier: Result := FIdentifierAttri;
-    tkKey: Result := FKeyAttri;
-    tkSpace: Result := FSpaceAttri;
-    tkSymbol: Result := FSymbolAttri;
-    tkText: Result := FTextAttri;
-    tkUndefKey: Result := FUndefKeyAttri;
-    tkValue: Result := FValueAttri;
+  case fTokenID of
+    tkAmpersand: Result := fAndAttri;
+    tkComment: Result := fCommentAttri;
+    tkIdentifier: Result := fIdentifierAttri;
+    tkKey: Result := fKeyAttri;
+    tkSpace: Result := fSpaceAttri;
+    tkSymbol: Result := fSymbolAttri;
+    tkText: Result := fTextAttri;
+    tkUndefKey: Result := fUndefKeyAttri;
+    tkValue: Result := fValueAttri;
     else Result := nil;
   end;
 end;
 
 function TSynHTMLSyn.GetTokenKind: Integer;
 begin
-  Result := Ord(FTokenID);
+  Result := Ord(fTokenId);
 end;
 
 function TSynHTMLSyn.GetRange: Pointer;
 begin
-  Result := Pointer(FRange);
+  Result := Pointer(fRange);
 end;
 
 procedure TSynHTMLSyn.SetRange(Value: Pointer);
 begin
-  FRange := TRangeState(Value);
+  fRange := TRangeState(Value);
 end;
 
 procedure TSynHTMLSyn.ResetRange;
 begin
-  FRange:= rsText;
+  fRange:= rsText;
 end;
 
 function TSynHTMLSyn.IsFilterStored: Boolean;
 begin
-  Result := FDefaultFilter <> SYNS_FilterHTML;
+  Result := fDefaultFilter <> SYNS_FilterHTML;
 end;
 
 class function TSynHTMLSyn.GetLanguageName: string;
@@ -1197,29 +1193,26 @@ class function TSynHTMLSyn.GetLanguageName: string;
   Result := SYNS_LangHTML;
 end;
 
-function TSynHTMLSyn.GetSampleSource: UnicodeString;
+function TSynHTMLSyn.GetSampleSource: string;
 begin
-  Result :=
-    ''#13#10 +
-    #13#10 +
-    ''#13#10 +
-    ''#13#10 +
-    '  
'#13#10 + - ' '#13#10 + - '
'#13#10 + - ' Sample HTML code © 2001'#13#10 + - ''#13#10 + - ''; + Result := ''#13#10 + + #13#10 + + ''#13#10 + + ''#13#10 + + '
'#13#10 + + ' '#13#10 + + '
'#13#10 + + ' Sample HTML code © 2001'#13#10 + + ''#13#10 + + ''; end; -class function TSynHTMLSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynHTMLSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangHTML; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynHTMLSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterIDL.pas b/Ext/SynEdit/Source/SynHighlighterIDL.pas index e2f1797..214725c 100644 --- a/Ext/SynEdit/Source/SynHighlighterIDL.pas +++ b/Ext/SynEdit/Source/SynHighlighterIDL.pas @@ -27,12 +27,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterIDL.pas,v 1.8.2.7 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -------------------------------------------------------------------------------} unit SynHighlighterIDL; @@ -63,7 +57,7 @@ interface tkSymbol, tkUnknown); - TRangeState = (rsUnknown, rsComment, rsString, rsChar); + TRangeState = (rsUnKnown, rsComment, rsString, rsChar); PIdentFuncTableFunc = ^TIdentFuncTableFunc; TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; @@ -71,18 +65,18 @@ interface type TSynIdlSyn = class(TSynCustomHighlighter) private - FRange: TRangeState; - FTokenID: TtkTokenKind; - FIdentFuncTable: array[0..100] of TIdentFuncTableFunc; - FCommentAttri: TSynHighlighterAttributes; - FDatatypeAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FPreprocessorAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; + fRange: TRangeState; + fTokenID: TtkTokenKind; + fIdentFuncTable: array[0..100] of TIdentFuncTableFunc; + fCommentAttri: TSynHighlighterAttributes; + fDatatypeAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fPreprocessorAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; function AltFunc(Index: Integer): TtkTokenKind; procedure IdentProc; procedure SymbolProc; @@ -151,12 +145,12 @@ TSynIdlSyn = class(TSynCustomHighlighter) procedure CharProc; procedure PreProcessorProc; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public constructor Create(AOwner: TComponent); override; class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; function GetRange: Pointer; override; procedure ResetRange; override; procedure SetRange(Value: Pointer); override; @@ -168,15 +162,15 @@ TSynIdlSyn = class(TSynCustomHighlighter) function IsIdentChar(AChar: WideChar): Boolean; override; procedure Next; override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; - property DatatypeAttri: TSynHighlighterAttributes read FDatatypeAttri write FDatatypeAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri; - property PreprocessorAttri: TSynHighlighterAttributes read FPreprocessorAttri write FPreprocessorAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; + property DatatypeAttri: TSynHighlighterAttributes read fDatatypeAttri write fDatatypeAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri; + property PreprocessorAttri: TSynHighlighterAttributes read fPreprocessorAttri write fPreprocessorAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri; end; implementation @@ -185,7 +179,7 @@ implementation SynEditStrConst; const - KeyWords: array[0..47] of UnicodeString = ( + KeyWords: array[0..47] of string = ( 'abstract', 'any', 'attribute', 'boolean', 'case', 'char', 'const', 'context', 'custom', 'default', 'double', 'enum', 'exception', 'factory', 'FALSE', 'fixed', 'float', 'in', 'inout', 'interface', 'local', 'long', @@ -214,7 +208,7 @@ function TSynIdlSyn.HashKey(Str: PWideChar): Cardinal; Inc(Str); end; Result := Result mod 101; - FStringLen := Str - FToIdent; + fStringLen := Str - fToIdent; end; {$Q+} @@ -222,10 +216,10 @@ function TSynIdlSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; @@ -234,58 +228,58 @@ procedure TSynIdlSyn.InitIdent; var i: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; - - FIdentFuncTable[51] := FuncAbstract; - FIdentFuncTable[41] := FuncAny; - FIdentFuncTable[82] := FuncAttribute; - FIdentFuncTable[74] := FuncBoolean; - FIdentFuncTable[67] := FuncCase; - FIdentFuncTable[0] := FuncChar; - FIdentFuncTable[43] := FuncConst; - FIdentFuncTable[3] := FuncContext; - FIdentFuncTable[46] := FuncCustom; - FIdentFuncTable[76] := FuncDefault; - FIdentFuncTable[71] := FuncDouble; - FIdentFuncTable[20] := FuncEnum; - FIdentFuncTable[66] := FuncException; - FIdentFuncTable[80] := FuncFactory; - FIdentFuncTable[45] := FuncFalse; - FIdentFuncTable[9] := FuncFixed; - FIdentFuncTable[84] := FuncFloat; - FIdentFuncTable[2] := FuncIn; - FIdentFuncTable[10] := FuncInout; - FIdentFuncTable[1] := FuncInterface; - FIdentFuncTable[39] := FuncLocal; - FIdentFuncTable[83] := FuncLong; - FIdentFuncTable[62] := FuncModule; - FIdentFuncTable[95] := FuncNative; - FIdentFuncTable[14] := FuncObject; - FIdentFuncTable[23] := FuncOctet; - FIdentFuncTable[38] := FuncOneway; - FIdentFuncTable[34] := FuncOut; - FIdentFuncTable[37] := FuncPrivate; - FIdentFuncTable[86] := FuncPublic; - FIdentFuncTable[79] := FuncRaises; - FIdentFuncTable[21] := FuncReadonly; - FIdentFuncTable[42] := FuncSequence; - FIdentFuncTable[24] := FuncShort; - FIdentFuncTable[78] := FuncString; - FIdentFuncTable[52] := FuncStruct; - FIdentFuncTable[31] := FuncSupports; - FIdentFuncTable[12] := FuncSwitch; - FIdentFuncTable[97] := FuncTrue; - FIdentFuncTable[28] := FuncTruncatable; - FIdentFuncTable[87] := FuncTypedef; - FIdentFuncTable[100] := FuncUnion; - FIdentFuncTable[27] := FuncUnsigned; - FIdentFuncTable[36] := FuncValuebase; - FIdentFuncTable[18] := FuncValuetype; - FIdentFuncTable[61] := FuncVoid; - FIdentFuncTable[32] := FuncWchar; - FIdentFuncTable[63] := FuncWstring; + fIdentFuncTable[i] := AltFunc; + + fIdentFuncTable[51] := FuncAbstract; + fIdentFuncTable[41] := FuncAny; + fIdentFuncTable[82] := FuncAttribute; + fIdentFuncTable[74] := FuncBoolean; + fIdentFuncTable[67] := FuncCase; + fIdentFuncTable[0] := FuncChar; + fIdentFuncTable[43] := FuncConst; + fIdentFuncTable[3] := FuncContext; + fIdentFuncTable[46] := FuncCustom; + fIdentFuncTable[76] := FuncDefault; + fIdentFuncTable[71] := FuncDouble; + fIdentFuncTable[20] := FuncEnum; + fIdentFuncTable[66] := FuncException; + fIdentFuncTable[80] := FuncFactory; + fIdentFuncTable[45] := FuncFalse; + fIdentFuncTable[9] := FuncFixed; + fIdentFuncTable[84] := FuncFloat; + fIdentFuncTable[2] := FuncIn; + fIdentFuncTable[10] := FuncInout; + fIdentFuncTable[1] := FuncInterface; + fIdentFuncTable[39] := FuncLocal; + fIdentFuncTable[83] := FuncLong; + fIdentFuncTable[62] := FuncModule; + fIdentFuncTable[95] := FuncNative; + fIdentFuncTable[14] := FuncObject; + fIdentFuncTable[23] := FuncOctet; + fIdentFuncTable[38] := FuncOneway; + fIdentFuncTable[34] := FuncOut; + fIdentFuncTable[37] := FuncPrivate; + fIdentFuncTable[86] := FuncPublic; + fIdentFuncTable[79] := FuncRaises; + fIdentFuncTable[21] := FuncReadonly; + fIdentFuncTable[42] := FuncSequence; + fIdentFuncTable[24] := FuncShort; + fIdentFuncTable[78] := FuncString; + fIdentFuncTable[52] := FuncStruct; + fIdentFuncTable[31] := FuncSupports; + fIdentFuncTable[12] := FuncSwitch; + fIdentFuncTable[97] := FuncTrue; + fIdentFuncTable[28] := FuncTruncatable; + fIdentFuncTable[87] := FuncTypedef; + fIdentFuncTable[100] := FuncUnion; + fIdentFuncTable[27] := FuncUnsigned; + fIdentFuncTable[36] := FuncValuebase; + fIdentFuncTable[18] := FuncValuetype; + fIdentFuncTable[61] := FuncVoid; + fIdentFuncTable[32] := FuncWchar; + fIdentFuncTable[63] := FuncWstring; end; function TSynIdlSyn.AltFunc(Index: Integer): TtkTokenKind; @@ -680,13 +674,13 @@ function TSynIdlSyn.FuncWstring(Index: Integer): TtkTokenKind; procedure TSynIdlSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynIdlSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -694,7 +688,7 @@ procedure TSynIdlSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', 'e', 'E': Result := True; else @@ -704,7 +698,7 @@ procedure TSynIdlSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of @@ -718,52 +712,52 @@ procedure TSynIdlSyn.NumberProc; procedure TSynIdlSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then + if fLine[Run] = #10 then Inc(Run); end; procedure TSynIdlSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynIdlSyn.CommentOpenProc; begin Inc(Run); - if (FLine[Run] = '*') then + if (fLine[Run] = '*') then begin - FRange := rsComment; + fRange := rsComment; CommentProc; - FTokenID := tkComment; + fTokenID := tkComment; end - else if (FLine[Run] = '/') then + else if (fLine[Run] = '/') then begin while not IsLineEnd(Run) do Inc(Run); - FTokenID := tkComment; + fTokenID := tkComment; end else - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynIdlSyn.CommentProc; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; else begin - FTokenID := tkComment; + fTokenID := tkComment; repeat - if (FLine[Run] = '*') and - (FLine[Run + 1] = '/') then + if (fLine[Run] = '*') and + (fLine[Run + 1] = '/') then begin Inc(Run, 2); - FRange := rsUnknown; + fRange := rsUnKnown; Break; end; if not IsLineEnd(Run) then @@ -776,22 +770,22 @@ procedure TSynIdlSyn.CommentProc; procedure TSynIdlSyn.StringOpenProc; begin Inc(Run); - FRange := rsString; + fRange := rsString; StringProc; - FTokenID := tkString; + fTokenID := tkString; end; procedure TSynIdlSyn.StringProc; begin - FTokenID := tkString; + fTokenID := tkString; repeat - if (FLine[Run] = '"') then + if (fLine[Run] = '"') then begin Inc(Run); - FRange := rsUnknown; + fRange := rsUnKnown; Break; end - else if (FLine[Run] = '\') then + else if (fLine[Run] = '\') then Inc(Run); if not IsLineEnd(Run) then Inc(Run); @@ -801,19 +795,19 @@ procedure TSynIdlSyn.StringProc; procedure TSynIdlSyn.CharOpenProc; begin Inc(Run); - FRange := rsChar; + fRange := rsChar; CharProc; - FTokenID := tkString; + fTokenID := tkString; end; procedure TSynIdlSyn.CharProc; begin - FTokenID := tkString; + fTokenID := tkString; repeat - if (FLine[Run] = '''') then + if (fLine[Run] = '''') then begin Inc(Run); - FRange := rsUnknown; + fRange := rsUnKnown; Break; end; if not IsLineEnd(Run) then @@ -825,7 +819,7 @@ procedure TSynIdlSyn.PreProcessorProc; function IsWhiteChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of #0, #9, #10, #13, #32: Result := True; else @@ -834,20 +828,20 @@ procedure TSynIdlSyn.PreProcessorProc; end; var - Directive: String; + Directive: string; begin Directive := ''; while not IsWhiteChar do begin - Directive := Directive + FLine[Run]; + Directive := Directive + fLine[Run]; Inc(Run); end; - if (WideCompareStr(Directive, '#include') = 0) then - FTokenID := tkPreprocessor - else if (WideCompareStr(Directive, '#pragma') = 0) then - FTokenID := tkPreprocessor + if (CompareStr(Directive, '#include') = 0) then + fTokenID := tkPreprocessor + else if (CompareStr(Directive, '#pragma') = 0) then + fTokenID := tkPreprocessor else - FTokenID := tkIdentifier; + fTokenID := tkIdentifier; end; { PreProcessorProc } @@ -855,78 +849,78 @@ constructor TSynIdlSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := True; + fCaseSensitive := True; - FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - FCommentAttri.Foreground := clNavy; - AddAttribute(FCommentAttri); + fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + fCommentAttri.Foreground := clNavy; + AddAttribute(fCommentAttri); - FDatatypeAttri := TSynHighLighterAttributes.Create(SYNS_AttrDatatype, SYNS_FriendlyAttrDatatype); - FDatatypeAttri.Style := [fsBold]; - FDatatypeAttri.Foreground := clTeal; - AddAttribute(FDatatypeAttri); + fDatatypeAttri := TSynHighLighterAttributes.Create(SYNS_AttrDatatype, SYNS_FriendlyAttrDatatype); + fDatatypeAttri.Style := [fsBold]; + fDatatypeAttri.Foreground := clTeal; + AddAttribute(fDatatypeAttri); - FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); + fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); - FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); + fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); - FNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - FNumberAttri.Foreground := clBlue; - AddAttribute(FNumberAttri); + fNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + fNumberAttri.Foreground := clBlue; + AddAttribute(fNumberAttri); - FPreprocessorAttri := TSynHighLighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); - FPreprocessorAttri.Foreground := clRed; - AddAttribute(FPreprocessorAttri); + fPreprocessorAttri := TSynHighLighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); + fPreprocessorAttri.Foreground := clRed; + AddAttribute(fPreprocessorAttri); - FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); + fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); - FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - FStringAttri.Foreground := clBlue; - AddAttribute(FStringAttri); + fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + fStringAttri.Foreground := clBlue; + AddAttribute(fStringAttri); - FSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); + fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FDefaultFilter := SYNS_FilterCORBAIDL; - FRange := rsUnknown; + fDefaultFilter := SYNS_FilterCORBAIDL; + fRange := rsUnknown; end; procedure TSynIdlSyn.IdentProc; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynIdlSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynIdlSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynIdlSyn.Next; begin - FTokenPos := Run; - case FRange of + fTokenPos := Run; + case fRange of rsComment: CommentProc; else begin - FRange := rsUnknown; - case FLine[Run] of + fRange := rsUnknown; + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; @@ -950,12 +944,12 @@ procedure TSynIdlSyn.Next; function TSynIdlSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -963,27 +957,27 @@ function TSynIdlSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttribut function TSynIdlSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynIdlSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynIdlSyn.GetTokenAttribute: TSynHighLighterAttributes; begin case GetTokenID of - tkComment: Result := FCommentAttri; - tkDatatype: Result := FDatatypeAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkPreprocessor: Result := FPreprocessorAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FIdentifierAttri; + tkComment: Result := fCommentAttri; + tkDatatype: Result := fDatatypeAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkPreprocessor: Result := fPreprocessorAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fIdentifierAttri; else Result := nil; end; @@ -991,10 +985,10 @@ function TSynIdlSyn.GetTokenAttribute: TSynHighLighterAttributes; function TSynIdlSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; -function TSynIdlSyn.GetSampleSource: UnicodeString; +function TSynIdlSyn.GetSampleSource: string; begin Result := '/* CORBA IDL sample source */'#13#10 + '#include '#13#10 + @@ -1011,7 +1005,7 @@ function TSynIdlSyn.GetSampleSource: UnicodeString; function TSynIdlSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterCORBAIDL; + Result := fDefaultFilter <> SYNS_FilterCORBAIDL; end; function TSynIdlSyn.IsIdentChar(AChar: WideChar): Boolean; @@ -1031,26 +1025,24 @@ class function TSynIdlSyn.GetLanguageName: string; procedure TSynIdlSyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; end; procedure TSynIdlSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; function TSynIdlSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; -class function TSynIdlSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynIdlSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangCORBAIDL; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynIdlSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterIni.pas b/Ext/SynEdit/Source/SynHighlighterIni.pas index 520a1fb..5e36087 100644 --- a/Ext/SynEdit/Source/SynHighlighterIni.pas +++ b/Ext/SynEdit/Source/SynHighlighterIni.pas @@ -27,20 +27,12 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterIni.pas,v 1.13.2.5 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { -@abstract(Provides an Ini-files highlighter for SynEdit) +@abstract(Provides an Ini and toml files highlighter for SynEdit) @author(Igor P. Zenkov, converted to SynEdit by Bruno Mikkelsen ) @created(1999-11-02, converted to SynEdit 2000-04-21) -@lastmod(2000-04-21) -The SynHighlighterIni unit provides SynEdit with an Ini-files highlighter. +The SynHighlighterIni unit provides SynEdit with and Ini and toml files highlighter. Thanks to Primoz Gabrijelcic, Martin Waldenburg and Michael Hieke. } @@ -51,28 +43,44 @@ interface uses - Graphics, + System.Classes, + System.RegularExpressions, + Vcl.Graphics, SynEditTypes, SynEditHighlighter, - SynUnicode, - Classes; + SynEditCodeFolding, + SynUnicode; type TtkTokenKind = (tkComment, tkText, tkSection, tkKey, tkNull, tkNumber, - tkSpace, tkString, tkSymbol, tkUnknown); + tkHex, tkFloat, tkOct, tkSpace, tkString, tkSymbol, tkKeyword, + tkTrippleQuotedString, tkUnknown); + + TIniHighlightType = (typeIni, typeToml); + + TRangeState = NativeUInt; +const + rsUnKnown = 0; + rsMultilineString = 1; + rsMultilineString2 = 2; + rsOpenBracketsBase = 1000; type - TSynIniSyn = class(TSynCustomHighlighter) + TSynIniSyn = class(TSynCustomCodeFoldingHighlighter) private FTokenID: TtkTokenKind; - FCommentAttri: TSynHighlighterAttributes; - FTextAttri: TSynHighlighterAttributes; - FSectionAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; + fRange: TRangeState; + FOpenSqBrackets: NativeUInt; + fCommentAttri: TSynHighlighterAttributes; + fTextAttri: TSynHighlighterAttributes; + fSectionAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fKeywordAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fIniHighlightType: TIniHighlightType; procedure SectionOpenProc; procedure KeyProc; procedure CRProc; @@ -81,16 +89,17 @@ TSynIniSyn = class(TSynCustomHighlighter) procedure LFProc; procedure NullProc; procedure NumberProc; - procedure SemiColonProc; + procedure CommentProc; procedure SpaceProc; procedure StringProc; // "" procedure StringProc1; // '' + procedure StringEndProc(EndChar: Char); protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; @@ -100,86 +109,155 @@ TSynIniSyn = class(TSynCustomHighlighter) function GetTokenAttribute: TSynHighlighterAttributes; override; function GetTokenKind: Integer; override; procedure Next; override; + function GetRange: Pointer; override; + procedure ResetRange; override; + procedure SetRange(Value: Pointer); override; + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; + procedure AdjustFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings); override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property TextAttri: TSynHighlighterAttributes read FTextAttri - write FTextAttri; - property SectionAttri: TSynHighlighterAttributes read FSectionAttri - write FSectionAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri - write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; + property IniHighlightType: TIniHighlightType read fIniHighlightType + write fIniHighlightType default typeIni; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property TextAttri: TSynHighlighterAttributes read fTextAttri + write fTextAttri; + property SectionAttri: TSynHighlighterAttributes read fSectionAttri + write fSectionAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri + write fKeyAttri; + property KeywordAttri: TSynHighlighterAttributes read fKeywordAttri + write fKeywordAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; end; implementation uses + System.SysUtils, SynEditStrConst; constructor TSynIniSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - FCommentAttri.Foreground := clGreen; - AddAttribute(FCommentAttri); - FTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText); - AddAttribute(FTextAttri); - FSectionAttri := TSynHighlighterAttributes.Create(SYNS_AttrSection, SYNS_FriendlyAttrSection); - FSectionAttri.Style := [fsBold]; - AddAttribute(FSectionAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); - AddAttribute(FKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + fCommentAttri.Foreground := clGreen; + AddAttribute(fCommentAttri); + fTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText); + AddAttribute(fTextAttri); + fSectionAttri := TSynHighlighterAttributes.Create(SYNS_AttrSection, SYNS_FriendlyAttrSection); + fSectionAttri.Style := [fsBold]; + AddAttribute(fSectionAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); + fKeyAttri.Foreground := clTeal; + AddAttribute(fKeyAttri); + fKeywordAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeywordAttri.Foreground := clBlue; + fKeywordAttri.Style := [fsBold]; + AddAttribute(fKeywordAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + fNumberAttri.Foreground := clBlue; + AddAttribute(fNumberAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + fStringAttri.Foreground := clPurple; + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + fSymbolAttri.Style := [fsBold]; + AddAttribute(fSymbolAttri); SetAttributesOnChange(DefHighlightChange); - FDefaultFilter := SYNS_FilterINI; -end; { Create } + fDefaultFilter := SYNS_FilterINI; +end; + +procedure TSynIniSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine, ToLine: Integer); +var + Line: Integer; + SLine: string; +begin + for Line := FromLine to ToLine do + begin + SLine := LinesToScan[Line]; + + if (SLine <> '') and + (GetHighlighterAttriAtRowCol(LinesToScan, Line, 1) = SectionAttri) + then + FoldRanges.StopStartFoldRange(Line + 1, 0) + else + FoldRanges.NoFoldInfo(Line + 1) + end; +end; + +{ Create } procedure TSynIniSyn.SectionOpenProc; begin // if it is not column 0 mark as tkText and get out of here if Run > 0 then begin - FTokenID := tkText; + if FIniHighlightType = typeToml then + begin + Inc(FOpenSqBrackets); + fTokenID := tkSymbol; + end + else + fTokenID := tkText; + Inc(Run); Exit; end; // this is column 0 ok it is a Section - FTokenID := tkSection; + fTokenID := tkSection; Inc(Run); + + if FLine[Run] = '[' then + begin + // table array + Inc(Run); + end; + while FLine[Run] <> #0 do case FLine[Run] of ']': begin Inc(Run); + if FLine[Run] = ']' then + begin + // table array + Inc(Run); + end; Break end; - #10, #13: - Break; + #10: Break; + #13: Break; else Inc(Run); end; end; +procedure TSynIniSyn.SetRange(Value: Pointer); +begin + fRange := TRangeState(Value); + if fRange > rsOpenBracketsBase then + FOpenSqBrackets := fRange - rsOpenBracketsBase + else + FOpenSqBrackets := 0; +end; + procedure TSynIniSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; case FLine[Run + 1] of #10: Inc(Run, 2); else Inc(Run); @@ -189,183 +267,614 @@ procedure TSynIniSyn.CRProc; procedure TSynIniSyn.EqualProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynIniSyn.KeyProc; begin - FTokenID := tkKey; + fTokenID := tkKey; Inc(Run); while FLine[Run] <> #0 do case FLine[Run] of - '=': - Break; - #10, #13: - Break; + '=': Break; + #10: Break; + #13: Break; else Inc(Run); end; end; procedure TSynIniSyn.TextProc; - function IsTextChar: Boolean; - begin - case fLine[Run] of - 'a'..'z', 'A'..'Z', '0'..'9': - Result := True; - else - Result := False; - end; - end; - begin - if Run = 0 then + if (Run = 0) and (FOpenSqBrackets <= 0) then KeyProc else begin - FTokenID := tkText; - Inc(Run); - while FLine[Run] <> #0 do - if IsTextChar then - Inc(Run) - else - Break; + if (fIniHighlightType = typeToml) and + CharInSet(fLine[Run], ['[', ']', '{', '}']) then + begin + if FLine[Run] = '[' then + Inc(FOpenSqBrackets) + else if FLine[Run] = ']' then + Dec(FOpenSqBrackets); + + fTokenID := tkSymbol; + Inc(Run); + end + else + begin + fTokenID := tkText; + Inc(Run); + while FLine[Run] <> #0 do + if IsIdentChar(FLine[Run]) then + Inc(Run) + else + Break; + + if (fIniHighlightType = typeToml) and + ((GetToken.ToLower = 'true') or + (GetToken.ToLower = 'false')) + then + fTokenId := tkKeyword; + end; end; end; procedure TSynIniSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynIniSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; procedure TSynIniSyn.NumberProc; - - function IsNumberChar: Boolean; +type + TNumberState = + ( + nsStart, + nsDotFound, + nsHex, + nsOct, + nsBinary, + nsExpFound + ); + +var + temp: WideChar; + State: TNumberState; + + function CheckSpecialCases: Boolean; + begin + case temp of + // Look for dot (.) + '.': begin + // .45 + if CharInSet(FLine[Run], ['0'..'9']) then + begin + Inc(Run); + fTokenID := tkFloat; + State := nsDotFound; + // Non-number dot + end else begin + fTokenID := tkText; + Result := False; + Exit; + end; // if + end; // DOT + + '+', '-': begin + if not CharInSet(FLine[Run], ['.', '0'..'9']) then + begin + fTokenID := tkText; + Result := False; + Exit; + end; // if + end; // DOT + + // Look for zero (0) + '0': begin + temp := FLine[Run]; + // 0x123ABC + if CharInSet(temp, ['x', 'X']) then begin + Inc (Run); + fTokenID := tkHex; + State := nsHex; + // 0o123 + end else if CharInSet(temp, ['o', 'O']) then begin + Inc (Run); + fTokenID := tkOct; + State := nsOct; + // 0.45 + end else if CharInSet(temp, ['b', 'B']) then begin + Inc (Run); + fTokenID := tkOct; + State := nsBinary; + // 0.45 + end else if temp = '.' then begin + Inc (Run); + State := nsDotFound; + fTokenID := tkFloat; + end; // if + end; // ZERO + end; // case + + Result := True; + end; // CheckSpecialCases + + function HandleBadNumber: Boolean; + begin + Result := False; + fTokenID := tkUnknown; + // Ignore all tokens till end of "number" + while IsIdentChar(FLine[Run]) or (FLine[Run] = '.') do + Inc (Run); + end; // HandleBadNumber + + function HandleExponent: Boolean; + begin + State := nsExpFound; + fTokenID := tkFloat; + // Skip e[+/-] + if CharInSet(FLine[Run+1], ['+', '-']) then + Inc (Run); + // Invalid token : 1.0e + if not CharInSet(FLine[Run+1], ['0'..'9']) then begin + Inc (Run); + Result := HandleBadNumber; + Exit; + end; // if + + Result := True; + end; // HandleExponent + + function CheckStart: Boolean; begin - case fLine[Run] of - '0'..'9', '.', 'e', 'E': - Result := True; + // Allow underscores inside the number + if temp = '_' then begin + if CharInSet(FLine[Run + 1], ['0'..'9']) then + Result := True else - Result := False; - end; - end; - - function IsAlphaChar: Boolean; + Result := HandleBadNumber; + // 1234 + end else if CharInSet(temp, ['0'..'9']) then begin + Result := True; + //123e4 + end else if CharInSet(temp, ['e', 'E']) then begin + Result := HandleExponent; + // 123.45j + end else if CharInSet(temp, ['j', 'J']) then begin + Inc (Run); + fTokenID := tkFloat; + Result := False; + // 123.45 + end else if temp = '.' then begin + State := nsDotFound; + fTokenID := tkFloat; + Result := True; + // Error! + end else if IsIdentChar(temp) then begin + Result := HandleBadNumber; + // End of number + end else begin + Result := False; + end; // if + end; // CheckStart + + function CheckDotFound: Boolean; begin - case fLine[Run] of - 'a'..'z', 'A'..'Z': - Result := True; + // Allow underscores inside the number + if temp = '_' then begin + if CharInSet(FLine[Run - 1], ['0'..'9']) and + CharInSet(FLine[Run + 1], ['0'..'9']) + then + Result := True else - Result := False; - end; - end; + Result := HandleBadNumber; + // 1.0e4 + end else if CharInSet(temp, ['e', 'E']) then begin + Result := HandleExponent; + // 123.45 + end else if CharInSet(temp, ['0'..'9']) then begin + Result := True; + // 123.45j + end else if CharInSet(temp, ['j', 'J']) then begin + Inc (Run); + Result := False; + // 123.45.45: Error! + end else if temp = '.' then begin + Result := False; + HandleBadNumber; + // Error! + end else if IsIdentChar(temp) then begin + Result := HandleBadNumber; + // End of number + end else begin + Result := False; + end; // if + end; // CheckDotFound + + function CheckSpecialInt(ValidChars: TSysCharSet): Boolean; + begin + // Allow underscores inside the number + if temp = '_' then begin + if CharInSet(FLine[Run - 1], ValidChars) and + CharInSet(FLine[Run + 1], ValidChars) + then + Result := True + else + Result := HandleBadNumber; + end else if CharInSet(temp, ValidChars) then + begin + Result := True; + end else if CharInSet(temp, ['l', 'L']) then begin + Inc (Run); + Result := False; + end else if temp = '.' then begin + Result := False; + HandleBadNumber; + end else if IsIdentChar(temp) then begin + Result := HandleBadNumber; + end else begin + Result := False; + end; // if + end; // CheckHex + + function CheckExpFound: Boolean; + begin + // Allow underscores inside the number + if temp = '_' then begin + if CharInSet(FLine[Run - 1], ['0'..'9']) and + CharInSet(FLine[Run + 1], ['0'..'9']) + then + Result := True + else + Result := HandleBadNumber; + // 1e+123 + end else if CharInSet(temp, ['0'..'9']) then begin + Result := True; + // 1e+123j + end else if CharInSet(temp, ['j', 'J']) then begin + Inc (Run); + Result := False; + // 1e4.5: Error! + end else if temp = '.' then begin + Result := False; + HandleBadNumber; + // Error! + end else if IsIdentChar(temp) then begin + Result := HandleBadNumber; + // End of number + end else begin + Result := False; + end; // if + end; // CheckExpFound begin - if Run = 0 then - KeyProc - else - begin - Inc(Run); - FTokenID := tkNumber; - while IsNumberChar do Inc(Run); - if IsAlphaChar then TextProc; - end; + State := nsStart; + fTokenID := tkNumber; + + temp := FLine[Run]; + Inc (Run); + + // Special cases + if not CheckSpecialCases then + Exit; + + // Use a state machine to parse numbers + while True do begin + temp := FLine[Run]; + + case State of + nsStart: + if not CheckStart then Exit; + nsDotFound: + if not CheckDotFound then Exit; + nsHex: + if not CheckSpecialInt(['a'..'f', 'A'..'F', '0'..'9']) then Exit; + nsOct: + if not CheckSpecialInt(['0'..'7']) then Exit; + nsBinary: + if not CheckSpecialInt(['0'..'1']) then Exit; + nsExpFound: + if not CheckExpFound then Exit; + end; // case + + Inc (Run); + end; // while end; -// ; -procedure TSynIniSyn.SemiColonProc; +procedure TSynIniSyn.ResetRange; begin - // if it is not column 0 mark as tkText and get out of here - if Run > 0 then - begin - FTokenID := tkText; - Inc(Run); - Exit; - end; + fRange := rsUnknown; +end; + +procedure TSynIniSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings); +var + I, J: Integer; +begin + // Last section + if FoldRanges.Count > 0 then + FoldRanges.Ranges.List[FoldRanges.Count - 1].ToLine := LinesToScan.Count; + + // Remove empty lines at the bottom + for I := 0 to FoldRanges.Count - 1 do + with FoldRanges.Ranges.List[I] do + for J := ToLine downto FromLine + 1 do + if LinesToScan[J - 1] = '' then + Dec(ToLine) + else + Break; +end; - // this is column 0 ok it is a comment - FTokenID := tkComment; +// ; +procedure TSynIniSyn.CommentProc; +begin + fTokenID := tkComment; Inc(Run); while FLine[Run] <> #0 do case FLine[Run] of - #10, #13: - Break; - else - Inc(Run); + #10: Break; + #13: Break; + else Inc(Run); end; end; procedure TSynIniSyn.SpaceProc; begin - Inc(Run); - FTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); + if (Run = 0) and (FOpenSqBrackets <= 0) then + KeyProc + else + begin + Inc(Run); + fTokenID := tkSpace; + while IsWhiteChar(FLine[Run]) and not IsLineEnd(Run) do Inc(Run); + end; +end; + +procedure TSynIniSyn.StringEndProc(EndChar: Char); +var + fBackslashCount: Integer; +begin + fTokenID := tkTrippleQuotedString; + + case FLine[Run] of + #0: + begin + NullProc; + EXIT; + end; + #10: + begin + LFProc; + EXIT; + end; + #13: + begin + CRProc; + EXIT; + end; + end; + + repeat + if FLine[Run] = '\' then + begin + if FLine[Run + 1] = EndChar then + begin + fBackslashCount := 1; + + while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do + fBackslashCount := fBackslashCount + 1; + + if (fBackslashCount mod 2 = 1) then Inc(Run, 2); + end; + end;// if FLine[Run]... + if (FLine[Run]=EndChar) and (FLine[Run+1]=EndChar) and (FLine[Run+2]=EndChar) then begin + Inc(Run,3); + fRange:=rsUnknown; + EXIT; + end; + Inc(Run); + until IsLineEnd(Run); end; // "" procedure TSynIniSyn.StringProc; +var + fBackslashCount: Integer; begin - FTokenID := tkString; - if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2); + if Run = 0 then + begin + KeyProc; + Exit; + end; + + fTokenID := tkString; + if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then begin + fTokenID := tkTrippleQuotedString; + Inc(Run, 3); + + fRange:=rsMultilineString; + while fLine[Run] <> #0 do begin + case fLine[Run] of + + '\': begin + { If we're looking at a backslash, and the following character is an + end quote, and it's preceeded by an odd number of backslashes, then + it shouldn't mark the end of the string. If it's preceeded by an + even number, then it should. !!!THIS RULE DOESNT APPLY IN RAW STRINGS} + if FLine[Run + 1] = #39 then + begin + fBackslashCount := 1; + + while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do + fBackslashCount := fBackslashCount + 1; + + if (fBackslashCount mod 2 = 1) then Inc(Run) + end; + Inc(Run); + end;// '\': + + #39: + if (fLine[Run + 1] = #39) and (fLine[Run + 2] = #39) then begin + fRange := rsUnKnown; + Inc(Run, 3); + EXIT; + end else + Inc(Run); + #10: EXIT; + #13: EXIT; + else + Inc(Run); + end; + end; + end + else //if short string repeat case FLine[Run] of - #0, #10, #13: - Break; - end; - Inc(Run); - until FLine[Run] = #34; + #0, #10, #13: Break; + + {The same backslash stuff above...} + '\':begin + if FLine[Run + 1] = #39 then + begin + fBackslashCount := 1; + + while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do + fBackslashCount := fBackslashCount + 1; + + if (fBackslashCount mod 2 = 1) then Inc(Run) + end; + Inc(Run); + end;// '\': + + else Inc(Run); + end; //case + until (FLine[Run] = #39); if FLine[Run] <> #0 then Inc(Run); end; // '' procedure TSynIniSyn.StringProc1; +var + fBackslashCount: Integer; begin - FTokenID := tkString; - if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then Inc(Run, 2); + if Run = 0 then + begin + KeyProc; + Exit; + end; + + fTokenID := tkString; + if (FLine[Run + 1] = '"') and (FLine[Run + 2] = '"') then + begin + fTokenID := tkTrippleQuotedString; + Inc(Run, 3); + + fRange := rsMultilineString2; + while fLine[Run] <> #0 do + begin + case fLine[Run] of + + '\':begin + { If we're looking at a backslash, and the following character is an + end quote, and it's preceeded by an odd number of backslashes, then + it shouldn't mark the end of the string. If it's preceeded by an + even number, then it should. !!!THIS RULE DOESNT APPLY IN RAW STRINGS} + if FLine[Run + 1] = '"' then + begin + fBackslashCount := 1; + + while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do + fBackslashCount := fBackslashCount + 1; + + if (fBackslashCount mod 2 = 1) then Inc(Run) + end; + Inc(Run); + end;// '\': + + '"': + if (fLine[Run + 1] = '"') and (fLine[Run + 2] = '"') then begin + fRange := rsUnKnown; + Inc(Run, 3); + Exit; + end else + Inc(Run); + #10: Exit; + #13: Exit; + else + Inc(Run); + end; + end; + end + else //if short string repeat case FLine[Run] of - #0, #10, #13: - Break; - end; - Inc(Run); - until FLine[Run] = #39; + #0, #10, #13: Break; + {The same backslash stuff above...} + '\':begin + if FLine[Run + 1] = '"' then + begin + fBackslashCount := 1; + + while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do + fBackslashCount := fBackslashCount + 1; + + if (fBackslashCount mod 2 = 1) then Inc(Run) + end; + Inc(Run); + end;// '\': + + else Inc(Run); + end; //case + until (FLine[Run] = '"'); if FLine[Run] <> #0 then Inc(Run); end; procedure TSynIniSyn.Next; begin - FTokenPos := Run; - case fLine[Run] of - #0: NullProc; - #10: LFProc; - #13: CRProc; - #34: StringProc; - #39: StringProc1; - '0'..'9': NumberProc; - #59: SemiColonProc; - #61: EqualProc; - #91: SectionOpenProc; - #1..#9, #11, #12, #14..#32: SpaceProc; - else TextProc; + fTokenPos := Run; + + case fRange of + rsMultilineString: + StringEndProc(#39); + rsMultilineString2: + StringEndProc('"'); + else + case fLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + '''': StringProc; + '"': StringProc1; + '+', '-', '.', '0'..'9': NumberProc; + ';', '#': CommentProc; + '=' : EqualProc; + '[': SectionOpenProc; + else + if IsWhiteChar(fLine[Run]) then + SpaceProc + else + TextProc; + end; end; + inherited; end; function TSynIniSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_KEYWORD: Result := fKeywordAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -373,38 +882,43 @@ function TSynIniSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribut function TSynIniSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynIniSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynIniSyn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkComment: Result := FCommentAttri; - tkText: Result := FTextAttri; - tkSection: Result := FSectionAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FTextAttri; + case fTokenID of + tkComment: Result := fCommentAttri; + tkText: Result := fTextAttri; + tkSection: Result := fSectionAttri; + tkKey: Result := fKeyAttri; + tkKeyword: Result := fKeywordAttri; + tkNumber, + tkHex, + tkFloat, + tkOct: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fTextAttri; + tkTrippleQuotedString: Result := fStringAttri; else Result := nil; end; end; function TSynIniSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; function TSynIniSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterINI; + Result := fDefaultFilter <> SYNS_FilterINI; end; class function TSynIniSyn.GetLanguageName: string; @@ -412,23 +926,28 @@ class function TSynIniSyn.GetLanguageName: string; Result := SYNS_LangINI; end; -function TSynIniSyn.GetSampleSource: UnicodeString; +function TSynIniSyn.GetRange: Pointer; +begin + if FOpenSqBrackets > 0 then + Result := Pointer(rsOpenBracketsBase + FOpenSqBrackets) + else + Result := Pointer(fRange); +end; + +function TSynIniSyn.GetSampleSource: string; begin - Result := - '; Syntax highlighting'#13#10+ - '[Section]'#13#10+ - 'Key=value'#13#10+ - 'String="Arial"'#13#10+ - 'Number=123456'; + Result := '; Syntax highlighting'#13#10+ + '[Section]'#13#10+ + 'Key=value'#13#10+ + 'String="Arial"'#13#10+ + 'Number=123456'; end; -class function TSynIniSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynIniSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangINI; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynIniSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterInno.pas b/Ext/SynEdit/Source/SynHighlighterInno.pas index 7b7ba4d..a68ad86 100644 --- a/Ext/SynEdit/Source/SynHighlighterInno.pas +++ b/Ext/SynEdit/Source/SynHighlighterInno.pas @@ -25,13 +25,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterInno.pas,v 1.22.2.9 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides an Inno script file highlighter for SynEdit) @@ -50,13 +43,13 @@ interface uses - Graphics, + System.SysUtils, + System.Classes, + System.Generics.Defaults, + System.Generics.Collections, + Vcl.Graphics, SynEditTypes, - SynEditHighlighter, - SynHighlighterHashEntries, - SynUnicode, - SysUtils, - Classes; + SynEditHighlighter; type TtkTokenKind = (tkComment, tkConstant, tkIdentifier, tkKey, tkKeyOrParameter, @@ -65,20 +58,19 @@ interface TSynInnoSyn = class(TSynCustomHighlighter) private - FTokenID: TtkTokenKind; - FConstantAttri: TSynHighlighterAttributes; - FCommentAttri: TSynHighlighterAttributes; - FSectionAttri: TSynHighlighterAttributes; - FParamAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FInvalidAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FKeywords: TSynHashEntryList; - function HashKey(Str: PWideChar): Integer; + fTokenID: TtkTokenKind; + fConstantAttri: TSynHighlighterAttributes; + fCommentAttri: TSynHighlighterAttributes; + fSectionAttri: TSynHighlighterAttributes; + fParamAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fInvalidAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + FKeywords: TDictionary; function IdentKind(MayBe: PWideChar): TtkTokenKind; procedure SymbolProc; procedure CRProc; @@ -93,13 +85,14 @@ TSynInnoSyn = class(TSynCustomHighlighter) procedure SemiColonProc; procedure StringProc; procedure UnknownProc; - procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); + procedure DoAddKeyword(AKeyword: string; AKind: Integer); protected - function IsCurrentToken(const Token: UnicodeString): Boolean; override; + function GetSampleSource: string; override; + function IsCurrentToken(const Token: string): Boolean; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -111,32 +104,33 @@ TSynInnoSyn = class(TSynCustomHighlighter) function GetTokenKind: Integer; override; procedure Next; override; published - property ConstantAttri: TSynHighlighterAttributes read FConstantAttri - write FConstantAttri; - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri - write FInvalidAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property ParameterAttri: TSynHighlighterAttributes read FParamAttri - write FParamAttri; - property SectionAttri: TSynHighlighterAttributes read FSectionAttri - write FSectionAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; + property ConstantAttri: TSynHighlighterAttributes read fConstantAttri + write fConstantAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri + write fInvalidAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property ParameterAttri: TSynHighlighterAttributes read fParamAttri + write fParamAttri; + property SectionAttri: TSynHighlighterAttributes read fSectionAttri + write fSectionAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; end; implementation uses + SynEditMiscProcs, SynEditStrConst; const @@ -146,7 +140,7 @@ implementation {Ref: Keywords and Parameters are updated as they last appeared in Inno Setup / ISX version 1.3.26} - Keywords: UnicodeString = + Keywords: string = 'adminprivilegesrequired,allownoicons,allowrootdirectory,allowuncpath,' + 'alwayscreateuninstallicon,alwaysrestart,alwaysshowcomponentslist,' + 'alwaysshowdironreadypage,alwaysshowgrouponreadypage,' + @@ -174,7 +168,7 @@ implementation 'windowvisible,wizardimagebackcolor,wizardimagefile,wizardsmallimagefile,' + 'wizardstyle,workingdir'; - Parameters: UnicodeString = + Parameters: string = 'hkcc,hkcr,hkcu,hklm,hku,alwaysoverwrite,alwaysskipifsameorolder,append,' + 'binary,classic,closeonexit,comparetimestampalso,confirmoverwrite,' + 'createkeyifdoesntexist,createonlyiffileexists,createvalueifdoesntexist,' + @@ -191,68 +185,35 @@ implementation 'uninsdeletesection,uninsdeletesectionifempty,uninsdeletevalue,' + 'uninsneveruninstall,useapppaths,verysilent,waituntilidle'; - KeyOrParameter: UnicodeString = 'string'; - -function TSynInnoSyn.HashKey(Str: PWideChar): Integer; - - function GetOrd: Integer; - begin - case Str^ of - '_': Result := 1; - 'a'..'z': Result := 2 + Ord(Str^) - Ord('a'); - 'A'..'Z': Result := 2 + Ord(Str^) - Ord('A'); - else Result := 0; - end; - end; - -begin - Result := 0; - while IsIdentChar(Str^) do - begin -{$IFOPT Q-} - Result := 7 * Result + GetOrd; -{$ELSE} - Result := (7 * Result + GetOrd) and $FFFFFF; -{$ENDIF} - Inc(Str); - end; - Result := Result and $1FF; // 511 - FStringLen := Str - FToIdent; -end; + KeyOrParameter: string = 'string'; function TSynInnoSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var - Entry: TSynHashEntry; + S: string; begin - FToIdent := MayBe; - Entry := FKeywords[HashKey(MayBe)]; - while Assigned(Entry) do - begin - if Entry.KeywordLen > FStringLen then - Break - else if Entry.KeywordLen = FStringLen then - if IsCurrentToken(Entry.Keyword) then - begin - Result := TtkTokenKind(Entry.Kind); - Exit; - end; - Entry := Entry.Next; - end; - Result := tkIdentifier; + fToIdent := MayBe; + while IsIdentChar(MayBe^) do + Inc(Maybe); + fStringLen := Maybe - fToIdent; + SetString(S, fToIdent, fStringLen); + if FKeywords.ContainsKey(S) then + Result := FKeywords[S] + else + Result := tkIdentifier; end; -function TSynInnoSyn.IsCurrentToken(const Token: UnicodeString): Boolean; +function TSynInnoSyn.IsCurrentToken(const Token: string): Boolean; var I: Integer; Temp: PWideChar; begin - Temp := FToIdent; - if Length(Token) = FStringLen then + Temp := fToIdent; + if Length(Token) = fStringLen then begin Result := True; - for i := 1 to FStringLen do + for i := 1 to fStringLen do begin - if SynWideLowerCase(Temp^)[1] <> SynWideLowerCase(Token[i])[1] then + if AnsiLowerCase(Temp^)[1] <> AnsiLowerCase(Token[i])[1] then begin Result := False; Break; @@ -267,81 +228,82 @@ function TSynInnoSyn.IsCurrentToken(const Token: UnicodeString): Boolean; constructor TSynInnoSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := False; + fCaseSensitive := False; - FKeywords := TSynHashEntryList.Create; + // Create the keywords dictionary case-insensitive + FKeywords := TDictionary.Create(TIStringComparer.Ordinal); - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - FCommentAttri.Foreground := clGray; - AddAttribute(FCommentAttri); + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + fCommentAttri.Foreground := clGray; + AddAttribute(fCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); - FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar); - AddAttribute(FInvalidAttri); + fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar); + AddAttribute(fInvalidAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - FKeyAttri.Foreground := clNavy; - AddAttribute(FKeyAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + fKeyAttri.Foreground := clNavy; + AddAttribute(fKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - FNumberAttri.Foreground := clMaroon; - AddAttribute(FNumberAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + fNumberAttri.Foreground := clMaroon; + AddAttribute(fNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - FStringAttri.Foreground := clBlue; - AddAttribute(FStringAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + fStringAttri.Foreground := clBlue; + AddAttribute(fStringAttri); - FConstantAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective); - FConstantAttri.Style := [fsBold, fsItalic]; - FConstantAttri.Foreground := clTeal; - AddAttribute(FConstantAttri); + fConstantAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective); + fConstantAttri.Style := [fsBold, fsItalic]; + fConstantAttri.Foreground := clTeal; + AddAttribute(fConstantAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); //Parameters - FParamAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); - FParamAttri.Style := [fsBold]; - FParamAttri.Foreground := clOlive; - AddAttribute(FParamAttri); + fParamAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); + fParamAttri.Style := [fsBold]; + fParamAttri.Foreground := clOlive; + AddAttribute(fParamAttri); - FSectionAttri := TSynHighlighterAttributes.Create(SYNS_AttrSection, SYNS_FriendlyAttrSection); - FSectionAttri.Style := [fsBold]; - FSectionAttri.Foreground := clRed; - AddAttribute(FSectionAttri); + fSectionAttri := TSynHighlighterAttributes.Create(SYNS_AttrSection, SYNS_FriendlyAttrSection); + fSectionAttri.Style := [fsBold]; + fSectionAttri.Foreground := clRed; + AddAttribute(fSectionAttri); SetAttributesOnChange(DefHighlightChange); EnumerateKeywords(Ord(tkKey), Keywords, IsIdentChar, DoAddKeyword); EnumerateKeywords(Ord(tkParameter), Parameters, IsIdentChar, DoAddKeyword); EnumerateKeywords(Ord(tkKeyOrParameter), KeyOrParameter, IsIdentChar, DoAddKeyword); - FDefaultFilter := SYNS_FilterInno; + fDefaultFilter := SYNS_FilterInno; end; destructor TSynInnoSyn.Destroy; begin - FKeywords.Free; + fKeywords.Free; inherited Destroy; end; procedure TSynInnoSyn.SymbolProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); end; procedure TSynInnoSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then Inc(Run); + if fLine[Run] = #10 then Inc(Run); end; procedure TSynInnoSyn.EqualProc; @@ -349,10 +311,10 @@ procedure TSynInnoSyn.EqualProc; // If any word has equal (=) symbol, // then the immediately followed text is treated as string // (though it does not have quotes) - FTokenID := tkString; + fTokenID := tkString; repeat Inc(Run); - if FLine[Run] = ';' then + if fLine[Run] = ';' then begin Inc(Run); Break; @@ -364,17 +326,17 @@ procedure TSynInnoSyn.IdentProc; var LookAhead: Integer; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - if FTokenID = tkKeyOrParameter then + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + if fTokenID = tkKeyOrParameter then begin LookAhead := Run; - while CharInSet(FLine[LookAhead], [#9, ' ']) do + while CharInSet(fLine[LookAhead], [#9, ' ']) do Inc(LookAhead); - if FLine[LookAhead] = ':' then - FTokenID := tkKey + if fLine[LookAhead] = ':' then + fTokenID := tkKey else - FTokenID := tkParameter; + fTokenID := tkParameter; end; end; @@ -383,16 +345,16 @@ procedure TSynInnoSyn.SectionProc; // if it is not column 0 mark as tkParameter and get out of here if Run > 0 then begin - FTokenID := tkUnknown; + fTokenID := tkUnknown; Inc(Run); Exit; end; // this is column 0 ok it is a Section - FTokenID := tkSection; + fTokenID := tkSection; repeat Inc(Run); - if FLine[Run] = ']' then + if fLine[Run] = ']' then begin Inc(Run); Break; @@ -402,22 +364,22 @@ procedure TSynInnoSyn.SectionProc; procedure TSynInnoSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynInnoSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; procedure TSynInnoSyn.NumberProc; begin - FTokenID := tkNumber; + fTokenID := tkNumber; repeat Inc(Run); - until not CharInSet(FLine[Run], ['0'..'9']); + until not CharInSet(fLine[Run], ['0'..'9']); end; procedure TSynInnoSyn.ConstantProc; @@ -426,19 +388,19 @@ procedure TSynInnoSyn.ConstantProc; begin { Much of this is based on code from the SkipPastConst function in IS's CmnFunc2 unit. [jr] } - if FLine[Run + 1] = '{' then + if fLine[Run + 1] = '{' then begin { '{{' is not a constant } - FTokenID := tkUnknown; + fTokenID := tkUnknown; Inc(Run, 2); Exit; end; - FTokenID := tkConstant; + fTokenID := tkConstant; BraceLevel := 1; LastOpenBrace := Low(Integer); repeat Inc(Run); - case FLine[Run] of + case fLine[Run] of '{': begin if LastOpenBrace <> Run - 1 then begin @@ -463,10 +425,10 @@ procedure TSynInnoSyn.ConstantProc; procedure TSynInnoSyn.SpaceProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; repeat Inc(Run); - until (FLine[Run] > #32) or IsLineEnd(Run); + until (fLine[Run] > #32) or IsLineEnd(Run); end; procedure TSynInnoSyn.SemiColonProc; @@ -474,14 +436,14 @@ procedure TSynInnoSyn.SemiColonProc; I: Integer; begin for I := Run-1 downto 0 do - if FLine[I] > ' ' then begin + if fLine[I] > ' ' then begin // If the semicolon is not the first non-whitespace character on the // line, then it isn't the start of a comment. - FTokenID := tkUnknown; + fTokenID := tkUnknown; Inc(Run); Exit; end; - FTokenID := tkComment; + fTokenID := tkComment; repeat Inc(Run); until IsLineEnd(Run); @@ -489,12 +451,12 @@ procedure TSynInnoSyn.SemiColonProc; procedure TSynInnoSyn.StringProc; begin - FTokenID := tkString; + fTokenID := tkString; repeat Inc(Run); - if FLine[Run] = '"' then begin + if fLine[Run] = '"' then begin Inc(Run); - if FLine[Run] <> '"' then // embedded "" does not end the string + if fLine[Run] <> '"' then // embedded "" does not end the string Break; end; until IsLineEnd(Run); @@ -503,13 +465,13 @@ procedure TSynInnoSyn.StringProc; procedure TSynInnoSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynInnoSyn.Next; begin - FTokenPos := Run; - case FLine[Run] of + fTokenPos := Run; + case fLine[Run] of #13: CRProc; 'A'..'Z', 'a'..'z', '_': IdentProc; #10: LFProc; @@ -531,12 +493,12 @@ function TSynInnoSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -544,23 +506,23 @@ function TSynInnoSyn.GetDefaultAttribute(Index: Integer): function TSynInnoSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynInnoSyn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkComment: Result := FCommentAttri; - tkParameter: Result := FParamAttri; - tkSection: Result := FSectionAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkConstant: Result := FConstantAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FIdentifierAttri; + case fTokenID of + tkComment: Result := fCommentAttri; + tkParameter: Result := fParamAttri; + tkSection: Result := fSectionAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkConstant: Result := fConstantAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fIdentifierAttri; else Result := nil; end; @@ -568,17 +530,17 @@ function TSynInnoSyn.GetTokenAttribute: TSynHighlighterAttributes; function TSynInnoSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; function TSynInnoSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynInnoSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterInno; + Result := fDefaultFilter <> SYNS_FilterInno; end; class function TSynInnoSyn.GetLanguageName: string; @@ -586,21 +548,41 @@ class function TSynInnoSyn.GetLanguageName: string; Result := SYNS_LangInno; end; -procedure TSynInnoSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); -var - HashValue: Integer; +procedure TSynInnoSyn.DoAddKeyword(AKeyword: string; AKind: Integer); +begin + if not FKeywords.ContainsKey(AKeyword) then + FKeywords.Add(AKeyword, TtkTokenKind(AKind)); +end; + +function TSynInnoSyn.GetSampleSource: string; begin - HashValue := HashKey(PWideChar(AKeyword)); - FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind); + Result := + '; -- Example.iss --' + #13#10 + + '[Setup]' + #13#10 + + 'AppName=My Program' + #13#10 + + 'AppVersion=1.5' + #13#10 + + 'WizardStyle=modern' + #13#10 + + 'DefaultDirName={autopf}\My Program' + #13#10 + + 'DefaultGroupName=My Program' + #13#10 + + 'UninstallDisplayIcon={app}\MyProg.exe' + #13#10 + + 'Compression=lzma2' + #13#10 + + 'SolidCompression=yes' + #13#10 + + 'OutputDir=userdocs:Inno Setup Examples Output' + #13#10 + + '' + #13#10 + + '[Files]' + #13#10 + + 'Source: "MyProg.exe"; DestDir: "{app}"' + #13#10 + + 'Source: "MyProg.chm"; DestDir: "{app}"' + #13#10 + + 'Source: "Readme.txt"; DestDir: "{app}"; Flags: isreadme' + #13#10 + + '' + #13#10 + + '[Icons]' + #13#10 + + 'Name: "{group}\My Program"; Filename: "{app}\MyProg.exe"'; end; -class function TSynInnoSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynInnoSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangInno; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynInnoSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterJSON.pas b/Ext/SynEdit/Source/SynHighlighterJSON.pas index aae41c2..4c17116 100644 --- a/Ext/SynEdit/Source/SynHighlighterJSON.pas +++ b/Ext/SynEdit/Source/SynHighlighterJSON.pas @@ -31,8 +31,6 @@ unit SynHighlighterJSON; -{$I SynEdit.inc} - interface uses @@ -41,7 +39,11 @@ interface SynEditTypes, SynEditHighlighter, SynUnicode, - SysUtils, Classes; + //++ CodeFolding + SynEditCodeFolding, + //++ CodeFolding + SysUtils, + Classes; type TtkTokenKind = (tkString, tkReserved, tkNull, tkNumber, tkSpace, @@ -50,7 +52,9 @@ interface TRangeState = (rsUnknown, rsAttribute, rsObjectValue, rsArrayValue); type - TSynJSONSyn = class(TSynCustomHighLighter) +//++ CodeFolding + TSynJSONSyn = class(TSynCustomCodeFoldingHighlighter) +//-- CodeFolding private FRange: TRangeState; FTokenID: TtkTokenKind; @@ -76,11 +80,11 @@ TSynJSONSyn = class(TSynCustomHighLighter) procedure SymbolProc; procedure UnknownProc; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; @@ -93,6 +97,10 @@ TSynJSONSyn = class(TSynCustomHighLighter) procedure Next; override; procedure SetRange(Value: Pointer); override; procedure ResetRange; override; +//++ CodeFolding + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; +//-- CodeFolding published property AttributeAttri: TSynHighlighterAttributes read FAttributeAttri write FAttributeAttri; @@ -113,7 +121,6 @@ implementation uses SynEditStrConst; - { TSynJSONSyn } constructor TSynJSONSyn.Create(AOwner: TComponent); @@ -225,6 +232,11 @@ procedure TSynJSONSyn.NumberProc; if FLine[Run] = '0' then if FLine[Run + 1] <> '.' then begin + if CharInSet(FLine[Run + 1], [#0, #32, ',', ']', '}']) then + begin + Inc(Run); + Exit; + end; FTokenID := tkUnknown; while (FLine[Run] <> #32) and not IsLineEnd(Run) do Inc(Run); Exit; @@ -340,12 +352,7 @@ procedure TSynJSONSyn.SpaceProc; procedure TSynJSONSyn.StringProc; - function IsHex(Digit: AnsiChar): Boolean; overload; - begin - Result := CharInSet(Digit, ['0'..'9', 'A'..'F', 'a'..'f']); - end; - - function IsHex(Digit: WideChar): Boolean; overload; + function IsHex(Digit: Char): Boolean; begin Result := CharInSet(Digit, ['0'..'9', 'A'..'F', 'a'..'f']); end; @@ -398,7 +405,7 @@ procedure TSynJSONSyn.UnknownProc; procedure TSynJSONSyn.Next; begin - FTokenPos := Run; + fTokenPos := Run; case FLine[Run] of #0: NullProc; #1..#9, #11, #12, #14..#32: SpaceProc; @@ -436,7 +443,7 @@ function TSynJSONSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribu function TSynJSONSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynJSONSyn.GetRange: Pointer; @@ -476,6 +483,87 @@ procedure TSynJSONSyn.ResetRange; FRange := rsUnknown; end; +//++ CodeFolding +procedure TSynJSONSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine, ToLine: Integer); +var + CurLine: string; + Line: Integer; + + function LineHasChar(Line: Integer; character: char; + StartCol : Integer): Boolean; // faster than Pos! + var + I: Integer; + begin + Result := False; + for I := StartCol to Length(CurLine) do begin + if CurLine[i] = character then begin + // Char must have proper highlighting (ignore stuff inside comments...) + if GetHighlighterAttriAtRowCol(LinesToScan, Line, I) <> CommentAttribute then begin + Result := True; + Break; + end; + end; + end; + end; + + function FindBraces(Line: Integer; OpenBrace, CloseBrace: char; FoldType: Integer): Boolean; + var + Col: Integer; + begin + Result := False; + + for Col := 1 to Length(CurLine) do + begin + // We've found a starting character + if CurLine[col] = OpenBrace then + begin + // Char must have proper highlighting (ignore stuff inside comments...) + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> CommentAttribute then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, CloseBrace, col + 1) then begin + FoldRanges.StartFoldRange(Line + 1, FoldType); + Result := True; + end; + // Skip until a newline + Break; + end; + end else if CurLine[col] = CloseBrace then + begin + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> CommentAttribute then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, OpenBrace, col + 1) then begin + FoldRanges.StopFoldRange(Line + 1, FoldType); + Result := True; + end; + // Skip until a newline + Break; + end; + end; + end; // for Col + end; + +begin + for Line := FromLine to ToLine do + begin + CurLine := LinesToScan[Line]; + + // Skip empty lines + if CurLine = '' then begin + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end; + + // Find an braces on this line (Fold Type 1) + if not FindBraces(Line, '{', '}', 1) then + if not FindBraces(Line, '[', ']', 2) then + FoldRanges.NoFoldInfo(Line + 1); + end; // while Line +end; +//-- CodeFolding + procedure TSynJSONSyn.SetRange(Value: Pointer); begin FRange := TRangeState(Value); @@ -491,7 +579,7 @@ class function TSynJSONSyn.GetLanguageName: string; Result := SYNS_LangJSON; end; -function TSynJSONSyn.GetSampleSource: UnicodeString; +function TSynJSONSyn.GetSampleSource: string; begin Result := '{'#13#10 + @@ -522,13 +610,11 @@ function TSynJSONSyn.GetSampleSource: UnicodeString; '}'; end; -class function TSynJSONSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynJSONSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangJSON; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynJSONSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterJScript.pas b/Ext/SynEdit/Source/SynHighlighterJScript.pas index 218433e..10ffa56 100644 --- a/Ext/SynEdit/Source/SynHighlighterJScript.pas +++ b/Ext/SynEdit/Source/SynHighlighterJScript.pas @@ -27,13 +27,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterJScript.pas,v 1.21.2.8 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a JavaScript/JScript highlighter for SynEdit) @@ -52,4412 +45,319 @@ interface uses Graphics, - Registry, + System.Win.Registry, SynEditTypes, SynEditHighlighter, - SynUnicode, -{$IFDEF SYN_CodeFolding} - SynEditCodeFolding, -{$ENDIF} SysUtils, - Classes; - -type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, - tkString, tkSymbol, tkUnknown, tkNonReservedKey, tkEvent); - - TRangeState = (rsUnknown, rsANSI); - - PIdentFuncTableFunc = ^TIdentFuncTableFunc; - TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - -type -{$IFDEF SYN_CodeFolding} - TSynJScriptSyn = class(TSynCustomCodeFoldingHighlighter) -{$ELSE} - TSynJScriptSyn = class(TSynCustomHighLighter) -{$ENDIF} - private - FRange: TRangeState; - FTokenID: TtkTokenKind; - FIdentFuncTable: array[0..5152] of TIdentFuncTableFunc; - FCommentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNonReservedKeyAttri: TSynHighlighterAttributes; - FEventAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - function AltFunc(Index: Integer): TtkTokenKind; - function FuncAbs(Index: Integer): TtkTokenKind; - function FuncAbstract(Index: Integer): TtkTokenKind; - function FuncAcos(Index: Integer): TtkTokenKind; - function FuncAction(Index: Integer): TtkTokenKind; - function FuncAlert(Index: Integer): TtkTokenKind; - function FuncAlign(Index: Integer): TtkTokenKind; - function FuncAlinkcolor(Index: Integer): TtkTokenKind; - function FuncAll(Index: Integer): TtkTokenKind; - function FuncAnchor(Index: Integer): TtkTokenKind; - function FuncAnchors(Index: Integer): TtkTokenKind; - function FuncAppcodename(Index: Integer): TtkTokenKind; - function FuncApplet(Index: Integer): TtkTokenKind; - function FuncApplets(Index: Integer): TtkTokenKind; - function FuncAppname(Index: Integer): TtkTokenKind; - function FuncAppversion(Index: Integer): TtkTokenKind; - function FuncArea(Index: Integer): TtkTokenKind; - function FuncArguments(Index: Integer): TtkTokenKind; - function FuncArray(Index: Integer): TtkTokenKind; - function FuncAsin(Index: Integer): TtkTokenKind; - function FuncAtan(Index: Integer): TtkTokenKind; - function FuncAtan2(Index: Integer): TtkTokenKind; - function FuncBack(Index: Integer): TtkTokenKind; - function FuncBackground(Index: Integer): TtkTokenKind; - function FuncBgcolor(Index: Integer): TtkTokenKind; - function FuncBig(Index: Integer): TtkTokenKind; - function FuncBlink(Index: Integer): TtkTokenKind; - function FuncBlur(Index: Integer): TtkTokenKind; - function FuncBody(Index: Integer): TtkTokenKind; - function FuncBold(Index: Integer): TtkTokenKind; - function FuncBoolean(Index: Integer): TtkTokenKind; - function FuncBoolean2(Index: Integer): TtkTokenKind; - function FuncBorder(Index: Integer): TtkTokenKind; - function FuncBottom(Index: Integer): TtkTokenKind; - function FuncBreak(Index: Integer): TtkTokenKind; - function FuncButton(Index: Integer): TtkTokenKind; - function FuncByte(Index: Integer): TtkTokenKind; - function FuncCall(Index: Integer): TtkTokenKind; - function FuncCallee(Index: Integer): TtkTokenKind; - function FuncCaller(Index: Integer): TtkTokenKind; - function FuncCaptureevents(Index: Integer): TtkTokenKind; - function FuncCase(Index: Integer): TtkTokenKind; - function FuncCatch(Index: Integer): TtkTokenKind; - function FuncCeil(Index: Integer): TtkTokenKind; - function FuncChar(Index: Integer): TtkTokenKind; - function FuncCharat(Index: Integer): TtkTokenKind; - function FuncCharcodeat(Index: Integer): TtkTokenKind; - function FuncCheckbox(Index: Integer): TtkTokenKind; - function FuncChecked(Index: Integer): TtkTokenKind; - function FuncClass(Index: Integer): TtkTokenKind; - function FuncClear(Index: Integer): TtkTokenKind; - function FuncClearinterval(Index: Integer): TtkTokenKind; - function FuncCleartimeout(Index: Integer): TtkTokenKind; - function FuncClick(Index: Integer): TtkTokenKind; - function FuncClose(Index: Integer): TtkTokenKind; - function FuncClosed(Index: Integer): TtkTokenKind; - function FuncColor(Index: Integer): TtkTokenKind; - function FuncComplete(Index: Integer): TtkTokenKind; - function FuncConcat(Index: Integer): TtkTokenKind; - function FuncConfirm(Index: Integer): TtkTokenKind; - function FuncConst(Index: Integer): TtkTokenKind; - function FuncConstructor(Index: Integer): TtkTokenKind; - function FuncContinue(Index: Integer): TtkTokenKind; - function FuncCookie(Index: Integer): TtkTokenKind; - function FuncCos(Index: Integer): TtkTokenKind; - function FuncCurrent(Index: Integer): TtkTokenKind; - function FuncDate(Index: Integer): TtkTokenKind; - function FuncDebugger(Index: Integer): TtkTokenKind; - function FuncDefault(Index: Integer): TtkTokenKind; - function FuncDefaultchecked(Index: Integer): TtkTokenKind; - function FuncDefaultselected(Index: Integer): TtkTokenKind; - function FuncDefaultstatus(Index: Integer): TtkTokenKind; - function FuncDefaultvalue(Index: Integer): TtkTokenKind; - function FuncDelete(Index: Integer): TtkTokenKind; - function FuncDescription(Index: Integer): TtkTokenKind; - function FuncDisplay(Index: Integer): TtkTokenKind; - function FuncDo(Index: Integer): TtkTokenKind; - function FuncDocument(Index: Integer): TtkTokenKind; - function FuncDomain(Index: Integer): TtkTokenKind; - function FuncDouble(Index: Integer): TtkTokenKind; - function FuncE(Index: Integer): TtkTokenKind; - function FuncElements(Index: Integer): TtkTokenKind; - function FuncElse(Index: Integer): TtkTokenKind; - function FuncEmbed(Index: Integer): TtkTokenKind; - function FuncEmbeds(Index: Integer): TtkTokenKind; - function FuncEnabledplugin(Index: Integer): TtkTokenKind; - function FuncEncoding(Index: Integer): TtkTokenKind; - function FuncEnum(Index: Integer): TtkTokenKind; - function FuncEscape(Index: Integer): TtkTokenKind; - function FuncEval(Index: Integer): TtkTokenKind; - function FuncEvent(Index: Integer): TtkTokenKind; - function FuncExp(Index: Integer): TtkTokenKind; - function FuncExport(Index: Integer): TtkTokenKind; - function FuncExtends(Index: Integer): TtkTokenKind; - function FuncFalse(Index: Integer): TtkTokenKind; - function FuncFgcolor(Index: Integer): TtkTokenKind; - function FuncFilename(Index: Integer): TtkTokenKind; - function FuncFileupload(Index: Integer): TtkTokenKind; - function FuncFinal(Index: Integer): TtkTokenKind; - function FuncFinally(Index: Integer): TtkTokenKind; - function FuncFind(Index: Integer): TtkTokenKind; - function FuncFixed(Index: Integer): TtkTokenKind; - function FuncFloat(Index: Integer): TtkTokenKind; - function FuncFloat2(Index: Integer): TtkTokenKind; - function FuncFloor(Index: Integer): TtkTokenKind; - function FuncFocus(Index: Integer): TtkTokenKind; - function FuncFontcolor(Index: Integer): TtkTokenKind; - function FuncFontsize(Index: Integer): TtkTokenKind; - function FuncFor(Index: Integer): TtkTokenKind; - function FuncForm(Index: Integer): TtkTokenKind; - function FuncForms(Index: Integer): TtkTokenKind; - function FuncForward(Index: Integer): TtkTokenKind; - function FuncFrame(Index: Integer): TtkTokenKind; - function FuncFrames(Index: Integer): TtkTokenKind; - function FuncFromcharcode(Index: Integer): TtkTokenKind; - function FuncFunction(Index: Integer): TtkTokenKind; - function FuncFunction2(Index: Integer): TtkTokenKind; - function FuncGetdate(Index: Integer): TtkTokenKind; - function FuncGetday(Index: Integer): TtkTokenKind; - function FuncGetelementbyid(Index: Integer): TtkTokenKind; - function FuncGetfullyear(Index: Integer): TtkTokenKind; - function FuncGethours(Index: Integer): TtkTokenKind; - function FuncGetmilliseconds(Index: Integer): TtkTokenKind; - function FuncGetminutes(Index: Integer): TtkTokenKind; - function FuncGetmonth(Index: Integer): TtkTokenKind; - function FuncGetseconds(Index: Integer): TtkTokenKind; - function FuncGettime(Index: Integer): TtkTokenKind; - function FuncGettimezoneoffset(Index: Integer): TtkTokenKind; - function FuncGetutcdate(Index: Integer): TtkTokenKind; - function FuncGetutcday(Index: Integer): TtkTokenKind; - function FuncGetutcfullyear(Index: Integer): TtkTokenKind; - function FuncGetutchours(Index: Integer): TtkTokenKind; - function FuncGetutcmilliseconds(Index: Integer): TtkTokenKind; - function FuncGetutcminutes(Index: Integer): TtkTokenKind; - function FuncGetutcmonth(Index: Integer): TtkTokenKind; - function FuncGetutcseconds(Index: Integer): TtkTokenKind; - function FuncGetyear(Index: Integer): TtkTokenKind; - function FuncGlobal(Index: Integer): TtkTokenKind; - function FuncGo(Index: Integer): TtkTokenKind; - function FuncGoto(Index: Integer): TtkTokenKind; - function FuncHandleevent(Index: Integer): TtkTokenKind; - function FuncHash(Index: Integer): TtkTokenKind; - function FuncHeight(Index: Integer): TtkTokenKind; - function FuncHidden(Index: Integer): TtkTokenKind; - function FuncHistory(Index: Integer): TtkTokenKind; - function FuncHome(Index: Integer): TtkTokenKind; - function FuncHost(Index: Integer): TtkTokenKind; - function FuncHostname(Index: Integer): TtkTokenKind; - function FuncHref(Index: Integer): TtkTokenKind; - function FuncHspace(Index: Integer): TtkTokenKind; - function FuncIf(Index: Integer): TtkTokenKind; - function FuncImage(Index: Integer): TtkTokenKind; - function FuncImages(Index: Integer): TtkTokenKind; - function FuncImplements(Index: Integer): TtkTokenKind; - function FuncImport(Index: Integer): TtkTokenKind; - function FuncIn(Index: Integer): TtkTokenKind; - function FuncIndex(Index: Integer): TtkTokenKind; - function FuncIndexof(Index: Integer): TtkTokenKind; - function FuncInfinity(Index: Integer): TtkTokenKind; - function FuncInnerheight(Index: Integer): TtkTokenKind; - function FuncInnerwidth(Index: Integer): TtkTokenKind; - function FuncInput(Index: Integer): TtkTokenKind; - function FuncInstanceof(Index: Integer): TtkTokenKind; - function FuncInt(Index: Integer): TtkTokenKind; - function FuncInterface(Index: Integer): TtkTokenKind; - function FuncIsfinite(Index: Integer): TtkTokenKind; - function FuncIsnan(Index: Integer): TtkTokenKind; - function FuncItalics(Index: Integer): TtkTokenKind; - function FuncJava(Index: Integer): TtkTokenKind; - function FuncJavaenabled(Index: Integer): TtkTokenKind; - function FuncJoin(Index: Integer): TtkTokenKind; - function FuncLastindexof(Index: Integer): TtkTokenKind; - function FuncLastmodified(Index: Integer): TtkTokenKind; - function FuncLayer(Index: Integer): TtkTokenKind; - function FuncLayers(Index: Integer): TtkTokenKind; - function FuncLeft(Index: Integer): TtkTokenKind; - function FuncLength(Index: Integer): TtkTokenKind; - function FuncLink(Index: Integer): TtkTokenKind; - function FuncLinkcolor(Index: Integer): TtkTokenKind; - function FuncLinks(Index: Integer): TtkTokenKind; - function FuncLn10(Index: Integer): TtkTokenKind; - function FuncLn2(Index: Integer): TtkTokenKind; - function FuncLocation(Index: Integer): TtkTokenKind; - function FuncLocationbar(Index: Integer): TtkTokenKind; - function FuncLog(Index: Integer): TtkTokenKind; - function FuncLog10e(Index: Integer): TtkTokenKind; - function FuncLog2e(Index: Integer): TtkTokenKind; - function FuncLogon(Index: Integer): TtkTokenKind; - function FuncLong(Index: Integer): TtkTokenKind; - function FuncLowsrc(Index: Integer): TtkTokenKind; - function FuncMatch(Index: Integer): TtkTokenKind; - function FuncMath(Index: Integer): TtkTokenKind; - function FuncMax(Index: Integer): TtkTokenKind; - function FuncMax_value(Index: Integer): TtkTokenKind; - function FuncMenubar(Index: Integer): TtkTokenKind; - function FuncMethod(Index: Integer): TtkTokenKind; - function FuncMimetype(Index: Integer): TtkTokenKind; - function FuncMimetypes(Index: Integer): TtkTokenKind; - function FuncMin(Index: Integer): TtkTokenKind; - function FuncMin_value(Index: Integer): TtkTokenKind; - function FuncMoveby(Index: Integer): TtkTokenKind; - function FuncMoveto(Index: Integer): TtkTokenKind; - function FuncName(Index: Integer): TtkTokenKind; - function FuncNan(Index: Integer): TtkTokenKind; - function FuncNative(Index: Integer): TtkTokenKind; - function FuncNavigator(Index: Integer): TtkTokenKind; - function FuncNegative_infinity(Index: Integer): TtkTokenKind; - function FuncNetscape(Index: Integer): TtkTokenKind; - function FuncNew(Index: Integer): TtkTokenKind; - function FuncNext(Index: Integer): TtkTokenKind; - function FuncNull(Index: Integer): TtkTokenKind; - function FuncNull2(Index: Integer): TtkTokenKind; - function FuncNumber(Index: Integer): TtkTokenKind; - function FuncObject(Index: Integer): TtkTokenKind; - function FuncOnabort(Index: Integer): TtkTokenKind; - function FuncOnblur(Index: Integer): TtkTokenKind; - function FuncOnchange(Index: Integer): TtkTokenKind; - function FuncOnclick(Index: Integer): TtkTokenKind; - function FuncOndblclick(Index: Integer): TtkTokenKind; - function FuncOnerror(Index: Integer): TtkTokenKind; - function FuncOnfocus(Index: Integer): TtkTokenKind; - function FuncOnkeydown(Index: Integer): TtkTokenKind; - function FuncOnkeypress(Index: Integer): TtkTokenKind; - function FuncOnkeyup(Index: Integer): TtkTokenKind; - function FuncOnload(Index: Integer): TtkTokenKind; - function FuncOnmousedown(Index: Integer): TtkTokenKind; - function FuncOnmousemove(Index: Integer): TtkTokenKind; - function FuncOnmouseout(Index: Integer): TtkTokenKind; - function FuncOnmouseover(Index: Integer): TtkTokenKind; - function FuncOnmouseup(Index: Integer): TtkTokenKind; - function FuncOnreset(Index: Integer): TtkTokenKind; - function FuncOnselect(Index: Integer): TtkTokenKind; - function FuncOnsubmit(Index: Integer): TtkTokenKind; - function FuncOnunload(Index: Integer): TtkTokenKind; - function FuncOpen(Index: Integer): TtkTokenKind; - function FuncOpener(Index: Integer): TtkTokenKind; - function FuncOption(Index: Integer): TtkTokenKind; - function FuncOptions(Index: Integer): TtkTokenKind; - function FuncOuterheight(Index: Integer): TtkTokenKind; - function FuncOuterwidth(Index: Integer): TtkTokenKind; - function FuncPackage(Index: Integer): TtkTokenKind; - function FuncPackages(Index: Integer): TtkTokenKind; - function FuncPagex(Index: Integer): TtkTokenKind; - function FuncPagexoffset(Index: Integer): TtkTokenKind; - function FuncPagey(Index: Integer): TtkTokenKind; - function FuncPageyoffset(Index: Integer): TtkTokenKind; - function FuncParent(Index: Integer): TtkTokenKind; - function FuncParse(Index: Integer): TtkTokenKind; - function FuncParsefloat(Index: Integer): TtkTokenKind; - function FuncParseint(Index: Integer): TtkTokenKind; - function FuncPassword(Index: Integer): TtkTokenKind; - function FuncPathname(Index: Integer): TtkTokenKind; - function FuncPersonalbar(Index: Integer): TtkTokenKind; - function FuncPi(Index: Integer): TtkTokenKind; - function FuncPlatform(Index: Integer): TtkTokenKind; - function FuncPlugin(Index: Integer): TtkTokenKind; - function FuncPlugins(Index: Integer): TtkTokenKind; - function FuncPort(Index: Integer): TtkTokenKind; - function FuncPositive_infinity(Index: Integer): TtkTokenKind; - function FuncPow(Index: Integer): TtkTokenKind; - function FuncPrevious(Index: Integer): TtkTokenKind; - function FuncPrint(Index: Integer): TtkTokenKind; - function FuncPrivate(Index: Integer): TtkTokenKind; - function FuncPrompt(Index: Integer): TtkTokenKind; - function FuncProtected(Index: Integer): TtkTokenKind; - function FuncProtocol(Index: Integer): TtkTokenKind; - function FuncPrototype(Index: Integer): TtkTokenKind; - function FuncPublic(Index: Integer): TtkTokenKind; - function FuncRadio(Index: Integer): TtkTokenKind; - function FuncRandom(Index: Integer): TtkTokenKind; - function FuncReferrer(Index: Integer): TtkTokenKind; - function FuncRefresh(Index: Integer): TtkTokenKind; - function FuncRegexp(Index: Integer): TtkTokenKind; - function FuncReleaseevents(Index: Integer): TtkTokenKind; - function FuncReload(Index: Integer): TtkTokenKind; - function FuncReplace(Index: Integer): TtkTokenKind; - function FuncReset(Index: Integer): TtkTokenKind; - function FuncResizeby(Index: Integer): TtkTokenKind; - function FuncResizeto(Index: Integer): TtkTokenKind; - function FuncReturn(Index: Integer): TtkTokenKind; - function FuncReverse(Index: Integer): TtkTokenKind; - function FuncRight(Index: Integer): TtkTokenKind; - function FuncRound(Index: Integer): TtkTokenKind; - function FuncRouteevent(Index: Integer): TtkTokenKind; - function FuncScreen(Index: Integer): TtkTokenKind; - function FuncScroll(Index: Integer): TtkTokenKind; - function FuncScrollbars(Index: Integer): TtkTokenKind; - function FuncScrollby(Index: Integer): TtkTokenKind; - function FuncScrollto(Index: Integer): TtkTokenKind; - function FuncSearch(Index: Integer): TtkTokenKind; - function FuncSelect(Index: Integer): TtkTokenKind; - function FuncSelected(Index: Integer): TtkTokenKind; - function FuncSelectedindex(Index: Integer): TtkTokenKind; - function FuncSelf(Index: Integer): TtkTokenKind; - function FuncSetdate(Index: Integer): TtkTokenKind; - function FuncSetfullyear(Index: Integer): TtkTokenKind; - function FuncSethours(Index: Integer): TtkTokenKind; - function FuncSetinterval(Index: Integer): TtkTokenKind; - function FuncSetmilliseconds(Index: Integer): TtkTokenKind; - function FuncSetminutes(Index: Integer): TtkTokenKind; - function FuncSetmonth(Index: Integer): TtkTokenKind; - function FuncSetseconds(Index: Integer): TtkTokenKind; - function FuncSettime(Index: Integer): TtkTokenKind; - function FuncSettimeout(Index: Integer): TtkTokenKind; - function FuncSetutcdate(Index: Integer): TtkTokenKind; - function FuncSetutcfullyear(Index: Integer): TtkTokenKind; - function FuncSetutchours(Index: Integer): TtkTokenKind; - function FuncSetutcmilliseconds(Index: Integer): TtkTokenKind; - function FuncSetutcminutes(Index: Integer): TtkTokenKind; - function FuncSetutcmonth(Index: Integer): TtkTokenKind; - function FuncSetutcseconds(Index: Integer): TtkTokenKind; - function FuncSetyear(Index: Integer): TtkTokenKind; - function FuncShort(Index: Integer): TtkTokenKind; - function FuncSin(Index: Integer): TtkTokenKind; - function FuncSlice(Index: Integer): TtkTokenKind; - function FuncSmall(Index: Integer): TtkTokenKind; - function FuncSort(Index: Integer): TtkTokenKind; - function FuncSplit(Index: Integer): TtkTokenKind; - function FuncSqrt(Index: Integer): TtkTokenKind; - function FuncSqrt1_2(Index: Integer): TtkTokenKind; - function FuncSqrt2(Index: Integer): TtkTokenKind; - function FuncSrc(Index: Integer): TtkTokenKind; - function FuncStart(Index: Integer): TtkTokenKind; - function FuncStatic(Index: Integer): TtkTokenKind; - function FuncStatus(Index: Integer): TtkTokenKind; - function FuncStatusbar(Index: Integer): TtkTokenKind; - function FuncStop(Index: Integer): TtkTokenKind; - function FuncStrike(Index: Integer): TtkTokenKind; - function FuncString(Index: Integer): TtkTokenKind; - function FuncStyle(Index: Integer): TtkTokenKind; - function FuncSub(Index: Integer): TtkTokenKind; - function FuncSubmit(Index: Integer): TtkTokenKind; - function FuncSubstr(Index: Integer): TtkTokenKind; - function FuncSubstring(Index: Integer): TtkTokenKind; - function FuncSuffixes(Index: Integer): TtkTokenKind; - function FuncSup(Index: Integer): TtkTokenKind; - function FuncSuper(Index: Integer): TtkTokenKind; - function FuncSwitch(Index: Integer): TtkTokenKind; - function FuncSynchronized(Index: Integer): TtkTokenKind; - function FuncTags(Index: Integer): TtkTokenKind; - function FuncTaint(Index: Integer): TtkTokenKind; - function FuncTaintenabled(Index: Integer): TtkTokenKind; - function FuncTan(Index: Integer): TtkTokenKind; - function FuncTarget(Index: Integer): TtkTokenKind; - function FuncText(Index: Integer): TtkTokenKind; - function FuncTextarea(Index: Integer): TtkTokenKind; - function FuncThis(Index: Integer): TtkTokenKind; - function FuncThrow(Index: Integer): TtkTokenKind; - function FuncThrows(Index: Integer): TtkTokenKind; - function FuncTitle(Index: Integer): TtkTokenKind; - function FuncTogmtstring(Index: Integer): TtkTokenKind; - function FuncTolocalestring(Index: Integer): TtkTokenKind; - function FuncTolowercase(Index: Integer): TtkTokenKind; - function FuncToolbar(Index: Integer): TtkTokenKind; - function FuncTop(Index: Integer): TtkTokenKind; - function FuncTosource(Index: Integer): TtkTokenKind; - function FuncTostring(Index: Integer): TtkTokenKind; - function FuncTouppercase(Index: Integer): TtkTokenKind; - function FuncToutcstring(Index: Integer): TtkTokenKind; - function FuncTransient(Index: Integer): TtkTokenKind; - function FuncTrue(Index: Integer): TtkTokenKind; - function FuncTry(Index: Integer): TtkTokenKind; - function FuncType(Index: Integer): TtkTokenKind; - function FuncTypeof(Index: Integer): TtkTokenKind; - function FuncUndefined(Index: Integer): TtkTokenKind; - function FuncUnescape(Index: Integer): TtkTokenKind; - function FuncUntaint(Index: Integer): TtkTokenKind; - function FuncUnwatch(Index: Integer): TtkTokenKind; - function FuncUrl(Index: Integer): TtkTokenKind; - function FuncUseragent(Index: Integer): TtkTokenKind; - function FuncUtc(Index: Integer): TtkTokenKind; - function FuncValue(Index: Integer): TtkTokenKind; - function FuncValueof(Index: Integer): TtkTokenKind; - function FuncVar(Index: Integer): TtkTokenKind; - function FuncVisibility(Index: Integer): TtkTokenKind; - function FuncVlinkcolor(Index: Integer): TtkTokenKind; - function FuncVoid(Index: Integer): TtkTokenKind; - function FuncVspace(Index: Integer): TtkTokenKind; - function FuncWatch(Index: Integer): TtkTokenKind; - function FuncWhile(Index: Integer): TtkTokenKind; - function FuncWidth(Index: Integer): TtkTokenKind; - function FuncWindow(Index: Integer): TtkTokenKind; - function FuncWith(Index: Integer): TtkTokenKind; - function FuncWrite(Index: Integer): TtkTokenKind; - function FuncWriteln(Index: Integer): TtkTokenKind; - function FuncZindex(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; - procedure AndSymbolProc; - procedure CommentProc; - procedure CRProc; - procedure IdentProc; - procedure LFProc; - procedure MinusProc; - procedure ModSymbolProc; - procedure NullProc; - procedure NumberProc; - procedure OrSymbolProc; - procedure PlusProc; - procedure PointProc; - procedure SlashProc; - procedure SpaceProc; - procedure StarProc; - procedure StringProc; - procedure SymbolProc; - procedure UnknownProc; - protected - function GetSampleSource: UnicodeString; override; - function IsFilterStored: Boolean; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; - public - constructor Create(AOwner: TComponent); override; - function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; - override; - function GetEol: Boolean; override; - function GetRange: Pointer; override; - function GetTokenID: TtkTokenKind; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: Integer; override; - procedure Next; override; - procedure SetRange(Value: Pointer); override; - procedure ResetRange; override; -{$IFDEF SYN_CodeFolding} - procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; -{$ENDIF} - published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NonReservedKeyAttri: TSynHighlighterAttributes read FNonReservedKeyAttri write FNonReservedKeyAttri; - property EventAttri: TSynHighlighterAttributes read FEventAttri write FEventAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..398] of UnicodeString = ( - 'abs', 'abstract', 'acos', 'action', 'alert', 'align', 'alinkColor', 'all', - 'All', 'anchor', 'Anchor', 'anchors', 'appCodeName', 'Applet', 'applets', - 'appName', 'appVersion', 'Area', 'arguments', 'Arguments', 'Array', 'asin', - 'atan', 'atan2', 'back', 'background', 'bgColor', 'big', 'blink', 'blur', - 'body', 'bold', 'boolean', 'Boolean', 'border', 'bottom', 'break', 'Button', - 'byte', 'call', 'callee', 'caller', 'captureEvents', 'case', 'catch', - 'ceil', 'char', 'charAt', 'charCodeAt', 'Checkbox', 'checked', 'class', - 'clear', 'clearInterval', 'clearTimeout', 'click', 'close', 'closed', - 'color', 'complete', 'concat', 'confirm', 'const', 'constructor', - 'continue', 'cookie', 'cos', 'current', 'Date', 'debugger', 'default', - 'defaultChecked', 'defaultSelected', 'defaultStatus', 'defaultValue', - 'delete', 'description', 'display', 'do', 'document', 'domain', 'double', - 'E', 'elements', 'else', 'Embed', 'embeds', 'enabledPlugin', 'encoding', - 'enum', 'escape', 'eval', 'event', 'exp', 'export', 'extends', 'false', - 'fgColor', 'filename', 'FileUpload', 'final', 'finally', 'find', 'fixed', - 'float', 'Float', 'floor', 'focus', 'fontcolor', 'fontsize', 'for', 'form', - 'Form', 'forms', 'forward', 'Frame', 'frames', 'fromCharCode', 'function', - 'Function', 'getDate', 'getDay', 'getElementById', 'getFullYear', - 'getHours', 'getMilliseconds', 'getMinutes', 'getMonth', 'getSeconds', - 'getTime', 'getTimezoneOffset', 'getUTCDate', 'getUTCDay', 'getUTCFullYear', - 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', - 'getUTCSeconds', 'getYear', 'Global', 'go', 'goto', 'handleEvent', 'hash', - 'height', 'Hidden', 'history', 'History', 'home', 'host', 'hostname', - 'href', 'hspace', 'if', 'Image', 'images', 'implements', 'import', 'in', - 'index', 'indexOf', 'Infinity', 'innerHeight', 'innerWidth', 'input', - 'instanceof', 'int', 'interface', 'isFinite', 'isNaN', 'italics', 'java', - 'javaEnabled', 'join', 'lastIndexOf', 'lastModified', 'Layer', 'layers', - 'left', 'length', 'link', 'Link', 'linkColor', 'links', 'LN10', 'LN2', - 'location', 'Location', 'locationbar', 'log', 'LOG10E', 'LOG2E', 'logon', - 'long', 'lowsrc', 'match', 'Math', 'max', 'MAX_VALUE', 'menubar', 'method', - 'MimeType', 'mimeTypes', 'min', 'MIN_VALUE', 'moveBy', 'moveTo', 'name', - 'NaN', 'native', 'navigator', 'Navigator', 'NEGATIVE_INFINITY', 'netscape', - 'new', 'next', 'null', 'Null', 'Number', 'Object', 'onAbort', 'onBlur', - 'onChange', 'onClick', 'onDblClick', 'onError', 'onFocus', 'onKeyDown', - 'onKeyPress', 'onKeyUp', 'onLoad', 'onMouseDown', 'onMouseMove', - 'onMouseOut', 'onMouseOver', 'onMouseUp', 'onReset', 'onSelect', 'onSubmit', - 'onUnload', 'open', 'opener', 'Option', 'options', 'outerHeight', - 'outerWidth', 'package', 'Packages', 'pageX', 'pageXOffset', 'pageY', - 'pageYOffset', 'parent', 'parse', 'parseFloat', 'parseInt', 'Password', - 'pathname', 'personalbar', 'PI', 'platform', 'Plugin', 'plugins', 'port', - 'POSITIVE_INFINITY', 'pow', 'previous', 'print', 'private', 'prompt', - 'protected', 'protocol', 'prototype', 'public', 'Radio', 'random', - 'referrer', 'refresh', 'RegExp', 'releaseEvents', 'reload', 'replace', - 'reset', 'Reset', 'resizeBy', 'resizeTo', 'return', 'reverse', 'right', - 'round', 'routeEvent', 'screen', 'scroll', 'scrollbars', 'scrollBy', - 'scrollTo', 'search', 'select', 'Select', 'selected', 'selectedIndex', - 'self', 'setDate', 'setFullYear', 'setHours', 'setInterval', - 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', - 'setTimeout', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', - 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', - 'setYear', 'short', 'sin', 'slice', 'small', 'sort', 'split', 'sqrt', - 'SQRT1_2', 'SQRT2', 'src', 'start', 'static', 'status', 'statusbar', 'stop', - 'strike', 'String', 'style', 'sub', 'submit', 'Submit', 'substr', - 'substring', 'suffixes', 'sup', 'super', 'switch', 'synchronized', 'tags', - 'taint', 'taintEnabled', 'tan', 'target', 'text', 'Text', 'Textarea', - 'this', 'throw', 'throws', 'title', 'toGMTString', 'toLocaleString', - 'toLowerCase', 'toolbar', 'top', 'toSource', 'toString', 'toUpperCase', - 'toUTCString', 'transient', 'true', 'try', 'type', 'typeof', 'undefined', - 'Undefined', 'unescape', 'untaint', 'unwatch', 'URL', 'userAgent', 'UTC', - 'value', 'valueOf', 'var', 'visibility', 'vlinkColor', 'void', 'vspace', - 'watch', 'while', 'width', 'window', 'Window', 'with', 'write', 'writeln', - 'zIndex' - ); - - KeyIndices: array[0..5152] of Integer = ( - -1, -1, -1, -1, -1, -1, -1, -1, -1, 231, -1, -1, -1, -1, -1, 296, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 55, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 208, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 295, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 75, 351, -1, -1, -1, -1, -1, -1, 315, 37, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 239, -1, -1, -1, -1, -1, 326, -1, -1, -1, 31, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 143, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 339, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 241, -1, -1, -1, -1, -1, -1, -1, -1, -1, 3, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 235, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 204, -1, -1, -1, -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, - -1, -1, 16, 52, 389, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 259, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 331, 30, -1, -1, -1, -1, -1, -1, - -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 304, -1, 396, 2, -1, -1, 323, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 167, - -1, -1, -1, -1, -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, 34, -1, - -1, -1, -1, 203, -1, -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, -1, 83, -1, -1, - -1, -1, -1, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 268, -1, -1, -1, -1, -1, -1, -1, -1, 182, -1, -1, -1, -1, -1, 246, 18, -1, - -1, -1, -1, -1, 209, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 220, 161, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 332, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 229, -1, -1, -1, -1, -1, -1, -1, 157, 319, -1, 210, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 234, -1, -1, -1, -1, -1, -1, -1, -1, -1, 105, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 381, 78, -1, - -1, -1, -1, -1, -1, -1, 257, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 219, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 196, -1, -1, -1, -1, -1, 379, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 363, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 309, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 386, 146, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 269, -1, -1, -1, 199, 172, -1, 15, 123, -1, -1, -1, -1, -1, -1, -1, 136, - -1, -1, -1, 128, -1, -1, -1, -1, 366, -1, -1, 185, -1, -1, -1, -1, 153, -1, - -1, -1, -1, 388, -1, -1, 165, -1, -1, -1, -1, -1, -1, 338, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 360, -1, -1, - 194, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 307, -1, -1, -1, -1, -1, -1, -1, 258, -1, - -1, -1, 96, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 180, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, 129, -1, -1, - -1, -1, -1, -1, -1, -1, 120, -1, -1, 95, -1, 233, -1, -1, -1, -1, -1, -1, - -1, -1, 40, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 160, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 90, 282, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 341, 232, 121, 155, -1, - -1, -1, -1, -1, 247, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 327, -1, -1, -1, -1, -1, -1, -1, -1, -1, 74, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 170, -1, -1, -1, -1, 298, -1, - -1, -1, -1, -1, -1, -1, 114, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 94, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 271, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 324, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 197, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 91, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, -1, -1, 237, -1, -1, -1, -1, -1, 6, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 250, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 205, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 238, -1, -1, -1, - -1, -1, -1, -1, -1, 275, -1, -1, -1, -1, -1, -1, -1, -1, -1, 287, -1, -1, - -1, -1, -1, -1, -1, 227, -1, -1, 383, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 58, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 29, 148, 171, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 392, -1, -1, -1, -1, -1, 125, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 201, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, 212, - -1, -1, -1, -1, -1, -1, 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, -1, -1, - -1, -1, -1, -1, -1, -1, 27, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 334, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 289, -1, -1, -1, -1, 312, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 385, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 51, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, -1, -1, 371, 76, - -1, -1, 330, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 68, -1, -1, -1, -1, -1, -1, 225, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 119, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 13, -1, -1, -1, 156, -1, 23, -1, -1, -1, -1, -1, -1, - -1, -1, 280, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 178, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 277, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, -1, -1, -1, 93, -1, - -1, -1, -1, -1, -1, -1, 202, -1, 5, 343, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 255, -1, -1, -1, -1, -1, -1, -1, - -1, 43, -1, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 50, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 333, -1, -1, -1, -1, -1, 12, -1, -1, -1, -1, 139, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 320, -1, -1, -1, -1, -1, -1, - 214, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 278, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 302, 316, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 137, -1, -1, -1, - 254, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 86, -1, -1, -1, -1, -1, -1, -1, -1, 345, -1, -1, 144, -1, -1, -1, 7, - -1, -1, 306, -1, -1, -1, -1, 113, -1, -1, -1, -1, -1, -1, 308, -1, -1, -1, - -1, 357, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 361, -1, -1, -1, -1, -1, -1, -1, 195, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 387, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 169, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 376, -1, -1, -1, -1, 188, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 359, 98, -1, -1, -1, - -1, -1, -1, -1, 11, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 299, -1, -1, -1, 369, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 147, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 118, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 356, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 8, -1, 300, -1, -1, 228, 59, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 213, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, - -1, -1, 176, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 350, -1, -1, -1, -1, - -1, -1, 284, -1, -1, -1, 256, -1, -1, 276, -1, -1, -1, -1, -1, -1, -1, -1, - 190, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 102, -1, 230, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, 71, 26, -1, -1, -1, -1, - -1, -1, 60, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 322, -1, -1, 175, -1, -1, 393, -1, 124, 85, -1, -1, -1, -1, - -1, -1, -1, -1, 150, -1, 236, -1, -1, -1, -1, -1, -1, -1, -1, -1, 140, -1, - -1, -1, -1, -1, -1, 183, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 42, 244, -1, -1, -1, -1, -1, -1, -1, 47, 313, -1, 41, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 294, -1, -1, -1, -1, -1, -1, -1, -1, 374, -1, -1, -1, -1, -1, -1, -1, 245, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 177, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 347, -1, -1, -1, -1, -1, -1, -1, 391, -1, -1, -1, -1, -1, -1, -1, - 217, -1, -1, -1, 87, -1, -1, -1, 329, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 39, -1, -1, -1, -1, -1, -1, -1, -1, 189, -1, -1, 222, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 174, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 274, -1, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 382, -1, -1, -1, 138, 226, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 24, -1, -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, -1, - -1, -1, 318, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 335, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 260, -1, -1, -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 288, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 342, -1, -1, -1, -1, -1, -1, - 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 377, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 132, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 158, -1, -1, 166, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, 57, - -1, -1, -1, 211, -1, -1, -1, -1, 243, -1, -1, -1, -1, -1, 264, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 321, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 207, -1, -1, - 216, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 149, -1, -1, -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, 293, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, 242, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 56, - -1, 154, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 92, 193, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 325, 126, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 206, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 372, -1, -1, -1, 380, -1, -1, - 352, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 263, -1, -1, -1, -1, -1, -1, -1, 373, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 286, -1, 46, -1, -1, -1, -1, 184, -1, -1, -1, -1, -1, -1, 19, - -1, -1, -1, 25, -1, -1, -1, -1, -1, -1, -1, 367, -1, -1, -1, -1, -1, 270, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 283, - -1, -1, -1, -1, -1, -1, -1, -1, 151, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, -1, -1, - -1, -1, -1, -1, 398, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 252, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 355, -1, -1, 365, -1, -1, -1, - -1, -1, -1, -1, -1, 28, -1, -1, 378, -1, -1, -1, -1, 354, -1, -1, -1, -1, - -1, -1, -1, -1, 349, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 97, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, -1, -1, -1, -1, 285, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 21, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 215, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 198, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 81, 394, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 358, -1, -1, -1, -1, -1, -1, -1, 173, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 224, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 181, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 375, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 9, -1, -1, -1, -1, -1, 305, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 141, - 281, 115, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, - -1, -1, 261, -1, -1, -1, -1, 265, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 273, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 362, -1, 290, -1, 66, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 112, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 131, -1, 279, -1, -1, -1, 249, -1, -1, -1, -1, -1, -1, 223, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 297, -1, -1, -1, -1, - 127, -1, -1, 142, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 364, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 88, -1, -1, -1, -1, -1, -1, 248, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 395, 251, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 45, -1, -1, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 310, -1, 218, -1, -1, -1, -1, -1, -1, 187, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 130, 390, -1, -1, -1, -1, -1, -1, -1, - 328, -1, 221, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 336, -1, -1, -1, -1, -1, -1, 311, -1, -1, -1, -1, - -1, -1, -1, -1, 303, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 108, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 344, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 337, -1, -1, -1, -1, -1, 262, -1, -1, -1, -1, - -1, -1, -1, 267, -1, -1, -1, -1, -1, -1, -1, 253, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 397, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 162, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 346, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, 348, 159, -1, -1, -1, -1, -1, -1, -1, - 368, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 370, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 164, -1, 314, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 291, -1, -1, -1, -1, -1, -1, 384, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 82, -1, -1, -1, -1, -1, -1, 340, -1, -1, - -1, -1, -1, -1, 317, -1, 79, -1, -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, - 353, -1, 301, -1, -1, -1, -1, -1, -1, 163, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 266, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 186, -1, -1, -1 - ); - -{$Q-} -function TSynJScriptSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 751 + Ord(Str^) * 148; - Inc(Str); - end; - Result := Result mod 5153; - FStringLen := Str - FToIdent; -end; -{$Q+} - -function TSynJScriptSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; -var - Key: Cardinal; -begin - FToIdent := MayBe; - Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) - else - Result := tkIdentifier; -end; - -procedure TSynJScriptSyn.InitIdent; -var - i: Integer; -begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; - - FIdentFuncTable[4966] := FuncAbs; - FIdentFuncTable[2170] := FuncAbstract; - FIdentFuncTable[520] := FuncAcos; - FIdentFuncTable[319] := FuncAction; - FIdentFuncTable[4368] := FuncAlert; - FIdentFuncTable[2070] := FuncAlign; - FIdentFuncTable[1500] := FuncAlinkcolor; - FIdentFuncTable[2362] := FuncAll; - FIdentFuncTable[2706] := FuncAll; - FIdentFuncTable[4383] := FuncAnchor; - FIdentFuncTable[491] := FuncAnchor; - FIdentFuncTable[2516] := FuncAnchors; - FIdentFuncTable[2207] := FuncAppcodename; - FIdentFuncTable[1993] := FuncApplet; - FIdentFuncTable[1805] := FuncApplets; - FIdentFuncTable[965] := FuncAppname; - FIdentFuncTable[416] := FuncAppversion; - FIdentFuncTable[2052] := FuncArea; - FIdentFuncTable[618] := FuncArguments; - FIdentFuncTable[3950] := FuncArguments; - FIdentFuncTable[2987] := FuncArray; - FIdentFuncTable[4131] := FuncAsin; - FIdentFuncTable[5117] := FuncAtan; - FIdentFuncTable[1999] := FuncAtan2; - FIdentFuncTable[3356] := FuncBack; - FIdentFuncTable[3954] := FuncBackground; - FIdentFuncTable[2882] := FuncBgcolor; - FIdentFuncTable[1824] := FuncBig; - FIdentFuncTable[4067] := FuncBlink; - FIdentFuncTable[1709] := FuncBlur; - FIdentFuncTable[483] := FuncBody; - FIdentFuncTable[243] := FuncBold; - FIdentFuncTable[4200] := FuncBoolean; - FIdentFuncTable[3265] := FuncBoolean2; - FIdentFuncTable[563] := FuncBorder; - FIdentFuncTable[2857] := FuncBottom; - FIdentFuncTable[2410] := FuncBreak; - FIdentFuncTable[223] := FuncButton; - FIdentFuncTable[575] := FuncByte; - FIdentFuncTable[3204] := FuncCall; - FIdentFuncTable[1125] := FuncCallee; - FIdentFuncTable[3049] := FuncCaller; - FIdentFuncTable[3037] := FuncCaptureevents; - FIdentFuncTable[2101] := FuncCase; - FIdentFuncTable[2105] := FuncCatch; - FIdentFuncTable[4662] := FuncCeil; - FIdentFuncTable[3938] := FuncChar; - FIdentFuncTable[3046] := FuncCharat; - FIdentFuncTable[3724] := FuncCharcodeat; - FIdentFuncTable[4522] := FuncCheckbox; - FIdentFuncTable[2127] := FuncChecked; - FIdentFuncTable[1908] := FuncClass; - FIdentFuncTable[417] := FuncClear; - FIdentFuncTable[4574] := FuncClearinterval; - FIdentFuncTable[2626] := FuncCleartimeout; - FIdentFuncTable[55] := FuncClick; - FIdentFuncTable[3783] := FuncClose; - FIdentFuncTable[3615] := FuncClosed; - FIdentFuncTable[1688] := FuncColor; - FIdentFuncTable[2712] := FuncComplete; - FIdentFuncTable[2889] := FuncConcat; - FIdentFuncTable[3503] := FuncConfirm; - FIdentFuncTable[820] := FuncConst; - FIdentFuncTable[3079] := FuncConstructor; - FIdentFuncTable[3092] := FuncContinue; - FIdentFuncTable[4022] := FuncCookie; - FIdentFuncTable[4452] := FuncCos; - FIdentFuncTable[1188] := FuncCurrent; - FIdentFuncTable[1955] := FuncDate; - FIdentFuncTable[1095] := FuncDebugger; - FIdentFuncTable[1389] := FuncDefault; - FIdentFuncTable[2881] := FuncDefaultchecked; - FIdentFuncTable[2879] := FuncDefaultselected; - FIdentFuncTable[3607] := FuncDefaultstatus; - FIdentFuncTable[1234] := FuncDefaultvalue; - FIdentFuncTable[214] := FuncDelete; - FIdentFuncTable[1929] := FuncDescription; - FIdentFuncTable[1046] := FuncDisplay; - FIdentFuncTable[748] := FuncDo; - FIdentFuncTable[5075] := FuncDocument; - FIdentFuncTable[4671] := FuncDomain; - FIdentFuncTable[4176] := FuncDouble; - FIdentFuncTable[5059] := FuncE; - FIdentFuncTable[581] := FuncElements; - FIdentFuncTable[4413] := FuncElse; - FIdentFuncTable[2919] := FuncEmbed; - FIdentFuncTable[2346] := FuncEmbeds; - FIdentFuncTable[3190] := FuncEnabledplugin; - FIdentFuncTable[4627] := FuncEncoding; - FIdentFuncTable[3716] := FuncEnum; - FIdentFuncTable[1147] := FuncEscape; - FIdentFuncTable[1465] := FuncEval; - FIdentFuncTable[3807] := FuncEvent; - FIdentFuncTable[2060] := FuncExp; - FIdentFuncTable[1298] := FuncExport; - FIdentFuncTable[1114] := FuncExtends; - FIdentFuncTable[1069] := FuncFalse; - FIdentFuncTable[4097] := FuncFgcolor; - FIdentFuncTable[2508] := FuncFilename; - FIdentFuncTable[271] := FuncFileupload; - FIdentFuncTable[3365] := FuncFinal; - FIdentFuncTable[587] := FuncFinally; - FIdentFuncTable[2843] := FuncFind; - FIdentFuncTable[931] := FuncFixed; - FIdentFuncTable[1921] := FuncFloat; - FIdentFuncTable[730] := FuncFloat2; - FIdentFuncTable[1491] := FuncFloor; - FIdentFuncTable[4111] := FuncFocus; - FIdentFuncTable[4774] := FuncFontcolor; - FIdentFuncTable[4932] := FuncFontsize; - FIdentFuncTable[407] := FuncFor; - FIdentFuncTable[2968] := FuncForm; - FIdentFuncTable[4469] := FuncForm; - FIdentFuncTable[2370] := FuncForms; - FIdentFuncTable[1279] := FuncForward; - FIdentFuncTable[4402] := FuncFrame; - FIdentFuncTable[2522] := FuncFrames; - FIdentFuncTable[3737] := FuncFromcharcode; - FIdentFuncTable[2666] := FuncFunction; - FIdentFuncTable[1982] := FuncFunction2; - FIdentFuncTable[1111] := FuncGetdate; - FIdentFuncTable[1176] := FuncGetday; - FIdentFuncTable[553] := FuncGetelementbyid; - FIdentFuncTable[966] := FuncGetfullyear; - FIdentFuncTable[2918] := FuncGethours; - FIdentFuncTable[1735] := FuncGetmilliseconds; - FIdentFuncTable[3823] := FuncGetminutes; - FIdentFuncTable[4549] := FuncGetmonth; - FIdentFuncTable[978] := FuncGetseconds; - FIdentFuncTable[1102] := FuncGettime; - FIdentFuncTable[4707] := FuncGettimezoneoffset; - FIdentFuncTable[4493] := FuncGetutcdate; - FIdentFuncTable[3536] := FuncGetutcday; - FIdentFuncTable[5080] := FuncGetutcfullyear; - FIdentFuncTable[671] := FuncGetutchours; - FIdentFuncTable[1795] := FuncGetutcmilliseconds; - FIdentFuncTable[974] := FuncGetutcminutes; - FIdentFuncTable[2302] := FuncGetutcmonth; - FIdentFuncTable[3282] := FuncGetutcseconds; - FIdentFuncTable[2212] := FuncGetyear; - FIdentFuncTable[2940] := FuncGlobal; - FIdentFuncTable[4400] := FuncGo; - FIdentFuncTable[4552] := FuncGoto; - FIdentFuncTable[269] := FuncHandleevent; - FIdentFuncTable[2358] := FuncHash; - FIdentFuncTable[380] := FuncHeight; - FIdentFuncTable[911] := FuncHidden; - FIdentFuncTable[2645] := FuncHistory; - FIdentFuncTable[1710] := FuncHistory; - FIdentFuncTable[3710] := FuncHome; - FIdentFuncTable[2928] := FuncHost; - FIdentFuncTable[3996] := FuncHostname; - FIdentFuncTable[2246] := FuncHref; - FIdentFuncTable[991] := FuncHspace; - FIdentFuncTable[3785] := FuncIf; - FIdentFuncTable[1177] := FuncImage; - FIdentFuncTable[1997] := FuncImages; - FIdentFuncTable[706] := FuncImplements; - FIdentFuncTable[3582] := FuncImport; - FIdentFuncTable[4969] := FuncIn; - FIdentFuncTable[1137] := FuncIndex; - FIdentFuncTable[656] := FuncIndexof; - FIdentFuncTable[4918] := FuncInfinity; - FIdentFuncTable[5096] := FuncInnerheight; - FIdentFuncTable[5008] := FuncInnerwidth; - FIdentFuncTable[999] := FuncInput; - FIdentFuncTable[3585] := FuncInstanceof; - FIdentFuncTable[545] := FuncInt; - FIdentFuncTable[124] := FuncInterface; - FIdentFuncTable[2465] := FuncIsfinite; - FIdentFuncTable[1266] := FuncIsnan; - FIdentFuncTable[1711] := FuncItalics; - FIdentFuncTable[963] := FuncJava; - FIdentFuncTable[4225] := FuncJavaenabled; - FIdentFuncTable[3229] := FuncJoin; - FIdentFuncTable[2913] := FuncLastindexof; - FIdentFuncTable[2778] := FuncLastmodified; - FIdentFuncTable[3139] := FuncLayer; - FIdentFuncTable[2021] := FuncLayers; - FIdentFuncTable[2770] := FuncLeft; - FIdentFuncTable[1083] := FuncLength; - FIdentFuncTable[4263] := FuncLink; - FIdentFuncTable[611] := FuncLink; - FIdentFuncTable[2947] := FuncLinkcolor; - FIdentFuncTable[3943] := FuncLinks; - FIdentFuncTable[986] := FuncLn10; - FIdentFuncTable[5149] := FuncLn2; - FIdentFuncTable[4694] := FuncLocation; - FIdentFuncTable[2489] := FuncLocation; - FIdentFuncTable[3213] := FuncLocationbar; - FIdentFuncTable[2812] := FuncLog; - FIdentFuncTable[3420] := FuncLog10e; - FIdentFuncTable[3346] := FuncLog2e; - FIdentFuncTable[3808] := FuncLogon; - FIdentFuncTable[1030] := FuncLong; - FIdentFuncTable[2430] := FuncLowsrc; - FIdentFuncTable[830] := FuncMatch; - FIdentFuncTable[1454] := FuncMath; - FIdentFuncTable[4163] := FuncMax; - FIdentFuncTable[962] := FuncMax_value; - FIdentFuncTable[165] := FuncMenubar; - FIdentFuncTable[1767] := FuncMethod; - FIdentFuncTable[2068] := FuncMimetype; - FIdentFuncTable[568] := FuncMimetypes; - FIdentFuncTable[398] := FuncMin; - FIdentFuncTable[1580] := FuncMin_value; - FIdentFuncTable[3868] := FuncMoveby; - FIdentFuncTable[3688] := FuncMoveto; - FIdentFuncTable[147] := FuncName; - FIdentFuncTable[624] := FuncNan; - FIdentFuncTable[709] := FuncNative; - FIdentFuncTable[3619] := FuncNavigator; - FIdentFuncTable[1798] := FuncNavigator; - FIdentFuncTable[2749] := FuncNegative_infinity; - FIdentFuncTable[2232] := FuncNetscape; - FIdentFuncTable[4150] := FuncNew; - FIdentFuncTable[3691] := FuncNext; - FIdentFuncTable[3186] := FuncNull; - FIdentFuncTable[4687] := FuncNull2; - FIdentFuncTable[811] := FuncNumber; - FIdentFuncTable[655] := FuncObject; - FIdentFuncTable[4718] := FuncOnabort; - FIdentFuncTable[3216] := FuncOnblur; - FIdentFuncTable[4506] := FuncOnchange; - FIdentFuncTable[4236] := FuncOnclick; - FIdentFuncTable[1962] := FuncOndblclick; - FIdentFuncTable[3283] := FuncOnerror; - FIdentFuncTable[1618] := FuncOnfocus; - FIdentFuncTable[2711] := FuncOnkeydown; - FIdentFuncTable[698] := FuncOnkeypress; - FIdentFuncTable[2845] := FuncOnkeyup; - FIdentFuncTable[9] := FuncOnload; - FIdentFuncTable[1175] := FuncOnmousedown; - FIdentFuncTable[1116] := FuncOnmousemove; - FIdentFuncTable[720] := FuncOnmouseout; - FIdentFuncTable[356] := FuncOnmouseover; - FIdentFuncTable[2930] := FuncOnmouseup; - FIdentFuncTable[1494] := FuncOnreset; - FIdentFuncTable[1591] := FuncOnselect; - FIdentFuncTable[233] := FuncOnsubmit; - FIdentFuncTable[1527] := FuncOnunload; - FIdentFuncTable[309] := FuncOpen; - FIdentFuncTable[3742] := FuncOpener; - FIdentFuncTable[3624] := FuncOption; - FIdentFuncTable[3038] := FuncOptions; - FIdentFuncTable[3129] := FuncOuterheight; - FIdentFuncTable[617] := FuncOuterwidth; - FIdentFuncTable[1183] := FuncPackage; - FIdentFuncTable[4634] := FuncPackages; - FIdentFuncTable[4499] := FuncPagex; - FIdentFuncTable[1543] := FuncPagexoffset; - FIdentFuncTable[4647] := FuncPagey; - FIdentFuncTable[4043] := FuncPageyoffset; - FIdentFuncTable[4818] := FuncParent; - FIdentFuncTable[2306] := FuncParse; - FIdentFuncTable[2092] := FuncParsefloat; - FIdentFuncTable[2800] := FuncParseint; - FIdentFuncTable[756] := FuncPassword; - FIdentFuncTable[1065] := FuncPathname; - FIdentFuncTable[433] := FuncPersonalbar; - FIdentFuncTable[3413] := FuncPi; - FIdentFuncTable[4421] := FuncPlatform; - FIdentFuncTable[4802] := FuncPlugin; - FIdentFuncTable[3917] := FuncPlugins; - FIdentFuncTable[3630] := FuncPort; - FIdentFuncTable[4426] := FuncPositive_infinity; - FIdentFuncTable[5137] := FuncPow; - FIdentFuncTable[4810] := FuncPrevious; - FIdentFuncTable[602] := FuncPrint; - FIdentFuncTable[958] := FuncPrivate; - FIdentFuncTable[3968] := FuncPrompt; - FIdentFuncTable[1326] := FuncProtected; - FIdentFuncTable[1815] := FuncProtocol; - FIdentFuncTable[4437] := FuncPrototype; - FIdentFuncTable[3260] := FuncPublic; - FIdentFuncTable[1600] := FuncRadio; - FIdentFuncTable[2803] := FuncRandom; - FIdentFuncTable[2045] := FuncReferrer; - FIdentFuncTable[2270] := FuncRefresh; - FIdentFuncTable[4495] := FuncRegexp; - FIdentFuncTable[2008] := FuncReleaseevents; - FIdentFuncTable[4401] := FuncReload; - FIdentFuncTable[1148] := FuncReplace; - FIdentFuncTable[3987] := FuncReset; - FIdentFuncTable[2796] := FuncReset; - FIdentFuncTable[4116] := FuncResizeby; - FIdentFuncTable[3936] := FuncResizeto; - FIdentFuncTable[1610] := FuncReturn; - FIdentFuncTable[3457] := FuncReverse; - FIdentFuncTable[1857] := FuncRight; - FIdentFuncTable[4450] := FuncRound; - FIdentFuncTable[5041] := FuncRouteevent; - FIdentFuncTable[100] := FuncScreen; - FIdentFuncTable[3727] := FuncScroll; - FIdentFuncTable[3112] := FuncScrollbars; - FIdentFuncTable[195] := FuncScrollby; - FIdentFuncTable[15] := FuncScrollto; - FIdentFuncTable[4544] := FuncSearch; - FIdentFuncTable[1271] := FuncSelect; - FIdentFuncTable[2532] := FuncSelect; - FIdentFuncTable[2708] := FuncSelected; - FIdentFuncTable[5089] := FuncSelectedindex; - FIdentFuncTable[2283] := FuncSelf; - FIdentFuncTable[4756] := FuncSetdate; - FIdentFuncTable[517] := FuncSetfullyear; - FIdentFuncTable[4389] := FuncSethours; - FIdentFuncTable[2365] := FuncSetinterval; - FIdentFuncTable[1057] := FuncSetmilliseconds; - FIdentFuncTable[2377] := FuncSetminutes; - FIdentFuncTable[867] := FuncSetmonth; - FIdentFuncTable[4685] := FuncSetseconds; - FIdentFuncTable[4747] := FuncSettime; - FIdentFuncTable[1862] := FuncSettimeout; - FIdentFuncTable[3047] := FuncSetutcdate; - FIdentFuncTable[5010] := FuncSetutcfullyear; - FIdentFuncTable[222] := FuncSetutchours; - FIdentFuncTable[2284] := FuncSetutcmilliseconds; - FIdentFuncTable[5073] := FuncSetutcminutes; - FIdentFuncTable[3374] := FuncSetutcmonth; - FIdentFuncTable[707] := FuncSetutcseconds; - FIdentFuncTable[2225] := FuncSetyear; - FIdentFuncTable[3661] := FuncShort; - FIdentFuncTable[2910] := FuncSin; - FIdentFuncTable[523] := FuncSlice; - FIdentFuncTable[1345] := FuncSmall; - FIdentFuncTable[3822] := FuncSort; - FIdentFuncTable[239] := FuncSplit; - FIdentFuncTable[1224] := FuncSqrt; - FIdentFuncTable[4716] := FuncSqrt1_2; - FIdentFuncTable[3194] := FuncSqrt2; - FIdentFuncTable[1932] := FuncSrc; - FIdentFuncTable[482] := FuncStart; - FIdentFuncTable[684] := FuncStatic; - FIdentFuncTable[2201] := FuncStatus; - FIdentFuncTable[1836] := FuncStatusbar; - FIdentFuncTable[3389] := FuncStop; - FIdentFuncTable[4740] := FuncStrike; - FIdentFuncTable[4796] := FuncString; - FIdentFuncTable[1006] := FuncStyle; - FIdentFuncTable[283] := FuncSub; - FIdentFuncTable[5066] := FuncSubmit; - FIdentFuncTable[1174] := FuncSubmit; - FIdentFuncTable[3496] := FuncSubstr; - FIdentFuncTable[2071] := FuncSubstring; - FIdentFuncTable[4785] := FuncSuffixes; - FIdentFuncTable[2355] := FuncSup; - FIdentFuncTable[4953] := FuncSuper; - FIdentFuncTable[3170] := FuncSwitch; - FIdentFuncTable[4968] := FuncSynchronized; - FIdentFuncTable[4084] := FuncTags; - FIdentFuncTable[2789] := FuncTaint; - FIdentFuncTable[215] := FuncTaintenabled; - FIdentFuncTable[3896] := FuncTan; - FIdentFuncTable[5087] := FuncTarget; - FIdentFuncTable[4075] := FuncText; - FIdentFuncTable[4055] := FuncText; - FIdentFuncTable[2681] := FuncTextarea; - FIdentFuncTable[2382] := FuncThis; - FIdentFuncTable[4217] := FuncThrow; - FIdentFuncTable[2507] := FuncThrows; - FIdentFuncTable[1027] := FuncTitle; - FIdentFuncTable[2422] := FuncTogmtstring; - FIdentFuncTable[4448] := FuncTolocalestring; - FIdentFuncTable[857] := FuncTolowercase; - FIdentFuncTable[4611] := FuncToolbar; - FIdentFuncTable[4058] := FuncTop; - FIdentFuncTable[983] := FuncTosource; - FIdentFuncTable[3962] := FuncTostring; - FIdentFuncTable[4977] := FuncTouppercase; - FIdentFuncTable[2536] := FuncToutcstring; - FIdentFuncTable[4990] := FuncTransient; - FIdentFuncTable[1928] := FuncTrue; - FIdentFuncTable[3889] := FuncTry; - FIdentFuncTable[3925] := FuncType; - FIdentFuncTable[3121] := FuncTypeof; - FIdentFuncTable[4305] := FuncUndefined; - FIdentFuncTable[2484] := FuncUndefined; - FIdentFuncTable[3518] := FuncUnescape; - FIdentFuncTable[4070] := FuncUntaint; - FIdentFuncTable[836] := FuncUnwatch; - FIdentFuncTable[3893] := FuncUrl; - FIdentFuncTable[747] := FuncUseragent; - FIdentFuncTable[3278] := FuncUtc; - FIdentFuncTable[1621] := FuncValue; - FIdentFuncTable[5048] := FuncValueof; - FIdentFuncTable[1890] := FuncVar; - FIdentFuncTable[910] := FuncVisibility; - FIdentFuncTable[2454] := FuncVlinkcolor; - FIdentFuncTable[996] := FuncVoid; - FIdentFuncTable[418] := FuncVspace; - FIdentFuncTable[4708] := FuncWatch; - FIdentFuncTable[3178] := FuncWhile; - FIdentFuncTable[1729] := FuncWidth; - FIdentFuncTable[2916] := FuncWindow; - FIdentFuncTable[4177] := FuncWindow; - FIdentFuncTable[4646] := FuncWith; - FIdentFuncTable[519] := FuncWrite; - FIdentFuncTable[4841] := FuncWriteln; - FIdentFuncTable[4030] := FuncZindex; -end; - -function TSynJScriptSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAbs(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAbstract(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAcos(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAction(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAlert(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAlign(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAlinkcolor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAll(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAnchor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAnchors(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAppcodename(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncApplet(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncApplets(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAppname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAppversion(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncArea(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncArguments(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncArray(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAsin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAtan(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncAtan2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBack(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBackground(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBgcolor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBig(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBlink(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBlur(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBody(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBold(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBoolean(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBoolean2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - - -function TSynJScriptSyn.FuncBorder(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBottom(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncBreak(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncButton(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncByte(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCall(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCallee(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCaller(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCaptureevents(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCase(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCatch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCeil(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncChar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCharat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCharcodeat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCheckbox(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncChecked(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncClass(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncClear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncClearinterval(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCleartimeout(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncClick(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncClose(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncClosed(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncColor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncComplete(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncConcat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncConfirm(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncConst(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncConstructor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncContinue(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCookie(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCos(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncCurrent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDebugger(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDefault(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDefaultchecked(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDefaultselected(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDefaultstatus(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDefaultvalue(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDelete(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDescription(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDisplay(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDo(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDocument(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDomain(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncDouble(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncE(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncElements(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncElse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEmbed(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEmbeds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEnabledplugin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEncoding(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEnum(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEscape(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEval(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncEvent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncExp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncExport(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncExtends(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFalse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFgcolor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFilename(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFileupload(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFinal(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFinally(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFind(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFixed(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFloat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFloat2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFloor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFocus(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFontcolor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFontsize(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncForm(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncForms(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncForward(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFrame(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFrames(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFromcharcode(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFunction(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncFunction2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetdate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetday(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetelementbyid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetfullyear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGethours(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetmilliseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetminutes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetmonth(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGettime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGettimezoneoffset(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcdate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcday(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcfullyear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutchours(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcmilliseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcminutes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcmonth(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetutcseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGetyear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGlobal(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGo(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncGoto(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHandleevent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHash(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHeight(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHidden(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHistory(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHome(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHost(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHostname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHref(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncHspace(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncIf(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncImage(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncImages(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncImplements(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncImport(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncIn(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncIndex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncIndexof(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInfinity(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInnerheight(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInnerwidth(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInput(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInstanceof(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncInterface(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncIsfinite(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncIsnan(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncItalics(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncJava(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncJavaenabled(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncJoin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLastindexof(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLastmodified(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLayer(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLayers(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLeft(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLength(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLink(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLinkcolor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLinks(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLn10(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLn2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLocation(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLocationbar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLog(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLog10e(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLog2e(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLogon(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLong(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncLowsrc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMatch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMath(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMax(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMax_value(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMenubar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMethod(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMimetype(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMimetypes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMin_value(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMoveby(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncMoveto(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncName(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNan(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNative(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNavigator(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNegative_infinity(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNetscape(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNew(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNext(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNull(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNull2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncNumber(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncObject(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnabort(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnblur(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnchange(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnclick(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOndblclick(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnerror(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnfocus(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnkeydown(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnkeypress(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnkeyup(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnload(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnmousedown(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnmousemove(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnmouseout(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnmouseover(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnmouseup(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnreset(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnselect(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnsubmit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOnunload(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkEvent - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOpen(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOpener(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOption(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOptions(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOuterheight(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncOuterwidth(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPackage(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPackages(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPagex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPagexoffset(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPagey(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPageyoffset(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncParent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncParse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncParsefloat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncParseint(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPassword(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPathname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPersonalbar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPi(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPlatform(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPlugin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPlugins(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPort(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPositive_infinity(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPow(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPrevious(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPrint(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPrivate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPrompt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncProtected(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncProtocol(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPrototype(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncPublic(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRadio(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRandom(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReferrer(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRefresh(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRegexp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReleaseevents(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReload(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReplace(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReset(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncResizeby(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncResizeto(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReturn(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncReverse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRight(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRound(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncRouteevent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncScreen(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncScroll(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncScrollbars(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncScrollby(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncScrollto(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSearch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSelect(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSelected(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSelectedindex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSelf(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetdate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetfullyear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSethours(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetinterval(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetmilliseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetminutes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetmonth(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSettime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSettimeout(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutcdate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutcfullyear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutchours(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutcmilliseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutcminutes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutcmonth(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetutcseconds(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSetyear(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncShort(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSlice(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSmall(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSort(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSplit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSqrt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSqrt1_2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSqrt2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSrc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStart(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStatic(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStatus(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStatusbar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStop(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStrike(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncString(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncStyle(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSub(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSubmit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSubstr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSubstring(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSuffixes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSup(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSuper(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSwitch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncSynchronized(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTags(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTaint(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTaintenabled(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTan(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTarget(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncText(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTextarea(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncThis(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncThrow(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncThrows(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTitle(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTogmtstring(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTolocalestring(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTolowercase(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncToolbar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTop(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTosource(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTostring(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTouppercase(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncToutcstring(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTransient(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTrue(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTry(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncType(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncTypeof(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncUndefined(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncUnescape(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncUntaint(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncUnwatch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; - -function TSynJScriptSyn.FuncUrl(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; + SynUnicode, + Classes, +//++ CodeFolding + SynEditCodeFolding; +//++ CodeFolding -function TSynJScriptSyn.FuncUseragent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; -function TSynJScriptSyn.FuncUtc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; +type + TtkTokenKind = (tkSymbol, tkKey, tkComment, tkIdentifier, tkNull, tkNumber, tkSpace, + tkString, tkUnknown, tkNonReservedKey, tkEvent, tkSpecVar, tkTemplate); -function TSynJScriptSyn.FuncValue(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; + TRangeState = (rsUnknown, rsANSI, rsLiteral, rsLiteralTemplate); -function TSynJScriptSyn.FuncValueof(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; + PIdentFuncTableFunc = ^TIdentFuncTableFunc; + TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; -function TSynJScriptSyn.FuncVar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; +type +// TSynJScriptSyn = class(TSynCustomHighLighter) +//++ CodeFolding + TSynJScriptSyn = class(TSynCustomCodeFoldingHighlighter) +//-- CodeFolding + private + fRange: TRangeState; + fLiteralLevel: Integer; + FTokenID: TtkTokenKind; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNonReservedKeyAttri: TSynHighlighterAttributes; + fEventAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fSpecVarAttri: TSynHighlighterAttributes; + fTemplateAttri: TSynHighlighterAttributes; -function TSynJScriptSyn.FuncVisibility(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; + procedure AndSymbolProc; + procedure CommentProc; + procedure CRProc; + procedure IdentProc; + procedure LFProc; + procedure MinusProc; + procedure ModSymbolProc; + procedure NullProc; + procedure NumberProc; + procedure OrSymbolProc; + procedure PlusProc; + procedure PointProc; + procedure SlashProc; + procedure SpaceProc; + procedure StarProc; + procedure StringProc; + procedure LiteralsProc; + procedure LiteralsRangeProc; + procedure LiteralsTemplateRangeProc; + procedure SymbolProc; + procedure UnderScoreProc; + procedure UnknownProc; + protected + function GetSampleSource: string; override; + function IsFilterStored: Boolean; override; + public + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: string; override; + public + constructor Create(AOwner: TComponent); override; + function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: Integer; override; + function IsKeyword(const AKeyword: string): Boolean; override; + function IsEvent(const AKeyword: string): Boolean; + function IsNonReserwedKeyWord(const AKeyword: string): Boolean; + procedure Next; override; + procedure SetRange(Value: Pointer); override; + procedure ResetRange; override; +//++ CodeFolding + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; +//-- CodeFolding + published + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + { ths attribut will hghlight words start wth underscore } + property SpecVarAttri: TSynHighlighterAttributes read fSpecVarAttri + write fSpecVarAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NonReservedKeyAttri: TSynHighlighterAttributes read fNonReservedKeyAttri write fNonReservedKeyAttri; + property EventAttri: TSynHighlighterAttributes read fEventAttri write fEventAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri; + property TemplateAttri: TSynHighlighterAttributes read FTemplateAttri write FTemplateAttri; + end; -function TSynJScriptSyn.FuncVlinkcolor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; +implementation -function TSynJScriptSyn.FuncVoid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; +uses + SynEditStrConst; -function TSynJScriptSyn.FuncVspace(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; +const + // IMPORTANT!!! Cause JavaScript is case sensitive, list must be sorted by ASCII values + NonReserwedKeyWords: array[0..317] of string = ( + 'All', 'Anchor', 'Applet', 'Area', 'Arguments', 'Array', 'Boolean', + 'Button', 'Checkbox', 'Date', 'E', 'Embed', 'FileUpload', 'Float', + 'Form', 'Frame', 'Function', 'Global', 'Hidden', 'History', 'Image', + 'Infinity', 'LN10', 'LN2', 'LOG10E', 'LOG2E', 'Layer', 'Link', + 'Location', 'MAX_VALUE', 'MIN_VALUE', 'Math', 'MimeType', + 'NEGATIVE_INFINITY', 'Navigator', 'Null', 'Number', 'Object', + 'Option', 'PI', 'POSITIVE_INFINITY', 'Packages', 'Password', 'Plugin', + 'Radio', 'RegExp', 'Reset', 'SQRT1_2', 'SQRT2', 'Select', 'String', + 'Submit', 'Text', 'Textarea', 'URL', 'UTC', 'Undefined', 'Window', + 'abs', 'acos', 'action', 'alert', 'align', 'alinkColor', 'all', + 'anchor', 'anchors', 'appCodeName', 'appName', 'appVersion', + 'applets', 'arguments', 'asin', 'atan', 'atan2', 'await', 'back', + 'background', 'bgColor', 'big', 'blink', 'blur', 'body', 'bold', + 'border', 'bottom', 'call', 'caller', 'captureEvents', 'ceil', + 'charAt', 'charCodeAt', 'checked', 'clear', 'clearInterval', + 'clearTimeout', 'click', 'close', 'closed', 'color', 'complete', + 'concat', 'confirm', 'cookie', 'cos', 'current', 'defaultChecked', + 'defaultSelected', 'defaultStatus', 'defaultValue', 'description', + 'display', 'document', 'domain', 'elements', 'embeds', + 'enabledPlugin', 'encoding', 'escape', 'eval', 'event', 'exp', + 'fgColor', 'filename', 'find', 'fixed', 'floor', 'focus', 'fontcolor', + 'fontsize', 'form', 'forms', 'forward', 'frames', 'fromCharCode', + 'getDate', 'getDay', 'getElementById', 'getFullYear', 'getHours', + 'getMilliseconds', 'getMinutes', 'getMonth', 'getSeconds', 'getTime', + 'getTimezoneOffset', 'getUTCDate', 'getUTCDay', 'getUTCFullYear', + 'getUTCHours', 'getUTCMilliseconds', 'getUTCMinutes', 'getUTCMonth', + 'getUTCSeconds', 'getYear', 'go', 'handleEvent', 'hash', 'height', + 'history', 'home', 'host', 'hostname', 'href', 'hspace', 'images', + 'index', 'indexOf', 'innerHeight', 'innerWidth', 'input', 'isFinite', + 'isNaN', 'italics', 'java', 'javaEnabled', 'join', 'lastIndexOf', + 'lastModified', 'layers', 'left', 'length', 'let', 'link', + 'linkColor', 'links', 'location', 'locationbar', 'log', 'logon', + 'lowsrc', 'match', 'max', 'menubar', 'method', 'mimeTypes', 'min', + 'moveBy', 'moveTo', 'name', 'navigator', 'netscape', 'next', 'open', + 'opener', 'options', 'outerHeight', 'outerWidth', 'pageX', + 'pageXOffset', 'pageY', 'pageYOffset', 'parent', 'parse', + 'parseFloat', 'parseInt', 'pathname', 'personalbar', 'platform', + 'plugins', 'port', 'pow', 'previous', 'print', 'prompt', 'protocol', + 'random', 'referrer', 'refresh', 'releaseEvents', 'reload', 'replace', + 'reset', 'resizeBy', 'resizeTo', 'reverse', 'right', 'round', + 'routeEvent', 'screen', 'scroll', 'scrollBy', 'scrollTo', + 'scrollbars', 'search', 'select', 'selected', 'selectedIndex', 'self', + 'setDate', 'setFullYear', 'setHours', 'setInterval', + 'setMilliseconds', 'setMinutes', 'setMonth', 'setSeconds', 'setTime', + 'setTimeout', 'setUTCDate', 'setUTCFullYear', 'setUTCHours', + 'setUTCMilliseconds', 'setUTCMinutes', 'setUTCMonth', 'setUTCSeconds', + 'setYear', 'sin', 'slice', 'small', 'sort', 'split', 'sqrt', 'src', + 'status', 'statusbar', 'stop', 'strike', 'style', 'sub', 'submit', + 'substr', 'substring', 'suffixes', 'sup', 'tags', 'taint', + 'taintEnabled', 'tan', 'target', 'text', 'title', 'toGMTString', + 'toLocaleString', 'toLowerCase', 'toSource', 'toString', + 'toUTCString', 'toUpperCase', 'toolbar', 'top', 'type', 'undefined', + 'unescape', 'untaint', 'unwatch', 'userAgent', 'value', 'valueOf', + 'visibility', 'vlinkColor', 'vspace', 'watch', 'width', 'window', + 'write', 'writeln', 'zIndex' + ); -function TSynJScriptSyn.FuncWatch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; + KeyWords: array[0..61] of string = ( + 'abstract', 'boolean', 'break', 'byte', 'callee', 'case', + 'catch', 'char', 'const', 'constructor', 'continue', + 'debugger', 'default', 'delete', 'do', 'double', 'else', + 'enum', 'export', 'extends', 'false', 'final', 'finally', + 'float', 'for', 'function', 'goto', 'if', 'implements', + 'import', 'in', 'instanceof', 'int', 'interface', 'long', + 'NaN', 'native', 'new', 'null', 'package', 'private', + 'protected', 'prototype', 'public', 'return', 'short', + 'start', 'static', 'super', 'switch', 'synchronized', + 'this', 'throw', 'throws', 'transient', 'true', 'try', + 'typeof', 'var', 'void', 'while', 'with' + ); -function TSynJScriptSyn.FuncWhile(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; + Events: array[0..19] of string = ( + 'onAbort', 'onBlur', 'onChange', 'onClick', 'onDblClick', + 'onError', 'onFocus', 'onKeyDown', 'onKeyPress', 'onKeyUp', + 'onLoad', 'onMouseDown', 'onMouseMove', 'onMouseOut', + 'onMouseOver', 'onMouseUp', 'onReset', 'onSelect', + 'onSubmit', 'onUnload' + ); -function TSynJScriptSyn.FuncWidth(Index: Integer): TtkTokenKind; +function TSynJScriptSyn.IsKeyword(const AKeyword: string): Boolean; +var + First, Last, I, Compare: Integer; begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; + First := 0; + Last := High(Keywords); + Result := False; -function TSynJScriptSyn.FuncWindow(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; + while First <= Last do + begin + I := (First + Last) shr 1; + Compare := CompareStr(Keywords[I], AKeyWord); + if Compare = 0 then + begin + Result := True; + Break; + end + else + if Compare < 0 then First := I + 1 else Last := I - 1; + end; end; -function TSynJScriptSyn.FuncWith(Index: Integer): TtkTokenKind; +function TSynJScriptSyn.IsEvent(const AKeyword: string): Boolean; +var + First, Last, I, Compare: Integer; begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; + First := 0; + Last := High(Events); + Result := False; -function TSynJScriptSyn.FuncWrite(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; + while First <= Last do + begin + I := (First + Last) shr 1; + Compare := CompareStr(Events[I], AKeyWord); + if Compare = 0 then + begin + Result := True; + Break; + end + else + if Compare < 0 then First := I + 1 else Last := I - 1; + end; end; -function TSynJScriptSyn.FuncWriteln(Index: Integer): TtkTokenKind; +function TSynJScriptSyn.IsNonReserwedKeyWord(const AKeyword: string): Boolean; +var + First, Last, I, Compare: Integer; begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; -end; + First := 0; + Last := High(NonReserwedKeyWords); + Result := False; -function TSynJScriptSyn.FuncZindex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkNonReservedKey - else - Result := tkIdentifier; + while First <= Last do + begin + I := (First + Last) shr 1; + Compare := CompareStr(NonReserwedKeyWords[I], AKeyWord); + if Compare = 0 then + begin + Result := True; + Break; + end + else + if Compare < 0 then First := I + 1 else Last := I - 1; + end; end; constructor TSynJScriptSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := True; - - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); - FNonReservedKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); - AddAttribute(FNonReservedKeyAttri); - FEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrEvent, SYNS_FriendlyAttrEvent); - AddAttribute(FEventAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); + fLiteralLevel := 0; + fCaseSensitive := True; + + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + AddAttribute(fCommentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fSpecVarAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpecialVariable, SYNS_FriendlyAttrSpecialVariable); + AddAttribute(fSpecVarAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); + fNonReservedKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); + AddAttribute(fNonReservedKeyAttri); + fEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrEvent, SYNS_FriendlyAttrEvent); + AddAttribute(fEventAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); + fTemplateAttri := TSynHighlighterAttributes.Create(SYNS_AttrTemplate, SYNS_FriendlyAttrTemplate); + AddAttribute(fTemplateAttri); SetAttributesOnChange(DefHighlightChange); - InitIdent; - FDefaultFilter := SYNS_FilterJScript; - FRange := rsUnknown; + fDefaultFilter := SYNS_FilterJScript; + fRange := rsUnknown; end; procedure TSynJScriptSyn.AndSymbolProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '&']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '&']) then Inc(Run); end; procedure TSynJScriptSyn.CommentProc; begin - if FLine[Run] = #0 then - NullProc - else + if fLine[Run] = #0 then + NullProc + else begin - FTokenID := tkComment; + fTokenID := tkComment; repeat - if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then + if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then begin - FRange := rsUnknown; + fRange := rsUnKnown; Inc(Run, 2); Break; end; @@ -4468,41 +368,123 @@ procedure TSynJScriptSyn.CommentProc; procedure TSynJScriptSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then Inc(Run); + if fLine[Run] = #10 then Inc(Run); end; procedure TSynJScriptSyn.IdentProc; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do Inc(Run); + while IsIdentChar(fLine[Run]) do Inc(Run); + if IsEvent(GetToken) then + begin + fTokenId := tkEvent; + end + else + if IsKeyWord(GetToken) then + begin + fTokenId := tkKey; + end + else + if IsNonReserwedKeyWord(GetToken) then + fTokenId := tkNonReservedKey + else + fTokenId := tkIdentifier; end; procedure TSynJScriptSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynJScriptSyn.LiteralsProc; +begin + fTokenID := tkString; + fRange := rsLiteral; Inc(Run); + if not IsLineEnd(Run) then + LiteralsRangeProc; +end; + +procedure TSynJScriptSyn.LiteralsRangeProc; +var + OK: Boolean; + myLit: Boolean; +begin + case fLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + fTokenID := tkString; + + repeat + ok := (FLine[Run] = '`') and ((Run = 0) or (FLine[Pred(Run)] <> '\')); + myLit := (FLine[Run] = '$') and (FLine[Run + 1] = '{'); + if myLit then + begin + Inc(fLiteralLevel); + fRange := rsLiteralTemplate; + Break; + end; + if OK then + begin + Inc(Run); + fRange := rsUnKnown; + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; +end; + +procedure TSynJScriptSyn.LiteralsTemplateRangeProc; +var + OK: Boolean; +begin + case fLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + fTokenID := tkTemplate; + if (FLine[Run] = '$') and (FLine[Run+1] = '{') then + Inc(Run, 2); + + repeat + ok := (FLine[Run] = '}'); + { end of Template = switch back to Literal } + if OK then + begin + Dec(fLiteralLevel); + Inc(Run); + fRange := rsLiteral; + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; + end; procedure TSynJScriptSyn.MinusProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '-', '>']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '-', '>']) then Inc(Run); end; procedure TSynJScriptSyn.ModSymbolProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if FLine[Run] = '=' then Inc(Run); + if fLine[Run] = '=' then Inc(Run); end; procedure TSynJScriptSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -4510,7 +492,7 @@ procedure TSynJScriptSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', 'a'..'f', 'A'..'F', 'x', 'X': Result := True; else @@ -4520,7 +502,7 @@ procedure TSynJScriptSyn.NumberProc; function IsHexChar(Run: Integer): Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', 'a'..'f', 'A'..'F': Result := True; else @@ -4532,7 +514,7 @@ procedure TSynJScriptSyn.NumberProc; idx1: Integer; // token[1] isHex: Boolean; begin - FTokenID := tkNumber; + fTokenID := tkNumber; isHex := False; idx1 := Run; Inc(Run); @@ -4560,42 +542,44 @@ procedure TSynJScriptSyn.NumberProc; procedure TSynJScriptSyn.OrSymbolProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '|']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '|']) then Inc(Run); end; procedure TSynJScriptSyn.PlusProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '+']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '+']) then Inc(Run); end; procedure TSynJScriptSyn.PointProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if (FLine[Run] = '.') and (FLine[Run + 1] = '.') then Inc(Run, 2); + if (fLine[Run] = '.') and (fLine[Run + 1] = '.') then Inc(Run, 2); end; procedure TSynJScriptSyn.SlashProc; begin Inc(Run); - case FLine[Run] of + { we should handle escaped slash \// } + if (Run > 1) and (FLine[run-2] <> '\') or (Run=1) then + case fLine[Run] of '/': begin - FTokenID := tkComment; + fTokenID := tkComment; repeat Inc(Run); until IsLineEnd(Run); end; '*': begin - FTokenID := tkComment; - FRange := rsAnsi; + fTokenID := tkComment; + fRange := rsAnsi; repeat Inc(Run); - if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then begin - FRange := rsUnknown; + if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then begin + fRange := rsUnKnown; Inc(Run, 2); Break; end; @@ -4603,39 +587,46 @@ procedure TSynJScriptSyn.SlashProc; end; '=': begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; procedure TSynJScriptSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynJScriptSyn.StarProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if FLine[Run] = '=' then Inc(Run); + if fLine[Run] = '=' then Inc(Run); end; procedure TSynJScriptSyn.StringProc; var - l_strChar: UnicodeString; + l_strChar: WideChar; + IsEscaped: Boolean; begin - FTokenID := tkString; + fTokenID := tkString; l_strChar := FLine[Run]; // We could have '"' or #39 + { we will handle escaped quotes } + IsEscaped := False; if (FLine[Run + 1] = l_strChar) and (FLine[Run + 2] = l_strChar) then Inc(Run, 2); repeat - if IsLineEnd(Run) then - Break; + case FLine[Run] of + #0, #10, #13: Break; + '\': IsEscaped := not IsEscaped; + else + IsEscaped := False; + end; Inc(Run); - until (FLine[Run] = l_strChar) and (FLine[Pred(Run)] <> '\'); + until (FLine[Run] = l_strChar) and (FLine[Pred(Run)] <> '\') and not IsEscaped; if not IsLineEnd(Run) then Inc(Run); end; @@ -4643,25 +634,32 @@ procedure TSynJScriptSyn.StringProc; procedure TSynJScriptSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenId := tkSymbol; end; procedure TSynJScriptSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynJScriptSyn.Next; begin - FTokenPos := Run; - if FRange = rsANSI then + fTokenPos := Run; + if fRange = rsANSI then CommentProc else - case FLine[Run] of + if fRange = rsLiteralTemplate then + LiteralsTemplateRangeProc + else + if fRange = rsLiteral then + LiteralsRangeProc + else + case fLine[Run] of '&': AndSymbolProc; #13: CRProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; + 'A'..'Z', 'a'..'z': IdentProc; + '_': UnderscoreProc; #10: LFProc; '-': MinusProc; '%': ModSymbolProc; @@ -4676,6 +674,7 @@ procedure TSynJScriptSyn.Next; '"', #39: StringProc; '~', '{', '}', ',', '(', ')', '[', ']', '<', '>', ':', '?', ';', '!', '=': SymbolProc; + '`': LiteralsProc; else UnknownProc; end; inherited; @@ -4684,12 +683,12 @@ procedure TSynJScriptSyn.Next; function TSynJScriptSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -4697,73 +696,124 @@ function TSynJScriptSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttr function TSynJScriptSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynJScriptSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; function TSynJScriptSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynJScriptSyn.GetTokenAttribute: TSynHighlighterAttributes; begin case GetTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNonReservedKey: Result := FNonReservedKeyAttri; - tkEvent: Result := FEventAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FIdentifierAttri; + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNonReservedKey: Result := fNonReservedKeyAttri; + tkEvent: Result := fEventAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkSpecVar: Result := fSpecVarAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkTemplate: Result := FTemplateAttri; + tkUnknown: Result := fIdentifierAttri; else Result := nil; end; end; function TSynJScriptSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; procedure TSynJScriptSyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; +end; + +procedure TSynJScriptSyn.SetRange(Value: Pointer); +begin + fRange := TRangeState(Value); +end; + +function TSynJScriptSyn.IsFilterStored: Boolean; +begin + Result := fDefaultFilter <> SYNS_FilterJScript; +end; + +class function TSynJScriptSyn.GetLanguageName: string; +begin + Result := SYNS_LangJScript; +end; + +function TSynJScriptSyn.GetSampleSource: string; +begin + Result := '// Syntax highlighting'#13#10+ + 'function printNumber()'#13#10+ + '{'#13#10+ + ' var number = 1234;'#13#10+ + ' var x;'#13#10+ + ' document.write("The number is " + number);'#13#10+ + ' for (var i = 0; i <= number; i++)'#13#10+ + ' {'#13#10+ + ' x++;'#13#10+ + ' x--;'#13#10+ + ' x += 1.0;'#13#10+ + ' }'#13#10+ + ' i += @; // illegal character'#13#10+ + '}'#13#10+ + 'body.onLoad = printNumber;'; +end; + +class function TSynJScriptSyn.GetFriendlyLanguageName: string; +begin + Result := SYNS_FriendlyLangJScript; +end; + +procedure TSynJScriptSyn.UnderScoreProc; +begin + if (Run = 0) or not IsIdentChar(fLine[Run-1]) then + fTokenID := tkSpecVar + else + fTokenID := tkIdentifier; + Inc(Run); + while IsIdentChar(fLine[Run]) do Inc(Run); end; -{$IFDEF SYN_CodeFolding} +//++ CodeFolding procedure TSynJScriptSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; LinesToScan: TStrings; FromLine, ToLine: Integer); var - CurLine: String; + CurLine: string; Line: Integer; function LineHasChar(Line: Integer; character: char; - StartCol : Integer): boolean; // faster than Pos! + StartCol: Integer): boolean; // faster than Pos! var - i: Integer; + I: Integer; begin - result := false; + Result := False; for I := StartCol to Length(CurLine) do begin - if CurLine[i] = character then begin + if CurLine[I] = character then begin // Char must have proper highlighting (ignore stuff inside comments...) if GetHighlighterAttriAtRowCol(LinesToScan, Line, I) <> fCommentAttri then begin - result := true; - break; + Result := True; + Break; end; end; end; end; - function FindBraces(Line: Integer) : Boolean; - Var - Col : Integer; + function FindBraces(Line: Integer): Boolean; + var + Col: Integer; begin Result := False; @@ -4781,7 +831,7 @@ procedure TSynJScriptSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; Result := True; end; // Skip until a newline - break; + Break; end; end else if CurLine[col] = '}' then begin @@ -4793,15 +843,15 @@ procedure TSynJScriptSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; Result := True; end; // Skip until a newline - break; + Break; end; end; end; // for Col end; function FoldRegion(Line: Integer): Boolean; - Var - S : string; + var + S: string; begin Result := False; S := TrimLeft(CurLine); @@ -4852,49 +902,9 @@ procedure TSynJScriptSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; FoldRanges.NoFoldInfo(Line + 1); end; // while Line end; -{$ENDIF} - -procedure TSynJScriptSyn.SetRange(Value: Pointer); -begin - FRange := TRangeState(Value); -end; - -function TSynJScriptSyn.IsFilterStored: Boolean; -begin - Result := FDefaultFilter <> SYNS_FilterJScript; -end; - -class function TSynJScriptSyn.GetLanguageName: string; -begin - Result := SYNS_LangJScript; -end; - -function TSynJScriptSyn.GetSampleSource: UnicodeString; -begin - Result := '// Syntax highlighting'#13#10+ - 'function printNumber()'#13#10+ - '{'#13#10+ - ' var number = 1234;'#13#10+ - ' var x;'#13#10+ - ' document.write("The number is " + number);'#13#10+ - ' for (var i = 0; i <= number; i++)'#13#10+ - ' {'#13#10+ - ' x++;'#13#10+ - ' x--;'#13#10+ - ' x += 1.0;'#13#10+ - ' }'#13#10+ - ' i += @; // illegal character'#13#10+ - '}'#13#10+ - 'body.onLoad = printNumber;'; -end; +//-- CodeFolding -class function TSynJScriptSyn.GetFriendlyLanguageName: UnicodeString; -begin - Result := SYNS_FriendlyLangJScript; -end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynJScriptSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterJava.pas b/Ext/SynEdit/Source/SynHighlighterJava.pas index 2fc4a5d..cddb495 100644 --- a/Ext/SynEdit/Source/SynHighlighterJava.pas +++ b/Ext/SynEdit/Source/SynHighlighterJava.pas @@ -12,7 +12,7 @@ The Original Code is based on the DcjSynJava.pas file from the mwEdit component suite by Martin Waldenburg and other developers, the Initial Author of this file is Michael Trier. -Unicode translation by Maël Hörz. +Unicode translation by Maël Hörz. All Rights Reserved. Contributors to the SynEdit and mwEdit projects are listed in the @@ -27,13 +27,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterJava.pas,v 1.18.2.10 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a Java highlighter for SynEdit) @@ -53,12 +46,17 @@ interface Graphics, SynEditTypes, SynEditHighlighter, + Windows, + SysUtils, SynUnicode, - SysUtils, Classes; + Classes, +//++ CodeFolding + SynEditCodeFolding; +//++ CodeFolding type - TtkTokenKind = (tkComment, tkDocument, tkIdentifier, tkInvalid, tkKey, - tkNull, tkNumber, tkSpace, tkString, tkSymbol, tkUnknown); + TtkTokenKind = (tkSymbol, tkKey, tkComment, tkDocument, tkIdentifier, tkInvalid, + tkNull, tkNumber, tkSpace, tkString, tkUnknown); TxtkTokenKind = ( xtkAdd, xtkAddAssign, xtkAnd, xtkAndAssign, xtkAssign, xtkBitComplement, @@ -77,23 +75,26 @@ interface PIdentFuncTableFunc = ^TIdentFuncTableFunc; TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - TSynJavaSyn = class(TSynCustomHighlighter) +// TSynJavaSyn = class(TSynCustomHighlighter) +//++ CodeFolding + TSynJavaSyn = class(TSynCustomCodeFoldingHighlighter) +//-- CodeFolding private - FRange: TRangeState; + fRange: TRangeState; FRoundCount: Integer; FSquareCount: Integer; FTokenID: TtkTokenKind; FExtTokenID: TxtkTokenKind; - FIdentFuncTable: array[0..112] of TIdentFuncTableFunc; - FCommentAttri: TSynHighlighterAttributes; - FDocumentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FInvalidAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; + fIdentFuncTable: array[0..112] of TIdentFuncTableFunc; + fCommentAttri: TSynHighlighterAttributes; + fDocumentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fInvalidAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; function AltFunc(Index: Integer): TtkTokenKind; function KeyWordFunc(Index: Integer): TtkTokenKind; function HashKey(Str: PWideChar): Cardinal; @@ -136,12 +137,12 @@ TSynJavaSyn = class(TSynCustomHighlighter) procedure XOrSymbolProc; procedure UnknownProc; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function GetExtTokenID: TxtkTokenKind; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; @@ -156,24 +157,28 @@ TSynJavaSyn = class(TSynCustomHighlighter) procedure SetRange(Value: Pointer); override; procedure ResetRange; override; property ExtTokenID: TxtkTokenKind read GetExtTokenID; +//++ CodeFolding + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; +//-- CodeFolding published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property DocumentAttri: TSynHighlighterAttributes read FDocumentAttri - write FDocumentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri - write FInvalidAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property DocumentAttri: TSynHighlighterAttributes read fDocumentAttri + write fDocumentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri + write fInvalidAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; end; implementation @@ -182,7 +187,7 @@ implementation SynEditStrConst; const - KeyWords: array[0..51] of UnicodeString = ( + KeyWords: array[0..51] of string = ( 'abstract', 'assert', 'boolean', 'break', 'byte', 'case', 'catch', 'char', 'class', 'const', 'continue', 'default', 'do', 'double', 'else', 'extends', 'false', 'final', 'finally', 'float', 'for', 'goto', 'if', 'implements', @@ -211,7 +216,7 @@ function TSynJavaSyn.HashKey(Str: PWideChar): Cardinal; Inc(Str); end; Result := Result mod 113; - FStringLen := Str - FToIdent; + fStringLen := Str - fToIdent; end; {$Q+} @@ -219,10 +224,10 @@ function TSynJavaSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; @@ -231,13 +236,13 @@ procedure TSynJavaSyn.InitIdent; var i: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; + fIdentFuncTable[i] := AltFunc; - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if @FIdentFuncTable[i] = nil then - FIdentFuncTable[i] := KeyWordFunc; + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if @fIdentFuncTable[i] = nil then + fIdentFuncTable[i] := KeyWordFunc; end; function TSynJavaSyn.AltFunc(Index: Integer): TtkTokenKind; @@ -257,42 +262,43 @@ constructor TSynJavaSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := True; - - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - AddAttribute(FCommentAttri); - FDocumentAttri := TSynHighlighterAttributes.Create(SYNS_AttrDocumentation, SYNS_FriendlyAttrDocumentation); - FDocumentAttri.Style := [fsItalic]; - AddAttribute(FDocumentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrInvalidSymbol, SYNS_FriendlyAttrInvalidSymbol); - AddAttribute(FInvalidAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); - FRange := rsUnknown; + fCaseSensitive := True; + + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + AddAttribute(fCommentAttri); + fDocumentAttri := TSynHighlighterAttributes.Create(SYNS_AttrDocumentation, SYNS_FriendlyAttrDocumentation); + fDocumentAttri.Style := [fsItalic]; + AddAttribute(fDocumentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrInvalidSymbol, SYNS_FriendlyAttrInvalidSymbol); + AddAttribute(fInvalidAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + fSpaceAttri.Foreground := clWindow; + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); + fRange := rsUnknown; SetAttributesOnChange(DefHighlightChange); InitIdent; - FDefaultFilter := SYNS_FilterJava; + fDefaultFilter := SYNS_FilterJava; end; { Create } procedure TSynJavaSyn.CommentProc; begin - if FRange = rsComment then - FTokenID := tkComment + if fRange = rsComment then + fTokenID := tkComment else - FTokenID := tkDocument; + fTokenID := tkDocument; case FLine[Run] of #0: begin @@ -314,10 +320,10 @@ procedure TSynJavaSyn.CommentProc; while not IsLineEnd(Run) do case FLine[Run] of '*': - if FLine[Run + 1] = '/' then + if fLine[Run + 1] = '/' then begin Inc(Run, 2); - FRange := rsUnknown; + fRange := rsUnknown; Break; end else Inc(Run); @@ -331,19 +337,19 @@ procedure TSynJavaSyn.AndSymbolProc; '=': {and assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkAndAssign; end; '&': {conditional and} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkCondAnd; end; else {and} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkAnd; end; end; @@ -351,10 +357,10 @@ procedure TSynJavaSyn.AndSymbolProc; procedure TSynJavaSyn.AsciiCharProc; begin - FTokenID := tkString; + fTokenID := tkString; repeat if IsLineEnd(Run) then Break; - if FLine[Run] = #92 then + if fLine[Run] = #92 then Inc(Run); // backslash, if we have an escaped single character, skip to the next if not IsLineEnd(Run) then Inc(Run); //Add check here to prevent overrun from backslash being last char until FLine[Run] = #39; @@ -363,46 +369,45 @@ procedure TSynJavaSyn.AsciiCharProc; procedure TSynJavaSyn.AtSymbolProc; begin - FTokenID := tkInvalid; + fTokenID := tkInvalid; Inc(Run); end; procedure TSynJavaSyn.BraceCloseProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenId := tkSymbol; FExtTokenID := xtkBraceClose; end; procedure TSynJavaSyn.BraceOpenProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenId := tkSymbol; FExtTokenID := xtkBraceOpen; end; procedure TSynJavaSyn.CRProc; begin - FTokenID := tkSpace; - case FLine[Run + 1] of + fTokenID := tkSpace; + Case FLine[Run + 1] of #10: Inc(Run, 2); - else - Inc(Run); + else Inc(Run); end; end; procedure TSynJavaSyn.ColonProc; begin Inc(Run); {colon - conditional} - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkColon; end; procedure TSynJavaSyn.CommaProc; begin Inc(Run); - FTokenID := tkSymbol; - FExtTokenID := xtkComma; + fTokenID := tkSymbol; + fExtTokenID := xtkComma; end; procedure TSynJavaSyn.EqualProc; @@ -411,13 +416,13 @@ procedure TSynJavaSyn.EqualProc; '=': {logical equal} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkLogEqual; end; else {assign} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkAssign; end; end; @@ -425,16 +430,16 @@ procedure TSynJavaSyn.EqualProc; procedure TSynJavaSyn.GreaterProc; begin - case FLine[Run + 1] of + Case FLine[Run + 1] of '=': {greater than or equal to} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkGreaterThanEqual; end; '>': begin - case FLine[Run + 2] of + Case FLine[Run + 2] of '=': {shift right assign} begin Inc(Run, 3); @@ -457,12 +462,12 @@ procedure TSynJavaSyn.GreaterProc; FExtTokenID := xtkShiftRight; end; end; - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {greater than} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkGreaterThan; end; end; @@ -470,14 +475,14 @@ procedure TSynJavaSyn.GreaterProc; procedure TSynJavaSyn.IdentProc; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do Inc(Run); + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynJavaSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; @@ -487,7 +492,7 @@ procedure TSynJavaSyn.LowerProc; '=': {less than or equal to} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkLessThanEqual; end; '<': @@ -502,12 +507,12 @@ procedure TSynJavaSyn.LowerProc; Inc(Run, 2); FExtTokenID := xtkShiftLeft; end; - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {less than} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkLessThan; end; end; @@ -519,19 +524,19 @@ procedure TSynJavaSyn.MinusProc; '=': {subtract assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkSubtractAssign; end; '-': {decrement} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkDecrement; end; else {subtract} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkSubtract; end; end; @@ -543,13 +548,13 @@ procedure TSynJavaSyn.MultiplyProc; '=': {multiply assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkMultiplyAssign; end; else {multiply} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkMultiply; end; end; @@ -561,13 +566,13 @@ procedure TSynJavaSyn.NotSymbolProc; '=': {not equal} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkNotEqual; end; else {logical complement} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkLogComplement; end; end; @@ -575,7 +580,7 @@ procedure TSynJavaSyn.NotSymbolProc; procedure TSynJavaSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -583,8 +588,8 @@ procedure TSynJavaSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of - '0'..'9', '.', '-', 'l', 'L', 'x', 'X', 'A'..'F', 'a'..'f': + case fLine[Run] of + '0'..'9', '.', 'l', 'L', 'x', 'X', 'A'..'F', 'a'..'f': //Fiala Result := True; else Result := False; @@ -593,7 +598,7 @@ procedure TSynJavaSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of @@ -610,19 +615,19 @@ procedure TSynJavaSyn.OrSymbolProc; '=': {inclusive or assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkIncOrAssign; end; '|': {conditional or} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkCondOr; end; else {inclusive or} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkIncOr; end; end; @@ -634,19 +639,19 @@ procedure TSynJavaSyn.PlusProc; '=': {add assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkAddAssign; end; '+': {increment} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkIncrement; end; else {add} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkAdd; end; end; @@ -660,19 +665,19 @@ procedure TSynJavaSyn.PointProc; NumberProc; Exit; end; - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkPoint; end; procedure TSynJavaSyn.PoundProc; begin Inc(Run); - FTokenID := tkInvalid; + fTokenID := tkInvalid; end; procedure TSynJavaSyn.QuestionProc; begin - FTokenID := tkSymbol; {question mark - conditional} + fTokenID := tkSymbol; {question mark - conditional} FExtTokenID := xtkQuestion; Inc(Run); end; @@ -683,13 +688,13 @@ procedure TSynJavaSyn.RemainderSymbolProc; '=': {remainder assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkRemainderAssign; end; else {remainder} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkRemainder; end; end; @@ -698,7 +703,7 @@ procedure TSynJavaSyn.RemainderSymbolProc; procedure TSynJavaSyn.RoundCloseProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkRoundClose; Dec(FRoundCount); end; @@ -711,10 +716,127 @@ procedure TSynJavaSyn.RoundOpenProc; Inc(FRoundCount); end; +//++ CodeFolding +procedure TSynJavaSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine, ToLine: Integer); +var + CurLine: string; + Line: Integer; + + function LineHasChar(Line: Integer; character: char; + StartCol: Integer): Boolean; // faster than Pos! + var + I: Integer; + begin + Result := False; + for I := StartCol to Length(CurLine) do begin + if CurLine[I] = character then begin + // Char must have proper highlighting (ignore stuff inside comments...) + if GetHighlighterAttriAtRowCol(LinesToScan, Line, I) <> fCommentAttri then begin + Result := True; + Break; + end; + end; + end; + end; + + function FindBraces(Line: Integer): Boolean; + var + Col: Integer; + begin + Result := False; + + for Col := 1 to Length(CurLine) do + begin + // We've found a starting character + if CurLine[col] = '{' then + begin + // Char must have proper highlighting (ignore stuff inside comments...) + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> fCommentAttri then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, '}', col + 1) then begin + FoldRanges.StartFoldRange(Line + 1, 1); + Result := True; + end; + // Skip until a newline + Break; + end; + end else if CurLine[col] = '}' then + begin + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> fCommentAttri then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, '{', col + 1) then begin + FoldRanges.StopFoldRange(Line + 1, 1); + Result := True; + end; + // Skip until a newline + Break; + end; + end; + end; // for Col + end; + + function FoldRegion(Line: Integer): Boolean; + var + S: string; + begin + Result := False; + S := TrimLeft(CurLine); + if Uppercase(Copy(S, 1, 9)) = '//#REGION' then + begin + FoldRanges.StartFoldRange(Line + 1, FoldRegionType); + Result := True; + end + else if Uppercase(Copy(S, 1, 12)) = '//#ENDREGION' then + begin + FoldRanges.StopFoldRange(Line + 1, FoldRegionType); + Result := True; + end; + end; + +begin + for Line := FromLine to ToLine do + begin + // Deal first with Multiline comments (Fold Type 2) + if TRangeState(GetLineRange(LinesToScan, Line)) in [rsComment, rsDocument] then + begin + if not (TRangeState(GetLineRange(LinesToScan, Line - 1)) in [rsComment, rsDocument]) then + FoldRanges.StartFoldRange(Line + 1, 2) + else + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end + else if TRangeState(GetLineRange(LinesToScan, Line - 1)) in [rsComment, rsDocument] then + begin + FoldRanges.StopFoldRange(Line + 1, 2); + Continue; + end; + + CurLine := LinesToScan[Line]; + + // Skip empty lines + if CurLine = '' then begin + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end; + + // Find Fold regions + if FoldRegion(Line) then + Continue; + + // Find an braces on this line (Fold Type 1) + if not FindBraces(Line) then + FoldRanges.NoFoldInfo(Line + 1); + end; // while Line +end; +//-- CodeFolding + procedure TSynJavaSyn.SemiColonProc; begin Inc(Run); {semicolon} - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkSemiColon; end; @@ -724,7 +846,7 @@ procedure TSynJavaSyn.SlashProc; '/': {c++ style comments} begin Inc(Run, 2); - FTokenID := tkComment; + fTokenID := tkComment; while not IsLineEnd(Run) do begin Inc(Run); @@ -732,42 +854,42 @@ procedure TSynJavaSyn.SlashProc; end; '*': begin - if (FLine[Run+2] = '*') and (FLine[Run+3] <> '/')then {documentation comment} + if (fLine[Run+2] = '*') and (fLine[Run+3] <> '/')then {documentation comment} begin - FRange := rsDocument; - FTokenID := tkDocument; + fRange := rsDocument; + fTokenID := tkDocument; Inc(Run); end else {c style comment} begin - FRange := rsComment; - FTokenID := tkComment; + fRange := rsComment; + fTokenID := tkComment; end; Inc(Run, 2); while not IsLineEnd(Run) do - case FLine[Run] of + case fLine[Run] of '*': - if FLine[Run + 1] = '/' then + if fLine[Run + 1] = '/' then begin Inc(Run, 2); - FRange := rsUnknown; + fRange := rsUnknown; Break; end else Inc(Run); - else + else Inc(Run); end; end; '=': {division assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkDivideAssign; end; else {division} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkDivide; end; end; @@ -776,14 +898,14 @@ procedure TSynJavaSyn.SlashProc; procedure TSynJavaSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynJavaSyn.SquareCloseProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkSquareClose; Dec(FSquareCount); end; @@ -791,14 +913,14 @@ procedure TSynJavaSyn.SquareCloseProc; procedure TSynJavaSyn.SquareOpenProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkSquareOpen; Inc(FSquareCount); end; procedure TSynJavaSyn.StringProc; begin - FTokenID := tkString; + fTokenID := tkString; if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2); repeat if IsLineEnd(Run) then Break; @@ -813,23 +935,23 @@ procedure TSynJavaSyn.StringProc; procedure TSynJavaSyn.TildeProc; begin Inc(Run); {bitwise complement} - FTokenID := tkSymbol; + fTokenId := tkSymbol; FExtTokenID := xtkBitComplement; end; procedure TSynJavaSyn.XOrSymbolProc; begin - case FLine[Run + 1] of + Case FLine[Run + 1] of '=': {xor assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkXorAssign; end; else {xor} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkXor; end; end; @@ -838,19 +960,22 @@ procedure TSynJavaSyn.XOrSymbolProc; procedure TSynJavaSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynJavaSyn.Next; begin - FTokenPos := Run; - case FRange of + fTokenPos := Run; + case fRange of rsComment: CommentProc; rsDocument: CommentProc; else + if IsCharAlphaNumeric(fLine[Run]) and not CharInSet(fLine[Run], ['0'..'9']) then //Fiala + IdentProc + else begin - FRange := rsUnknown; - case FLine[Run] of + fRange := rsUnknown; + case fLine[Run] of '&': AndSymbolProc; #39: AsciiCharProc; '@': AtSymbolProc; @@ -861,10 +986,8 @@ procedure TSynJavaSyn.Next; ',': CommaProc; '=': EqualProc; '>': GreaterProc; - 'A'..'Z', 'a'..'z', '_', '$', - WideChar(#$00C0)..WideChar(#$00D6), - WideChar(#$00D8)..WideChar(#$00F6), - WideChar(#$00F8)..WideChar(#$00FF): IdentProc; +// 'A'..'Z', 'a'..'z', '_', '$', 'L'..'Ö', 'Ø'..'ö', 'ø'..'ÿ': IdentProc; //Fiala + '_': IdentProc; //Fiala #10: LFProc; '<': LowerProc; '-': MinusProc; @@ -899,39 +1022,39 @@ procedure TSynJavaSyn.Next; function TSynJavaSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; end; function TSynJavaSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynJavaSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; procedure TSynJavaSyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; end; procedure TSynJavaSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; function TSynJavaSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynJavaSyn.GetExtTokenID: TxtkTokenKind; @@ -941,40 +1064,42 @@ function TSynJavaSyn.GetExtTokenID: TxtkTokenKind; function TSynJavaSyn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkComment: Result := FCommentAttri; - tkDocument: Result := FDocumentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkInvalid: Result := FInvalidAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FInvalidAttri; + case fTokenID of + tkComment: Result := fCommentAttri; + tkDocument: Result := fDocumentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkInvalid: Result := fInvalidAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fInvalidAttri; else Result := nil; end; end; function TSynJavaSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; function TSynJavaSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterJava; + Result := fDefaultFilter <> SYNS_FilterJava; end; function TSynJavaSyn.IsIdentChar(AChar: WideChar): Boolean; begin + Result := IsCharAlphaNumeric(AChar) or CharInSet(AChar, ['_', '$']); //Fiala +(* case AChar of - '_', '$', '0'..'9', 'a'..'z', 'A'..'Z', WideChar(#$00C0)..WideChar(#$00D6), - WideChar(#$00D8)..WideChar(#$00F6), WideChar(#$00F8)..WideChar(#$00FF): + '_', '$', '0'..'9', 'a'..'z', 'A'..'Z', 'L'..'Ö', 'Ø'..'ö', 'ø'..'ÿ': Result := True; else Result := False; end; +*) end; class function TSynJavaSyn.GetLanguageName: string; @@ -982,29 +1107,26 @@ class function TSynJavaSyn.GetLanguageName: string; Result := SYNS_LangJava; end; -function TSynJavaSyn.GetSampleSource: UnicodeString; +function TSynJavaSyn.GetSampleSource: string; begin - Result := - '/* Java syntax highlighting */'#13#10 + - 'import java.util.*;'#13#10 + - #13#10 + - '/** Example class */'#13#10 + - 'public class Sample {'#13#10 + - ' public static void main(String[] args) {'#13#10 + - ' int i = 0;'#13#10 + - ' for(i = 0; i < 10; i++)'#13#10 + - ' System.out.println("Hello world");'#13#10 + - ' }'#13#10 + - '}'; + Result := '/* Java syntax highlighting */'#13#10 + + 'import java.util.*;'#13#10 + + #13#10 + + '/** Example class */'#13#10 + + 'public class Sample {'#13#10 + + ' public static void main(String[] args) {'#13#10 + + ' int i = 0;'#13#10 + + ' for(i = 0; i < 10; i++)'#13#10 + + ' System.out.println("Hello world");'#13#10 + + ' }'#13#10 + + '}'; end; -class function TSynJavaSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynJavaSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangJava; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynJavaSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterKix.pas b/Ext/SynEdit/Source/SynHighlighterKix.pas index e4e9b04..021a79f 100644 --- a/Ext/SynEdit/Source/SynHighlighterKix.pas +++ b/Ext/SynEdit/Source/SynHighlighterKix.pas @@ -27,13 +27,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterKix.pas,v 1.12.2.6 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a Kix syntax highlighter for SynEdit) @@ -67,17 +60,17 @@ interface type TSynKixSyn = class(TSynCustomHighlighter) private - FTokenID: TtkTokenKind; - FIdentFuncTable: array[0..970] of TIdentFuncTableFunc; - FCommentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FMiscellaneousAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FVariableAttri: TSynHighlighterAttributes; + fTokenID: TtkTokenKind; + fIdentFuncTable: array[0..970] of TIdentFuncTableFunc; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fMiscellaneousAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fVariableAttri: TSynHighlighterAttributes; function AltFunc(Index: Integer): TtkTokenKind; function KeyWordFunc(Index: Integer): TtkTokenKind; function HashKey(Str: PWideChar): Cardinal; @@ -97,11 +90,11 @@ TSynKixSyn = class(TSynCustomHighlighter) procedure StringProc; procedure UnknownProc; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; @@ -112,23 +105,23 @@ TSynKixSyn = class(TSynCustomHighlighter) function GetTokenKind: Integer; override; procedure Next; override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; property MiscellaneousAttri: TSynHighlighterAttributes - read FMiscellaneousAttri write FMiscellaneousAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; - property VariableAttri: TSynHighlighterAttributes read FVariableAttri - write FVariableAttri; + read fMiscellaneousAttri write fMiscellaneousAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; + property VariableAttri: TSynHighlighterAttributes read fVariableAttri + write fVariableAttri; end; implementation @@ -137,7 +130,7 @@ implementation SynEditStrConst; const - KeyWords: array[0..168] of UnicodeString = ( + KeyWords: array[0..168] of string = ( 'addkey', 'addprinterconnection', 'addprogramgroup', 'addprogramitem', 'address', 'asc', 'at', 'backupeventlog', 'beep', 'big', 'box', 'break', 'call', 'case', 'cd', 'chr', 'cleareventlog', 'close', 'cls', 'color', @@ -233,7 +226,7 @@ function TSynKixSyn.HashKey(Str: PWideChar): Cardinal; Inc(Str); end; Result := Result mod 971; - FStringLen := Str - FToIdent; + fStringLen := Str - fToIdent; end; {$Q+} @@ -241,10 +234,10 @@ function TSynKixSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; @@ -253,13 +246,13 @@ procedure TSynKixSyn.InitIdent; var i: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; + fIdentFuncTable[i] := AltFunc; - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if @FIdentFuncTable[i] = nil then - FIdentFuncTable[i] := KeyWordFunc; + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if @fIdentFuncTable[i] = nil then + fIdentFuncTable[i] := KeyWordFunc; end; function TSynKixSyn.AltFunc(Index: Integer): TtkTokenKind; @@ -279,60 +272,60 @@ constructor TSynKixSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := False; - - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); - FMiscellaneousAttri := TSynHighlighterAttributes.Create(SYNS_AttrMiscellaneous, SYNS_FriendlyAttrMiscellaneous); - AddAttribute(FMiscellaneousAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); - FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); - AddAttribute(FVariableAttri); + fCaseSensitive := False; + + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + AddAttribute(fCommentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); + fMiscellaneousAttri := TSynHighlighterAttributes.Create(SYNS_AttrMiscellaneous, SYNS_FriendlyAttrMiscellaneous); + AddAttribute(fMiscellaneousAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); + fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); + AddAttribute(fVariableAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FDefaultFilter := SYNS_FilterKIX; + fDefaultFilter := SYNS_FilterKIX; end; procedure TSynKixSyn.AsciiCharProc; begin - FTokenID := tkString; + fTokenID := tkString; Inc(Run); while CharInSet(FLine[Run], ['0'..'9']) do Inc(Run); end; procedure TSynKixSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then Inc(Run); + if fLine[Run] = #10 then Inc(Run); end; procedure TSynKixSyn.IdentProc; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do Inc(Run); + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynKixSyn.MacroProc; function IsMacroChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', 'A'..'Z', 'a'..'z': Result := True; else @@ -342,32 +335,32 @@ procedure TSynKixSyn.MacroProc; begin Inc(Run); - FTokenID := tkMiscellaneous; + fTokenID := tkMiscellaneous; while IsMacroChar do Inc(Run); end; procedure TSynKixSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynKixSyn.PrintProc; begin - FTokenID := tkKey; + fTokenID := tkKey; Inc(Run); end; procedure TSynKixSyn.VariableProc; begin - FTokenID := tkVariable; + fTokenId := tkVariable; Inc(run); while IsIdentChar(FLine[Run]) do Inc(run); end; procedure TSynKixSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -375,7 +368,7 @@ procedure TSynKixSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', 'e', 'E': Result := True; else @@ -385,7 +378,7 @@ procedure TSynKixSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of @@ -398,7 +391,7 @@ procedure TSynKixSyn.NumberProc; procedure TSynKixSyn.CommentProc; begin - FTokenID := tkComment; + fTokenID := tkComment; repeat Inc(Run); until IsLineEnd(Run); @@ -407,7 +400,7 @@ procedure TSynKixSyn.CommentProc; procedure TSynKixSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; @@ -415,12 +408,11 @@ procedure TSynKixSyn.StringProc; var C: WideChar; begin - FTokenID := tkString; - C := FLine[run]; + fTokenID := tkString; + C := fline[run]; repeat case FLine[Run] of - #0, #10, #13: - Break; + #0, #10, #13: Break; end; Inc(Run); until FLine[Run] = C; @@ -430,13 +422,13 @@ procedure TSynKixSyn.StringProc; procedure TSynKixSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynKixSyn.Next; begin - FTokenPos := Run; - case FLine[Run] of + fTokenPos := Run; + case fLine[Run] of '#': AsciiCharProc; #13: CRProc; 'A'..'Z', 'a'..'z', '_': IdentProc; @@ -457,47 +449,46 @@ procedure TSynKixSyn.Next; function TSynKixSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; end; function TSynKixSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynKixSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynKixSyn.GetTokenAttribute: TSynHighlighterAttributes; begin case GetTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkMiscellaneous: Result := FMiscellaneousAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkVariable: Result := FVariableAttri; - tkUnknown: Result := FIdentifierAttri; - else - Result := nil; + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkMiscellaneous: Result := fMiscellaneousAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkVariable: Result := fVariableAttri; + tkUnknown: Result := fIdentifierAttri; + else Result := nil; end; end; function TSynKixSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; class function TSynKixSyn.GetLanguageName: string; @@ -507,28 +498,25 @@ class function TSynKixSyn.GetLanguageName: string; function TSynKixSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterKIX; + Result := fDefaultFilter <> SYNS_FilterKIX; end; -function TSynKixSyn.GetSampleSource: UnicodeString; +function TSynKixSyn.GetSampleSource: string; begin - Result := - '; KiXtart sample source'#13#10 + - 'break on'#13#10 + - 'color b/n'#13#10 + - #13#10 + - 'AT(1, 30) "Hello World!"'#13#10 + - '$USERID = @USERID'#13#10 + - 'AT(1, 30) $USERID'; + Result := '; KiXtart sample source'#13#10 + + 'break on'#13#10 + + 'color b/n'#13#10 + + #13#10 + + 'AT(1, 30) "Hello World!"'#13#10 + + '$USERID = @USERID'#13#10 + + 'AT(1, 30) $USERID'; end; -class function TSynKixSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynKixSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangKIX; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynKixSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterLDraw.pas b/Ext/SynEdit/Source/SynHighlighterLDraw.pas index bfc3bba..b67fbf9 100644 --- a/Ext/SynEdit/Source/SynHighlighterLDraw.pas +++ b/Ext/SynEdit/Source/SynHighlighterLDraw.pas @@ -27,12 +27,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterLDraw.pas,v 1.7.2.7 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -------------------------------------------------------------------------------} { @abstract(Provides an LDraw syntax highlighter for SynEdit) @@ -72,7 +66,7 @@ interface tkTriangle, tkUnknown); - TRangeState = (rsUnknown); + TRangeState = (rsUnKnown); PIdentFuncTableFunc = ^TIdentFuncTableFunc; TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; @@ -80,21 +74,21 @@ interface type TSynLDRSyn = class(TSynCustomHighlighter) private - FRange: TRangeState; - FTokenID: TtkTokenKind; - FIdentFuncTable: array[0..1] of TIdentFuncTableFunc; - FColorAttri: TSynHighlighterAttributes; - FCommentAttri: TSynHighlighterAttributes; - FFirstTriAttri: TSynHighlighterAttributes; - FFourthTriAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FLineAttri: TSynHighlighterAttributes; - FOpLineAttri: TSynHighlighterAttributes; - FQuadAttri: TSynHighlighterAttributes; - FSecondTriAttri: TSynHighlighterAttributes; - FThirdTriAttri: TSynHighlighterAttributes; - FTriangleAttri: TSynHighlighterAttributes; + fRange: TRangeState; + fTokenID: TtkTokenKind; + fIdentFuncTable: array[0..1] of TIdentFuncTableFunc; + fColorAttri: TSynHighlighterAttributes; + fCommentAttri: TSynHighlighterAttributes; + fFirstTriAttri: TSynHighlighterAttributes; + fFourthTriAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fLineAttri: TSynHighlighterAttributes; + fOpLineAttri: TSynHighlighterAttributes; + fQuadAttri: TSynHighlighterAttributes; + fSecondTriAttri: TSynHighlighterAttributes; + fThirdTriAttri: TSynHighlighterAttributes; + fTriangleAttri: TSynHighlighterAttributes; function AltFunc(Index: Integer): TtkTokenKind; function FuncAuthor(Index: Integer): TtkTokenKind; function HashKey(Str: PWideChar): Cardinal; @@ -108,36 +102,36 @@ TSynLDRSyn = class(TSynCustomHighlighter) procedure LFProc; function FirstChar(DatLine: PWideChar): WideChar; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public constructor Create(AOwner: TComponent); override; class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; function GetRange: Pointer; override; procedure ResetRange; override; procedure SetRange(Value: Pointer); override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override; function GetEol: Boolean; override; - function GetKeyWords(TokenKind: Integer): UnicodeString; override; + function GetKeyWords(TokenKind: Integer): string; override; function GetTokenID: TtkTokenKind; function GetTokenAttribute: TSynHighlighterAttributes; override; function GetTokenKind: Integer; override; function IsIdentChar(AChar: WideChar): Boolean; override; procedure Next; override; published - property ColorAttri: TSynHighlighterAttributes read FColorAttri write FColorAttri; - property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; - property FirstTriAttri: TSynHighlighterAttributes read FFirstTriAttri write FFirstTriAttri; - property FourthTriAttri: TSynHighlighterAttributes read FFourthTriAttri write FFourthTriAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property LineAttri: TSynHighlighterAttributes read FLineAttri write FLineAttri; - property OpLineAttri: TSynHighlighterAttributes read FOpLineAttri write FOpLineAttri; - property QuadAttri: TSynHighlighterAttributes read FQuadAttri write FQuadAttri; - property SecondTriAttri: TSynHighlighterAttributes read FSecondTriAttri write FSecondTriAttri; - property ThirdTriAttri: TSynHighlighterAttributes read FThirdTriAttri write FThirdTriAttri; - property TriangleAttri: TSynHighlighterAttributes read FTriangleAttri write FTriangleAttri; + property ColorAttri: TSynHighlighterAttributes read fColorAttri write fColorAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; + property FirstTriAttri: TSynHighlighterAttributes read fFirstTriAttri write fFirstTriAttri; + property FourthTriAttri: TSynHighlighterAttributes read fFourthTriAttri write fFourthTriAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property LineAttri: TSynHighlighterAttributes read fLineAttri write fLineAttri; + property OpLineAttri: TSynHighlighterAttributes read fOpLineAttri write fOpLineAttri; + property QuadAttri: TSynHighlighterAttributes read fQuadAttri write fQuadAttri; + property SecondTriAttri: TSynHighlighterAttributes read fSecondTriAttri write fSecondTriAttri; + property ThirdTriAttri: TSynHighlighterAttributes read fThirdTriAttri write fThirdTriAttri; + property TriangleAttri: TSynHighlighterAttributes read fTriangleAttri write fTriangleAttri; end; implementation @@ -146,7 +140,7 @@ implementation SynEditStrConst; const - KeyWords: array[0..0] of UnicodeString = ( + KeyWords: array[0..0] of string = ( 'author' ); @@ -164,7 +158,7 @@ function TSynLDRSyn.HashKey(Str: PWideChar): Cardinal; Inc(Str); end; Result := Result mod 2; - FStringLen := Str - FToIdent; + fStringLen := Str - fToIdent; end; {$Q+} @@ -172,10 +166,10 @@ function TSynLDRSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; @@ -184,11 +178,11 @@ procedure TSynLDRSyn.InitIdent; var i: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; + fIdentFuncTable[i] := AltFunc; - FIdentFuncTable[1] := FuncAuthor; + fIdentFuncTable[1] := FuncAuthor; end; function TSynLDRSyn.AltFunc(Index: Integer): TtkTokenKind; @@ -206,78 +200,78 @@ function TSynLDRSyn.FuncAuthor(Index: Integer): TtkTokenKind; procedure TSynLDRSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; procedure TSynLDRSyn.CRProc; begin - FTokenID := tkUnknown; + fTokenID := tkUnknown; Inc(Run); - if FLine[Run] = #10 then + if fLine[Run] = #10 then Inc(Run); end; procedure TSynLDRSyn.LFProc; begin - FTokenID := tkUnknown; + fTokenID := tkUnknown; Inc(Run); end; constructor TSynLDRSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FColorAttri := TSynHighLighterAttributes.Create(SYNS_AttrColor, SYNS_FriendlyAttrColor); - FColorAttri.Foreground := clNavy; - AddAttribute(FColorAttri); + fColorAttri := TSynHighLighterAttributes.Create(SYNS_AttrColor, SYNS_FriendlyAttrColor); + fColorAttri.Foreground := clNavy; + AddAttribute(fColorAttri); - FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Foreground := clBlue; - AddAttribute(FCommentAttri); + fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Foreground := clBlue; + AddAttribute(fCommentAttri); - FFirstTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrFirstTri, SYNS_FriendlyAttrFirstTri); - FFirstTriAttri.Foreground := RGB(206,111,73); - AddAttribute(FFirstTriAttri); + fFirstTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrFirstTri, SYNS_FriendlyAttrFirstTri); + fFirstTriAttri.Foreground := RGB(206,111,73); + AddAttribute(fFirstTriAttri); - FFourthTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrFourthTri, SYNS_FriendlyAttrFourthTri); - FFourthTriAttri.Foreground := RGB(54,99,12); - AddAttribute(FFourthTriAttri); + fFourthTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrFourthTri, SYNS_FriendlyAttrFourthTri); + fFourthTriAttri.Foreground := RGB(54,99,12); + AddAttribute(fFourthTriAttri); - FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); + fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); - FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); + fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); - FLineAttri := TSynHighLighterAttributes.Create(SYNS_AttrLine, SYNS_FriendlyAttrLine); - FLineAttri.Foreground := clBlack; - AddAttribute(FLineAttri); + fLineAttri := TSynHighLighterAttributes.Create(SYNS_AttrLine, SYNS_FriendlyAttrLine); + fLineAttri.Foreground := clBlack; + AddAttribute(fLineAttri); - FOpLineAttri := TSynHighLighterAttributes.Create(SYNS_AttrOpLine, SYNS_FriendlyAttrOpLine); - FOpLineAttri.Foreground := clBlack; - AddAttribute(FOpLineAttri); + fOpLineAttri := TSynHighLighterAttributes.Create(SYNS_AttrOpLine, SYNS_FriendlyAttrOpLine); + fOpLineAttri.Foreground := clBlack; + AddAttribute(fOpLineAttri); - FQuadAttri := TSynHighLighterAttributes.Create(SYNS_AttrQuad, SYNS_FriendlyAttrQuad); - FQuadAttri.Foreground := clRed; - AddAttribute(FQuadAttri); + fQuadAttri := TSynHighLighterAttributes.Create(SYNS_AttrQuad, SYNS_FriendlyAttrQuad); + fQuadAttri.Foreground := clRed; + AddAttribute(fQuadAttri); - FSecondTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrSecondTri, SYNS_FriendlyAttrSecondTri); - FSecondTriAttri.Foreground := RGB(54,99,12); - AddAttribute(FSecondTriAttri); + fSecondTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrSecondTri, SYNS_FriendlyAttrSecondTri); + fSecondTriAttri.Foreground := RGB(54,99,12); + AddAttribute(fSecondTriAttri); - FThirdTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrThirdTri, SYNS_FriendlyAttrThirdTri); - FThirdTriAttri.Foreground := RGB(206,111,73); - AddAttribute(FThirdTriAttri); + fThirdTriAttri := TSynHighLighterAttributes.Create(SYNS_AttrThirdTri, SYNS_FriendlyAttrThirdTri); + fThirdTriAttri.Foreground := RGB(206,111,73); + AddAttribute(fThirdTriAttri); - FTriangleAttri := TSynHighLighterAttributes.Create(SYNS_AttrTriangle, SYNS_FriendlyAttrTriangle); - FTriangleAttri.Foreground := clBlack; - AddAttribute(FTriangleAttri); + fTriangleAttri := TSynHighLighterAttributes.Create(SYNS_AttrTriangle, SYNS_FriendlyAttrTriangle); + fTriangleAttri.Foreground := clBlack; + AddAttribute(fTriangleAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FDefaultFilter := SYNS_FilterLDraw; - FRange := rsUnknown; + fDefaultFilter := SYNS_FilterLDraw; + fRange := rsUnknown; end; function TSynLDRSyn.FirstChar(DatLine: PWideChar): WideChar; @@ -291,17 +285,17 @@ function TSynLDRSyn.FirstChar(DatLine: PWideChar): WideChar; procedure TSynLDRSyn.IdentProc; begin - if FirstChar(FLine) = '0' then + if FirstChar(fLine) = '0' then begin - FTokenID := tkComment; - while (FLine[Run] <> #10) and (FLine[Run] <> #13) - and (FLine[Run] <> #0) do Inc(Run); + fTokenID := tkComment; + while (fLine[Run] <> #10) and (fLine[Run] <> #13) + and (fLine[Run] <> #0) do Inc(Run); end else begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; end; @@ -333,29 +327,29 @@ procedure TSynLDRSyn.Number1Proc; end; begin - case ArgNumber(FLine) of + case ArgNumber(fLine) of 1: begin - case FLine[Run] of - '0': FTokenID := tkComment; - '1': FTokenID := tkIdentifier; - '2': FTokenID := tkLine; - '3': FTokenID := tkTriangle; - '4': FTokenID := tkQuad; - '5': FTokenID := tkOpLine; + case fLine[Run] of + '0': fTokenID := tkComment; + '1': fTokenID := tkIdentifier; + '2': fTokenID := tkLine; + '3': fTokenID := tkTriangle; + '4': fTokenID := tkQuad; + '5': fTokenID := tkOpLine; end; end; - 2: if FirstChar(FLine) <> '0' then FTokenID := tkColor - else FTokenID := tkComment; - 3..5: if FirstChar(FLine) <> '0' then FTokenID := tkFirstTri - else FTokenID := tkComment; - 6..8: if FirstChar(FLine) <> '0' then FTokenID := tkSecondTri - else FTokenID := tkComment; - 9..11: if FirstChar(FLine) <> '0' then FTokenID := tkThirdTri - else FTokenID := tkComment; - 12..14: if FirstChar(FLine) <> '0' then FTokenID := tkFourthTri - else FTokenID := tkComment; + 2: if FirstChar(fLine) <> '0' then fTokenID := tkColor + else fTokenID := tkComment; + 3..5: if FirstChar(fLine) <> '0' then fTokenID := tkFirstTri + else fTokenID := tkComment; + 6..8: if FirstChar(fLine) <> '0' then fTokenID := tkSecondTri + else fTokenID := tkComment; + 9..11: if FirstChar(fLine) <> '0' then fTokenID := tkThirdTri + else fTokenID := tkComment; + 12..14: if FirstChar(fLine) <> '0' then fTokenID := tkFourthTri + else fTokenID := tkComment; else - FTokenID := tkIdentifier; + fTokenID := tkIdentifier; end; while CharInSet(FLine[Run], ['0'..'9', '.']) do Inc(Run); end; @@ -363,13 +357,13 @@ procedure TSynLDRSyn.Number1Proc; procedure TSynLDRSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynLDRSyn.Next; begin - FTokenPos := Run; - case FLine[Run] of + fTokenPos := Run; + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; @@ -383,9 +377,9 @@ procedure TSynLDRSyn.Next; function TSynLDRSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; else Result := nil; end; @@ -393,35 +387,35 @@ function TSynLDRSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttribut function TSynLDRSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; -function TSynLDRSyn.GetKeyWords(TokenKind: Integer): UnicodeString; +function TSynLDRSyn.GetKeyWords(TokenKind: Integer): string; begin Result := 'Author'; end; function TSynLDRSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynLDRSyn.GetTokenAttribute: TSynHighLighterAttributes; begin case GetTokenID of - tkColor: Result := FColorAttri; - tkComment: Result := FCommentAttri; - tkFirstTri: Result := FFirstTriAttri; - tkFourthTri: Result := FFourthTriAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkLine: Result := FLineAttri; - tkOpLine: Result := FOpLineAttri; - tkQuad: Result := FQuadAttri; - tkSecondTri: Result := FSecondTriAttri; - tkThirdTri: Result := FThirdTriAttri; - tkTriangle: Result := FTriangleAttri; - tkUnknown: Result := FIdentifierAttri; + tkColor: Result := fColorAttri; + tkComment: Result := fCommentAttri; + tkFirstTri: Result := fFirstTriAttri; + tkFourthTri: Result := fFourthTriAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkLine: Result := fLineAttri; + tkOpLine: Result := fOpLineAttri; + tkQuad: Result := fQuadAttri; + tkSecondTri: Result := fSecondTriAttri; + tkThirdTri: Result := fThirdTriAttri; + tkTriangle: Result := fTriangleAttri; + tkUnknown: Result := fIdentifierAttri; else Result := nil; end; @@ -429,10 +423,10 @@ function TSynLDRSyn.GetTokenAttribute: TSynHighLighterAttributes; function TSynLDRSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; -function TSynLDRSyn.GetSampleSource: UnicodeString; +function TSynLDRSyn.GetSampleSource: string; begin Result := #13#10 + 'Sample source for: '#13#10 + @@ -447,7 +441,7 @@ function TSynLDRSyn.GetSampleSource: UnicodeString; function TSynLDRSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterLDraw; + Result := fDefaultFilter <> SYNS_FilterLDraw; end; function TSynLDRSyn.IsIdentChar(AChar: WideChar): Boolean; @@ -467,26 +461,24 @@ class function TSynLDRSyn.GetLanguageName: string; procedure TSynLDRSyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; end; procedure TSynLDRSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; function TSynLDRSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; -class function TSynLDRSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynLDRSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangLDraw; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynLDRSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterLLVM.pas b/Ext/SynEdit/Source/SynHighlighterLLVM.pas index eaea1a5..ba2378d 100644 --- a/Ext/SynEdit/Source/SynHighlighterLLVM.pas +++ b/Ext/SynEdit/Source/SynHighlighterLLVM.pas @@ -26,12 +26,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -------------------------------------------------------------------------------} unit SynHighlighterLLVM; @@ -169,7 +163,7 @@ implementation 'indirectbr', 'initialexec', 'inlinehint', 'inreg', 'insertelement', 'insertvalue', 'intel_ocl_bicc', 'inteldialect', 'internal', 'inttoptr', 'invoke', 'label', 'landingpad', 'linker_private', 'linker_private_weak', - 'linker_private_weak_def_auto', 'linkonce', 'linkonce_odr', + 'linker_private_weak_def_auto', 'linkonce', 'linkonce_odr', 'linkonce_odr_auto_hide', 'load', 'localdynamic', 'localexec', 'lshr', 'malloc', 'max', 'metadata', 'min', 'minsize', 'module', 'monotonic', 'msp430_intrcc', 'mul', 'naked', 'nand', 'ne', 'nest', 'ninf', 'nnan', @@ -637,29 +631,29 @@ function TSynLLVMIRSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; procedure TSynLLVMIRSyn.SpaceProc; begin - inc(Run); + Inc(Run); fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynLLVMIRSyn.NullProc; begin fTokenID := tkNull; - inc(Run); + Inc(Run); end; procedure TSynLLVMIRSyn.CRProc; begin fTokenID := tkSpace; - inc(Run); + Inc(Run); if fLine[Run] = #10 then - inc(Run); + Inc(Run); end; procedure TSynLLVMIRSyn.LFProc; begin fTokenID := tkSpace; - inc(Run); + Inc(Run); end; procedure TSynLLVMIRSyn.IntegerTypeProc; @@ -925,7 +919,7 @@ procedure TSynLLVMIRSyn.IdentProc; procedure TSynLLVMIRSyn.UnknownProc; begin - inc(Run); + Inc(Run); fTokenID := tkUnknown; end; @@ -1089,7 +1083,5 @@ function TSynLLVMIRSyn.GetRange: Pointer; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynLLVMIRSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterM3.pas b/Ext/SynEdit/Source/SynHighlighterM3.pas index 7bb5b90..40581f6 100644 --- a/Ext/SynEdit/Source/SynHighlighterM3.pas +++ b/Ext/SynEdit/Source/SynHighlighterM3.pas @@ -23,13 +23,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterM3.pas,v 1.11.2.5 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a Modula-3 syntax highlighter for SynEdit) @@ -46,14 +39,13 @@ interface uses - Graphics, - Registry, + System.SysUtils, + System.Classes, + System.Generics.Defaults, + System.Generics.Collections, + Vcl.Graphics, SynEditTypes, - SynEditHighlighter, - SynHighlighterHashEntries, - SynUnicode, - SysUtils, - Classes; + SynEditHighlighter; type TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkPragma, @@ -63,27 +55,26 @@ interface TRangeState = packed record case Boolean of - False: (p: Pointer); + False: (P: Pointer); True: (TokenRange: Word; Level: Word); end; TSynM3Syn = class(TSynCustomHighLighter) private - FRange: TRangeState; + fRange: TRangeState; FTokenID: TtkTokenKind; - FCommentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FPragmaAttri: TSynHighlighterAttributes; - FReservedAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FSyntaxErrorAttri: TSynHighlighterAttributes; - FKeywords: TSynHashEntryList; - procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); - function HashKey(Str: PWideChar): Integer; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fPragmaAttri: TSynHighlighterAttributes; + fReservedAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fSyntaxErrorAttri: TSynHighlighterAttributes; + FKeywords: TDictionary; + procedure DoAddKeyword(AKeyword: string; AKind: Integer); function IdentKind(MayBe: PWideChar): TtkTokenKind; procedure SymAsciiCharProc; procedure SymCommentHelpProc; @@ -101,14 +92,11 @@ TSynM3Syn = class(TSynCustomHighLighter) procedure SymSymbolProc; procedure SymUnknownProc; protected + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; -{$IFDEF SYN_DEVELOPMENT_CHECKS} - public - property _Keywords: TSynHashEntryList read FKeywords; -{$ENDIF} + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -123,159 +111,126 @@ TSynM3Syn = class(TSynCustomHighLighter) procedure ResetRange; override; procedure SetRange(Value: Pointer); override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property PragmaAttri: TSynHighlighterAttributes read FPragmaAttri - write FPragmaAttri; - property ReservedAttri: TSynHighlighterAttributes read FReservedAttri - write FReservedAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; - property SyntaxErrorAttri: TSynHighlighterAttributes read FSyntaxErrorAttri - write FSyntaxErrorAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property PragmaAttri: TSynHighlighterAttributes read fPragmaAttri + write fPragmaAttri; + property ReservedAttri: TSynHighlighterAttributes read fReservedAttri + write fReservedAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; + property SyntaxErrorAttri: TSynHighlighterAttributes read fSyntaxErrorAttri + write fSyntaxErrorAttri; end; implementation uses + SynEditMiscProcs, SynEditStrConst; const - Keywords: UnicodeString = + Keywords: string = 'AS,AND,ANY,ARRAY,BEGIN,BITS,BRANDED,BY,CASE,CONST,DIV,DO,ELSE,ELSIF,END,' + 'EVAL,EXCEPT,EXCEPTION,EXIT,EXPORTS,FINALLY,FOR,FROM,GENERIC,IF,IMPORT,' + 'IN,INTERFACE,LOCK,LOOP,METHODS,MOD,MODULE,NOT,OBJECT,OF,OR,OVERRIDES,' + 'PROCEDURE,RAISE,RAISES,READONLY,RECORD,REF,REPEAT,RETURN,REVEAL,ROOT,' + 'SET,THEN,TO,TRY,TYPE,TYPECASE,UNSAFE,UNTIL,UNTRACED,VALUE,VAR,WHILE,WITH'; - ReservedWords: UnicodeString = + ReservedWords: string = 'ABS,ADDRESS,ADR,ADRSIZE,BITSIZE,BOOLEAN,BYTESIZE,CARDINAL,CEILING,CHAR,' + 'DEC,DISPOSE,FALSE,FIRST,FLOAT,FLOOR,INC,INTEGER,ISTYPE,LAST,LONGFLOAT,' + 'LONGREAL,LOOPHOLE,MAX,MIN,MUTEX,NARROW,NEW,NIL,NULL,NUMBER,ORD,REAL,' + 'REFANY,ROUND,SUBARRAY,TEXT,TRUE,TRUNC,TYPECODE,VAL'; -procedure TSynM3Syn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); -var - HashValue: Integer; +procedure TSynM3Syn.DoAddKeyword(AKeyword: string; AKind: Integer); begin - HashValue := HashKey(PWideChar(AKeyword)); - FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind); -end; - -function TSynM3Syn.HashKey(Str: PWideChar): Integer; - - function GetOrd: Integer; - begin - case Str^ of - 'a'..'z': Result := 1 + Ord(Str^) - Ord('a'); - 'A'..'Z': Result := 1 + Ord(Str^) - Ord('A'); - '0'..'9': Result := 28 + Ord(Str^) - Ord('0'); - '_': Result := 27; - else Result := 0; - end - end; - -begin - Result := 0; - while IsIdentChar(Str^) do - begin -{$IFOPT Q-} - Result := 7 * Result + GetOrd; -{$ELSE} - Result := (7 * Result + GetOrd) and $FFFFFF; -{$ENDIF} - Inc(Str); - end; - Result := Result and $FF; // 255 - FStringLen := Str - FToIdent; + if not FKeywords.ContainsKey(AKeyword) then + FKeywords.Add(AKeyword, TtkTokenKind(AKind)); end; function TSynM3Syn.IdentKind(MayBe: PWideChar): TtkTokenKind; var - Entry: TSynHashEntry; -begin - FToIdent := MayBe; - Entry := FKeywords[HashKey(MayBe)]; - while Assigned(Entry) do - begin - if Entry.KeywordLen > FStringLen then - Break - else if Entry.KeywordLen = FStringLen then - if IsCurrentToken(Entry.Keyword) then - begin - Result := TtkTokenKind(Entry.Kind); - Exit; - end; - Entry := Entry.Next; - end; - Result := tkIdentifier; + S: string; +begin + fToIdent := MayBe; + while IsIdentChar(MayBe^) do + Inc(Maybe); + fStringLen := Maybe - fToIdent; + SetString(S, fToIdent, fStringLen); + if FKeywords.ContainsKey(S) then + Result := FKeywords[S] + else + Result := tkIdentifier; end; constructor TSynM3Syn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := True; - - FKeywords := TSynHashEntryList.Create; - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style:= [fsItalic]; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); - FKeyAttri.Style:= [fsBold]; - AddAttribute(FKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FPragmaAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); - FPragmaAttri.Style:= [fsBold]; - AddAttribute(FPragmaAttri); - FReservedAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - AddAttribute(FReservedAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); - FSyntaxErrorAttri := TSynHighlighterAttributes.Create(SYNS_AttrSyntaxError, SYNS_FriendlyAttrSyntaxError); - FSyntaxErrorAttri.Foreground := clRed; - AddAttribute(FSyntaxErrorAttri); + fCaseSensitive := True; + + // Create the keywords dictionary case-sensitive + FKeywords := TDictionary.Create; + + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style:= [fsItalic]; + AddAttribute(fCommentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); + fKeyAttri.Style:= [fsBold]; + AddAttribute(fKeyAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fPragmaAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); + fPragmaAttri.Style:= [fsBold]; + AddAttribute(fPragmaAttri); + fReservedAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + AddAttribute(fReservedAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); + fSyntaxErrorAttri := TSynHighlighterAttributes.Create(SYNS_AttrSyntaxError, SYNS_FriendlyAttrSyntaxError); + fSyntaxErrorAttri.Foreground := clRed; + AddAttribute(fSyntaxErrorAttri); SetAttributesOnChange(DefHighlightChange); EnumerateKeywords(Ord(tkKey), Keywords, IsIdentChar, DoAddKeyword); EnumerateKeywords(Ord(tkReserved), ReservedWords, IsIdentChar, DoAddKeyword); - FDefaultFilter := SYNS_FilterModula3; + fDefaultFilter := SYNS_FilterModula3; end; destructor TSynM3Syn.Destroy; begin - FKeywords.Free; + fKeywords.Free; inherited Destroy; end; procedure TSynM3Syn.SymAsciiCharProc; begin - FTokenID := tkString; + fTokenID := tkString; Inc(Run); while not IsLineEnd(Run) do begin - case FLine[Run] of - '\': if FLine[Run + 1] = #39 then + case fLine[Run] of + '\': if fLine[Run + 1] = #39 then Inc(Run); #39: begin Inc(Run); - if FLine[Run] <> #39 then + if fLine[Run] <> #39 then Break; end; end; @@ -285,60 +240,60 @@ procedure TSynM3Syn.SymAsciiCharProc; procedure TSynM3Syn.SymCommentHelpProc; begin - FTokenID := tkComment; + fTokenID := tkComment; SymNestedHelperProc('(', ')'); end; procedure TSynM3Syn.SymCRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then + if fLine[Run] = #10 then Inc(Run); end; procedure TSynM3Syn.SymIdentProc; begin - FTokenID := IdentKind(FLine + Run); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do + fTokenID := IdentKind(fLine + Run); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynM3Syn.SymLFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynM3Syn.SymNestedHelperProc(AOpenChar, ACloseChar: WideChar); begin - case FLine[Run] of + case fLine[Run] of #0: SymNullProc; #10: SymLFProc; #13: SymCRProc; else repeat - if FLine[Run]= AOpenChar then + if fLine[Run]= AOpenChar then begin Inc(Run); - if FLine[Run] = '*' then + if fLine[Run] = '*' then begin Inc(Run); - Inc(FRange.Level); + Inc(fRange.Level); end; end - else if FLine[Run] = '*' then + else if fLine[Run] = '*' then begin Inc(Run); - if FLine[Run] = ACloseChar then + if fLine[Run] = ACloseChar then begin Inc(Run); - if FRange.Level > 0 then - Dec(FRange.Level); - if FRange.Level = 0 then + if fRange.Level > 0 then + Dec(fRange.Level); + if fRange.Level = 0 then begin - FRange.TokenRange := Ord(trNone); + fRange.TokenRange := Ord(trNone); Break end; end; @@ -351,7 +306,7 @@ procedure TSynM3Syn.SymNestedHelperProc(AOpenChar, ACloseChar: WideChar); procedure TSynM3Syn.SymNullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -375,7 +330,7 @@ procedure TSynM3Syn.SymNumberProc; function IsExponentChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of 'd', 'D', 'e', 'E', 'x', 'X': Result := True; else @@ -385,124 +340,124 @@ procedure TSynM3Syn.SymNumberProc; begin - FTokenID := tkNumber; + fTokenID := tkNumber; BasedNumber := False; MaxDigit := 9; // skip leading zeros, but they can be numbers too - while FLine[Run] = '0' do + while fLine[Run] = '0' do Inc(Run); - if not IsIdentChar(FLine[Run]) then + if not IsIdentChar(fLine[Run]) then Exit; // check for numbers with a base prefix - if CharInSet(FLine[Run], ['2'..'9']) and (FLine[Run + 1] = '_') then + if CharInSet(fLine[Run], ['2'..'9']) and (fLine[Run + 1] = '_') then begin BasedNumber := True; - MaxDigit := Ord(FLine[Run]) - Ord('0') - 1; + MaxDigit := Ord(fLine[Run]) - Ord('0') - 1; Inc(Run, 2); end - else if (FLine[Run] = '1') and CharInSet(FLine[Run + 1], ['0'..'6']) - and (FLine[Run + 2] = '_') then + else if (fLine[Run] = '1') and CharInSet(fLine[Run + 1], ['0'..'6']) + and (fLine[Run + 2] = '_') then begin BasedNumber := True; - MaxDigit := 10 + Ord(FLine[Run + 1]) - Ord('0') - 1; + MaxDigit := 10 + Ord(fLine[Run + 1]) - Ord('0') - 1; Inc(Run, 3); end; if BasedNumber then begin // advance over all valid digits, but at least one has to be there - if IsValidDigit(FLine[Run]) then + if IsValidDigit(fLine[Run]) then begin repeat Inc(Run); - until not IsValidDigit(FLine[Run]); + until not IsValidDigit(fLine[Run]); end else - FTokenID := tkSyntaxError; + fTokenID := tkSyntaxError; end else begin // "normal" numbers repeat Inc(Run); - until not CharInSet(FLine[Run], ['0'..'9']); + until not CharInSet(fLine[Run], ['0'..'9']); // can include a decimal point and an exponent - if FLine[Run] = '.' then + if fLine[Run] = '.' then begin Inc(Run); - if CharInSet(FLine[Run], ['0'..'9']) then + if CharInSet(fLine[Run], ['0'..'9']) then begin repeat Inc(Run); - until not CharInSet(FLine[Run], ['0'..'9']); + until not CharInSet(fLine[Run], ['0'..'9']); end else - FTokenID := tkSyntaxError; // must be a number after the '.' + fTokenID := tkSyntaxError; // must be a number after the '.' end; // can include an exponent if IsExponentChar then begin Inc(Run); - if CharInSet(FLine[Run], ['+', '-']) then + if CharInSet(fLine[Run], ['+', '-']) then Inc(Run); - if CharInSet(FLine[Run], ['0'..'9']) then + if CharInSet(fLine[Run], ['0'..'9']) then begin repeat Inc(Run); - until not CharInSet(FLine[Run], ['0'..'9']); + until not CharInSet(fLine[Run], ['0'..'9']); end else // exponent must include a number - FTokenID := tkSyntaxError; + fTokenID := tkSyntaxError; end; end; // it's a syntax error if there are any Identifier chars left - if IsIdentChar(FLine[Run]) then + if IsIdentChar(fLine[Run]) then begin - FTokenID := tkSyntaxError; + fTokenID := tkSyntaxError; repeat Inc(Run); - until not IsIdentChar(FLine[Run]); + until not IsIdentChar(fLine[Run]); end; end; procedure TSynM3Syn.SymPragmaProc; begin Inc(Run); - if FLine[Run] = '*' then + if fLine[Run] = '*' then begin Inc(Run); - FRange.TokenRange := Ord(trPragma); - Inc(FRange.Level); + fRange.TokenRange := Ord(trPragma); + Inc(fRange.Level); if IsLineEnd(Run) then - FTokenID := tkPragma + fTokenID := tkPragma else SymPragmaHelpProc; end else - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynM3Syn.SymPragmaHelpProc; begin - FTokenID := tkPragma; + fTokenID := tkPragma; SymNestedHelperProc('<', '>'); end; procedure TSynM3Syn.SymRoundOpenProc; begin Inc(Run); - if FLine[Run] = '*' then + if fLine[Run] = '*' then begin Inc(Run); - FRange.TokenRange := Ord(trComment); - Inc(FRange.Level); + fRange.TokenRange := Ord(trComment); + Inc(fRange.Level); if IsLineEnd(Run) then - FTokenID := tkComment + fTokenID := tkComment else SymCommentHelpProc; end else begin - FTokenID := tkSymbol; - if FLine[Run] = '.' then + fTokenID := tkSymbol; + if fLine[Run] = '.' then Inc(Run); end; end; @@ -510,22 +465,22 @@ procedure TSynM3Syn.SymRoundOpenProc; procedure TSynM3Syn.SymSpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynM3Syn.SymStringProc; begin - FTokenID := tkString; + fTokenID := tkString; Inc(Run); while not IsLineEnd(Run) do begin - case FLine[Run] of + case fLine[Run] of #34: begin Inc(Run); Break; end; - '\': if CharInSet(FLine[Run + 1], [#34, '\']) then + '\': if CharInSet(fLine[Run + 1], [#34, '\']) then Inc(Run); end; Inc(Run); @@ -535,23 +490,23 @@ procedure TSynM3Syn.SymStringProc; procedure TSynM3Syn.SymSymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynM3Syn.SymUnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynM3Syn.Next; begin - FTokenPos := Run; - case TTokenRange(FRange.TokenRange) of + fTokenPos := Run; + case TTokenRange(fRange.TokenRange) of trComment: SymCommentHelpProc; trPragma: SymPragmaHelpProc; else - case FLine[Run] of + case fLine[Run] of #39: SymAsciiCharProc; #13: SymCRProc; 'A'..'Z', 'a'..'z', '_': SymIdentProc; @@ -573,12 +528,12 @@ function TSynM3Syn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -586,12 +541,12 @@ function TSynM3Syn.GetDefaultAttribute(Index: Integer): function TSynM3Syn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynM3Syn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterModula3; + Result := fDefaultFilter <> SYNS_FilterModula3; end; class function TSynM3Syn.GetLanguageName: string; @@ -599,25 +554,25 @@ class function TSynM3Syn.GetLanguageName: string; Result := SYNS_LangModula3; end; -function TSynM3Syn.GetRange: Pointer; +function TSynM3Syn.GetRange: pointer; begin - Result := FRange.p; + Result := fRange.P; end; function TSynM3Syn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkPragma: Result:= FPragmaAttri; - tkReserved: Result := FReservedAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkSyntaxError: Result := FSyntaxErrorAttri; - tkUnknown: Result := FIdentifierAttri; + case fTokenID of + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkPragma: Result:= fPragmaAttri; + tkReserved: Result := fReservedAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkSyntaxError: Result := fSyntaxErrorAttri; + tkUnknown: Result := fIdentifierAttri; else Result := nil; end; @@ -625,31 +580,40 @@ function TSynM3Syn.GetTokenAttribute: TSynHighlighterAttributes; function TSynM3Syn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynM3Syn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; procedure TSynM3Syn.ResetRange; begin - FRange.p := nil; + fRange.P := nil; end; -procedure TSynM3Syn.SetRange(Value: Pointer); +procedure TSynM3Syn.SetRange(Value: pointer); begin - FRange.p := Value; + fRange.P := Value; end; -class function TSynM3Syn.GetFriendlyLanguageName: UnicodeString; +class function TSynM3Syn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangModula3; end; +function TSynM3Syn.GetSampleSource: string; +begin + Result := + 'MODULE Main;' + #13#10 + + '(* An insightful comment! *)' + #13#10 + + 'IMPORT IO;' + #13#10 + + 'BEGIN' + #13#10 + + ' IO.Put("Hello World\n")' + #13#10 + + 'END Main.'; +end; + initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynM3Syn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterManager.pas b/Ext/SynEdit/Source/SynHighlighterManager.pas index a6d322d..ab3bd59 100644 --- a/Ext/SynEdit/Source/SynHighlighterManager.pas +++ b/Ext/SynEdit/Source/SynHighlighterManager.pas @@ -27,11 +27,6 @@ If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: SynHighlighterManager.pas,v 1.7.2.2 2008/03/01 18:32:02 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - Known Issues: - does not work when dropped on a frame in Delphi 5 -------------------------------------------------------------------------------} @@ -89,11 +84,7 @@ TSynHighlighterManager = class(TComponent) implementation uses -{$IFDEF SYN_COMPILER_6_UP} DesignIntf, -{$ELSE} - DsgnIntf, -{$ENDIF} Windows, Forms, Controls, @@ -111,22 +102,13 @@ TSynHighlighterForm = class(TForm) btnOK: TButton; btnCancel: TButton; Highlight: TSynHighlighterList; - constructor Create(highlighters: TSynHighlighterList); - {$IFDEF SYN_COMPILER_4_UP}reintroduce;{$ENDIF} + constructor Create(highlighters: TSynHighlighterList); reintroduce; procedure LoadForm; procedure SelectAll(Sender: TObject); procedure DeselectAll(Sender: TObject); end; - {$IFDEF SYN_COMPILER_4_UP} - {$IFDEF SYN_COMPILER_6_UP} - TDesignerClass = IDesigner; - {$ELSE} - TDesignerClass = IFormDesigner; - {$ENDIF} - {$ELSE} - TDesignerClass = TFormDesigner; - {$ENDIF} + TDesignerClass = IDesigner; { TSynHighlighterManager } @@ -139,27 +121,27 @@ constructor TSynHighlighterManager.Create(AOwner: TComponent); procedure CheckExisting; var - i: integer; - j: integer; + I: Integer; + J: Integer; begin - for i := 0 to form.ComponentCount-1 do begin - j := highlight.FindByClass(form.Components[i]); - if j >= 0 then begin - j := synForm.clbHighlighters.Items.IndexOf(highlight[j].GetFriendlyLanguageName); - if j >= 0 then - synForm.clbHighlighters.Checked[j] := true; + for I := 0 to form.ComponentCount-1 do begin + J := highlight.FindByClass(form.Components[I]); + if J >= 0 then begin + J := synForm.clbHighlighters.Items.IndexOf(highlight[J].GetFriendlyLanguageName); + if J >= 0 then + synForm.clbHighlighters.Checked[J] := True; end; end; //for end; - function FindHighlighterComp(hlClass: TSynCustomHighlighterClass): integer; + function FindHighlighterComp(hlClass: TSynCustomHighlighterClass): Integer; var - i: integer; + I: Integer; begin Result := -1; - for i := 0 to form.ComponentCount-1 do begin - if form.Components[i] is hlClass then begin - Result := i; + for I := 0 to form.ComponentCount-1 do begin + if form.Components[I] is hlClass then begin + Result := I; Exit; end; end; //for @@ -167,24 +149,24 @@ constructor TSynHighlighterManager.Create(AOwner: TComponent); procedure PlaceNew; var - i: integer; - high: integer; - comp: integer; - xpos, ypos: integer; - xstart: integer; + I: Integer; + high: Integer; + comp: Integer; + xpos, ypos: Integer; + xstart: Integer; procedure GetStartCoordinates; var - compTop: integer; - compLeft: integer; - i: integer; + compTop: Integer; + compLeft: Integer; + I: Integer; begin xpos := -1; ypos := -1; - for i := 0 to form.ComponentCount-1 do begin - if form.Components[i] is TSynCustomHighlighterClass then begin - compLeft := LongRec(form.Components[i].DesignInfo).Lo; - compTop := LongRec(form.Components[i].DesignInfo).Hi; + for I := 0 to form.ComponentCount-1 do begin + if form.Components[I] is TSynCustomHighlighterClass then begin + compLeft := LongRec(form.Components[I].DesignInfo).Lo; + compTop := LongRec(form.Components[I].DesignInfo).Hi; if (xpos < 0) or (compLeft < xpos) then xpos := compLeft; if (ypos < 0) or (compTop < ypos) then @@ -207,24 +189,24 @@ constructor TSynHighlighterManager.Create(AOwner: TComponent); end; end; - function CoordinatesTaken: boolean; + function CoordinatesTaken: Boolean; var - compTop: integer; - compLeft: integer; + compTop: Integer; + compLeft: Integer; compRect: TRect; testRect: TRect; interRect: TRect; - i: integer; + I: Integer; begin - Result := false; + Result := False; testRect := Rect(xpos,ypos,xpos+31,ypos+31); - for i := 0 to form.ComponentCount-1 do begin - if (form.Components[i] <> self) and (not (form.Components[i] is TControl)) then begin - compLeft := LongRec(form.Components[i].DesignInfo).Lo; - compTop := LongRec(form.Components[i].DesignInfo).Hi; + for I := 0 to form.ComponentCount-1 do begin + if (form.Components[I] <> self) and (not (form.Components[I] is TControl)) then begin + compLeft := LongRec(form.Components[I].DesignInfo).Lo; + compTop := LongRec(form.Components[I].DesignInfo).Hi; compRect := Rect(compLeft,compTop,compLeft+31,compTop+31); if IntersectRect(interRect,testRect,compRect) then begin - Result := true; + Result := True; Exit; end; end; @@ -243,9 +225,9 @@ constructor TSynHighlighterManager.Create(AOwner: TComponent); // inserted highlighters to be sorted by name. // Iterate twice - delete highlighters in first pass (to make place), create // in second. - for i := 0 to synForm.clbHighlighters.Items.Count-1 do begin - if not synForm.clbHighlighters.Checked[i] then begin // unchecked - remove - high := highlight.FindByFriendlyName(synForm.clbHighlighters.Items[i]); + for I := 0 to synForm.clbHighlighters.Items.Count-1 do begin + if not synForm.clbHighlighters.Checked[I] then begin // unchecked - remove + high := highlight.FindByFriendlyName(synForm.clbHighlighters.Items[I]); if high >= 0 then begin comp := FindHighlighterComp(highlight[high]); if comp >= 0 then @@ -253,9 +235,9 @@ constructor TSynHighlighterManager.Create(AOwner: TComponent); end; end; end; //for - for i := 0 to synForm.clbHighlighters.Items.Count-1 do begin - if synForm.clbHighlighters.Checked[i] then begin // checked - add - high := highlight.FindByFriendlyName(synForm.clbHighlighters.Items[i]); + for I := 0 to synForm.clbHighlighters.Items.Count-1 do begin + if synForm.clbHighlighters.Checked[I] then begin // checked - add + high := highlight.FindByFriendlyName(synForm.clbHighlighters.Items[I]); if high >= 0 then begin if FindHighlighterComp(highlight[high]) < 0 then begin GetFreeCoordinates; @@ -293,16 +275,22 @@ constructor TSynHighlighterManager.Create(AOwner: TComponent); { TSynHighlighterForm } constructor TSynHighlighterForm.Create(highlighters: TSynHighlighterList); + + function PPIScale(Value: Integer): Integer; + begin + Result := MulDiv(Value, Application.MainForm.CurrentPPI, 96); + end; + begin CreateNew(nil); Caption := 'Highlighter Manager'; - Width := 410; - Height := 243; + ClientWidth := PPIScale(403); + ClientHeight := PPIScale(217); Position := poScreenCenter; BorderStyle := bsDialog; Highlight := highlighters; - + //object clbHighlighters: TCheckListBox // Left = 8 // Top = 8 @@ -360,22 +348,22 @@ constructor TSynHighlighterForm.Create(highlighters: TSynHighlighterList); begin Name := 'clbHighlighters'; Parent := Self; - Left := 8; - Top := 8; - Width := 305; - Height := 201; - ItemHeight := 13; - Sorted := true; + Left := PPIScale(8); + Top := PPIScale(8); + Width := PPIScale(305); + Height := PPIScale(201); + //ItemHeight := 13; + Sorted := True; TabOrder := 0; end; with btnSelectAll do begin Name := 'btnSelectAll'; Parent := Self; - Left := 320; - Top := 8; - Width := 75; - Height := 25; + Left := PPIScale(320); + Top := PPIScale(8); + Width := PPIScale(75); + Height := PPIScale(25); Caption := '&Select All'; TabOrder := 1; OnClick := SelectAll; @@ -384,10 +372,10 @@ constructor TSynHighlighterForm.Create(highlighters: TSynHighlighterList); begin Name := 'btnDeselectAll'; Parent := Self; - Left := 320; - Top := 40; - Width := 75; - Height := 25; + Left := PPIScale(320); + Top := PPIScale(40); + Width := PPIScale(75); + Height := PPIScale(25); Caption := '&Deselect All'; TabOrder := 2; OnClick := DeselectAll; @@ -396,10 +384,10 @@ constructor TSynHighlighterForm.Create(highlighters: TSynHighlighterList); begin Name := 'btnOK'; Parent := Self; - Left := 320; - Top := 152; - Width := 75; - Height := 25; + Left := PPIScale(320); + Top := PPIScale(152); + Width := PPIScale(75); + Height := PPIScale(25); Caption := 'OK'; Default := True; ModalResult := 1; @@ -409,10 +397,10 @@ constructor TSynHighlighterForm.Create(highlighters: TSynHighlighterList); begin Name := 'btnCancel'; Parent := Self; - Left := 320; - Top := 184; - Width := 75; - Height := 25; + Left := PPIScale(320); + Top := PPIScale(184); + Width := PPIScale(75); + Height := PPIScale(25); Caption := 'Cancel'; ModalResult := 2; TabOrder := 4; @@ -422,28 +410,28 @@ constructor TSynHighlighterForm.Create(highlighters: TSynHighlighterList); procedure TSynHighlighterForm.DeselectAll(Sender: TObject); var - i: integer; + I: Integer; begin - for i := 0 to clbHighlighters.Items.Count-1 do - clbHighlighters.Checked[i] := false; + for I := 0 to clbHighlighters.Items.Count-1 do + clbHighlighters.Checked[I] := False; end; procedure TSynHighlighterForm.LoadForm; var - i: integer; + I: Integer; begin clbHighlighters.Clear; - for i := 0 to Highlight.Count-1 do begin - clbHighlighters.Items.Add(Highlight[i].GetFriendlyLanguageName); + for I := 0 to Highlight.Count-1 do begin + clbHighlighters.Items.Add(Highlight[I].GetFriendlyLanguageName); end; //for end; procedure TSynHighlighterForm.SelectAll(Sender: TObject); var - i: integer; + I: Integer; begin - for i := 0 to clbHighlighters.Items.Count-1 do - clbHighlighters.Checked[i] := true; + for I := 0 to clbHighlighters.Items.Count-1 do + clbHighlighters.Checked[I] := True; end; end. diff --git a/Ext/SynEdit/Source/SynHighlighterModelica.pas b/Ext/SynEdit/Source/SynHighlighterModelica.pas index 3f5ea31..dbb6908 100644 --- a/Ext/SynEdit/Source/SynHighlighterModelica.pas +++ b/Ext/SynEdit/Source/SynHighlighterModelica.pas @@ -25,13 +25,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterModelica.pas,v 1.12.2.6 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} unit SynHighlighterModelica; @@ -61,17 +54,17 @@ interface type TSynModelicaSyn = class(TSynCustomHighlighter) private - FRange: TRangeState; - FTokenID: TtkTokenKind; - FIdentFuncTable: array[0..96] of TIdentFuncTableFunc; - FCommentAttri: TSynHighlighterAttributes; - FDirectiveAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; + fRange: TRangeState; + fTokenID: TtkTokenKind; + fIdentFuncTable: array[0..96] of TIdentFuncTableFunc; + fCommentAttri: TSynHighlighterAttributes; + fDirectiveAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; function AltFunc(Index: Integer): TtkTokenKind; function KeyWordFunc(Index: Integer): TtkTokenKind; function HashKey(Str: PWideChar): Cardinal; @@ -105,7 +98,7 @@ TSynModelicaSyn = class(TSynCustomHighlighter) function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; @@ -119,21 +112,21 @@ TSynModelicaSyn = class(TSynCustomHighlighter) procedure SetRange(Value: Pointer); override; procedure ResetRange; override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property DirectiveAttri: TSynHighlighterAttributes read FDirectiveAttri - write FDirectiveAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property DirectiveAttri: TSynHighlighterAttributes read fDirectiveAttri + write fDirectiveAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; end; implementation @@ -142,7 +135,7 @@ implementation SynEditStrConst; const - KeyWords: array[0..47] of UnicodeString = ( + KeyWords: array[0..47] of string = ( 'algorithm', 'and', 'annotation', 'assert', 'block', 'Boolean', 'class', 'connect', 'connector', 'constant', 'der', 'discrete', 'else', 'elseif', 'end', 'equation', 'extends', 'external', 'false', 'final', 'flow', 'for', @@ -170,7 +163,7 @@ function TSynModelicaSyn.HashKey(Str: PWideChar): Cardinal; Inc(Str); end; Result := Result mod 97; - FStringLen := Str - FToIdent; + fStringLen := Str - fToIdent; end; {$Q+} @@ -178,25 +171,25 @@ function TSynModelicaSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; procedure TSynModelicaSyn.InitIdent; var - i: Integer; + I: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; + for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if KeyIndices[I] = -1 then + fIdentFuncTable[I] := AltFunc; - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if @FIdentFuncTable[i] = nil then - FIdentFuncTable[i] := KeyWordFunc; + for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if @fIdentFuncTable[I] = nil then + fIdentFuncTable[I] := KeyWordFunc; end; function TSynModelicaSyn.AltFunc(Index: Integer): TtkTokenKind; @@ -216,73 +209,73 @@ constructor TSynModelicaSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := True; - - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - AddAttribute(FCommentAttri); - FDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective); - AddAttribute(FDirectiveAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); + fCaseSensitive := True; + + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + AddAttribute(fCommentAttri); + fDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective); + AddAttribute(fDirectiveAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FDefaultFilter := SYNS_FilterModelica; - FRange := rsUnknown; + fDefaultFilter := SYNS_FilterModelica; + fRange := rsUnknown; end; procedure TSynModelicaSyn.AndSymbolProc; begin Inc(Run); - FTokenID := tkSymbol; - if CharInSet(FLine[Run], ['=', '&']) then + fTokenID := tkSymbol; + if CharInSet(fLine[Run], ['=', '&']) then Inc(Run); end; procedure TSynModelicaSyn.AsciiCharProc; begin - FRange := rsString39; - FTokenID := tkString; + fRange := rsString39; + fTokenID := tkString; repeat Inc(Run); - until IsLineEnd(Run) or (FLine[Run] = #39); - if FLine[Run] = #39 then + until IsLineEnd(Run) or (fLine[Run] = #39); + if fLine[Run] = #39 then begin - FRange := rsUnknown; + fRange := rsUnknown; Inc(Run); end; end; procedure TSynModelicaSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then + if fLine[Run] = #10 then Inc(Run); end; procedure TSynModelicaSyn.ColonProc; begin Inc(Run); - FTokenID := tkSymbol; - if FLine[Run] = ':' then + fTokenID := tkSymbol; + if fLine[Run] = ':' then Inc(Run); end; procedure TSynModelicaSyn.DirectiveProc; begin - FTokenID := tkDirective; + fTokenID := tkDirective; repeat Inc(Run); until IsLineEnd(Run); @@ -291,12 +284,12 @@ procedure TSynModelicaSyn.DirectiveProc; procedure TSynModelicaSyn.GreaterProc; begin Inc(Run); - FTokenID := tkSymbol; - case FLine[Run] of + fTokenID := tkSymbol; + case fLine[Run] of '=': Inc(Run); '>': begin Inc(Run); - if FLine[Run] = '=' then + if fLine[Run] = '=' then Inc(Run); end; end; @@ -304,26 +297,26 @@ procedure TSynModelicaSyn.GreaterProc; procedure TSynModelicaSyn.IdentProc; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do Inc(Run); + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynModelicaSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynModelicaSyn.LowerProc; begin Inc(Run); - FTokenID := tkSymbol; - case FLine[Run] of + fTokenID := tkSymbol; + case fLine[Run] of '=': Inc(Run); '<': begin Inc(Run); - if FLine[Run] = '=' then + if fLine[Run] = '=' then Inc(Run); end; end; @@ -332,14 +325,14 @@ procedure TSynModelicaSyn.LowerProc; procedure TSynModelicaSyn.MinusProc; begin Inc(Run); - FTokenID := tkSymbol; - if CharInSet(FLine[Run], ['=', '-', '>']) then + fTokenID := tkSymbol; + if CharInSet(fLine[Run], ['=', '-', '>']) then Inc(Run); end; procedure TSynModelicaSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -347,7 +340,7 @@ procedure TSynModelicaSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', 'u', 'U', 'l', 'L', 'x', 'X', 'e', 'E', 'f', 'F': Result := True; else @@ -357,7 +350,7 @@ procedure TSynModelicaSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of @@ -371,68 +364,68 @@ procedure TSynModelicaSyn.NumberProc; procedure TSynModelicaSyn.OrSymbolProc; begin Inc(Run); - FTokenID := tkSymbol; - if CharInSet(FLine[Run], ['=', '|']) then + fTokenID := tkSymbol; + if CharInSet(fLine[Run], ['=', '|']) then Inc(Run); end; procedure TSynModelicaSyn.PlusProc; begin Inc(Run); - FTokenID := tkSymbol; - if CharInSet(FLine[Run], ['=', '+']) then + fTokenID := tkSymbol; + if CharInSet(fLine[Run], ['=', '+']) then Inc(Run); end; procedure TSynModelicaSyn.PointProc; begin Inc(Run); - FTokenID := tkSymbol; - if (FLine[Run] = '.') and (FLine[Run + 1] = '.') then + fTokenID := tkSymbol; + if (fLine[Run] = '.') and (fLine[Run + 1] = '.') then Inc(Run, 2); end; procedure TSynModelicaSyn.SlashProc; begin Inc(Run); - case FLine[Run] of + case fLine[Run] of '/': begin - FTokenID := tkComment; + fTokenID := tkComment; repeat Inc(Run); until IsLineEnd(Run); end; '*': begin - FRange := rsComment; + fRange := rsComment; Inc(Run); if IsLineEnd(Run) then - FTokenID := tkComment + fTokenID := tkComment else AnsiCProc; end; else - FTokenID := tkSymbol; - if FLine[Run] = '=' then + fTokenID := tkSymbol; + if fLine[Run] = '=' then Inc(Run); end; end; procedure TSynModelicaSyn.SpaceProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; repeat Inc(Run); - until (FLine[Run] > #32) or IsLineEnd(Run); + until (fLine[Run] > #32) or IsLineEnd(Run); end; procedure TSynModelicaSyn.StringProc; begin - FRange := rsString34; + fRange := rsString34; Inc(Run); if IsLineEnd(Run) then - FTokenID := tkString + fTokenID := tkString else String34Proc; end; @@ -440,35 +433,35 @@ procedure TSynModelicaSyn.StringProc; procedure TSynModelicaSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenId := tkSymbol; end; procedure TSynModelicaSyn.SymbolProcWithEqual; begin Inc(Run); - FTokenID := tkSymbol; - if FLine[Run] = '=' then + fTokenID := tkSymbol; + if fLine[Run] = '=' then Inc(Run); end; procedure TSynModelicaSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynModelicaSyn.AnsiCProc; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; else - FTokenID := tkComment; + fTokenID := tkComment; repeat - if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then begin + if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then begin Inc(Run, 2); - FRange := rsUnknown; + fRange := rsUnknown; Break; end; Inc(Run); @@ -478,16 +471,16 @@ procedure TSynModelicaSyn.AnsiCProc; procedure TSynModelicaSyn.String39Proc; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; else - FTokenID := tkString; + fTokenID := tkString; repeat - if FLine[Run] = #39 then begin + if fLine[Run] = #39 then begin Inc(Run); - FRange := rsUnknown; + fRange := rsUnknown; Break; end; Inc(Run); @@ -497,24 +490,24 @@ procedure TSynModelicaSyn.String39Proc; procedure TSynModelicaSyn.String34Proc; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; else - FTokenID := tkString; + fTokenID := tkString; repeat - case FLine[Run] of + case fLine[Run] of #34: begin Inc(Run); - FRange := rsUnknown; + fRange := rsUnknown; Break; end; #92: begin Inc(Run); - if FLine[Run] = #34 then + if fLine[Run] = #34 then Inc(Run); end; else @@ -526,14 +519,14 @@ procedure TSynModelicaSyn.String34Proc; procedure TSynModelicaSyn.Next; begin - FTokenPos := Run; - case FRange of + fTokenPos := Run; + case fRange of rsComment: AnsiCProc; rsString39: String39Proc; rsString34: String34Proc; else - FRange := rsUnknown; - case FLine[Run] of + fRange := rsUnknown; + case fLine[Run] of '&': AndSymbolProc; #39: AsciiCharProc; #13: CRProc; @@ -563,12 +556,12 @@ procedure TSynModelicaSyn.Next; function TSynModelicaSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -576,31 +569,31 @@ function TSynModelicaSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAtt function TSynModelicaSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynModelicaSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; function TSynModelicaSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynModelicaSyn.GetTokenAttribute: TSynHighlighterAttributes; begin case GetTokenID of - tkComment: Result := FCommentAttri; - tkDirective: Result := FDirectiveAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FIdentifierAttri; + tkComment: Result := fCommentAttri; + tkDirective: Result := fDirectiveAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fIdentifierAttri; else Result := nil; end; @@ -608,22 +601,22 @@ function TSynModelicaSyn.GetTokenAttribute: TSynHighlighterAttributes; function TSynModelicaSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; procedure TSynModelicaSyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; end; procedure TSynModelicaSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; function TSynModelicaSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterModelica; + Result := fDefaultFilter <> SYNS_FilterModelica; end; class function TSynModelicaSyn.GetLanguageName: string; @@ -631,13 +624,11 @@ class function TSynModelicaSyn.GetLanguageName: string; Result := SYNS_LangModelica; end; -class function TSynModelicaSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynModelicaSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangModelica; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynModelicaSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterMsg.pas b/Ext/SynEdit/Source/SynHighlighterMsg.pas index 175708d..086d838 100644 --- a/Ext/SynEdit/Source/SynHighlighterMsg.pas +++ b/Ext/SynEdit/Source/SynHighlighterMsg.pas @@ -27,12 +27,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterMsg.pas,v 1.8.2.6 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -------------------------------------------------------------------------------} unit SynHighlighterMsg; @@ -61,23 +55,23 @@ interface tkTerminator, tkUnknown); - TRangeState = (rsUnknown, rsBraceComment, rsString); + TRangeState = (rsUnKnown, rsBraceComment, rsString); PIdentFuncTableFunc = ^TIdentFuncTableFunc; TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; TSynMsgSyn = class(TSynCustomHighlighter) private - FRange: TRangeState; - FTokenID: TtkTokenKind; - FIdentFuncTable: array[0..6] of TIdentFuncTableFunc; - FCommentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FTerminatorAttri: TSynHighlighterAttributes; + fRange: TRangeState; + fTokenID: TtkTokenKind; + fIdentFuncTable: array[0..6] of TIdentFuncTableFunc; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fTerminatorAttri: TSynHighlighterAttributes; function AltFunc(Index: Integer): TtkTokenKind; function FuncBeginproc(Index: Integer): TtkTokenKind; function FuncChars(Index: Integer): TtkTokenKind; @@ -102,12 +96,12 @@ TSynMsgSyn = class(TSynCustomHighlighter) procedure StringOpenProc; procedure StringProc; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public constructor Create(AOwner: TComponent); override; class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; function GetRange: Pointer; override; procedure ResetRange; override; procedure SetRange(Value: Pointer); override; @@ -119,13 +113,13 @@ TSynMsgSyn = class(TSynCustomHighlighter) function IsIdentChar(AChar: WideChar): Boolean; override; procedure Next; override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri; - property TerminatorAttri: TSynHighlighterAttributes read FTerminatorAttri write FTerminatorAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri; + property TerminatorAttri: TSynHighlighterAttributes read fTerminatorAttri write fTerminatorAttri; end; implementation @@ -134,7 +128,7 @@ implementation SynEditStrConst; const - KeyWords: array[0..6] of UnicodeString = ( + KeyWords: array[0..6] of string = ( 'beginproc', 'chars', 'enclosedby', 'endproc', 'keys', 'samplesource', 'tokentypes' ); @@ -153,7 +147,7 @@ function TSynMsgSyn.HashKey(Str: PWideChar): Cardinal; Inc(Str); end; Result := Result mod 7; - FStringLen := Str - FToIdent; + fStringLen := Str - fToIdent; end; {$Q+} @@ -161,10 +155,10 @@ function TSynMsgSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; @@ -173,17 +167,17 @@ procedure TSynMsgSyn.InitIdent; var i: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; + fIdentFuncTable[i] := AltFunc; - FIdentFuncTable[4] := FuncBeginproc; - FIdentFuncTable[1] := FuncChars; - FIdentFuncTable[0] := FuncEnclosedby; - FIdentFuncTable[6] := FuncEndproc; - FIdentFuncTable[3] := FuncKeys; - FIdentFuncTable[5] := FuncSamplesource; - FIdentFuncTable[2] := FuncTokentypes; + fIdentFuncTable[4] := FuncBeginproc; + fIdentFuncTable[1] := FuncChars; + fIdentFuncTable[0] := FuncEnclosedby; + fIdentFuncTable[6] := FuncEndproc; + fIdentFuncTable[3] := FuncKeys; + fIdentFuncTable[5] := FuncSamplesource; + fIdentFuncTable[2] := FuncTokentypes; end; function TSynMsgSyn.AltFunc(Index: Integer): TtkTokenKind; @@ -250,52 +244,52 @@ function TSynMsgSyn.FuncTokentypes(Index: Integer): TtkTokenKind; procedure TSynMsgSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynMsgSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; procedure TSynMsgSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then + if fLine[Run] = #10 then Inc(Run); end; procedure TSynMsgSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynMsgSyn.BraceCommentOpenProc; begin Inc(Run); - FRange := rsBraceComment; + fRange := rsBraceComment; BraceCommentProc; - FTokenID := tkComment; + fTokenID := tkComment; end; procedure TSynMsgSyn.BraceCommentProc; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; else begin - FTokenID := tkComment; + fTokenID := tkComment; repeat - if (FLine[Run] = '}') then + if (fLine[Run] = '}') then begin Inc(Run, 1); - FRange := rsUnknown; + fRange := rsUnKnown; Break; end; if not IsLineEnd(Run) then @@ -308,19 +302,19 @@ procedure TSynMsgSyn.BraceCommentProc; procedure TSynMsgSyn.StringOpenProc; begin Inc(Run); - FRange := rsString; + fRange := rsString; StringProc; - FTokenID := tkString; + fTokenID := tkString; end; procedure TSynMsgSyn.StringProc; begin - FTokenID := tkString; + fTokenID := tkString; repeat - if (FLine[Run] = '''') then + if (fLine[Run] = '''') then begin Inc(Run, 1); - FRange := rsUnknown; + fRange := rsUnKnown; Break; end; if not IsLineEnd(Run) then @@ -332,79 +326,79 @@ constructor TSynMsgSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := False; + fCaseSensitive := False; - FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - FCommentAttri.Foreground := clNavy; - AddAttribute(FCommentAttri); + fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + fCommentAttri.Foreground := clNavy; + AddAttribute(fCommentAttri); - FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); + fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); - FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); + fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); - FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); + fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); - FStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); + fStringAttri := TSynHighLighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); - FSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); + fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); - FTerminatorAttri := TSynHighLighterAttributes.Create(SYNS_AttrTerminator, SYNS_FriendlyAttrTerminator); - AddAttribute(FTerminatorAttri); + fTerminatorAttri := TSynHighLighterAttributes.Create(SYNS_AttrTerminator, SYNS_FriendlyAttrTerminator); + AddAttribute(fTerminatorAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FDefaultFilter := SYNS_FilterSynGenMsgfiles; - FRange := rsUnknown; + fDefaultFilter := SYNS_FilterSynGenMsgfiles; + fRange := rsUnknown; end; procedure TSynMsgSyn.IdentProc; begin - FTokenID := IdentKind(FLine + Run); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do + fTokenID := IdentKind(fLine + Run); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynMsgSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynMsgSyn.TerminatorProc; begin Inc(Run); - if (FLine[Run] = '>') and (FLine[Run + 1] = '<') and (FLine[Run + 2] = '|') then + if (fLine[Run] = '>') and (fLine[Run + 1] = '<') and (fLine[Run + 2] = '|') then begin - FTokenID := tkTerminator; + fTokenID := tkTerminator; Inc(Run, 3); end else - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynMsgSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynMsgSyn.Next; begin - FTokenPos := Run; - case FRange of + fTokenPos := Run; + case fRange of rsBraceComment: BraceCommentProc; else begin - FRange := rsUnknown; - case FLine[Run] of + fRange := rsUnknown; + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; @@ -424,12 +418,12 @@ procedure TSynMsgSyn.Next; function TSynMsgSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -437,25 +431,25 @@ function TSynMsgSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttribut function TSynMsgSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynMsgSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynMsgSyn.GetTokenAttribute: TSynHighLighterAttributes; begin case GetTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkTerminator: Result := FTerminatorAttri; - tkUnknown: Result := FIdentifierAttri; + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkTerminator: Result := fTerminatorAttri; + tkUnknown: Result := fIdentifierAttri; else Result := nil; end; @@ -463,10 +457,10 @@ function TSynMsgSyn.GetTokenAttribute: TSynHighLighterAttributes; function TSynMsgSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; -function TSynMsgSyn.GetSampleSource: UnicodeString; +function TSynMsgSyn.GetSampleSource: string; begin Result := 'TSynSampleSyn {first identifier is the class name }'#13#10 + 'tk {second identifier is the prefix }'#13#10 + @@ -479,7 +473,7 @@ function TSynMsgSyn.GetSampleSource: UnicodeString; function TSynMsgSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterSynGenMsgfiles; + Result := fDefaultFilter <> SYNS_FilterSynGenMsgfiles; end; function TSynMsgSyn.IsIdentChar(AChar: WideChar): Boolean; @@ -499,26 +493,24 @@ class function TSynMsgSyn.GetLanguageName: string; procedure TSynMsgSyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; end; procedure TSynMsgSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; function TSynMsgSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; -class function TSynMsgSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynMsgSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangSynGenMsgfiles; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynMsgSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterMulti.pas b/Ext/SynEdit/Source/SynHighlighterMulti.pas index 2c269aa..11841bd 100644 --- a/Ext/SynEdit/Source/SynHighlighterMulti.pas +++ b/Ext/SynEdit/Source/SynHighlighterMulti.pas @@ -25,13 +25,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterMulti.pas,v 1.34.2.11 2008/09/14 16:25:00 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a Multiple-highlighter syntax highlighter for SynEdit) @@ -50,54 +43,56 @@ interface uses - Windows, + Winapi.Windows, + System.Win.Registry, + System.RegularExpressions, SynEditTypes, SynEditHighlighter, SynUnicode, - Classes; + System.Classes; type TOnCheckMarker = procedure (Sender: TObject; var StartPos, MarkerLen: Integer; - var MarkerText: UnicodeString; Line: Integer; const LineStr: string) of object; + var MarkerText: string; Line: Integer; const LineStr: string) of object; TScheme = class(TCollectionItem) private - FEndExpr: UnicodeString; - FStartExpr: UnicodeString; - FHighlighter: TSynCustomHighLighter; - FMarkerAttri: TSynHighlighterAttributes; - FSchemeName: TComponentName; - FCaseSensitive: Boolean; - FOnCheckStartMarker: TOnCheckMarker; - FOnCheckEndMarker: TOnCheckMarker; - function ConvertExpression(const Value: UnicodeString): UnicodeString; + fEndExpr: string; + fStartExpr: string; + fEndRE: TRegEx; + fStartRE: TRegEx; + fHighlighter: TSynCustomHighLighter; + fMarkerAttri: TSynHighlighterAttributes; + fSchemeName: TComponentName; + fCaseSensitive: Boolean; + fOnCheckStartMarker: TOnCheckMarker; + fOnCheckEndMarker: TOnCheckMarker; + function ConvertExpression(const Value: string): string; procedure MarkerAttriChanged(Sender: TObject); procedure SetMarkerAttri(const Value: TSynHighlighterAttributes); procedure SetHighlighter(const Value: TSynCustomHighlighter); - procedure SetEndExpr(const Value: UnicodeString); - procedure SetStartExpr(const Value: UnicodeString); + procedure SetEndExpr(const Value: string); + procedure SetStartExpr(const Value: string); procedure SetCaseSensitive(const Value: Boolean); protected procedure DefineProperties(Filer: TFiler); override; -{$IFDEF SYN_COMPILER_3_UP} function GetDisplayName: string; override; procedure SetDisplayName(const Value: string); override; -{$ENDIF} public constructor Create(Collection: TCollection); override; destructor Destroy; override; published - property CaseSensitive: Boolean read FCaseSensitive write SetCaseSensitive + property CaseSensitive: Boolean read fCaseSensitive write SetCaseSensitive default True; - property StartExpr: UnicodeString read FStartExpr write SetStartExpr; - property EndExpr: UnicodeString read FEndExpr write SetEndExpr; - property Highlighter: TSynCustomHighlighter read FHighlighter + property StartExpr: string read fStartExpr write SetStartExpr; + property EndExpr: string read fEndExpr write SetEndExpr; + property Highlighter: TSynCustomHighlighter read fHighlighter write SetHighlighter; - property MarkerAttri: TSynHighlighterAttributes read FMarkerAttri + property MarkerAttri: TSynHighlighterAttributes read fMarkerAttri write SetMarkerAttri; - property SchemeName: TComponentName read FSchemeName write FSchemeName; - property OnCheckStartMarker: TOnCheckMarker read FOnCheckStartMarker write FOnCheckStartMarker; - property OnCheckEndMarker: TOnCheckMarker read FOnCheckEndMarker write FOnCheckEndMarker; + property SchemeName: TComponentName read fSchemeName write fSchemeName; + property OnCheckStartMarker: TOnCheckMarker read fOnCheckStartMarker write fOnCheckStartMarker; + property OnCheckEndMarker: TOnCheckMarker read fOnCheckEndMarker write fOnCheckEndMarker; end; TgmSchemeClass = class of TScheme; @@ -106,14 +101,12 @@ TSynMultiSyn = class; TSchemes = class(TCollection) private - FOwner: TSynMultiSyn; + fOwner: TSynMultiSyn; function GetItems(Index: Integer): TScheme; procedure SetItems(Index: Integer; const Value: TScheme); -{$IFDEF SYN_COMPILER_3_UP} protected function GetOwner: TPersistent; override; procedure Update(Item: TCollectionItem); override; -{$ENDIF} public constructor Create(aOwner: TSynMultiSyn); property Items[aIndex: Integer]: TScheme read GetItems write SetItems; @@ -122,28 +115,24 @@ TSchemes = class(TCollection) TMarker = class protected - FScheme: Integer; - FStartPos: Integer; - FMarkerLen: Integer; - FMarkerText: UnicodeString; - FIsOpenMarker: Boolean; + fScheme: Integer; + fStartPos: Integer; + fMarkerLen: Integer; + fMarkerText: string; + fIsOpenMarker: Boolean; public constructor Create(aScheme, aStartPos, aMarkerLen: Integer; - aIsOpenMarker: Boolean; const aMarkerText: UnicodeString); + aIsOpenMarker: Boolean; const aMarkerText: string); end; TRangeOperation = (roGet, roSet); -{$IFDEF SYN_COMPILER_16_UP} TRangeUNativeInt = NativeUInt; -{$ELSE} - TRangeUNativeInt = Cardinal; -{$ENDIF} TRangeProc = procedure (Operation: TRangeOperation; var Range: TRangeUNativeInt) of object; TCustomRangeEvent = procedure (Sender: TSynMultiSyn; Operation: TRangeOperation; - var Range: Pointer) of object; + var Range: pointer) of object; { * Usage notes * @@ -170,8 +159,8 @@ TMarker = class Index of the scheme that is currently parsing. DefaultHighlighter maps to -1. * Implementation notes * - FTmpRange: - Using the OldRangeProc, FTmpRange was the only way to restore the Range + fTmpRange: + Using the OldRangeProc, fTmpRange was the only way to restore the Range of the DefaultHighlighter after a Scheme spanned across multiple lines. With the NewRangeProc, the only use for it is restoring DefaultHighLighter's Range in case a nested MultiSyn uses the highlighter too. @@ -179,27 +168,27 @@ TMarker = class TSynMultiSyn = class(TSynCustomHighlighter) private - FRangeProc: TRangeProc; - FDefaultLanguageName: string; - FMarkers: TList; - FMarker: TMarker; - FNextMarker: Integer; - FCurrScheme: Integer; - FTmpRange: Pointer; - FOnCustomRange: TCustomRangeEvent; - FLineStr: UnicodeString; + fRangeProc: TRangeProc; + fDefaultLanguageName: string; + fMarkers: TList; + fMarker: TMarker; + fNextMarker: Integer; + fCurrScheme: Integer; + fTmpRange: pointer; + fOnCustomRange: TCustomRangeEvent; + fLineStr: string; procedure SetDefaultHighlighter(const Value: TSynCustomHighLighter); function GetMarkers(Index: Integer): TMarker; property Markers[Index: Integer]: TMarker read GetMarkers; procedure DoCheckMarker(Scheme:TScheme; StartPos, MarkerLen: Integer; - const MarkerText: UnicodeString; Start: Boolean; Line: Integer; + const MarkerText: string; Start: Boolean; Line: Integer; const LineStr: string); procedure SetOnCustomRange(const Value: TCustomRangeEvent); protected - FSchemes: TSchemes; - FDefaultHighlighter: TSynCustomHighLighter; - FLineNumber: Integer; - FSampleSource: UnicodeString; + fSchemes: TSchemes; + fDefaultHighlighter: TSynCustomHighLighter; + fLineNumber: Integer; + fSampleSource: string; procedure Loaded; override; procedure SetSchemes(const Value: TSchemes); procedure ClearMarkers; @@ -209,85 +198,60 @@ TSynMultiSyn = class(TSynCustomHighlighter) procedure HookHighlighter(aHL: TSynCustomHighlighter); procedure UnhookHighlighter(aHL: TSynCustomHighlighter); procedure Notification(aComp: TComponent; aOp: TOperation); override; - function GetSampleSource: UnicodeString; override; - procedure SetSampleSource(Value: UnicodeString); override; - procedure DoSetLine(const Value: UnicodeString; LineNumber: Integer); override; + function GetSampleSource: string; override; + procedure SetSampleSource(Value: string); override; + procedure DoSetLine(const Value: string; LineNumber: Integer); override; // procedure OldRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); procedure NewRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); procedure UserRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; function GetEol: Boolean; override; - function GetExpandedToken: UnicodeString; override; function GetRange: Pointer; override; - function GetToken: UnicodeString; override; function GetTokenAttribute: TSynHighlighterAttributes; override; function GetTokenKind: Integer; override; procedure Next; override; procedure SetRange(Value: Pointer); override; procedure ResetRange; override; function UpdateRangeProcs: Boolean; - property CurrScheme: Integer read FCurrScheme write FCurrScheme; - property CurrLine: UnicodeString read FLineStr; + property CurrScheme: Integer read fCurrScheme write fCurrScheme; + property CurrLine: string read fLineStr; function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; override; function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; override; function IsIdentChar(AChar: WideChar): Boolean; override; published - property Schemes: TSchemes read FSchemes write SetSchemes; - property DefaultHighlighter: TSynCustomHighLighter read FDefaultHighlighter + property Schemes: TSchemes read fSchemes write SetSchemes; + property DefaultHighlighter: TSynCustomHighLighter read fDefaultHighlighter write SetDefaultHighlighter; - property DefaultLanguageName: string read FDefaultLanguageName - write FDefaultLanguageName; - property OnCustomRange: TCustomRangeEvent read FOnCustomRange write SetOnCustomRange; + property DefaultLanguageName: string read fDefaultLanguageName + write fDefaultLanguageName; + property OnCustomRange: TCustomRangeEvent read fOnCustomRange write SetOnCustomRange; end; implementation uses - Graphics, + System.SysUtils, + System.Math, + Vcl.Graphics, SynEditMiscProcs, - SynRegExpr, - SynEditStrConst, - SysUtils; - -procedure CheckExpression(const Expr: UnicodeString); -var - Parser: TRegExpr; -begin - Parser := TRegExpr.Create; - try - Parser.Expression := Expr; - try - Parser.Compile; - except - on E: ERegExpr do - begin - if E.ErrorCode < 1000 then - E.Message := Format('"%s" is not a valid Regular Expression.'#13'Error (pos %d): %s', - [Expr, E.CompilerErrorPos, Copy(Parser.ErrorMsg(E.ErrorCode), 16, MaxInt)]); - raise; - end; - end; - finally - Parser.Free; - end; -end; + SynEditStrConst; { TMarker } constructor TMarker.Create(aScheme, aStartPos, - aMarkerLen: Integer; aIsOpenMarker: Boolean; const aMarkerText: UnicodeString); + aMarkerLen: Integer; aIsOpenMarker: Boolean; const aMarkerText: string); begin - FScheme := aScheme; - FStartPos := aStartPos; - FMarkerLen := aMarkerLen; - FIsOpenMarker := aIsOpenMarker; - FMarkerText := aMarkerText; + fScheme := aScheme; + fStartPos := aStartPos; + fMarkerLen := aMarkerLen; + fIsOpenMarker := aIsOpenMarker; + fMarkerText := aMarkerText; end; { TSynMultiSyn } @@ -296,18 +260,18 @@ procedure TSynMultiSyn.ClearMarkers; var i: Integer; begin - for i := 0 to FMarkers.Count - 1 do - TObject(FMarkers[i]).Free; - FMarkers.Clear; + for i := 0 to fMarkers.Count - 1 do + TObject(fMarkers[i]).Free; + fMarkers.Clear; end; constructor TSynMultiSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FSchemes := TSchemes.Create(Self); - FCurrScheme := -1; - FMarkers := TList.Create; - FRangeProc := NewRangeProc; + fSchemes := TSchemes.Create(Self); + fCurrScheme := -1; + fMarkers := TList.Create; + fRangeProc := NewRangeProc; end; destructor TSynMultiSyn.Destroy; @@ -317,8 +281,8 @@ destructor TSynMultiSyn.Destroy; Schemes.Clear; DefaultHighlighter := nil; inherited Destroy; - FSchemes.Free; - FMarkers.Free; + fSchemes.Free; + fMarkers.Free; end; function TSynMultiSyn.GetAttribCount: Integer; @@ -386,14 +350,14 @@ function TSynMultiSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttrib function TSynMultiSyn.GetEol: Boolean; begin - if FMarker <> nil then + if fMarker <> nil then Result := False - else if FCurrScheme >= 0 then + else if fCurrScheme >= 0 then Result := Schemes[CurrScheme].Highlighter.GetEol else if DefaultHighlighter <> nil then Result := DefaultHighlighter.GetEol else - Result := Run > FLineLen + 1; + Result := Run > fLineLen; end; class function TSynMultiSyn.GetLanguageName: string; @@ -403,7 +367,7 @@ class function TSynMultiSyn.GetLanguageName: string; function TSynMultiSyn.GetMarkers(Index: Integer): TMarker; begin - Result := TMarker(FMarkers[Index]); + Result := TMarker(fMarkers[Index]); end; procedure TSynMultiSyn.OldRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); @@ -417,20 +381,20 @@ procedure TSynMultiSyn.OldRangeProc(Operation: TRangeOperation; var Range: TRang MaxSchemeRange = (1 shl SchemeRangeSize) - 1; var iHL: TSynCustomHighlighter; - iSchemeIndex: Cardinal; - iSchemeRange: Cardinal; + iSchemeIndex: cardinal; + iSchemeRange: cardinal; begin if Operation = roGet then begin - if (FCurrScheme < 0) then + if (fCurrScheme < 0) then iHL := DefaultHighlighter else - iHL := Schemes[FCurrScheme].Highlighter; - iSchemeIndex := FCurrScheme + 2; + iHL := Schemes[fCurrScheme].Highlighter; + iSchemeIndex := fCurrScheme + 2; Assert(iSchemeIndex <= MaxSchemeCount); if iHL <> nil then begin - iSchemeRange := Cardinal(iHL.GetRange); + iSchemeRange := cardinal(iHL.GetRange); Assert((iSchemeRange <= MaxSchemeRange) or (iHL is TSynMultiSyn)); end else @@ -444,31 +408,23 @@ procedure TSynMultiSyn.OldRangeProc(Operation: TRangeOperation; var Range: TRang begin if Range = 0 then Exit; - iSchemeRange := Cardinal(Range); - FCurrScheme := Integer(iSchemeRange and MaxSchemeCount) - 2; + iSchemeRange := cardinal(Range); + fCurrScheme := Integer(iSchemeRange and MaxSchemeCount) - 2; iSchemeRange := iSchemeRange shr SchemeIndexSize; if (CurrScheme < 0) then begin if DefaultHighlighter <> nil then - DefaultHighlighter.SetRange(Pointer(iSchemeRange)); + DefaultHighlighter.SetRange(pointer(iSchemeRange)); end else - Schemes[CurrScheme].Highlighter.SetRange(Pointer(iSchemeRange)); + Schemes[CurrScheme].Highlighter.SetRange(pointer(iSchemeRange)); end; end; -function TSynMultiSyn.GetToken: UnicodeString; -begin - if DefaultHighlighter = nil then - Result := FLineStr - else - Result := inherited GetToken; -end; - function TSynMultiSyn.GetTokenAttribute: TSynHighlighterAttributes; begin - if FMarker <> nil then - Result := Schemes[FMarker.FScheme].MarkerAttri + if fMarker <> nil then + Result := Schemes[fMarker.fScheme].MarkerAttri else if CurrScheme >= 0 then Result := Schemes[CurrScheme].Highlighter.GetTokenAttribute else if DefaultHighlighter <> nil then @@ -479,10 +435,10 @@ function TSynMultiSyn.GetTokenAttribute: TSynHighlighterAttributes; function TSynMultiSyn.GetTokenKind: Integer; begin - if FMarker <> nil then + if fMarker <> nil then Result := 0 - else if FCurrScheme >= 0 then - Result := Schemes[FCurrScheme].Highlighter.GetTokenKind + else if fCurrScheme >= 0 then + Result := Schemes[fCurrScheme].Highlighter.GetTokenKind else if DefaultHighlighter <> nil then Result := DefaultHighlighter.GetTokenKind else @@ -497,31 +453,24 @@ procedure TSynMultiSyn.HookHighlighter(aHL: TSynCustomHighlighter); procedure TSynMultiSyn.Next; var - iToken, TmpLine, ExpandedTmpLine: UnicodeString; + iToken, TmpLine: string; iHL: TSynCustomHighlighter; begin - if DefaultHighlighter = nil then - begin - if Run > 0 then - Inc(Run) - else - Run := Length(FLineStr) + 1; - inherited; - Exit; - end; - - if (FNextMarker < FMarkers.Count) and (Run + 1 >= Markers[FNextMarker].FStartPos) then + if (fNextMarker < fMarkers.Count) and (Run + 1 >= Markers[fNextMarker].fStartPos) then begin - FMarker := Markers[FNextMarker]; - if FMarker.FIsOpenMarker then + fMarker := Markers[fNextMarker]; + if fMarker.fIsOpenMarker then begin - FCurrScheme := FMarker.FScheme; - FTmpRange := DefaultHighlighter.GetRange; + fCurrScheme := fMarker.fScheme; + if DefaultHighlighter = nil then + fTmpRange := nil + else + fTmpRange := DefaultHighlighter.GetRange; Schemes[CurrScheme].Highlighter.ResetRange; end; - Inc(FNextMarker); - FTokenPos := Run; - Inc(Run, FMarker.FMarkerLen); + Inc(fNextMarker); + fTokenPos := Run; + Inc(Run, fMarker.fMarkerLen); inherited; Exit; end; @@ -533,54 +482,46 @@ procedure TSynMultiSyn.Next; else iHL := DefaultHighlighter; - if FMarkers.Count = 0 then - TmpLine := FLineStr + if fMarkers.Count = 0 then + TmpLine := fLineStr else - TmpLine := Copy(FLineStr, 1, Markers[FNextMarker].FStartPos - 1); - - if fExpandedLine <> nil then + TmpLine := Copy(fLineStr, 1, Markers[fNextMarker].fStartPos - 1); + + if iHL = nil then begin - if FMarkers.Count = 0 then - ExpandedTmpLine := FExpandedLineStr - else - ExpandedTmpLine := Copy(FExpandedLineStr, 1, - PosToExpandedPos(Markers[FNextMarker].FStartPos - 1)); - iHL.SetLineExpandedAtWideGlyphs(TmpLine, ExpandedTmpLine, FLineNumber); + FTokenPos := Run; + Run := Max(Length(TmpLine), 1); end else - iHL.SetLine(TmpLine, FLineNumber); + iHL.SetLine(TmpLine, fLineNumber); end - else if FMarker <> nil then + else if fMarker <> nil then begin - if not FMarker.FIsOpenMarker then + if not fMarker.fIsOpenMarker then begin - FCurrScheme := -1; - DefaultHighlighter.SetRange(FTmpRange); + fCurrScheme := -1; + if Assigned(DefaultHighlighter) then + DefaultHighlighter.SetRange(fTmpRange); end; - FMarker := nil; + fMarker := nil; if CurrScheme >= 0 then iHL := Schemes[CurrScheme].Highlighter else iHL := DefaultHighlighter; - if FNextMarker < FMarkers.Count then - TmpLine := Copy(FLineStr, Run + 1, Markers[FNextMarker].FStartPos - Run - 1) + if fNextMarker < fMarkers.Count then + TmpLine := Copy(fLineStr, Run + 1, Markers[fNextMarker].fStartPos - Run - 1) else - TmpLine := Copy(FLineStr, Run + 1, MaxInt); + TmpLine := Copy(fLineStr, Run + 1); - if fExpandedLine <> nil then + if iHL = nil then begin - if FNextMarker < FMarkers.Count then - ExpandedTmpLine := Copy(FExpandedLineStr, FExpandedRun + 1, - PosToExpandedPos(Markers[FNextMarker].FStartPos - Run - 1)) - else - ExpandedTmpLine := Copy(FExpandedLineStr, FExpandedRun + 1, MaxInt); - - iHL.SetLineExpandedAtWideGlyphs(TmpLine, ExpandedTmpLine, FLineNumber); + FTokenPos := Run; + Inc(Run, Max(Length(TmpLine), 1)) end else - iHL.SetLine(TmpLine, FLineNumber); + iHL.SetLine(TmpLine, fLineNumber); end else begin @@ -588,15 +529,26 @@ procedure TSynMultiSyn.Next; iHL := Schemes[CurrScheme].Highlighter else iHL := DefaultHighlighter; - iHL.Next; + if iHL = nil then + begin + FTokenPos := Run; + Run := Max(FLineLen, Run + 1); + end + else + iHL.Next; end; - FTokenPos := iHL.GetTokenPos; - iToken := iHL.GetToken; - if FNextMarker > 0 then - with Markers[FNextMarker - 1] do - Inc(FTokenPos, FStartPos + FMarkerLen - 1); - Inc(Run, (FTokenPos - Run) + Length(iToken)); + if Assigned(iHL) then + begin + fTokenPos := iHL.GetTokenPos; + iToken := iHL.GetToken; + end + else + iToken := inherited GetToken; + if fNextMarker > 0 then + with Markers[fNextMarker - 1] do + Inc(fTokenPos, fStartPos + fMarkerLen - 1); + Inc(Run, (fTokenPos - Run) + Length(iToken)); inherited; end; @@ -620,11 +572,11 @@ procedure TSynMultiSyn.Notification(aComp: TComponent; aOp: TOperation); procedure TSynMultiSyn.ResetRange; begin - FCurrScheme := -1; + fCurrScheme := -1; if DefaultHighlighter <> nil then begin DefaultHighlighter.ResetRange; - FTmpRange := DefaultHighlighter.GetRange; + fTmpRange := DefaultHighlighter.GetRange; end; end; @@ -638,7 +590,7 @@ procedure TSynMultiSyn.SetDefaultHighlighter( raise Exception.Create(sDefaultHlSetToSelf); if DefaultHighlighter <> nil then UnhookHighlighter(DefaultHighlighter); - FDefaultHighlighter := Value; + fDefaultHighlighter := Value; if DefaultHighlighter <> nil then HookHighlighter(DefaultHighlighter); DefHighlightChange(Self); @@ -646,12 +598,12 @@ procedure TSynMultiSyn.SetDefaultHighlighter( end; procedure TSynMultiSyn.DoCheckMarker(Scheme:TScheme; StartPos, MarkerLen: Integer; - const MarkerText: UnicodeString; Start: Boolean; Line: Integer; + const MarkerText: string; Start: Boolean; Line: Integer; const LineStr: string); var aStartPos: Integer; aMarkerLen: Integer; - aMarkerText: UnicodeString; + aMarkerText: string; begin aStartPos := StartPos; aMarkerLen := MarkerLen; @@ -662,45 +614,43 @@ procedure TSynMultiSyn.DoCheckMarker(Scheme:TScheme; StartPos, MarkerLen: Intege Scheme.OnCheckEndMarker(Self, aStartPos, aMarkerLen, aMarkerText, Line, LineStr); if (aMarkerText <> '') and (aMarkerLen > 0) then begin - FMarkers.Add(TMarker.Create(Scheme.Index, aStartPos, aMarkerLen, Start, + fMarkers.Add(TMarker.Create(Scheme.Index, aStartPos, aMarkerLen, Start, aMarkerText)); end; end; procedure TSynMultiSyn.SetSchemes(const Value: TSchemes); begin - FSchemes.Assign(Value); + fSchemes.Assign(Value); end; procedure TSynMultiSyn.UnhookHighlighter(aHL: TSynCustomHighlighter); begin aHL.UnhookAttrChangeEvent(DefHighlightChange); -{$IFDEF SYN_COMPILER_5_UP} aHL.RemoveFreeNotification(Self); -{$ENDIF} end; -function TSynMultiSyn.GetSampleSource: UnicodeString; +function TSynMultiSyn.GetSampleSource: string; begin - Result := FSampleSource; + Result := fSampleSource; end; -procedure TSynMultiSyn.SetSampleSource(Value: UnicodeString); +procedure TSynMultiSyn.SetSampleSource(Value: string); begin - FSampleSource := Value; + fSampleSource := Value; end; function TSynMultiSyn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; var - r: TBetterRegistry; + r: TRegistry; i: Integer; begin if DefaultHighlighter <> nil then Result := DefaultHighlighter.LoadFromRegistry(RootKey, Key + '\DefaultHighlighter') else Result := False; - r := TBetterRegistry.Create; + r := TRegistry.Create; try r.RootKey := RootKey; for i := 0 to Schemes.Count-1 do @@ -722,14 +672,14 @@ function TSynMultiSyn.LoadFromRegistry(RootKey: HKEY; function TSynMultiSyn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean; var - r: TBetterRegistry; + r: TRegistry; i: Integer; begin if DefaultHighlighter <> nil then Result := DefaultHighlighter.SaveToRegistry(RootKey, Key + '\DefaultHighlighter') else Result := False; - r := TBetterRegistry.Create; + r := TRegistry.Create; try r.RootKey := RootKey; for i := 0 to Schemes.Count-1 do @@ -752,12 +702,12 @@ function TSynMultiSyn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean; function TSynMultiSyn.GetRange: Pointer; begin Result := nil; - FRangeProc(roGet, TRangeUNativeInt(Result)); + fRangeProc(roGet, TRangeUNativeInt(Result)); end; procedure TSynMultiSyn.SetRange(Value: Pointer); begin - FRangeProc(roSet, TRangeUNativeInt(Value)); + fRangeProc(roSet, TRangeUNativeInt(Value)); end; procedure TSynMultiSyn.NewRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); @@ -770,18 +720,18 @@ procedure TSynMultiSyn.NewRangeProc(Operation: TRangeOperation; var Range: TRang if Operation = roGet then begin if DefaultHighlighter <> nil then - Range := Cardinal(DefaultHighlighter.GetRange) + Range := cardinal(DefaultHighlighter.GetRange) else Range := 0; if CurrScheme >= 0 then begin - Assert(Cardinal(Schemes[CurrScheme].Highlighter.GetRange) <= MaxSchemeRange); + Assert(cardinal(Schemes[CurrScheme].Highlighter.GetRange) <= MaxSchemeRange); Range := Range shl SchemeRangeSize; - Range := Range or Cardinal(Schemes[CurrScheme].Highlighter.GetRange); + Range := Range or cardinal(Schemes[CurrScheme].Highlighter.GetRange); end; Assert(CurrScheme <= MaxSchemeCount); Range := Range shl SchemeIndexSize; - Range := Range or Cardinal(CurrScheme + 1); + Range := Range or cardinal(CurrScheme + 1); end else begin @@ -789,13 +739,13 @@ procedure TSynMultiSyn.NewRangeProc(Operation: TRangeOperation; var Range: TRang Range := Range shr SchemeIndexSize; if CurrScheme >= 0 then begin - Schemes[CurrScheme].Highlighter.SetRange(Pointer(Range and MaxSchemeRange)); + Schemes[CurrScheme].Highlighter.SetRange(pointer(Range and MaxSchemeRange)); Range := Range shr SchemeRangeSize; end; if DefaultHighlighter <> nil then begin - FTmpRange := Pointer(Range); - DefaultHighlighter.SetRange(FTmpRange); + fTmpRange := pointer(Range); + DefaultHighlighter.SetRange(fTmpRange); end; end; end; @@ -806,28 +756,28 @@ function TSynMultiSyn.UpdateRangeProcs: Boolean; i: Integer; OldProc: TRangeProc; begin - OldProc := FRangeProc; + OldProc := fRangeProc; if Assigned(OnCustomRange) then - FRangeProc := UserRangeProc + fRangeProc := UserRangeProc else begin - FRangeProc := NewRangeProc; + fRangeProc := NewRangeProc; for i := 0 to Schemes.Count -1 do if Schemes[i].Highlighter is TSynMultiSyn then begin - FRangeProc := OldRangeProc; + fRangeProc := OldRangeProc; Break; end; end; - Result := TMethod(OldProc).Code <> TMethod(FRangeProc).Code; + Result := TMethod(OldProc).Code <> TMethod(fRangeProc).Code; if Result then DefHighlightChange(Self); end; procedure TSynMultiSyn.UserRangeProc(Operation: TRangeOperation; var Range: TRangeUNativeInt); begin - OnCustomRange(Self, Operation, Pointer(Range)); + OnCustomRange(Self, Operation, pointer(Range)); if (Operation = roSet) and (DefaultHighlighter <> nil) then - FTmpRange := DefaultHighlighter.GetRange; + fTmpRange := DefaultHighlighter.GetRange; end; procedure TSynMultiSyn.SetOnCustomRange(const Value: TCustomRangeEvent); @@ -835,7 +785,7 @@ procedure TSynMultiSyn.SetOnCustomRange(const Value: TCustomRangeEvent); if (TMethod(OnCustomRange).Code <> TMethod(Value).Code) or (TMethod(OnCustomRange).Data <> TMethod(Value).Data) then begin - FOnCustomRange := Value; + fOnCustomRange := Value; UpdateRangeProcs; end; end; @@ -856,98 +806,90 @@ function TSynMultiSyn.IsIdentChar(AChar: WideChar): Boolean; Result := inherited IsIdentChar(AChar); end; -class function TSynMultiSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynMultiSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangGeneralMulti; end; -procedure TSynMultiSyn.DoSetLine(const Value: UnicodeString; LineNumber: Integer); +procedure TSynMultiSyn.DoSetLine(const Value: string; LineNumber: Integer); var - iParser: TRegExpr; + Match: TMatch; iScheme: TScheme; - iExpr: UnicodeString; - iLine: UnicodeString; + iExpr: string; + iLine: string; iEaten: Integer; - i: Integer; + Idx: Integer; begin ClearMarkers; - iParser := TRegExpr.Create; - try - iEaten := 0; - iLine := Value; - if CurrScheme >= 0 - then - iScheme := FSchemes[CurrScheme] - else - iScheme := nil; - while iLine <> '' do - if iScheme <> nil then + iEaten := 0; + iLine := Value; + if CurrScheme >= 0 + then + iScheme := fSchemes[CurrScheme] + else + iScheme := nil; + while iLine <> '' do + if iScheme <> nil then + begin + if iScheme.EndExpr = '' then + Break + else + Match := iScheme.fEndRE.Match(iLine); + + if Match.Success then begin - iParser.Expression := iScheme.EndExpr; - iParser.ModifierI := not iScheme.CaseSensitive; - if iParser.Exec(iLine) then - begin - iExpr := Copy(Value, iParser.MatchPos[0] + iEaten, iParser.MatchLen[0]); - DoCheckMarker(iScheme, iParser.MatchPos[0] + iEaten, iParser.MatchLen[0], - iExpr, False, LineNumber, Value); - Delete(iLine, 1, iParser.MatchPos[0] - 1 + iParser.MatchLen[0]); - Inc(iEaten, iParser.MatchPos[0] - 1 + iParser.MatchLen[0]); - iScheme := nil; - end - else - Break; + iExpr := Copy(Value, Match.Index + iEaten, Match.Length); + DoCheckMarker(iScheme, Match.Index + iEaten, Match.Length, + iExpr, False, LineNumber, Value); + Delete(iLine, 1, Match.Index - 1 + Match.Length); + Inc(iEaten, Match.Index - 1 + Match.Length); + iScheme := nil; end else + Break; + end + else + begin + Idx := 0; + while Idx < Schemes.Count do begin - for i := 0 to Schemes.Count - 1 do + iScheme := Schemes[Idx]; + if (iScheme.StartExpr = '') or (iScheme.Highlighter = nil) or + (not iScheme.Highlighter.Enabled) then begin - iScheme := Schemes[i]; - if (iScheme.StartExpr = '') or (iScheme.EndExpr = '') or - (iScheme.Highlighter = nil) or (not iScheme.Highlighter.Enabled) then - begin - continue; - end; - iParser.Expression := iScheme.StartExpr; - iParser.ModifierI := not iScheme.CaseSensitive; - if iParser.Exec(iLine) then begin - iExpr := Copy(Value, iParser.MatchPos[0] + iEaten, iParser.MatchLen[0]); - DoCheckMarker(iScheme, iParser.MatchPos[0] + iEaten, iParser.MatchLen[0], - iExpr, True, LineNumber, Value); - Delete(iLine, 1, iParser.MatchPos[0] - 1 + iParser.MatchLen[0]); - Inc(iEaten, iParser.MatchPos[0] - 1 + iParser.MatchLen[0]); - Break; - end; - end; {for} - if i >= Schemes.Count then - Break; - end; {else} + Inc(Idx); + Continue; + end; + Match := iScheme.fStartRE.Match(iLine); - finally - iParser.Free; - end; + if Match.Success then + begin + iExpr := Copy(Value, Match.Index + iEaten, Match.Length); + DoCheckMarker(iScheme, Match.Index + iEaten, Match.Length, + iExpr, True, LineNumber, Value); + Delete(iLine, 1, Match.Index - 1 + Match.Length); + Inc(iEaten, Match.Index - 1 + Match.Length); + Break; + end; + Inc(Idx); + end; {for} + if Idx >= Schemes.Count then + Break; + end; {else} - FLineStr := Value; - fLine := PWideChar(FLineStr); + fLineStr := Value; + fLineLen := Value.Length; + fLine := PWideChar(fLineStr); fCasedLineStr := ''; - fCasedLine := PWideChar(FLineStr); + fCasedLine := PWideChar(fLineStr); - FMarker := nil; + fMarker := nil; Run := 0; - FExpandedRun := 0; fOldRun := Run; - FTokenPos := 0; - fExpandedTokenPos := 0; - FNextMarker := 0; - FLineNumber := LineNumber; -end; - -function TSynMultiSyn.GetExpandedToken: UnicodeString; -begin - if (DefaultHighlighter = nil) and (fExpandedLine <> nil) then - Result := FExpandedLineStr - else - Result := inherited GetExpandedToken; + fTokenPos := 0; + fNextMarker := 0; + fLineNumber := LineNumber; end; { TSchemes } @@ -955,7 +897,7 @@ function TSynMultiSyn.GetExpandedToken: UnicodeString; constructor TSchemes.Create(aOwner: TSynMultiSyn); begin inherited Create(TScheme); - FOwner := aOwner; + fOwner := aOwner; end; function TSchemes.GetItems(Index: Integer): TScheme; @@ -963,34 +905,30 @@ function TSchemes.GetItems(Index: Integer): TScheme; Result := inherited Items[Index] as TScheme; end; -{$IFDEF SYN_COMPILER_3_UP} function TSchemes.GetOwner: TPersistent; begin - Result := FOwner; + Result := fOwner; end; -{$ENDIF} procedure TSchemes.SetItems(Index: Integer; const Value: TScheme); begin inherited Items[Index] := Value; end; -{$IFDEF SYN_COMPILER_3_UP} procedure TSchemes.Update(Item: TCollectionItem); begin if Item <> nil then - FOwner.DefHighlightChange(Item) + fOwner.DefHighlightChange(Item) else // pass the MultiSyn as the Sender so Editors reparse their text - FOwner.DefHighlightChange(FOwner); + fOwner.DefHighlightChange(fOwner); end; -{$ENDIF} { TScheme } -function TScheme.ConvertExpression(const Value: UnicodeString): UnicodeString; +function TScheme.ConvertExpression(const Value: string): string; begin if not CaseSensitive then - Result := SynWideUpperCase(Value) + Result := Value.ToUpper else Result := Value; end; @@ -998,9 +936,9 @@ function TScheme.ConvertExpression(const Value: UnicodeString): UnicodeString; constructor TScheme.Create(Collection: TCollection); begin inherited Create(Collection); - FCaseSensitive := True; - FMarkerAttri := TSynHighlighterAttributes.Create(SYNS_AttrMarker, SYNS_FriendlyAttrMarker); - FMarkerAttri.OnChange := MarkerAttriChanged; + fCaseSensitive := True; + fMarkerAttri := TSynHighlighterAttributes.Create(SYNS_AttrMarker, SYNS_FriendlyAttrMarker); + fMarkerAttri.OnChange := MarkerAttriChanged; MarkerAttri.Background := clYellow; MarkerAttri.Style := [fsBold]; MarkerAttri.InternalSaveDefaultValues; @@ -1011,18 +949,14 @@ destructor TScheme.Destroy; { unhook notification handlers } Highlighter := nil; inherited Destroy; - FMarkerAttri.Free; + fMarkerAttri.Free; end; procedure TScheme.DefineProperties(Filer: TFiler); begin inherited; -{$IFNDEF UNICODE} - UnicodeDefineProperties(Filer, Self); -{$ENDIF} end; -{$IFDEF SYN_COMPILER_3_UP} function TScheme.GetDisplayName: string; begin if SchemeName <> '' then @@ -1030,7 +964,6 @@ function TScheme.GetDisplayName: string; else Result := inherited GetDisplayName; end; -{$ENDIF SYN_COMPILER_3_UP} procedure TScheme.MarkerAttriChanged(Sender: TObject); begin @@ -1039,30 +972,49 @@ procedure TScheme.MarkerAttriChanged(Sender: TObject); procedure TScheme.SetCaseSensitive(const Value: Boolean); begin - if FCaseSensitive <> Value then + if fCaseSensitive <> Value then begin - FCaseSensitive := Value; + fCaseSensitive := Value; + // recompile regular expressions + if fStartExpr <> '' then + begin + if fCaseSensitive then + fStartRE := CompiledRegEx(fStartExpr, [roNotEmpty]) + else + fStartRE := CompiledRegEx(fStartExpr, [roNotEmpty, roIgnoreCase]); + end; + if fEndExpr <> '' then + begin + if fCaseSensitive then + fEndRE := CompiledRegEx(fEndExpr, [roNotEmpty]) + else + fEndRE := CompiledRegEx(fEndExpr, [roNotEmpty, roIgnoreCase]); + end; Changed(True); end; end; -{$IFDEF SYN_COMPILER_3_UP} procedure TScheme.SetDisplayName(const Value: string); begin SchemeName := Value; end; -{$ENDIF SYN_COMPILER_3_UP} -procedure TScheme.SetEndExpr(const Value: UnicodeString); +procedure TScheme.SetEndExpr(const Value: string); var - OldValue: UnicodeString; + OldValue: string; begin - if FEndExpr <> Value then + if fEndExpr <> Value then begin if Value <> '' then - CheckExpression(Value); - OldValue := FEndExpr; - FEndExpr := Value; + begin + // Raises an exception if invalid + if fCaseSensitive then + fEndRE := CompiledRegEx(Value, [roNotEmpty]) + else + fEndRE := CompiledRegEx(Value, [roNotEmpty, roIgnoreCase]); + end; + OldValue := fEndExpr; + fEndExpr := Value; if ConvertExpression(OldValue) <> ConvertExpression(Value) then Changed(True); end; @@ -1075,10 +1027,10 @@ procedure TScheme.SetHighlighter(const Value: TSynCustomHighLighter); begin if Highlighter <> Value then begin - iOwner := TSchemes(Collection).FOwner; + iOwner := TSchemes(Collection).fOwner; if (Highlighter <> nil) and (Highlighter <> iOwner) then iOwner.UnhookHighlighter(Highlighter); - FHighlighter := Value; + fHighlighter := Value; if (Highlighter <> nil) and (Highlighter <> iOwner) then iOwner.HookHighlighter(Highlighter); if Highlighter is TSynMultiSyn then @@ -1092,19 +1044,25 @@ procedure TScheme.SetHighlighter(const Value: TSynCustomHighLighter); procedure TScheme.SetMarkerAttri(const Value: TSynHighlighterAttributes); begin - FMarkerAttri.Assign(Value); + fMarkerAttri.Assign(Value); end; -procedure TScheme.SetStartExpr(const Value: UnicodeString); +procedure TScheme.SetStartExpr(const Value: string); var - OldValue: UnicodeString; + OldValue: string; begin - if FStartExpr <> Value then + if fStartExpr <> Value then begin if Value <> '' then - CheckExpression(Value); - OldValue := FStartExpr; - FStartExpr := Value; + begin + // Raises an exception if invalid + if fCaseSensitive then + fStartRE := CompiledRegEx(Value, [roNotEmpty]) + else + fStartRE := CompiledRegEx(Value, [roNotEmpty, roIgnoreCase]); + end; + OldValue := fStartExpr; + fStartExpr := Value; if ConvertExpression(Value) <> ConvertExpression(OldValue) then Changed(True); end; diff --git a/Ext/SynEdit/Source/SynHighlighterOmni.pas b/Ext/SynEdit/Source/SynHighlighterOmni.pas new file mode 100644 index 0000000..d521dc7 --- /dev/null +++ b/Ext/SynEdit/Source/SynHighlighterOmni.pas @@ -0,0 +1,2631 @@ +{------------------------------------------------------------------------------- +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: SynHighlighterGeneral.pas, released 2000-04-07. +The Original Code is based on the mwGeneralSyn.pas file from the +mwEdit component suite by Martin Waldenburg and other developers, the Initial +Author of this file is Martin Waldenburg. +Portions written by Martin Waldenburg are copyright 1999 Martin Waldenburg. + +Contributors to the SynEdit and mwEdit projects are listed in the +Contributors.txt file. + +Alternatively, the contents of this file may be used under the terms of the +GNU General Public License Version 2 or later (the "GPL"), in which case +the provisions of the GPL are applicable instead of those above. +If you wish to allow use of your version of this file only under the terms +of the GPL and not to allow others to use your version of this file +under the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the GPL. +If you do not delete the provisions above, a recipient may use your version +of this file under either the MPL or the GPL. +-------------------------------------------------------------------------------} +{ +@abstract(Provides an Omnipotent customizable highlighter for SynEdit) +@author(Martin Waldenburg, converted to SynEdit by Michael Hieke massively extented by Jan Fiala) +The SynHighlighterOmni unit provides a customizable highlighter for SynEdit. +} + +{ TODO : Resource strings } +{ TODO : Fix Structural Highlighting } + +unit SynHighlighterOmni; + +{$I SynEdit.Inc} + +interface + +uses + Winapi.Windows, + System.SysUtils, + SynEditHighlighter, + SynUnicode, +// JCLUnicode, + System.Classes, + SynEditCodeFolding; + +const + SYNS_AttrKey2 = 'Keywords 2'; + SYNS_AttrKey3 = 'Keywords 3'; + +type + TtkTokenKind = (tkSymbol, tkKey, tkComment, tkIdentifier, tkNull, tkNumber, + tkPreprocessor, tkSpace, tkString, tkUnknown, + tkLabel, tkReserved, tkKey2, tkKey3, tkHex, tkValue, tkVariable, tkAttribute); + + { multiline comments } + TCommentStyle = (csAnsiStyle, csPasStyle, csCStyle, csAsmStyle, csDollar, + csSmartStyle, csHaskell, csDStyle, csJCLStyle, csHTML, + csVLisp, csCLisp, csDead, cs2Excl, csDollarMulti, csForth, + csLUA, csLilypond, csHeller, csOkuma, csPwShell, csStarSemicol, + csTexInfo, csAutoit); + TCommentStyles = set of TCommentStyle; + + { singleline comments } + TSingleStyle = (csCPL, csSharpStyle, csExclStyle, csPercentStyle, csSinglQStyle, + csDblQStyle, csByStyle, csPipe, csBasStyle, csLeftBracket, + csDMISStyle, csSQLStyle, csFortran, csCStar, csWebFocus, + csFoxStyle, csPocoStyle, csSpecStyle, csSlashStyle, csLineC, + csBatStyle, csTabKey, cs2Stars, csPCL, csSpace, csJCL, + csAutomaton, csDash, csBackSlashStyle, csAngleBrackets, + csINIStyle, csEuklid); + TSingleLineComments = set of TSingleStyle; + + THLGroup = (hgHTML, hgNone); + + TRangeState = (rsUnKnown, rsAnsi, rsPasStyle, rsCStyle, rsDollar, + rsSmart, rsHaskell, rsD, rsJCL, rsVLisp, rsCLisp, + rsHTML, rs2Excl, rsDead, rsDollarMulti, rsForth, + rsLua, rsLilypond, rsHeller, rsOkuma, rsFileName, + rsPwShell, rsStarSemicol, rsTexInfo, rsTexInfoBye, + rsEuklid, rsRuby, rsAutoIt, rsRubyString1, rsRubyString2); + + TStringDelim = (sdSingleQuote, sdDoubleQuote, sdApostropheQuote); + TStringDelimiters = set of TStringDelim; + + TCodeFoldingType = (cftNone, cftCurlyBracket); + +type + TSynOmniSyn = class(TSynCustomCodeFoldingHighlighter) + private + FRange: TRangeState; + FTokenID: TtkTokenKind; + FCommentAttri: TSynHighlighterAttributes; + FIdentifierAttri: TSynHighlighterAttributes; + FKeyAttri: TSynHighlighterAttributes; + FNumberAttri: TSynHighlighterAttributes; + FPreprocessorAttri: TSynHighlighterAttributes; + FSpaceAttri: TSynHighlighterAttributes; + FStringAttri: TSynHighlighterAttributes; + FSymbolAttri: TSynHighlighterAttributes; + FHexAttri: TSynHighlighterAttributes; + FKeyWords: TStrings; + FComments: TCommentStyles; + FSingleComments: TSingleLineComments; + FStringDelimCh: WideChar; + FDetectPreprocessor: Boolean; + FResAttri: TSynHighlighterAttributes; + FKey2Attri: TSynHighlighterAttributes; + FKey3Attri: TSynHighlighterAttributes; + FLabelAttri: TSynHighlighterAttributes; + FStringDelim: TStringDelimiters; + FStringDelimChars: TSysCharSet; + FKeyWords3: TStrings; + FResWords: TStrings; + FKeyWords2: TStrings; + FLangName: string; + FKeywordChars: string; + FHighlighterGroup: THLGroup; + FHasLabel: Boolean; + FEscapedStrings: Boolean; + FEscapeChar: WideChar; + FVectorSupport: Boolean; + FCaseSensitive: Boolean; + FValueAttri: TSynHighlighterAttributes; + FPHPVariable: Boolean; + FVariableAttri: TSynHighlighterAttributes; + FAttributeAttri: TSynHighlighterAttributes; + FRubySymbols: Boolean; + FCodeFoldingType: TCodeFoldingType; + FRubyStringChar: char; + FKW2StartWith: Boolean; + FKW3StartWith: Boolean; + FKW1StartWith: Boolean; + FKW4StartWith: Boolean; + procedure AsciiCharProc; + procedure BraceOpenProc; + procedure PointCommaProc; + procedure CRProc; + procedure IdentProc; + procedure IntegerProc; + procedure LFProc; + procedure NullProc; + procedure NumberProc; + procedure RoundOpenProc; + procedure SlashProc; + procedure BackSlashProc; + procedure SpaceProc; + procedure StringProc; + procedure UnknownProc; + + procedure SymbolProc; + procedure FortranCommProc; + procedure REMCommentProc; + procedure BatCommentProc; + procedure HTMLCommentProc; + procedure HexProc; + procedure PipeProc; + procedure CommentRangeProc; + procedure MinusProc; + procedure LabelProc; + procedure AsteriskProc; + procedure PerCentProc; + procedure ExclamationProc; + procedure AmpersandProc; + procedure SingleQuoteProc; + procedure DoubleQuoteProc; + procedure RubyStringProc; + procedure RubyStringProc2; + procedure RubyRangeProc(const AType: Integer); + procedure TabKeyProc; + procedure FileNameProc; + procedure RestIsCommentProc; + procedure SetLangName(const Value: string); + procedure SetKeyWords(const Value: TStrings); + procedure SetComments(Value: TCommentStyles); + procedure SetStringDelim(const Value: TStringDelimiters); + procedure SetDetectPreprocessor(Value: Boolean); + procedure SetKeyWords2(const Value: TStrings); + procedure SetKeyWords3(const Value: TStrings); + procedure SetResWords(const Value: TStrings); + procedure SetSingleComments(const Value: TSingleLineComments); + function IsEsc(const ARun: Integer): Boolean; + procedure SetCaseSensitive(const Value: Boolean); + public + class function GetCapabilities: TSynHighlighterCapabilities; override; + class function GetLanguageName: string; override; + class function GetFriendlyLanguageName: string; override; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure Assign(Source: TPersistent); override; + function GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; + override; + function GetEol: Boolean; override; + function GetRange: Pointer; override; + function GetTokenID: TtkTokenKind; + function GetTokenAttribute: TSynHighlighterAttributes; override; + function GetTokenKind: integer; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + function GetKeyWords(TokenKind: Integer): string; override; + function IsWordBreakChar(AChar: WideChar): Boolean; override; + procedure Next; override; + procedure ResetRange; override; + // ScanForFoldRanges is used for CodeFolding + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; + procedure SetRange(Value: Pointer); override; + function SaveToIniFile(const FileName: string): Boolean; + function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; override; + function LoadFromIniFile(const FileName: string): Boolean; + function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; override; + procedure SetKeyWordsCompat(FromStrings: TStrings; ToStrings: TStrings); + function IsReservedWord(const AKeyword: string; KeyList: TStrings; AKWStartWith: Boolean): Boolean; + published + property HighLighterGroup: THLGroup read FHighlighterGroup write FHighlighterGroup; + property KeyWordChars: string read FKeywordChars write FKeywordChars; + property SingleLineComments: TSingleLineComments read FSingleComments + write SetSingleComments; + property HasLabel: Boolean read FHasLabel write FHasLabel; + property EscapedStrings: Boolean read FEscapedStrings write FEscapedStrings; + property EscapeChar: WideChar read FEscapeChar write FEscapeChar; + property VectorSupport: Boolean read FVectorSupport write FVectorSupport; + property CaseSensitive: Boolean read FCaseSensitive write SetCaseSensitive; + property KW1StartWith: Boolean read FKW1StartWith write FKW1StartWith; + property KW2StartWith: Boolean read FKW2StartWith write FKW2StartWith; + property KW3StartWith: Boolean read FKW3StartWith write FKW3StartWith; + property KW4StartWith: Boolean read FKW4StartWith write FKW4StartWith; + property LangName: string read FLangName write SetLangName; + property CodeFoldingType: TCodeFoldingType read FCodeFoldingType write FCodeFoldingType; + property CommentAttri: TSynHighlighterAttributes read FCommentAttri + write FCommentAttri; + property Comments: TCommentStyles read FComments write SetComments; + property DetectPreprocessor: Boolean read FDetectPreprocessor + write SetDetectPreprocessor; + property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri + write FIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property KeyWords: TStrings read FKeyWords write SetKeyWords; + property ResAttri: TSynHighlighterAttributes read FResAttri write FResAttri; + property ResWords: TStrings read FResWords write SetResWords; + property KeyWords2: TStrings read FKeyWords2 write SetKeyWords2; + property KeyWords3: TStrings read FKeyWords3 write SetKeyWords3; + property PHPVariable: Boolean read FPHPVariable write FPHPVariable; + property RubySymbols: Boolean read FRubySymbols write FRubySymbols; + property NumberAttri: TSynHighlighterAttributes read FNumberAttri + write FNumberAttri; + property PreprocessorAttri: TSynHighlighterAttributes + read FPreprocessorAttri write FPreprocessorAttri; + property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri + write FSpaceAttri; + property StringAttri: TSynHighlighterAttributes read FStringAttri + write FStringAttri; + property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri + write FSymbolAttri; + property StringDelim: TStringDelimiters read FStringDelim write SetStringDelim + default [sdSingleQuote]; + property LabelAttri: TSynHighlighterAttributes read FLabelAttri + write FLabelAttri; + property HexAttri: TSynHighlighterAttributes read FHexAttri + write FHexAttri; + property ValueAttri: TSynHighlighterAttributes read FValueAttri + write FValueAttri; + property VariableAttri: TSynHighlighterAttributes read FVariableAttri + write FVariableAttri; + property AttributeAttri: TSynHighlighterAttributes read FAttributeAttri + write FAttributeAttri; + end; + +implementation + +uses + System.Win.Registry, + System.TypInfo, + SyStem.IniFiles, + SynEditStrConst, + SynEditMiscProcs, + Vcl.Graphics; + + +function TSynOmniSyn.IsEsc(const ARun: Integer): Boolean; +var + i, j: Integer; +begin + Result := False; + if not FEscapedStrings then Exit; + j := 0; + for i := ARun downto 0 do + if FLine[i] <> FEscapeChar then + Break + else + if FLine[i] = FEscapeChar then + Inc(j); + Result := j Mod 2 = 1; +end; + +function TSynOmniSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + Result := IsCharAlphaNumeric(AChar) or (Pos(AChar, FKeywordChars) > 0) + or (FPHPVariable and (AChar='$')) or ((csAutoit in FComments) and (AChar = '#')); +end; + +function TSynOmniSyn.IsWordBreakChar(AChar: WideChar): Boolean; +begin + if (csBasStyle in SingleLineComments) and (AChar = ';') then + Result := True + else + Result := inherited IsWordBreakChar(AChar) and not IsIdentChar(AChar); +end; + +constructor TSynOmniSyn.Create(AOwner: TComponent); + function CreateStringsList: TStringList; + begin + Result := TStringList.Create; + { important, cause we want to use CompareXXX not AnsiCompareXXX } + Result.UseLocale := False; + Result.Sorted := True; + Result.Duplicates := dupIgnore; + end; +begin + inherited Create(AOwner); + FHasLabel := True; + FKeyWords := CreateStringsList; + FKeyWords2 := CreateStringsList; + FKeyWords3 := CreateStringsList; + FResWords := CreateStringsList; + FCodeFoldingType := cftNone; + FRubyStringChar := ' '; + FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + FCommentAttri.Style := [fsItalic]; + AddAttribute(FCommentAttri); + FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(FIdentifierAttri); + FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); + FKeyAttri.Style := [fsBold]; + AddAttribute(FKeyAttri); + FResAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_AttrReservedWord); + FResAttri.Style := [fsBold]; + FResAttri.Foreground := clMaroon; + AddAttribute(FResAttri); + FKey2Attri := TSynHighlighterAttributes.Create(SYNS_AttrKey2, SYNS_AttrKey2); + FKey2Attri.Style := [fsBold]; + AddAttribute(FKey2Attri); + FKey3Attri := TSynHighlighterAttributes.Create(SYNS_AttrKey3, SYNS_AttrKey3); + FKey3Attri.Style := [fsBold]; + AddAttribute(FKey3Attri); + FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(FNumberAttri); + FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(FSpaceAttri); + FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(FStringAttri); + FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(FSymbolAttri); + FPreprocessorAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); + AddAttribute(FPreprocessorAttri); + SetAttributesOnChange(DefHighlightChange); + FLabelAttri := TSynHighlighterAttributes.Create(SYNS_AttrLabel, SYNS_AttrLabel); + AddAttribute(FLabelAttri); + FHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal); + AddAttribute(FHexAttri); + FValueAttri := TSynHighlighterAttributes.Create(SYNS_AttrValue, SYNS_FriendlyAttrValue); + AddAttribute(FValueAttri); + FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); + AddAttribute(FVariableAttri); + FAttributeAttri := TSynHighlighterAttributes.Create(SYNS_AttrAttribute, SYNS_FriendlyAttrAttribute); + AddAttribute(FAttributeAttri); + FStringDelim := [sdSingleQuote]; + FStringDelimCh := ''''; + FRange := rsUnknown; + FLangName := SYNS_FriendlyLangUnknown; + FHighlighterGroup := hgNone; + FCaseSensitive := False; + FEscapedStrings := True; +end; + +destructor TSynOmniSyn.Destroy; +begin + FKeyWords.Free; + FResWords.Free; + FKeyWords2.Free; + FKeyWords3.Free; + inherited Destroy; +end; + +procedure TSynOmniSyn.AsciiCharProc; +var + WasWord: Boolean; +begin + if (csCLisp in FComments) and (FLine[Run+1] = '|') then + begin + FTokenID := tkComment; + FRange := rsCLisp; + Inc(Run, 2); + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + { HEX value #$0123456789abcdef } + if (FLine[Run+1] = '$') and CharInSet(FLine[Run + 2], ['0'..'9', 'a'..'f', 'A'..'F']) then + begin + FTokenID := tkValue; + Inc(Run, 2); + while CharInSet(FLine[Run], ['0'..'9', 'a'..'f', 'A'..'F']) do + begin + Inc(Run); + end; + end + else + if (csAutoIt in FComments) and (FLine[Run+1] = 'c') and (FLine[Run+2] = 's') then + begin + FTokenID := tkComment; + FRange := rsAutoIt; + Inc(Run, 3); + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + if (csSharpStyle in FSingleComments) and (FLine[Run+1] <> '{') then + begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end + else + if csPasStyle in Comments then + begin + FTokenID := tkString; + repeat + Inc(Run); + until not IsCharAlphaNumeric(FLine[Run]); + end + else + if FDetectPreprocessor then + begin + if Trim(FLine)[1] <> '#' then + begin + FTokenID := tkSymbol; + Inc(Run); + Exit; + end; + WasWord := False; + FTokenID := tkPreprocessor; + repeat + if not WasWord and IsIdentChar(FLine[Run]) then WasWord := True; + Inc(Run); + until IsLineEnd(Run) or (FLine[Run] = ' ') and WasWord; +(* + FTokenID := tkPreprocessor; + repeat + Inc(Run); + until IsLineEnd(Run); +*) + end + else + begin + FTokenID := tkSymbol; + Inc(Run); + end; +end; + +procedure TSynOmniSyn.Assign(Source: TPersistent); +var + SourceHL: TSynOmniSyn; +begin + if Source is TSynOmniSyn then + begin + SourceHL := TSynOmniSyn(Source); + FLangName := SourceHL.LangName; + FCodeFoldingType := SourceHL.CodeFoldingType; + FComments := SourceHL.Comments; + FDetectPreprocessor := SourceHL.DetectPreprocessor; + FKeyWords.Assign(SourceHL.KeyWords); + FKeyWords.Assign(SourceHL.KeyWords); + FResWords.Assign(SourceHL.ResWords); + FKeyWords2.Assign(SourceHL.KeyWords2); + FKeyWords3.Assign(SourceHL.KeyWords3); + FPHPVariable := SourceHL.PHPVariable; + FRubySymbols := SourceHL.RubySymbols; + FHighlighterGroup := SourceHL.HighLighterGroup; + FKeywordChars := SourceHL.KeyWordChars; + FSingleComments := SourceHL.SingleLineComments; + FHasLabel := SourceHL.HasLabel; + FEscapedStrings := SourceHL.EscapedStrings; + FEscapeChar := SourceHL.EscapeChar; + FVectorSupport := SourceHL.VectorSupport; + FCaseSensitive := SourceHL.CaseSensitive; + FKW1StartWith := SourceHL.KW1StartWith; + FKW2StartWith := SourceHL.KW2StartWith; + FKW3StartWith := SourceHL.KW3StartWith; + FKW4StartWith := SourceHL.KW4StartWith; + end; + inherited; +end; + +procedure TSynOmniSyn.BraceOpenProc; +begin + if csLeftBracket in FSingleComments then + begin + FTokenID := tkComment; + FRange := rsUnKnown; + repeat + Inc(Run); + until IsLineEnd(Run); + end + else + if (csSmartStyle in FComments) and (FLine[Run+1] = '*') then + begin + FTokenID := tkComment; + FRange := rsSmart; + Inc(Run, 2); + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + if (csHaskell in FComments) and (FLine[Run+1] = '-') then + begin + FTokenID := tkComment; + FRange := rsHaskell; + Inc(Run, 2); + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + if csPasStyle in FComments then + begin + FTokenID := tkComment; + FRange := rsPasStyle; + Inc(Run); + if not IsLineEnd(Run) then + CommentRangeProc; +// PasStyleProc; + end + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; +end; + +procedure TSynOmniSyn.PointCommaProc; +begin + if (csVLisp in FComments) and (FLine[Run + 1] = '|') then + begin + FTokenID := tkComment; + FRange := rsVLisp; + Inc(Run, 2); + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + // VLisp comment can start directly after text + if ((csVLisp in FComments) or (csAutoit in FComments)) and + (csBasStyle in FSingleComments) then // Fiala + begin + FTokenID := tkComment; + FRange := rsUnknown; + Inc(Run); + while FLine[Run] <> #0 do + begin + FTokenID := tkComment; + Inc(Run); + end; + end + else + if (csASmStyle in FComments) or (csBasStyle in FSingleComments) then + begin + if (Run=0) or CharInSet(FLine[Run-1], [#32, #9]) then + begin + FTokenID := tkComment; + FRange := rsUnknown; + Inc(Run); + while FLine[Run] <> #0 do + begin + FTokenID := tkComment; + Inc(Run); + end; + end + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end + else + // INI komentar je prvni znak na radku + if (csINIStyle in FSingleComments) and (Run=0) then + begin + FTokenID := tkComment; + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; +end; + +procedure TSynOmniSyn.CRProc; +begin + FTokenID := tkSpace; + Inc(Run); + if FLine[Run] = #10 then Inc(Run); +end; + +procedure TSynOmniSyn.IdentProc; +var + OldRun: Integer; + tmpToken: string; + WhiteStart: Boolean; + I: Integer; +begin + OldRun := Run; + WhiteStart := False; + { check for label - there can be several whitespaces from line begin + before label: starts } + if Run < 10 then + begin + WhiteStart := True; + for I := Run - 1 downto 1 do + if not IsWhiteChar(FLine[I]) then + begin + WhiteStart := False; + Break; + end; + end; + while IsIdentChar(FLine[Run]) do Inc(Run); + if FHasLabel and (FLine[Run] = ':') and IsWhiteChar(FLine[Run + 1]) and (WhiteStart or + (OldRun = 2) and CharInSet(FLine[OldRun-1], ['R', 'r'])) then + begin + Inc(Run); + FTokenID := tkLabel; + end + else + begin + tmpToken := GetToken; + if IsReservedWord(tmpToken, FKeyWords, FKW1StartWith) then FTokenID := tkKey else + if IsReservedWord(tmpToken, FResWords, FKW2StartWith) then FTokenID := tkReserved else + if IsReservedWord(tmpToken, FKeyWords2, FKW3StartWith) then FTokenID := tkKey2 else + if IsReservedWord(tmpToken, FKeyWords3, FKW4StartWith) then FTokenID := tkKey3 else + FTokenID := tkIdentifier; + end; +end; + +procedure TSynOmniSyn.IntegerProc; + + function IsIntegerChar: Boolean; + begin + case FLine[Run] of + '0'..'9', 'A'..'F', 'a'..'f': + Result := True; + else + Result := False; + end; + end; + + +begin + if (csDollarMulti in Comments) then + begin + Inc(Run); + FRange := rsDollarMulti; + FTokenID := tkComment; + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + if (csDollar in Comments) and (FLine[Run + 1] = '(') then + begin + Inc(Run); + FRange := rsDollar; + FTokenID := tkComment; + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + if (csDMISStyle in FSingleComments) and (FLine[Run + 1] = '$') or + (csDollar in Comments) and (FLine[Run + 1] = '*') then + begin + Inc(Run); + FTokenID := tkComment; + while not IsLineEnd(Run) do + Inc(Run); + end + else + if (csDollar in Comments) and (FLine[Run + 1] = ')') then + begin + Inc(Run); + FRange := rsUnKnown; + FTokenID := tkSymbol; + end + else + if (csCPL in SingleLineComments) then + begin + FRange := rsUnKnown; + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end + else + if FPHPVariable then + begin + FTokenID := tkVariable; + repeat + Inc(Run); + until not (IsCharAlphaNumeric(FLine[Run]) or (FLine[Run] = '_')); + end + else +(* + if ((csPasStyle in Comments) or (csCStyle in Comments)) and + ((Run=0) or IsCharAlphaNumeric(FLine[Run-1])) then + begin + Inc(Run); + FTokenID := tkNumber; + IsNum := True; + while IsCharAlphaNumeric(FLine[Run]) do + begin + if not IsIntegerChar then IsNum := False; + Inc(Run); + end; + if not IsNum then FTokenID := tkUnknown; + end + else +*) + { HEX number $0123456789abcdef } + if not ((csDollar in Comments) or (csDollarMulti in Comments) or + (csCPL in SingleLineComments) or (csDMISStyle in SingleLineComments)) and + CharInSet(FLine[Run + 1], ['0'..'9', 'a'..'f', 'A'..'F']) and + ((Run = 0) or (FLine[Run-1] <> '#')) then + begin + FTokenID := tkHex; + Inc(Run); + while CharInSet(FLine[Run], ['0'..'9', 'a'..'f', 'A'..'F']) do + begin + Inc(Run); + end; + { zkontroluju, jestli je to po��d ��slo t�eba takov� $Default bralo prvn� 4 znaky jako hex } + if IsCharAlpha(FLine[Run]) then + FTokenID := tkUnknown; + end + else + begin + Inc(Run); + FTokenID := tkUnknown; + end; +end; + +procedure TSynOmniSyn.LFProc; +begin + FTokenID := tkSpace; + Inc(Run); +end; + +procedure TSynOmniSyn.NullProc; +begin + FTokenID := tkNull; + Inc(Run); +end; + +procedure TSynOmniSyn.NumberProc; +var + OldRun: Integer; + + function IsNumberChar: Boolean; + begin + case FLine[Run] of + '0'..'9', 'a'..'f', 'A'..'F', 'h', 'H', '.', 'x': + Result := True; + else + Result := False; + end; + end; + +begin + OldRun := Run; + { we will test label started with number } + while IsIdentChar(FLine[Run]) do Inc(Run); + if FHasLabel and (OldRun = 0) and (FLine[Run] = ':') then + begin + Inc(Run); + FTokenID := tkLabel; + end + else + { standard number test } + begin + Run := OldRun; + Inc(Run); + FTokenID := tkNumber; + while IsNumberChar do + begin + case FLine[Run] of + 'x': begin // handle C style hex numbers + HexProc; + Break; + end; + 'a'..'f', 'A'..'F', 'h', 'H': begin + HexProc; + Break; + end; + '.': + if FLine[Run + 1] = '.' then Break; + end; + Inc(Run); + end; + end; +end; + +procedure TSynOmniSyn.RoundOpenProc; +begin + Inc(Run); + if (csOkuma in FComments) then + begin + FRange := rsOkuma; + FTokenID := tkComment; + Dec(run); + repeat + Inc(Run); + if (FLine[Run] = ')') then + begin + Inc(Run); + FRange := rsUnKnown; + Break; + end + until IsLineEnd(Run); + end + else + if (csHeller in FComments) and ((FLine[Run] = '*') or (FLine[Run] = '/')) then + begin + FRange := rsHeller; + FTokenID := tkComment; + repeat + Inc(Run); + if (FLine[Run] = ')') then + begin + Inc(Run); + FRange := rsUnKnown; + Break; + end + until IsLineEnd(Run); + end + else + if csAnsiStyle in FComments then + begin + case FLine[Run] of + '*': + begin + FTokenID := tkComment; + FRange := rsAnsi; + Inc(Run); + while FLine[Run] <> #0 do + case FLine[Run] of + '*': + if FLine[Run + 1] = ')' then + begin + FRange := rsUnKnown; + Inc(Run, 2); + Break; + end else Inc(Run); + #10: Break; + #13: Break; + else Inc(Run); + end; + end; + '.': + begin + Inc(Run); + FTokenID := tkSymbol; + end; + else + begin + FTokenID := tkSymbol; + end; + end; + end + else + if (csForth in FComments) and (FLine[Run] = ' ') then + begin + FRange := rsForth; + FTokenID := tkComment; + repeat + Inc(Run); + if (FLine[Run] = ')') then + begin + Inc(Run); + FRange := rsUnKnown; + Break; + end + until IsLineEnd(Run); + end + else + { Ruby gsub(/.../, ...) - highlight of the content of /.../ } + if FRubySymbols and (FLine[Run] = '/') then + begin + FTokenID := tkSymbol; + repeat + Inc(Run); + until IsLineEnd(Run) or (FLine[Run] = '/'); + Inc(Run); + end + else + FTokenID := tkSymbol; +end; + +procedure TSynOmniSyn.RubyRangeProc(const AType: Integer); +var + myLevel: Integer; + IsRegExp: Boolean; +begin + myLevel := 0; + { regular expression } + if AType > 10 then + FTokenID := tkAttribute + { symbols } + else + FTokenID := tkValue; + + { handle end of line - we wrote last char } + case AType of + 1, 11: FRange := rsRubyString1; + 2, 12: FRange := rsRubyString2; + else + FRange := rsUnknown; + end; + + { regular expressions /[ ... ]/ } + if AType > 10 then + begin + repeat + Inc(Run); + until IsLineEnd(Run) or (FLine[Run] = ']') and not IsEsc(Run-1) and (FLine[Run+1] = '/'); + if FLine[Run] = ']' then + begin + Inc(Run, 2); + case AType of + 11: FRange := rsRubyString1; + 12: FRange := rsRubyString2; + else + FRange := rsUnknown; + end; + end + end + // symbols #{...} + else + begin + IsRegExp := False; + { we need to count brackets to get end of symbol } + repeat + Inc(Run); + { we need to skip regular expressions /[...]/ } + if (FLine[Run-1] = '/') and (FLine[Run] = '[') then + IsRegExp := True; + if (FLine[Run] = '/') and (FLine[Run-1] = ']') and not IsEsc(Run-2) then + IsRegExp := False; + + { if we are inside regular expression, we don't count brackets } + if not IsRegExp then + begin + if (FLine[Run] = '{') and not IsEsc(Run-1) then + Inc(myLevel) + else + if (FLine[Run] = '}') and not IsEsc(Run-1) then + // special stupid case of string %}...} + if FLine[Run-1] = '%' then + Inc(myLevel) + else + Dec(MyLevel); + end; + until IsLineEnd(Run) or (FLine[Run] = '}') and (myLevel <= 0); + if FLine[Run] = '}' then + begin + Inc(Run); + case AType of + 1: FRange := rsRubyString1; + 2: FRange := rsRubyString2; + else + FRange := rsUnknown; + end; + end; + end; +end; + +procedure TSynOmniSyn.RubyStringProc; +var + ch: WideChar; +begin + ch := FLine[Run]; + { RUBY } + { we are returning from section or symbol to string } + if (FRange = rsRubyString1) and (ch = '"') then + begin + Inc(run); + FTokenID := tkString; + FRange := rsUnKnown; + Exit; + end; + + { here we continue in multiline string } + FTokenID := tkString; + FRange := rsRubyString1; + { multiline string - we must set string end char } + if (Run = 0) or (FLine[Run] <> '"') then + ch := '"'; + if (FLine[Run + 1] = ch) and (FLine[Run + 2] = ch) then + Inc(Run, 2); + repeat + { RUBY - zacatek sekce ve stringu } + if (FLine[Run] = '#') and (FLine[Run+ 1] = '{') then + begin + FRange := rsRubyString1; + Exit; + end; + Inc(Run); + until IsLineEnd(Run) or (FLine[Run] = ch) and not IsEsc(Run-1); + if (FLine[Run] = ch) then FRange := rsUnknown; + if FLine[Run] <> #0 then Inc(Run); +end; + +procedure TSynOmniSyn.RubyStringProc2; +begin + FTokenID := tkString; + { enter string procedure first time - we need to remember string begin char } + if fRubyStringChar = ' ' then + begin + Inc(Run); + { normal strings %[...], %!...!, e.t.c.} + if FLine[Run-1] = '%' then + begin + { we will handle special case %sx ..... x } + if FLine[Run] = 's' then + Inc(Run); + FRubyStringChar := FLine[Run]; + end; + end + else + { we return from range and first char is end of the string = end } + if FLine[Run] = FRubyStringChar then + begin + Inc(Run); + FRubyStringChar := ' '; + FRange := rsUnKnown; + Exit; + end; + + FRange := rsRubyString2; + { fix the string close char } + case FRubyStringChar of + '(': FRubyStringChar := ')'; + '<': FRubyStringChar := '>'; + '[': FRubyStringChar := ']'; + '{': FRubyStringChar := '}'; + end; + repeat + { RUBY - start of symbol - we end and continue in RubyRangeProc } + if (FLine[Run] = '#') and (FLine[Run+ 1] = '{') then Exit; + Inc(Run); + until IsLineEnd(Run) or (FLine[Run] = '''') and not IsEsc(Run-1) + or (FRubyStringChar <> ' ') and (FLine[Run] = FRubyStringChar) and not IsEsc(Run-1); + { end of the string } + if (FLine[Run] = '''') and not IsEsc(Run-1) or (FRubyStringChar <> ' ') and (FLine[Run] = FRubyStringChar) then + begin + Inc(Run); + fRubyStringChar := ' '; + FRange := rsUnknown; + end; +end; + +procedure TSynOmniSyn.SlashProc; +var + IsComment: Boolean; + i: Integer; +begin + if (csSpecStyle in FSingleComments) then + begin + { slash is first char on line } + IsComment := (Run = 0); + if not IsComment then + for i := Run - 1 downto 1 do + begin + if FLine[i] = ';' then + begin + IsComment := True; + Break; + end; + if not CharInSet(FLine[i], [#32, #9]) then + begin + IsComment := False; + Break; + end; + end; + if IsComment then + begin + Inc(Run); + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + Exit; + end; + end; + case FLine[Run + 1] of + '/': + begin + { block comment //* .. *// } + if (csJCLStyle in FComments) and (FLine[Run + 2] = '*') then + begin + Inc(Run, 3); + FTokenID := tkComment; + FRange := rsJCL; + while FLine[Run] <> #0 do + case FLine[Run] of + '*': + if (FLine[Run + 1] = '/') and (FLine[Run + 2] = '/') then + begin + FRange := rsUnKnown; + Inc(Run, 3); + Break; + end + else + Inc(Run); + #10: Break; + #13: Break; + else + Inc(Run); + end; + end + else + { line comment //* } + if (csJCL in FSingleComments) and (FLine[Run + 2] = '*') then + begin + Inc(Run, 3); + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end + else + { line comment // } + if csSlashStyle in FSingleComments then + begin + Inc(Run, 2); + FTokenID := tkComment; + while not IsLineEnd(Run) do + begin + Inc(Run); + // PSL support: -- PSL something... + if Copy(FLine, Run-4, 5) = ' psl ' then + Break; + end; + end + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; + '*': + begin + { block comment /* .. */ } + if csCStyle in FComments then + begin + FTokenID := tkComment; + FRange := rsCStyle; + Inc(Run); + while FLine[Run] <> #0 do + case FLine[Run] of + '*': + if FLine[Run + 1] = '/' then + begin + FRange := rsUnKnown; + Inc(Run, 2); + Break; + end + else + Inc(Run); + #10: Break; + #13: Break; + else + Inc(Run); + end; + end + else + // line comment /* + if csLineC in FSingleComments then + begin + Inc(Run, 2); + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; + '+': + begin + { block comment /+ .. +/ } + if csDStyle in FComments then + begin + FTokenID := tkComment; + FRange := rsD; + Inc(Run); + while FLine[Run] <> #0 do + case FLine[Run] of + '*': + if FLine[Run + 1] = '/' then + begin + FRange := rsUnKnown; + Inc(Run, 2); + Break; + end else Inc(Run); + #10: Break; + #13: Break; + else + Inc(Run); + end; + end + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; + end; + +end; + +procedure TSynOmniSyn.SpaceProc; +begin + Inc(Run); + FTokenID := tkSpace; + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynOmniSyn.StringProc; +var + ch: WideChar; +begin + ch := FLine[Run]; + { in MathLab is v' vector and not string } + if FVectorSupport and (ch = '''') then + if (Run > 0) and IsCharAlphaW(FLine[Run - 1]) then + begin + Inc(Run); + Exit; + end; + if (ch = '''') and (csSinglQStyle in FSingleComments) then + begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end + else + { rest of strings } + begin + FTokenID := tkString; + if (FLine[Run + 1] = ch) and (FLine[Run + 2] = ch) then + Inc(Run, 2); + repeat + case FLine[Run] of + #0, #10, #13: Break; + end; + Inc(Run); + until (FLine[Run] = ch) and not IsEsc(Run-1); +// until ((ch = '''') and (FLine[Run] = '''') or (FLine[Run] = '"') or (FLine[Run] = '`'))and not IsEsc(Run-1); + if IsLineEnd(Run) then + begin + if FRubySymbols then + FRange := rsRubyString2; + end + else + Inc(Run); + end; +end; + +procedure TSynOmniSyn.UnknownProc; +begin + Inc(Run); + FTokenID := tkUnknown; +end; + +procedure TSynOmniSyn.Next; +begin + fTokenPos := Run; + if (FRange = rsRubyString1) and (FLine[Run] = '#') and (FLine[Run+1] = '{') then + RubyRangeProc(1) + else + if (FRange = rsRubyString2) and (FLine[Run] = '#') and (FLine[Run+1] = '{') then + RubyRangeProc(2) + else + if (FRange = rsRubyString1) and not IsLineEnd(Run) then + RubyStringProc + else + if (FRange = rsRubyString2) and not IsLineEnd(Run) then + RubyStringProc2 + else + if (FRange <> rsUnknown) and (FRange <> rsRuby) and (FRange <> rsRubyString1) then + CommentRangeProc + else + {TexInfo} + if (csTexInfo in Comments) and (Run=0) and (FLine[run] = '@') then + begin + if (Copy(FLine, 1, 3) = '@c ') or (Copy(FLine, 1, 8) = '@comment') then + RestIsCommentProc + else + if (Copy(FLine, 1, 7) = '@ignore') then + begin + FRange := rsTexInfo; + RestIsCommentProc; + end + else + if (Copy(FLine, 1, 8) = '@bye') then + begin + FRange := rsTexInfoBye; + RestIsCommentProc; + end + else + begin + Inc(Run); + IdentProc; + end; + end + else + if not ((cs2Stars in FSingleComments) and (FLine[Run] = '*') and (FLine[Run + 1] = '*') or + (csAutomaton in FSingleComments) and (FLine[Run] = '%') and (FLine[Run + 1] = '%') or + (csSQLStyle in FSingleComments) and (FLine[Run] = '-') and (FLine[Run + 1] = '-')) and + (Pos(FLine[Run], FKeywordChars) > 0) then + IdentProc + else + // Descript.ion comment starts with fist space to end of line + if csSpace in FSingleComments then + begin + if Run = 0 then + FileNameProc + else + RestIsCommentProc; + end + else + {PowerShell attribute in square brackets} + if (csPwShell in FComments) and (Run>0) and (FLine[Run-1] = '[') and IsCharAlpha(FLine[Run]) then + begin + FTokenID := tkAttribute; + while IsCharAlphaNumeric(FLine[Run]) do Inc(Run); + end + else + begin + case FLine[Run] of + '''': if (csDead in FComments) and (FLine[Run+1] = '''') then + begin + FTokenID := tkComment; + FRange := rsDead; + Inc(Run); + CommentRangeProc; + end + else + if (csSinglQStyle in FSingleComments) then + SingleQuoteProc + else + if CharInSet('''', FStringDelimChars) then + StringProc + else + UnknownProc; + '"': if csDblQStyle in FSingleComments then + DoubleQuoteProc + else + if FRubySymbols and not IsEsc(Run-1) then + RubyStringProc + else + if CharInSet('"', FStringDelimChars) and not IsEsc(Run-1) then + StringProc + else + UnknownProc; + '`': if CharinSet('`', FStringDelimChars) then + StringProc + else + UnknownProc; + '#': if FRubySymbols and (FLine[Run+1] = '{') then + RubyRangeProc(3) + else + AsciiCharProc; + '{': BraceOpenProc; + ';': PointCommaProc; + #13: CRProc; + 'A', 'B', 'D'..'Q', 'S'..'Z', + 'a', 'b', 'd'..'q', 's'..'z': IdentProc; +// '_': UnknownProc; + 'C', 'c': FortranCommProc; + 'R', 'r': REMCommentProc; + '$': IntegerProc; + #10: LFProc; + #0: NullProc; + '|': PipeProc; + '0'..'9': NumberProc; + '(': RoundOpenProc; + '/': SlashProc; + '\': BackSlashProc; + #1..#8, #11, #12, #14..#32: SpaceProc; + #9: TabKeyProc; + '-': MinusProc; + '@': LabelProc; + '*': AsteriskProc; + '!': ExclamationProc; + '&': AmpersandProc; + '%': if FRubySymbols and + CharInSet(FLine[Run+1], ['<', '(', '{', '.', '''', '!', '[', ']', '&', 's', '_', '/']) then + RubyStringProc2 + else + PerCentProc; + ':': BatCommentProc; + '}', ',', '=', '^', '+', '.', ')', '[', ']', + '<': HTMLCommentProc; + '>', '?': SymbolProc; + else + UnknownProc; + end; + end; + inherited; +end; + +class function TSynOmniSyn.GetCapabilities: TSynHighlighterCapabilities; +begin + Result := inherited GetCapabilities + [hcStructureHighlight]; +end; + +function TSynOmniSyn.GetDefaultAttribute(Index: integer): TSynHighlighterAttributes; +begin + case Index of + SYN_ATTR_COMMENT: Result := FCommentAttri; + SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; + SYN_ATTR_KEYWORD: Result := FKeyAttri; + SYN_ATTR_STRING: Result := FStringAttri; + SYN_ATTR_WHITESPACE: Result := FSpaceAttri; + SYN_ATTR_SYMBOL: Result := FSymbolAttri; + else + Result := nil; + end; +end; + +function TSynOmniSyn.GetEol: Boolean; +begin + Result := (Run >= FLineLen + 1); +end; + +function TSynOmniSyn.GetRange: Pointer; +begin + Result := Pointer(FRange); +end; + +function TSynOmniSyn.GetTokenID: TtkTokenKind; +begin + Result := FTokenID; +end; + +function TSynOmniSyn.GetTokenAttribute: TSynHighlighterAttributes; +begin + case FTokenID of + tkComment: Result := FCommentAttri; + tkIdentifier: Result := FIdentifierAttri; + tkKey: Result := FKeyAttri; + tkNumber: Result := FNumberAttri; + tkPreprocessor: Result := FPreprocessorAttri; + tkSpace: Result := FSpaceAttri; + tkString: Result := FStringAttri; + tkSymbol: Result := FSymbolAttri; + tkUnknown: Result := FIdentifierAttri; + tkReserved: Result := FResAttri; + tkKey2: Result := FKey2Attri; + tkKey3: Result := FKey3Attri; + tkLabel: Result := FLabelAttri; + tkHex: Result := FHexAttri; + tkValue: Result := FValueAttri; + tkVariable: Result := FVariableAttri; + tkAttribute: Result := FAttributeAttri; + else + Result := nil; + end; +end; + +function TSynOmniSyn.GetTokenKind: integer; +begin + Result := Ord(FTokenID); +end; + +procedure TSynOmniSyn.ResetRange; +begin + FRange := rsUnknown; +end; + +procedure TSynOmniSyn.SetRange(Value: Pointer); +begin + FRange := TRangeState(Value); +end; + +procedure TSynOmniSyn.SetKeyWords(const Value: TStrings); +begin + SetKeyWordsCompat(Value, FKeyWords); +end; + +procedure TSynOmniSyn.SetCaseSensitive(const Value: Boolean); +begin + if FCaseSensitive <> Value then + begin + FCaseSensitive := Value; + TstringList(ResWords).CaseSensitive := FCaseSensitive; + TstringList(KeyWords).CaseSensitive := FCaseSensitive; + TstringList(KeyWords2).CaseSensitive := FCaseSensitive; + TstringList(KeyWords3).CaseSensitive := FCaseSensitive; + end; +end; + +procedure TSynOmniSyn.SetComments(Value: TCommentStyles); +begin + FComments := Value; + DefHighLightChange(nil); +end; + +class function TSynOmniSyn.GetLanguageName: string; +begin + Result := SYNS_LangOmni; +end; + +function TSynOmniSyn.LoadFromIniFile(const FileName: string): Boolean; +var + Str: string; + IniFile: TMemIniFile; + SL: TStringList; +begin + Result := False; + if FileExists(FileName) then + begin + IniFile := TMemIniFile.Create(FileName); + try + with IniFile do + begin + FLangName := ReadString('Settings', 'Name', ''); + + Str := ReadString('Settings', 'FileType', ''); + if (Str <> '') and (FLangName <> '') then + begin + Str := StringReplace(Str, ',', ';', [rfReplaceAll]); + FDefaultFilter := + Format('%s %s (%s)|%2:s', [FLangName, SYNS_Files, Str]); + end + else + fDefaultFilter := ''; + + FCaseSensitive := ReadBool('Settings', 'CaseSensitive', False); + + FVectorSupport := ReadBool('Settings', 'Vectors', False); + if ReadBool('Settings', 'HTMLGroup', False) then + FHighLighterGroup := hgHTML + else + FHighLighterGroup := hgNone; + + FComments := []; + if ReadBool('Settings', 'ANSIComment', False) then Include(FComments, csAnsiStyle); + if ReadBool('Settings', 'PasComment', False) then Include(FComments, csPasStyle); + if ReadBool('Settings', 'CComment', False) then Include(FComments, csCStyle); + if ReadBool('Settings', 'DollarComment', False) then Include(FComments, csDollar); + if ReadBool('Settings', 'SmartComment', False) then Include(FComments, csSmartStyle); + if ReadBool('Settings', 'HaskellComment', False) then Include(FComments, csHaskell); + if ReadBool('Settings', 'DComment', False) then Include(FComments, csDStyle); + if ReadBool('Settings', 'JCLComment', False) then Include(FComments, csJCLStyle); + if ReadBool('Settings', 'VLispComment', False) then Include(FComments, csVLisp); + if ReadBool('Settings', 'CLispComment', False) then Include(FComments, csCLisp); + if ReadBool('Settings', 'DeadComment', False) then Include(FComments, csDead); + if ReadBool('Settings', '2Exclamation', False) then Include(FComments, cs2Excl); + if ReadBool('Settings', 'DollarMultiComment', False) then Include(FComments, csDollarMulti); + if ReadBool('Settings', 'ForthComment', False) then Include(FComments, csForth); + if ReadBool('Settings', 'HTMLComment', False) then Include(FComments, csHTML); + if ReadBool('Settings', 'LuaComment', False) then Include(FComments, csLUA); + if ReadBool('Settings', 'LilypondComment', False) then Include(FComments, csLilypond); + if ReadBool('Settings', 'OkumaComment', False) then Include(FComments, csOkuma); + if ReadBool('Settings', 'HellerComment', False) then Include(FComments, csHeller); + if ReadBool('Settings', 'PwShellComment', False) then Include(FComments, csPwShell); + if ReadBool('Settings', 'SSComment', False) then Include(FComments, csStarSemicol); + if ReadBool('Settings', 'TexInfoComment', False) then Include(FComments, csTexInfo); + if ReadBool('Settings', 'AutoitBlockComm', False) then Include(FComments, csAutoit); + + FSingleComments := []; + if ReadBool('Settings', 'CPLComment', False) then Include(FSingleComments, csCPL); + if ReadBool('Settings', 'SpecComment', False) then Include(FSingleComments, csSpecStyle); + if ReadBool('Settings', 'BackSlashComment', False) then Include(FSingleComments, csBackSlashStyle); + if ReadBool('Settings', 'LineCComment', False) then Include(FSingleComments, csLineC); + if ReadBool('Settings', 'BasComment', False) then Include(FSingleComments, csBasStyle); + if ReadBool('Settings', 'INIComment', False) then Include(FSingleComments, csINIStyle); + if ReadBool('Settings', 'FoxComment', False) then Include(FSingleComments, csFoxStyle); + if ReadBool('Settings', 'REMComment', False) then Include(FSingleComments, csBatStyle); + if ReadBool('Settings', 'ExclComment', False) then Include(FSingleComments, csExclStyle); + if ReadBool('Settings', 'ByComment', False) then Include(FSingleComments, csByStyle); + if ReadBool('Settings', 'SharpComment', False) then Include(FSingleComments, csSharpStyle); + if ReadBool('Settings', 'SlashComment', False) then Include(FSingleComments, csSlashStyle); + if ReadBool('Settings', 'PerCentComment', False) then Include(FSingleComments, csPercentStyle); + if ReadBool('Settings', 'AutomatonComment', False) then Include(FSingleComments, csAutomaton); + if ReadBool('Settings', 'SinglQComment', False) then Include(FSingleComments, csSinglQStyle); + if ReadBool('Settings', 'DblQComment', False) then Include(FSingleComments, csDblQStyle); + if ReadBool('Settings', 'SQLComment', False) then Include(FSingleComments, csSQLStyle); + if ReadBool('Settings', 'CStarComment', False) then Include(FSingleComments, csCStar); + if ReadBool('Settings', 'FortranComment', False) then Include(FSingleComments, csFortran); + if ReadBool('Settings', 'LBracketComment', False) then Include(FSingleComments, csLeftBracket); + if ReadBool('Settings', 'PocoComment', False) then Include(FSingleComments, csPocoStyle); + if ReadBool('Settings', 'PipeComment', False) then Include(FSingleComments, csPipe); + if ReadBool('Settings', 'WebFocusComment', False) then Include(FSingleComments, csWebFocus); + if ReadBool('Settings', 'DMISComment', False) then Include(FSingleComments, csDMISStyle); + if ReadBool('Settings', 'TabKeyComment', False) then Include(FSingleComments, csTabKey); + if ReadBool('Settings', '2StarsComment', False) then Include(FSingleComments, cs2Stars); + if ReadBool('Settings', 'PCLComment', False) then Include(FSingleComments, csPCL); + if ReadBool('Settings', 'EuklidComment', False) then Include(FSingleComments, csEuklid); + if ReadBool('Settings', 'SpaceComment', False) then Include(FSingleComments, csSpace); + if ReadBool('Settings', 'JCLsingleComment', False) then Include(FSingleComments, csJCL); + if ReadBool('Settings', 'DashComment', False) then Include(FSingleComments, csDash); + if ReadBool('Settings', 'AngleBrackets', False) then Include(FSingleComments, csAngleBrackets); + + FStringDelim := []; + if ReadBool('Settings', 'SingleQuote', False) then Include(FStringDelim, sdSingleQuote); + if ReadBool('Settings', 'ApostropheQuote', False) then Include(FStringDelim, sdApostropheQuote); + if ReadBool('Settings', 'DoubleQuote', True) then Include(FStringDelim, sdDoubleQuote); + FEscapedStrings := ReadBool('Settings', 'EscString', True); + FEscapeChar := ReadString('Settings', 'EscChar', '\')[1]; + + FDetectPreprocessor := ReadBool('Settings', 'Preprocessors', False); + FHasLabel := ReadBool('Settings', 'Label', True); + FPHPVariable := ReadBool('Settings', 'PHPVariable', False); + FRubySymbols := ReadBool('Settings', 'RubySymbols', False); + FKeyWordChars := ReadString('Settings', 'KeyWordChars', '_'); + + FCodeFoldingType := TCodeFoldingType(GetEnumValue( + TypeInfo(TCodeFoldingType), + ReadString('Settings', 'CodeFolding', 'ftNone'))); + FKW1StartWith := ReadBool('Settings', 'KW1StartWith', False); + FKW2StartWith := ReadBool('Settings', 'KW2StartWith', False); + FKW3StartWith := ReadBool('Settings', 'KW3StartWith', False); + FKW4StartWith := ReadBool('Settings', 'KW4StartWith', False); + + SL := TStringList.Create; + try + SL.Clear; ReadSection('KeyWords', SL); + SetKeyWordsCompat(SL, KeyWords); + SL.Clear; ReadSection('ReservedWords', SL); + SetKeyWordsCompat(SL, ResWords); + SL.Clear; ReadSection('KeyWords2', SL); + SetKeyWordsCompat(SL, KeyWords2); + SL.Clear; ReadSection('KeyWords3', SL); + SetKeyWordsCompat(SL, KeyWords3); + finally + SL.Free; + end; + end; + Result := True; + finally + IniFile.Free; + end; + end; +end; + +function TSynOmniSyn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; +var + r: TRegistry; +begin + r:= TRegistry.Create; + try + r.RootKey := RootKey; + if r.OpenKeyReadOnly(Key) then begin + if r.ValueExists('KeyWords') then KeyWords.Text:= r.ReadString('KeyWords'); + Result := inherited LoadFromRegistry(RootKey, Key); + end + else Result := false; + finally r.Free; end; +end; + +function TSynOmniSyn.SaveToIniFile(const FileName: string): Boolean; +var + SL : TStringList; + + function BToC(BoolValue: Boolean): string; + begin + if BoolValue then Result := '1' + else Result := '0'; + end; + + procedure SortList(AStrings: TStrings); + var + Str, TrimmedStr: string; + SortedSL: TStringList; + begin + SortedSL := TStringList.Create; + try + SortedSL.Clear; + { important, cause we want CompareXXX, not AnsiCompareXXX when Sort } + SortedSL.UseLocale := False; + SortedSL.Sorted := True; + SortedSL.Duplicates := dupIgnore; + for Str in AStrings do + begin + TrimmedStr := Trim(Str); + if TrimmedStr <> '' then + SortedSL.Add(TrimmedStr); + end; + AStrings.Assign(SortedSL); + finally + SortedSL.Free; + end; + end; + + procedure AddIf(const AKey: string; b: Boolean); + begin + if b then SL.Add(AKey + '=1'); + end; + + procedure AddBool(const AKey: string; b: Boolean); + begin + if b then + SL.Add(AKey + '=1') + else + SL.Add(AKey + '=0'); + end; + +var + KeyWord: string; + Idx: Integer; + Str: string; +begin + Result := False; + + if (FileName <> '') then + begin + SL := TStringList.Create; + try + SL.Add(';SynEdit Omni HighLighter Definition File'); + SL.Add('[Settings]'); + SL.Add('Name=' + FLangName); + SL.Add('HTMLGroup=' + BToC(FHighLighterGroup = hgHTML)); + SL.Add('Vectors=' + BToC(FVectorSupport)); + SL.Add('Label=' + BToC(FHasLabel)); + SL.Add('PHPVariable=' + BToC(FPHPVariable)); + SL.Add('RubySymbols=' + BToC(FRubySymbols)); + + Idx := FDefaultFilter.IndexOf('|'); + if Idx >= 0 then + begin + Str := FDefaultFilter.Substring(Idx + 1); + Str := StringReplace(Str, ';', ',', [rfReplaceAll]); + SL.Add('FileType=' + Str); + end; + AddIf('CaseSensitive', FCaseSensitive); + AddIf('Preprocessors', FDetectPreprocessor); + + AddIf('ANSIComment', csAnsiStyle in FComments); + AddIf('PasComment', csPasStyle in FComments); + AddIf('CComment', csCStyle in FComments); + AddIf('DollarComment', csDollar in FComments); + AddIf('SmartComment', csSmartStyle in FComments); + AddIf('HaskellComment', csHaskell in FComments); + AddIf('DComment', csDStyle in FComments); + AddIf('JCLComment', csJCLStyle in FComments); + AddIf('VLispComment', csVLisp in FComments); + AddIf('CLispComment', csCLisp in FComments); + AddIf('DeadComment', csDead in FComments); + AddIf('2Exclamation', cs2Excl in FComments); + AddIf('DollarMultiComment', csDollarMulti in FComments); + AddIf('ForthComment', csForth in FComments); + AddIf('HTMLComment', csHTML in FComments); + AddIf('LuaComment', csLUA in FComments); + AddIf('LilypondComment', csLilypond in FComments); + AddIf('OkumaComment', csOkuma in FComments); + AddIf('HellerComment', csHeller in FComments); + AddIf('PwShellComment', csPwShell in FComments); + AddIf('SSComment', csStarSemicol in FComments); + AddIf('TexInfoComment', csTexInfo in FComments); + AddIf('AutoitBlockComm', csAutoit in FComments); + + AddIf('CPLComment', csCPL in FSingleComments); + AddIf('SpecComment', csSpecStyle in FSingleComments); + AddIf('BackSlashComment', csBackSlashStyle in FSingleComments); + AddIf('LineCComment', csLineC in FSingleComments); + AddIf('BasComment', csBasStyle in FSingleComments); + AddIf('INIComment', csINIStyle in FSingleComments); + AddIf('FoxComment', csFoxStyle in FSingleComments); + AddIf('REMComment', csBatStyle in FSingleComments); + AddIf('ExclComment', csExclStyle in FSingleComments); + AddIf('ByComment', csByStyle in FSingleComments); + AddIf('SharpComment', csSharpStyle in FSingleComments); + AddIf('SlashComment', csSlashStyle in FSingleComments); + AddIf('PerCentComment', csPercentStyle in FSingleComments); + AddIf('AutomatonComment', csAutomaton in FSingleComments); + AddIf('SinglQComment', csSinglQStyle in FSingleComments); + AddIf('DblQComment', csDblQStyle in FSingleComments); + AddIf('SQLComment', csSQLStyle in FSingleComments); + AddIf('CStarComment', csCStar in FSingleComments); + AddIf('FortranComment', csFortran in FSingleComments); + AddIf('LBracketComment', csLeftBracket in FSingleComments); + AddIf('PocoComment', csPocoStyle in FSingleComments); + AddIf('PipeComment', csPipe in FSingleComments); + AddIf('WebFocusComment', csWebFocus in FSingleComments); + AddIf('DMISComment', csDMISStyle in FSingleComments); + AddIf('TabKeyComment', csTabKey in FSingleComments); + AddIf('2StarsComment', cs2Stars in FSingleComments); + AddIf('PCLComment', csPCL in FSingleComments); + AddIf('EuklidComment', csEuklid in FSingleComments); + AddIf('SpaceComment', csSpace in FSingleComments); + AddIf('JCLsingleComment', csJCL in FSingleComments); + AddIf('DashComment', csDash in FSingleComments); + AddIf('AngleBrackets', csAngleBrackets in FSingleComments); + + AddBool('SingleQuote', sdSingleQuote in FStringDelim); + AddBool('DoubleQuote', sdDoubleQuote in FStringDelim); + AddBool('ApostropheQuote', sdApostropheQuote in FStringDelim); + SL.Add('EscString=' + BToC(FEscapedStrings)); + SL.Add('EscChar=' + FEscapeChar); + + AddBool('KW1StartWith', FKW1StartWith); + AddBool('KW2StartWith', FKW2StartWith); + AddBool('KW3StartWith', FKW3StartWith); + AddBool('KW4StartWith', FKW4StartWith); + + + SL.Add('KeyWordChars=' + FKeywordChars); + SL.Add('CodeFolding=' + + GetEnumName(TypeInfo(TCodeFoldingType), Integer(FCodeFoldingType))); + + SL.Add('[KeyWords]'); + for KeyWord in FKeyWords do + SL.Add(KeyWord+'='); + SL.Add('[ReservedWords]'); + for KeyWord in FResWords do + SL.Add(KeyWord+'='); + SL.Add('[KeyWords2]'); + for KeyWord in FKeyWords2 do + SL.Add(KeyWord+'='); + SL.Add('[KeyWords3]'); + for KeyWord in FKeyWords3 do + SL.Add(KeyWord+'='); + + SL.SaveToFile(FileName); + Result := True; + finally + SL.Free; + end; + end; +end; + +function TSynOmniSyn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean; +var + r: TRegistry; +begin + r:= TRegistry.Create; + try + r.RootKey := RootKey; + if r.OpenKey(Key,true) then begin + r.WriteString('KeyWords', KeyWords.Text); + Result := inherited SaveToRegistry(RootKey, Key); + end + else Result := false; + finally r.Free; end; +end; + +procedure TSynOmniSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine, ToLine: Integer); +var + CurLine: String; + + function LineHasChar(Line: Integer; character: char; + StartCol : Integer): Boolean; // faster than Pos! + var + i: Integer; + begin + result := false; + for I := StartCol to Length(CurLine) do begin + if CurLine[i] = character then begin + // Char must have proper highlighting (ignore stuff inside comments...) + if GetHighlighterAttriAtRowCol(LinesToScan, Line, I) <> FCommentAttri then begin + result := true; + Break; + end; + end; + end; + end; + + function FindBraces(Line: Integer) : Boolean; + var + Col : Integer; + begin + Result := False; + + for Col := 1 to Length(CurLine) do + begin + // We've found a starting character + if CurLine[col] = '{' then + begin + // Char must have proper highlighting (ignore stuff inside comments...) + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> FCommentAttri then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, '}', col + 1) then begin + FoldRanges.StartFoldRange(Line + 1, 1, + LeftSpaces(CurLine, True, TabWidth(LinesToScan))); + Result := True; + end; + // Skip until a newline + Break; + end; + end else if CurLine[col] = '}' then + begin + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> FCommentAttri then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, '{', col + 1) then begin + FoldRanges.StopFoldRange(Line + 1, 1); + Result := True; + end; + // Skip until a newline + Break; + end; + end; + end; // for Col + end; + + function FoldRegion(Line: Integer): Boolean; + var + S : string; + begin + Result := False; + S := AnsiUpperCase(TrimLeft(CurLine)); + if S.Contains('#REGION') then + begin + FoldRanges.StartFoldRange(Line + 1, FoldRegionType); + Result := True; + end + else + if S.Contains('#ENDREGION') then + begin + FoldRanges.StopFoldRange(Line + 1, FoldRegionType); + Result := True; + end; + end; + +var + Line: Integer; + RangeState: TRangeState; + +begin + if FCodeFoldingType <> cftCurlyBracket then Exit; + + for Line := FromLine to ToLine do + begin + // Deal first with Multiline comments (Fold Type 2) + RangeState := TRangeState(GetLineRange(LinesToScan, Line)); + if RangeState in [rsAnsi, rsPasStyle, rsCStyle, rsPwShell] then + begin + if TRangeState(GetLineRange(LinesToScan, Line - 1)) = RangeState then + FoldRanges.NoFoldInfo(Line + 1) + else + FoldRanges.StartFoldRange(Line + 1, 2); + Continue; + end + else + begin + RangeState := TRangeState(GetLineRange(LinesToScan, Line - 1)); + if RangeState in [rsAnsi, rsPasStyle, rsCStyle, rsPwShell] then + begin + FoldRanges.StopFoldRange(Line + 1, 2); + Continue; + end; + end; + + CurLine := LinesToScan[Line]; + + // Skip empty lines + if CurLine = '' then begin + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end; + + // Find Fold regions + if FoldRegion(Line) then + Continue; + + // Find an braces on this line (Fold Type 1) + if not FindBraces(Line) then + FoldRanges.NoFoldInfo(Line + 1); + end; // while Line +end; + +procedure TSynOmniSyn.SetDetectPreprocessor(Value: Boolean); +begin + if Value <> FDetectPreprocessor then + begin + FDetectPreprocessor := Value; + DefHighlightChange(Self); + end; +end; + +class function TSynOmniSyn.GetFriendlyLanguageName: string; +begin + Result := SYNS_FriendlyLangOmni; +end; + +procedure TSynOmniSyn.SetLangName(const Value: string); +begin + FLangName := Value; + if Value = '' then + FLangName := SYNS_FriendlyLangUnknown; +end; + +procedure TSynOmniSyn.SetKeyWords2(const Value: TStrings); +begin + SetKeyWordsCompat(Value, FKeyWords2); +end; + +procedure TSynOmniSyn.SetKeyWords3(const Value: TStrings); +begin + SetKeyWordsCompat(Value, FKeyWords3); +end; + +procedure TSynOmniSyn.SetResWords(const Value: TStrings); +begin + SetKeyWordsCompat(Value, FResWords); +end; + +procedure TSynOmniSyn.SetStringDelim(const Value: TStringDelimiters); +begin + FStringDelim := Value; + FStringDelimChars := []; + if sdSingleQuote in FStringDelim then Include(FStringDelimChars, ''''); + if sdDoubleQuote in FStringDelim then Include(FStringDelimChars, '"'); + if sdApostropheQuote in FStringDelim then Include(FStringDelimChars, '`'); +end; + +procedure TSynOmniSyn.CommentRangeProc; +var + OK: Boolean; +begin + case FLine[Run] of + #0: NullProc; + #10: LFProc; + #13: CRProc; + else + FTokenID := tkComment; + OK := False; + + repeat + case FRange of + rsPasStyle: OK := (FLine[Run] = '}'); + rsStarSemicol: OK := (FLine[Run] = ';'); + rsForth, rsHeller, rsOkuma: OK := (FLine[Run] = ')'); + rsDollarMulti: OK := (FLine[Run] = '$'); + rsHaskell: OK := (FLine[Run] = '-') and (FLine[Run+1] = '}'); + rsSmart: OK := (FLine[Run] = '*') and (FLine[Run+1] = '}'); + rsDollar: OK := (FLine[Run] = '$') and (FLine[Run + 1] = ')'); + rsAnsi: OK := (FLine[Run] = '*') and (FLine[Run + 1] = ')'); + rsD: OK := (FLine[Run] = '+') and (FLine[Run + 1] = '/'); + rsCStyle: OK := (FLine[Run] = '*') and (FLine[Run + 1] = '/'); + rsVLisp: OK := (FLine[Run] = '|') and (FLine[Run + 1] = ';'); + rsCLisp: OK := (FLine[Run] = '|') and (FLine[Run + 1] = '#'); + rsDead: OK := (FLine[Run] = '''') and (FLine[Run + 1] = ''''); + rs2Excl: OK := (FLine[Run] = '!') and (FLine[Run + 1] = '!'); + rsLua: OK := (FLine[Run] = ']') and (FLine[Run + 1] = ']'); + rsPwShell: OK := (FLine[Run] = '#') and (FLine[Run + 1] = '>'); + rsLilypond: OK := (FLine[Run] = '%') and (FLine[Run + 1] = '}'); + rsJCL: OK := (FLine[Run] = '*') and (FLine[Run + 1] = '/') and (FLine[Run + 2] = '/'); + rsHTML: OK := (FLine[Run] = '-') and (FLine[Run + 1] = '-') and (FLine[Run + 2] = '>'); + rsTexInfo: OK := WideSameStr(Copy(FLine, 1, 11), '@end ignore'); + rsAutoIt: OK := (FLine[Run] = '#') and (FLine[Run + 1] = 'c') and (FLine[Run + 2] = 'e'); + end; + if OK then + begin + if FRange in [rsPasStyle, rsDollarMulti, rsForth, rsOkuma, rsHeller, rsStarSemicol] then + Inc(Run) + else + Inc(Run, 2); + if FRange in [rsJCL, rsHTML, rsAutoIt] then + Inc(Run); + if FRange = rsTexInfo then + Inc(Run, 9); + FRange := rsUnKnown; + Break; + end; + Inc(Run); + until IsLineEnd(Run); + end; +end; + +function TSynOmniSyn.IsReservedWord(const AKeyword: string; KeyList: TStrings; + AKWStartWith: Boolean): Boolean; +var + First, Last, I, L, Compare: Integer; + Token: string; + Chr: Char; +begin + Result := False; + if KeyList.Count = 0 then Exit; + First := 0; + Last := KeyList.Count - 1; + while First <= Last do + begin + I := (First + Last) shr 1; + Token := KeyList[i]; + L := Length(Token); + + { token starts with list item and is followed by number } + if AKWStartWith then + begin + Chr := String(Copy(AKeyWord, L + 1, 1) + ' ')[1]; + if FCaseSensitive then + Compare := CompareStr(Token, Copy(AKeyWord, 1, L)) + else + Compare := CompareText(Token, Copy(AKeyWord, 1, L)); + { followed by numbers only (space is added when equal to token ) } + if (Compare = 0) and not CharInSet(Chr, (['0'..'9','-', ' '])) then + Compare := 1; + + end + else + begin + if FCaseSensitive then + Compare := CompareStr(Token, AKeyWord) + else + Compare := CompareText(Token, AKeyWord); + end; + if Compare = 0 then + begin + Result := True; + if AKWStartWith then + Run := Run - Length(AKeyword) + L; + Break; + end else + if Compare < 0 then + First := I + 1 + else + Last := I - 1; + end; +end; + +procedure TSynOmniSyn.SetKeyWordsCompat(FromStrings, ToStrings: TStrings); +var + Str: string; +begin + if (FromStrings <> nil) and (Tostrings <> nil) then + begin + Tostrings.Clear; + ToStrings.BeginUpdate; + for Str in FromStrings do + begin + if FCaseSensitive then + ToStrings.Add(Str) + else + ToStrings.Add(UpperCase(Str)); + end; + ToStrings.EndUpdate; + + DefHighLightChange(nil); + end; +end; + +procedure TSynOmniSyn.HexProc; + + function IsHexChar: Boolean; + begin + case FLine[Run] of + '0'..'9', 'A'..'F', 'a'..'f', 'H', 'h': Result := True; + else + Result := False; + end; + end; + +begin + Inc(Run); + FTokenID := tkHex; + while IsHexChar do + Inc(Run); +end; + +{----------------------------------------------------------------- + Fotran comment and C* comment +------------------------------------------------------------------} +procedure TSynOmniSyn.FortranCommProc; + + function IsFirstChar: Boolean; + var + I: Integer; + begin + Result := True; + for I := Run - 1 downto 0 do + if not CharInSet(FLine[I], [#32, #9]) then + begin + Result := False; + Break; + end; + end; + +begin + if (csFortran in FSingleComments) and (Run=0) {IsFirstChar} or + (csCStar in FSingleComments) and (FLine[Run+1] = '*') then + begin + Inc(Run); + FTokenID := tkComment; + while (FLine[Run] <> #0) do begin + case FLine[Run] of + #10, #13: Break; + end; + Inc(Run); + end; + end + else + begin + FTokenID := tkIdentifier; + IdentProc; + end; +end; + +procedure TSynOmniSyn.REMCommentProc; +begin + if (csBatStyle in FSingleComments) and CharInSet(FLine[Run+1], ['E', 'e']) + and CharInSet(FLine[Run+2], ['M', 'm']) and (FLine[Run+3] <= #32) then + begin + FTokenID := tkComment; + Inc(Run, 3); + while (FLine[Run] <> #0) do begin + case FLine[Run] of + #10, #13: Break; + end; { case } + Inc(Run); + end; { while } + end + else begin + FTokenID := tkIdentifier; + IdentProc; + end; +end; + +procedure TSynOmniSyn.BatCommentProc; +var + myChar: Char; +begin + FTokenID := tkSymbol; + Inc(Run); + if (csBatStyle in FSingleComments) and (FLine[Run] = ':') then + begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end + else + { Ruby symbol :something } + if FRubySymbols and (Run > 1) and IsIdentChar(FLine[Run]) and (FLine[Run-2] = ' ') then + begin + FTokenID := tkLabel; + repeat Inc(Run) until not IsIdentChar(FLine[Run]) or IsLineEnd(Run); +// if not IsLineEnd(Run) then Inc(Run); + end + else + { Ruby symbol :"something" or :'something' } + if FRubySymbols and CharInSet(FLine[Run], ['"', '''']) then + begin + myChar := FLine[Run]; + FTokenID := tkLabel; + repeat Inc(Run) until (FLine[Run] = myChar) or IsLineEnd(Run); + if not IsLineEnd(Run) then Inc(Run); + end + else + if FHasLabel and (Run = 1) and (FLine[Run] <> ':') then + begin + FTokenID := tkLabel; + while IsIdentChar(FLine[Run]) do Inc(Run); + end + else + if FRubySymbols and (Run > 1) and (FLine[Run] = ':') then + Inc(Run); + +end; + +procedure TSynOmniSyn.LabelProc; +begin + { char @ is marked as comment char } + if csByStyle in FSingleComments then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end + { this is part for label } + else + if FHasLabel and (Run = 0) then + begin + Inc(Run); + FTokenID := tkLabel; + while IsIdentChar(FLine[Run]) do Inc(Run); + end + else + if FRubySymbols then + begin + Inc(Run); + FTokenID := tkVariable; + while IsIdentChar(FLine[Run]) do Inc(Run); + end + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; +end; + +procedure TSynOmniSyn.AsteriskProc; +var + IsComm: Boolean; + i: Integer; + + function IsSasComment: Boolean; + var + i: Integer; + begin + Result := True; + for i := Run-1 downto 0 do + if not CharInSet(FLine[i], [#32, #9, ';']) then + begin + Result := False; + Break; + end + else + if FLine[i] = ';' then + Break; + end; + +begin + if (cs2Stars in FSingleComments) and (FLine[Run+1] = '*') then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) or (FLine[Run] = ';') do Inc(Run); + end + else + if csStarSemicol in FComments then + begin + FTokenID := tkComment; + FRange := rsStarSemicol; + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + if csFoxStyle in FSingleComments then + begin + IsComm := True; + if Run > 0 then + for i := Run - 1 downto 0 do + if not CharInSet(FLine[i], [#32, #9]) then + begin + IsComm := False; + Break; + end; + if IsComm then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end + else begin + Inc(Run); + FTokenID := tkSymbol; + end; + end + else + if (csPocoStyle in FSingleComments) and IsSasComment then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) or (FLine[Run] = ';') do Inc(Run); + end + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; +end; + +procedure TSynOmniSyn.PipeProc; +begin + FTokenID := tkSymbol; + Inc(Run); + if (csPipe in FSingleComments) then + begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); + end; +end; + +procedure TSynOmniSyn.MinusProc; +begin + if (csDash in FSingleComments) and (Run = 0) and (FLine[Run+1] = ' ') then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end + else + if (csLua in FComments) and (Copy(FLine, Run+1, 4) = '--[[') then + begin + FTokenID := tkComment; + FRange := rsLua; + Inc(Run, 4); + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + if (csWebFocus in FSingleComments) and (FLine[Run+1] = '*') then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end + else + if (csSQLStyle in FSingleComments) and (FLine[Run+1] = '-') then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) do + begin + Inc(Run); + // PSL support: -- PSL something... + if Copy(FLine, Run-4, 5) = ' psl ' then + Break; + end; + end + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; +end; + +procedure TSynOmniSyn.AmpersandProc; +begin + if (csFoxStyle in FSingleComments) and (FLine[Run+1] = '&') then begin + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end + else begin + Inc(Run); + FTokenID := tkSymbol; + end; +end; + +procedure TSynOmniSyn.PerCentProc; +begin + if (csAutomaton in FSingleComments) and (FLine[Run+1] = '%') then + begin + FTokenID := tkComment; + Inc(Run, 2); + while not IsLineEnd(Run) do Inc(Run); + end + else + if (csLilypond in FComments) and (FLine[Run+1] = '{') then + begin + FTokenID := tkComment; + FRange := rsLilypond; + Inc(Run, 2); + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + if csPerCentStyle in FSingleComments then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; +end; + +procedure TSynOmniSyn.ExclamationProc; +begin + if (cs2Excl in Comments) and (FLine[Run+1] = '!') then + begin + FTokenID := tkComment; + FRange := rs2Excl; + Inc(Run, 2); + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + if (csPCL in FSingleComments) and (FLine[Run+1] = '*') or (csExclStyle in FSingleComments) then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end + else + begin + Inc(Run); + FTokenID := tkSymbol; + end; +end; + +procedure TSynOmniSyn.DoubleQuoteProc; +begin + FTokenID := tkComment; + while not IsLineEnd(Run) do + begin + Inc(Run); + if CharInSet(FLine[Run], ['"', ';']) then + begin + if FLine[Run] = '"' then Inc(Run); + Break; + end; + end; +end; + +procedure TSynOmniSyn.SingleQuoteProc; +begin + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); +end; + +procedure TSynOmniSyn.SymbolProc; +begin + Inc(Run); + FTokenID := tkSymbol; +end; + +procedure TSynOmniSyn.SetSingleComments( + const Value: TSingleLineComments); +begin + FSingleComments := Value; + DefHighLightChange(nil); +end; + +procedure TSynOmniSyn.BackSlashProc; +begin + Inc(Run); + if (csForth in FComments) and (FLine[Run] = ' ') or + (csBackSlashStyle in FSingleComments) then //and ((Run=1) or (FLine[Run-2]=' ')) and (FLine[Run]=' ') then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end + else + FTokenID := tkSymbol; +end; + +procedure TSynOmniSyn.TabKeyProc; +begin + Inc(Run); + if (csTabKey in FSingleComments) then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end + else + FTokenID := tkSpace;; +end; + +procedure TSynOmniSyn.FileNameProc; +var + isQuote: Boolean; +begin + isQuote := (FLine[Run] = '"'); + FTokenID := tkLabel; + repeat + Inc(Run); + if FLine[Run] = '"' then + isQuote := False; + until IsLineEnd(Run) or not isQuote and CharInSet(FLine[Run], [#32, #9]); +end; + +procedure TSynOmniSyn.RestIsCommentProc; +begin + FTokenID := tkComment; + repeat + Inc(Run); + until IsLineEnd(Run); +end; + +function TSynOmniSyn.GetKeyWords(TokenKind: Integer): string; +begin + Result := ''; +end; + +procedure TSynOmniSyn.HTMLCommentProc; +var + myChar: Char; +begin + FTokenID := tkSymbol; + myChar := FLine[Run]; + Inc(Run); + { AngleBracket comment } + if (csAngleBrackets in FSingleComments) and (FLine[Run] = '<') and (FLine[Run+1] = '<') then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end + else + { HTML multiline comment } + if (csHTML in FComments) and (FLine[Run] = '!') and (FLine[Run+1] = '-') then + begin + FTokenID := tkComment; + FRange := rsHTML; + Inc(Run, 2); + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + { PowerShell multiline comment } + if (csPwShell in FComments) and (myChar='<') and (FLine[Run] = '#') then + begin + FTokenID := tkComment; + FRange := rsPwShell; + Inc(Run, 1); + if not IsLineEnd(Run) then + CommentRangeProc; + end + else + {Euklid comment } + if (csEuklid in FSingleComments) and (myChar = '.') and (FLine[Run] = '.') then + begin + FTokenID := tkComment; + while not IsLineEnd(Run) do Inc(Run); + end +end; + +initialization + RegisterPlaceableHighlighter(TSynOmniSyn); +end. + diff --git a/Ext/SynEdit/Source/SynHighlighterPHP.pas b/Ext/SynEdit/Source/SynHighlighterPHP.pas index 6d3da3a..c1a056f 100644 --- a/Ext/SynEdit/Source/SynHighlighterPHP.pas +++ b/Ext/SynEdit/Source/SynHighlighterPHP.pas @@ -1,4 +1,4 @@ -{------------------------------------------------------------------------------- +{------------------------------------------------------------------------------- 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 @@ -13,8 +13,7 @@ mwEdit component suite by Martin Waldenburg and other developers, the Initial Author of this file is Willo van der Merwe. "Heredoc" syntax highlighting implementation by Marko Njezic. -Unicode translation by Ma?l H?rz. -PHP5 keywords added by CodehunterWorks. +Unicode translation by Maël Hörz. All Rights Reserved. Contributors to the SynEdit and mwEdit projects are listed in the @@ -29,13 +28,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterPHP.pas,v 1.22.3.0 2012/09/11 16:25:00 codehunterworks Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a PHP syntax highlighter for SynEdit) @@ -54,19 +46,22 @@ interface uses Graphics, - Registry, + System.Win.Registry, SynEditTypes, SynEditHighlighter, - SynUnicode, SysUtils, - Classes; + SynUnicode, + Classes, +//++ CodeFolding + SynEditCodeFolding; +//++ CodeFolding type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, - tkNumber, tkSpace, tkString, tkSymbol, tkUnknown, tkVariable); + TtkTokenKind = (tkSymbol, tkKey, tkComment, tkDocument, tkIdentifier, tkNull, + tkNumber, tkSpace, tkString, tkUnknown, tkVariable); {$IFDEF SYN_HEREDOC} - TRangeState = (rsUnknown, rsString39, rsString34, rsComment, rsVarExpansion, + TRangeState = (rsUnKnown, rsString39, rsString34, rsString96, rsComment, rsDocument, rsVarExpansion, rsHeredoc); TRangePointer = packed record @@ -75,42 +70,39 @@ interface False: (Range: Byte; Length: Byte; Checksum: Word); end; {$ELSE} - TRangeState = (rsUnknown, rsString39, rsString34, rsComment, rsVarExpansion); + TRangeState = (rsUnKnown, rsString39, rsString34, rsString96, rsComment, rsDocument, rsVarExpansion); {$ENDIF} PIdentFuncTableFunc = ^TIdentFuncTableFunc; TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; type - TSynPHPSyn = class(TSynCustomHighlighter) +// TSynPHPSyn = class(TSynCustomHighlighter) + TSynPHPSyn = class(TSynCustomCodeFoldingHighlighter) private - FRange: TRangeState; + fRange: TRangeState; {$IFDEF SYN_HEREDOC} - FHeredocLength: Byte; - FHeredocChecksum: Word; + fHeredocLength: Byte; + fHeredocChecksum: Word; {$ENDIF} FTokenID: TtkTokenKind; - FIdentFuncTable: array[0..255] of TIdentFuncTableFunc; - FCommentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FVariableAttri: TSynHighlighterAttributes; + fIdentFuncTable: array[0..438] of TIdentFuncTableFunc; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fVariableAttri: TSynHighlighterAttributes; + fDocumentAttri: TSynHighlighterAttributes; function AltFunc(Index: Integer): TtkTokenKind; function KeyWordFunc(Index: Integer): TtkTokenKind; function HashKey(Str: PWideChar): Cardinal; function IdentKind(MayBe: PWideChar): TtkTokenKind; procedure InitIdent; procedure AndSymbolProc; - procedure AtSymbolProc; - procedure BraceCloseProc; - procedure BraceOpenProc; procedure CRProc; - procedure ColonProc; - procedure CommaProc; procedure EqualProc; procedure GreaterProc; procedure IdentProc; @@ -123,36 +115,30 @@ TSynPHPSyn = class(TSynCustomHighlighter) procedure NumberProc; procedure OrSymbolProc; procedure PlusProc; - procedure PointProc; procedure PoundProc; - procedure QuestionProc; procedure RemainderSymbolProc; - procedure RoundCloseProc; - procedure RoundOpenProc; - procedure SemiColonProc; + procedure SymbolProc; procedure SlashProc; procedure SpaceProc; - procedure SquareCloseProc; - procedure SquareOpenProc; procedure StringProc; procedure VarExpansionProc; - procedure TildeProc; procedure VariableProc; procedure XOrSymbolProc; procedure UnknownProc; procedure AnsiCProc; procedure String39Proc; procedure String34Proc; + procedure String96Proc; {$IFDEF SYN_HEREDOC} procedure HeredocProc; {$ENDIF} protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; procedure NextProcedure; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; @@ -162,61 +148,90 @@ TSynPHPSyn = class(TSynCustomHighlighter) function GetTokenID: TtkTokenKind; function GetTokenAttribute: TSynHighlighterAttributes; override; function GetTokenKind: Integer; override; + function IsIdentChar(AChar: WideChar): Boolean; override; + function IsWordBreakChar(AChar: WideChar): Boolean; override; procedure Next; override; procedure SetRange(Value: Pointer); override; procedure ResetRange; override; +//++ CodeFolding + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; +//-- CodeFolding published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; - property VariableAttri: TSynHighlighterAttributes read FVariableAttri - write FVariableAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property DocumentAttri: TSynHighlighterAttributes read fDocumentAttri + write fDocumentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; + property VariableAttri: TSynHighlighterAttributes read fVariableAttri + write fVariableAttri; end; implementation uses SynEditMiscProcs, - SynEditStrConst; + SynEditStrConst, + Windows; const - KeyWords: array[0..73] of UnicodeString = ( - '__class__', '__dir__', '__file__', '__function__', '__halt_compiler', - '__line__', '__method__', '__namespace__', 'abstract', 'and', 'array', 'as', - 'break', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare', - 'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', - 'endfor', 'endforeach', 'endif', 'endswitch', 'endwhile', 'eval', 'exit', - 'extends', 'false', 'final', 'for', 'foreach', 'function', 'global', 'goto', - 'if', 'implements', 'include', 'include_once', 'instanceof', 'interface', - 'isset', 'list', 'namespace', 'new', 'null', 'old_function', 'or', 'print', - 'private', 'protected', 'public', 'require', 'require_once', 'return', - 'static', 'switch', 'synedit', 'throw', 'true', 'try', 'unset', 'use', - 'var', 'while', 'xor' + +{ expanded keyword list } + KeyWords: array[0..110] of string = ( + '__autoload', '__call', '__callstatic', '__class__', '__clone', + '__construct', '__debuginfo', '__destruct', '__dir__', '__file__', + '__function__', '__get', '__halt_compiler', '__invoke', '__isset', + '__line__', '__method__', '__namespace__', '__set', '__set_state', + '__sleep', '__tostring', '__trait__', '__unset', '__wakeup', 'abstract', + 'and', 'array', 'as', 'binary', 'bool', 'boolean', 'break', 'callable', + 'case', 'catch', 'cfunction', 'class', 'clone', 'const', 'continue', + 'declare', 'default', 'die', 'do', 'double', 'echo', 'else', 'elseif', + 'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch', + 'endwhile', 'eval', 'exception', 'exit', 'extends', 'false', 'final', + 'finally', 'float', 'for', 'foreach', 'function', 'global', 'goto', 'if', + 'implements', 'include', 'include_once', 'instanceof', 'insteadof', 'int', + 'integer', 'interface', 'isset', 'list', 'mixed', 'namespace', 'new', + 'null', 'object', 'old_function', 'or', 'parent', 'print', 'private', + 'protected', 'public', 'real', 'require', 'require_once', 'return', 'self', + 'static', 'string', 'switch', 'throw', 'trait', 'true', 'try', 'unset', + 'use', 'var', 'void', 'while', 'xor', 'yield' ); - KeyIndices: array[0..222] of Integer = ( - -1, -1, 69, -1, -1, 1, 19, -1, -1, -1, -1, -1, -1, 35, -1, 17, -1, -1, 53, - 6, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, - 52, 36, -1, -1, 66, -1, 62, -1, 38, 15, 44, -1, -1, -1, -1, 32, -1, -1, 24, - 48, -1, -1, 56, 45, 65, 40, -1, -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, - -1, 60, -1, -1, -1, -1, -1, 31, 11, -1, 33, 20, 49, -1, -1, -1, 21, -1, -1, - -1, 54, -1, -1, -1, -1, -1, 29, -1, 64, -1, 23, -1, -1, 14, -1, -1, 42, -1, - -1, 0, 25, 50, -1, 58, 4, 27, -1, -1, 7, -1, -1, -1, -1, -1, 63, -1, 34, -1, - -1, -1, -1, -1, -1, -1, -1, 28, 13, 47, 51, -1, -1, 2, -1, 37, -1, -1, 71, - 3, -1, 30, -1, 43, -1, -1, -1, -1, 57, 8, -1, -1, -1, -1, 41, 10, -1, 12, - 72, -1, -1, -1, -1, -1, -1, 73, -1, -1, -1, -1, 5, -1, 22, -1, -1, -1, 70, - 9, 18, -1, -1, -1, -1, -1, 59, 26, -1, -1, 16, -1, 68, -1, 61, -1, -1, -1, - 39, -1, -1, -1, -1, -1, -1, -1, -1, 55, -1, -1, -1 + KeyIndices: array[0..438] of Integer = ( + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, + 25, -1, 110, -1, -1, 72, 88, -1, 67, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, + -1, 38, -1, 80, -1, -1, -1, 11, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, 102, + 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 104, -1, 40, -1, -1, -1, -1, -1, -1, -1, 76, -1, 101, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, 98, -1, -1, 64, -1, + -1, -1, 37, -1, 29, -1, -1, -1, 36, 60, -1, -1, -1, -1, 54, -1, -1, -1, -1, + -1, -1, -1, -1, 27, -1, 32, -1, 51, 94, -1, 73, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 79, -1, -1, -1, 10, -1, -1, -1, -1, -1, 96, -1, -1, 9, -1, 100, -1, + -1, -1, -1, -1, 57, -1, -1, -1, -1, -1, -1, 85, -1, -1, -1, 39, -1, -1, 109, + 0, 44, -1, -1, -1, 78, -1, -1, -1, 65, 19, -1, 81, -1, 46, 1, 6, -1, 69, -1, + 14, -1, -1, 35, -1, 71, -1, -1, -1, 33, -1, -1, -1, -1, -1, -1, -1, -1, 50, + -1, -1, -1, -1, -1, 4, -1, 20, 8, -1, -1, 47, 7, -1, 68, -1, 5, 49, -1, -1, + -1, 93, -1, -1, 89, -1, -1, -1, 34, -1, 59, -1, 86, -1, -1, 103, -1, -1, -1, + -1, -1, 26, -1, -1, -1, -1, -1, 23, -1, 83, 66, 58, -1, -1, -1, 63, -1, 45, + -1, -1, -1, -1, -1, -1, -1, 70, -1, -1, 105, -1, -1, 62, -1, -1, -1, -1, -1, + -1, 42, 82, 24, 30, -1, -1, -1, 97, -1, -1, -1, 17, -1, 74, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 106, -1, 22, 3, -1, -1, -1, 90, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 15, -1, -1, -1, -1, 41, -1, 16, -1, -1, -1, -1, + -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, 77, -1, 84, -1, -1, 92, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 18, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 13, -1, 48, 12, -1, 28, -1, -1, -1, -1, -1, -1, 21, -1, 95, 108, 91, -1, -1, + -1, -1, -1, 99, -1, -1, -1, -1, -1, 55, -1, -1, 107, 56, -1, -1, -1, -1, -1, + 87 ); {$Q-} @@ -225,36 +240,37 @@ function TSynPHPSyn.HashKey(Str: PWideChar): Cardinal; Result := 0; while IsIdentChar(Str^) do begin - Result := Result * 252 + Ord(Str^) * 595; + Result := Result * 155 + Ord(Str^) * 90; Inc(Str); end; - Result := Result mod 223; - FStringLen := Str - FToIdent; -end;{$Q+} + Result := Result mod 439; + fStringLen := Str - fToIdent; +end; +{$Q+} function TSynPHPSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; procedure TSynPHPSyn.InitIdent; var - i: Integer; + I: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; + for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if KeyIndices[I] = -1 then + fIdentFuncTable[I] := AltFunc; - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if @FIdentFuncTable[i] = nil then - FIdentFuncTable[i] := KeyWordFunc; + for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if @fIdentFuncTable[I] = nil then + fIdentFuncTable[I] := KeyWordFunc; end; function TSynPHPSyn.AltFunc(Index: Integer): TtkTokenKind; @@ -264,276 +280,193 @@ function TSynPHPSyn.AltFunc(Index: Integer): TtkTokenKind; function TSynPHPSyn.KeyWordFunc(Index: Integer): TtkTokenKind; begin - if IsCurrentToken(KeyWords[Index]) then begin - Result := tkKey; - end else begin - Result := tkIdentifier; - end; + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier end; constructor TSynPHPSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := False; - - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); - FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); - AddAttribute(FVariableAttri); + fCaseSensitive := False; + + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + AddAttribute(fCommentAttri); + fDocumentAttri := TSynHighlighterAttributes.Create(SYNS_AttrDocumentation, SYNS_FriendlyAttrDocumentation); + fDocumentAttri.Style := [fsItalic]; + AddAttribute(fDocumentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); + fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); + AddAttribute(fVariableAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FDefaultFilter := SYNS_FilterPHP; - FRange := rsUnknown; + fDefaultFilter := SYNS_FilterPHP; + fRange := rsUnknown; end; procedure TSynPHPSyn.AndSymbolProc; begin - case FLine[Run + 1] of - '=': {and assign} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; - '&': {conditional and} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; - else {and} - begin - Inc(Run); - FTokenID := tkSymbol; + begin + fTokenID := tkSymbol; + case FLine[Run + 1] of + '=': Inc(Run, 2); {and assign} + '&': Inc(Run, 2); {conditional and} + else {and} + Inc(Run); end; end; end; -procedure TSynPHPSyn.AtSymbolProc; -begin - Inc(Run); - FTokenID := tkSymbol; -end; - -procedure TSynPHPSyn.BraceCloseProc; -begin - Inc(Run); - FTokenID := tkSymbol; -end; - -procedure TSynPHPSyn.BraceOpenProc; -begin - Inc(Run); - FTokenID := tkSymbol; -end; - procedure TSynPHPSyn.CRProc; begin - FTokenID := tkSpace; - case FLine[Run + 1] of + fTokenID := tkSpace; + Case FLine[Run + 1] of #10: Inc(Run, 2); - else - Inc(Run); + else Inc(Run); end; end; -procedure TSynPHPSyn.ColonProc; -begin - Inc(Run); {colon - conditional} - FTokenID := tkSymbol; -end; - -procedure TSynPHPSyn.CommaProc; -begin - Inc(Run); - FTokenID := tkSymbol; -end; - procedure TSynPHPSyn.EqualProc; begin + fTokenID := tkSymbol; case FLine[Run + 1] of - '=': {logical equal} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; - '>': {Hash operator} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; + '=': Inc(Run, 2); {logical equal} + '>': Inc(Run, 2); {Hash operator} else {assign} - begin Inc(Run); - FTokenID := tkSymbol; - end; end; end; procedure TSynPHPSyn.GreaterProc; begin + fTokenID := tkSymbol; case FLine[Run + 1] of - '=': {greater than or equal to} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; - '>': - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; + '=': Inc(Run, 2); {greater than or equal to} + '>': Inc(Run, 2); else {greater than} - begin - Inc(Run); - FTokenID := tkSymbol; - end; + Inc(Run); end; end; procedure TSynPHPSyn.IdentProc; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do Inc(Run); + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynPHPSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynPHPSyn.LowerProc; {$IFDEF SYN_HEREDOC} var - i, Len : Integer; + I, Len: Integer; {$ENDIF} begin - case FLine[Run + 1] of - '=': {less than or equal to} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; - '<': - begin - FTokenID := tkSymbol; -{$IFDEF SYN_HEREDOC} - if (FLine[Run + 2] = '<') and IsIdentChar(FLine[Run + 3]) then + case FLine[Run + 1] of + '=': {less than or equal to} begin - Inc(Run, 3); + Inc(Run, 2); + fTokenID := tkSymbol; + end; + '<': + begin + fTokenID := tkSymbol; +{$IFDEF SYN_HEREDOC} + if (FLine[Run + 2] = '<') and IsIdentChar(FLine[Run + 3]) then + begin + Inc(Run, 3); - i := Run; - while IsIdentChar(FLine[i]) do Inc(i); - Len := i - Run; + I := Run; + while IsIdentChar(FLine[I]) do Inc(I); + Len := I - Run; - if Len > 255 then - begin - FTokenID := tkUnknown; - Exit; - end; + if Len > 255 then + begin + fTokenID := tkUnknown; + Exit; + end; - FRange := rsHeredoc; - FHeredocLength := Len; - FHeredocChecksum := CalcFCS(FLine[Run], Len); + fRange := rsHeredoc; + fHeredocLength := Len; + fHeredocChecksum := CalcFCS(FLine[Run], Len); - Inc(Run, Len); - FTokenID := tkString; - end - else + Inc(Run, Len); + fTokenID := tkString; + end + else {$ENDIF} - if FLine[Run + 2] = '=' then {shift left assign} - begin - Inc(Run, 3) - end - else {shift left} - begin - Inc(Run, 2); + if FLine[Run + 2] = '=' then {shift left assign} + begin + Inc(Run, 3) + end + else {shift left} + begin + Inc(Run, 2); + end; end; + else {less than} + begin + Inc(Run); + fTokenID := tkSymbol; end; - else {less than} - begin - Inc(Run); - FTokenID := tkSymbol; end; - end; end; procedure TSynPHPSyn.MinusProc; begin - case FLine[Run + 1] of - '=': {subtract assign} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; - '-': {decrement} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; - '>': {Class operator} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; - else {subtract} - begin + fTokenID := tkSymbol; + case FLine[Run + 1] of + '=': Inc(Run, 2); {subtract assign} + '-': Inc(Run, 2); {decrement} + '>': Inc(Run, 2); {Class operator} + else {subtract} Inc(Run); - FTokenID := tkSymbol; end; - end; end; procedure TSynPHPSyn.MultiplyProc; begin + fTokenID := tkSymbol; case FLine[Run + 1] of - '=': {multiply assign} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; + '=': Inc(Run, 2); {multiply assign} else {multiply} - begin - Inc(Run); - FTokenID := tkSymbol; - end; + Inc(Run); end; end; procedure TSynPHPSyn.NotSymbolProc; begin + fTokenID := tkSymbol; case FLine[Run + 1] of - '=': {not equal} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; + '=': Inc(Run, 2); {not equal} else {logical complement} - begin - Inc(Run); - FTokenID := tkSymbol; - end; + Inc(Run); end; end; procedure TSynPHPSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -541,7 +474,7 @@ procedure TSynPHPSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', '-', 'l', 'L', 'x', 'X', 'A'..'F', 'a'..'f': Result := True; else @@ -551,13 +484,12 @@ procedure TSynPHPSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of '.': - if FLine[Run + 1] = '.' then - Break; + if FLine[Run + 1] = '.' then Break; end; Inc(Run); end; @@ -565,164 +497,228 @@ procedure TSynPHPSyn.NumberProc; procedure TSynPHPSyn.OrSymbolProc; begin + fTokenID := tkSymbol; case FLine[Run + 1] of - '=': {inclusive or assign} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; - '|': {conditional or} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; + '=': Inc(Run, 2); {inclusive or assign} + '|': Inc(Run, 2); {conditional or} else {inclusive or} - begin - Inc(Run); - FTokenID := tkSymbol; - end; + Inc(Run); end; end; procedure TSynPHPSyn.PlusProc; begin + fTokenID := tkSymbol; case FLine[Run + 1] of - '=': {add assign} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; - '+': {increment} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; + '=': Inc(Run, 2); {add assign} + '|': Inc(Run, 2); {increment} else {add} - begin - Inc(Run); - FTokenID := tkSymbol; - end; + Inc(Run); end; end; -procedure TSynPHPSyn.PointProc; -begin - Inc(Run); {point} - FTokenID := tkSymbol; -end; - procedure TSynPHPSyn.PoundProc; begin repeat Inc(Run); until IsLineEnd(Run); - FTokenID := tkComment; -end; - -procedure TSynPHPSyn.QuestionProc; -begin - FTokenID := tkSymbol; {question mark - conditional} - Inc(Run); + fTokenID := tkComment; end; procedure TSynPHPSyn.RemainderSymbolProc; begin + fTokenID := tkSymbol; case FLine[Run + 1] of - '=': {remainder assign} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; + '=': Inc(Run, 2); {remainder assign} else {remainder} - begin - Inc(Run); - FTokenID := tkSymbol; - end; + Inc(Run); end; end; -procedure TSynPHPSyn.RoundCloseProc; +procedure TSynPHPSyn.SymbolProc; begin Inc(Run); FTokenID := tkSymbol; end; -procedure TSynPHPSyn.RoundOpenProc; -begin - Inc(Run); - FTokenID := tkSymbol; -end; +//-- CodeFolding +procedure TSynPHPSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine, ToLine: Integer); +var + CurLine: string; + Line: Integer; + + function LineHasChar(Line: Integer; character: char; + StartCol: Integer): Boolean; // faster than Pos! + var + I: Integer; + begin + Result := False; + for I := StartCol to Length(CurLine) do begin + if CurLine[I] = character then begin + // Char must have proper highlighting (ignore stuff inside comments...) + if GetHighlighterAttriAtRowCol(LinesToScan, Line, I) <> fCommentAttri then begin + Result := True; + Break; + end; + end; + end; + end; + + function FindBraces(Line: Integer): Boolean; + var + Col: Integer; + begin + Result := False; + + for Col := 1 to Length(CurLine) do + begin + // We've found a starting character + if CurLine[col] = '{' then + begin + // Char must have proper highlighting (ignore stuff inside comments...) + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> fCommentAttri then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, '}', col + 1) then begin + FoldRanges.StartFoldRange(Line + 1, 1); + Result := True; + end; + // Skip until a newline + Break; + end; + end else if CurLine[col] = '}' then + begin + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> fCommentAttri then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, '{', col + 1) then begin + FoldRanges.StopFoldRange(Line + 1, 1); + Result := True; + end; + // Skip until a newline + Break; + end; + end; + end; // for Col + end; + + function FoldRegion(Line: Integer): Boolean; + var + S: string; + begin + Result := False; + S := TrimLeft(CurLine); + if Uppercase(Copy(S, 1, 9)) = '//#REGION' then + begin + FoldRanges.StartFoldRange(Line + 1, FoldRegionType); + Result := True; + end + else if Uppercase(Copy(S, 1, 12)) = '//#ENDREGION' then + begin + FoldRanges.StopFoldRange(Line + 1, FoldRegionType); + Result := True; + end; + end; -procedure TSynPHPSyn.SemiColonProc; begin - Inc(Run); {semicolon} - FTokenID := tkSymbol; + for Line := FromLine to ToLine do + begin + // Deal first with Multiline comments (Fold Type 2) + if TRangeState(GetLineRange(LinesToScan, Line)) in [rsComment, rsDocument] then + begin + if not (TRangeState(GetLineRange(LinesToScan, Line - 1)) in [rsComment, rsDocument]) then + FoldRanges.StartFoldRange(Line + 1, 2) + else + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end + else if TRangeState(GetLineRange(LinesToScan, Line - 1)) in [rsComment, rsDocument] then + begin + FoldRanges.StopFoldRange(Line + 1, 2); + Continue; + end; + + CurLine := LinesToScan[Line]; + + // Skip empty lines + if CurLine = '' then begin + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end; + + // Find Fold regions + if FoldRegion(Line) then + Continue; + + // Find an braces on this line (Fold Type 1) + if not FindBraces(Line) then + FoldRanges.NoFoldInfo(Line + 1); + end; // while Line end; +//-- CodeFolding procedure TSynPHPSyn.SlashProc; begin - case FLine[Run + 1] of - '/': {c++ style comments} - begin - Inc(Run, 2); - FTokenID := tkComment; - while not IsLineEnd(Run) do - Inc(Run); - end; - '*': - begin - FRange := rsComment; - Inc(Run); - FTokenID := tkComment; {c style comment} - - Inc(Run); - while not IsLineEnd(Run) do - if FLine[Run] = '*' then + case FLine[Run + 1] of + '/': {c++ style comments} + begin + Inc(Run, 2); + fTokenID := tkComment; + while not IsLineEnd(Run) do + Inc(Run); + end; + '*': + begin + if (fLine[Run+2] = '*') and (fLine[Run+3] <> '/') then {documentation comment} + begin + fRange := rsDocument; + fTokenID := tkDocument; + Inc(Run); + end + else {c style comment} begin - if FLine[Run + 1] = '/' then + fRange := rsComment; + fTokenID := tkComment; + Inc(Run); + end; + + Inc(Run); + while not IsLineEnd(Run) do + if fLine[Run] = '*' then begin - FRange := rsUnknown; - Inc(Run, 2); - Break; + if fLine[Run + 1] = '/' then + begin + fRange := rsUnKnown; + Inc(Run, 2); + Break; + end + else + Inc(Run) end else - Inc(Run) - end - else - Inc(Run); - end; - '=': {division assign} + Inc(Run); + end; + '=': {division assign} + begin + Inc(Run, 2); + fTokenID := tkSymbol; + end; + else {division} begin - Inc(Run, 2); - FTokenID := tkSymbol; + Inc(Run); + fTokenID := tkSymbol; end; - else {division} - begin - Inc(Run); - FTokenID := tkSymbol; end; - end; end; procedure TSynPHPSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; -procedure TSynPHPSyn.SquareCloseProc; -begin - Inc(Run); - FTokenID := tkSymbol; -end; - -procedure TSynPHPSyn.SquareOpenProc; -begin - Inc(Run); - FTokenID := tkSymbol; -end; - procedure TSynPHPSyn.StringProc; function IsEscaped: Boolean; @@ -738,16 +734,19 @@ procedure TSynPHPSyn.StringProc; var iCloseChar: WideChar; begin - if IsLineEnd(Run) and (FTokenPos = Run) then + if IsLineEnd(Run) and (fTokenPos = Run) then begin NextProcedure; Exit; end; - FTokenID := tkString; - if FRange = rsString39 then - iCloseChar := #39 + fTokenID := tkString; + case fRange of + rsString39: iCloseChar := #39; + rsString34: iCloseChar := #34; + rsString96: iCloseChar := '`'; else - iCloseChar := #34; + iCloseChar := #0; + end; while not IsLineEnd(Run) do begin if (FLine[Run] = iCloseChar) and not IsEscaped then @@ -759,8 +758,8 @@ procedure TSynPHPSyn.StringProc; Dec(Run); if not IsEscaped then begin - { break the token to process the variable } - FRange := rsVarExpansion; + { Break the token to process the variable } + fRange := rsVarExpansion; Exit; end else if FLine[Run] = '{' then @@ -769,7 +768,7 @@ procedure TSynPHPSyn.StringProc; Inc(Run); end; if (FLine[Run] = iCloseChar) then - FRange := rsUnknown; + fRange := rsUnKnown; if not IsLineEnd(Run) then Inc(Run); end; @@ -782,7 +781,7 @@ procedure TSynPHPSyn.VarExpansionProc; iOpenBrackets: Integer; iTempRun: Integer; begin - FRange := rsString34; { var expansion only occurs in double quoted strings } + fRange := rsString34; { var expansion only occurs in double quoted strings } FTokenID := tkVariable; if FLine[Run] = '{' then begin @@ -836,11 +835,11 @@ procedure TSynPHPSyn.VarExpansionProc; Inc(iTempRun); while not IsLineEnd(iTempRun) and (FLine[iTempRun] <> #39) do Inc(iTempRun); - if (FLine[iTempRun] = #39) and (FLine[iTempRun + 1 ] = ']') then + if (FLine[iTempRun] = #39) and (fLine[iTempRun +1 ] = ']') then begin Inc(iTempRun, 2); Run := iTempRun; - continue; + Continue; end else Break; @@ -873,44 +872,58 @@ procedure TSynPHPSyn.VarExpansionProc; end; end; -procedure TSynPHPSyn.TildeProc; -begin - Inc(Run); {bitwise complement} - FTokenID := tkSymbol; -end; - procedure TSynPHPSyn.VariableProc; begin - FTokenID := tkVariable; - Inc(Run); - while IsIdentChar(FLine[Run]) do Inc(Run); +{begin} + if IsIdentChar(fLine[Run+1]) then + begin + Inc(Run); + { checking function name } + if fLine[Run-1] = '@' then + begin + fTokenID := IdentKind((fLine + Run)); + { isn't function, must be variable } + if FTokenID = tkIdentifier then + fTokenID := tkVariable; + end + { rest are variables } + else + fTokenID := tkVariable; + while IsIdentChar(fLine[Run]) do + begin + Inc(Run); + end; + end + else + begin + fTokenID := tkSymbol; + Inc(Run); + end; +{end} end; procedure TSynPHPSyn.XOrSymbolProc; begin + fTokenID := tkSymbol; case FLine[Run + 1] of - '=': {xor assign} - begin - Inc(Run, 2); - FTokenID := tkSymbol; - end; + '=': Inc(Run, 2); {xor assign} else {xor} - begin - Inc(Run); - FTokenID := tkSymbol; - end; + Inc(Run); end; end; procedure TSynPHPSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynPHPSyn.AnsiCProc; begin - FTokenID := tkComment; + if fRange = rsComment then + fTokenID := tkComment + else + fTokenID := tkDocument; case FLine[Run] of #0: begin @@ -932,10 +945,10 @@ procedure TSynPHPSyn.AnsiCProc; while not IsLineEnd(Run) do if FLine[Run] = '*' then begin - if FLine[Run + 1] = '/' then + if fLine[Run + 1] = '/' then begin Inc(Run, 2); - FRange := rsUnknown; + fRange := rsUnKnown; Break; end else @@ -947,14 +960,14 @@ procedure TSynPHPSyn.AnsiCProc; procedure TSynPHPSyn.String39Proc; begin - FRange := rsString39; + fRange := rsString39; Inc( Run ); StringProc; end; procedure TSynPHPSyn.String34Proc; begin - FRange := rsString34; + fRange := rsString34; Inc( Run ); StringProc; end; @@ -976,39 +989,39 @@ procedure TSynPHPSyn.HeredocProc; end; var - i: Integer; + I: Integer; begin - if IsLineEnd(Run) and (FTokenPos = Run) then + if IsLineEnd(Run) and (fTokenPos = Run) then begin NextProcedure; Exit; end; - FTokenID := tkString; + fTokenID := tkString; if Run = 0 then begin - i := 0; + I := 0; - while not (IsLineEnd(FLine[i]) or (FLine[i] = ';')) do + while not (IsLineEnd(FLine[I]) or (FLine[I] = ';')) do begin - if i > FHeredocLength then + if I > fHeredocLength then begin SkipToEOL; Exit; end; - Inc(i); + Inc(I); end; - if i <> FHeredocLength then + if I <> fHeredocLength then begin SkipToEOL; Exit; end; - if (CalcFCS(FLine[0], i) = FHeredocChecksum) then + if (CalcFCS(FLine[0], I) = fHeredocChecksum) then begin - FRange := rsUnknown; - Run := i; + fRange := rsUnknown; + Run := I; Exit; end; end; @@ -1019,9 +1032,9 @@ procedure TSynPHPSyn.HeredocProc; procedure TSynPHPSyn.Next; begin - FTokenPos := Run; - case FRange of - rsComment: AnsiCProc; + fTokenPos := Run; + case fRange of + rsComment, rsDocument: AnsiCProc; rsString39, rsString34: StringProc; rsVarExpansion: VarExpansionProc; {$IFDEF SYN_HEREDOC} @@ -1029,7 +1042,7 @@ procedure TSynPHPSyn.Next; {$ENDIF} else begin - FRange := rsUnknown; + fRange := rsUnknown; NextProcedure; end; end; @@ -1042,40 +1055,29 @@ procedure TSynPHPSyn.Next; procedure TSynPHPSyn.NextProcedure; begin - case FLine[Run] of + case fLine[Run] of '&': AndSymbolProc; #39: String39Proc; // single quote - '@': AtSymbolProc; - '}': BraceCloseProc; - '{': BraceOpenProc; + #0: NullProc; + #10: LFProc; #13: CRProc; - ':': ColonProc; - ',': CommaProc; '=': EqualProc; '>': GreaterProc; 'A'..'Z', 'a'..'z', '_': IdentProc; - #10: LFProc; '<': LowerProc; '-': MinusProc; '*': MultiplyProc; '!': NotSymbolProc; - #0: NullProc; '0'..'9': NumberProc; '|': OrSymbolProc; '+': PlusProc; - '.': PointProc; '#': PoundProc; - '?': QuestionProc; '%': RemainderSymbolProc; - ')': RoundCloseProc; - '(': RoundOpenProc; - ';': SemiColonProc; + '(', ')', '{', '}', '[', ']', '@', ':', ',', '.', '\', '?', '~', ';': SymbolProc; '/': SlashProc; #1..#9, #11, #12, #14..#32: SpaceProc; - ']': SquareCloseProc; - '[': SquareOpenProc; #34: String34Proc; // double quote - '~': TildeProc; + '`': String96Proc; '$': VariableProc; '^': XOrSymbolProc; else UnknownProc; @@ -1085,12 +1087,12 @@ procedure TSynPHPSyn.NextProcedure; function TSynPHPSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -1098,7 +1100,7 @@ function TSynPHPSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribut function TSynPHPSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynPHPSyn.GetRange: Pointer; @@ -1108,52 +1110,53 @@ function TSynPHPSyn.GetRange: Pointer; {$ENDIF} begin {$IFDEF SYN_HEREDOC} - RangePointer.Range := Ord(FRange); + RangePointer.Range := Ord(fRange); RangePointer.Length := 0; RangePointer.Checksum := 0; - if FRange = rsHeredoc then + if fRange = rsHeredoc then begin - RangePointer.Length := FHeredocLength; - RangePointer.Checksum := FHeredocChecksum; + RangePointer.Length := fHeredocLength; + RangePointer.Checksum := fHeredocChecksum; end; Result := RangePointer.Ptr; {$ELSE} - Result := Pointer(FRange); + Result := Pointer(fRange); {$ENDIF} end; function TSynPHPSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynPHPSyn.GetTokenAttribute: TSynHighlighterAttributes; begin case GetTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkVariable: Result := FVariableAttri; - tkUnknown: Result := FIdentifierAttri; + tkComment: Result := fCommentAttri; + tkDocument: Result := fDocumentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkVariable: Result := fVariableAttri; + tkUnknown: Result := fIdentifierAttri; else Result := nil; end; end; function TSynPHPSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; procedure TSynPHPSyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; {$IFDEF SYN_HEREDOC} - FHeredocLength := 0; - FHeredocChecksum := 0; + fHeredocLength := 0; + fHeredocChecksum := 0; {$ENDIF} end; @@ -1165,22 +1168,22 @@ procedure TSynPHPSyn.SetRange(Value: Pointer); begin {$IFDEF SYN_HEREDOC} RangePointer := TRangePointer(Value); - FRange := TRangeState(RangePointer.Range); - FHeredocLength := 0; - FHeredocChecksum := 0; - if FRange = rsHeredoc then + fRange := TRangeState(RangePointer.Range); + fHeredocLength := 0; + fHeredocChecksum := 0; + if fRange = rsHeredoc then begin - FHeredocLength := RangePointer.Length; - FHeredocChecksum := RangePointer.Checksum; + fHeredocLength := RangePointer.Length; + fHeredocChecksum := RangePointer.Checksum; end; {$ELSE} - FRange := TRangeState(Value); + fRange := TRangeState(Value); {$ENDIF} end; function TSynPHPSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterPHP; + Result := fDefaultFilter <> SYNS_FilterPHP; end; class function TSynPHPSyn.GetLanguageName: string; @@ -1188,7 +1191,7 @@ class function TSynPHPSyn.GetLanguageName: string; Result := SYNS_LangPHP; end; -function TSynPHPSyn.GetSampleSource: UnicodeString; +function TSynPHPSyn.GetSampleSource: string; begin Result := '// Syntax highlighting'#13#10+ 'function printNumber()'#13#10+ @@ -1205,13 +1208,35 @@ function TSynPHPSyn.GetSampleSource: UnicodeString; end; -class function TSynPHPSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynPHPSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangPHP; end; +function TSynPHPSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + Result := IsCharAlphaNumeric(AChar) or CharInSet(AChar, ['_', '$']); +end; + +function TSynPHPSyn.IsWordBreakChar(AChar: WideChar): Boolean; +begin + case AChar of + #0..#32, '.', ',', ';', ':', '"', '''', '+', '`', '-', '^', '!', '?', '&', + '@', '§', '%', '#', '~', '[', ']', '(', ')', '{', '}', '<', '>', + '=', '*', '/', '\', '|': + Result := True; + else + Result := False; + end; +end; + +procedure TSynPHPSyn.String96Proc; +begin + fRange := rsString96; + Inc( Run ); + StringProc; +end; + initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynPHPSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterPas.pas b/Ext/SynEdit/Source/SynHighlighterPas.pas index 740b058..c66a087 100644 --- a/Ext/SynEdit/Source/SynHighlighterPas.pas +++ b/Ext/SynEdit/Source/SynHighlighterPas.pas @@ -28,13 +28,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterPas.pas,v 1.27.2.10 2009/02/23 15:43:50 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a Pascal/Delphi syntax highlighter for SynEdit) @@ -55,24 +48,23 @@ interface uses - Windows, - Graphics, + Winapi.Windows, + System.Win.Registry, + Vcl.Graphics, SynEditTypes, SynEditHighlighter, SynUnicode, - SysUtils, -{$IFDEF SYN_CodeFolding} - SynEditCodeFolding, - SynRegExpr, -{$ENDIF} - Classes; + System.SysUtils, + System.Classes, + System.RegularExpressions, + SynEditCodeFolding; type - TtkTokenKind = (tkAsm, tkComment, tkIdentifier, tkKey, tkNull, tkNumber, - tkSpace, tkString, tkSymbol, tkUnknown, tkFloat, tkHex, tkDirec, tkChar); + TtkTokenKind = (tkSymbol, tkKey, tkAsm, tkComment, tkIdentifier, tkNull, tkNumber, + tkSpace, tkString, tkUnknown, tkFloat, tkHex, tkDirec, tkChar, tkType); TRangeState = (rsANil, rsAnsi, rsAnsiAsm, rsAsm, rsBor, rsBorAsm, rsProperty, - rsExports, rsDirective, rsDirectiveAsm, rsUnknown); + rsExports, rsDirective, rsDirectiveAsm, rsUnKnown); PIdentFuncTableFunc = ^TIdentFuncTableFunc; TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; @@ -85,35 +77,32 @@ interface BDSVersionPrefix = 'BDS'; type -{$IFDEF SYN_CodeFolding} TSynPasSyn = class(TSynCustomCodeFoldingHighlighter) -{$ELSE} - TSynPasSyn = class(TSynCustomHighlighter) -{$ENDIF} private - FAsmStart: Boolean; - FRange: TRangeState; - FIdentFuncTable: array[0..388] of TIdentFuncTableFunc; - FTokenID: TtkTokenKind; - FStringAttri: TSynHighlighterAttributes; - FCharAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FFloatAttri: TSynHighlighterAttributes; - FHexAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FAsmAttri: TSynHighlighterAttributes; - FCommentAttri: TSynHighlighterAttributes; - FDirecAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FDelphiVersion: TDelphiVersion; - FPackageSource: Boolean; -{$IFDEF SYN_CodeFolding} - RE_BlockBegin : TRegExpr; - RE_BlockEnd : TRegExpr; - RE_Code: TRegExpr; -{$ENDIF} + fAsmStart: Boolean; + fRange: TRangeState; + fIdentFuncTable: array[0..640] of TIdentFuncTableFunc; + fTokenID: TtkTokenKind; + fStringAttri: TSynHighlighterAttributes; + fCharAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fFloatAttri: TSynHighlighterAttributes; + fHexAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fAsmAttri: TSynHighlighterAttributes; + fCommentAttri: TSynHighlighterAttributes; + fDirecAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fDelphiVersion: TDelphiVersion; + fPackageSource: Boolean; + fTypeAttri: TSynHighlighterAttributes; + // Regular Expressions + RE_BlockBegin: TRegEx; + RE_BlockEnd: TRegEx; + RE_Code: TRegEx; + RE_ControlFlow: TRegEx; function AltFunc(Index: Integer): TtkTokenKind; function KeyWordFunc(Index: Integer): TtkTokenKind; function FuncAsm(Index: Integer): TtkTokenKind; @@ -150,6 +139,7 @@ TSynPasSyn = class(TSynCustomHighlighter) function FuncThreadvar(Index: Integer): TtkTokenKind; function FuncWrite(Index: Integer): TtkTokenKind; function FuncWriteonly(Index: Integer): TtkTokenKind; + function FuncType(Index: Integer): TtkTokenKind; function HashKey(Str: PWideChar): Cardinal; function IdentKind(MayBe: PWideChar): TtkTokenKind; procedure InitIdent; @@ -177,15 +167,14 @@ TSynPasSyn = class(TSynCustomHighlighter) procedure SetDelphiVersion(const Value: TDelphiVersion); procedure SetPackageSource(const Value: Boolean); protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetCapabilities: TSynHighlighterCapabilities; override; class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; - destructor Destroy; override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override; function GetEol: Boolean; override; @@ -198,162 +187,211 @@ TSynPasSyn = class(TSynCustomHighlighter) procedure SetRange(Value: Pointer); override; function UseUserSettings(VersionIndex: Integer): Boolean; override; procedure EnumUserSettings(DelphiVersions: TStrings); override; -{$IFDEF SYN_CodeFolding} procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; procedure AdjustFoldRanges(FoldRanges: TSynFoldRanges; LinesToScan: TStrings); override; -{$ENDIF} + function FlowControlAtLine(Lines: TStrings; Line: Integer): TSynFlowControl; override; published - property AsmAttri: TSynHighlighterAttributes read FAsmAttri write FAsmAttri; - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property DirectiveAttri: TSynHighlighterAttributes read FDirecAttri - write FDirecAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property FloatAttri: TSynHighlighterAttributes read FFloatAttri - write FFloatAttri; - property HexAttri: TSynHighlighterAttributes read FHexAttri - write FHexAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property CharAttri: TSynHighlighterAttributes read FCharAttri - write FCharAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; - property DelphiVersion: TDelphiVersion read FDelphiVersion write SetDelphiVersion + property AsmAttri: TSynHighlighterAttributes read fAsmAttri write fAsmAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property DirectiveAttri: TSynHighlighterAttributes read fDirecAttri + write fDirecAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property FloatAttri: TSynHighlighterAttributes read fFloatAttri + write fFloatAttri; + property HexAttri: TSynHighlighterAttributes read fHexAttri + write fHexAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property CharAttri: TSynHighlighterAttributes read fCharAttri + write fCharAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; + property TypeAttri: TSynHighlighterAttributes read fTypeAttri + write fTypeAttri; + property DelphiVersion: TDelphiVersion read fDelphiVersion write SetDelphiVersion default LastDelphiVersion; - property PackageSource: Boolean read FPackageSource write SetPackageSource default True; + property PackageSource: Boolean read fPackageSource write SetPackageSource default True; end; implementation uses - SynEditStrConst; + System.Math, + SynEditStrConst, + SynEditMiscProcs; const // if the language is case-insensitive keywords *must* be in lowercase - KeyWords: array[0..110] of UnicodeString = ( - 'absolute', 'abstract', 'and', 'array', 'as', 'asm', 'assembler', - 'automated', 'begin', 'case', 'cdecl', 'class', 'const', 'constructor', - 'contains', 'default', 'deprecated', 'destructor', 'dispid', - 'dispinterface', 'div', 'do', 'downto', 'dynamic', 'else', 'end', 'except', - 'export', 'exports', 'external', 'far', 'file', 'final', 'finalization', - 'finally', 'for', 'forward', 'function', 'goto', 'helper', 'if', - 'implementation', 'implements', 'in', 'index', 'inherited', - 'initialization', 'inline', 'interface', 'is', 'label', 'library', - 'message', 'mod', 'name', 'near', 'nil', 'nodefault', 'not', 'object', 'of', - 'on', 'operator', 'or', 'out', 'overload', 'override', 'package', 'packed', - 'pascal', 'platform', 'private', 'procedure', 'program', 'property', - 'protected', 'public', 'published', 'raise', 'read', 'readonly', 'record', - 'register', 'reintroduce', 'repeat', 'requires', 'resourcestring', - 'safecall', 'sealed', 'set', 'shl', 'shr', 'stdcall', 'stored', 'string', - 'stringresource', 'then', 'threadvar', 'to', 'try', 'type', 'unit', 'until', - 'uses', 'var', 'virtual', 'while', 'with', 'write', 'writeonly', 'xor' + KeyWords: array[0..131] of string = ( + 'absolute', 'abstract', 'and', 'ansistring', 'array', 'as', 'asm', + 'assembler', 'automated', 'begin', 'boolean', 'byte', 'bytebool', + 'cardinal', 'case', 'cdecl', 'class', 'const', 'constructor', 'contains', + 'currency', 'default', 'deprecated', 'destructor', 'dispid', + 'dispinterface', 'div', 'do', 'double', 'downto', 'dynamic', 'else', 'end', + 'except', 'export', 'exports', 'extended', 'external', 'far', 'file', + 'final', 'finalization', 'finally', 'for', 'forward', 'function', 'goto', + 'helper', 'if', 'implementation', 'implements', 'in', 'index', 'inherited', + 'initialization', 'inline', 'int64', 'integer', 'interface', 'is', 'label', + 'library', 'longbool', 'longint', 'longword', 'message', 'mod', 'name', + 'near', 'nil', 'nodefault', 'not', 'object', 'of', 'on', 'operator', 'or', + 'out', 'overload', 'override', 'package', 'packed', 'pascal', 'platform', + 'private', 'procedure', 'program', 'property', 'protected', 'public', + 'published', 'raise', 'read', 'readonly', 'real48', 'record', 'register', + 'reintroduce', 'repeat', 'requires', 'resourcestring', 'safecall', 'sealed', + 'set', 'shl', 'shortint', 'shortstring', 'shr', 'single', 'smallint', + 'stdcall', 'stored', 'string', 'stringresource', 'then', 'threadvar', 'to', + 'try', 'type', 'unit', 'until', 'uses', 'var', 'virtual', 'while', + 'string', 'with', 'word', 'wordbool', 'write', 'writeonly', 'xor' ); - KeyIndices: array[0..388] of Integer = ( - -1, -1, -1, 105, -1, 51, -1, 108, -1, -1, -1, -1, -1, 75, -1, -1, 46, -1, - -1, 103, -1, -1, -1, -1, 55, -1, -1, -1, -1, 76, -1, -1, 96, 14, -1, 31, 3, - 102, -1, -1, -1, 7, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, -1, -1, 25, -1, - -1, 56, 65, 95, -1, -1, -1, 34, -1, 85, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 22, -1, -1, -1, -1, -1, -1, 80, -1, -1, -1, -1, 50, -1, -1, 109, 98, -1, - 86, -1, 13, -1, -1, -1, 107, -1, -1, 60, -1, 0, 64, -1, -1, -1, -1, 8, 10, - -1, -1, -1, 67, -1, -1, -1, 74, -1, 17, -1, 73, 69, -1, 68, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 16, -1, -1, 23, 39, -1, 35, 30, -1, -1, -1, 70, -1, 37, - -1, -1, 89, 71, 84, 72, -1, 29, 40, -1, -1, -1, 32, -1, -1, -1, 94, -1, -1, - 87, -1, -1, -1, -1, -1, -1, 77, -1, -1, -1, -1, -1, -1, 11, 57, 41, 6, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, 97, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 44, 12, -1, -1, 101, -1, 58, -1, -1, -1, 99, -1, -1, - -1, -1, 53, 20, -1, -1, -1, 36, -1, -1, 63, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 45, -1, -1, -1, -1, 27, -1, -1, -1, -1, -1, 59, - -1, 110, -1, 15, -1, 52, -1, -1, -1, -1, 5, 48, -1, -1, -1, 81, -1, 28, -1, - -1, -1, 2, -1, 1, -1, 106, -1, -1, -1, -1, 90, -1, 83, -1, -1, -1, -1, -1, - 79, -1, -1, 33, 62, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, 88, - 61, 54, -1, 42, -1, -1, -1, 66, -1, -1, -1, 92, 100, -1, -1, -1, -1, -1, 18, - -1, -1, 26, 47, 38, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 9, -1, 91, -1, -1, -1, -1, -1, -1, 49, -1, 21, -1, -1, -1, -1, -1, -1, 43, - -1, 82, -1, 19, 104, -1, -1, -1, -1, -1 + KeyIndices: array[0..640] of Integer = ( + -1, -1, -1, 34, -1, -1, 5, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 122, -1, 78, -1, -1, 11, -1, -1, -1, -1, -1, -1, -1, 128, -1, -1, + -1, -1, -1, -1, -1, -1, 107, -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, 35, + -1, -1, -1, 4, 79, -1, 36, -1, -1, 117, -1, -1, -1, -1, -1, 49, -1, -1, -1, + 77, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 105, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 113, -1, 112, + -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, 72, -1, 40, -1, 121, 83, 98, + -1, -1, -1, -1, -1, 38, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 100, -1, 86, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, 32, -1, + -1, -1, -1, 58, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 67, -1, 6, + 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 71, -1, -1, -1, -1, + -1, -1, -1, -1, 48, -1, -1, -1, 3, -1, 43, -1, -1, -1, 96, -1, -1, 53, -1, + 76, -1, -1, -1, -1, -1, -1, -1, -1, -1, 104, -1, -1, -1, -1, -1, 12, -1, -1, + -1, -1, -1, -1, 37, 90, -1, 126, -1, -1, 85, 81, -1, -1, -1, -1, -1, -1, -1, + 52, -1, -1, -1, 124, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, 42, -1, -1, 29, + -1, 127, -1, -1, -1, -1, -1, -1, 129, -1, -1, -1, 16, -1, -1, 108, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 28, -1, 101, 61, -1, -1, 26, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 59, 131, -1, -1, -1, -1, -1, -1, -1, -1, 65, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, 41, 2, -1, + -1, 82, -1, -1, -1, 30, -1, -1, 33, -1, -1, -1, -1, 95, -1, -1, -1, -1, -1, + -1, -1, 114, -1, 51, -1, 9, -1, 21, -1, 0, -1, -1, 66, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 55, 14, 18, -1, -1, -1, -1, 110, -1, -1, -1, -1, 10, -1, -1, + -1, 97, -1, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, + 8, 70, -1, -1, -1, -1, -1, -1, 27, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 87, 111, -1, -1, 25, 50, -1, 57, -1, 24, -1, -1, -1, -1, -1, 39, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, 123, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 130, -1, -1, -1, -1, -1, -1, -1, -1, 102, -1, -1, + -1, -1, 17, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, 125, -1, -1, -1, -1, + 103, -1, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, + -1, -1, 119, -1, 118, -1, -1, -1, -1, 88, 7, -1, -1, -1, -1, -1, -1, -1, 46, + 89, -1, -1, -1, -1, -1, 62, -1, -1, -1, -1, -1, -1, -1, 45, -1, -1, 54, -1, + 75, -1, -1, 56, -1, -1, -1, -1, -1, -1, 68, -1, 115, -1, 60, -1, -1, 91, -1, + -1, -1, -1, -1, -1, 93, -1, -1, 106, -1, 94, 73, -1, -1, -1, -1, -1, 22, -1, + -1, -1, 84, -1, 92, -1, -1, 47, -1, -1, -1, -1, -1, 23, -1, -1, -1, -1, -1, + -1, 80 ); -{$Q-} +{$IFOPT Q+} + {$OVERFLOWCHECKS OFF} + {$DEFINE OVERFLOWCHECK_ON} +{$ENDIF} function TSynPasSyn.HashKey(Str: PWideChar): Cardinal; begin Result := 0; while IsIdentChar(Str^) do begin - Result := Result * 812 + Ord(Str^) * 76; + Result := Result * 526 + Ord(Str^) * 502; Inc(Str); end; - Result := Result mod 389; - FStringLen := Str - FToIdent; + Result := Result mod 641; + fStringLen := Str - fToIdent; end; -{$Q+} +{$IFDEF OVERFLOWCHECK_ON} + {$OVERFLOWCHECKS ON} + {$UNDEF OVERFLOWCHECK_ON} +{$ENDIF} function TSynPasSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; procedure TSynPasSyn.InitIdent; var - i: Integer; -begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; - - FIdentFuncTable[275] := FuncAsm; - FIdentFuncTable[41] := FuncAutomated; - FIdentFuncTable[112] := FuncCdecl; - FIdentFuncTable[33] := FuncContains; - FIdentFuncTable[137] := FuncDeprecated; - FIdentFuncTable[340] := FuncDispid; - FIdentFuncTable[382] := FuncDispinterface; - FIdentFuncTable[54] := FuncEnd; - FIdentFuncTable[282] := FuncExports; - FIdentFuncTable[163] := FuncFinal; - FIdentFuncTable[306] := FuncFinalization; - FIdentFuncTable[141] := FuncHelper; - FIdentFuncTable[325] := FuncImplements; - FIdentFuncTable[214] := FuncIndex; - FIdentFuncTable[323] := FuncName; - FIdentFuncTable[185] := FuncNodefault; - FIdentFuncTable[307] := FuncOperator; - FIdentFuncTable[58] := FuncOverload; - FIdentFuncTable[116] := FuncPackage; - FIdentFuncTable[148] := FuncPlatform; - FIdentFuncTable[120] := FuncProperty; - FIdentFuncTable[303] := FuncRead; - FIdentFuncTable[83] := FuncReadonly; - FIdentFuncTable[297] := FuncReintroduce; - FIdentFuncTable[65] := FuncRequires; - FIdentFuncTable[94] := FuncResourcestring; - FIdentFuncTable[170] := FuncSafecall; - FIdentFuncTable[321] := FuncSealed; - FIdentFuncTable[333] := FuncStdcall; - FIdentFuncTable[348] := FuncStored; - FIdentFuncTable[59] := FuncStringresource; - FIdentFuncTable[204] := FuncThreadvar; - FIdentFuncTable[7] := FuncWrite; - FIdentFuncTable[91] := FuncWriteonly; - - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if @FIdentFuncTable[i] = nil then - FIdentFuncTable[i] := KeyWordFunc; + I: Integer; +begin + for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if KeyIndices[I] = -1 then + fIdentFuncTable[I] := AltFunc; + + fIdentFuncTable[215] := FuncType; + fIdentFuncTable[412] := FuncType; + fIdentFuncTable[26] := FuncType; + fIdentFuncTable[242] := FuncType; + fIdentFuncTable[188] := FuncType; + fIdentFuncTable[428] := FuncType; + fIdentFuncTable[310] := FuncType; + fIdentFuncTable[62] := FuncType; + fIdentFuncTable[585] := FuncType; + fIdentFuncTable[462] := FuncType; + fIdentFuncTable[569] := FuncType; + fIdentFuncTable[511] := FuncType; + fIdentFuncTable[166] := FuncType; + fIdentFuncTable[611] := FuncType; + fIdentFuncTable[86] := FuncType; + fIdentFuncTable[609] := FuncType; + fIdentFuncTable[298] := FuncType; + fIdentFuncTable[484] := FuncType; + fIdentFuncTable[521] := FuncType; + fIdentFuncTable[284] := FuncType; + fIdentFuncTable[34] := FuncType; + fIdentFuncTable[111] := FuncType; + + fIdentFuncTable[187] := FuncAsm; + fIdentFuncTable[434] := FuncAutomated; + fIdentFuncTable[419] := FuncCdecl; + fIdentFuncTable[353] := FuncContains; + fIdentFuncTable[618] := FuncDeprecated; + fIdentFuncTable[464] := FuncDispid; + fIdentFuncTable[459] := FuncDispinterface; + fIdentFuncTable[167] := FuncEnd; + fIdentFuncTable[55] := FuncExports; + fIdentFuncTable[126] := FuncFinal; + fIdentFuncTable[355] := FuncFinalization; + fIdentFuncTable[627] := FuncHelper; + fIdentFuncTable[460] := FuncImplements; + fIdentFuncTable[264] := FuncIndex; + fIdentFuncTable[185] := FuncName; + fIdentFuncTable[435] := FuncNodefault; + fIdentFuncTable[582] := FuncOperator; + fIdentFuncTable[23] := FuncOverload; + fIdentFuncTable[640] := FuncPackage; + fIdentFuncTable[129] := FuncPlatform; + fIdentFuncTable[455] := FuncProperty; + fIdentFuncTable[624] := FuncRead; + fIdentFuncTable[606] := FuncReadonly; + fIdentFuncTable[416] := FuncReintroduce; + fIdentFuncTable[530] := FuncRequires; + fIdentFuncTable[153] := FuncResourcestring; + fIdentFuncTable[312] := FuncSafecall; + fIdentFuncTable[505] := FuncSealed; + fIdentFuncTable[407] := FuncStdcall; + fIdentFuncTable[456] := FuncStored; + fIdentFuncTable[109] := FuncStringresource; + fIdentFuncTable[594] := FuncThreadvar; + fIdentFuncTable[291] := FuncWrite; + fIdentFuncTable[496] := FuncWriteonly; + + for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if @fIdentFuncTable[I] = nil then + fIdentFuncTable[I] := KeyWordFunc; end; function TSynPasSyn.AltFunc(Index: Integer): TtkTokenKind; @@ -369,13 +407,36 @@ function TSynPasSyn.KeyWordFunc(Index: Integer): TtkTokenKind; Result := tkIdentifier end; +function TSynPasSyn.FlowControlAtLine(Lines: TStrings; Line: Integer): + TSynFlowControl; +var + Match: TMatch; +begin + Result := fcNone; + + Match := RE_ControlFlow.Match(Lines[Line - 1]); + if Match.Success then + begin + if Match.Groups[2].Length > 0 then + Result := fcBreak + else if Match.Groups[3].Length > 0 then + Result := fcContinue + else + Result := fcExit; + + if GetHighlighterAttriAtRowCol(Lines, Line - 1, Match.Index) <> IdentifierAttri + then + Result := fcNone; + end; +end; + function TSynPasSyn.FuncAsm(Index: Integer): TtkTokenKind; begin if IsCurrentToken(KeyWords[Index]) then begin Result := tkKey; - FRange := rsAsm; - FAsmStart := True; + fRange := rsAsm; + fAsmStart := True; end else Result := tkIdentifier; @@ -434,7 +495,7 @@ function TSynPasSyn.FuncEnd(Index: Integer): TtkTokenKind; if IsCurrentToken(KeyWords[Index]) then begin Result := tkKey; - FRange := rsUnknown; + fRange := rsUnknown; end else Result := tkIdentifier; @@ -445,7 +506,7 @@ function TSynPasSyn.FuncExports(Index: Integer): TtkTokenKind; if IsCurrentToken(KeyWords[Index]) then begin Result := tkKey; - FRange := rsExports; + fRange := rsExports; end else Result := tkIdentifier; @@ -477,7 +538,7 @@ function TSynPasSyn.FuncHelper(Index: Integer): TtkTokenKind; function TSynPasSyn.FuncImplements(Index: Integer): TtkTokenKind; begin - if (FRange = rsProperty) and (DelphiVersion >= dvDelphi4) and IsCurrentToken(KeyWords[Index]) then + if (fRange = rsProperty) and (DelphiVersion >= dvDelphi4) and IsCurrentToken(KeyWords[Index]) then Result := tkKey else Result := tkIdentifier; @@ -485,7 +546,7 @@ function TSynPasSyn.FuncImplements(Index: Integer): TtkTokenKind; function TSynPasSyn.FuncIndex(Index: Integer): TtkTokenKind; begin - if (FRange in [rsProperty, rsExports]) and IsCurrentToken(KeyWords[Index]) then + if (fRange in [rsProperty, rsExports]) and IsCurrentToken(KeyWords[Index]) then Result := tkKey else Result := tkIdentifier; @@ -493,7 +554,7 @@ function TSynPasSyn.FuncIndex(Index: Integer): TtkTokenKind; function TSynPasSyn.FuncName(Index: Integer): TtkTokenKind; begin - if (FRange = rsExports) and IsCurrentToken(KeyWords[Index]) then + if (fRange = rsExports) and IsCurrentToken(KeyWords[Index]) then Result := tkKey else Result := tkIdentifier; @@ -501,7 +562,7 @@ function TSynPasSyn.FuncName(Index: Integer): TtkTokenKind; function TSynPasSyn.FuncNodefault(Index: Integer): TtkTokenKind; begin - if (FRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then + if (fRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then Result := tkKey else Result := tkIdentifier; @@ -544,7 +605,7 @@ function TSynPasSyn.FuncProperty(Index: Integer): TtkTokenKind; if IsCurrentToken(KeyWords[Index]) then begin Result := tkKey; - FRange := rsProperty; + fRange := rsProperty; end else Result := tkIdentifier; @@ -552,7 +613,7 @@ function TSynPasSyn.FuncProperty(Index: Integer): TtkTokenKind; function TSynPasSyn.FuncRead(Index: Integer): TtkTokenKind; begin - if (FRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then + if (fRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then Result := tkKey else Result := tkIdentifier; @@ -560,7 +621,7 @@ function TSynPasSyn.FuncRead(Index: Integer): TtkTokenKind; function TSynPasSyn.FuncReadonly(Index: Integer): TtkTokenKind; begin - if (DelphiVersion >= dvDelphi3) and (FRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then + if (DelphiVersion >= dvDelphi3) and (fRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then Result := tkKey else Result := tkIdentifier; @@ -616,7 +677,7 @@ function TSynPasSyn.FuncStdcall(Index: Integer): TtkTokenKind; function TSynPasSyn.FuncStored(Index: Integer): TtkTokenKind; begin - if (FRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then + if (fRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then Result := tkKey else Result := tkIdentifier; @@ -640,7 +701,7 @@ function TSynPasSyn.FuncThreadvar(Index: Integer): TtkTokenKind; function TSynPasSyn.FuncWrite(Index: Integer): TtkTokenKind; begin - if (FRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then + if (fRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then Result := tkKey else Result := tkIdentifier; @@ -648,91 +709,82 @@ function TSynPasSyn.FuncWrite(Index: Integer): TtkTokenKind; function TSynPasSyn.FuncWriteonly(Index: Integer): TtkTokenKind; begin - if (DelphiVersion >= dvDelphi3) and (FRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then + if (DelphiVersion >= dvDelphi3) and (fRange = rsProperty) and IsCurrentToken(KeyWords[Index]) then Result := tkKey else Result := tkIdentifier; end; +function TSynPasSyn.FuncType(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkType + else + Result := tkIdentifier +end; + constructor TSynPasSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := False; - - FDelphiVersion := LastDelphiVersion; - FPackageSource := True; - - FAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler); - AddAttribute(FAsmAttri); - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style:= [fsItalic]; - AddAttribute(FCommentAttri); - FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); - FDirecAttri.Style:= [fsItalic]; - AddAttribute(FDirecAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style:= [fsBold]; - AddAttribute(FKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat); - AddAttribute(FFloatAttri); - FHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal); - AddAttribute(FHexAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FCharAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter); - AddAttribute(FCharAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); + fCaseSensitive := False; + + fDelphiVersion := LastDelphiVersion; + fPackageSource := True; + + fAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler); + AddAttribute(fAsmAttri); + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style:= [fsItalic]; + AddAttribute(fCommentAttri); + fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); + fDirecAttri.Style:= [fsItalic]; + AddAttribute(fDirecAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style:= [fsBold]; + AddAttribute(fKeyAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat); + AddAttribute(fFloatAttri); + fHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal); + AddAttribute(fHexAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); + fCharAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter); + AddAttribute(fCharAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); + fTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); + AddAttribute(fTypeAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FRange := rsUnknown; - FAsmStart := False; - FDefaultFilter := SYNS_FilterPascal; - -{$IFDEF SYN_CodeFolding} - RE_BlockBegin := TRegExpr.Create; - RE_BlockBegin.Expression := '\b(begin|record|class)\b'; - RE_BlockBegin.ModifierI := True; - - RE_BlockEnd := TRegExpr.Create; - RE_BlockEnd.Expression := '\bend\b'; - RE_BlockEnd.ModifierI := True; - - RE_Code := TRegExpr.Create; - RE_Code.Expression := '^\s*(function|procedure)\b'; - RE_Code.ModifierI := True; -{$ENDIF} -end; + fRange := rsUnknown; + fAsmStart := False; + fDefaultFilter := SYNS_FilterPascal; -destructor TSynPasSyn.Destroy; -begin -{$IFDEF SYN_CodeFolding} - FreeAndNil(RE_BlockBegin); - FreeAndNil(RE_BlockEnd); - FreeAndNil(RE_Code); -{$ENDIF} - inherited; -end; + RE_BlockBegin := CompiledRegEx('\b(begin|record|class|case|try)\b', [roIgnoreCase]); + RE_BlockEnd := CompiledRegEx('\bend\b', [roIgnoreCase]); + RE_Code := CompiledRegEx('^\s*(function|procedure|constructor|destructor)\b', [roIgnoreCase]); + RE_ControlFlow := CompiledRegEx('\b((break)|(continue)|(exit))\b', [roIgnoreCase]); +end; procedure TSynPasSyn.AddressOpProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if FLine[Run] = '@' then Inc(Run); + if fLine[Run] = '@' then Inc(Run); end; procedure TSynPasSyn.AsciiCharProc; function IsAsciiChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '$', 'A'..'F', 'a'..'f': Result := True; else @@ -741,7 +793,7 @@ procedure TSynPasSyn.AsciiCharProc; end; begin - FTokenID := tkChar; + fTokenID := tkChar; Inc(Run); while IsAsciiChar do Inc(Run); @@ -749,24 +801,24 @@ procedure TSynPasSyn.AsciiCharProc; procedure TSynPasSyn.BorProc; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; else begin - if FRange in [rsDirective, rsDirectiveAsm] then - FTokenID := tkDirec + if fRange in [rsDirective, rsDirectiveAsm] then + fTokenID := tkDirec else - FTokenID := tkComment; + fTokenID := tkComment; repeat - if FLine[Run] = '}' then + if fLine[Run] = '}' then begin Inc(Run); - if FRange in [rsBorAsm, rsDirectiveAsm] then - FRange := rsAsm + if fRange in [rsBorAsm, rsDirectiveAsm] then + fRange := rsAsm else - FRange := rsUnknown; + fRange := rsUnKnown; Break; end; Inc(Run); @@ -777,43 +829,43 @@ procedure TSynPasSyn.BorProc; procedure TSynPasSyn.BraceOpenProc; begin - if (FLine[Run + 1] = '$') then + if (fLine[Run + 1] = '$') then begin - if FRange = rsAsm then - FRange := rsDirectiveAsm + if fRange = rsAsm then + fRange := rsDirectiveAsm else - FRange := rsDirective; + fRange := rsDirective; end else begin - if FRange = rsAsm then - FRange := rsBorAsm + if fRange = rsAsm then + fRange := rsBorAsm else - FRange := rsBor; + fRange := rsBor; end; BorProc; end; procedure TSynPasSyn.ColonOrGreaterProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if FLine[Run] = '=' then Inc(Run); + if fLine[Run] = '=' then Inc(Run); end; procedure TSynPasSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then + if fLine[Run] = #10 then Inc(Run); end; procedure TSynPasSyn.IdentProc; begin - FTokenID := IdentKind(FLine + Run); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do + fTokenID := IdentKind(fLine + Run); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; @@ -821,7 +873,7 @@ procedure TSynPasSyn.IntegerProc; function IsIntegerChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', 'A'..'F', 'a'..'f': Result := True; else @@ -831,28 +883,28 @@ procedure TSynPasSyn.IntegerProc; begin Inc(Run); - FTokenID := tkHex; + fTokenID := tkHex; while IsIntegerChar do Inc(Run); end; procedure TSynPasSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynPasSyn.LowerProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if (FLine[Run] = '=') or (FLine[Run] = '>') then + if (fLine[Run] = '=') or (fLine[Run] = '>') then Inc(Run); end; procedure TSynPasSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -860,7 +912,7 @@ procedure TSynPasSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', 'e', 'E', '-', '+': Result := True; else @@ -870,19 +922,19 @@ procedure TSynPasSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin - case FLine[Run] of + case fLine[Run] of '.': - if FLine[Run + 1] = '.' then + if fLine[Run + 1] = '.' then Break else - FTokenID := tkFloat; - 'e', 'E': FTokenID := tkFloat; + fTokenID := tkFloat; + 'e', 'E': fTokenID := tkFloat; '-', '+': begin - if FTokenID <> tkFloat then // arithmetic + if fTokenID <> tkFloat then // arithmetic Break; if (FLine[Run - 1] <> 'e') and (FLine[Run - 1] <> 'E') then Break; //float, but it ends here @@ -894,27 +946,27 @@ procedure TSynPasSyn.NumberProc; procedure TSynPasSyn.PointProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if (FLine[Run] = '.') or (FLine[Run - 1] = ')') then + if (fLine[Run] = '.') or (fLine[Run - 1] = ')') then Inc(Run); end; procedure TSynPasSyn.AnsiProc; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; else - FTokenID := tkComment; + fTokenID := tkComment; repeat - if (FLine[Run] = '*') and (FLine[Run + 1] = ')') then begin + if (fLine[Run] = '*') and (fLine[Run + 1] = ')') then begin Inc(Run, 2); - if FRange = rsAnsiAsm then - FRange := rsAsm + if fRange = rsAnsiAsm then + fRange := rsAsm else - FRange := rsUnknown; + fRange := rsUnKnown; Break; end; Inc(Run); @@ -925,66 +977,66 @@ procedure TSynPasSyn.AnsiProc; procedure TSynPasSyn.RoundOpenProc; begin Inc(Run); - case FLine[Run] of + case fLine[Run] of '*': begin Inc(Run); - if FRange = rsAsm then - FRange := rsAnsiAsm + if fRange = rsAsm then + fRange := rsAnsiAsm else - FRange := rsAnsi; - FTokenID := tkComment; + fRange := rsAnsi; + fTokenID := tkComment; if not IsLineEnd(Run) then AnsiProc; end; '.': begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; procedure TSynPasSyn.SemicolonProc; begin Inc(Run); - FTokenID := tkSymbol; - if FRange in [rsProperty, rsExports] then - FRange := rsUnknown; + fTokenID := tkSymbol; + if fRange in [rsProperty, rsExports] then + fRange := rsUnknown; end; procedure TSynPasSyn.SlashProc; begin Inc(Run); - if (FLine[Run] = '/') and (FDelphiVersion > dvDelphi1) then + if (fLine[Run] = '/') and (fDelphiVersion > dvDelphi1) then begin - FTokenID := tkComment; + fTokenID := tkComment; repeat Inc(Run); until IsLineEnd(Run); end else - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynPasSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynPasSyn.StringProc; begin - FTokenID := tkString; + fTokenID := tkString; Inc(Run); while not IsLineEnd(Run) do begin - if FLine[Run] = #39 then begin + if fLine[Run] = #39 then begin Inc(Run); - if FLine[Run] <> #39 then + if fLine[Run] <> #39 then Break; end; Inc(Run); @@ -994,26 +1046,26 @@ procedure TSynPasSyn.StringProc; procedure TSynPasSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynPasSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynPasSyn.Next; begin - FAsmStart := False; - FTokenPos := Run; - case FRange of + fAsmStart := False; + fTokenPos := Run; + case fRange of rsAnsi, rsAnsiAsm: AnsiProc; rsBor, rsBorAsm, rsDirective, rsDirectiveAsm: BorProc; else - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; @@ -1026,7 +1078,7 @@ procedure TSynPasSyn.Next; '{': BraceOpenProc; '}', '!', '"', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~': begin - case FLine[Run] of + case fLine[Run] of '(': RoundOpenProc; '.': PointProc; ';': SemicolonProc; @@ -1049,12 +1101,12 @@ function TSynPasSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -1062,35 +1114,36 @@ function TSynPasSyn.GetDefaultAttribute(Index: Integer): function TSynPasSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynPasSyn.GetTokenID: TtkTokenKind; begin - if not FAsmStart and (FRange = rsAsm) - and not (FTokenID in [tkNull, tkComment, tkDirec, tkSpace]) + if not fAsmStart and (fRange = rsAsm) + and not (fTokenId in [tkNull, tkComment, tkDirec, tkSpace]) then Result := tkAsm else - Result := FTokenID; + Result := fTokenId; end; function TSynPasSyn.GetTokenAttribute: TSynHighlighterAttributes; begin case GetTokenID of - tkAsm: Result := FAsmAttri; - tkComment: Result := FCommentAttri; - tkDirec: Result := FDirecAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkFloat: Result := FFloatAttri; - tkHex: Result := FHexAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkChar: Result := FCharAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FSymbolAttri; + tkAsm: Result := fAsmAttri; + tkComment: Result := fCommentAttri; + tkDirec: Result := fDirecAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkFloat: Result := fFloatAttri; + tkHex: Result := fHexAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkChar: Result := fCharAttri; + tkSymbol: Result := fSymbolAttri; + tkType: Result := fTypeAttri; + tkUnknown: Result := fSymbolAttri; else Result := nil; end; @@ -1103,256 +1156,27 @@ function TSynPasSyn.GetTokenKind: Integer; function TSynPasSyn.GetRange: Pointer; begin - Result := Pointer(FRange); -end; - -{$IFDEF SYN_CodeFolding} -type - TRangeStates = set of TRangeState; - -Const - FT_Standard = 1; // begin end, class end, record end - FT_Comment = 11; - FT_Asm = 12; - FT_HereDocDouble = 13; - FT_HereDocSingle = 14; - FT_ConditionalDirective = 15; - FT_CodeDeclaration = 16; - FT_CodeDeclarationWithBody = 17; - FT_Implementation = 18; - -procedure TSynPasSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine, ToLine: Integer); -var - CurLine: String; - Line: Integer; - - function BlockDelimiter(Line: Integer): Boolean; - var - Index: Integer; - begin - Result := False; - - if RE_BlockBegin.Exec(CurLine) then - begin - // Char must have proper highlighting (ignore stuff inside comments...) - Index := RE_BlockBegin.MatchPos[0]; - if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then - begin - // And ignore lines with both opening and closing chars in them - Re_BlockEnd.InputString := CurLine; - if not RE_BlockEnd.Exec(Index + 1) then begin - FoldRanges.StartFoldRange(Line + 1, FT_Standard); - Result := True; - end; - end; - end else if RE_BlockEnd.Exec(CurLine) then - begin - Index := RE_BlockEnd.MatchPos[0]; - if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then - begin - FoldRanges.StopFoldRange(Line + 1, FT_Standard); - Result := True; - end; - end; - end; - - function FoldRegion(Line: Integer): Boolean; - var - S: string; - begin - Result := False; - S := TrimLeft(CurLine); - if Uppercase(Copy(S, 1, 8)) = '{$REGION' then - begin - FoldRanges.StartFoldRange(Line + 1, FoldRegionType); - Result := True; - end - else if Uppercase(Copy(S, 1, 11)) = '{$ENDREGION' then - begin - FoldRanges.StopFoldRange(Line + 1, FoldRegionType); - Result := True; - end; - end; - - function ConditionalDirective(Line: Integer): Boolean; - var - S: string; - begin - Result := False; - S := TrimLeft(CurLine); - if Uppercase(Copy(S, 1, 7)) = '{$IFDEF' then - begin - FoldRanges.StartFoldRange(Line + 1, FT_ConditionalDirective); - Result := True; - end - else if Uppercase(Copy(S, 1, 7)) = '{$ENDIF' then - begin - FoldRanges.StopFoldRange(Line + 1, FT_ConditionalDirective); - Result := True; - end; - end; - - function IsMultiLineStatement(Line : integer; Ranges: TRangeStates; - Fold : Boolean; FoldType: Integer = 1): Boolean; - begin - Result := True; - if TRangeState(GetLineRange(LinesToScan, Line)) in Ranges then - begin - if Fold and not (TRangeState(GetLineRange(LinesToScan, Line - 1)) in Ranges) then - FoldRanges.StartFoldRange(Line + 1, FoldType) - else - FoldRanges.NoFoldInfo(Line + 1); - end - else if Fold and (TRangeState(GetLineRange(LinesToScan, Line - 1)) in Ranges) then - begin - FoldRanges.StopFoldRange(Line + 1, FoldType); - end else - Result := False; - end; - -begin - for Line := FromLine to ToLine do - begin - // Deal first with Multiline statements - if IsMultiLineStatement(Line, [rsAnsi], True, FT_Comment) or - IsMultiLineStatement(Line, [rsAsm, rsAnsiAsm, rsBorAsm, rsDirectiveAsm], True, FT_Asm) or - IsMultiLineStatement(Line, [rsBor], True, FT_Comment) or - IsMultiLineStatement(Line, [rsDirective], False) - then - Continue; - - CurLine := LinesToScan[Line]; - - // Skip empty lines - if CurLine = '' then begin - FoldRanges.NoFoldInfo(Line + 1); - Continue; - end; - - // Deal with ConditionalDirectives - if ConditionalDirective(Line) then - Continue; - - // Find Fold regions - if FoldRegion(Line) then - Continue; - - // Implementation - if Uppercase(TrimLeft(CurLine)) = 'IMPLEMENTATION' then - FoldRanges.StartFoldRange(Line +1, FT_Implementation) - // Functions and procedures - else if RE_Code.Exec(CurLine) then - FoldRanges.StartFoldRange(Line + 1, FT_CodeDeclaration) - // Find begin or end (Fold Type 1) - else if not BlockDelimiter(Line) then - FoldRanges.NoFoldInfo(Line + 1); - end; //for Line + Result := Pointer(fRange); end; -procedure TSynPasSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings); -{ - Provide folding for procedures and functions included nested ones. -} -Var - i, j, SkipTo: Integer; - ImplementationIndex: Integer; - FoldRange: TSynFoldRange; -begin - ImplementationIndex := - 1; - for i := FoldRanges.Ranges.Count - 1 downto 0 do - begin - if FoldRanges.Ranges.List[i].FoldType = FT_Implementation then - ImplementationIndex := i - else if FoldRanges.Ranges.List[i].FoldType = FT_CodeDeclaration then - begin - if ImplementationIndex >= 0 then begin - // Code declaration in the Interface part of a unit - FoldRanges.Ranges.Delete(i); - Dec(ImplementationIndex); - continue; - end; - // Examine the following ranges - SkipTo := 0; - j := i + 1; - while J < FoldRanges.Ranges.Count do begin - FoldRange := FoldRanges.Ranges.List[j]; - Inc(j); - case FoldRange.FoldType of - // Nested procedure or function - FT_CodeDeclarationWithBody: - begin - SkipTo := FoldRange.ToLine; - continue; - end; - FT_Standard: - // possibly begin end; - if FoldRange.ToLine <= SkipTo then - Continue - else if RE_BlockBegin.Exec(LinesToScan[FoldRange.FromLine - 1]) then - begin - if LowerCase(RE_BlockBegin.Match[0]) = 'begin' then - begin - // function or procedure followed by begin end block - // Adjust ToLine - FoldRanges.Ranges.List[i].ToLine := FoldRange.ToLine; - FoldRanges.Ranges.List[i].FoldType := FT_CodeDeclarationWithBody; - break - end else - begin - // class or record declaration follows, so - FoldRanges.Ranges.Delete(i); - break; - end; - end else - Assert(False, 'TSynDWSSyn.AdjustFoldRanges'); - else - begin - if FoldRange.ToLine <= SkipTo then - Continue - else begin - // Otherwise delete - // eg. function definitions within a class definition - FoldRanges.Ranges.Delete(i); - break - end; - end; - end; - end; - end; - end; - if ImplementationIndex >= 0 then - // Looks better without it - //FoldRanges.Ranges.List[ImplementationIndex].ToLine := LinesToScan.Count; - FoldRanges.Ranges.Delete(ImplementationIndex); -end; -{$ENDIF} - procedure TSynPasSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; procedure TSynPasSyn.ResetRange; begin - FRange:= rsUnknown; + fRange:= rsUnknown; end; procedure TSynPasSyn.EnumUserSettings(DelphiVersions: TStrings); -{$IFNDEF SYN_DELPHI_2006_UP} -const - KEY_WOW64_64KEY = $0100; - KEY_WOW64_32KEY = $0200; -{$ENDIF} - procedure LoadKeyVersions(const Key, Prefix: string); var Versions: TStringList; - i: Integer; + I: Integer; begin - with TBetterRegistry.Create(KEY_READ or KEY_WOW64_32KEY) do + with TRegistry.Create(KEY_READ or KEY_WOW64_32KEY) do begin try RootKey := HKEY_LOCAL_MACHINE; @@ -1362,8 +1186,8 @@ procedure TSynPasSyn.EnumUserSettings(DelphiVersions: TStrings); Versions := TStringList.Create; try GetKeyNames(Versions); - for i := 0 to Versions.Count - 1 do - DelphiVersions.Add(Prefix + Versions[i]); + for I := 0 to Versions.Count - 1 do + DelphiVersions.Add(Prefix + Versions[I]); finally FreeAndNil(Versions); end; @@ -1378,6 +1202,8 @@ procedure TSynPasSyn.EnumUserSettings(DelphiVersions: TStrings); end; begin + { returns the user settings that exist in the registry } + // See UseUserSettings below where these strings are used LoadKeyVersions('\SOFTWARE\Borland\Delphi', ''); LoadKeyVersions('\SOFTWARE\Borland\BDS', BDSVersionPrefix); LoadKeyVersions('\SOFTWARE\CodeGear\BDS', BDSVersionPrefix); @@ -1388,7 +1214,7 @@ function TSynPasSyn.UseUserSettings(VersionIndex: Integer): Boolean; // Possible parameter values: // index into TStrings returned by EnumUserSettings // Possible return values: -// True : settings were read and used +// True: settings were read and used // False: problem reading settings or invalid version specified - old settings // were preserved @@ -1401,10 +1227,10 @@ function TSynPasSyn.UseUserSettings(VersionIndex: Integer): Boolean; function ReadDelphi2Or3(settingTag: string; attri: TSynHighlighterAttributes; name: string): Boolean; var - i: Integer; + I: Integer; begin - for i := 1 to Length(name) do - if name[i] = ' ' then name[i] := '_'; + for I := 1 to Length(name) do + if name[I] = ' ' then name[I] := '_'; Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, '\Software\Borland\Delphi\'+settingTag+'\Highlight',name,True); end; { ReadDelphi2Or3 } @@ -1427,31 +1253,21 @@ function TSynPasSyn.UseUserSettings(VersionIndex: Integer): Boolean; '\Software\CodeGear\BDS\'+settingTag+'\Editor\Highlight',key,False); end; { ReadDelphi2009OrMore } - function ReadDelphiXEOrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; - begin - Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, - '\Software\Embarcadero\BDS\'+settingTag+'\Editor\Highlight',key,False); - end; { ReadDelphi2009OrMore } - - begin { ReadDelphiSetting } try if Pos('BDS', settingTag) = 1 then // BDS product begin VersionStr := Copy(settingTag, Length(BDSVersionPrefix) + 1, 999); Version := 0; - if not TryStrToCurr(StringReplace(VersionStr, '.', {$IFDEF SYN_COMPILER_15_UP}FormatSettings.{$ENDIF}DecimalSeparator, []), Version) then + if not TryStrToCurr(StringReplace(VersionStr, '.', FormatSettings.DecimalSeparator, []), Version) then begin Result := False; Exit; end; - if Version >= 8 then - Result := ReadDelphiXEOrMore(VersionStr, attri, key) + if Version >= 6 then + Result := ReadDelphi2009OrMore(VersionStr, attri, key) else - if Version >= 6 then - Result := ReadDelphi2009OrMore(VersionStr, attri, key) - else - Result := ReadDelphi8To2007(VersionStr, attri, key); + Result := ReadDelphi8To2007(VersionStr, attri, key); end else begin // Borland Delphi 7 or earlier if (settingTag[1] = '2') or (settingTag[1] = '3') @@ -1467,11 +1283,6 @@ function TSynPasSyn.UseUserSettings(VersionIndex: Integer): Boolean; iVersions: TStringList; iVersionTag: string; begin { ReadDelphiSettings } - {$IFDEF SYN_COMPILER_7_UP} - {$IFNDEF SYN_COMPILER_9_UP} - Result := False; // Silence the compiler warning - {$ENDIF} - {$ENDIF} iVersions := TStringList.Create; try EnumUserSettings(iVersions); @@ -1504,18 +1315,18 @@ function TSynPasSyn.UseUserSettings(VersionIndex: Integer): Boolean; if Result then begin - FAsmAttri.AssignColorAndStyle(tmpAsmAttri); - FCharAttri.AssignColorAndStyle(tmpStringAttri); { Delphi lacks Char attribute } - FCommentAttri.AssignColorAndStyle(tmpCommentAttri); - FDirecAttri.AssignColorAndStyle(tmpCommentAttri); { Delphi lacks Directive attribute } - FFloatAttri.AssignColorAndStyle(tmpNumberAttri); { Delphi lacks Float attribute } - FHexAttri.AssignColorAndStyle(tmpNumberAttri); { Delphi lacks Hex attribute } - FIdentifierAttri.AssignColorAndStyle(tmpIdentAttri); - FKeyAttri.AssignColorAndStyle(tmpKeyAttri); - FNumberAttri.AssignColorAndStyle(tmpNumberAttri); - FSpaceAttri.AssignColorAndStyle(tmpSpaceAttri); - FStringAttri.AssignColorAndStyle(tmpStringAttri); - FSymbolAttri.AssignColorAndStyle(tmpSymbolAttri); + fAsmAttri.AssignColorAndStyle(tmpAsmAttri); + fCharAttri.AssignColorAndStyle(tmpStringAttri); { Delphi lacks Char attribute } + fCommentAttri.AssignColorAndStyle(tmpCommentAttri); + fDirecAttri.AssignColorAndStyle(tmpCommentAttri); { Delphi lacks Directive attribute } + fFloatAttri.AssignColorAndStyle(tmpNumberAttri); { Delphi lacks Float attribute } + fHexAttri.AssignColorAndStyle(tmpNumberAttri); { Delphi lacks Hex attribute } + fIdentifierAttri.AssignColorAndStyle(tmpIdentAttri); + fKeyAttri.AssignColorAndStyle(tmpKeyAttri); + fNumberAttri.AssignColorAndStyle(tmpNumberAttri); + fSpaceAttri.AssignColorAndStyle(tmpSpaceAttri); + fStringAttri.AssignColorAndStyle(tmpStringAttri); + fSymbolAttri.AssignColorAndStyle(tmpSymbolAttri); end; tmpAsmAttri.Free; tmpCommentAttri.Free; @@ -1531,7 +1342,7 @@ function TSynPasSyn.UseUserSettings(VersionIndex: Integer): Boolean; Result := ReadDelphiSettings(VersionIndex); end; -function TSynPasSyn.GetSampleSource: UnicodeString; +function TSynPasSyn.GetSampleSource: string; begin Result := '{ Syntax highlighting }'#13#10 + 'procedure TForm1.Button1Click(Sender: TObject);'#13#10 + @@ -1564,44 +1375,293 @@ class function TSynPasSyn.GetLanguageName: string; class function TSynPasSyn.GetCapabilities: TSynHighlighterCapabilities; begin - Result := inherited GetCapabilities + [hcUserSettings]; + Result := inherited GetCapabilities + [hcUserSettings, hcStructureHighlight]; end; function TSynPasSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterPascal; + Result := fDefaultFilter <> SYNS_FilterPascal; end; procedure TSynPasSyn.SetDelphiVersion(const Value: TDelphiVersion); begin - if FDelphiVersion <> Value then + if fDelphiVersion <> Value then begin - FDelphiVersion := Value; - if (FDelphiVersion < dvDelphi3) and FPackageSource then - FPackageSource := False; + fDelphiVersion := Value; + if (fDelphiVersion < dvDelphi3) and fPackageSource then + fPackageSource := False; DefHighlightChange(Self); end; end; procedure TSynPasSyn.SetPackageSource(const Value: Boolean); begin - if FPackageSource <> Value then + if fPackageSource <> Value then begin - FPackageSource := Value; - if FPackageSource and (FDelphiVersion < dvDelphi3) then - FDelphiVersion := dvDelphi3; + fPackageSource := Value; + if fPackageSource and (fDelphiVersion < dvDelphi3) then + fDelphiVersion := dvDelphi3; DefHighlightChange(Self); end; end; -class function TSynPasSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynPasSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangPascal; end; +type + TRangeStates = set of TRangeState; + +const + FT_Standard = 1; // begin end, class end, record end + FT_Comment = 11; + FT_Asm = 12; + FT_ConditionalDirective = 15; + FT_CodeDeclaration = 16; + FT_CodeDeclarationWithBody = 17; + FT_Implementation = 18; + +procedure TSynPasSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine, ToLine: Integer); +var + CurLine: string; + Line: Integer; + + function BlockDelimiter(Line: Integer): Boolean; + var + BeginIndex: Integer; + EndIndex: Integer; + Match: TMatch; + MatchValue: string; + StructureHighlight: Boolean; + begin + BeginIndex := 0; + EndIndex := 0; + StructureHighlight := False; + + Match := RE_BlockBegin.Match(CurLine); + if Match.Success then + begin + // Char must have proper highlighting (ignore stuff inside comments...) + BeginIndex := Match.Index; + if GetHighlighterAttriAtRowCol(LinesToScan, Line, BeginIndex) <> fKeyAttri then + BeginIndex := -1 + else + begin + MatchValue := LowerCase(Match.Value); + StructureHighlight := (MatchValue = 'begin') or + (MatchValue = 'case') or (MatchValue = 'try'); + end; + end; + + Match := RE_BlockEnd.Match(CurLine); + if Match.Success then begin + begin + EndIndex := Match.Index; + if GetHighlighterAttriAtRowCol(LinesToScan, Line, EndIndex) <> fKeyAttri then + EndIndex := -1; + end; + end; + + Result := True; + if (BeginIndex <= 0) and (EndIndex <= 0) then + Result := False + else if (BeginIndex > 0) and (EndIndex <= 0) then + FoldRanges.StartFoldRange(Line + 1, FT_Standard, + IfThen(StructureHighlight, + LeftSpaces(CurLine, True, TabWidth(LinesToScan)), 0)) + else if (BeginIndex <= 0) and (EndIndex > 0) then + FoldRanges.StopFoldRange(Line + 1, FT_Standard) + else if EndIndex >= BeginIndex then + Result := False // begin end on the same line - ignore + else // end begin as in "end else begin" + FoldRanges.StopStartFoldRange(Line + 1, FT_Standard); + end; + + function FoldRegion(Line: Integer): Boolean; + var + S: string; + begin + Result := False; + S := TrimLeft(CurLine); + if Uppercase(Copy(S, 1, 8)) = '{$REGION' then + begin + FoldRanges.StartFoldRange(Line + 1, FoldRegionType); + Result := True; + end + else if Uppercase(Copy(S, 1, 11)) = '{$ENDREGION' then + begin + FoldRanges.StopFoldRange(Line + 1, FoldRegionType); + Result := True; + end; + end; + + function ConditionalDirective(Line: Integer): Boolean; + var + S: string; + begin + Result := False; + S := TrimLeft(CurLine); + if Uppercase(Copy(S, 1, 7)) = '{$IFDEF' then + begin + FoldRanges.StartFoldRange(Line + 1, FT_ConditionalDirective); + Result := True; + end + else if Uppercase(Copy(S, 1, 7)) = '{$ENDIF' then + begin + FoldRanges.StopFoldRange(Line + 1, FT_ConditionalDirective); + Result := True; + end + else if Uppercase(Copy(S, 1, 7)) = '{$IFEND' then + begin + FoldRanges.StopFoldRange(Line + 1, FT_ConditionalDirective); + Result := True; + end; + end; + + function IsMultiLineStatement(Line: Integer; Ranges: TRangeStates; + Fold: Boolean; FoldType: Integer = 1): Boolean; + begin + Result := True; + if TRangeState(GetLineRange(LinesToScan, Line)) in Ranges then + begin + if Fold and not (TRangeState(GetLineRange(LinesToScan, Line - 1)) in Ranges) then + FoldRanges.StartFoldRange(Line + 1, FoldType) + else + FoldRanges.NoFoldInfo(Line + 1); + end + else if Fold and (TRangeState(GetLineRange(LinesToScan, Line - 1)) in Ranges) then + begin + FoldRanges.StopFoldRange(Line + 1, FoldType); + end else + Result := False; + end; + +begin + for Line := FromLine to ToLine do + begin + // Deal first with Multiline statements + if IsMultiLineStatement(Line, [rsAnsi], True, FT_Comment) or + IsMultiLineStatement(Line, [rsAsm, rsAnsiAsm, rsBorAsm, rsDirectiveAsm], True, FT_Asm) or + IsMultiLineStatement(Line, [rsBor], True, FT_Comment) or + IsMultiLineStatement(Line, [rsDirective], False) + then + Continue; + + CurLine := LinesToScan[Line]; + + // Skip empty lines + if CurLine = '' then begin + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end; + + // Deal with ConditionalDirectives + if ConditionalDirective(Line) then + Continue; + + // Find Fold regions + if FoldRegion(Line) then + Continue; + + // Implementation + if Uppercase(TrimLeft(CurLine)) = 'IMPLEMENTATION' then + FoldRanges.StartFoldRange(Line +1, FT_Implementation) + // Functions and procedures + else if RE_Code.Matches(CurLine).Count > 0 then + FoldRanges.StartFoldRange(Line +1, FT_CodeDeclaration) + // Find begin or end (Fold Type 1) + else if not BlockDelimiter(Line) then + FoldRanges.NoFoldInfo(Line + 1); + end; //for Line +end; + +procedure TSynPasSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings); +{ + Provide folding for procedures and functions included nested ones. +} +var + I, j, SkipTo: Integer; + ImplementationIndex: Integer; + FoldRange: TSynFoldRange; + mc: TMatchCollection; +begin + ImplementationIndex := - 1; + for I := FoldRanges.Ranges.Count - 1 downto 0 do + begin + if FoldRanges.Ranges.List[I].FoldType = FT_Implementation then + ImplementationIndex := I + else if FoldRanges.Ranges.List[I].FoldType = FT_CodeDeclaration then + begin + if ImplementationIndex >= 0 then begin + // Code declaration in the Interface part of a unit + FoldRanges.Ranges.Delete(I); + Dec(ImplementationIndex); + Continue; + end; + // Examine the following ranges + SkipTo := 0; + j := I + 1; + while J < FoldRanges.Ranges.Count do begin + FoldRange := FoldRanges.Ranges.List[j]; + Inc(j); + case FoldRange.FoldType of + // Nested procedure or function + FT_CodeDeclarationWithBody: + begin + SkipTo := FoldRange.ToLine; + Continue; + end; + FT_Standard: + // possibly begin end; + if FoldRange.ToLine <= SkipTo then + Continue + else + begin + mc := RE_BlockBegin.Matches(LinesToScan[FoldRange.FromLine - 1]); + if mc.Count > 0 then + begin + if mc.Item[0].Value.ToLower = 'begin' then + begin + // function or procedure followed by begin end block + // Adjust ToLine + FoldRanges.Ranges.List[I].ToLine := FoldRange.ToLine; + FoldRanges.Ranges.List[I].FoldType := FT_CodeDeclarationWithBody; + Break + end else + begin + // class or record declaration follows, so + FoldRanges.Ranges.Delete(I); + Break; + end; + end else + Assert(False, 'TSynDWSSyn.AdjustFoldRanges'); + end; + else + begin + if FoldRange.ToLine <= SkipTo then + Continue + else begin + // Otherwise delete + // eg. function definitions within a class definition + FoldRanges.Ranges.Delete(I); + Break + end; + end; + end; + end; + end; + end; + if ImplementationIndex >= 0 then + // Looks better without it + //FoldRanges.Ranges.List[ImplementationIndex].ToLine := LinesToScan.Count; + FoldRanges.Ranges.Delete(ImplementationIndex); +end; + + initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynPasSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterPerl.pas b/Ext/SynEdit/Source/SynHighlighterPerl.pas index 5300190..fa74c1e 100644 --- a/Ext/SynEdit/Source/SynHighlighterPerl.pas +++ b/Ext/SynEdit/Source/SynHighlighterPerl.pas @@ -1,4 +1,4 @@ -{------------------------------------------------------------------------------- +{------------------------------------------------------------------------------- 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 @@ -12,7 +12,7 @@ The Original Code is based on the DcjSynPerl.pas file from the mwEdit component suite by Martin Waldenburg and other developers, the Initial Author of this file is Michael Trier. -Unicode translation by Maël Hörz. +Unicode translation by Maël Hörz. All Rights Reserved. Contributors to the SynEdit and mwEdit projects are listed in the @@ -28,11 +28,6 @@ If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: SynHighlighterPerl.pas,v 1.14.2.8 2008/09/14 16:25:01 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - Known Issues: - Using q, qq, qw, qx, m, s, tr will not properly parse the contained information. @@ -56,315 +51,48 @@ interface Graphics, SynEditTypes, SynEditHighlighter, - SynUnicode, + Windows, //Fiala SysUtils, - Classes; + SynUnicode, + Classes, +//++ CodeFolding + SynEditCodeFolding; +//++ CodeFolding type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkOperator, - tkPragma, tkSpace, tkString, tkSymbol, tkUnknown, tkVariable); + TtkTokenKind = (tkSymbol, tkKey, tkComment, tkIdentifier, tkNull, tkNumber, tkOperator, + tkPragma, tkSpace, tkString, tkUnknown, tkVariable); + + TRangeState = (rsUnknown, rsString, rsQuotedString); PIdentFuncTableFunc = ^TIdentFuncTableFunc; TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - TSynPerlSyn = class(TSynCustomHighlighter) +// TSynPerlSyn = class(TSynCustomHighlighter) +//++ CodeFolding + TSynPerlSyn = class(TSynCustomCodeFoldingHighlighter) +//-- CodeFolding private + FRange: TRangeState; //Fiala FTokenID: TtkTokenKind; - FIdentFuncTable: array[0..2422] of TIdentFuncTableFunc; - FCommentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FInvalidAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FOperatorAttri: TSynHighlighterAttributes; - FPragmaAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FVariableAttri: TSynHighlighterAttributes; + fIdentFuncTable: array[0..2728] of TIdentFuncTableFunc; //Fiala + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fInvalidAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fOperatorAttri: TSynHighlighterAttributes; + fPragmaAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fVariableAttri: TSynHighlighterAttributes; function AltFunc(Index: Integer): TtkTokenKind; - function Func36accumulator(Index: Integer): TtkTokenKind; - function Func36arg(Index: Integer): TtkTokenKind; - function Func36argv(Index: Integer): TtkTokenKind; - function Func36basetime(Index: Integer): TtkTokenKind; - function Func36child95error(Index: Integer): TtkTokenKind; - function Func36debugging(Index: Integer): TtkTokenKind; - function Func36effective95group95id(Index: Integer): TtkTokenKind; - function Func36effective95user95id(Index: Integer): TtkTokenKind; - function Func36egid(Index: Integer): TtkTokenKind; - function Func36env(Index: Integer): TtkTokenKind; - function Func36errno(Index: Integer): TtkTokenKind; - function Func36euid(Index: Integer): TtkTokenKind; - function Func36eval95error(Index: Integer): TtkTokenKind; - function Func36executable95name(Index: Integer): TtkTokenKind; - function Func36format95formfeed(Index: Integer): TtkTokenKind; - function Func36format95line95break95characters(Index: Integer): TtkTokenKind; - function Func36format95lines95left(Index: Integer): TtkTokenKind; - function Func36format95lines95per95page(Index: Integer): TtkTokenKind; - function Func36format95name(Index: Integer): TtkTokenKind; - function Func36format95page95number(Index: Integer): TtkTokenKind; - function Func36format95top95name(Index: Integer): TtkTokenKind; - function Func36gid(Index: Integer): TtkTokenKind; - function Func36inplace95edit(Index: Integer): TtkTokenKind; - function Func36input95line95number(Index: Integer): TtkTokenKind; - function Func36input95record95separator(Index: Integer): TtkTokenKind; - function Func36last95paren95match(Index: Integer): TtkTokenKind; - function Func36list95separator(Index: Integer): TtkTokenKind; - function Func36match(Index: Integer): TtkTokenKind; - function Func36multiline95matching(Index: Integer): TtkTokenKind; - function Func36nr(Index: Integer): TtkTokenKind; - function Func36ofmt(Index: Integer): TtkTokenKind; - function Func36ors(Index: Integer): TtkTokenKind; - function Func36os95error(Index: Integer): TtkTokenKind; - function Func36output95autoflush(Index: Integer): TtkTokenKind; - function Func36output95field95separator(Index: Integer): TtkTokenKind; - function Func36perl95version(Index: Integer): TtkTokenKind; - function Func36perldb(Index: Integer): TtkTokenKind; - function Func36pid(Index: Integer): TtkTokenKind; - function Func36postmatch(Index: Integer): TtkTokenKind; - function Func36prematch(Index: Integer): TtkTokenKind; - function Func36process95id(Index: Integer): TtkTokenKind; - function Func36program95name(Index: Integer): TtkTokenKind; - function Func36real95group95id(Index: Integer): TtkTokenKind; - function Func36real95user95id(Index: Integer): TtkTokenKind; - function Func36rs(Index: Integer): TtkTokenKind; - function Func36sig(Index: Integer): TtkTokenKind; - function Func36subscript95separator(Index: Integer): TtkTokenKind; - function Func36subsep(Index: Integer): TtkTokenKind; - function Func36system95fd95max(Index: Integer): TtkTokenKind; - function Func36uid(Index: Integer): TtkTokenKind; - function Func36warning(Index: Integer): TtkTokenKind; - function Func37inc(Index: Integer): TtkTokenKind; - function Func64argv(Index: Integer): TtkTokenKind; - function Func64inc(Index: Integer): TtkTokenKind; - function FuncAbs(Index: Integer): TtkTokenKind; - function FuncAccept(Index: Integer): TtkTokenKind; - function FuncAlarm(Index: Integer): TtkTokenKind; - function FuncAnd(Index: Integer): TtkTokenKind; - function FuncAtan2(Index: Integer): TtkTokenKind; - function FuncBind(Index: Integer): TtkTokenKind; - function FuncBinmode(Index: Integer): TtkTokenKind; - function FuncBless(Index: Integer): TtkTokenKind; - function FuncCaller(Index: Integer): TtkTokenKind; - function FuncChdir(Index: Integer): TtkTokenKind; - function FuncChmod(Index: Integer): TtkTokenKind; - function FuncChomp(Index: Integer): TtkTokenKind; - function FuncChop(Index: Integer): TtkTokenKind; - function FuncChown(Index: Integer): TtkTokenKind; - function FuncChr(Index: Integer): TtkTokenKind; - function FuncChroot(Index: Integer): TtkTokenKind; - function FuncClose(Index: Integer): TtkTokenKind; - function FuncClosedir(Index: Integer): TtkTokenKind; - function FuncCmp(Index: Integer): TtkTokenKind; - function FuncConnect(Index: Integer): TtkTokenKind; - function FuncConstant(Index: Integer): TtkTokenKind; - function FuncCos(Index: Integer): TtkTokenKind; - function FuncCrypt(Index: Integer): TtkTokenKind; - function FuncDbmclose(Index: Integer): TtkTokenKind; - function FuncDbmopen(Index: Integer): TtkTokenKind; - function FuncDefined(Index: Integer): TtkTokenKind; - function FuncDelete(Index: Integer): TtkTokenKind; - function FuncDiagnostics(Index: Integer): TtkTokenKind; - function FuncDie(Index: Integer): TtkTokenKind; - function FuncDo(Index: Integer): TtkTokenKind; - function FuncDump(Index: Integer): TtkTokenKind; - function FuncEach(Index: Integer): TtkTokenKind; - function FuncElse(Index: Integer): TtkTokenKind; - function FuncElsif(Index: Integer): TtkTokenKind; - function FuncEndgrent(Index: Integer): TtkTokenKind; - function FuncEndhostent(Index: Integer): TtkTokenKind; - function FuncEndnetent(Index: Integer): TtkTokenKind; - function FuncEndprotoent(Index: Integer): TtkTokenKind; - function FuncEndpwent(Index: Integer): TtkTokenKind; - function FuncEndservent(Index: Integer): TtkTokenKind; - function FuncEof(Index: Integer): TtkTokenKind; - function FuncEq(Index: Integer): TtkTokenKind; - function FuncEval(Index: Integer): TtkTokenKind; - function FuncExec(Index: Integer): TtkTokenKind; - function FuncExists(Index: Integer): TtkTokenKind; - function FuncExit(Index: Integer): TtkTokenKind; - function FuncExp(Index: Integer): TtkTokenKind; - function FuncFcntl(Index: Integer): TtkTokenKind; - function FuncFileno(Index: Integer): TtkTokenKind; - function FuncFlock(Index: Integer): TtkTokenKind; - function FuncFor(Index: Integer): TtkTokenKind; - function FuncForeach(Index: Integer): TtkTokenKind; - function FuncFork(Index: Integer): TtkTokenKind; - function FuncFormat(Index: Integer): TtkTokenKind; - function FuncFormline(Index: Integer): TtkTokenKind; - function FuncGe(Index: Integer): TtkTokenKind; - function FuncGetc(Index: Integer): TtkTokenKind; - function FuncGetgrent(Index: Integer): TtkTokenKind; - function FuncGetgrgid(Index: Integer): TtkTokenKind; - function FuncGetgrnam(Index: Integer): TtkTokenKind; - function FuncGethostbyaddr(Index: Integer): TtkTokenKind; - function FuncGethostbyname(Index: Integer): TtkTokenKind; - function FuncGethostent(Index: Integer): TtkTokenKind; - function FuncGetlogin(Index: Integer): TtkTokenKind; - function FuncGetnetbyaddr(Index: Integer): TtkTokenKind; - function FuncGetnetbyname(Index: Integer): TtkTokenKind; - function FuncGetnetent(Index: Integer): TtkTokenKind; - function FuncGetpeername(Index: Integer): TtkTokenKind; - function FuncGetpgrp(Index: Integer): TtkTokenKind; - function FuncGetppid(Index: Integer): TtkTokenKind; - function FuncGetpriority(Index: Integer): TtkTokenKind; - function FuncGetprotobyname(Index: Integer): TtkTokenKind; - function FuncGetprotobynumber(Index: Integer): TtkTokenKind; - function FuncGetprotoent(Index: Integer): TtkTokenKind; - function FuncGetpwent(Index: Integer): TtkTokenKind; - function FuncGetpwnam(Index: Integer): TtkTokenKind; - function FuncGetpwuid(Index: Integer): TtkTokenKind; - function FuncGetservbyname(Index: Integer): TtkTokenKind; - function FuncGetservbyport(Index: Integer): TtkTokenKind; - function FuncGetservent(Index: Integer): TtkTokenKind; - function FuncGetsockname(Index: Integer): TtkTokenKind; - function FuncGetsockopt(Index: Integer): TtkTokenKind; - function FuncGlob(Index: Integer): TtkTokenKind; - function FuncGmtime(Index: Integer): TtkTokenKind; - function FuncGoto(Index: Integer): TtkTokenKind; - function FuncGrep(Index: Integer): TtkTokenKind; - function FuncGt(Index: Integer): TtkTokenKind; - function FuncHex(Index: Integer): TtkTokenKind; - function FuncIf(Index: Integer): TtkTokenKind; - function FuncImport(Index: Integer): TtkTokenKind; - function FuncIndex(Index: Integer): TtkTokenKind; - function FuncInt(Index: Integer): TtkTokenKind; - function FuncInteger(Index: Integer): TtkTokenKind; - function FuncIoctl(Index: Integer): TtkTokenKind; - function FuncJoin(Index: Integer): TtkTokenKind; - function FuncKeys(Index: Integer): TtkTokenKind; - function FuncKill(Index: Integer): TtkTokenKind; - function FuncLast(Index: Integer): TtkTokenKind; - function FuncLc(Index: Integer): TtkTokenKind; - function FuncLcfirst(Index: Integer): TtkTokenKind; - function FuncLe(Index: Integer): TtkTokenKind; - function FuncLength(Index: Integer): TtkTokenKind; - function FuncLess(Index: Integer): TtkTokenKind; - function FuncLink(Index: Integer): TtkTokenKind; - function FuncListen(Index: Integer): TtkTokenKind; - function FuncLocal(Index: Integer): TtkTokenKind; - function FuncLocale(Index: Integer): TtkTokenKind; - function FuncLocaltime(Index: Integer): TtkTokenKind; - function FuncLog(Index: Integer): TtkTokenKind; - function FuncLstat(Index: Integer): TtkTokenKind; - function FuncLt(Index: Integer): TtkTokenKind; - function FuncM(Index: Integer): TtkTokenKind; - function FuncMap(Index: Integer): TtkTokenKind; - function FuncMkdir(Index: Integer): TtkTokenKind; - function FuncMsgctl(Index: Integer): TtkTokenKind; - function FuncMsgget(Index: Integer): TtkTokenKind; - function FuncMsgrcv(Index: Integer): TtkTokenKind; - function FuncMsgsnd(Index: Integer): TtkTokenKind; - function FuncMy(Index: Integer): TtkTokenKind; - function FuncNe(Index: Integer): TtkTokenKind; - function FuncNext(Index: Integer): TtkTokenKind; - function FuncNo(Index: Integer): TtkTokenKind; - function FuncNot(Index: Integer): TtkTokenKind; - function FuncOct(Index: Integer): TtkTokenKind; - function FuncOpen(Index: Integer): TtkTokenKind; - function FuncOpendir(Index: Integer): TtkTokenKind; - function FuncOr(Index: Integer): TtkTokenKind; - function FuncOrd(Index: Integer): TtkTokenKind; - function FuncPack(Index: Integer): TtkTokenKind; - function FuncPackage(Index: Integer): TtkTokenKind; - function FuncPipe(Index: Integer): TtkTokenKind; - function FuncPop(Index: Integer): TtkTokenKind; - function FuncPos(Index: Integer): TtkTokenKind; - function FuncPrint(Index: Integer): TtkTokenKind; - function FuncPush(Index: Integer): TtkTokenKind; - function FuncQ(Index: Integer): TtkTokenKind; - function FuncQq(Index: Integer): TtkTokenKind; - function FuncQuotemeta(Index: Integer): TtkTokenKind; - function FuncQw(Index: Integer): TtkTokenKind; - function FuncQx(Index: Integer): TtkTokenKind; - function FuncRand(Index: Integer): TtkTokenKind; - function FuncRead(Index: Integer): TtkTokenKind; - function FuncReaddir(Index: Integer): TtkTokenKind; - function FuncReadlink(Index: Integer): TtkTokenKind; - function FuncRecv(Index: Integer): TtkTokenKind; - function FuncRedo(Index: Integer): TtkTokenKind; - function FuncRef(Index: Integer): TtkTokenKind; - function FuncRename(Index: Integer): TtkTokenKind; - function FuncRequire(Index: Integer): TtkTokenKind; - function FuncReset(Index: Integer): TtkTokenKind; - function FuncReturn(Index: Integer): TtkTokenKind; - function FuncReverse(Index: Integer): TtkTokenKind; - function FuncRewinddir(Index: Integer): TtkTokenKind; - function FuncRindex(Index: Integer): TtkTokenKind; - function FuncRmdir(Index: Integer): TtkTokenKind; - function FuncScalar(Index: Integer): TtkTokenKind; - function FuncSeek(Index: Integer): TtkTokenKind; - function FuncSeekdir(Index: Integer): TtkTokenKind; - function FuncSelect(Index: Integer): TtkTokenKind; - function FuncSemctl(Index: Integer): TtkTokenKind; - function FuncSemget(Index: Integer): TtkTokenKind; - function FuncSemop(Index: Integer): TtkTokenKind; - function FuncSend(Index: Integer): TtkTokenKind; - function FuncSetgrent(Index: Integer): TtkTokenKind; - function FuncSethostent(Index: Integer): TtkTokenKind; - function FuncSetnetent(Index: Integer): TtkTokenKind; - function FuncSetpgrp(Index: Integer): TtkTokenKind; - function FuncSetpriority(Index: Integer): TtkTokenKind; - function FuncSetprotoent(Index: Integer): TtkTokenKind; - function FuncSetpwent(Index: Integer): TtkTokenKind; - function FuncSetservent(Index: Integer): TtkTokenKind; - function FuncSetsockopt(Index: Integer): TtkTokenKind; - function FuncShift(Index: Integer): TtkTokenKind; - function FuncShmctl(Index: Integer): TtkTokenKind; - function FuncShmget(Index: Integer): TtkTokenKind; - function FuncShmread(Index: Integer): TtkTokenKind; - function FuncShmwrite(Index: Integer): TtkTokenKind; - function FuncShutdown(Index: Integer): TtkTokenKind; - function FuncSigtrap(Index: Integer): TtkTokenKind; - function FuncSin(Index: Integer): TtkTokenKind; - function FuncSleep(Index: Integer): TtkTokenKind; - function FuncSocket(Index: Integer): TtkTokenKind; - function FuncSocketpair(Index: Integer): TtkTokenKind; - function FuncSort(Index: Integer): TtkTokenKind; - function FuncSplice(Index: Integer): TtkTokenKind; - function FuncSplit(Index: Integer): TtkTokenKind; - function FuncSprintf(Index: Integer): TtkTokenKind; - function FuncSqrt(Index: Integer): TtkTokenKind; - function FuncSrand(Index: Integer): TtkTokenKind; - function FuncStat(Index: Integer): TtkTokenKind; - function FuncStrict(Index: Integer): TtkTokenKind; - function FuncStudy(Index: Integer): TtkTokenKind; - function FuncSub(Index: Integer): TtkTokenKind; - function FuncSubs(Index: Integer): TtkTokenKind; - function FuncSubstr(Index: Integer): TtkTokenKind; - function FuncSymlink(Index: Integer): TtkTokenKind; - function FuncSyscall(Index: Integer): TtkTokenKind; - function FuncSysread(Index: Integer): TtkTokenKind; - function FuncSystem(Index: Integer): TtkTokenKind; - function FuncSyswrite(Index: Integer): TtkTokenKind; - function FuncTell(Index: Integer): TtkTokenKind; - function FuncTelldir(Index: Integer): TtkTokenKind; - function FuncTie(Index: Integer): TtkTokenKind; - function FuncTime(Index: Integer): TtkTokenKind; - function FuncTimes(Index: Integer): TtkTokenKind; - function FuncTr(Index: Integer): TtkTokenKind; - function FuncTruncate(Index: Integer): TtkTokenKind; - function FuncUc(Index: Integer): TtkTokenKind; - function FuncUcfirst(Index: Integer): TtkTokenKind; - function FuncUmask(Index: Integer): TtkTokenKind; - function FuncUndef(Index: Integer): TtkTokenKind; - function FuncUnless(Index: Integer): TtkTokenKind; - function FuncUnlink(Index: Integer): TtkTokenKind; - function FuncUnpack(Index: Integer): TtkTokenKind; - function FuncUnshift(Index: Integer): TtkTokenKind; - function FuncUntie(Index: Integer): TtkTokenKind; - function FuncUse(Index: Integer): TtkTokenKind; - function FuncUtime(Index: Integer): TtkTokenKind; - function FuncValues(Index: Integer): TtkTokenKind; - function FuncVars(Index: Integer): TtkTokenKind; - function FuncVec(Index: Integer): TtkTokenKind; - function FuncWait(Index: Integer): TtkTokenKind; - function FuncWaitpid(Index: Integer): TtkTokenKind; - function FuncWantarray(Index: Integer): TtkTokenKind; - function FuncWarn(Index: Integer): TtkTokenKind; - function FuncWhile(Index: Integer): TtkTokenKind; - function FuncWrite(Index: Integer): TtkTokenKind; - function FuncXor(Index: Integer): TtkTokenKind; + function FuncVar(Index: Integer): TtkTokenKind; + function FuncKey(Index: Integer): TtkTokenKind; + function FuncOperator(Index: Integer): TtkTokenKind; + function FuncPragma(Index: Integer): TtkTokenKind; + function HashKey(Str: PWideChar): Cardinal; function IdentKind(MayBe: PWideChar): TtkTokenKind; procedure InitIdent; @@ -383,20 +111,23 @@ TSynPerlSyn = class(TSynCustomHighlighter) procedure NumberProc; procedure OrSymbolProc; procedure PlusProc; + procedure qFunctionProc; procedure SlashProc; procedure SpaceProc; procedure StarProc; procedure StringInterpProc; procedure StringLiteralProc; + procedure StringEndProc; procedure SymbolProc; procedure XOrSymbolProc; procedure UnknownProc; + procedure VariableProc; //Fiala protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; @@ -406,2836 +137,430 @@ TSynPerlSyn = class(TSynCustomHighlighter) function GetTokenAttribute: TSynHighlighterAttributes; override; function GetTokenKind: Integer; override; function IsIdentChar(AChar: WideChar): Boolean; override; + function IsWordBreakChar(AChar: WideChar): Boolean; override; //Fiala procedure Next; override; - published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri - write FInvalidAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property OperatorAttri: TSynHighlighterAttributes read FOperatorAttri - write FOperatorAttri; - property PragmaAttri: TSynHighlighterAttributes read FPragmaAttri - write FPragmaAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; - property VariableAttri: TSynHighlighterAttributes read FVariableAttri - write FVariableAttri; - end; - -implementation - -uses - SynEditStrConst; - -const - KeyWords: array[0..281] of UnicodeString = ( - '$ACCUMULATOR', '$ARG', '$ARGV', '$BASETIME', '$CHILD_ERROR', '$DEBUGGING', - '$EFFECTIVE_GROUP_ID', '$EFFECTIVE_USER_ID', '$EGID', '$ENV', '$ERRNO', - '$EUID', '$EVAL_ERROR', '$EXECUTABLE_NAME', '$FORMAT_FORMFEED', - '$FORMAT_LINE_BREAK_CHARACTERS', '$FORMAT_LINES_LEFT', - '$FORMAT_LINES_PER_PAGE', '$FORMAT_NAME', '$FORMAT_PAGE_NUMBER', - '$FORMAT_TOP_NAME', '$GID', '$INPLACE_EDIT', '$INPUT_LINE_NUMBER', - '$INPUT_RECORD_SEPARATOR', '$LAST_PAREN_MATCH', '$LIST_SEPARATOR', '$MATCH', - '$MULTILINE_MATCHING', '$NR', '$OFMT', '$ORS', '$OS_ERROR', - '$OUTPUT_AUTOFLUSH', '$OUTPUT_FIELD_SEPARATOR', '$PERL_VERSION', '$PERLDB', - '$PID', '$POSTMATCH', '$PREMATCH', '$PROCESS_ID', '$PROGRAM_NAME', - '$REAL_GROUP_ID', '$REAL_USER_ID', '$RS', '$SIG', '$SUBSCRIPT_SEPARATOR', - '$SUBSEP', '$SYSTEM_FD_MAX', '$UID', '$WARNING', '%INC', '@ARGV', '@INC', - 'abs', 'accept', 'alarm', 'and', 'atan2', 'bind', 'binmode', 'bless', - 'caller', 'chdir', 'chmod', 'chomp', 'chop', 'chown', 'chr', 'chroot', - 'close', 'closedir', 'cmp', 'connect', 'constant', 'cos', 'crypt', - 'dbmclose', 'dbmopen', 'defined', 'delete', 'diagnostics', 'die', 'do', - 'dump', 'each', 'else', 'elsif', 'endgrent', 'endhostent', 'endnetent', - 'endprotoent', 'endpwent', 'endservent', 'eof', 'eq', 'eval', 'exec', - 'exists', 'exit', 'exp', 'fcntl', 'fileno', 'flock', 'for', 'foreach', - 'fork', 'format', 'formline', 'ge', 'getc', 'getgrent', 'getgrgid', - 'getgrnam', 'gethostbyaddr', 'gethostbyname', 'gethostent', 'getlogin', - 'getnetbyaddr', 'getnetbyname', 'getnetent', 'getpeername', 'getpgrp', - 'getppid', 'getpriority', 'getprotobyname', 'getprotobynumber', - 'getprotoent', 'getpwent', 'getpwnam', 'getpwuid', 'getservbyname', - 'getservbyport', 'getservent', 'getsockname', 'getsockopt', 'glob', - 'gmtime', 'goto', 'grep', 'gt', 'hex', 'if', 'import', 'index', 'int', - 'integer', 'ioctl', 'join', 'keys', 'kill', 'last', 'lc', 'lcfirst', 'le', - 'length', 'less', 'link', 'listen', 'local', 'locale', 'localtime', 'log', - 'lstat', 'lt', 'm', 'map', 'mkdir', 'msgctl', 'msgget', 'msgrcv', 'msgsnd', - 'my', 'ne', 'next', 'no', 'not', 'oct', 'open', 'opendir', 'or', 'ord', - 'pack', 'package', 'pipe', 'pop', 'pos', 'print', 'push', 'q', 'qq', - 'quotemeta', 'qw', 'qx', 'rand', 'read', 'readdir', 'readlink', 'recv', - 'redo', 'ref', 'rename', 'require', 'reset', 'return', 'reverse', - 'rewinddir', 'rindex', 'rmdir', 'scalar', 'seek', 'seekdir', 'select', - 'semctl', 'semget', 'semop', 'send', 'setgrent', 'sethostent', 'setnetent', - 'setpgrp', 'setpriority', 'setprotoent', 'setpwent', 'setservent', - 'setsockopt', 'shift', 'shmctl', 'shmget', 'shmread', 'shmwrite', - 'shutdown', 'sigtrap', 'sin', 'sleep', 'socket', 'socketpair', 'sort', - 'splice', 'split', 'sprintf', 'sqrt', 'srand', 'stat', 'strict', 'study', - 'sub', 'subs', 'substr', 'symlink', 'syscall', 'sysread', 'system', - 'syswrite', 'tell', 'telldir', 'tie', 'time', 'times', 'tr', 'truncate', - 'uc', 'ucfirst', 'umask', 'undef', 'unless', 'unlink', 'unpack', 'unshift', - 'untie', 'use', 'utime', 'values', 'vars', 'vec', 'wait', 'waitpid', - 'wantarray', 'warn', 'while', 'write', 'xor' - ); - - KeyIndices: array[0..2422] of Integer = ( - -1, -1, 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 62, -1, -1, -1, -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, -1, - -1, -1, -1, -1, 212, 189, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 55, -1, 242, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 77, 247, - -1, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, -1, - 155, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, -1, -1, -1, -1, -1, 254, -1, - -1, -1, -1, -1, -1, -1, -1, 253, -1, 273, -1, -1, -1, 180, -1, -1, -1, -1, - 41, -1, -1, 18, -1, 173, -1, -1, -1, -1, -1, -1, -1, -1, -1, 243, -1, 132, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 172, -1, 45, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 44, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 208, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 281, -1, 142, -1, -1, -1, -1, 233, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 23, -1, 7, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 87, 179, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 256, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 165, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 198, -1, -1, -1, -1, -1, 116, 124, -1, -1, 203, 47, -1, -1, -1, -1, - 150, -1, -1, -1, 205, -1, -1, 152, -1, -1, 271, -1, -1, -1, -1, 76, 92, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 186, -1, -1, -1, 207, -1, -1, -1, - -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, 175, -1, -1, -1, -1, -1, -1, 153, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 11, -1, 170, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 258, -1, -1, -1, -1, 99, -1, -1, -1, -1, 22, -1, -1, 33, -1, - -1, -1, -1, -1, -1, -1, -1, 135, -1, -1, -1, -1, -1, -1, -1, -1, 227, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 259, 228, -1, -1, -1, -1, 115, -1, -1, 215, -1, -1, -1, -1, -1, -1, -1, 167, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 158, 40, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 174, -1, 169, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 4, -1, -1, -1, 59, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 197, -1, -1, 32, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 261, -1, -1, - 276, -1, -1, -1, -1, -1, -1, -1, -1, 266, -1, -1, -1, -1, 101, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 144, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 75, -1, -1, 38, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 190, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 2, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 262, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 239, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 202, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, 49, -1, -1, -1, -1, - -1, -1, -1, 112, -1, -1, 20, -1, -1, -1, -1, -1, 238, -1, -1, 8, -1, 249, - -1, -1, -1, -1, -1, -1, 246, -1, 232, 216, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 146, 54, -1, -1, -1, -1, -1, -1, -1, -1, 39, -1, -1, -1, -1, -1, -1, - 218, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 214, -1, -1, -1, -1, 277, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 89, 183, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 6, -1, -1, -1, 79, -1, -1, -1, - -1, -1, 86, 63, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 267, 48, 131, 91, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 69, -1, -1, -1, -1, -1, 94, -1, -1, -1, -1, -1, -1, -1, 270, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 109, -1, 166, -1, 73, -1, -1, -1, -1, -1, - -1, -1, 43, -1, -1, -1, -1, -1, -1, 279, -1, 26, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 68, -1, 280, -1, -1, -1, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 278, -1, 184, -1, -1, -1, -1, -1, -1, -1, -1, 206, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 264, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 163, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 176, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, 117, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 250, -1, -1, -1, -1, -1, -1, -1, 244, -1, -1, -1, - -1, -1, 129, -1, -1, -1, -1, -1, 95, -1, 234, -1, -1, -1, -1, -1, -1, -1, - -1, 231, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 230, -1, 138, -1, -1, - -1, -1, -1, 191, -1, 200, -1, -1, -1, 125, -1, -1, 268, 108, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 178, -1, -1, -1, -1, -1, -1, -1, 185, -1, -1, 66, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 194, -1, 222, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 143, -1, 226, 182, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, - -1, -1, -1, -1, -1, -1, 251, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, - 113, -1, -1, -1, -1, -1, -1, -1, 37, -1, 71, -1, 15, -1, -1, -1, 154, 257, - -1, -1, -1, -1, 209, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 160, -1, -1, -1, 126, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 240, -1, -1, -1, -1, -1, -1, 241, -1, -1, -1, -1, -1, -1, 275, -1, -1, -1, - -1, -1, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, 139, -1, -1, -1, -1, -1, - -1, -1, -1, 100, -1, -1, 13, -1, -1, -1, -1, -1, -1, -1, 177, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 223, -1, -1, -1, -1, -1, -1, 130, -1, -1, 97, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 224, -1, -1, -1, -1, -1, 196, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 120, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 114, -1, 148, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, 274, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 137, 35, 159, -1, -1, -1, -1, -1, -1, -1, 260, -1, - -1, -1, -1, -1, 24, -1, 118, 245, -1, -1, 88, -1, -1, -1, -1, -1, -1, -1, - -1, 211, 119, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 187, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 217, -1, -1, -1, -1, -1, 237, -1, -1, -1, -1, 188, 147, - -1, 50, -1, -1, -1, -1, -1, -1, 103, -1, -1, -1, -1, -1, 96, 181, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 14, -1, -1, -1, - -1, 210, 27, -1, 136, -1, -1, 106, -1, -1, -1, -1, -1, -1, -1, 107, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 236, -1, -1, -1, - -1, 141, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 85, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, -1, 164, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 265, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 193, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, - 121, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, - -1, -1, -1, 51, -1, -1, -1, -1, -1, -1, -1, -1, 151, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 98, 213, -1, -1, -1, -1, 5, - -1, 219, -1, -1, -1, -1, 162, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, - -1, -1, 221, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 12, -1, 255, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 272, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 56, -1, -1, -1, -1, 83, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 82, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 195, 225, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, 171, - -1, -1, -1, 157, 149, -1, -1, -1, -1, -1, -1, 127, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 252, -1, -1, -1, 65, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 229, -1, -1, -1, -1, -1, -1, -1, 199, -1, -1, -1, 105, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 248, -1, -1, -1, -1, 104, -1, -1, - -1, -1, -1, -1, 3, -1, -1, -1, -1, -1, -1, -1, 269, -1, -1, -1, -1, -1, -1, - -1, 220, 110, -1, -1, -1, 128, -1, -1, -1, -1, 235, 263, -1, -1, -1, -1, -1, - -1, -1, 201, -1, -1, -1, -1, -1, 29, -1, 156, -1, -1, -1, 19, -1, 123, -1, - 204, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 57, -1, -1, 145, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 84, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 90, -1, -1, -1, -1, -1, - 80, -1, -1, -1, -1 - ); - -{$Q-} -function TSynPerlSyn.HashKey(Str: PWideChar): Cardinal; -begin - Result := 0; - while IsIdentChar(Str^) or CharInSet(Str^, ['$', '%', '@']) do - begin - Result := Result * 975 + Ord(Str^) * 515; - Inc(Str); - end; - Result := Result mod 2423; - FStringLen := Str - FToIdent; -end; -{$Q+} - -function TSynPerlSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; -var - Key: Cardinal; -begin - FToIdent := MayBe; - Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) - else - Result := tkIdentifier; -end; - -procedure TSynPerlSyn.InitIdent; -var - i: Integer; -begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; - - FIdentFuncTable[368] := Func36accumulator; - FIdentFuncTable[2] := Func36arg; - FIdentFuncTable[804] := Func36argv; - FIdentFuncTable[2272] := Func36basetime; - FIdentFuncTable[626] := Func36child95error; - FIdentFuncTable[2026] := Func36debugging; - FIdentFuncTable[981] := Func36effective95group95id; - FIdentFuncTable[317] := Func36effective95user95id; - FIdentFuncTable[876] := Func36egid; - FIdentFuncTable[141] := Func36env; - FIdentFuncTable[35] := Func36errno; - FIdentFuncTable[495] := Func36euid; - FIdentFuncTable[2067] := Func36eval95error; - FIdentFuncTable[1589] := Func36executable95name; - FIdentFuncTable[1835] := Func36format95formfeed; - FIdentFuncTable[1465] := Func36format95line95break95characters; - FIdentFuncTable[1415] := Func36format95lines95left; - FIdentFuncTable[201] := Func36format95lines95per95page; - FIdentFuncTable[172] := Func36format95name; - FIdentFuncTable[2319] := Func36format95page95number; - FIdentFuncTable[867] := Func36format95top95name; - FIdentFuncTable[1237] := Func36gid; - FIdentFuncTable[519] := Func36inplace95edit; - FIdentFuncTable[315] := Func36input95line95number; - FIdentFuncTable[1733] := Func36input95record95separator; - FIdentFuncTable[1923] := Func36last95paren95match; - FIdentFuncTable[1093] := Func36list95separator; - FIdentFuncTable[1841] := Func36match; - FIdentFuncTable[2201] := Func36multiline95matching; - FIdentFuncTable[2313] := Func36nr; - FIdentFuncTable[2149] := Func36ofmt; - FIdentFuncTable[955] := Func36ors; - FIdentFuncTable[648] := Func36os95error; - FIdentFuncTable[522] := Func36output95autoflush; - FIdentFuncTable[97] := Func36output95field95separator; - FIdentFuncTable[1718] := Func36perl95version; - FIdentFuncTable[1568] := Func36perldb; - FIdentFuncTable[1461] := Func36pid; - FIdentFuncTable[723] := Func36postmatch; - FIdentFuncTable[908] := Func36prematch; - FIdentFuncTable[594] := Func36process95id; - FIdentFuncTable[169] := Func36program95name; - FIdentFuncTable[2182] := Func36real95group95id; - FIdentFuncTable[1084] := Func36real95user95id; - FIdentFuncTable[238] := Func36rs; - FIdentFuncTable[220] := Func36sig; - FIdentFuncTable[261] := Func36subscript95separator; - FIdentFuncTable[427] := Func36subsep; - FIdentFuncTable[1016] := Func36system95fd95max; - FIdentFuncTable[856] := Func36uid; - FIdentFuncTable[1803] := Func36warning; - FIdentFuncTable[1992] := Func37inc; - FIdentFuncTable[1181] := Func64argv; - FIdentFuncTable[1004] := Func64inc; - FIdentFuncTable[899] := FuncAbs; - FIdentFuncTable[79] := FuncAccept; - FIdentFuncTable[2102] := FuncAlarm; - FIdentFuncTable[2365] := FuncAnd; - FIdentFuncTable[1501] := FuncAtan2; - FIdentFuncTable[630] := FuncBind; - FIdentFuncTable[125] := FuncBinmode; - FIdentFuncTable[1110] := FuncBless; - FIdentFuncTable[19] := FuncCaller; - FIdentFuncTable[992] := FuncChdir; - FIdentFuncTable[2236] := FuncChmod; - FIdentFuncTable[2200] := FuncChomp; - FIdentFuncTable[1341] := FuncChop; - FIdentFuncTable[1964] := FuncChown; - FIdentFuncTable[1103] := FuncChr; - FIdentFuncTable[1046] := FuncChroot; - FIdentFuncTable[846] := FuncClose; - FIdentFuncTable[1463] := FuncClosedir; - FIdentFuncTable[470] := FuncCmp; - FIdentFuncTable[1076] := FuncConnect; - FIdentFuncTable[2039] := FuncConstant; - FIdentFuncTable[720] := FuncCos; - FIdentFuncTable[447] := FuncCrypt; - FIdentFuncTable[111] := FuncDbmclose; - FIdentFuncTable[1988] := FuncDbmopen; - FIdentFuncTable[985] := FuncDefined; - FIdentFuncTable[2418] := FuncDelete; - FIdentFuncTable[1194] := FuncDiagnostics; - FIdentFuncTable[2120] := FuncDie; - FIdentFuncTable[2107] := FuncDo; - FIdentFuncTable[2381] := FuncDump; - FIdentFuncTable[1909] := FuncEach; - FIdentFuncTable[991] := FuncElse; - FIdentFuncTable[341] := FuncElsif; - FIdentFuncTable[1739] := FuncEndgrent; - FIdentFuncTable[967] := FuncEndhostent; - FIdentFuncTable[2412] := FuncEndnetent; - FIdentFuncTable[1018] := FuncEndprotoent; - FIdentFuncTable[448] := FuncEndpwent; - FIdentFuncTable[1681] := FuncEndservent; - FIdentFuncTable[1052] := FuncEof; - FIdentFuncTable[1278] := FuncEq; - FIdentFuncTable[1816] := FuncEval; - FIdentFuncTable[1618] := FuncExec; - FIdentFuncTable[2020] := FuncExists; - FIdentFuncTable[514] := FuncExit; - FIdentFuncTable[1586] := FuncExp; - FIdentFuncTable[686] := FuncFcntl; - FIdentFuncTable[115] := FuncFileno; - FIdentFuncTable[1810] := FuncFlock; - FIdentFuncTable[2265] := FuncFor; - FIdentFuncTable[2225] := FuncForeach; - FIdentFuncTable[1846] := FuncFork; - FIdentFuncTable[1854] := FuncFormat; - FIdentFuncTable[1319] := FuncFormline; - FIdentFuncTable[1072] := FuncGe; - FIdentFuncTable[2289] := FuncGetc; - FIdentFuncTable[51] := FuncGetgrent; - FIdentFuncTable[864] := FuncGetgrgid; - FIdentFuncTable[1453] := FuncGetgrnam; - FIdentFuncTable[1663] := FuncGethostbyaddr; - FIdentFuncTable[567] := FuncGethostbyname; - FIdentFuncTable[422] := FuncGethostent; - FIdentFuncTable[1243] := FuncGetlogin; - FIdentFuncTable[1735] := FuncGetnetbyaddr; - FIdentFuncTable[1749] := FuncGetnetbyname; - FIdentFuncTable[1647] := FuncGetnetent; - FIdentFuncTable[1970] := FuncGetpeername; - FIdentFuncTable[2348] := FuncGetpgrp; - FIdentFuncTable[2321] := FuncGetppid; - FIdentFuncTable[423] := FuncGetpriority; - FIdentFuncTable[1315] := FuncGetprotobyname; - FIdentFuncTable[1495] := FuncGetprotobynumber; - FIdentFuncTable[2168] := FuncGetprotoent; - FIdentFuncTable[2293] := FuncGetpwent; - FIdentFuncTable[1272] := FuncGetpwnam; - FIdentFuncTable[1615] := FuncGetpwuid; - FIdentFuncTable[1017] := FuncGetservbyname; - FIdentFuncTable[186] := FuncGetservbyport; - FIdentFuncTable[26] := FuncGetservent; - FIdentFuncTable[737] := FuncGetsockname; - FIdentFuncTable[531] := FuncGetsockopt; - FIdentFuncTable[1843] := FuncGlob; - FIdentFuncTable[1717] := FuncGmtime; - FIdentFuncTable[1303] := FuncGoto; - FIdentFuncTable[1577] := FuncGrep; - FIdentFuncTable[1528] := FuncGt; - FIdentFuncTable[1896] := FuncHex; - FIdentFuncTable[292] := FuncIf; - FIdentFuncTable[1381] := FuncImport; - FIdentFuncTable[708] := FuncIndex; - FIdentFuncTable[2368] := FuncInt; - FIdentFuncTable[898] := FuncInteger; - FIdentFuncTable[1801] := FuncIoctl; - FIdentFuncTable[1665] := FuncJoin; - FIdentFuncTable[2161] := FuncKeys; - FIdentFuncTable[432] := FuncKill; - FIdentFuncTable[2001] := FuncLast; - FIdentFuncTable[439] := FuncLc; - FIdentFuncTable[485] := FuncLcfirst; - FIdentFuncTable[1469] := FuncLe; - FIdentFuncTable[132] := FuncLength; - FIdentFuncTable[2315] := FuncLess; - FIdentFuncTable[2160] := FuncLink; - FIdentFuncTable[593] := FuncListen; - FIdentFuncTable[1719] := FuncLocal; - FIdentFuncTable[1491] := FuncLocale; - FIdentFuncTable[357] := FuncLocaltime; - FIdentFuncTable[2033] := FuncLog; - FIdentFuncTable[1176] := FuncLstat; - FIdentFuncTable[1925] := FuncLt; - FIdentFuncTable[406] := FuncM; - FIdentFuncTable[1074] := FuncMap; - FIdentFuncTable[578] := FuncMkdir; - FIdentFuncTable[1701] := FuncMsgctl; - FIdentFuncTable[613] := FuncMsgget; - FIdentFuncTable[497] := FuncMsgrcv; - FIdentFuncTable[2156] := FuncMsgsnd; - FIdentFuncTable[218] := FuncMy; - FIdentFuncTable[174] := FuncNe; - FIdentFuncTable[611] := FuncNext; - FIdentFuncTable[478] := FuncNo; - FIdentFuncTable[1217] := FuncNot; - FIdentFuncTable[1597] := FuncOct; - FIdentFuncTable[1330] := FuncOpen; - FIdentFuncTable[342] := FuncOpendir; - FIdentFuncTable[164] := FuncOr; - FIdentFuncTable[1817] := FuncOrd; - FIdentFuncTable[1384] := FuncPack; - FIdentFuncTable[968] := FuncPackage; - FIdentFuncTable[1125] := FuncPipe; - FIdentFuncTable[1338] := FuncPop; - FIdentFuncTable[460] := FuncPos; - FIdentFuncTable[1768] := FuncPrint; - FIdentFuncTable[1800] := FuncPush; - FIdentFuncTable[43] := FuncQ; - FIdentFuncTable[777] := FuncQq; - FIdentFuncTable[1309] := FuncQuotemeta; - FIdentFuncTable[1444] := FuncQw; - FIdentFuncTable[1959] := FuncQx; - FIdentFuncTable[1367] := FuncRand; - FIdentFuncTable[2133] := FuncRead; - FIdentFuncTable[1635] := FuncReaddir; - FIdentFuncTable[645] := FuncReadlink; - FIdentFuncTable[416] := FuncRecv; - FIdentFuncTable[2221] := FuncRedo; - FIdentFuncTable[1311] := FuncRef; - FIdentFuncTable[2307] := FuncRename; - FIdentFuncTable[843] := FuncRequire; - FIdentFuncTable[426] := FuncReset; - FIdentFuncTable[2323] := FuncReturn; - FIdentFuncTable[436] := FuncReverse; - FIdentFuncTable[1134] := FuncRewinddir; - FIdentFuncTable[464] := FuncRindex; - FIdentFuncTable[272] := FuncRmdir; - FIdentFuncTable[1475] := FuncScalar; - FIdentFuncTable[1840] := FuncSeek; - FIdentFuncTable[1748] := FuncSeekdir; - FIdentFuncTable[42] := FuncSelect; - FIdentFuncTable[2021] := FuncSemctl; - FIdentFuncTable[933] := FuncSemget; - FIdentFuncTable[570] := FuncSemop; - FIdentFuncTable[888] := FuncSend; - FIdentFuncTable[1789] := FuncSetgrent; - FIdentFuncTable[915] := FuncSethostent; - FIdentFuncTable[2028] := FuncSetnetent; - FIdentFuncTable[2288] := FuncSetpgrp; - FIdentFuncTable[2047] := FuncSetpriority; - FIdentFuncTable[1369] := FuncSetprotoent; - FIdentFuncTable[1608] := FuncSetpwent; - FIdentFuncTable[1629] := FuncSetservent; - FIdentFuncTable[2134] := FuncSetsockopt; - FIdentFuncTable[1383] := FuncShift; - FIdentFuncTable[540] := FuncShmctl; - FIdentFuncTable[562] := FuncShmget; - FIdentFuncTable[2213] := FuncShmread; - FIdentFuncTable[1301] := FuncShmwrite; - FIdentFuncTable[1289] := FuncShutdown; - FIdentFuncTable[887] := FuncSigtrap; - FIdentFuncTable[297] := FuncSin; - FIdentFuncTable[1280] := FuncSleep; - FIdentFuncTable[2298] := FuncSocket; - FIdentFuncTable[1891] := FuncSocketpair; - FIdentFuncTable[1795] := FuncSort; - FIdentFuncTable[873] := FuncSplice; - FIdentFuncTable[830] := FuncSplit; - FIdentFuncTable[1546] := FuncSprintf; - FIdentFuncTable[1553] := FuncSqrt; - FIdentFuncTable[81] := FuncSrand; - FIdentFuncTable[184] := FuncStat; - FIdentFuncTable[1266] := FuncStrict; - FIdentFuncTable[1736] := FuncStudy; - FIdentFuncTable[885] := FuncSub; - FIdentFuncTable[112] := FuncSubs; - FIdentFuncTable[2260] := FuncSubstr; - FIdentFuncTable[878] := FuncSymlink; - FIdentFuncTable[1258] := FuncSyscall; - FIdentFuncTable[1422] := FuncSysread; - FIdentFuncTable[2196] := FuncSystem; - FIdentFuncTable[158] := FuncSyswrite; - FIdentFuncTable[149] := FuncTell; - FIdentFuncTable[2069] := FuncTelldir; - FIdentFuncTable[387] := FuncTie; - FIdentFuncTable[1470] := FuncTime; - FIdentFuncTable[509] := FuncTimes; - FIdentFuncTable[561] := FuncTr; - FIdentFuncTable[1727] := FuncTruncate; - FIdentFuncTable[669] := FuncUc; - FIdentFuncTable[819] := FuncUcfirst; - FIdentFuncTable[2299] := FuncUmask; - FIdentFuncTable[1162] := FuncUndef; - FIdentFuncTable[1946] := FuncUnless; - FIdentFuncTable[681] := FuncUnlink; - FIdentFuncTable[1015] := FuncUnpack; - FIdentFuncTable[1318] := FuncUnshift; - FIdentFuncTable[2280] := FuncUntie; - FIdentFuncTable[1060] := FuncUse; - FIdentFuncTable[442] := FuncUtime; - FIdentFuncTable[2080] := FuncValues; - FIdentFuncTable[160] := FuncVars; - FIdentFuncTable[1705] := FuncVec; - FIdentFuncTable[1560] := FuncWait; - FIdentFuncTable[672] := FuncWaitpid; - FIdentFuncTable[938] := FuncWantarray; - FIdentFuncTable[1123] := FuncWarn; - FIdentFuncTable[1091] := FuncWhile; - FIdentFuncTable[1105] := FuncWrite; - FIdentFuncTable[290] := FuncXor; -end; - -function TSynPerlSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36accumulator(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36arg(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36argv(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36basetime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36child95error(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36debugging(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36effective95group95id(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36effective95user95id(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36egid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36env(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36errno(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36euid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36eval95error(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36executable95name(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95formfeed(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95line95break95characters(Index: Integer): - TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95lines95left(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95lines95per95page(Index: Integer): - TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95name(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95page95number(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36format95top95name(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36gid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36inplace95edit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36input95line95number(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36input95record95separator(Index: Integer): - TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36last95paren95match(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36list95separator(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36match(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36multiline95matching(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36nr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36ofmt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36ors(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36os95error(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36output95autoflush(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36output95field95separator(Index: Integer): - TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36perl95version(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36perldb(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36pid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36postmatch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36prematch(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36process95id(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36program95name(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36real95group95id(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36real95user95id(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36rs(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36sig(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36subscript95separator(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36subsep(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36system95fd95max(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36uid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func36warning(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func37inc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func64argv(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.Func64inc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkVariable - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncAbs(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncAccept(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncAlarm(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncAnd(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncAtan2(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncBind(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncBinmode(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncBless(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncCaller(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChdir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChmod(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChomp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChop(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChown(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncChroot(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncClose(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncClosedir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncCmp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncConnect(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncConstant(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncCos(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncCrypt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDbmclose(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDbmopen(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDefined(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDelete(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDiagnostics(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDie(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDo(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncDump(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEach(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncElse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncElsif(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEndgrent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEndhostent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEndnetent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEndprotoent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEndpwent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEndservent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEof(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEq(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncEval(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncExec(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncExists(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncExit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncExp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFcntl(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFileno(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFlock(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFor(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncForeach(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFork(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFormat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncFormline(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGe(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetgrent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetgrgid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetgrnam(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGethostbyaddr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGethostbyname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGethostent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetlogin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetnetbyaddr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetnetbyname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetnetent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetpeername(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetpgrp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetppid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetpriority(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetprotobyname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetprotobynumber(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetprotoent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetpwent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetpwnam(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetpwuid(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetservbyname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetservbyport(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetservent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetsockname(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGetsockopt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGlob(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGmtime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGoto(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGrep(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncGt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncHex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncIf(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncImport(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncIndex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncInt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncInteger(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncIoctl(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncJoin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncKeys(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncKill(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLast(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLcfirst(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLe(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLength(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLess(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLink(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncListen(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLocal(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLocale(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLocaltime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLog(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLstat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncLt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncM(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMap(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMkdir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMsgctl(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMsgget(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMsgrcv(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMsgsnd(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncMy(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncNe(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncNext(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncNo(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncNot(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncOct(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncOpen(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncOpendir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncOr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncOrd(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPack(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPackage(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPipe(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPop(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPos(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPrint(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncPush(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncQ(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncQq(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncQuotemeta(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncQw(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncQx(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRand(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRead(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncReaddir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncReadlink(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRecv(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRedo(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRef(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRename(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRequire(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncReset(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncReturn(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncReverse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRewinddir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRindex(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncRmdir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncScalar(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSeek(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSeekdir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSelect(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSemctl(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSemget(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSemop(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSend(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetgrent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSethostent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetnetent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetpgrp(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetpriority(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetprotoent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetpwent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetservent(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSetsockopt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncShift(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncShmctl(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncShmget(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncShmread(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncShmwrite(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncShutdown(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSigtrap(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSin(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSleep(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSocket(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSocketpair(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSort(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSplice(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSplit(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSprintf(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSqrt(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSrand(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncStat(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncStrict(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncStudy(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSub(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSubs(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSubstr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSymlink(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSyscall(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSysread(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSystem(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncSyswrite(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTell(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTelldir(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTie(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTimes(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTr(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncTruncate(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUc(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUcfirst(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUmask(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUndef(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUnless(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUnlink(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUnpack(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUnshift(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUntie(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUse(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; - -function TSynPerlSyn.FuncUtime(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; + function GetRange: Pointer; override; //Fiala + procedure ResetRange; override; //Fiala + procedure SetRange(Value: Pointer); override; //Fiala +//++ CodeFolding + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; +//-- CodeFolding + published + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri + write fInvalidAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property OperatorAttri: TSynHighlighterAttributes read fOperatorAttri + write fOperatorAttri; + property PragmaAttri: TSynHighlighterAttributes read fPragmaAttri + write fPragmaAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; + property VariableAttri: TSynHighlighterAttributes read fVariableAttri + write fVariableAttri; + end; -function TSynPerlSyn.FuncValues(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; +implementation -function TSynPerlSyn.FuncVars(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkPragma - else - Result := tkIdentifier; -end; +uses + SynEditStrConst; -function TSynPerlSyn.FuncVec(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; +const + { expanded keywords list } //Fiala + KeyWords: array[0..295] of string = ( + '$ACCUMULATOR', '$ARG', '$ARGV', '$BASETIME', '$DEBUGGING', + '$EFFECTIVE_GROUP_ID', '$EFFECTIVE_USER_ID', '$EGID', '$ENV', '$ERRNO', + '$EUID', '$EVAL_ERROR', '$EXECUTABLE_NAME', '$FORMAT_FORMFEED', + '$FORMAT_LINE_BREAK_CHARACTERS', '$FORMAT_LINES_LEFT', + '$FORMAT_LINES_PER_PAGE', '$FORMAT_NAME', '$FORMAT_PAGE_NUMBER', + '$FORMAT_TOP_NAME', '$GID', '$CHILD_ERROR', '$INPLACE_EDIT', + '$INPUT_LINE_NUMBER', '$INPUT_RECORD_SEPARATOR', '$LAST_PAREN_MATCH', + '$LIST_SEPARATOR', '$MATCH', '$MULTILINE_MATCHING', '$NR', '$OFMT', '$ORS', + '$OS_ERROR', '$OUTPUT_AUTOFLUSH', '$OUTPUT_FIELD_SEPARATOR', + '$PERL_VERSION', '$PERLDB', '$PID', '$POSTMATCH', '$PREMATCH', + '$PROCESS_ID', '$PROGRAM_NAME', '$REAL_GROUP_ID', '$REAL_USER_ID', '$RS', + '$SIG', '$SUBSCRIPT_SEPARATOR', '$SUBSEP', '$SYSTEM_FD_MAX', '$UID', + '$WARNING', '%INC', '@ARGV', '@INC', 'abs', 'accept', 'alarm', 'and', + 'atan2', 'bind', 'binmode', 'bless', 'break', 'caller', 'close', 'closedir', + 'cmp', 'connect', 'constant', 'continue', 'cos', 'crypt', 'dbmclose', + 'dbmopen', 'defined', 'delete', 'diagnostics', 'die', 'do', 'dump', 'each', + 'else', 'elsif', 'endgrent', 'endhostent', 'endnetent', 'endprotoent', + 'endpwent', 'endservent', 'eof', 'eq', 'eval', 'exec', 'exists', 'exit', + 'exp', 'fcntl', 'fileno', 'flock', 'for', 'foreach', 'fork', 'format', + 'formline', 'ge', 'getc', 'getgrent', 'getgrgid', 'getgrnam', + 'gethostbyaddr', 'gethostbyname', 'gethostent', 'getlogin', 'getnetbyaddr', + 'getnetbyname', 'getnetent', 'getpeername', 'getpgrp', 'getppid', + 'getpriority', 'getprotobyname', 'getprotobynumber', 'getprotoent', + 'getpwent', 'getpwnam', 'getpwuid', 'getservbyname', 'getservbyport', + 'getservent', 'getsockname', 'getsockopt', 'glob', 'gmtime', 'goto', 'grep', + 'gt', 'hex', 'chdir', 'chmod', 'chomp', 'chop', 'chown', 'chr', 'chroot', + 'if', 'import', 'index', 'int', 'integer', 'ioctl', 'join', 'keys', 'kill', + 'last', 'lc', 'lcfirst', 'le', 'length', 'less', 'link', 'listen', 'local', + 'locale', 'localtime', 'lock', 'log', 'lstat', 'lt', 'm', 'map', 'mkdir', + 'msgctl', 'msgget', 'msgrcv', 'msgsnd', 'my', 'ne', 'next', 'no', 'not', + 'oct', 'open', 'opendir', 'or', 'ord', 'our', 'pack', 'package', 'pipe', + 'pop', 'pos', 'print', 'printf', 'push', 'q', 'qq', 'qr', 'quotemeta', 'qw', + 'qx', 'rand', 'read', 'readdir', 'readline', 'readlink', 'readpipe', 'recv', + 'redo', 'ref', 'rename', 'require', 'reset', 'return', 'reverse', + 'rewinddir', 'rindex', 'rmdir', 'say', 'scalar', 'seek', 'seekdir', + 'select', 'semctl', 'semget', 'semop', 'send', 'setgrent', 'sethostent', + 'setnetent', 'setpgrp', 'setpriority', 'setprotoent', 'setpwent', + 'setservent', 'setsockopt', 'shift', 'shmctl', 'shmget', 'shmread', + 'shmwrite', 'shutdown', 'sigtrap', 'sin', 'sleep', 'socket', 'socketpair', + 'sort', 'splice', 'split', 'sprintf', 'sqrt', 'srand', 'stat', 'state', + 'strict', 'study', 'sub', 'subs', 'substr', 'symlink', 'syscall', 'sysopen', + 'sysread', 'sysseek', 'system', 'syswrite', 'tell', 'telldir', 'tie', + 'tied', 'time', 'times', 'tr', 'truncate', 'uc', 'ucfirst', 'umask', + 'undef', 'unless', 'unlink', 'unpack', 'unshift', 'untie', 'until', 'use', + 'utime', 'values', 'vars', 'vec', 'wait', 'waitpid', 'wantarray', 'warn', + 'while', 'write', 'xor' + ); -function TSynPerlSyn.FuncWait(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; + KeyIndices: array[0..2728] of Integer = ( + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 222, -1, -1, -1, -1, -1, -1, + -1, -1, 201, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 203, -1, -1, -1, -1, -1, -1, -1, -1, 87, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 217, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 198, 10, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 157, -1, -1, 167, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 58, -1, -1, -1, -1, -1, -1, -1, -1, -1, 126, + -1, -1, -1, -1, -1, -1, -1, -1, 274, -1, -1, -1, -1, -1, 7, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, -1, 143, 275, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 254, -1, -1, -1, -1, -1, -1, -1, 118, -1, -1, + -1, -1, -1, -1, 259, -1, -1, -1, -1, -1, -1, -1, -1, 114, -1, -1, -1, -1, + -1, -1, -1, -1, 23, -1, 237, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 148, 185, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 270, 16, -1, -1, -1, 103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 60, 44, -1, 50, -1, -1, -1, -1, 135, -1, -1, 137, -1, + -1, -1, -1, -1, -1, -1, -1, 83, -1, -1, 53, -1, -1, 63, -1, -1, -1, -1, -1, + 166, -1, -1, -1, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 22, -1, -1, -1, -1, -1, -1, 149, 202, -1, -1, 77, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 70, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 258, -1, -1, -1, -1, -1, -1, 204, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 277, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 194, -1, 41, -1, -1, 243, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 230, 71, -1, -1, -1, -1, -1, -1, + 231, -1, -1, -1, -1, -1, 283, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 107, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 216, -1, -1, -1, -1, -1, 124, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 265, -1, -1, -1, -1, -1, + 152, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 146, 92, -1, -1, -1, -1, -1, -1, 147, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 19, -1, + -1, 129, -1, -1, -1, -1, -1, -1, -1, -1, -1, 213, -1, -1, -1, 8, -1, -1, -1, + -1, -1, 36, -1, -1, -1, 15, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 233, -1, -1, -1, -1, 121, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 281, -1, 271, -1, -1, -1, -1, -1, -1, -1, 196, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 248, -1, -1, -1, 5, -1, -1, -1, -1, 20, -1, -1, -1, -1, -1, + -1, -1, -1, 207, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 176, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 131, -1, -1, -1, -1, + -1, -1, -1, 142, -1, 3, -1, -1, -1, -1, 249, 108, -1, -1, -1, -1, 133, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 211, -1, -1, -1, -1, -1, + -1, 130, -1, 21, -1, -1, -1, -1, -1, -1, 225, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 287, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 17, -1, -1, -1, 59, -1, -1, 169, -1, 82, -1, -1, 81, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 240, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 123, -1, -1, -1, -1, + 14, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 192, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 235, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 205, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 38, -1, -1, -1, 189, -1, -1, -1, -1, -1, 187, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 246, 164, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 105, -1, -1, -1, -1, 100, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 276, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 199, -1, -1, -1, -1, -1, 288, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 242, -1, -1, -1, -1, -1, -1, -1, -1, 94, -1, -1, 122, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 138, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 284, -1, 179, 112, -1, + -1, 253, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 239, 190, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 165, -1, -1, -1, -1, -1, 218, -1, -1, -1, 106, -1, 75, 255, -1, -1, 97, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 191, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 40, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 279, -1, -1, -1, -1, -1, + -1, 224, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 212, -1, -1, -1, -1, -1, + -1, 125, -1, -1, -1, 139, 267, -1, 269, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 73, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 98, 136, -1, + -1, -1, -1, 90, -1, -1, -1, -1, -1, -1, -1, -1, 74, -1, -1, 263, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 278, -1, -1, 30, -1, -1, -1, + -1, -1, -1, -1, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, + -1, 32, -1, 95, 161, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 209, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 264, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 4, -1, -1, -1, -1, -1, -1, -1, -1, -1, 291, -1, -1, -1, -1, 61, + -1, -1, -1, -1, 244, -1, 11, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 27, -1, -1, -1, 31, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 182, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 256, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 150, -1, -1, 215, 260, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 54, -1, -1, -1, -1, -1, 197, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 210, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 88, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 175, -1, -1, -1, -1, -1, -1, -1, -1, 141, -1, + -1, -1, -1, -1, -1, -1, 67, -1, -1, -1, -1, -1, 65, 272, -1, -1, -1, -1, -1, + -1, -1, -1, 29, -1, -1, -1, -1, 292, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 227, -1, -1, -1, -1, -1, -1, -1, -1, -1, 160, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 56, -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 57, -1, -1, -1, -1, -1, -1, -1, 25, -1, -1, -1, + -1, 228, 266, 170, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 180, 234, -1, -1, -1, -1, -1, + -1, 69, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 289, + -1, 93, -1, -1, -1, -1, 55, -1, 183, -1, -1, -1, -1, -1, 163, -1, 162, -1, + -1, -1, 132, -1, -1, -1, 282, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 247, -1, 188, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 174, -1, -1, -1, 280, -1, -1, 261, 51, -1, -1, -1, -1, -1, 144, + 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 229, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 193, 172, -1, + -1, -1, -1, -1, 219, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 208, -1, -1, + -1, -1, -1, -1, -1, 6, 113, -1, -1, -1, 250, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 145, 28, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 109, + -1, -1, 168, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 186, -1, 151, -1, -1, -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, -1, 251, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 184, -1, 262, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 68, 238, -1, -1, -1, -1, + 221, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 173, -1, -1, -1, 104, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 223, -1, 101, -1, -1, 46, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 76, -1, -1, -1, -1, -1, -1, -1, -1, 0, -1, -1, -1, 119, + -1, -1, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, 294, -1, 85, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 18, -1, -1, -1, -1, -1, + -1, 37, -1, -1, -1, -1, 220, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 99, + -1, -1, -1, -1, -1, -1, -1, 178, -1, -1, -1, -1, -1, -1, -1, -1, 293, 34, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 252, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 285, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 232, -1, -1, -1, -1, -1, -1, -1, 52, + -1, -1, 43, 117, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 120, -1, 128, 48, -1, -1, -1, -1, -1, -1, -1, 47, -1, + -1, -1, 39, 127, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 268, -1, + -1, -1, -1, -1, -1, 86, -1, -1, -1, -1, -1, -1, 89, -1, 236, -1, -1, -1, -1, + -1, -1, 13, -1, -1, -1, -1, -1, 96, 155, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 286, -1, -1, -1, -1, -1, -1, -1, -1, 33, 1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 195, 80, 62, -1, -1, -1, 290, -1, -1, -1, -1, 26, -1, -1, -1, -1, + -1, 115, -1, -1, 91, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 134, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 245, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 12, + -1, -1, 171, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 214, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 295, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 273, -1, -1, + -1, 181, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 226, 257, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 241, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 206, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, -1, + -1, -1, 102, -1, -1, 79, -1, -1, -1, -1, -1, -1, 84, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 177, -1, + -1, -1, -1, -1, -1, -1, 154, -1, -1, -1, -1, -1 + ); -function TSynPerlSyn.FuncWaitpid(Index: Integer): TtkTokenKind; +{$Q-} +function TSynPerlSyn.HashKey(Str: PWideChar): Cardinal; begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; + Result := 0; + while IsIdentChar(Str^) do + begin + Result := Result * 714 + Ord(Str^) * 970; + Inc(Str); + end; + Result := Result mod 2729; + fStringLen := Str - fToIdent; end; +{$Q+} -function TSynPerlSyn.FuncWantarray(Index: Integer): TtkTokenKind; +function TSynPerlSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; +var + Key: Cardinal; begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey + fToIdent := MayBe; + Key := HashKey(MayBe); + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; -function TSynPerlSyn.FuncWarn(Index: Integer): TtkTokenKind; +procedure TSynPerlSyn.InitIdent; +var + I: Integer; begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; + for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if KeyIndices[I] = -1 then + fIdentFuncTable[I] := AltFunc + else + fIdentFuncTable[I] := FuncKey; -function TSynPerlSyn.FuncWhile(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; -end; +{variable //Fiala + all functions starting FuncNN (NN = number) +} -function TSynPerlSyn.FuncWrite(Index: Integer): TtkTokenKind; -begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier; +{pragma + FuncConstant; + FuncDiagnostics; + FuncInteger; + FuncLess; + FuncLocale; + FuncSigtrap; + FuncStrict; + FuncSubs; + FuncVars; +} +{operators + FuncAnd; + FuncCmp; + FuncEq; + FuncGe; + FuncGt; + FuncLe; + FuncLt; + FuncNe; + FuncNot; + FuncOr; + FuncXor; +} + + fIdentFuncTable[2206] := FuncVar; + fIdentFuncTable[2446] := FuncVar; + fIdentFuncTable[144] := FuncVar; + fIdentFuncTable[785] := FuncVar; + fIdentFuncTable[1434] := FuncVar; + fIdentFuncTable[732] := FuncVar; + fIdentFuncTable[1994] := FuncVar; + fIdentFuncTable[184] := FuncVar; + fIdentFuncTable[627] := FuncVar; + fIdentFuncTable[2152] := FuncVar; + fIdentFuncTable[91] := FuncVar; + fIdentFuncTable[1456] := FuncVar; + fIdentFuncTable[2529] := FuncVar; + fIdentFuncTable[2419] := FuncVar; + fIdentFuncTable[911] := FuncVar; + fIdentFuncTable[637] := FuncVar; + fIdentFuncTable[282] := FuncVar; + fIdentFuncTable[855] := FuncVar; + fIdentFuncTable[2243] := FuncVar; + fIdentFuncTable[610] := FuncVar; + fIdentFuncTable[737] := FuncVar; + fIdentFuncTable[820] := FuncVar; + fIdentFuncTable[354] := FuncVar; + fIdentFuncTable[247] := FuncVar; + fIdentFuncTable[2070] := FuncVar; + fIdentFuncTable[1803] := FuncVar; + fIdentFuncTable[2468] := FuncVar; + fIdentFuncTable[1473] := FuncVar; + fIdentFuncTable[2014] := FuncVar; + fIdentFuncTable[1678] := FuncVar; + fIdentFuncTable[1352] := FuncVar; + fIdentFuncTable[1477] := FuncVar; + fIdentFuncTable[1376] := FuncVar; + fIdentFuncTable[2445] := FuncVar; + fIdentFuncTable[2285] := FuncVar; + fIdentFuncTable[2218] := FuncVar; + fIdentFuncTable[633] := FuncVar; + fIdentFuncTable[2250] := FuncVar; + fIdentFuncTable[969] := FuncVar; + fIdentFuncTable[2382] := FuncVar; + fIdentFuncTable[1220] := FuncVar; + fIdentFuncTable[452] := FuncVar; + fIdentFuncTable[956] := FuncVar; + fIdentFuncTable[2345] := FuncVar; + fIdentFuncTable[304] := FuncVar; + fIdentFuncTable[959] := FuncVar; + fIdentFuncTable[2183] := FuncVar; + fIdentFuncTable[2378] := FuncVar; + fIdentFuncTable[2370] := FuncVar; + fIdentFuncTable[1773] := FuncVar; + fIdentFuncTable[306] := FuncVar; + fIdentFuncTable[1927] := FuncVar; + fIdentFuncTable[2342] := FuncVar; + fIdentFuncTable[326] := FuncVar; + + fIdentFuncTable[2112] := FuncPragma; + fIdentFuncTable[2197] := FuncPragma; + fIdentFuncTable[263] := FuncPragma; + fIdentFuncTable[343] := FuncPragma; + fIdentFuncTable[1878] := FuncPragma; + fIdentFuncTable[2638] := FuncPragma; + fIdentFuncTable[214] := FuncPragma; + fIdentFuncTable[396] := FuncPragma; + fIdentFuncTable[838] := FuncPragma; + + fIdentFuncTable[1795] := FuncOperator; + fIdentFuncTable[1371] := FuncOperator; + fIdentFuncTable[1302] := FuncOperator; + fIdentFuncTable[2135] := FuncOperator; + fIdentFuncTable[311] := FuncOperator; + fIdentFuncTable[1934] := FuncOperator; + fIdentFuncTable[110] := FuncOperator; + fIdentFuncTable[762] := FuncOperator; + fIdentFuncTable[1129] := FuncOperator; + fIdentFuncTable[1870] := FuncOperator; + fIdentFuncTable[2564] := FuncOperator; end; -function TSynPerlSyn.FuncXor(Index: Integer): TtkTokenKind; +function TSynPerlSyn.AltFunc(Index: Integer): TtkTokenKind; begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkOperator - else - Result := tkIdentifier; + Result := tkIdentifier; end; constructor TSynPerlSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := True; - - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style:= [fsItalic]; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar); - AddAttribute(FInvalidAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style:= [fsBold]; - AddAttribute(FKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FOperatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrOperator, SYNS_FriendlyAttrOperator); - AddAttribute(FOperatorAttri); - FPragmaAttri := TSynHighlighterAttributes.Create(SYNS_AttrPragma, SYNS_FriendlyAttrPragma); - FPragmaAttri.Style := [fsBold]; - AddAttribute(FPragmaAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); - FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); - FVariableAttri.Style := [fsBold]; - AddAttribute(FVariableAttri); + fCaseSensitive := True; + + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style:= [fsItalic]; + AddAttribute(fCommentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar); + AddAttribute(fInvalidAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style:= [fsBold]; + AddAttribute(fKeyAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fOperatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrOperator, SYNS_FriendlyAttrOperator); + AddAttribute(fOperatorAttri); + fPragmaAttri := TSynHighlighterAttributes.Create(SYNS_AttrPragma, SYNS_FriendlyAttrPragma); + fPragmaAttri.Style := [fsBold]; + AddAttribute(fPragmaAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + fSpaceAttri.Foreground := clWindow; + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); + fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); + fVariableAttri.Style := [fsBold]; + AddAttribute(fVariableAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FDefaultFilter := SYNS_FilterPerl; + fDefaultFilter := SYNS_FilterPerl; + fRange := rsUnknown; end; { Create } procedure TSynPerlSyn.AndSymbolProc; @@ -3244,7 +569,7 @@ procedure TSynPerlSyn.AndSymbolProc; '=': {bit and assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; '&': begin @@ -3252,20 +577,20 @@ procedure TSynPerlSyn.AndSymbolProc; Inc(Run, 3) else {logical and} Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {bit and} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; end; procedure TSynPerlSyn.CRProc; begin - FTokenID := tkSpace; - case FLine[Run + 1] of + fTokenID := tkSpace; + Case FLine[Run + 1] of #10: Inc(Run, 2); else Inc(Run); end; @@ -3273,30 +598,34 @@ procedure TSynPerlSyn.CRProc; procedure TSynPerlSyn.ColonProc; begin - case FLine[Run + 1] of + Case FLine[Run + 1] of ':': {double colon} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {colon} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; end; procedure TSynPerlSyn.CommentProc; begin - FTokenID := tkComment; - repeat - case FLine[Run] of - #0, #10, #13: - Break; - end; + if (Run = 0) or (Run > 0) and (FLine[Run-1] <> '\') then + begin + fTokenID := tkComment; + repeat + case FLine[Run] of + #0, #10, #13: Break; + end; + Inc(Run); + until FLine[Run] = #0; + end + else Inc(Run); - until FLine[Run] = #0; end; procedure TSynPerlSyn.EqualProc; @@ -3305,33 +634,33 @@ procedure TSynPerlSyn.EqualProc; '=': {logical equal} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; '>': {digraph} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; '~': {bind scalar to pattern} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {assign} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; end; procedure TSynPerlSyn.GreaterProc; begin - case FLine[Run + 1] of + Case FLine[Run + 1] of '=': {greater than or equal to} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; '>': begin @@ -3339,12 +668,12 @@ procedure TSynPerlSyn.GreaterProc; Inc(Run, 3) else {shift right} Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {greater than} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; end; @@ -3354,26 +683,26 @@ procedure TSynPerlSyn.IdentProc; case FLine[Run] of '$': begin - case FLine[Run + 1] of + Case FLine[Run + 1] of '!'..'+', '-'..'@', '['..']', '_', '`', '|', '~': begin {predefined variables} Inc(Run, 2); - FTokenID := tkVariable; + fTokenID := tkVariable; Exit; end; '^': begin - case FLine[Run + 2] of + Case FLine[Run + 2] of 'A', 'D', 'F', 'I', 'L', 'P', 'T', 'W', 'X': begin {predefined variables} Inc(Run, 3); - FTokenID := tkVariable; + fTokenID := tkVariable; Exit; end; #0, #10, #13: {predefined variables} begin Inc(Run, 2); - FTokenID := tkVariable; + fTokenID := tkVariable; Exit; end; end; @@ -3382,48 +711,48 @@ procedure TSynPerlSyn.IdentProc; end; '%': begin - case FLine[Run + 1] of + Case FLine[Run + 1] of '=': {mod assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; Exit; end; #0, #10, #13: {mod} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; Exit; end; end; end; 'x': begin - case FLine[Run + 1] of + Case FLine[Run + 1] of '=': {repetition assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; Exit; end; #0, #10, #13: {repetition} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; Exit; end; end; end; end; {regular identifier} - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do Inc(Run); + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynPerlSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; @@ -3436,7 +765,7 @@ procedure TSynPerlSyn.LowerProc; Inc(Run, 3) else {less than or equal to} Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; '<': begin @@ -3444,12 +773,12 @@ procedure TSynPerlSyn.LowerProc; Inc(Run, 3) else {shift left} Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {less than} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; end; @@ -3460,22 +789,22 @@ procedure TSynPerlSyn.MinusProc; '=': {subtract assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; '-': {decrement} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; '>': {arrow} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {subtract} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; end; @@ -3486,24 +815,24 @@ procedure TSynPerlSyn.NotSymbolProc; '~': {logical negated bind like =~} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; '=': {not equal} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {not} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; end; procedure TSynPerlSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -3511,7 +840,7 @@ procedure TSynPerlSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '-', '_', '.', 'A'..'F', 'a'..'f', 'x', 'X': Result := True; else @@ -3529,25 +858,25 @@ procedure TSynPerlSyn.NumberProc; if FLine[Run] = '.' then {sed range} Inc(Run); - FTokenID := tkSymbol; {range} + fTokenID := tkSymbol; {range} Exit; end; '=': begin Inc(Run, 2); - FTokenID := tkSymbol; {concatenation assign} + fTokenID := tkSymbol; {concatenation assign} Exit; end; 'a'..'z', 'A'..'Z', '_': begin - FTokenID := tkSymbol; {concatenation} + fTokenID := tkSymbol; {concatenation} Inc(Run); Exit; end; end; end; Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of @@ -3566,7 +895,7 @@ procedure TSynPerlSyn.OrSymbolProc; '=': {bit or assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; '|': begin @@ -3574,12 +903,12 @@ procedure TSynPerlSyn.OrSymbolProc; Inc(Run, 3) else {logical or} Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {bit or} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; end; @@ -3590,18 +919,72 @@ procedure TSynPerlSyn.PlusProc; '=': {add assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; '+': {increment} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {add} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; + end; + end; +end; + +procedure TSynPerlSyn.qFunctionProc; //Fiala +var + myBracket: char; + + function GetFirstBracket: char; + var + I: Integer; + begin + Result := #0; + I := Run + 1; + while not IsLineEnd(I) do + begin + if CharInSet(FLine[I], [' ', #8, '(', '{']) then + { we will return opening bracket } + case FLine[I] of + '(': begin + Result := ')'; + Break; + end; + '{': begin + Result := '}'; + Break; + end; + end + { when other than opening bracket or space, we will stop } + else + Break; + Inc(I) end; + + end; + +begin + { qfunction } +// myBracket := GetFirstBracket; +// if ((Run = 0) or (Run > 0) and (FLine[Run-1] = ' ')) and (myBracket <> #0) then + if (FLine[Run+1] = 'q') and (FLine[Run+2] = '(') or (FLine[Run+1] = '(') then + begin + myBracket := ')'; + fTokenID := tkString; + repeat + Inc(Run); + until (FLine[Run] = myBracket) or IsLineEnd(Run); + if not IsLineEnd(Run) then + Inc(Run); + end + else + begin + { standard identifier } + fTokenID := tkIdentifier; + Inc(run); end; end; @@ -3611,12 +994,12 @@ procedure TSynPerlSyn.SlashProc; '=': {division assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {division} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; end; @@ -3624,7 +1007,7 @@ procedure TSynPerlSyn.SlashProc; procedure TSynPerlSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; @@ -3634,7 +1017,7 @@ procedure TSynPerlSyn.StarProc; '=': {multiply assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; '*': begin @@ -3642,26 +1025,37 @@ procedure TSynPerlSyn.StarProc; Inc(Run, 3) else {exponentiation} Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {multiply} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; end; procedure TSynPerlSyn.StringInterpProc; var - BackslashCount : Integer; + fBackslashCount: Integer; begin - FTokenID := tkString; + { modification for first quote is backshlashed } + if (FRange = rsUnknown ) and (FLine[Run - 1] = '\') then // Fiala + begin + Inc(Run); + fTokenID := tkSymbol; + Exit; + end; + + fTokenID := tkString; + if FRange = rsUnknown then + FRange := rsString + else + Inc(Run); if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2); repeat case FLine[Run] of - #0, #10, #13: - Break; + #0, #10, #13: Break; #92: { If we're looking at a backslash, and the following character is an end quote, and it's preceeded by an odd number of backslashes, then @@ -3669,26 +1063,27 @@ procedure TSynPerlSyn.StringInterpProc; even number, then it should. } if (FLine[Run + 1] = #34) then begin - BackslashCount := 1; + fBackslashCount := 1; - while ((Run > BackslashCount) and (FLine[Run - BackslashCount] = #92)) do - BackslashCount := BackslashCount + 1; + while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = #92)) do + fBackslashCount := fBackslashCount + 1; - if (BackslashCount mod 2 = 1) then Inc(Run) + if (fBackslashCount mod 2 = 1) then Inc(Run) end; end; Inc(Run); until FLine[Run] = #34; + if FLine[Run] = #34 then + FRange := rsUnknown; if FLine[Run] <> #0 then Inc(Run); end; procedure TSynPerlSyn.StringLiteralProc; begin - FTokenID := tkString; + fTokenID := tkString; repeat case FLine[Run] of - #0, #10, #13: - Break; + #0, #10, #13: Break; end; Inc(Run); until FLine[Run] = #39; @@ -3697,22 +1092,25 @@ procedure TSynPerlSyn.StringLiteralProc; procedure TSynPerlSyn.SymbolProc; begin + if (Run = 0) or (Run>0) and (FLine[Run - 1] <> '\') then + fTokenId := tkSymbol + else + fTokenId := tkUnknown; Inc(Run); - FTokenID := tkSymbol; end; procedure TSynPerlSyn.XOrSymbolProc; begin - case FLine[Run + 1] of + Case FLine[Run + 1] of '=': {xor assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else {xor} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; end; @@ -3720,20 +1118,28 @@ procedure TSynPerlSyn.XOrSymbolProc; procedure TSynPerlSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynPerlSyn.Next; begin - FTokenPos := Run; - case FLine[Run] of + fTokenPos := Run; + if not IsLineEnd(Run) and (fRange = rsString) then + begin + StringEndProc; + end + else + case fLine[Run] of '&': AndSymbolProc; #13: CRProc; ':': ColonProc; '#': CommentProc; '=': EqualProc; '>': GreaterProc; - '%', '@', '$', 'A'..'Z', 'a'..'z', '_': IdentProc; +// '%', '@', '$', 'A'..'Z', 'a'..'z', '_': IdentProc; + '$', '%', '@': VariableProc; + 'q': qFunctionProc; //Fiala + 'A'..'Z', 'a'..'p', 'r'..'z', '_': IdentProc; //Fiala #10: LFProc; '<': LowerProc; '-': MinusProc; @@ -3745,7 +1151,7 @@ procedure TSynPerlSyn.Next; '/': SlashProc; #1..#9, #11, #12, #14..#32: SpaceProc; '*': StarProc; - #34: StringInterpProc; + '"': StringInterpProc; #39: StringLiteralProc; '^': XOrSymbolProc; '(', ')', '[', ']', '\', '{', '}', ',', ';', '?', '~': SymbolProc; @@ -3757,12 +1163,12 @@ procedure TSynPerlSyn.Next; function TSynPerlSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -3770,38 +1176,38 @@ function TSynPerlSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribu function TSynPerlSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynPerlSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynPerlSyn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkOperator: Result := FOperatorAttri; - tkPragma: Result := FPragmaAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FInvalidAttri; - tkVariable: Result := FVariableAttri; + case fTokenID of + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkOperator: Result := fOperatorAttri; + tkPragma: Result := fPragmaAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fInvalidAttri; + tkVariable: Result := fVariableAttri; else Result := nil; end; end; function TSynPerlSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; -function TSynPerlSyn.GetSampleSource: UnicodeString; +function TSynPerlSyn.GetSampleSource: string; begin Result := '#!/bin/perl'#13#10 + @@ -3818,31 +1224,234 @@ function TSynPerlSyn.GetSampleSource: UnicodeString; function TSynPerlSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterPerl; + Result := fDefaultFilter <> SYNS_FilterPerl; end; function TSynPerlSyn.IsIdentChar(AChar: WideChar): Boolean; +begin + Result := IsCharAlphaNumeric(AChar) or CharInSet(AChar, ['_', '$', '@', '%']) //Fiala +end; + +class function TSynPerlSyn.GetLanguageName: string; +begin + Result := SYNS_LangPerl; +end; + +class function TSynPerlSyn.GetFriendlyLanguageName: string; +begin + Result := SYNS_FriendlyLangPerl; +end; + +{begin} //Fiala +procedure TSynPerlSyn.VariableProc; +begin + { $" is Perl vaiable } //Fiala + if CharInSet(fLine[Run + 1], ['$', '"', '%', 'a'..'z', 'A'..'Z', '_', '#']) then + begin + fTokenID := tkVariable; + Inc(Run, 2); + while CharInSet(FLine[Run], ['0'..'9', 'a'..'z', 'A'..'Z', '_']) do + Inc(Run); + end + else + IdentProc; +end; + +function TSynPerlSyn.FuncVar(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkVariable + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncKey(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkKey + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncOperator(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkOperator + else + Result := tkIdentifier; +end; + +function TSynPerlSyn.FuncPragma(Index: Integer): TtkTokenKind; +begin + if IsCurrentToken(KeyWords[Index]) then + Result := tkPragma + else + Result := tkIdentifier; +end; +{end} //Fiala + +function TSynPerlSyn.IsWordBreakChar(AChar: WideChar): Boolean; //Fiala begin case AChar of - '%', '@', '$', '_', '0'..'9', 'a'..'z', 'A'..'Z': + #0..#32, '.', ',', ';', ':', '"', '''', '+', '`', '-', '^', '!', '?', '&', + '§', '#', '~', '[', ']', '(', ')', '{', '}', '<', '>', + '=', '*', '/', '\', '|': Result := True; else Result := False; end; end; -class function TSynPerlSyn.GetLanguageName: string; +function TSynPerlSyn.GetRange: Pointer; //Fiala begin - Result := SYNS_LangPerl; + Result := Pointer(fRange); end; -class function TSynPerlSyn.GetFriendlyLanguageName: UnicodeString; +procedure TSynPerlSyn.ResetRange; //Fiala begin - Result := SYNS_FriendlyLangPerl; + fRange:= rsUnknown; +end; + +//++ CodeFolding +procedure TSynPerlSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine, ToLine: Integer); +var + CurLine: string; + Line: Integer; + + function LineHasChar(Line: Integer; character: char; + StartCol: Integer): boolean; // faster than Pos! + var + I: Integer; + begin + Result := False; + for I := StartCol to Length(CurLine) do begin + if CurLine[I] = character then begin + // Char must have proper highlighting (ignore stuff inside comments...) + if GetHighlighterAttriAtRowCol(LinesToScan, Line, I) <> fCommentAttri then begin + Result := True; + Break; + end; + end; + end; + end; + + function FindBraces(Line: Integer): Boolean; + var + Col: Integer; + begin + Result := False; + + for Col := 1 to Length(CurLine) do + begin + // We've found a starting character + if CurLine[col] = '{' then + begin + // Char must have proper highlighting (ignore stuff inside comments...) + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> fCommentAttri then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, '}', col + 1) then begin + FoldRanges.StartFoldRange(Line + 1, 1); + Result := True; + end; + // Skip until a newline + Break; + end; + end else if CurLine[col] = '}' then + begin + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Col) <> fCommentAttri then + begin + // And ignore lines with both opening and closing chars in them + if not LineHasChar(Line, '{', col + 1) then begin + FoldRanges.StopFoldRange(Line + 1, 1); + Result := True; + end; + // Skip until a newline + Break; + end; + end; + end; // for Col + end; + + function FoldRegion(Line: Integer): Boolean; + var + S: string; + begin + Result := False; + S := TrimLeft(CurLine); + if Uppercase(Copy(S, 1, 9)) = '#REGION' then + begin + FoldRanges.StartFoldRange(Line + 1, FoldRegionType); + Result := True; + end + else if Uppercase(Copy(S, 1, 12)) = '#ENDREGION' then + begin + FoldRanges.StopFoldRange(Line + 1, FoldRegionType); + Result := True; + end; + end; + +begin + for Line := FromLine to ToLine do + begin + + CurLine := LinesToScan[Line]; + + // Skip empty lines + if CurLine = '' then begin + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end; + + // Find Fold regions + if FoldRegion(Line) then + Continue; + + // Find an braces on this line (Fold Type 1) + if not FindBraces(Line) then + FoldRanges.NoFoldInfo(Line + 1); + end; // while Line +end; +//-- CodeFolding + +procedure TSynPerlSyn.SetRange(Value: Pointer); //Fiala +begin + fRange := TRangeState(Value); +end; + +procedure TSynPerlSyn.StringEndProc; //Fiala +var + fBackslashCount: Integer; +begin + FTokenID := tkString; + repeat + case FLine[Run] of + #34: begin + Inc(Run); + fRange := rsUnknown; + Break; + end; + #0, #10, #13: Break; + #92: + { If we're looking at a backslash, and the following character is an + end quote, and it's preceeded by an odd number of backslashes, then + it shouldn't mark the end of the string. If it's preceeded by an + even number, then it should. } + if (FLine[Run + 1] = #34) then + begin + fBackslashCount := 1; + + while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = #92)) do + fBackslashCount := fBackslashCount + 1; + + if (fBackslashCount mod 2 = 1) then Inc(Run) + end; + end; + Inc(Run); + until IsLineEnd(Run); end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynPerlSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterProgress.pas b/Ext/SynEdit/Source/SynHighlighterProgress.pas index 8e97cb2..3cd40c3 100644 --- a/Ext/SynEdit/Source/SynHighlighterProgress.pas +++ b/Ext/SynEdit/Source/SynHighlighterProgress.pas @@ -26,13 +26,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterProgress.pas,v 1.16.2.8 2009/09/28 19:16:08 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a Progress Syntax highlighter for SynEdit) @@ -52,13 +45,13 @@ interface uses - Graphics, + System.SysUtils, + System.Classes, + System.Generics.Defaults, + System.Generics.Collections, + Vcl.Graphics, SynEditTypes, - SynEditHighlighter, - SynHighlighterHashEntries, - SynUnicode, - SysUtils, - Classes; + SynEditHighlighter; type {Enumerates the different tokens in Progress.} @@ -83,26 +76,25 @@ interface type TSynProgressSyn = class(TSynCustomHighLighter) private - FRange: TRangeState; - FCommentLevel: Integer; - FIncludeLevel: Integer; - FPreProcessorLevel: Integer; + fRange: TRangeState; + fCommentLevel: Integer; + fIncludeLevel: Integer; + fPreProcessorLevel: Integer; FTokenID: TtkTokenKind; - FCommentAttri: TSynHighlighterAttributes; - FEventAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FIncludeAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNonReservedKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FPreprocessorAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FDataTypeAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FHashList: TSynHashEntryList; - procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); - function HashKey(Str: PWideChar): Integer; + fCommentAttri: TSynHighlighterAttributes; + fEventAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fIncludeAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNonReservedKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fPreprocessorAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fDataTypeAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + FKeywords: TDictionary; + procedure DoAddKeyword(AKeyword: string; AKind: Integer); function IdentKind(MayBe: PWideChar): TtkTokenKind; procedure AsciiCharProc; procedure CommentRangeProc; @@ -122,15 +114,11 @@ TSynProgressSyn = class(TSynCustomHighLighter) protected function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override; - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; -{$IFDEF DEBUG} - public - property Keywords: TSynHashEntryList read FHashList; -{$ENDIF} + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -144,33 +132,33 @@ TSynProgressSyn = class(TSynCustomHighLighter) procedure SetRange(Value: Pointer); override; procedure ResetRange; override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property EventAttri: TSynHighlighterAttributes read FEventAttri - write FEventAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property IncludeAttri: TSynHighlighterAttributes read FIncludeAttri - write FIncludeAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property EventAttri: TSynHighlighterAttributes read fEventAttri + write fEventAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property IncludeAttri: TSynHighlighterAttributes read fIncludeAttri + write fIncludeAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; property NonReservedKeyAttri: TSynHighlighterAttributes - read FNonReservedKeyAttri write FNonReservedKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; + read fNonReservedKeyAttri write fNonReservedKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; property PreprocessorAttri: TSynHighlighterAttributes - read FPreprocessorAttri write FPreprocessorAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property DataTypeAttri: TSynHighlighterAttributes read FDataTypeAttri - write FDataTypeAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; + read fPreprocessorAttri write fPreprocessorAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property DataTypeAttri: TSynHighlighterAttributes read fDataTypeAttri + write fDataTypeAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; end; const - DefaultKeywords: UnicodeString = + DefaultKeywords: string = 'accum accumulate active-window add alias ' + 'all alter ambig ambiguous analyze ' + 'analyze-resume analyze-suspend and any apply ' + @@ -263,7 +251,7 @@ TSynProgressSyn = class(TSynCustomHighLighter) '_servers _startup _trace _trans _user ' + '_userio _userlock _view _view-col _view-ref'; - DefaultNonReservedKeywords: UnicodeString = + DefaultNonReservedKeywords: string = 'abs absolute accelerator across add-events-procedure ' + 'add-first add-interval add-last advise alert-box allow-replication ' + 'ansi-only anywhere append appl-alert appl-alert-boxes ' + @@ -418,7 +406,7 @@ TSynProgressSyn = class(TSynCustomHighLighter) 'x-of y year year-offset yes-no ' + 'yes-no-cancel y-of'; - DefaultEvents: UnicodeString = + DefaultEvents: string = 'abort any-key any-printable append-line backspace ' + 'back-tab block blue bottom-column break-line ' + 'bs cancel cancel-move cancel-pick cancel-resize ' + @@ -465,7 +453,7 @@ TSynProgressSyn = class(TSynCustomHighLighter) 'u8 u9 unix-end up-arrow value-changed ' + 'white window-close window-resized window-restored'; - DefaultDataTypes: UnicodeString = + DefaultDataTypes: string = 'char character com-handle component-handle date datetime datetime-tz dec ' + 'decimal double float handle int ' + 'integer int64 log logical longchar raw rowid ' + @@ -474,121 +462,86 @@ TSynProgressSyn = class(TSynCustomHighLighter) implementation uses + SynEditMiscProcs, SynEditStrConst; -function TSynProgressSyn.HashKey(Str: PWideChar): Integer; - - function GetOrd: Integer; - begin - case Str^ of - 'a'..'z': Result := 1 + Ord(Str^) - Ord('a'); - 'A'..'Z': Result := 1 + Ord(Str^) - Ord('A'); - '0'..'9': Result := 27 + Ord(Str^) - Ord('0'); - '_': Result := 37; - '-': Result := 38; - else Result := 0; - end; - end; - -begin - Result := 0; - while IsIdentChar(Str^) do - begin -{$IFOPT Q-} - Result := 3 * Result + GetOrd; -{$ELSE} - Result := (3 * Result + GetOrd) and $FFFFFF; -{$ENDIF} - Inc(Str); - end; - Result := Result and $3FF; - FStringLen := Str - FToIdent; -end; - function TSynProgressSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var - Entry: TSynHashEntry; + S: string; begin - FToIdent := MayBe; - Entry := FHashList[HashKey(MayBe)]; - while Assigned(Entry) do - begin - if Entry.KeywordLen > FStringLen then - Break - else if Entry.KeywordLen = FStringLen then - if IsCurrentToken(Entry.Keyword) then - begin - Result := TtkTokenKind(Entry.Kind); - Exit; - end; - Entry := Entry.Next; - end; - Result := tkIdentifier; + fToIdent := MayBe; + while IsIdentChar(MayBe^) do + Inc(Maybe); + fStringLen := Maybe - fToIdent; + SetString(S, fToIdent, fStringLen); + if FKeywords.ContainsKey(S) then + Result := FKeywords[S] + else + Result := tkIdentifier; end; -procedure TSynProgressSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); -var - HashValue: Integer; +procedure TSynProgressSyn.DoAddKeyword(AKeyword: string; AKind: Integer); begin - HashValue := HashKey(PWideChar(AKeyword)); - FHashList[HashValue] := TSynHashEntry.Create(AKeyword, AKind); + if not FKeywords.ContainsKey(AKeyword) then + FKeywords.Add(AKeyword, TtkTokenKind(AKind)); end; constructor TSynProgressSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := False; + fCaseSensitive := False; - FHashList := TSynHashEntryList.Create; + // Create the keywords dictionary case-insensitive + FKeywords := TDictionary.Create(TIStringComparer.Ordinal); - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Foreground := clRed; - AddAttribute(FCommentAttri); + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Foreground := clRed; + AddAttribute(fCommentAttri); - FEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrEvent, SYNS_FriendlyAttrEvent); - FEventAttri.Foreground := clOlive; - AddAttribute(FEventAttri); + fEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrEvent, SYNS_FriendlyAttrEvent); + fEventAttri.Foreground := clOlive; + AddAttribute(fEventAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - FIdentifierAttri.Foreground := clNavy; - AddAttribute(FIdentifierAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + fIdentifierAttri.Foreground := clNavy; + AddAttribute(fIdentifierAttri); - FIncludeAttri := TSynHighlighterAttributes.Create(SYNS_AttrInclude, SYNS_FriendlyAttrInclude); - FIncludeAttri.Foreground := clPurple; - AddAttribute(FIncludeAttri); + fIncludeAttri := TSynHighlighterAttributes.Create(SYNS_AttrInclude, SYNS_FriendlyAttrInclude); + fIncludeAttri.Foreground := clPurple; + AddAttribute(fIncludeAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Foreground := clMaroon; - AddAttribute(FKeyAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Foreground := clMaroon; + AddAttribute(fKeyAttri); - FNonReservedKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); - FNonReservedKeyAttri.Foreground := clTeal; - AddAttribute(FNonReservedKeyAttri); + fNonreservedKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); + fNonReservedKeyAttri.Foreground := clTeal; + AddAttribute(fNonReservedKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - FNumberAttri.Foreground := clMaroon; - AddAttribute(FNumberAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + fNumberAttri.Foreground := clMaroon; + AddAttribute(fNumberAttri); - FPreprocessorAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); - FPreprocessorAttri.Foreground := clPurple; - AddAttribute(FPreprocessorAttri); + fPreprocessorAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); + fPreprocessorAttri.Foreground := clPurple; + AddAttribute(fPreProcessorAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); - FDataTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); - FDataTypeAttri.Foreground := clSilver; - AddAttribute(FDataTypeAttri); + fDataTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); + fDataTypeAttri.Foreground := clSilver; + AddAttribute(fDataTypeAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - FStringAttri.Foreground := clBlue; - AddAttribute(FStringAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + fStringAttri.Foreground := clBlue; + AddAttribute(fStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); - FDefaultFilter := SYNS_FilterProgress; + fDefaultFilter := SYNS_FilterProgress; EnumerateKeywords(Ord(tkKey), DefaultKeywords, IsIdentChar, DoAddKeyword); EnumerateKeywords(Ord(tkNonReserved), DefaultNonReservedKeywords, @@ -601,331 +554,331 @@ constructor TSynProgressSyn.Create(AOwner: TComponent); destructor TSynProgressSyn.Destroy; begin - FHashList.Free; + FKeywords.Free; inherited Destroy; end; procedure TSynProgressSyn.IdentProc; begin - FTokenID := IdentKind(FLine + Run); - Inc(Run, FStringLen); + fTokenID := IdentKind(fLine + Run); + Inc(Run, fStringLen); end; procedure TSynProgressSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; procedure TSynProgressSyn.NumberProc; var - p: PWideChar; + P: PWideChar; begin - FTokenID := tkNumber; - p := PWideChar(@FLine[Run]); + fTokenID := tkNumber; + P := PWideChar(@fLine[Run]); repeat - Inc(p); - until not CharInSet(p^, ['0'..'9']); - Run := p - FLine; + Inc(P); + until not CharInSet(P^, ['0'..'9']); + Run := P - fLine; end; procedure TSynProgressSyn.PreprocessorDefinitionProc; var - p: PWideChar; + P: PWideChar; begin - FTokenID := tkPreprocessor; - p := PWideChar(@FLine[Run]); - while p^ <> #0 do + fTokenID := tkPreprocessor; + P := PWideChar(@fLine[Run]); + while P^ <> #0 do begin - case p^ of - '~': if (p + 1)^ = #0 then - FRange := rsPreprocessorDef; + case P^ of + '~': if (P + 1)^ = #0 then + fRange := rsPreprocessorDef; end; - Inc(p); + Inc(P); end; - Run := p - FLine; + Run := P - fLine; end; procedure TSynProgressSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynProgressSyn.StringProc; var - p: PWideChar; + P: PWideChar; begin - FTokenID := tkString; - p := PWideChar(@FLine[Run]); + fTokenID := tkString; + P := PWideChar(@fLine[Run]); repeat - Inc(p); - until (p^ = #0) or (p^ = '"'); - if (p^ = '"') then Inc(p); - Run := p - FLine; + Inc(P); + until (P^ = #0) or (P^ = '"'); + if (P^ = '"') then Inc(P); + Run := P - fLine; end; procedure TSynProgressSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynProgressSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynProgressSyn.AsciiCharProc; var - p: PWideChar; + P: PWideChar; begin - FTokenID := tkString; - p := PWideChar(@FLine[Run]); + fTokenID := tkString; + P := PWideChar(@fLine[Run]); repeat - Inc(p); - until (p^ = #0) or (p^ = ''''); - if (p^ = '''') then Inc(p); - Run := p - FLine; + Inc(P); + until (P^ = #0) or (P^ = ''''); + if (P^ = '''') then Inc(P); + Run := P - fLine; end; procedure TSynProgressSyn.SlashProc; var - p: PWideChar; + P: PWideChar; begin - p := PWideChar(@FLine[Run]); - Inc(p); - case p^ of + P := PWideChar(@fLine[Run]); + Inc(P); + case P^ of '*': begin {c style comments} - FTokenID := tkComment; - FRange := rsComment; - FCommentLevel := 1; - Inc(p); - while (p^ <> #0) and (FRange = rsComment) do + fTokenID := tkComment; + fRange := rsComment; + fCommentLevel := 1; + Inc(P); + while (P^ <> #0) and (fRange = rsComment) do begin - case p^ of + case P^ of '*': begin - Inc(p); - if p^ = '/' then + Inc(P); + if P^ = '/' then begin - Inc(p); - Dec(FCommentLevel); + Inc(P); + Dec(fCommentLevel); if FCommentLevel = 0 then - FRange := rsNone; + fRange := rsNone; end; end; '/': begin - Inc(p); - if p^ = '*' then + Inc(P); + if P^ = '*' then begin - Inc(p); - Inc(FCommentLevel); // Max 65535 commentlevels. + Inc(P); + Inc(fCommentLevel); // Max 65535 commentlevels. end; end; else - Inc(p); + Inc(P); end; end; end; else {division} - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; - Run := p - FLine; + Run := P - fLine; end; procedure TSynProgressSyn.CommentRangeProc; var - p: PWideChar; + P: PWideChar; begin - FTokenID := tkComment; - p := PWideChar(@FLine[Run]); + fTokenID := tkComment; + P := PWideChar(@fLine[Run]); - if p^ = #0 then + if P^ = #0 then begin NullProc; Exit; end; - while (p^ <> #0) and (FRange = rsComment) do + while (P^ <> #0) and (fRange = rsComment) do begin - case p^ of + case P^ of '*': begin - Inc(p); - if p^ = '/' then + Inc(P); + if P^ = '/' then begin - Inc(p); - Dec(FCommentLevel); - if FCommentLevel = 0 then - FRange := rsNone; + Inc(P); + Dec(fCommentLevel); + if fCommentLevel = 0 then + fRange := rsNone; end; end; '/': begin - Inc(p); - if p^ = '*' then + Inc(P); + if P^ = '*' then begin - Inc(p); - Inc(FCommentLevel); + Inc(P); + Inc(fCommentLevel); end; end; else - Inc(p); + Inc(P); end; end; - Run := p - FLine; + Run := P - fLine; end; procedure TSynProgressSyn.IncludeRangeProc; var - p: PWideChar; + P: PWideChar; begin - FTokenID := tkInclude; - p := PWideChar(@FLine[Run]); + fTokenID := tkInclude; + P := PWideChar(@fLine[Run]); - if p^ = #0 then + if P^ = #0 then begin NullProc; Exit; end; - while p^ <> #0 do + while P^ <> #0 do begin - case p^ of + case P^ of '}': begin - Dec(FIncludeLevel); - if FIncludeLevel = 0 then + Dec(fIncludeLevel); + if fIncludeLevel = 0 then begin - FRange := rsNone; + fRange := rsNone; Break; end else - Inc(p); + Inc(P); end; else - Inc(p); + Inc(P); end; end; - Run := p - FLine; + Run := P - fLine; end; procedure TSynProgressSyn.PreprocessorRangeProc; var - p: PWideChar; + P: PWideChar; begin - FTokenID := tkPreprocessor; - p := PWideChar(@FLine[Run]); + fTokenID := tkPreprocessor; + P := PWideChar(@fLine[Run]); - if p^ = #0 then + if P^ = #0 then begin NullProc; Exit; end; - while (p^ <> #0) and (FRange = rsPreprocessor) do + while (P^ <> #0) and (fRange = rsPreprocessor) do begin - case p^ of - '{': Inc(FPreProcessorLevel); + case P^ of + '{': Inc(fPreprocessorLevel); '}': begin - Dec(FPreProcessorLevel); - if FPreProcessorLevel = 0 then - FRange := rsNone; + Dec(fPreprocessorLevel); + if fPreprocessorLevel = 0 then + fRange := rsNone; end; end; - Inc(p); + Inc(P); end; - Run := p - FLine; + Run := P - fLine; end; procedure TSynProgressSyn.PreprocessorDefinitionRangeProc; var - p: PWideChar; + P: PWideChar; begin - FTokenID := tkPreprocessor; - p := PWideChar(@FLine[Run]); + fTokenID := tkPreprocessor; + P := PWideChar(@fLine[Run]); if Run = 0 then - FRange := rsNone; + fRange := rsNone; - if p^ = #0 then + if P^ = #0 then begin NullProc; Exit; end; - while p^ <> #0 do + while P^ <> #0 do begin - case p^ of - '~': if (p+1)^ = #0 then - FRange := rsPreprocessorDef; + case P^ of + '~': if (P+1)^ = #0 then + fRange := rsPreprocessorDef; end; - Inc(p); + Inc(P); end; - Run := p - FLine; + Run := P - fLine; end; procedure TSynProgressSyn.BraceOpenProc; var - p: PWideChar; + P: PWideChar; function LevelCount: Integer; begin - if FTokenID = tkInclude then - Result := FIncludeLevel + if fTokenID = tkInclude then + Result := fIncludeLevel else - Result := FPreProcessorLevel; + Result := fPreprocessorLevel; end; begin - p := PWideChar(@FLine[Run]); + P := PWideChar(@fLine[Run]); - Inc(p); - case p^ of - 'A'..'Z', 'a'..'z', '_': FTokenID := tkInclude; - '&' : FTokenID := tkPreprocessor; + Inc(P); + case P^ of + 'A'..'Z', 'a'..'z', '_': fTokenID := tkInclude; + '&' : fTokenID := tkPreprocessor; else - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; - case FTokenID of - tkInclude : FIncludeLevel := 1; - tkPreprocessor: FPreProcessorLevel := 1; + case fTokenID of + tkInclude : fIncludeLevel := 1; + tkPreprocessor: fPreprocessorLevel := 1; end; while LevelCount > 0 do begin - case p^ of + case P^ of #0 : begin - if FTokenID = tkInclude then - FRange := rsInclude + if fTokenID = tkInclude then + fRange := rsInclude else - FRange := rsPreprocessor; + fRange := rsPreprocessor; Break; end; - '}': case FTokenID of - tkInclude : Dec(FIncludeLevel); - tkPreprocessor: Dec(FPreProcessorLevel); + '}': case fTokenID of + tkInclude : Dec(fIncludeLevel); + tkPreprocessor: Dec(fPreprocessorLevel); end; - '{': case FTokenID of - tkInclude : Inc(FIncludeLevel); - tkPreprocessor: Inc(FPreProcessorLevel); + '{': case fTokenID of + tkInclude : Inc(fIncludeLevel); + tkPreprocessor: Inc(fPreprocessorLevel); end; end; - Inc(p); + Inc(P); end; - Run := p - FLine; + Run := P - fLine; end; procedure TSynProgressSyn.Next; begin - FTokenPos := Run; - case FRange of + fTokenPos := Run; + case fRange of rsInclude: IncludeRangeProc; rsPreprocessor: PreprocessorRangeProc; rsPreprocessorDef: PreprocessorDefinitionRangeProc; rsComment: CommentRangeProc; else - case FLine[Run] of + case fLine[Run] of #0: NullProc; #1..#9, #11, #12, #14..#32: SpaceProc; 'A'..'Z','a'..'z','_': IdentProc; @@ -949,59 +902,59 @@ function TSynProgressSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAtt function TSynProgressSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynProgressSyn.GetRange: Pointer; var rng: TRangeInfo; begin - rng.Range := Ord(FRange); + rng.Range := Ord(fRange); rng.Level := 0; - case FRange of - rsComment: rng.Level := FCommentLevel; - rsInclude: rng.Level := FIncludeLevel; - rsPreProcessor: rng.Level := FPreProcessorLevel; + case fRange of + rsComment: rng.Level := fCommentLevel; + rsInclude: rng.Level := fIncludeLevel; + rsPreProcessor: rng.Level := fPreProcessorLevel; end; Result := rng.Ptr; end; function TSynProgressSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynProgressSyn.GetTokenAttribute: TSynHighlighterAttributes; begin case GetTokenID of - tkComment: Result := FCommentAttri; - tkEvent: Result := FEventAttri; - tkIdentifier: Result := FIdentifierAttri; - tkInclude: Result := FIncludeAttri; - tkKey: Result := FKeyAttri; - tkNonReserved: Result := FNonReservedKeyAttri; - tkNumber: Result := FNumberAttri; - tkPreprocessor: Result := FPreprocessorAttri; - tkSpace: Result := FSpaceAttri; - tkDataType: Result := FDataTypeAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FSymbolAttri; + tkComment: Result := fCommentAttri; + tkEvent: Result := fEventAttri; + tkIdentifier: Result := fIdentifierAttri; + tkInclude: Result := fIncludeAttri; + tkKey: Result := fKeyAttri; + tkNonReserved: Result := fNonReservedKeyAttri; + tkNumber: Result := fNumberAttri; + tkPreprocessor: Result := fPreprocessorAttri; + tkSpace: Result := fSpaceAttri; + tkDataType: Result := fDataTypeAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fSymbolAttri; else Result := nil; end; end; function TSynProgressSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; procedure TSynProgressSyn.ResetRange; begin - FRange := rsNone; - FCommentLevel := 0; - FIncludeLevel := 0; - FPreProcessorLevel := 0; + fRange := rsNone; + fCommentLevel := 0; + fIncludeLevel := 0; + fPreprocessorLevel := 0; end; procedure TSynProgressSyn.SetRange(Value: Pointer); @@ -1009,20 +962,20 @@ procedure TSynProgressSyn.SetRange(Value: Pointer); rng: TRangeInfo; begin rng := TRangeInfo(Value); - FRange := TRangeState(rng.Range); - FCommentLevel := 0; - FIncludeLevel := 0; - FPreProcessorLevel := 0; - case FRange of - rsComment: FCommentLevel := rng.Level; - rsInclude: FIncludeLevel := rng.Level; - rsPreProcessor: FPreProcessorLevel := rng.Level; + fRange := TRangeState(rng.Range); + fCommentLevel := 0; + fIncludeLevel := 0; + fPreprocessorLevel := 0; + case fRange of + rsComment: fCommentLevel := rng.Level; + rsInclude: fIncludeLevel := rng.Level; + rsPreProcessor: fPreprocessorLevel := rng.Level; end; end; function TSynProgressSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterProgress; + Result := fDefaultFilter <> SYNS_FilterProgress; end; function TSynProgressSyn.IsIdentChar(AChar: WideChar): Boolean; @@ -1040,7 +993,7 @@ class function TSynProgressSyn.GetLanguageName: string; Result := SYNS_LangProgress; end; -function TSynProgressSyn.GetSampleSource: UnicodeString; +function TSynProgressSyn.GetSampleSource: string; begin Result := '&scoped-define FirstChar 65'#13#10+ '&scoped-define LastChar 90'#13#10+ @@ -1064,13 +1017,11 @@ function TSynProgressSyn.GetSampleSource: UnicodeString; 'display s.'; end; -class function TSynProgressSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynProgressSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangProgress; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynProgressSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterPython.pas b/Ext/SynEdit/Source/SynHighlighterPython.pas index 792d15d..c767050 100644 --- a/Ext/SynEdit/Source/SynHighlighterPython.pas +++ b/Ext/SynEdit/Source/SynHighlighterPython.pas @@ -13,7 +13,7 @@ mwEdit component suite by Martin Waldenburg and other developers, the Initial Author of this file is Olivier Deckmyn. Portions created by M.Utku Karatas and Dennis Chuah. -Unicode translation by Maël Hörz. +Unicode translation by Maël Hörz. All Rights Reserved. Contributors to the SynEdit and mwEdit projects are listed in the @@ -28,13 +28,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterPython.pas,v 1.18.2.7 2008/09/14 16:25:02 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(A Python language highlighter for SynEdit) @@ -51,16 +44,14 @@ interface uses - Graphics, - SynEditHighlighter, + System.SysUtils, + System.Classes, + SynEditCodeFolding, + System.RegularExpressions, + Vcl.Graphics, SynEditTypes, SynUnicode, -{$IFDEF SYN_CodeFolding} - SynEditCodeFolding, - SynRegExpr, -{$ENDIF} - SysUtils, - Classes; + SynEditHighlighter; const ALPHA_CHARS = ['_', 'a'..'z', 'A'..'Z']; @@ -70,38 +61,34 @@ interface tkString, tkSymbol, tkNonKeyword, tkTrippleQuotedString, tkSystemDefined, tkHex, tkOct, tkFloat, tkUnknown); - TRangeState = (rsANil, rsComment, rsUnknown, rsMultilineString, rsMultilineString2, + TRangeState = (rsUnKnown, rsMultilineString, rsMultilineString2, rsMultilineString3 //this is to indicate if a string is made multiline by backslash char at line end (as in C++ highlighter) ); -type -{$IFDEF SYN_CodeFolding} + TPyFoldType = (pftCodeBlock, pftMultiLineStringFoldType, pftClassDefType, pftFunctionDefType); + + TSynPythonSyn = class(TSynCustomCodeFoldingHighlighter) -{$ELSE} - TSynPythonSyn = class(TSynCustomHighLighter) -{$ENDIF} private - FStringStarter: WideChar; // used only for rsMultilineString3 stuff - FRange: TRangeState; + fStringStarter: WideChar; // used only for rsMultilineString3 stuff + fRange: TRangeState; FTokenID: TtkTokenKind; - FKeywords: TUnicodeStringList; - FStringAttri: TSynHighlighterAttributes; - FDocStringAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FHexAttri: TSynHighlighterAttributes; - FOctalAttri: TSynHighlighterAttributes; - FFloatAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNonKeyAttri: TSynHighlighterAttributes; - FSystemAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FCommentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FErrorAttri: TSynHighlighterAttributes; -{$IFDEF SYN_CodeFolding} - BlockOpenerRE : TRegExpr; -{$ENDIF} + FKeywords: TStringList; + fStringAttri: TSynHighlighterAttributes; + fDocStringAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fHexAttri: TSynHighlighterAttributes; + fOctalAttri: TSynHighlighterAttributes; + fFloatAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNonKeyAttri: TSynHighlighterAttributes; + fSystemAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fErrorAttri: TSynHighlighterAttributes; + BlockOpenerRE: TRegEx; function IdentKind(MayBe: PWideChar): TtkTokenKind; procedure SymbolProc; procedure CRProc; @@ -120,14 +107,15 @@ TSynPythonSyn = class(TSynCustomHighLighter) procedure StringEndProc(EndChar: WideChar); procedure UnknownProc; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; - function GetKeywordIdentifiers: TUnicodeStringList; - property Keywords: TUnicodeStringList read FKeywords; + function GetKeywordIdentifiers: TStringList; + property Keywords: TStringList read FKeywords; property TokenID: TtkTokenKind read FTokenID; public + class function GetCapabilities: TSynHighlighterCapabilities; override; class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -141,59 +129,61 @@ TSynPythonSyn = class(TSynCustomHighLighter) procedure Next; override; procedure SetRange(Value: Pointer); override; procedure ResetRange; override; -{$IFDEF SYN_CodeFolding} - procedure InitFoldRanges(FoldRanges : TSynFoldRanges); override; + procedure InitFoldRanges(FoldRanges: TSynFoldRanges); override; procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; -{$ENDIF} + procedure AdjustFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings); override; + function FlowControlAtLine(Lines: TStrings; Line: Integer): TSynFlowControl; override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NonKeyAttri: TSynHighlighterAttributes read FNonKeyAttri - write FNonKeyAttri; - property SystemAttri: TSynHighlighterAttributes read FSystemAttri - write FSystemAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property HexAttri: TSynHighlighterAttributes read FHexAttri - write FHexAttri; - property OctalAttri: TSynHighlighterAttributes read FOctalAttri - write FOctalAttri; - property FloatAttri: TSynHighlighterAttributes read FFloatAttri - write FFloatAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property DocStringAttri: TSynHighlighterAttributes read FDocStringAttri - write FDocStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; - property ErrorAttri: TSynHighlighterAttributes read FErrorAttri - write FErrorAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NonKeyAttri: TSynHighlighterAttributes read fNonKeyAttri + write fNonKeyAttri; + property SystemAttri: TSynHighlighterAttributes read fSystemAttri + write fSystemAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property HexAttri: TSynHighlighterAttributes read fHexAttri + write fHexAttri; + property OctalAttri: TSynHighlighterAttributes read fOctalAttri + write fOctalAttri; + property FloatAttri: TSynHighlighterAttributes read fFloatAttri + write fFloatAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property DocStringAttri: TSynHighlighterAttributes read fDocStringAttri + write fDocStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; + property ErrorAttri: TSynHighlighterAttributes read fErrorAttri + write fErrorAttri; end; implementation uses - SynEditStrConst; + SynEditStrConst, + SynEditMiscProcs; var - GlobalKeywords: TUnicodeStringList; + GlobalKeywords: TStringList; -function TSynPythonSyn.GetKeywordIdentifiers: TUnicodeStringList; + +function TSynPythonSyn.GetKeywordIdentifiers: TStringList; const // No need to localise keywords! // List of keywords - KEYWORDCOUNT = 32; - KEYWORDS: array [1..KEYWORDCOUNT] of UnicodeString = + KEYWORDCOUNT = 29; + KEYWORDS: array [1..KEYWORDCOUNT] of string = ( 'and', - 'as', 'assert', 'break', 'class', @@ -213,7 +203,6 @@ function TSynPythonSyn.GetKeywordIdentifiers: TUnicodeStringList; 'in', 'is', 'lambda', - 'nonlocal', 'not', 'or', 'pass', @@ -222,18 +211,18 @@ function TSynPythonSyn.GetKeywordIdentifiers: TUnicodeStringList; 'return', 'try', 'while', - 'with', 'yield' ); // List of non-keyword identifiers - NONKEYWORDCOUNT = 65; - NONKEYWORDS: array [1..NONKEYWORDCOUNT] of UnicodeString = + NONKEYWORDCOUNT = 66; + NONKEYWORDS: array [1..NONKEYWORDCOUNT] of string = ( '__future__', '__import__', 'abs', 'apply', + 'as', 'buffer', 'callable', 'chr', @@ -302,7 +291,7 @@ function TSynPythonSyn.GetKeywordIdentifiers: TUnicodeStringList; if not Assigned (GlobalKeywords) then begin // Create the string list of keywords - only once - GlobalKeywords := TUnicodeStringList.Create; + GlobalKeywords := TStringList.Create; for f := 1 to KEYWORDCOUNT do GlobalKeywords.AddObject(KEYWORDS[f], Pointer(Ord(tkKey))); @@ -316,21 +305,21 @@ function TSynPythonSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var i: Integer; temp: PWideChar; - s: UnicodeString; + s: string; begin // Extract the identifier out - it is assumed to terminate in a // non-alphanumeric character - FToIdent := MayBe; + fToIdent := MayBe; temp := MayBe; while IsIdentChar(temp^) do Inc(temp); - FStringLen := temp - FToIdent; + fStringLen := temp - fToIdent; // Check to see if it is a keyword - SetString(s, FToIdent, FStringLen); + SetString(s, fToIdent, fStringLen); if FKeywords.Find(s, i) then begin - // TUnicodeStringList is not case sensitive! + // TStringList is not case sensitive! if s <> FKeywords[i] then i := -1; end @@ -341,16 +330,12 @@ function TSynPythonSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; Result := TtkTokenKind(FKeywords.Objects[i]) // Check if it is a system identifier (__*__) - else if (FStringLen >= 5) and + else if (fStringLen >= 5) and (MayBe[0] = '_') and (MayBe[1] = '_') and (MayBe[2] <> '_') and - (MayBe[FStringLen - 1] = '_') and (MayBe[FStringLen - 2] = '_') and - (MayBe[FStringLen - 3] <> '_') then + (MayBe[fStringLen - 1] = '_') and (MayBe[fStringLen - 2] = '_') and + (MayBe[fStringLen - 3] <> '_') then Result := tkSystemDefined - // Check for names of class and functions - not optimal - else if ( (WideCompareStr(Trim(Copy(FLine, 0, Length(FLine) - Length(FToIdent))), 'def')=0) or (WideCompareStr(Trim(Copy(FLine, 0, Length(FLine) - Length(FToIdent))), 'class')=0) ) then - Result := tkSystemDefined - // Else, hey, it is an ordinary run-of-the-mill identifier! else Result := tkIdentifier; @@ -360,86 +345,118 @@ constructor TSynPythonSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := True; + fCaseSensitive := True; - FKeywords := TUnicodeStringList.Create; - FKeywords.Sorted := True; + FKeywords := TStringList.Create; FKeywords.Duplicates := dupError; FKeywords.Assign (GetKeywordIdentifiers); - if not FKeywords.Sorted then - FKeywords.Sort; + FKeywords.CaseSensitive := True; + FKeywords.Sorted := True; -{$IFDEF SYN_CodeFolding} - BlockOpenerRE := TRegExpr.Create; - BlockOpenerRE.Expression := // ':\s*(#.*)?$'; + BlockOpenerRE := CompiledRegEx( '^(def|class|while|for|if|else|elif|try|except|with'+ - '|(async[ \t]+def)|(async[ \t]+with)|(async[ \t]+for))\b'; -{$ENDIF} - - FRange := rsUnknown; - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Foreground := clGray; - FCommentAttri.Style := [fsItalic]; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); - FNonKeyAttri := TSynHighlighterAttributes.Create (SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); - FNonKeyAttri.Foreground := clNavy; - FNonKeyAttri.Style := [fsBold]; - AddAttribute (FNonKeyAttri); - FSystemAttri := TSynHighlighterAttributes.Create (SYNS_AttrSystem, SYNS_FriendlyAttrSystem); - FSystemAttri.Style := [fsBold]; - AddAttribute (FSystemAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - FNumberAttri.Foreground := clBlue; - AddAttribute(FNumberAttri); - FHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal); - FHexAttri.Foreground := clBlue; - AddAttribute(FHexAttri); - FOctalAttri := TSynHighlighterAttributes.Create(SYNS_AttrOctal, SYNS_FriendlyAttrOctal); - FOctalAttri.Foreground := clBlue; - AddAttribute(FOctalAttri); - FFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat); - FFloatAttri.Foreground := clBlue; - AddAttribute(FFloatAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - FStringAttri.Foreground := clBlue; - AddAttribute(FStringAttri); - FDocStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrDocumentation, SYNS_FriendlyAttrDocumentation); - FDocStringAttri.Foreground := clTeal; - AddAttribute(FDocStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); - FErrorAttri := TSynHighlighterAttributes.Create(SYNS_AttrSyntaxError, SYNS_FriendlyAttrSyntaxError); - FErrorAttri.Foreground := clRed; - AddAttribute(FErrorAttri); + '|(async[ \t]+def)|(async[ \t]+with)|(async[ \t]+for))\b'); + + fRange := rsUnknown; + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Foreground := clGray; + fCommentAttri.Style := [fsItalic]; + AddAttribute(fCommentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); + fNonKeyAttri := TSynHighlighterAttributes.Create (SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); + fNonKeyAttri.Foreground := clNavy; + fNonKeyAttri.Style := [fsBold]; + AddAttribute (fNonKeyAttri); + fSystemAttri := TSynHighlighterAttributes.Create (SYNS_AttrSystem, SYNS_FriendlyAttrSystem); + fSystemAttri.Style := [fsBold]; + AddAttribute (fSystemAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + fNumberAttri.Foreground := clBlue; + AddAttribute(fNumberAttri); + fHexAttri := TSynHighlighterAttributes.Create(SYNS_AttrHexadecimal, SYNS_FriendlyAttrHexadecimal); + fHexAttri.Foreground := clBlue; + AddAttribute(fHexAttri); + fOctalAttri := TSynHighlighterAttributes.Create(SYNS_AttrOctal, SYNS_FriendlyAttrOctal); + fOctalAttri.Foreground := clBlue; + AddAttribute(fOctalAttri); + fFloatAttri := TSynHighlighterAttributes.Create(SYNS_AttrFloat, SYNS_FriendlyAttrFloat); + fFloatAttri.Foreground := clBlue; + AddAttribute(fFloatAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + fStringAttri.Foreground := clBlue; + AddAttribute(fStringAttri); + fDocStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrDocumentation, SYNS_FriendlyAttrDocumentation); + fDocStringAttri.Foreground := clTeal; + AddAttribute(fDocStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); + fErrorAttri := TSynHighlighterAttributes.Create(SYNS_AttrSyntaxError, SYNS_FriendlyAttrSyntaxError); + fErrorAttri.Foreground := clRed; + AddAttribute(fErrorAttri); SetAttributesOnChange(DefHighlightChange); - FDefaultFilter := SYNS_FilterPython; + fDefaultFilter := SYNS_FilterPython; end; { Create } destructor TSynPythonSyn.Destroy; begin -{$IFDEF SYN_CodeFolding} - BlockOpenerRE.Free; -{$ENDIF} FKeywords.Free; inherited; end; +function TSynPythonSyn.FlowControlAtLine(Lines: TStrings; + Line: Integer): TSynFlowControl; +var + SLine: string; + Index: Integer; +begin + Result := fcNone; + + SLine := Lines[Line - 1]; + + Index := SLine.IndexOf('continue'); + if Index >= 0 then + Result := fcContinue + else + begin + Index := SLine.IndexOf('break'); + if Index >= 0 then + Result := fcBreak + else + begin + Index := SLine.IndexOf('return'); + if Index >= 0 then + Result := fcExit + else + begin + Index := SLine.IndexOf('yield'); + if Index >= 0 then + Result := fcExit + end; + end; + end; + + // Index is 0-based + if (Index >= 0) and + not (GetHighlighterAttriAtRowCol(Lines, Line - 1, Index + 1) = KeyAttri) + then + Result := fcNone; +end; + procedure TSynPythonSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynPythonSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; case FLine[Run + 1] of #10: Inc(Run, 2); else @@ -447,9 +464,21 @@ procedure TSynPythonSyn.CRProc; end; end; +procedure TSynPythonSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings); +var + I: Integer; +begin + inherited; + for I := 0 to FoldRanges.Count - 1 do + with FoldRanges.Ranges.List[I] do + if FoldType <> Integer(pftCodeBlock) then + Indent := 0; +end; + procedure TSynPythonSyn.CommentProc; begin - FTokenID := tkComment; + fTokenID := tkComment; Inc(Run); while not IsLineEnd(Run) do Inc(Run); @@ -460,24 +489,24 @@ procedure TSynPythonSyn.GreaterProc; case FLine[Run + 1] of '=': begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; end; procedure TSynPythonSyn.IdentProc; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); end; procedure TSynPythonSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; @@ -486,22 +515,22 @@ procedure TSynPythonSyn.LowerProc; case FLine[Run + 1] of '=': begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; '>': begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end else begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; end; procedure TSynPythonSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -511,9 +540,9 @@ procedure TSynPythonSyn.NumberProc; ( nsStart, nsDotFound, - nsFloatNeeded, nsHex, nsOct, + nsBinary, nsExpFound ); @@ -529,8 +558,8 @@ procedure TSynPythonSyn.NumberProc; // .45 if CharInSet(FLine[Run], ['0'..'9']) then begin - Inc (Run); - FTokenID := tkFloat; + Inc(Run); + fTokenID := tkFloat; State := nsDotFound; // Non-number dot @@ -538,7 +567,7 @@ procedure TSynPythonSyn.NumberProc; // Ellipsis if (FLine[Run] = '.') and (FLine[Run+1] = '.') then Inc (Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; Result := False; Exit; end; // if @@ -550,24 +579,23 @@ procedure TSynPythonSyn.NumberProc; // 0x123ABC if CharInSet(temp, ['x', 'X']) then begin Inc (Run); - FTokenID := tkHex; + fTokenID := tkHex; State := nsHex; + // 0o123 + end else if CharInSet(temp, ['o', 'O']) then begin + Inc (Run); + fTokenID := tkOct; + State := nsOct; + // 0b1010 + end else if CharInSet(temp, ['b', 'B']) then begin + Inc (Run); + fTokenID := tkOct; //paint same as octal + State := nsBinary; // 0.45 end else if temp = '.' then begin Inc (Run); State := nsDotFound; - FTokenID := tkFloat; - end else if CharInSet(temp, ['0'..'9']) then begin - Inc (Run); - // 0123 or 0123.45 - if CharInSet(temp, ['0'..'7']) then begin - FTokenID := tkOct; - State := nsOct; - // 0899.45 - end else begin - FTokenID := tkFloat; - State := nsFloatNeeded; - end; // if + fTokenID := tkFloat; end; // if end; // ZERO end; // case @@ -578,7 +606,7 @@ procedure TSynPythonSyn.NumberProc; function HandleBadNumber: Boolean; begin Result := False; - FTokenID := tkUnknown; + fTokenID := tkUnknown; // Ignore all tokens till end of "number" while IsIdentChar(FLine[Run]) or (FLine[Run] = '.') do Inc (Run); @@ -587,11 +615,11 @@ procedure TSynPythonSyn.NumberProc; function HandleExponent: Boolean; begin State := nsExpFound; - FTokenID := tkFloat; + fTokenID := tkFloat; // Skip e[+/-] if CharInSet(FLine[Run+1], ['+', '-']) then Inc (Run); - // Invalid token : 1.0e + // Invalid token: 1.0e if not CharInSet(FLine[Run+1], ['0'..'9']) then begin Inc (Run); Result := HandleBadNumber; @@ -607,14 +635,20 @@ procedure TSynPythonSyn.NumberProc; Result := (FLine[Run+1] <> '.') or (FLine[Run+2] <> '.'); if Result then begin State := nsDotFound; - FTokenID := tkFloat; + fTokenID := tkFloat; end; // if end; // HandleDot function CheckStart: Boolean; begin + // Allow underscores inside the number + if temp = '_' then begin + if CharInSet(FLine[Run + 1], ['0'..'9']) then + Result := True + else + Result := HandleBadNumber; // 1234 - if CharInSet(temp, ['0'..'9']) then begin + end else if CharInSet(temp, ['0'..'9']) then begin Result := True; //123e4 end else if CharInSet(temp, ['e', 'E']) then begin @@ -622,7 +656,7 @@ procedure TSynPythonSyn.NumberProc; // 123.45j end else if CharInSet(temp, ['j', 'J']) then begin Inc (Run); - FTokenID := tkFloat; + fTokenID := tkFloat; Result := False; // 123.45 end else if temp = '.' then begin @@ -638,8 +672,16 @@ procedure TSynPythonSyn.NumberProc; function CheckDotFound: Boolean; begin + // Allow underscores inside the number + if temp = '_' then begin + if CharInSet(FLine[Run - 1], ['0'..'9']) and + CharInSet(FLine[Run + 1], ['0'..'9']) + then + Result := True + else + Result := HandleBadNumber; // 1.0e4 - if CharInSet(temp, ['e', 'E']) then begin + end else if CharInSet(temp, ['e', 'E']) then begin Result := HandleExponent; // 123.45 end else if CharInSet(temp, ['0'..'9']) then begin @@ -662,88 +704,45 @@ procedure TSynPythonSyn.NumberProc; end; // if end; // CheckDotFound - function CheckFloatNeeded: Boolean; + function CheckSpecialInt(ValidChars: TSysCharSet): Boolean; begin - // 091.0e4 - if CharInSet(temp, ['e', 'E']) then begin - Result := HandleExponent; - // 0912345 - end else if CharInSet(temp, ['0'..'9']) then begin - Result := True; - // 09123.45 - end else if temp = '.' then begin - Result := HandleDot or HandleBadNumber; // Bad octal - // 09123.45j - end else if CharInSet(temp, ['j', 'J']) then begin - Inc (Run); - Result := False; - // End of number (error: Bad oct number) 0912345 - end else begin - Result := HandleBadNumber; - end; - end; // CheckFloatNeeded - - function CheckHex: Boolean; - begin - // 0x123ABC - if CharInSet(temp, ['a'..'f', 'A'..'F', '0'..'9']) then + // Allow underscores inside the number + if temp = '_' then begin + if CharInSet(FLine[Run - 1], ValidChars) and + CharInSet(FLine[Run + 1], ValidChars) + then + Result := True + else + Result := HandleBadNumber; + end else if CharInSet(temp, ValidChars) then begin Result := True; - // 0x123ABCL end else if CharInSet(temp, ['l', 'L']) then begin Inc (Run); Result := False; - // 0x123.45: Error! end else if temp = '.' then begin Result := False; if HandleDot then HandleBadNumber; - // Error! end else if IsIdentChar(temp) then begin Result := HandleBadNumber; - // End of number end else begin Result := False; end; // if end; // CheckHex - function CheckOct: Boolean; - begin - // 012345 - if CharInSet(temp, ['0'..'9']) then begin - if not CharInSet(temp, ['0'..'7']) then begin - State := nsFloatNeeded; - FTokenID := tkFloat; - end; // if - Result := True; - // 012345L - end else if CharInSet(temp, ['l', 'L']) then begin - Inc (Run); - Result := False; - // 0123e4 - end else if CharInSet(temp, ['e', 'E']) then begin - Result := HandleExponent; - // 0123j - end else if CharInSet(temp, ['j', 'J']) then begin - Inc (Run); - FTokenID := tkFloat; - Result := False; - // 0123.45 - end else if temp = '.' then begin - Result := HandleDot; - // Error! - end else if IsIdentChar(temp) then begin - Result := HandleBadNumber; - // End of number - end else begin - Result := False; - end; // if - end; // CheckOct - function CheckExpFound: Boolean; begin + // Allow underscores inside the number + if temp = '_' then begin + if CharInSet(FLine[Run - 1], ['0'..'9']) and + CharInSet(FLine[Run + 1], ['0'..'9']) + then + Result := True + else + Result := HandleBadNumber; // 1e+123 - if CharInSet(temp, ['0'..'9']) then begin + end else if CharInSet(temp, ['0'..'9']) then begin Result := True; // 1e+123j end else if CharInSet(temp, ['j', 'J']) then begin @@ -765,7 +764,7 @@ procedure TSynPythonSyn.NumberProc; begin State := nsStart; - FTokenID := tkNumber; + fTokenID := tkNumber; temp := FLine[Run]; Inc (Run); @@ -783,12 +782,12 @@ procedure TSynPythonSyn.NumberProc; if not CheckStart then Exit; nsDotFound: if not CheckDotFound then Exit; - nsFloatNeeded: - if not CheckFloatNeeded then Exit; nsHex: - if not CheckHex then Exit; + if not CheckSpecialInt(['a'..'f', 'A'..'F', '0'..'9']) then Exit; nsOct: - if not CheckOct then Exit; + if not CheckSpecialInt(['0'..'7']) then Exit; + nsBinary: + if not CheckSpecialInt(['0'..'1']) then Exit; nsExpFound: if not CheckExpFound then Exit; end; // case @@ -800,46 +799,45 @@ procedure TSynPythonSyn.NumberProc; procedure TSynPythonSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynPythonSyn.String2Proc; var - BackslashCount: Integer; + fBackslashCount: Integer; begin - FTokenID := tkString; + fTokenID := tkString; if (FLine[Run + 1] = '"') and (FLine[Run + 2] = '"') then begin - FTokenID := tkTrippleQuotedString; + fTokenID := tkTrippleQuotedString; Inc(Run, 3); - FRange := rsMultilineString2; - while FLine[Run] <> #0 do + fRange := rsMultilineString2; + while fLine[Run] <> #0 do begin - case FLine[Run] of - - '\': - begin - { If we're looking at a backslash, and the following character is an - end quote, and it's preceeded by an odd number of backslashes, then - it shouldn't mark the end of the string. If it's preceeded by an - even number, then it should. !!!THIS RULE DOESNT APPLY IN RAW STRINGS} - if FLine[Run + 1] = '"' then - begin - BackslashCount := 1; - - while ((Run > BackslashCount) and (FLine[Run - BackslashCount] = '\')) do - BackslashCount := BackslashCount + 1; - - if (BackslashCount mod 2 = 1) then Inc(Run) - end; - Inc(Run); - end;// '\': + case fLine[Run] of + + '\':begin + { If we're looking at a backslash, and the following character is an + end quote, and it's preceeded by an odd number of backslashes, then + it shouldn't mark the end of the string. If it's preceeded by an + even number, then it should. !!!THIS RULE DOESNT APPLY IN RAW STRINGS} + if FLine[Run + 1] = '"' then + begin + fBackslashCount := 1; + + while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do + fBackslashCount := fBackslashCount + 1; + + if (fBackslashCount mod 2 = 1) then Inc(Run) + end; + Inc(Run); + end;// '\': '"': - if (FLine[Run + 1] = '"') and (FLine[Run + 2] = '"') then begin - FRange := rsUnknown; + if (fLine[Run + 1] = '"') and (fLine[Run + 2] = '"') then begin + fRange := rsUnKnown; Inc(Run, 3); Exit; end else @@ -858,25 +856,24 @@ procedure TSynPythonSyn.String2Proc; begin if FLine[Run-1] = '\' then begin - FStringStarter := '"'; - FRange := rsMultilineString3; + fStringStarter := '"'; + fRange := rsMultilineString3; end; Break; end; {The same backslash stuff above...} - '\': - begin - if FLine[Run + 1] = '"' then - begin - BackslashCount := 1; + '\':begin + if FLine[Run + 1] = '"' then + begin + fBackslashCount := 1; - while ((Run > BackslashCount) and (FLine[Run - BackslashCount] = '\')) do - BackslashCount := BackslashCount + 1; + while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do + fBackslashCount := fBackslashCount + 1; - if (BackslashCount mod 2 = 1) then Inc(Run) - end; - Inc(Run); - end;// '\': + if (fBackslashCount mod 2 = 1) then Inc(Run) + end; + Inc(Run); + end;// '\': else Inc(Run); end; //case @@ -924,16 +921,16 @@ procedure TSynPythonSyn.UnicodeStringProc; procedure TSynPythonSyn.StringProc; var - FBackslashCount: Integer; + fBackslashCount: Integer; begin - FTokenID := tkString; + fTokenID := tkString; if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then begin - FTokenID := tkTrippleQuotedString; + fTokenID := tkTrippleQuotedString; Inc(Run, 3); - FRange:=rsMultilineString; - while FLine[Run] <> #0 do begin - case FLine[Run] of + fRange:=rsMultilineString; + while fLine[Run] <> #0 do begin + case fLine[Run] of '\': begin { If we're looking at a backslash, and the following character is an @@ -942,55 +939,54 @@ procedure TSynPythonSyn.StringProc; even number, then it should. !!!THIS RULE DOESNT APPLY IN RAW STRINGS} if FLine[Run + 1] = #39 then begin - FBackslashCount := 1; + fBackslashCount := 1; - while ((Run > FBackslashCount) and (FLine[Run - FBackslashCount] = '\')) do - FBackslashCount := FBackslashCount + 1; + while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do + fBackslashCount := fBackslashCount + 1; - if (FBackslashCount mod 2 = 1) then Inc(Run) + if (fBackslashCount mod 2 = 1) then Inc(Run) end; Inc(Run); end;// '\': #39: - if (FLine[Run + 1] = #39) and (FLine[Run + 2] = #39) then begin - FRange := rsUnknown; + if (fLine[Run + 1] = #39) and (fLine[Run + 2] = #39) then begin + fRange := rsUnKnown; Inc(Run, 3); - Exit; + EXIT; end else Inc(Run); - #10: Exit; - #13: Exit; + #10: EXIT; + #13: EXIT; else Inc(Run); end; end; end - else //if short string + else //if short string repeat case FLine[Run] of - #0, #10, #13 : begin + #0, #10, #13: begin if FLine[Run-1] = '\' then begin - FStringStarter := #39; - FRange := rsMultilineString3; + fStringStarter := #39; + fRange := rsMultilineString3; end; - Break; + BREAK; end; {The same backslash stuff above...} - '\': - begin - if FLine[Run + 1] = #39 then - begin - FBackslashCount := 1; + '\':begin + if FLine[Run + 1] = #39 then + begin + fBackslashCount := 1; - while ((Run > FBackslashCount) and (FLine[Run - FBackslashCount] = '\')) do - FBackslashCount := FBackslashCount + 1; + while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do + fBackslashCount := fBackslashCount + 1; - if (FBackslashCount mod 2 = 1) then Inc(Run) - end; - Inc(Run); - end;// '\': + if (fBackslashCount mod 2 = 1) then Inc(Run) + end; + Inc(Run); + end;// '\': else Inc(Run); end; //case @@ -1000,55 +996,55 @@ procedure TSynPythonSyn.StringProc; procedure TSynPythonSyn.StringEndProc(EndChar: WideChar); var - BackslashCount: Integer; + fBackslashCount: Integer; begin - if FRange = rsMultilineString3 then - FTokenID := tkString + if fRange = rsMultilineString3 then + fTokenID := tkString else - FTokenID := tkTrippleQuotedString; + fTokenID := tkTrippleQuotedString; case FLine[Run] of #0: begin NullProc; - Exit; + EXIT; end; #10: begin LFProc; - Exit; + EXIT; end; #13: begin CRProc; - Exit; + EXIT; end; end; - if FRange = rsMultilineString3 then begin + if fRange = rsMultilineString3 then begin repeat - if FLine[Run]=FStringStarter then begin + if FLine[Run]=fStringStarter then begin Inc(Run); - FRange:=rsUnknown; - Exit; + fRange:=rsUnknown; + EXIT; end else if FLine[Run]='\' then ; {The same backslash stuff above...} begin - if FLine[Run + 1] = FStringStarter then + if FLine[Run + 1] = fStringStarter then begin - BackslashCount := 1; + fBackslashCount := 1; - while ((Run > BackslashCount) and (FLine[Run - BackslashCount] = '\')) do - BackslashCount := BackslashCount + 1; + while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do + fBackslashCount := fBackslashCount + 1; - if (BackslashCount mod 2 = 1) then Inc(Run); + if (fBackslashCount mod 2 = 1) then Inc(Run); end; end;// if FLine[Run]... Inc(Run); until IsLineEnd(Run); if FLine[Run-1]<>'\' then begin - FRange:=rsUnknown; - Exit; + fRange:=rsUnknown; + EXIT; end; end else repeat @@ -1056,18 +1052,18 @@ procedure TSynPythonSyn.StringEndProc(EndChar: WideChar); begin if FLine[Run + 1] = EndChar then begin - BackslashCount := 1; + fBackslashCount := 1; - while ((Run > BackslashCount) and (FLine[Run - BackslashCount] = '\')) do - BackslashCount := BackslashCount + 1; + while ((Run > fBackslashCount) and (FLine[Run - fBackslashCount] = '\')) do + fBackslashCount := fBackslashCount + 1; - if (BackslashCount mod 2 = 1) then Inc(Run, 2); + if (fBackslashCount mod 2 = 1) then Inc(Run, 2); end; end;// if FLine[Run]... if (FLine[Run]=EndChar) and (FLine[Run+1]=EndChar) and (FLine[Run+2]=EndChar) then begin Inc(Run,3); - FRange:=rsUnknown; - Exit; + fRange:=rsUnknown; + EXIT; end; Inc(Run); until IsLineEnd(Run); @@ -1076,22 +1072,22 @@ procedure TSynPythonSyn.StringEndProc(EndChar: WideChar); procedure TSynPythonSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynPythonSyn.Next; begin - FTokenPos := Run; + fTokenPos := Run; - case FRange of + case fRange of rsMultilineString: StringEndProc(#39); rsMultilineString2: StringEndProc('"'); rsMultilineString3: - StringEndProc(FStringStarter); + StringEndProc(fStringStarter); else - case FLine[Run] of + case fLine[Run] of '&', '}', '{', ':', ',', ']', '[', '*', '`', '^', ')', '(', ';', '/', '=', '-', '+', '!', '\', '%', '|', '~' : @@ -1115,13 +1111,18 @@ procedure TSynPythonSyn.Next; inherited; end; +class function TSynPythonSyn.GetCapabilities: TSynHighlighterCapabilities; +begin + Result := inherited GetCapabilities + [hcStructureHighlight]; +end; + function TSynPythonSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -1129,36 +1130,36 @@ function TSynPythonSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttri function TSynPythonSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynPythonSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; function TSynPythonSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynPythonSyn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNonKeyword: Result := FNonKeyAttri; - tkSystemDefined: Result := FSystemAttri; - tkNumber: Result := FNumberAttri; - tkHex: Result := FHexAttri; - tkOct: Result := FOctalAttri; - tkFloat: Result := FFloatAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkTrippleQuotedString: Result := FDocStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FErrorAttri; + case fTokenID of + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNonKeyword: Result := fNonKeyAttri; + tkSystemDefined: Result := fSystemAttri; + tkNumber: Result := fNumberAttri; + tkHex: Result := fHexAttri; + tkOct: Result := fOctalAttri; + tkFloat: Result := fFloatAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkTrippleQuotedString: Result := fDocStringAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fErrorAttri; else Result := nil; end; @@ -1166,15 +1167,14 @@ function TSynPythonSyn.GetTokenAttribute: TSynHighlighterAttributes; function TSynPythonSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; procedure TSynPythonSyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; end; -{$IFDEF SYN_CodeFolding} procedure TSynPythonSyn.InitFoldRanges(FoldRanges: TSynFoldRanges); begin inherited; @@ -1185,30 +1185,25 @@ procedure TSynPythonSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; LinesToScan: TStrings; FromLine, ToLine: Integer); var CurLine: string; - LeftTrimmedLine : string; + LeftTrimmedLine: string; Line: Integer; - Indent : Integer; - TabW : integer; - FoldType : integer; -const - MultiLineStringFoldType = 2; - ClassDefType = 3; - FunctionDefType = 4; + Indent: Integer; + TabW: Integer; + FoldType: Integer; - - function IsMultiLineString(Line : integer; Range : TRangeState; Fold : Boolean): Boolean; + function IsMultiLineString(Line: Integer; Range: TRangeState; Fold: Boolean): Boolean; begin Result := True; if TRangeState(GetLineRange(LinesToScan, Line)) = Range then begin if (TRangeState(GetLineRange(LinesToScan, Line - 1)) <> Range) and Fold then - FoldRanges.StartFoldRange(Line + 1, MultiLineStringFoldType) + FoldRanges.StartFoldRange(Line + 1, Integer(pftMultiLineStringFoldType)) else FoldRanges.NoFoldInfo(Line + 1); end else if (TRangeState(GetLineRange(LinesToScan, Line - 1)) = Range) and Fold then begin - FoldRanges.StopFoldRange(Line + 1, MultiLineStringFoldType); + FoldRanges.StopFoldRange(Line + 1, Integer(pftMultiLineStringFoldType)); end else Result := False; end; @@ -1228,27 +1223,6 @@ procedure TSynPythonSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; end; end; - function LeftSpaces: Integer; - var - p: PWideChar; - begin - p := PWideChar(CurLine); - if Assigned(p) then - begin - Result := 0; - while (p^ >= #1) and (p^ <= #32) do - begin - if (p^ = #9) then - Inc(Result, TabW) - else - Inc(Result); - Inc(p); - end; - end - else - Result := 0; - end; - begin // Deal with multiline strings for Line := FromLine to ToLine do begin @@ -1273,35 +1247,35 @@ procedure TSynPythonSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; Continue; TabW := TabWidth(LinesToScan); - Indent := LeftSpaces; + Indent := LeftSpaces(CurLine, True, TabW); // find fold openers - if BlockOpenerRE.Exec(LeftTrimmedLine) then - begin - if BlockOpenerRE.Match[1] = 'class' then - FoldType := ClassDefType - else if Pos('def', BlockOpenerRE.Match[1]) >= 1 then - FoldType := FunctionDefType - else - FoldType := 1; + with BlockOpenerRE.Match(LeftTrimmedLine) do + if Success then + begin + if Groups[1].Value = 'class' then + FoldType := Integer(pftClassDefType) + else if Pos('def', Groups[1].Value) >= 1 then + FoldType := Integer(pftFunctionDefType) + else + FoldType := Integer(pftCodeBlock); - FoldRanges.StartFoldRange(Line + 1, FoldType, Indent); - Continue; - end; + FoldRanges.StartFoldRange(Line + 1, FoldType, Indent); + Continue; + end; FoldRanges.StopFoldRange(Line + 1, 1, Indent) end; end; -{$ENDIF} procedure TSynPythonSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; function TSynPythonSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterPython; + Result := fDefaultFilter <> SYNS_FilterPython; end; class function TSynPythonSyn.GetLanguageName: string; @@ -1309,7 +1283,7 @@ class function TSynPythonSyn.GetLanguageName: string; Result := SYNS_LangPython; end; -function TSynPythonSyn.GetSampleSource: UnicodeString; +function TSynPythonSyn.GetSampleSource: string; begin Result := '#!/usr/local/bin/python'#13#10 + @@ -1320,15 +1294,13 @@ function TSynPythonSyn.GetSampleSource: UnicodeString; ' sys.exit(0)'; end; -class function TSynPythonSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynPythonSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangPython; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynPythonSyn); -{$ENDIF} finalization GlobalKeywords.Free; end. diff --git a/Ext/SynEdit/Source/SynHighlighterRC.pas b/Ext/SynEdit/Source/SynHighlighterRC.pas index 225b743..f897ae9 100644 --- a/Ext/SynEdit/Source/SynHighlighterRC.pas +++ b/Ext/SynEdit/Source/SynHighlighterRC.pas @@ -24,12 +24,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterRC.pas,v 1.6.2.8 2008/09/14 16:25:02 maelh Exp $ - -You may retrieve the latest version of SynEdit from the SynEdit home page, -located at http://SynEdit.SourceForge.net - -------------------------------------------------------------------------------} unit SynHighlighterRC; @@ -58,17 +52,17 @@ interface TSynRCSyn = class(TSynCustomHighlighter) private - FRange: TRangeState; - FTokenID: TtkTokenKind; - FIdentFuncTable: array[0..240] of TIdentFuncTableFunc; - FCommentAttri: TSynHighlighterAttributes; - FDirecAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; + fRange: TRangeState; + fTokenID: TtkTokenKind; + fIdentFuncTable: array[0..240] of TIdentFuncTableFunc; + fCommentAttri: TSynHighlighterAttributes; + fDirecAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; function AltFunc(Index: Integer): TtkTokenKind; function KeyWordFunc(Index: Integer): TtkTokenKind; function HashKey(Str: PWideChar): Cardinal; @@ -87,16 +81,16 @@ TSynRCSyn = class(TSynCustomHighlighter) procedure SymbolProc; procedure UnknownProc; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetCapabilities: TSynHighlighterCapabilities; override; class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(aOwner: TComponent); override; destructor Destroy; override; - function GetDefaultAttribute(index: Integer): TSynHighlighterAttributes; override; + function GetDefaultAttribute(index: integer): TSynHighlighterAttributes; override; function GetEol: Boolean; override; function GetRange: Pointer; override; function GetTokenID: TtkTokenKind; @@ -108,14 +102,14 @@ TSynRCSyn = class(TSynCustomHighlighter) function UseUserSettings(SettingIndex: Integer): Boolean; override; procedure EnumUserSettings(Settings: TStrings); override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; - property DirecAttri: TSynHighlighterAttributes read FDirecAttri write FDirecAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; + property DirecAttri: TSynHighlighterAttributes read fDirecAttri write fDirecAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri; end; implementation @@ -124,7 +118,7 @@ implementation SynEditStrConst; const - KeyWords: array[0..77] of UnicodeString = ( + KeyWords: array[0..77] of string = ( 'ACCELERATORS', 'ALT', 'ASCII', 'AUTO3STATE', 'AUTOCHECKBOX', 'AUTORADIOBUTTON', 'BITMAP', 'BLOCK', 'CAPTION', 'CHARACTERISTICS', 'CHECKBOX', 'CHECKED', 'CLASS', 'COMBOBOX', 'COMMENTS', 'COMPANYNAME', @@ -148,13 +142,13 @@ implementation -1, -1, -1, -1, 48, -1, 12, -1, -1, -1, -1, -1, -1, -1, 75, 73, 14, -1, 77, -1, 4, 63, -1, -1, -1, -1, 65, 19, 27, -1, 31, 38, -1, -1, -1, -1, -1, 50, -1, -1, -1, 28, -1, -1, -1, -1, -1, -1, -1, 8, 6, 18, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 49, 76, -1, 59, -1, -1, 52, 47, 29, -1, -1, -1, - -1, -1, -1, -1, 56, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 1, -1, -1, 71, 17, 32, 34, -1, 45, -1, -1, -1, 70, -1, 3, - -1, 62, 43, 5, -1, -1, 33, 0, 51, 16, 69, -1, -1, -1, 39, -1, -1, 7, -1, 11, - -1, -1, -1, 21, -1, 40, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, - -1, 26, -1, 66, 25, -1, -1, 72, -1, -1, 60, 15, -1, -1, -1, -1, 55, -1, -1, - -1, 30, -1, -1, -1, 46, -1, 58, -1, 37, 22, -1 + -1, -1, -1, -1, -1, -1, -1, 49, 76, -1, 59, -1, -1, 52, 47, 29, -1, -1, -1, + -1, -1, -1, -1, 56, -1, -1, 44, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 1, -1, -1, 71, 17, 32, 34, -1, 45, -1, -1, -1, 70, -1, 3, + -1, 62, 43, 5, -1, -1, 33, 0, 51, 16, 69, -1, -1, -1, 39, -1, -1, 7, -1, 11, + -1, -1, -1, 21, -1, 40, -1, -1, 36, -1, -1, -1, -1, -1, -1, -1, -1, -1, 53, + -1, 26, -1, 66, 25, -1, -1, 72, -1, -1, 60, 15, -1, -1, -1, -1, 55, -1, -1, + -1, 30, -1, -1, -1, 46, -1, 58, -1, 37, 22, -1 ); { TSynRCSyn } @@ -169,7 +163,7 @@ function TSynRCSyn.HashKey(Str: PWideChar): Cardinal; Inc(Str); end; Result := Result mod 241; - FStringLen := Str - FToIdent; + fStringLen := Str - fToIdent; end; {$Q+} @@ -177,25 +171,25 @@ function TSynRCSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; procedure TSynRCSyn.InitIdent; var - i: Integer; + I: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; + for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if KeyIndices[I] = -1 then + fIdentFuncTable[I] := AltFunc; - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if @FIdentFuncTable[i] = nil then - FIdentFuncTable[i] := KeyWordFunc; + for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if @fIdentFuncTable[I] = nil then + fIdentFuncTable[I] := KeyWordFunc; end; function TSynRCSyn.AltFunc(Index: Integer): TtkTokenKind; @@ -215,36 +209,36 @@ constructor TSynRCSyn.Create(aOwner: TComponent); begin inherited; - FCaseSensitive := True; + fCaseSensitive := True; - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - AddAttribute(FCommentAttri); + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + AddAttribute(fCommentAttri); - FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); - AddAttribute(FDirecAttri); + fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrPreprocessor, SYNS_FriendlyAttrPreprocessor); + AddAttribute(fDirecAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FRange := rsUnknown; - FDefaultFilter := SYNS_FilterRC; + fRange := rsUnknown; + fDefaultFilter := SYNS_FilterRC; end; destructor TSynRCSyn.Destroy; @@ -254,66 +248,65 @@ destructor TSynRCSyn.Destroy; procedure TSynRCSyn.QuoteProc; begin - FTokenID:= tkString; + fTokenId:= tkString; repeat Inc(Run); - until IsLineEnd(Run) or (FLine[Run] = #34); - if FLine[Run] = #34 then + until IsLineEnd(Run) or (fLine[Run] = #34); + if fLine[Run] = #34 then Inc(Run); end; procedure TSynRCSyn.SlashProc; begin - case FLine[Run + 1] of + case fLine[Run + 1] of #13: CRPRoc; #10: LFProc; '/': begin - FTokenID := tkComment; + fTokenId := tkComment; Inc(Run, 2); while not IsLineEnd(Run) do Inc(Run); end; '*': begin - FTokenID := tkComment; - FRange := rsComment; + fTokenID := tkComment; + fRange := rsComment; Inc(Run, 2); - while FLine[Run] <> #0 do - case FLine[Run] of + while fLine[Run] <> #0 do + case fLine[Run] of '*': - if FLine[Run + 1] = '/' then + if fLine[Run + 1] = '/' then begin Inc(Run, 2); - FRange := rsUnknown; + fRange := rsUnknown; Break; end else Inc(Run); - #10, #13: - Break; + #10, #13: Break; else Inc(Run); end; end; else - FTokenID := tkSymbol; + fTokenId := tkSymbol; Inc(Run); end end; procedure TSynRCSyn.CommentProc; begin - FTokenID := tkComment; - case FLine[Run] of + fTokenId := tkComment; + case fLine[Run] of #0: NullProc; #13: CRProc; #10: LFProc; else - FTokenID := tkComment; + fTokenId := tkComment; repeat - if (FLine[Run] = '*') and (FLine[Run +1] = '/') then + if (fLine[Run] = '*') and (fLine[Run +1] = '/') then begin Inc(Run, 2); - FRange := rsUnknown; + fRange := rsUnknown; Break; end else @@ -324,19 +317,19 @@ procedure TSynRCSyn.CommentProc; procedure TSynRCSyn.DirectiveProc; begin - FTokenID := tkDirective; + fTokenId := tkDirective; repeat - if (FLine[Run] = '/') then + if (fLine[Run] = '/') then begin - if FLine[Run +1] = '/' then + if fLine[Run +1] = '/' then begin - FRange := rsUnknown; + fRange := rsUnknown; Exit; end else - if FLine[Run +1] = '*' then + if fLine[Run +1] = '*' then begin - FRange := rsComment; + fRange := rsComment; Exit; end end; @@ -346,35 +339,35 @@ procedure TSynRCSyn.DirectiveProc; procedure TSynRCSyn.IdentProc; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do Inc(Run); + fTokenId := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynRCSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then + if fLine[Run] = #10 then Inc(Run); end; procedure TSynRCSyn.LFProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; end; procedure TSynRCSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenId := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynRCSyn.NullProc; begin - FTokenID := tkNull; + fTokenId := tkNull; Inc(Run); end; @@ -382,7 +375,7 @@ procedure TSynRCSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', 'u', 'U', 'x', 'X', 'A'..'F', 'a'..'f', 'L', 'l', '-', '+': Result := True; @@ -393,13 +386,11 @@ procedure TSynRCSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin - case FLine[Run] of - '.': - if FLine[Run + 1] = '.' then - Break; + case fLine[Run] of + '.': if fLine[Run + 1] = '.' then Break; end; Inc(Run); end; @@ -408,23 +399,23 @@ procedure TSynRCSyn.NumberProc; procedure TSynRCSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynRCSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynRCSyn.Next; begin - FTokenPos := Run; - case FRange of + fTokenPos := Run; + case fRange of rsDirective: DirectiveProc; rsComment: CommentProc; else - case FLine[Run] of + case fLine[Run] of #0: NullProc; #13: CRProc; #10: LFProc; @@ -444,60 +435,60 @@ procedure TSynRCSyn.Next; function TSynRCSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; end; function TSynRCSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynRCSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; function TSynRCSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenID; end; function TSynRCSyn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkComment: Result := FCommentAttri; - tkDirective: Result := FDirecAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FSymbolAttri; + case fTokenID of + tkComment: Result := fCommentAttri; + tkDirective: Result := fDirecAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fSymbolAttri; else Result := nil; end; end; function TSynRCSyn.GetTokenKind: Integer; begin - Result := Ord(GetTokenID); + Result := ord(GetTokenID); end; procedure TSynRCSyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; end; procedure TSynRCSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; procedure TSynRCSyn.EnumUserSettings(Settings: TStrings); @@ -517,7 +508,7 @@ class function TSynRCSyn.GetCapabilities: TSynHighlighterCapabilities; function TSynRCSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterRC; + Result := fDefaultFilter <> SYNS_FilterRC; end; class function TSynRCSyn.GetLanguageName: string; @@ -525,18 +516,16 @@ class function TSynRCSyn.GetLanguageName: string; Result := SYNS_LangRC; end; -function TSynRCSyn.GetSampleSource: UnicodeString; +function TSynRCSyn.GetSampleSource: string; begin Result := ''; end; -class function TSynRCSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynRCSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangRC; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynRCSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterRexx.pas b/Ext/SynEdit/Source/SynHighlighterRexx.pas index 6fcdf32..ed6831e 100644 --- a/Ext/SynEdit/Source/SynHighlighterRexx.pas +++ b/Ext/SynEdit/Source/SynHighlighterRexx.pas @@ -26,12 +26,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -------------------------------------------------------------------------------} unit SynHighlighterRexx; @@ -229,7 +223,7 @@ implementation SynEditStrConst; resourcestring - SYNS_FilterREXX = 'Rexx sources|*.REX'; + SYNS_FilterREXX = 'Rexx sources|*.REX|All files (*.*)|*.*'; SYNS_LangREXX = 'REXX'; SYNS_FriendlyLangREXX = 'REXX'; SYNS_AttrSpecial = 'Special'; @@ -393,7 +387,7 @@ function TSynRexxSyn.HashKey(Str: PWideChar): Cardinal; while IsIdentChar(Str^) do begin Result := Result * 290 + Ord(Str^) * 365; - inc(Str); + Inc(Str); end; Result := Result mod 349; fStringLen := Str - fToIdent; @@ -1211,29 +1205,29 @@ function TSynRexxSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; procedure TSynRexxSyn.SpaceProc; begin - inc(Run); + Inc(Run); fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynRexxSyn.NullProc; begin fTokenID := tkNull; - inc(Run); + Inc(Run); end; procedure TSynRexxSyn.CRProc; begin fTokenID := tkSpace; - inc(Run); + Inc(Run); if fLine[Run] = #10 then - inc(Run); + Inc(Run); end; procedure TSynRexxSyn.LFProc; begin fTokenID := tkSpace; - inc(Run); + Inc(Run); end; procedure TSynRexxSyn.MultilineCommentOpenProc; @@ -1392,14 +1386,14 @@ constructor TSynRexxSyn.Create(AOwner: TComponent); procedure TSynRexxSyn.IdentProc; begin fTokenID := IdentKind((fLine + Run)); - inc(Run, fStringLen); + Inc(Run, fStringLen); while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynRexxSyn.UnknownProc; begin - inc(Run); + Inc(Run); fTokenID := tkUnknown; end; diff --git a/Ext/SynEdit/Source/SynHighlighterRuby.pas b/Ext/SynEdit/Source/SynHighlighterRuby.pas index 37632dc..d719bd6 100644 --- a/Ext/SynEdit/Source/SynHighlighterRuby.pas +++ b/Ext/SynEdit/Source/SynHighlighterRuby.pas @@ -27,13 +27,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterRuby.pas,v 1.10.2.9 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a Ruby highlighter for SynEdit) @@ -76,22 +69,22 @@ interface type TSynRubySyn = class(TSynCustomHighlighter) private - FRange: TRangeState; + fRange: TRangeState; {$IFDEF SYN_HEREDOC} - FHeredocLength: Byte; - FHeredocChecksum: Word; + fHeredocLength: Byte; + fHeredocChecksum: Word; {$ENDIF} FTokenID: TtkTokenKind; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FSecondKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FCommentAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyWords: TUnicodeStrings; - FSecondKeys: TUnicodeStrings; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fSecondKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fCommentAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyWords: TStrings; + fSecondKeys: TStrings; procedure BraceOpenProc; procedure PointCommaProc; procedure CRProc; @@ -108,14 +101,14 @@ TSynRubySyn = class(TSynCustomHighlighter) {$IFDEF SYN_HEREDOC} procedure HeredocProc; {$ENDIF} - procedure SetSecondKeys(const Value: TUnicodeStrings); + procedure SetSecondKeys(const Value: TStrings); protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; procedure NextProcedure; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -124,30 +117,30 @@ TSynRubySyn = class(TSynCustomHighlighter) function GetEol: Boolean; override; function GetRange: Pointer; override; function GetTokenID: TtkTokenKind; - function IsKeyword(const AKeyword: UnicodeString): boolean; override; - function IsSecondKeyWord(aToken: UnicodeString): Boolean; + function IsKeyword(const AKeyword: string): Boolean; override; + function IsSecondKeyWord(aToken: string): Boolean; function GetTokenAttribute: TSynHighlighterAttributes; override; function GetTokenKind: Integer; override; procedure Next; override; procedure SetRange(Value: Pointer); override; procedure ResetRange; override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property SecondKeyAttri: TSynHighlighterAttributes read FSecondKeyAttri - write FSecondKeyAttri; - property SecondKeyWords: TUnicodeStrings read FSecondKeys write SetSecondKeys; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property SecondKeyAttri: TSynHighlighterAttributes read fSecondKeyAttri + write fSecondKeyAttri; + property SecondKeyWords: TStrings read fSecondKeys write SetSecondKeys; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; end; implementation @@ -158,27 +151,27 @@ implementation const RubyKeysCount = 43; - RubyKeys: array[1..RubyKeysCount] of UnicodeString = ( + RubyKeys: array[1..RubyKeysCount] of string = ( 'alias', 'attr', 'begin', 'break', 'case', 'class', 'def', 'do', 'else', 'elsif', 'end', 'ensure', 'exit', 'extend', 'false', 'for', 'gets', 'if', 'in', 'include', 'load', 'loop', 'module', 'next', 'nil', 'not', 'print', 'private', 'public', 'puts', 'raise', 'redo', 'require', 'rescue', 'retry', 'return', 'self', 'then', 'true', 'unless', 'when', 'while', 'yield'); -function TSynRubySyn.IsKeyword(const AKeyword: UnicodeString): Boolean; +function TSynRubySyn.IsKeyword(const AKeyword: string): Boolean; var First, Last, I, Compare: Integer; - Token: UnicodeString; + Token: string; begin First := 0; - Last := FKeyWords.Count - 1; + Last := fKeywords.Count - 1; Result := False; - Token := SynWideUpperCase(AKeyword); + Token := SysUtils.AnsiUpperCase(AKeyword); while First <= Last do begin I := (First + Last) shr 1; - Compare := WideCompareStr(FKeyWords[I], Token); + Compare := CompareStr(fKeywords[I], Token); if Compare = 0 then begin Result := True; @@ -191,19 +184,19 @@ function TSynRubySyn.IsKeyword(const AKeyword: UnicodeString): Boolean; end; end; { IsKeyWord } -function TSynRubySyn.IsSecondKeyWord(aToken: UnicodeString): Boolean; +function TSynRubySyn.IsSecondKeyWord(aToken: string): Boolean; var First, Last, I, Compare: Integer; - Token: UnicodeString; + Token: string; begin First := 0; - Last := FSecondKeys.Count - 1; + Last := fSecondKeys.Count - 1; Result := False; - Token := SynWideUpperCase(aToken); + Token := SysUtils.AnsiUpperCase(aToken); while First <= Last do begin I := (First + Last) shr 1; - Compare := WideCompareStr(FSecondKeys[i], Token); + Compare := CompareStr(fSecondKeys[i], Token); if Compare = 0 then begin Result := True; @@ -218,97 +211,95 @@ function TSynRubySyn.IsSecondKeyWord(aToken: UnicodeString): Boolean; constructor TSynRubySyn.Create(AOwner: TComponent); var - i: Integer; + I: Integer; begin inherited Create(AOwner); - FCaseSensitive := False; + fCaseSensitive := False; - FKeyWords := TUnicodeStringList.Create; - TUnicodeStringList(FKeyWords).Sorted := True; - TUnicodeStringList(FKeyWords).Duplicates := dupIgnore; - FSecondKeys := TUnicodeStringList.Create; - TUnicodeStringList(FSecondKeys).Sorted := True; - TUnicodeStringList(FSecondKeys).Duplicates := dupIgnore; + fKeyWords := TStringList.Create; + TStringList(fKeyWords).Sorted := True; + TStringList(fKeyWords).Duplicates := dupIgnore; + fSecondKeys := TStringList.Create; + TStringList(fSecondKeys).Sorted := True; + TStringList(fSecondKeys).Duplicates := dupIgnore; if not (csDesigning in ComponentState) then - for i := 1 to RubyKeysCount do - FKeyWords.Add(RubyKeys[i]); - - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Foreground := clMaroon; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Foreground := clBlue; - AddAttribute(FKeyAttri); - FSecondKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); - AddAttribute(FSecondKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - FNumberAttri.Foreground := clGreen; - AddAttribute(FNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - FStringAttri.Foreground := clPurple; - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - FSymbolAttri.Foreground := clBlue; - AddAttribute(FSymbolAttri); + for I := 1 to RubyKeysCount do + fKeyWords.Add(RubyKeys[I]); + + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Foreground := clMaroon; + AddAttribute(fCommentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Foreground := clBlue; + AddAttribute(fKeyAttri); + fSecondKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); + AddAttribute(fSecondKeyAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + fNumberAttri.Foreground := clGreen; + AddAttribute(fNumberAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + fStringAttri.Foreground := clPurple; + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + fSymbolAttri.Foreground := clBlue; + AddAttribute(fSymbolAttri); SetAttributesOnChange(DefHighlightChange); - FRange := rsUnknown; - FDefaultFilter := SYNS_FilterRuby; + fRange := rsUnknown; + fDefaultFilter := SYNS_FilterRuby; end; { Create } destructor TSynRubySyn.Destroy; begin - FKeyWords.Free; - FSecondKeys.Free; + fKeyWords.Free; + fSecondKeys.Free; inherited Destroy; end; { Destroy } procedure TSynRubySyn.BraceOpenProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynRubySyn.PointCommaProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynRubySyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; case FLine[Run + 1] of - #10: - Inc(Run, 2); - else - Inc(Run); + #10: Inc(Run, 2); + else Inc(Run); end; end; procedure TSynRubySyn.IdentProc; begin - while IsIdentChar(FLine[Run]) do Inc(Run); + while IsIdentChar(fLine[Run]) do Inc(Run); if IsKeyWord(GetToken) then begin - FTokenID := tkKey; + fTokenId := tkKey; Exit; end - else FTokenID := tkIdentifier; + else fTokenId := tkIdentifier; if IsSecondKeyWord(GetToken) then - FTokenID := tkSecondKey + fTokenId := tkSecondKey else - FTokenID := tkIdentifier; + fTokenId := tkIdentifier; end; procedure TSynRubySyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; @@ -323,7 +314,7 @@ procedure TSynRubySyn.LowerProc; {$IFDEF SYN_HEREDOC} if FLine[Run + 1] = '<' then begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; SkipRun := 0; QuoteChar := #0; @@ -352,25 +343,25 @@ procedure TSynRubySyn.LowerProc; if Len > 255 then begin - FTokenID := tkUnknown; + fTokenID := tkUnknown; Exit; end; if (QuoteChar <> #0) and (FLine[Run + SkipRun + Len] <> QuoteChar) then begin - FTokenID := tkUnknown; + fTokenID := tkUnknown; Exit; end; if IndentedHeredoc then - FRange := rsIndentedHeredoc + fRange := rsIndentedHeredoc else - FRange := rsHeredoc; - FHeredocLength := Len; - FHeredocChecksum := CalcFCS(FLine[Run + SkipRun], Len); + fRange := rsHeredoc; + fHeredocLength := Len; + fHeredocChecksum := CalcFCS(FLine[Run + SkipRun], Len); Inc(Run, SkipRun + Len); - FTokenID := tkString; + fTokenID := tkString; end else Inc(Run, 2); @@ -379,13 +370,13 @@ procedure TSynRubySyn.LowerProc; {$ENDIF} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; procedure TSynRubySyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -403,13 +394,12 @@ procedure TSynRubySyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of '.': - if FLine[Run + 1] = '.' then - Break; + if FLine[Run + 1] = '.' then Break; end; Inc(Run); end; @@ -418,7 +408,7 @@ procedure TSynRubySyn.NumberProc; procedure TSynRubySyn.RoundOpenProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenId := tkSymbol; end; procedure TSynRubySyn.SlashProc; @@ -427,21 +417,20 @@ procedure TSynRubySyn.SlashProc; '/': begin Inc(Run); - FTokenID := tkSymbol; + fTokenId := tkSymbol; end; '*': begin Inc(Run); - FTokenID := tkSymbol; + fTokenId := tkSymbol; end; else begin - FTokenID := tkComment; + fTokenID := tkComment; while FLine[Run] <> #0 do begin case FLine[Run] of - #10, #13: - Break; + #10, #13: Break; end; Inc(Run); end; @@ -452,7 +441,7 @@ procedure TSynRubySyn.SlashProc; procedure TSynRubySyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; @@ -476,14 +465,13 @@ procedure TSynRubySyn.StringProc; //until the matching close symbol is found. Otherwise the string is read until //the next occurrence of the same delimiter. - FTokenID := tkString; + fTokenID := tkString; QuoteChar := FLine[Run]; // either " or ' if (FLine[Run + 1] = QuoteChar) and (FLine[Run + 2] = QuoteChar) then Inc(Run, 2); repeat case FLine[Run] of - #0, #10, #13: - Break; + #0, #10, #13: Break; end; Inc(Run); until FLine[Run] = QuoteChar; @@ -493,7 +481,7 @@ procedure TSynRubySyn.StringProc; procedure TSynRubySyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; {$IFDEF SYN_HEREDOC} @@ -513,42 +501,42 @@ procedure TSynRubySyn.HeredocProc; end; var - i : Integer; + I: Integer; begin - if IsLineEnd(Run) and (FTokenPos = Run) then + if IsLineEnd(Run) and (fTokenPos = Run) then begin NextProcedure; Exit; end; - FTokenID := tkString; + fTokenID := tkString; - if FRange = rsIndentedHeredoc then - while FLine[Run] in [WideChar(#9), WideChar(#32)] do Inc(Run); + if fRange = rsIndentedHeredoc then + while FLine[Run] in [#$0009, #$0020] do Inc(Run); - if ((Run = 0) and (FRange = rsHeredoc)) or (FRange = rsIndentedHeredoc) then + if ((Run = 0) and (fRange = rsHeredoc)) or (fRange = rsIndentedHeredoc) then begin - i := 0; + I := 0; - while not IsLineEnd(FLine[Run + i]) do + while not IsLineEnd(FLine[Run + I]) do begin - if i > FHeredocLength then + if I > fHeredocLength then begin SkipToEOL; Exit; end; - Inc(i); + Inc(I); end; - if i <> FHeredocLength then + if I <> fHeredocLength then begin SkipToEOL; Exit; end; - if (CalcFCS(FLine[Run], i) = FHeredocChecksum) then + if (CalcFCS(FLine[Run], I) = fHeredocChecksum) then begin - FRange := rsUnknown; - Run := Run + i; + fRange := rsUnknown; + Run := Run + I; Exit; end; end; @@ -559,9 +547,9 @@ procedure TSynRubySyn.HeredocProc; procedure TSynRubySyn.Next; begin - FTokenPos := Run; + fTokenPos := Run; {$IFDEF SYN_HEREDOC} - if FRange in [rsHeredoc, rsIndentedHeredoc] then + if fRange in [rsHeredoc, rsIndentedHeredoc] then HeredocProc else {$ENDIF} @@ -592,11 +580,11 @@ procedure TSynRubySyn.NextProcedure; function TSynRubySyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; else Result := nil; end; @@ -604,7 +592,7 @@ function TSynRubySyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribu function TSynRubySyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynRubySyn.GetRange: Pointer; @@ -614,37 +602,37 @@ function TSynRubySyn.GetRange: Pointer; {$ENDIF} begin {$IFDEF SYN_HEREDOC} - RangePointer.Range := Ord(FRange); + RangePointer.Range := Ord(fRange); RangePointer.Length := 0; RangePointer.Checksum := 0; - if FRange in [rsHeredoc, rsIndentedHeredoc] then + if fRange in [rsHeredoc, rsIndentedHeredoc] then begin - RangePointer.Length := FHeredocLength; - RangePointer.Checksum := FHeredocChecksum; + RangePointer.Length := fHeredocLength; + RangePointer.Checksum := fHeredocChecksum; end; Result := RangePointer.Ptr; {$ELSE} - Result := Pointer(FRange); + Result := Pointer(fRange); {$ENDIF} end; function TSynRubySyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynRubySyn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkSecondKey: Result := FSecondKeyAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FSymbolAttri; + case fTokenID of + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkSecondKey: Result := fSecondKeyAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fSymbolAttri; else Result := nil; end; @@ -652,15 +640,15 @@ function TSynRubySyn.GetTokenAttribute: TSynHighlighterAttributes; function TSynRubySyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; procedure TSynRubySyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; {$IFDEF SYN_HEREDOC} - FHeredocLength := 0; - FHeredocChecksum := 0; + fHeredocLength := 0; + fHeredocChecksum := 0; {$ENDIF} end; @@ -672,20 +660,20 @@ procedure TSynRubySyn.SetRange(Value: Pointer); begin {$IFDEF SYN_HEREDOC} RangePointer := TRangePointer(Value); - FRange := TRangeState(RangePointer.Range); - FHeredocLength := 0; - FHeredocChecksum := 0; - if FRange in [rsHeredoc, rsIndentedHeredoc] then + fRange := TRangeState(RangePointer.Range); + fHeredocLength := 0; + fHeredocChecksum := 0; + if fRange in [rsHeredoc, rsIndentedHeredoc] then begin - FHeredocLength := RangePointer.Length; - FHeredocChecksum := RangePointer.Checksum; + fHeredocLength := RangePointer.Length; + fHeredocChecksum := RangePointer.Checksum; end; {$ELSE} - FRange := TRangeState(Value); + fRange := TRangeState(Value); {$ENDIF} end; -procedure TSynRubySyn.SetSecondKeys(const Value: TUnicodeStrings); +procedure TSynRubySyn.SetSecondKeys(const Value: TStrings); var i: Integer; begin @@ -693,16 +681,16 @@ procedure TSynRubySyn.SetSecondKeys(const Value: TUnicodeStrings); begin Value.BeginUpdate; for i := 0 to Value.Count - 1 do - Value[i] := SynWideUpperCase(Value[i]); + Value[i] := SysUtils.AnsiUpperCase(Value[i]); Value.EndUpdate; end; - FSecondKeys.Assign(Value); + fSecondKeys.Assign(Value); DefHighLightChange(nil); end; function TSynRubySyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterRuby; + Result := fDefaultFilter <> SYNS_FilterRuby; end; class function TSynRubySyn.GetLanguageName: string; @@ -710,7 +698,7 @@ class function TSynRubySyn.GetLanguageName: string; Result := SYNS_LangRuby; end; -function TSynRubySyn.GetSampleSource: UnicodeString; +function TSynRubySyn.GetSampleSource: string; begin Result := '# Factorial'+#13#10+ @@ -724,13 +712,11 @@ function TSynRubySyn.GetSampleSource: UnicodeString; 'print fact(ARGV[0].to_i), "\n"'; end; -class function TSynRubySyn.GetFriendlyLanguageName: UnicodeString; +class function TSynRubySyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangRuby; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynRubySyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterSDD.pas b/Ext/SynEdit/Source/SynHighlighterSDD.pas index 6390d8e..ec6b6f8 100644 --- a/Ext/SynEdit/Source/SynHighlighterSDD.pas +++ b/Ext/SynEdit/Source/SynHighlighterSDD.pas @@ -25,12 +25,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterSDD.pas,v 1.13.2.6 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -------------------------------------------------------------------------------} unit SynHighlighterSDD; @@ -63,21 +57,21 @@ interface PIdentFuncTableFunc = ^TIdentFuncTableFunc; TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; - TRangeState = (rsComment, rsUnknown); + TRangeState = (rsComment, rsUnKnown); type TSynSDDSyn = class(TSynCustomHighlighter) private - FRange: TRangeState; - FTokenID: TtkTokenKind; - FIdentFuncTable: array[0..36] of TIdentFuncTableFunc; - FCommentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FDatatypeAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; + fRange: TRangeState; + fTokenID: TtkTokenKind; + fIdentFuncTable: array[0..36] of TIdentFuncTableFunc; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fDatatypeAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; function AltFunc(Index: Integer): TtkTokenKind; function FuncArray(Index: Integer): TtkTokenKind; function FuncBinarydata(Index: Integer): TtkTokenKind; @@ -120,11 +114,11 @@ TSynSDDSyn = class(TSynCustomHighlighter) procedure UnknownProc; procedure SymbolProc; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; function GetRange: Pointer; override; procedure ResetRange; override; procedure SetRange(Value: Pointer); override; @@ -138,13 +132,13 @@ TSynSDDSyn = class(TSynCustomHighlighter) function GetTokenKind: Integer; override; procedure Next; override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property DatatypeAttri: TSynHighlighterAttributes read FDatatypeAttri write FDatatypeAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property DatatypeAttri: TSynHighlighterAttributes read fDatatypeAttri write fDatatypeAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri; end; implementation @@ -153,7 +147,7 @@ implementation SynEditStrConst; const - KeyWords: array[0..26] of UnicodeString = ( + KeyWords: array[0..26] of string = ( 'array', 'binarydata', 'block', 'byte', 'database', 'date', 'end', 'endblock', 'integer', 'keys', 'longint', 'memotext', 'object', 'objects', 'of', 'owner', 'partition', 'partitions', 'primary', 'real', 'secondary', @@ -175,7 +169,7 @@ function TSynSDDSyn.HashKey(Str: PWideChar): Cardinal; Inc(Str); end; Result := Result mod 37; - FStringLen := Str - FToIdent; + fStringLen := Str - fToIdent; end; {$Q+} @@ -183,10 +177,10 @@ function TSynSDDSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; @@ -195,37 +189,37 @@ procedure TSynSDDSyn.InitIdent; var i: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; - - FIdentFuncTable[3] := FuncArray; - FIdentFuncTable[20] := FuncBinarydata; - FIdentFuncTable[14] := FuncBlock; - FIdentFuncTable[1] := FuncByte; - FIdentFuncTable[29] := FuncDatabase; - FIdentFuncTable[8] := FuncDate; - FIdentFuncTable[30] := FuncEnd; - FIdentFuncTable[27] := FuncEndblock; - FIdentFuncTable[0] := FuncInteger; - FIdentFuncTable[24] := FuncKeys; - FIdentFuncTable[10] := FuncLongint; - FIdentFuncTable[26] := FuncMemotext; - FIdentFuncTable[19] := FuncObject; - FIdentFuncTable[32] := FuncObjects; - FIdentFuncTable[5] := FuncOf; - FIdentFuncTable[22] := FuncOwner; - FIdentFuncTable[6] := FuncPartition; - FIdentFuncTable[21] := FuncPartitions; - FIdentFuncTable[2] := FuncPrimary; - FIdentFuncTable[9] := FuncReal; - FIdentFuncTable[11] := FuncSecondary; - FIdentFuncTable[17] := FuncSpec; - FIdentFuncTable[7] := FuncString; - FIdentFuncTable[36] := FuncSuperblock; - FIdentFuncTable[35] := FuncSuperspec; - FIdentFuncTable[4] := FuncTime; - FIdentFuncTable[15] := FuncVar; + fIdentFuncTable[i] := AltFunc; + + fIdentFuncTable[3] := FuncArray; + fIdentFuncTable[20] := FuncBinarydata; + fIdentFuncTable[14] := FuncBlock; + fIdentFuncTable[1] := FuncByte; + fIdentFuncTable[29] := FuncDatabase; + fIdentFuncTable[8] := FuncDate; + fIdentFuncTable[30] := FuncEnd; + fIdentFuncTable[27] := FuncEndblock; + fIdentFuncTable[0] := FuncInteger; + fIdentFuncTable[24] := FuncKeys; + fIdentFuncTable[10] := FuncLongint; + fIdentFuncTable[26] := FuncMemotext; + fIdentFuncTable[19] := FuncObject; + fIdentFuncTable[32] := FuncObjects; + fIdentFuncTable[5] := FuncOf; + fIdentFuncTable[22] := FuncOwner; + fIdentFuncTable[6] := FuncPartition; + fIdentFuncTable[21] := FuncPartitions; + fIdentFuncTable[2] := FuncPrimary; + fIdentFuncTable[9] := FuncReal; + fIdentFuncTable[11] := FuncSecondary; + fIdentFuncTable[17] := FuncSpec; + fIdentFuncTable[7] := FuncString; + fIdentFuncTable[36] := FuncSuperblock; + fIdentFuncTable[35] := FuncSuperspec; + fIdentFuncTable[4] := FuncTime; + fIdentFuncTable[15] := FuncVar; end; function TSynSDDSyn.AltFunc(Index: Integer): TtkTokenKind; @@ -453,85 +447,85 @@ constructor TSynSDDSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := False; + fCaseSensitive := False; - FCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Foreground := clNavy; - FCommentAttri.Style := [fsItalic]; - AddAttribute(FCommentAttri); + fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Foreground := clNavy; + fCommentAttri.Style := [fsItalic]; + AddAttribute(fCommentAttri); - FIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); + fIdentifierAttri := TSynHighLighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); - FKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - FKeyAttri.Foreground := clGreen; - AddAttribute(FKeyAttri); + fKeyAttri := TSynHighLighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + fKeyAttri.Foreground := clGreen; + AddAttribute(fKeyAttri); - FDatatypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); - FDatatypeAttri.Style := [fsBold]; - FDatatypeAttri.Foreground := clTeal; - AddAttribute(FDatatypeAttri); + fDatatypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); + fDatatypeAttri.Style := [fsBold]; + fDatatypeAttri.Foreground := clTeal; + AddAttribute(fDatatypeAttri); - FSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); + fSpaceAttri := TSynHighLighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); - FNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - FNumberAttri.Foreground := clBlue; - AddAttribute(FNumberAttri); + fNumberAttri := TSynHighLighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + fNumberAttri.Foreground := clBlue; + AddAttribute(fNumberAttri); - FSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); + fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FDefaultFilter := SYNS_FilterSDD; - FRange := rsUnknown; + fDefaultFilter := SYNS_FilterSDD; + fRange := rsUnknown; end; { Create } procedure TSynSDDSyn.BraceOpenProc; begin - FRange := rsComment; + fRange := rsComment; BraceCommentProc; - FTokenID := tkComment; + fTokenID := tkComment; end; { BraceOpenProc } procedure TSynSDDSyn.IdentProc; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; { IdentProc } procedure TSynSDDSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; { NullProc } procedure TSynSDDSyn.SpaceProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; repeat Inc(Run); - until not CharInSet(FLine[Run], [#1..#32]); + until not CharInSet(fLine[Run], [#1..#32]); end; { SpaceProc } procedure TSynSDDSyn.BraceCommentProc; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; else begin - FTokenID := tkComment; + fTokenID := tkComment; repeat - if FLine[Run] = '}' then + if fLine[Run] = '}' then begin Inc(Run); - FRange := rsUnknown; + fRange := rsUnKnown; Break; end; Inc(Run); @@ -543,16 +537,16 @@ procedure TSynSDDSyn.BraceCommentProc; procedure TSynSDDSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; { UnknownProc } procedure TSynSDDSyn.Next; begin - FTokenPos := Run; - case FRange of + fTokenPos := Run; + case fRange of rsComment: BraceCommentProc; else - case FLine[Run] of + case fLine[Run] of '{': BraceOpenProc; '}', '!', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~': SymbolProc; 'A'..'Z', 'a'..'z', '_': IdentProc; @@ -567,19 +561,19 @@ procedure TSynSDDSyn.Next; procedure TSynSDDSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then + if fLine[Run] = #10 then Inc(Run); end; { CRProc } procedure TSynSDDSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; { LFProc } -function TSynSDDSyn.GetSampleSource: UnicodeString; +function TSynSDDSyn.GetSampleSource: string; begin Result := '{ Semanta data dictionary }'#13#10 + 'database Sample.001;'#13#10 + @@ -598,11 +592,11 @@ function TSynSDDSyn.GetSampleSource: UnicodeString; function TSynSDDSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -610,25 +604,25 @@ function TSynSDDSyn.GetDefaultAttribute(Index: Integer): TSynHighLighterAttribut function TSynSDDSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; { GetEol } function TSynSDDSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; { GetTokenId } function TSynSDDSyn.GetTokenAttribute: TSynHighLighterAttributes; begin case GetTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkDatatype: Result := FDatatypeAttri; - tkSpace: Result := FSpaceAttri; - tkNumber: Result := FNumberAttri; - tkUnknown: Result := FIdentifierAttri; - tkSymbol: Result := FSymbolAttri; + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkDatatype: Result := fDatatypeAttri; + tkSpace: Result := fSpaceAttri; + tkNumber: Result := fNumberAttri; + tkUnknown: Result := fIdentifierAttri; + tkSymbol: Result := fSymbolAttri; else Result := nil; end; @@ -636,24 +630,24 @@ function TSynSDDSyn.GetTokenAttribute: TSynHighLighterAttributes; function TSynSDDSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; { GetTokenKind } procedure TSynSDDSyn.ResetRange; begin inherited; - FRange := rsUnknown; + fRange := rsUnknown; end; { ResetRange } procedure TSynSDDSyn.SetRange(Value: Pointer); begin inherited; - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; { SetRange } function TSynSDDSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; { GetRange } class function TSynSDDSyn.GetLanguageName: string; @@ -665,7 +659,7 @@ procedure TSynSDDSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', 'e', 'E': Result := True; else @@ -675,7 +669,7 @@ procedure TSynSDDSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of @@ -688,22 +682,20 @@ procedure TSynSDDSyn.NumberProc; function TSynSDDSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterSDD; + Result := fDefaultFilter <> SYNS_FilterSDD; end; { IsFilterStored } procedure TSynSDDSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; -class function TSynSDDSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynSDDSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangSDD; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynSDDSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterSQL.pas b/Ext/SynEdit/Source/SynHighlighterSQL.pas index e563653..2bf13a0 100644 --- a/Ext/SynEdit/Source/SynHighlighterSQL.pas +++ b/Ext/SynEdit/Source/SynHighlighterSQL.pas @@ -1,4 +1,4 @@ -{------------------------------------------------------------------------------- +{------------------------------------------------------------------------------- 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 @@ -30,19 +30,12 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterSQL.pas,v 1.39.2.14 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(SQL highlighter for SynEdit with support for different dialects.) @author(Michael Hieke) @created(2000-04-21) -@lastmod(2000-11-16) +@lastmod(2022-02-11) The SynHighlighterSQL implements a highlighter for SQL for the SynEdit projects. Different SQL dialects can be selected via the Dialect property. } @@ -53,22 +46,14 @@ interface -{$IFDEF SYN_COMPILER_12_UP} - {$DEFINE USE_TABLE_DICTIONARY} -{$ENDIF} - uses - Graphics, - Registry, + System.SysUtils, + System.Classes, + System.Generics.Defaults, + System.Generics.Collections, + Vcl.Graphics, SynEditTypes, - SynEditHighlighter, - SynHighlighterHashEntries, - SynUnicode, - {$IFDEF USE_TABLE_DICTIONARY} - Generics.Collections, - {$ENDIF} - SysUtils, - Classes; + SynEditHighlighter; type TtkTokenKind = (tkComment, tkDatatype, tkDefaultPackage, tkException, @@ -84,41 +69,38 @@ interface type TSynSQLSyn = class(TSynCustomHighlighter) private - FRange: TRangeState; - FTokenID: TtkTokenKind; - FKeywords: TSynHashEntryList; - FProcNames: TUnicodeStrings; - FTableNames: TUnicodeStrings; - {$IFDEF USE_TABLE_DICTIONARY} - FTableDict: TDictionary; - {$ENDIF} - FFunctionNames: TUniCodeStrings; - FDialect: TSQLDialect; - FCommentAttri: TSynHighlighterAttributes; - FConditionalCommentAttri: TSynHighlighterAttributes; - FConsoleOutputAttri: TSynHighlighterAttributes; - FDataTypeAttri: TSynHighlighterAttributes; - FDefaultPackageAttri: TSynHighlighterAttributes; - FDelimitedIdentifierAttri: TSynHighlighterAttributes; - FExceptionAttri: TSynHighlighterAttributes; - FFunctionAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FPLSQLAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FSQLPlusAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FTableNameAttri: TSynHighlighterAttributes; - FProcNameAttri: TSynHighlighterAttributes; - FVariableAttri: TSynHighlighterAttributes; - function HashKey(Str: PWideChar): Integer; - function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); + fRange: TRangeState; + fTokenID: TtkTokenKind; + FKeywords: TDictionary; + FProcNames: TStrings; + fTableNames: TStrings; + fFunctionNames: TStrings; + fDialect: TSQLDialect; + fCommentAttri: TSynHighlighterAttributes; + fConditionalCommentAttri: TSynHighlighterAttributes; + fConsoleOutputAttri: TSynHighlighterAttributes; + fDataTypeAttri: TSynHighlighterAttributes; + fDefaultPackageAttri: TSynHighlighterAttributes; + fDelimitedIdentifierAttri: TSynHighlighterAttributes; + fExceptionAttri: TSynHighlighterAttributes; + fFunctionAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fPLSQLAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fSQLPlusAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fTableNameAttri: TSynHighlighterAttributes; + fProcNameAttri: TSynHighlighterAttributes; + fVariableAttri: TSynHighlighterAttributes; + + function IdentKind: TtkTokenKind; + procedure DoAddKeyword(AKeyword: string; AKind: Integer); procedure SetDialect(Value: TSQLDialect); - procedure SetTableNames(const Value: TUnicodeStrings); - procedure SetFunctionNames(const Value: TUnicodeStrings); + procedure SetTableNames(const Value: TStrings); + procedure SetFunctionNames(const Value: TStrings); procedure PutFunctionNamesInKeywordList; procedure FunctionNamesChanged(Sender: TObject); procedure ProcNamesChanged(Sender: TObject); @@ -150,13 +132,13 @@ TSynSQLSyn = class(TSynCustomHighlighter) procedure VariableProc; procedure UnknownProc; procedure AnsiCProc; - procedure SetProcNames(const Value: TUnicodeStrings); + procedure SetProcNames(const Value: TStrings); protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -164,69 +146,72 @@ TSynSQLSyn = class(TSynCustomHighlighter) function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override; function GetEol: Boolean; override; - function GetKeyWords(TokenKind: Integer): UnicodeString; override; + function GetKeyWords(TokenKind: Integer): string; override; function GetRange: Pointer; override; function GetTokenAttribute: TSynHighlighterAttributes; override; function GetTokenID: TtkTokenKind; function GetTokenKind: Integer; override; function IsIdentChar(AChar: WideChar): Boolean; override; - function IsKeyword(const AKeyword: UnicodeString): Boolean; override; + function IsKeyword(const AKeyword: string): Boolean; override; procedure Next; override; procedure ResetRange; override; procedure SetRange(Value: Pointer); override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; property ConditionalCommentAttri: TSynHighlighterAttributes - read FConditionalCommentAttri write FConditionalCommentAttri; + read fConditionalCommentAttri write fConditionalCommentAttri; property ConsoleOutputAttri: TSynHighlighterAttributes read FConsoleOutputAttri write FConsoleOutputAttri; - property DataTypeAttri: TSynHighlighterAttributes read FDataTypeAttri - write FDataTypeAttri; + property DataTypeAttri: TSynHighlighterAttributes read fDataTypeAttri + write fDataTypeAttri; property DefaultPackageAttri: TSynHighlighterAttributes - read FDefaultPackageAttri write FDefaultPackageAttri; + read fDefaultPackageAttri write fDefaultPackageAttri; property DelimitedIdentifierAttri: TSynHighlighterAttributes - read FDelimitedIdentifierAttri write FDelimitedIdentifierAttri; - property ExceptionAttri: TSynHighlighterAttributes read FExceptionAttri - write FExceptionAttri; - property FunctionAttri: TSynHighlighterAttributes read FFunctionAttri - write FFunctionAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property PLSQLAttri: TSynHighlighterAttributes read FPLSQLAttri - write FPLSQLAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property SQLPlusAttri: TSynHighlighterAttributes read FSQLPlusAttri - write FSQLPlusAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; + read fDelimitedIdentifierAttri write fDelimitedIdentifierAttri; + property ExceptionAttri: TSynHighlighterAttributes read fExceptionAttri + write fExceptionAttri; + property FunctionAttri: TSynHighlighterAttributes read fFunctionAttri + write fFunctionAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property PLSQLAttri: TSynHighlighterAttributes read fPLSQLAttri + write fPLSQLAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property SQLPlusAttri: TSynHighlighterAttributes read fSQLPlusAttri + write fSQLPlusAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; property ProcNameAttri: TSynHighlighterAttributes read FProcNameAttri write FProcNameAttri; - property TableNameAttri: TSynHighlighterAttributes read FTableNameAttri - write FTableNameAttri; - property ProcNames: TUnicodeStrings read FProcNames write SetProcNames; - property TableNames: TUnicodeStrings read FTableNames write SetTableNames; - property FunctionNames: TUnicodeStrings read FFunctionNames write SetFunctionNames; - property VariableAttri: TSynHighlighterAttributes read FVariableAttri - write FVariableAttri; - property SQLDialect: TSQLDialect read FDialect write SetDialect + property TableNameAttri: TSynHighlighterAttributes read fTableNameAttri + write fTableNameAttri; + property ProcNames: TStrings read FProcNames write SetProcNames; + property TableNames: TStrings read fTableNames write SetTableNames; + property FunctionNames: TStrings read fFunctionNames write SetFunctionNames; + property VariableAttri: TSynHighlighterAttributes read fVariableAttri + write fVariableAttri; + property SQLDialect: TSQLDialect read fDialect write SetDialect default sqlStandard; end; implementation uses + Winapi.Windows, + System.Character, + SynEditMiscProcs, SynEditStrConst; const //---"Standard" (ANSI SQL keywords (Version 1, 2 and 3) (www.sql.org)----------- - StandardKW: UnicodeString = + StandardKW: string = 'absolute,action,active,actor,add,after,alias,all,allocate,alter,' + 'and,any,are,as,asc,ascending,assertion,async,at,attributes,auto,' + 'base_name,before,begin,between,bit,bit_length,boolean,both,breadth,by,' + @@ -263,7 +248,7 @@ implementation 'while,with,without,work,write,year,zone'; //---Sybase keywords------------------------------------------------------------ - SybaseKW: UnicodeString = + SybaseKW: string = 'absolute,action,add,after,alias,all,allocate,alter,and,any,are,' + 'arith_overflow,as,asc,assertion,async,at,authorization,avg,before,begin,' + 'between,bit,bit_length,boolean,both,breadth,break,browse,bulk,by,call,' + @@ -309,7 +294,7 @@ implementation //---Oracle--------------------------------------------------------------------- // Oracle SQL keywords - OracleKW: UnicodeString = + OracleKW: string = 'ACCESS,ACCESSED,ACCOUNT,ACTIVATE,ACTIVE_INSTANCE_COUNT,ADD,ADMIN,ADVISE,' + 'AGENT,ALL,ALLOCATE,ALTER,ANALYZE,ANCILLARY,AND,ANY,AQ_TM_PROCESSES,' + 'ARCHIVE_LAG_TARGET,ARCHIVELOG,AS,ASC,ASSOCIATE,ATTRIBUTES,AUDIT,' + @@ -430,7 +415,7 @@ implementation //---Postgresql----------------------------------------------------------------- //Postgresql Keywords - PostgresKW: UnicodeString = + PostgresKW: string = 'IF,LOOP,ABORT,ABSOLUTE,ACCESS,ACTION,ADA,ADD,ADMIN,AFTER,AGGREGATE,ALIAS' + ',ALLOCATE,ALTER,ANALYSE,ANALYZE,AND,ARE,AS,ASC,ASENSITIVE' + ',ASSERTION,ASSIGNMENT,ASYMMETRIC,AT,ATOMIC,AUTHORIZATION,BACKWARD' + @@ -487,7 +472,7 @@ implementation ',VARIABLE,VARYING,VERBOSE,VIEW,VOLATILE,WHEN,WHENEVER,WHERE,WITH,WITHOUT,WORK,WRITE,YEAR,ZONE'; //Postgresql Functions - PostgresFunctions: UnicodeString = + PostgresFunctions: string = 'abs,cbrt,ceil,ceiling,degrees,exp,floor,ln,log,mod,pi,power,radians,random,'+ 'round,setseed,sign,sqrt,trunc,width_bucket,acos,asin,atan,atan2,cos,cot,'+ 'sin,tan,bit_length,char_length,character_length,convert,lower,octet_length,'+ @@ -517,7 +502,7 @@ implementation 'current_user,current_date,current_time,current_timestamp,localtime,localtimestamp,session_user,user'; //Postgresql Types - PostgresTypes: UnicodeString = + PostgresTypes: string = 'smallint,integer,bigint,decimal,numeric,real,double,serial,bigserial,'+ 'character,varchar,char,text,bytea,timestamp, interval,date,'+ 'time,boolean,point,line,lseg,box,path,polygon,circle,cidr,inet,'+ @@ -526,7 +511,7 @@ implementation 'trigger,void,opaque,refcursor,binary,blob,int4,int2,int8,float,float4,float8'; //Postgresql Exceptions - PostgresExceptions: UnicodeString = + PostgresExceptions: string = '$BODY$,SUCCESSFUL_COMPLETION,WARNING,DYNAMIC_RESULT_SETS_RETURNED,IMPLICIT_ZERO_BIT_PADDING,NULL_VALUE_ELIMINATED_IN_SET_FUNCTION,'+ 'PRIVILEGE_NOT_GRANTED,PRIVILEGE_NOT_REVOKED,STRING_DATA_RIGHT_TRUNCATION,DEPRECATED_FEATURE,NO_DATA,NO_ADDITIONAL_DYNAMIC_RESULT_SETS_RETURNED,'+ 'SQL_STATEMENT_NOT_YET_COMPLETE,CONNECTION_EXCEPTION,CONNECTION_DOES_NOT_EXIST,CONNECTION_FAILURE,SQLCLIENT_UNABLE_TO_ESTABLISH_SQLCONNECTION,'+ @@ -562,7 +547,7 @@ implementation 'PLPGSQL_ERROR,RAISE_EXCEPTION,INTERNAL_ERROR,DATA_CORRUPTED,INDEX_CORRUPTED'; // PLSQL keywords - OraclePLSQLKW: UnicodeString = + OraclePLSQLKW: string = 'ABORT,ACCEPT,AFTER,ARRAY,ARRAYLEN,ASSERT,ASSIGN,AT,AUTHORIZATION,' + 'AUTONOMOUS_TRANSACTION,BASE_TABLE,BEGIN,BODY,BULK,BULK_ROWCOUNT,CALL,' + 'CALLING,CASE,CHAR_BASE,CHARSETFORM,CHARSETID,CLOSE,CLUSTERS,COLAUTH,' + @@ -590,7 +575,7 @@ implementation 'WHEN,WHILE,WORK,WRITE,XOR'; // Oracle data types - OracleTypes: UnicodeString = + OracleTypes: string = 'ANYDATA,ANYDATASET,ANYTYPE,BFILE,BINARY_DOUBLE,BINARY_FLOAT,BINARY_INTEGER,' + 'BLOB,BOOLEAN,CHAR,CLOB,DATE,DAY,DBURITYPE,DEC,DECIMAL,DOUBLE,FLOAT,' + 'HTTPURITYPE,IDENTITY,INTEGER,INTERVAL,LONG,MLSLABEL,MONTH,NATURAL,NATURALN,NCHAR,' + @@ -599,7 +584,7 @@ implementation 'XMLDATA,XMLTYPE,YEAR,ZONE'; // Oracle built in exceptions - OracleExceptions: UnicodeString = + OracleExceptions: string = 'ACCESS_INTO_NULL,CASE_NOT_FOUND,COLLECTION_IS_NULL,CURSOR_ALREADY_OPEN,' + 'DUP_VAL_ON_INDEX,INVALID_CURSOR,INVALID_NUMBER,LOGIN_DENIED,' + 'NO_DATA_FOUND,NOT_LOGGED_ON,OTHERS,PROGRAM_ERROR,ROWTYPE_MISMATCH,' + @@ -608,7 +593,7 @@ implementation 'ZERO_DIVIDE'; // Oracle built in functions - OracleFunctions: UnicodeString = + OracleFunctions: string = 'ABS,ACOS,ADD_MONTHS,AGGREGATE,ANALYTIC,ASCII,ASCIISTR,ASIN,ATAN,ATAN2,' + 'AVERAGE,AVG,BASE64_DECODE,BASE64_ENCODE,BEGIN_REQUEST,BFILENAME,' + 'BIN_TO_NUM,BIT_AND,BIT_COMPLEMENT,BIT_OR,BIT_XOR,BITAND,' + @@ -678,7 +663,7 @@ implementation 'XMLAGG,XMLCOLATTVAL,XMLCONCAT,XMLELEMENT,XMLFOREST,XMLSEQUENCE,' + 'XMLTRANSFORM,XRANGE'; - OracleDefaultPackages: UnicodeString = + OracleDefaultPackages: string = 'CTX_ADM,CTX_CLS,CTX_DDL,CTX_DOC,CTX_OUTPUT,CTX_QUERY,CTX_REPORT,CTX_THES,CTX_ULEXER,' + 'DBMS_ADVANCED_REWRITE,DBMS_ADVISOR,DBMS_ALERT,DBMS_APPLICATION_INFO,' + 'DBMS_APPLY_ADM,DBMS_AQ,DBMS_AQ_EXP_HISTORY_TABLES,DBMS_AQ_EXP_INDEX_TABLES,' + @@ -736,7 +721,7 @@ implementation 'UTL_I18N,UTL_INADDR,UTL_LMS,UTL_MAIL,UTL_NLA,UTL_PG,UTL_RAW,UTL_REF,UTL_SMTP,' + 'UTL_SPADV,UTL_TCP,UTL_URL,WPG_DOCLOAD'; - OracleSQLPlusCommands: UnicodeString = + OracleSQLPlusCommands: string = 'APP,APPINFO,AQ$_AGENT,AQ$_AGENT_LIST_T,AQ$_DESCRIPTOR,AQ$_POST_INFO,' + 'AQ$_POST_INFO_LIST,AQ$_RECIPIENT_LIST_T,AQ$_REG_INFO,AQ$_REG_INFO_LIST,' + 'AQ$_SUBSCRIBER_LIST_T,ARCHIVE,ARRAYSIZE,ATTRIBUTE,AUTOCOMMIT,AUTOP,' + @@ -759,15 +744,15 @@ implementation 'UNDERLINE,UP,VAR,VARIABLE,VER,VERIFY,VERSION,VIS,VISIBLE,WHENEVER,WR,' + 'WRA,WRAP,WRAPPED'; - OracleCommentKW: UnicodeString = + OracleCommentKW: string = 'REM,REMA,REMAR,REMARK'; - OracleConsoleOutputKW: UnicodeString = + OracleConsoleOutputKW: string = 'PRO,PROM,PROMP,PROMPT'; //---MS-SQL 7------------------------------------------------------------------- // keywords - MSSQL7KW: UnicodeString = + MSSQL7KW: string = 'ABSOLUTE,ADD,ALL,ALTER,ANY,AS,ASC,AUTHORIZATION,AVG,BACKUP,BEGIN,' + 'BETWEEN,BREAK,BROWSE,BULK,BY,CASCADE,CHECK,CHECKPOINT,CLOSE,CLUSTERED,' + 'COLUMN,COMMIT,COMMITTED,COMPUTE,CONFIRM,CONSTRAINT,CONTAINS,' + @@ -791,7 +776,7 @@ implementation 'VALUES,VARYING,VIEW,WAITFOR,WHEN,WHERE,WHILE,WITH,WORK,WRITETEXT'; // functions - MSSQL7Functions: UnicodeString = + MSSQL7Functions: string = '@@CONNECTIONS,@@CPU_BUSY,@@CURSOR_ROWS,@@DATEFIRST,@@DBTS,@@ERROR,' + '@@FETCH_STATUS,@@IDENTITY,@@IDLE,@@IO_BUSY,@@LANGID,@@LANGUAGE,' + '@@LOCK_TIMEOUT,@@MAX_CONNECTIONS,@@MAX_PRECISION,@@NESTLEVEL,@@OPTIONS,' + @@ -815,14 +800,14 @@ implementation 'UPPER,USER_ID,USER_NAME,YEAR'; // types - MSSQL7Types: UnicodeString = + MSSQL7Types: string = 'BINARY,BIT,CHAR,DATETIME,DECIMAL,FLOAT,IMAGE,INT,MONEY,NCHAR,NTEXT,' + 'NUMERIC,NVARCHAR,REAL,SMALLDATETIME,SMALLINT,SMALLMONEY,SYSNAME,TEXT,' + 'TIMESTAMP,TINYINT,UNIQUEIDENTIFIER,VARBINARY,VARCHAR'; //---MS-SQL2K------------------------------------------------------------------- // keywords - MSSQL2000KW: UnicodeString = + MSSQL2000KW: string = 'ADD,ALL,ALTER,AND,ANY,AS,ASC,AUTHORIZATION,BACKUP,' + 'BEGIN,BETWEEN,BREAK,BROWSE,BULK,BY,CASCADE,CASE,' + 'CHECK,CHECKPOINT,CLOSE,CLUSTERED,COLLATE,' + @@ -848,7 +833,7 @@ implementation 'WITH,WRITETEXT'; // functions - MSSQL2000Functions: UnicodeString = + MSSQL2000Functions: string = '@@CONNECTIONS,@@CPU_BUSY,@@CURSOR_ROWS,@@DATEFIRST,@@DBTS,@@ERROR,' + '@@FETCH_STATUS,@@IDENTITY,@@IDLE,@@IO_BUSY,@@LANGID,@@LANGUAGE,' + '@@LOCK_TIMEOUT,@@MAX_CONNECTIONS,@@MAX_PRECISION,@@NESTLEVEL,@@OPTIONS,' + @@ -879,7 +864,7 @@ implementation 'USER_ID,USER_NAME,VAR,VARP,YEAR'; // types - MSSQL2000Types: UnicodeString = + MSSQL2000Types: string = 'bigint,binary,bit,char,character,datetime,' + 'dec,decimal,float,image,int,' + 'integer,money,nchar,ntext,numeric,nvarchar,real,' + @@ -889,10 +874,10 @@ implementation //---Interbase 6---------------------------------------------------------------- // functions - Interbase6Functions: UnicodeString = 'AVG,CAST,COUNT,GEN_ID,MAX,MIN,SUM,UPPER'; + Interbase6Functions: string = 'AVG,CAST,COUNT,GEN_ID,MAX,MIN,SUM,UPPER'; // keywords - Interbase6KW: UnicodeString = 'ACTIVE,ADD,AFTER,ALL,ALTER,AND,ANY,AS,ASC,' + + Interbase6KW: string = 'ACTIVE,ADD,AFTER,ALL,ALTER,AND,ANY,AS,ASC,' + 'ASCENDING,AT,AUTO,AUTODDL,BASED,BASENAME,BASE_NAME,BEFORE,BEGIN,BETWEEN,' + 'BLOBEDIT,BUFFER,BY,CACHE,CHARACTER_LENGTH,CHAR_LENGTH,CHECK,' + 'CHECK_POINT_LEN,CHECK_POINT_LENGTH,COLLATE,COLLATION,COLUMN,COMMIT,' + @@ -923,13 +908,13 @@ implementation 'WAIT,WEEKDAY,WHEN,WHENEVER,WHERE,WHILE,WITH,WORK,WRITE,YEAR,YEARDAY'; // types - Interbase6Types: UnicodeString = + Interbase6Types: string = 'BLOB,CHAR,CHARACTER,DATE,DECIMAL,DOUBLE,FLOAT,INTEGER,' + 'NUMERIC,SMALLINT,TIME,TIMESTAMP,VARCHAR'; //---MySQL---------------------------------------------------------------------- // keywords - MySqlKW: UnicodeString = + MySqlKW: string = 'ACCOUNT,ACTION,ADD,AFTER,AGAINST,ALGORITHM,ALL,ALTER,ANY,ALWAYS,ANALYZE,' + 'AND,AS,ASC,AT,AUTO_INCREMENT,AVG_ROW_LENGTH,BEFORE,BEGIN,BETWEEN,BINLOG,' + 'BLOCK,BOTH,BY,CACHE,CALL,CASCADE,CASCADED,CATALOG_NAME,CHANGE,CHANGED,' + @@ -993,11 +978,11 @@ implementation 'WHERE,WRAPPER,WRITE,WITH,WITHOUT,WORK,XA,XID,XML,XOR,YEAR_MONTH'; // PLSQL keywords - MySQLPLSQLKW: UnicodeString = + MySQLPLSQLKW: string = 'CASE,CLOSE,EXIT,FETCH,GOTO,HANDLER,ITERATE,IF,LEAVE,LOOP,REPEAT,THEN,' + 'UNTIL,WHEN,WHILE'; - MySQLTypes: UnicodeString = + MySQLTypes: string = // Table Engines 'ARCHIVE,BDB,BERKELEYDB,BLACKHOLE,CSV,EXAMPLE,FEDERATED,HEAP,INNOBASE,' + @@ -1095,7 +1080,7 @@ implementation 'utf8_vietnamese_ci'; // functions - MySQLFunctions: UnicodeString = + MySQLFunctions: string = 'ABS,ACOS,ADDDATE,ADDTIME,AES_DECRYPT,AES_ENCRYPT,ANY_VALUE,AREA,' + 'ASBINARY,ASCII,ASIN,ASTEXT,ASWKBASWKT,ASYMMETRIC_DECRYPT,' + 'ASYMMETRIC_DERIVE,ASYMMETRIC_ENCRYPT,ASYMMETRIC_SIGN,ASYMMETRIC_VERIFY,' + @@ -1168,7 +1153,7 @@ implementation //---Ingres--------------------------------------------------------------------- // keywords - IngresKW: UnicodeString = + IngresKW: string = 'ABORT,ACTIVATE,ADD,ADDFORM,AFTER,AGGREGATE,ALL,ALTER,AND,APPEND,ARRAY,' + 'AS,ASC,AT,AUDIT_LOG,AUTHORIZATION,AUTOCOMMIT,AVGU,BEFORE,BEGIN,BETWEEN,' + 'BREAKDISPLAY,BY,BYREF,CACHE,CALL,CALLFRAME,CALLPROC,CASCADE,CHECK,CLEAR,' + @@ -1208,13 +1193,13 @@ implementation 'VALIDATE,VALIDROW,VALUES,VIEW,WHEN,WHENEVER,WHERE,WHILE,WITH,WORK'; // types - IngresTypes: UnicodeString = + IngresTypes: string = 'BYTE,C,CHAR,CHARACTER,DATE,DECIMAL,FLOAT,FLOAT4,FLOAT8,INTEGER,INTEGER1,' + 'INTEGER2,INTEGER4,LONG,MONEY,OBJECT_KEY,SECURITY_LABEL,SHORT,SMALLINT,' + 'TABLE_KEY,TEXT,VARCHAR,VARYING'; // functions - IngresFunctions: UnicodeString = + IngresFunctions: string = '_BINTIM,_CPU_MS,_DATE,_DIO_CNT,_ET_SEC,_PFAULT_CNT,_TIME,_VERSION,ABS,' + 'ANY,ATAN,AUTOCOMMIT_STATE,AVG,BIOCNT,CHAREXTRACT,COLLATION,CONCAT,' + 'CONNECT_TIME_LIMIT,COS,COUNT,CREATE_PROCEDURE,CREATE_TABLE,DATABASE,' + @@ -1234,7 +1219,7 @@ implementation //---Nexus---------------------------------------------------------------------- // keywords - NexusKW: UnicodeString = + NexusKW: string = 'ABSOLUTE,AFTER,ALTER,ANY,ASC,ASSERT,ATOMIC,' + 'ADD,ALL,AND,AS,ASSEMBLY,AUTHORIZATION,BEFORE,' + 'BETWEEN,BINARY,BLOCK,BY,BEGIN,' + @@ -1268,7 +1253,7 @@ implementation 'VIEW,WHEN,WHILE,WITH,WORK,WHERE,WIDTH,YEAR'; // functions - NexusFunctions: UnicodeString = + NexusFunctions: string = 'ABS,ATAN,ATAN2,ATN2,AVG,BOTH,BROUND,CEIL,CEILING,CHAR_LENGTH,CHARACTER_LENGTH,'+ 'CHR,COS,COUNT,CURRENT_DATE,CURRENT_TIME,CURRENT_TIMESTAMP,CURRENT_USER,ERROR_MESSAGE,EXP,EXTRACT,'+ 'FLOOR,LASTAUTOINC,LEADING,LIST,LN,LOCALTIME,LOCALTIMESTAMP,LOWER,MAX,MED,MIN,MOD,NEWGUID,OCTECT,'+ @@ -1276,7 +1261,7 @@ implementation 'SUBSTRING,SUM,SYSTEM_ROW#,TOSTRING,TOSTRINGLEN,TRAILING,TRIM,UPPER,USER,USING'; // types - NexusTypes: UnicodeString = + NexusTypes: string = 'CHARACTER,CHAR,NULLSTRING,SHORTSTRING,SINGLECHAR,VARCHAR,' + 'CLOB,TEXT,NSINGLECHAR,NCHAR,' + 'NVARCHAR,NCLOB,BLOB,IMAGE,NUMERIC,DECIMAL,DEC,BYTE,TINYINT,SHORTINT,SMALLINT,INTEGER,INT,' + @@ -1285,7 +1270,7 @@ implementation //---Informix------------------------------------------------------------------- // keywords - InformixKW: Unicodestring = + InformixKW: string = 'ABSOLUTE,ACCESS,ACCESS_METHOD,ACTIVE,ADD,AFTER,AGGREGATE,ALIGNMENT,ALL,' + 'ALL_ROWS,ALLOCATE,ALTER,AND,ANSI,ANY,APPEND,AS,ASC,AT,ATTACH,AUDIT,' + 'AUTHORIZATION,AUTO,AUTOFREE,AVOID_EXECUTE,AVOID_SUBQF,BEFORE,BEGIN,' + @@ -1337,19 +1322,19 @@ implementation 'WORK,WRITE,XADATASOURCE,XID,XLOAD,XUNLOAD'; // types - InformixTypes: UnicodeString = + InformixTypes: string = 'BLOB,BOOLEAN,BYTE,CHAR,CHARACTER,VARYING,CLOB,DATE,DATETIME,DEC,DECIMAL,' + 'DOUBLE,PRECISION,FLOAT,INT,INT8,INTEGER,INTERVAL,LIST,LVARCHAR,MONEY,' + 'MULTISET,NCHAR,NUMERIC,NVARCHAR,REAL,ROW,SERIAL,SERIAL8,SET,SMALLFLOAT,' + 'SMALLINT,TEXT,VARCHAR'; // PLSQL keywords - InformixPLSQLKW: UnicodeString = + InformixPLSQLKW: string = 'CALL,CONTINUE,DEFINE,ERROR,EXCEPTION,EXIT,FOR,FOREACH,IF,LET,ON,RAISE,' + 'RETURN,SYSTEM,TRACE,WHENEVER,WHILE'; // functions - InformixFunctions: UnicodeString = + InformixFunctions: string = 'ABS,ACOS,ASIN,ATAN,ATAN2,AVG,CARDINALITY,CASE,CAST,CHARACTER_LENGTH,' + 'CHAR_LENGTH,COS,COUNT,CURRENT,DAY,DBINFO,DBSERVERNAME,DECODE,' + 'DECRYPT_CHAR,DECRYPT_BINARY,DEFAULT_ROLE,ENCRYPT_AES,ENCRYPT_TDES,EXP,' + @@ -1359,68 +1344,49 @@ implementation 'RPAD,SIN,SITENAME,SQRT,STDEV,SUBSTR,SUBSTRING,SUM,TAN,THEN,TO_CHAR,TO_DATE,' + 'TODAY,TRIM,TRUNC,UNITS,UPPER,USER,VARIANCE,WEEKDAY,WHEN,YEAR'; -function TSynSQLSyn.HashKey(Str: PWideChar): Integer; +function TSynSQLSyn.IdentKind: TtkTokenKind; var - FoundDoubleMinus: Boolean; + S: string; + p: PChar; - function GetOrd: Integer; + function IsIdentCharFromIndex(Index: Integer): Boolean; begin - case Str^ of - '_': Result := 1; - 'a'..'z': Result := 2 + Ord(Str^) - Ord('a'); - 'A'..'Z': Result := 2 + Ord(Str^) - Ord('A'); + case FLineStr[Index] of + 'a'..'z', 'A'..'Z', '0'..'9', '_': + Result := True; + '-': + Result := fDialect = sqlStandard; + '#', '$': + Result := fDialect in [sqlOracle, sqlNexus]; '@': - if FDialect in [sqlMSSQL7, sqlMSSQL2K] then - Result := 24 - else - Result := 0; - else Result := 0; + Result := fDialect in [sqlMSSQL7, sqlMSSQL2K]; + '!', '^', '{', '}', '~': + Result := fDialect = sqlNexus + else + Result := False; end; + if not Result then + Result := Char.IsLetterOrDigit(FLineStr, Index - 1) or + CharInSet(FLineStr[Index], AdditionalIdentChars) and + not IsWordBreakChar(FLineStr[Index]); end; begin - Result := 0; - while IsIdentChar(Str^) do + // This version handles non-ascii letters and surrogate pairs. + fToIdent := fLine + Run; + p := fToIdent + 1; + while (p^ <> #0) and ((p^.IsLowSurrogate) or IsIdentCharFromIndex(p - FLine + 1)) do begin - FoundDoubleMinus := (Str^ = '-') and ((Str + 1)^ = '-'); - if FoundDoubleMinus then Break; -{$IFOPT Q-} - Result := 2 * Result + GetOrd; -{$ELSE} - Result := (2 * Result + GetOrd) and $FFFFFF; -{$ENDIF} - Inc(Str); + // Special case for sqlStandard which allows hyphen as an identifier. + if (p^ = '-') and ((p + 1)^ = '-') then + Break; + p := CharNext(p); end; - Result := Result and $FF; // 255 - if Assigned(FToIdent) then - FStringLen := Str - FToIdent - else - FStringLen := 0; -end; - -function TSynSQLSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; -var - Entry: TSynHashEntry; -begin - FToIdent := MayBe; - Entry := FKeywords[HashKey(MayBe)]; - while Assigned(Entry) do - begin - if Entry.KeywordLen > FStringLen then - Break - else if Entry.KeywordLen = FStringLen then - if IsCurrentToken(Entry.Keyword) then - begin - Result := TtkTokenKind(Entry.Kind); - Exit; - end; - Entry := Entry.Next; - end; - {$IFDEF USE_TABLE_DICTIONARY} - if FTableDict.ContainsKey(SynWideLowerCase(Copy(StrPas(FToIdent), 1, FStringLen))) then - Result := tkTableName - else - {$ENDIF} + fStringLen := p - fToIdent; + if FScanningToEOL then + Exit(tkIdentifier); + SetString(S, fToIdent, fStringLen); + if not FKeywords.TryGetValue(S, Result) then Result := tkIdentifier; end; @@ -1428,87 +1394,81 @@ constructor TSynSQLSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := False; - - FKeywords := TSynHashEntryList.Create; - - FProcNames := TUnicodeStringList.Create; - TUnicodeStringList(FProcNames).OnChange := ProcNamesChanged; - - FTableNames := TUnicodeStringList.Create; - TUnicodeStringList(FTableNames).OnChange := TableNamesChanged; - {$IFDEF USE_TABLE_DICTIONARY} - FTableDict := TDictionary.Create; - {$ENDIF} - - FFunctionNames := TunicodeStringList.Create; - TUnicodeStringList(FFunctionNames).OnChange := FunctionNamesChanged; - - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - AddAttribute(FCommentAttri); - FConditionalCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrConditionalComment, SYNS_FriendlyAttrConditionalComment); - FConditionalCommentAttri.Style := [fsItalic]; - AddAttribute(FConditionalCommentAttri); - FConsoleOutputAttri := TSynHighlighterAttributes.Create(SYNS_AttrConsoleOutput, SYNS_FriendlyAttrConsoleOutput); - FConsoleOutputAttri.Style := [fsBold, fsUnderline]; - AddAttribute(FConsoleOutputAttri); - FDataTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); - FDataTypeAttri.Style := [fsBold]; - AddAttribute(FDataTypeAttri); - FDefaultPackageAttri := + fCaseSensitive := False; + + FKeywords := TDictionary.Create; + + FProcNames := TStringList.Create; + TStringList(FProcNames).OnChange := ProcNamesChanged; + + fTableNames := TStringList.Create; + TStringList(fTableNames).OnChange := TableNamesChanged; + + fFunctionNames := TStringList.Create; + TStringList(fFunctionNames).OnChange := FunctionNamesChanged; + + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + AddAttribute(fCommentAttri); + fConditionalCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrConditionalComment, SYNS_FriendlyAttrConditionalComment); + fConditionalCommentAttri.Style := [fsItalic]; + AddAttribute(fConditionalCommentAttri); + fConsoleOutputAttri := TSynHighlighterAttributes.Create(SYNS_AttrConsoleOutput, SYNS_FriendlyAttrConsoleOutput); + fConsoleOutputAttri.Style := [fsBold, fsUnderline]; + AddAttribute(fConsoleOutputAttri); + fDataTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); + fDataTypeAttri.Style := [fsBold]; + AddAttribute(fDataTypeAttri); + fDefaultPackageAttri := TSynHighlighterAttributes.Create(SYNS_AttrDefaultPackage, SYNS_FriendlyAttrDefaultPackage); - FDefaultPackageAttri.Style := [fsBold]; - AddAttribute(FDefaultPackageAttri); - FDelimitedIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrDelimitedIdentifier, SYNS_FriendlyAttrDelimitedIdentifier); - AddAttribute(FDelimitedIdentifierAttri); - FExceptionAttri := TSynHighlighterAttributes.Create(SYNS_AttrException, SYNS_FriendlyAttrException); - FExceptionAttri.Style := [fsItalic]; - AddAttribute(FExceptionAttri); - FFunctionAttri := TSynHighlighterAttributes.Create(SYNS_AttrFunction, SYNS_FriendlyAttrFunction); - FFunctionAttri.Style := [fsBold]; - AddAttribute(FFunctionAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FPLSQLAttri := TSynHighlighterAttributes.Create(SYNS_AttrPLSQL, SYNS_FriendlyAttrPLSQL); - FPLSQLAttri.Style := [fsBold]; - AddAttribute(FPLSQLAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FSQLPlusAttri:=TSynHighlighterAttributes.Create(SYNS_AttrSQLPlus, SYNS_FriendlyAttrSQLPlus); - FSQLPlusAttri.Style := [fsBold]; - AddAttribute(FSQLPlusAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_Attrstring, SYNS_FriendlyAttrstring); - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); - FProcNameAttri := TSynHighlighterAttributes.Create(SYNS_AttrProcName, SYNS_FriendlyAttrProcName); - AddAttribute(FProcNameAttri); - FTableNameAttri := TSynHighlighterAttributes.Create(SYNS_AttrTableName, SYNS_FriendlyAttrTableName); - AddAttribute(FTableNameAttri); - FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); - AddAttribute(FVariableAttri); + fDefaultPackageAttri.Style := [fsBold]; + AddAttribute(fDefaultPackageAttri); + fDelimitedIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrDelimitedIdentifier, SYNS_FriendlyAttrDelimitedIdentifier); + AddAttribute(fDelimitedIdentifierAttri); + fExceptionAttri := TSynHighlighterAttributes.Create(SYNS_AttrException, SYNS_FriendlyAttrException); + fExceptionAttri.Style := [fsItalic]; + AddAttribute(fExceptionAttri); + fFunctionAttri := TSynHighlighterAttributes.Create(SYNS_AttrFunction, SYNS_FriendlyAttrFunction); + fFunctionAttri.Style := [fsBold]; + AddAttribute(fFunctionAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fPLSQLAttri := TSynHighlighterAttributes.Create(SYNS_AttrPLSQL, SYNS_FriendlyAttrPLSQL); + fPLSQLAttri.Style := [fsBold]; + AddAttribute(fPLSQLAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fSQLPlusAttri:=TSynHighlighterAttributes.Create(SYNS_AttrSQLPlus, SYNS_FriendlyAttrSQLPlus); + fSQLPlusAttri.Style := [fsBold]; + AddAttribute(fSQLPlusAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_Attrstring, SYNS_FriendlyAttrstring); + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); + fProcNameAttri := TSynHighlighterAttributes.Create(SYNS_AttrProcName, SYNS_FriendlyAttrProcName); + AddAttribute(fProcNameAttri); + fTableNameAttri := TSynHighlighterAttributes.Create(SYNS_AttrTableName, SYNS_FriendlyAttrTableName); + AddAttribute(fTableNameAttri); + fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); + AddAttribute(fVariableAttri); SetAttributesOnChange(DefHighlightChange); - FDefaultFilter := SYNS_FilterSQL; - FRange := rsUnknown; - FDialect := sqlStandard; + fDefaultFilter := SYNS_FilterSQL; + fRange := rsUnknown; + fDialect := sqlStandard; InitializeKeywordLists; end; destructor TSynSQLSyn.Destroy; begin FKeywords.Free; - FProcNames.Free; - FTableNames.Free; - {$IFDEF USE_TABLE_DICTIONARY} - FTableDict.Free; - {$ENDIF} - FFunctionNames.Free; + fProcNames.Free; + fTableNames.Free; + fFunctionNames.Free; inherited Destroy; end; @@ -1521,9 +1481,9 @@ procedure TSynSQLSyn.Assign(Source: TPersistent); procedure TSynSQLSyn.AndSymbolProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '&']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '&']) then Inc(Run); end; procedure TSynSQLSyn.AsciiCharProc; @@ -1531,33 +1491,33 @@ procedure TSynSQLSyn.AsciiCharProc; IsEsc: Boolean; begin // Oracle SQL allows strings to go over multiple lines - if FLine[Run] = #0 then + if fLine[Run] = #0 then NullProc else begin - FTokenID := tkString; + fTokenID := tkString; // else it's end of multiline string if SQLDialect <> sqlMySql then begin - if (Run > 0) or (FRange <> rsString) or (FLine[Run] <> #39) then + if (Run > 0) or (fRange <> rsString) or (fLine[Run] <> #39) then begin - FRange := rsString; + fRange := rsString; repeat Inc(Run); - until IsLineEnd(Run) or (FLine[Run] = #39); + until IsLineEnd(Run) or (fLine[Run] = #39); end; - if FLine[Run] = #39 then + if fLine[Run] = #39 then begin Inc(Run); - FRange := rsUnknown; + fRange := rsUnknown; end; end else begin IsEsc := False; - if (Run > 0) or (FRange <> rsString) or - ((FLine[Run] <> #39) and (FLine[Run - 1] <> '\')) then + if (Run > 0) or (fRange <> rsString) or + ((fLine[Run] <> #39) and (fLine[Run - 1] <> '\')) then begin - FRange := rsString; + fRange := rsString; repeat if FLine[Run] = '\' then IsEsc := not IsEsc @@ -1574,7 +1534,7 @@ procedure TSynSQLSyn.AsciiCharProc; if (FLine[Run] = #39) and (not IsEsc) then begin Inc(Run); - FRange := rsUnknown; + fRange := rsUnknown; end; end; end; @@ -1582,40 +1542,40 @@ procedure TSynSQLSyn.AsciiCharProc; procedure TSynSQLSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then Inc(Run); + if fLine[Run] = #10 then Inc(Run); end; procedure TSynSQLSyn.EqualProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '>']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '>']) then Inc(Run); end; procedure TSynSQLSyn.GreaterProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '>']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '>']) then Inc(Run); end; procedure TSynSQLSyn.IdentProc; var FoundDoubleMinus: Boolean; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); + fTokenID := IdentKind; + Inc(Run, fStringLen); if FTokenID in [tkComment, tkConsoleOutput] then begin while not IsLineEnd(Run) do Inc(Run); end else - while IsIdentChar(FLine[Run]) do + while IsIdentChar(fLine[Run]) do begin - FoundDoubleMinus := (FLine[Run] = '-') and (FLine[Run + 1] = '-'); + FoundDoubleMinus := (fLine[Run] = '-') and (fLine[Run + 1] = '-'); if FoundDoubleMinus then Break; Inc(Run); end; @@ -1623,19 +1583,19 @@ procedure TSynSQLSyn.IdentProc; procedure TSynSQLSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynSQLSyn.LowerProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - case FLine[Run] of + case fLine[Run] of '=': Inc(Run); '<': begin Inc(Run); - if FLine[Run] = '=' then Inc(Run); + if fLine[Run] = '=' then Inc(Run); end; end; end; @@ -1643,22 +1603,22 @@ procedure TSynSQLSyn.LowerProc; procedure TSynSQLSyn.MinusProc; begin Inc(Run); - if (FLine[Run] = '-') and ((FDialect <> sqlMySQL) or (FLine[Run+1] = ' ')) then + if (fLine[Run] = '-') and ((fDialect <> sqlMySQL) or (fLine[Run+1] = ' ')) then begin - FTokenID := tkComment; + fTokenID := tkComment; repeat Inc(Run); until IsLineEnd(Run); end else - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynSQLSyn.HashProc; begin if SQLDialect = sqlMySql then begin - FTokenID := tkComment; + fTokenID := tkComment; repeat Inc(Run); until IsLineEnd(Run); @@ -1666,13 +1626,13 @@ procedure TSynSQLSyn.HashProc; else begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; end; procedure TSynSQLSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -1680,7 +1640,7 @@ procedure TSynSQLSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', '-': Result := True; else @@ -1690,7 +1650,7 @@ procedure TSynSQLSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of @@ -1704,16 +1664,16 @@ procedure TSynSQLSyn.NumberProc; procedure TSynSQLSyn.OrSymbolProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '|']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '|']) then Inc(Run); end; procedure TSynSQLSyn.PlusProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '+']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '+']) then Inc(Run); end; procedure TSynSQLSyn.FunctionNamesChanged(Sender: TObject); @@ -1729,23 +1689,23 @@ procedure TSynSQLSyn.ProcNamesChanged(Sender: TObject); procedure TSynSQLSyn.SlashProc; begin Inc(Run); - case FLine[Run] of + case fLine[Run] of '*': begin - if (SQLDialect = sqlMySql) and (FLine[Run + 1] = '!') then + if (SQLDialect = sqlMySql) and (fLine[Run + 1] = '!') then begin - FRange := rsConditionalComment; - FTokenID := tkConditionalComment; + fRange := rsConditionalComment; + fTokenID := tkConditionalComment; end else begin - FRange := rsComment; - FTokenID := tkComment; + fRange := rsComment; + fTokenID := tkComment; end; repeat Inc(Run); - if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then begin - FRange := rsUnknown; + if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then begin + fRange := rsUnknown; Inc(Run, 2); Break; end; @@ -1754,40 +1714,42 @@ procedure TSynSQLSyn.SlashProc; '=': begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; '/': begin if (SQLDialect = sqlNexus) then begin - FTokenID := tkComment; + fTokenID := tkComment; repeat Inc(Run); until IsLineEnd(Run); - end; + end + else + fTokenID := tkSymbol; end else - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; procedure TSynSQLSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynSQLSyn.QuoteProc; begin - FTokenID := tkDelimitedIdentifier; + fTokenID := tkDelimitedIdentifier; Inc(Run); while not IsLineEnd(Run) do begin - if FLine[Run] = #34 then + if fLine[Run] = #34 then begin Inc(Run); - if FLine[Run] <> #34 then + if fLine[Run] <> #34 then Break; end; Inc(Run); @@ -1798,14 +1760,14 @@ procedure TSynSQLSyn.BacktickProc; begin if SQLDialect = sqlMySql then begin - FTokenID := tkDelimitedIdentifier; + fTokenID := tkDelimitedIdentifier; Inc(Run); while not IsLineEnd(Run) do begin - if FLine[Run] = '`' then + if fLine[Run] = '`' then begin Inc(Run); - if FLine[Run] <> '`' then + if fLine[Run] <> '`' then Break; end; Inc(Run); @@ -1814,7 +1776,7 @@ procedure TSynSQLSyn.BacktickProc; else begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; end; @@ -1822,14 +1784,14 @@ procedure TSynSQLSyn.BracketProc; begin if SQLDialect in [sqlMSSQL7, sqlMSSQL2K] then begin - FTokenID := tkDelimitedIdentifier; + fTokenID := tkDelimitedIdentifier; Inc(Run); while not IsLineEnd(Run) do begin - if FLine[Run] = ']' then + if fLine[Run] = ']' then begin Inc(Run); - if FLine[Run] <> ']' then + if fLine[Run] <> ']' then Break; end; Inc(Run); @@ -1838,72 +1800,72 @@ procedure TSynSQLSyn.BracketProc; else begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; procedure TSynSQLSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynSQLSyn.SymbolAssignProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if FLine[Run] = '=' then Inc(Run); + if fLine[Run] = '=' then Inc(Run); end; procedure TSynSQLSyn.VariableProc; var - i: Integer; + I: Integer; FoundDoubleMinus: Boolean; begin // MS SQL Server uses @@ to indicate system functions/variables - if (SQLDialect in [sqlMSSQL7, sqlMSSQL2K]) and (FLine[Run] = '@') and (FLine[Run + 1] = '@') then + if (SQLDialect in [sqlMSSQL7, sqlMSSQL2K]) and (fLine[Run] = '@') and (fLine[Run + 1] = '@') then IdentProc - else if (SQLDialect in [sqlMySql, sqlOracle]) and (FLine[Run] = '@') then + else if (SQLDialect in [sqlMySql, sqlOracle]) and (fLine[Run] = '@') then SymbolProc // Oracle uses the ':' character to indicate bind variables // Ingres II also uses the ':' character to indicate variables - else if not (SQLDialect in [sqlOracle, sqlIngres]) and (FLine[Run] = ':') then + else if not (SQLDialect in [sqlOracle, sqlIngres]) and (fLine[Run] = ':') then SymbolProc else begin - FTokenID := tkVariable; - i := Run; + fTokenID := tkVariable; + I := Run; repeat - FoundDoubleMinus := (FLine[i] = '-') and (FLine[i + 1] = '-'); + FoundDoubleMinus := (fLine[I] = '-') and (fLine[I + 1] = '-'); if FoundDoubleMinus then Break; - Inc(i); - until not IsIdentChar(FLine[i]); - Run := i; + Inc(I); + until not IsIdentChar(fLine[I]); + Run := I; end; end; procedure TSynSQLSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynSQLSyn.AnsiCProc; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; else begin - if FRange = rsConditionalComment then - FTokenID := tkConditionalComment + if fRange = rsConditionalComment then + fTokenID := tkConditionalComment else - FTokenID := tkComment; + fTokenID := tkComment; repeat - if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then + if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then begin - FRange := rsUnknown; + fRange := rsUnknown; Inc(Run, 2); Break; end; @@ -1913,19 +1875,25 @@ procedure TSynSQLSyn.AnsiCProc; end; end; -function TSynSQLSyn.IsKeyword(const AKeyword: UnicodeString): Boolean; +function TSynSQLSyn.IsKeyword(const AKeyword: string): Boolean; var tk: TtkTokenKind; + S: string; begin - tk := IdentKind(PWideChar(AKeyword)); - Result := tk in [tkDatatype, tkException, tkFunction, tkKey, tkPLSQL, - tkDefaultPackage]; + if not fCaseSensitive then + S := AnsiLowerCase(AKeyword) + else + S := AKeyword; + if not FKeywords.TryGetValue(S, tk) then + tk := tkUnknown; + Result := tk in + [tkDatatype, tkException, tkFunction, tkKey, tkPLSQL, tkDefaultPackage]; end; procedure TSynSQLSyn.Next; begin - FTokenPos := Run; - case FRange of + fTokenPos := Run; + case fRange of rsComment, rsConditionalComment: AnsiCProc; rsConsoleOutput: @@ -1936,7 +1904,7 @@ procedure TSynSQLSyn.Next; rsString: AsciiCharProc; else - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; @@ -1959,7 +1927,14 @@ procedure TSynSQLSyn.Next; #1..#9, #11, #12, #14..#32: SpaceProc; '^', '%', '*', '!': SymbolAssignProc; '{', '}', '.', ',', ';', '?', '(', ')', ']', '~': SymbolProc; - else UnknownProc; + else + begin + // This will work with ansi and unicode letters, including surrogate pairs + if (not FLine[Run].IsLowSurrogate) and Char.IsLetter(FLineStr, Run) then // Index is 0 based here + IdentProc + else + UnknownProc; + end; end; end; inherited; @@ -1969,12 +1944,12 @@ function TSynSQLSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -1982,42 +1957,42 @@ function TSynSQLSyn.GetDefaultAttribute(Index: Integer): function TSynSQLSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynSQLSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; function TSynSQLSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynSQLSyn.GetTokenAttribute: TSynHighlighterAttributes; begin case GetTokenID of - tkComment: Result := FCommentAttri; - tkConditionalComment: Result := FConditionalCommentAttri; + tkComment: Result := fCommentAttri; + tkConditionalComment: Result := fConditionalCommentAttri; tkConsoleOutput: Result := FConsoleOutputAttri; - tkDatatype: Result := FDataTypeAttri; - tkDefaultPackage: Result := FDefaultPackageAttri; - tkDelimitedIdentifier: Result := FDelimitedIdentifierAttri; - tkException: Result := FExceptionAttri; - tkFunction: Result := FFunctionAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkPLSQL: Result := FPLSQLAttri; - tkSpace: Result := FSpaceAttri; - tkSQLPlus: Result := FSQLPlusAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; + tkDatatype: Result := fDataTypeAttri; + tkDefaultPackage: Result := fDefaultPackageAttri; + tkDelimitedIdentifier: Result := fDelimitedIdentifierAttri; + tkException: Result := fExceptionAttri; + tkFunction: Result := fFunctionAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkPLSQL: Result := fPLSQLAttri; + tkSpace: Result := fSpaceAttri; + tkSQLPlus: Result := fSQLPlusAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; tkProcName: Result := FProcNameAttri; - tkTableName: Result := FTableNameAttri; - tkVariable: Result := FVariableAttri; - tkUnknown: Result := FIdentifierAttri; + tkTableName: Result := fTableNameAttri; + tkVariable: Result := fVariableAttri; + tkUnknown: Result := fIdentifierAttri; else Result := nil; end; @@ -2025,22 +2000,22 @@ function TSynSQLSyn.GetTokenAttribute: TSynHighlighterAttributes; function TSynSQLSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; procedure TSynSQLSyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; end; procedure TSynSQLSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; function TSynSQLSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterSQL; + Result := fDefaultFilter <> SYNS_FilterSQL; end; function TSynSQLSyn.IsIdentChar(AChar: WideChar): Boolean; @@ -2049,16 +2024,20 @@ function TSynSQLSyn.IsIdentChar(AChar: WideChar): Boolean; 'a'..'z', 'A'..'Z', '0'..'9', '_': Result := True; '-': - Result := FDialect = sqlStandard; + Result := fDialect = sqlStandard; '#', '$': // TODO: check this case, ANSI code wasn't clear here if this is exclusively Oracle - Result := FDialect in [sqlOracle, sqlNexus]; + Result := fDialect in [sqlOracle, sqlNexus]; '@': - Result := FDialect in [sqlMSSQL7, sqlMSSQL2K]; + Result := fDialect in [sqlMSSQL7, sqlMSSQL2K]; '!', '^', '{', '}','~': - Result := FDialect = sqlNexus + Result := fDialect = sqlNexus else Result := False; end; + if not Result then + Result := AChar.IsLetterOrDigit or + CharInSet(AChar, AdditionalIdentChars) and + not IsWordBreakChar(AChar); end; class function TSynSQLSyn.GetLanguageName: string; @@ -2066,18 +2045,18 @@ class function TSynSQLSyn.GetLanguageName: string; Result := SYNS_LangSQL; end; -procedure TSynSQLSyn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); +procedure TSynSQLSyn.DoAddKeyword(AKeyword: string; AKind: Integer); var - HashValue: Integer; + S: string; begin - AKeyword := SynWideLowerCase(AKeyword); - HashValue := HashKey(PWideChar(AKeyword)); - FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind); + S := AnsiLowerCase(AKeyword); + if not FKeywords.ContainsKey(S) then + FKeywords.Add(S, TtkTokenKind(AKind)); end; -procedure TSynSQLSyn.SetTableNames(const Value: TUnicodeStrings); +procedure TSynSQLSyn.SetTableNames(const Value: TStrings); begin - FTableNames.Assign(Value); + fTableNames.Assign(Value); end; procedure TSynSQLSyn.TableNamesChanged(Sender: TObject); @@ -2088,62 +2067,39 @@ procedure TSynSQLSyn.TableNamesChanged(Sender: TObject); procedure TSynSQLSyn.PutTableNamesInKeywordList; var i: Integer; - Entry: TSynHashEntry; + S: string; begin - for i := 0 to FTableNames.Count - 1 do + for i := 0 to fTableNames.Count - 1 do begin - Entry := FKeywords[HashKey(PWideChar(FTableNames[i]))]; - while Assigned(Entry) do - begin - if SynWideLowerCase(Entry.Keyword) = SynWideLowerCase(FTableNames[i]) then - Break; - Entry := Entry.Next; - end; - if not Assigned(Entry) then - {$IFDEF USE_TABLE_DICTIONARY} - if not FTableDict.ContainsKey(SynWideLowerCase(FTableNames[i])) then - FTableDict.Add(SynWideLowerCase(FTableNames[i]), True); - {$ELSE} - DoAddKeyword(FTableNames[i], Ord(tkTableName)); - {$ENDIF} + S := AnsiLowerCase(fTableNames[i]); + if not FKeywords.ContainsKey(S) then + FKeywords.Add(S, tkTableName); end; end; procedure TSynSQLSyn.PutFunctionNamesInKeywordList; var i: Integer; - Entry: TSynHashEntry; + S: string; begin - for i := 0 to (FFunctionNames.Count - 1) do + for i := 0 to (fFunctionNames.Count - 1) do begin - Entry := FKeywords[HashKey(PWideChar(FFunctionNames[i]))]; - while Assigned(Entry) do - begin - if SynWideLowerCase(Entry.Keyword) = SynWideLowerCase(FFunctionNames[i]) then - Break; - Entry := Entry.Next; - end; - if not Assigned(Entry) then - DoAddKeyword(FFunctionNames[i], Ord(tkFunction)); + S := AnsiLowerCase(fFunctionNames[i]); + if not FKeywords.ContainsKey(S) then + FKeywords.Add(S, tkFunction); end; end; procedure TSynSQLSyn.PutProcNamesInKeywordList; var i: Integer; - Entry: TSynHashEntry; + S: string; begin - for i := 0 to FProcNames.Count - 1 do + for i := 0 to (fProcNames.Count - 1) do begin - Entry := FKeywords[HashKey(PWideChar(FProcNames[i]))]; - while Assigned(Entry) do - begin - if SynWideLowerCase(Entry.Keyword) = SynWideLowerCase(FProcNames[i]) then - Break; - Entry := Entry.Next; - end; - if not Assigned(Entry) then - DoAddKeyword(FProcNames[i], Ord(tkProcName)); + S := AnsiLowerCase(fProcNames[i]); + if not FKeywords.ContainsKey(S) then + FKeywords.Add(S, tkProcName); end; end; @@ -2151,15 +2107,8 @@ procedure TSynSQLSyn.InitializeKeywordLists; var I: Integer; begin -{$IFDEF LIST_CLEAR_NOT_VIRTUAL} - FKeywords.DeleteEntries; -{$ELSE} FKeywords.Clear; -{$ENDIF} - {$IFDEF USE_TABLE_DICTIONARY} - FTableDict.Clear; - {$ENDIF} - FToIdent := nil; + fToIdent := nil; for I := 0 to Ord(High(TtkTokenKind)) do EnumerateKeywords(I, GetKeywords(I), IsIdentChar, DoAddKeyword); @@ -2172,27 +2121,27 @@ procedure TSynSQLSyn.InitializeKeywordLists; procedure TSynSQLSyn.SetDialect(Value: TSQLDialect); begin - if (Value <> FDialect) then + if (Value <> fDialect) then begin - FDialect := Value; + fDialect := Value; InitializeKeywordLists; end; end; -procedure TSynSQLSyn.SetFunctionNames(const Value: TUnicodeStrings); +procedure TSynSQLSyn.SetFunctionNames(const Value: TStrings); begin FFunctionNames.Assign(Value); end; -procedure TSynSQLSyn.SetProcNames(const Value: TUnicodeStrings); +procedure TSynSQLSyn.SetProcNames(const Value: TStrings); begin - FProcNames.Assign(Value); + fProcNames.Assign(Value); end; -function TSynSQLSyn.GetSampleSource: UnicodeString; +function TSynSQLSyn.GetSampleSource: string; begin Result := ''; - case FDialect of + case fDialect of sqlPostgres: Result := '-- ANSI SQL sample source'#13#10 + 'SELECT *'#13#10 + @@ -2319,16 +2268,16 @@ function TSynSQLSyn.GetSampleSource: UnicodeString; end; end; -class function TSynSQLSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynSQLSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangSQL; end; -function TSynSQLSyn.GetKeyWords(TokenKind: Integer): UnicodeString; +function TSynSQLSyn.GetKeyWords(TokenKind: Integer): string; begin Result := ''; - case FDialect of + case fDialect of sqlPostgres: begin case TtkTokenKind(TokenKind) of @@ -2403,7 +2352,5 @@ function TSynSQLSyn.GetKeyWords(TokenKind: Integer): UnicodeString; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynSQLSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterST.pas b/Ext/SynEdit/Source/SynHighlighterST.pas index 499d45c..e6f9eb3 100644 --- a/Ext/SynEdit/Source/SynHighlighterST.pas +++ b/Ext/SynEdit/Source/SynHighlighterST.pas @@ -28,13 +28,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterST.pas,v 1.9.2.6 2008/09/14 16:25:03 maelh Exp $ by Ruggero Bandera - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} unit SynHighlighterST; @@ -58,25 +51,25 @@ interface tkSpace, tkString, tkSymbol, tkUnknown); TRangeState = (rsANil, rsAnsi, rsAnsiAsm, rsAsm, rsBor, rsBorAsm, rsProperty, - rsUnknown); + rsUnKnown); PIdentFuncTableFunc = ^TIdentFuncTableFunc; TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; TSynSTSyn = class(TSynCustomHighlighter) private - FAsmStart: Boolean; - FRange: TRangeState; - FIdentFuncTable: array[0..210] of TIdentFuncTableFunc; + fAsmStart: Boolean; + fRange: TRangeState; + fIdentFuncTable: array[0..210] of TIdentFuncTableFunc; FTokenID: TtkTokenKind; - FStringAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FAsmAttri: TSynHighlighterAttributes; - FCommentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fAsmAttri: TSynHighlighterAttributes; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; function AltFunc(Index: Integer): TtkTokenKind; function KeyWordFunc(Index: Integer): TtkTokenKind; function HashKey(Str: PWideChar): Cardinal; @@ -107,7 +100,7 @@ TSynSTSyn = class(TSynCustomHighlighter) function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; @@ -121,20 +114,20 @@ TSynSTSyn = class(TSynCustomHighlighter) procedure ResetRange; override; procedure SetRange(Value: Pointer); override; published - property AsmAttri: TSynHighlighterAttributes read FAsmAttri write FAsmAttri; - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; + property AsmAttri: TSynHighlighterAttributes read fAsmAttri write fAsmAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; end; implementation @@ -143,7 +136,7 @@ implementation SynEditStrConst; const - KeyWords: array[0..74] of UnicodeString = ( + KeyWords: array[0..74] of string = ( 'action', 'and', 'any', 'any_num', 'array', 'at', 'bool', 'by', 'byte', 'case', 'configuration', 'constant', 'dint', 'do', 'dword', 'else', 'elsif', 'end_action', 'end_case', 'end_configuration', 'end_for', 'end_if', @@ -181,7 +174,7 @@ function TSynSTSyn.HashKey(Str: PWideChar): Cardinal; Inc(Str); end; Result := Result mod 211; - FStringLen := Str - FToIdent; + fStringLen := Str - fToIdent; end; {$Q+} @@ -189,10 +182,10 @@ function TSynSTSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; @@ -201,13 +194,13 @@ procedure TSynSTSyn.InitIdent; var i: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; + fIdentFuncTable[i] := AltFunc; - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if @FIdentFuncTable[i] = nil then - FIdentFuncTable[i] := KeyWordFunc; + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if @fIdentFuncTable[i] = nil then + fIdentFuncTable[i] := KeyWordFunc; end; function TSynSTSyn.AltFunc(Index: Integer): TtkTokenKind; @@ -227,64 +220,64 @@ constructor TSynSTSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := False; - - FAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler); - AddAttribute(FAsmAttri); - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style:= [fsItalic]; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style:= [fsBold]; - AddAttribute(FKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); + fCaseSensitive := False; + + fAsmAttri := TSynHighlighterAttributes.Create(SYNS_AttrAssembler, SYNS_FriendlyAttrAssembler); + AddAttribute(fAsmAttri); + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style:= [fsItalic]; + AddAttribute(fCommentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style:= [fsBold]; + AddAttribute(fKeyAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FRange := rsUnknown; - FAsmStart := False; - FDefaultFilter := SYNS_FilterST; + fRange := rsUnknown; + fAsmStart := False; + fDefaultFilter := SYNS_FilterST; end; { Create } procedure TSynSTSyn.AddressOpProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if FLine[Run] = '@' then Inc(Run); + if fLine[Run] = '@' then Inc(Run); end; procedure TSynSTSyn.AsciiCharProc; begin - FTokenID := tkString; + fTokenID := tkString; Inc(Run); while CharInSet(FLine[Run], ['0'..'9']) do Inc(Run); end; procedure TSynSTSyn.BorProc; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; else begin - FTokenID := tkComment; + fTokenID := tkComment; repeat - if FLine[Run] = '}' then begin + if fLine[Run] = '}' then begin Inc(Run); - if FRange = rsBorAsm then - FRange := rsAsm + if fRange = rsBorAsm then + fRange := rsAsm else - FRange := rsUnknown; - Break; + fRange := rsUnKnown; + Break; end; Inc(Run); until IsLineEnd(Run); @@ -294,39 +287,39 @@ procedure TSynSTSyn.BorProc; procedure TSynSTSyn.BraceOpenProc; begin - if FRange = rsAsm then - FRange := rsBorAsm + if fRange = rsAsm then + fRange := rsBorAsm else - FRange := rsBor; + fRange := rsBor; BorProc; end; procedure TSynSTSyn.ColonOrGreaterProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if FLine[Run] = '=' then Inc(Run); + if fLine[Run] = '=' then Inc(Run); end; procedure TSynSTSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then Inc(Run); + if fLine[Run] = #10 then Inc(Run); end; procedure TSynSTSyn.IdentProc; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do Inc(Run); + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynSTSyn.IntegerProc; function IsIntegerChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', 'A'..'F', 'a'..'f': Result := True; else @@ -336,26 +329,26 @@ procedure TSynSTSyn.IntegerProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsIntegerChar do Inc(Run); end; procedure TSynSTSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynSTSyn.LowerProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '>']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '>']) then Inc(Run); end; procedure TSynSTSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -363,7 +356,7 @@ procedure TSynSTSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', 'e', 'E': Result := True; else @@ -373,7 +366,7 @@ procedure TSynSTSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of @@ -386,26 +379,26 @@ procedure TSynSTSyn.NumberProc; procedure TSynSTSyn.PointProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['.', ')']) then Inc(Run); + if CharInSet(fLine[Run], ['.', ')']) then Inc(Run); end; procedure TSynSTSyn.AnsiProc; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; else - FTokenID := tkComment; + fTokenID := tkComment; repeat - if (FLine[Run] = '*') and (FLine[Run + 1] = ')') then begin + if (fLine[Run] = '*') and (fLine[Run + 1] = ')') then begin Inc(Run, 2); - if FRange = rsAnsiAsm then - FRange := rsAsm + if fRange = rsAnsiAsm then + fRange := rsAsm else - FRange := rsUnknown; + fRange := rsUnKnown; Break; end; Inc(Run); @@ -416,65 +409,65 @@ procedure TSynSTSyn.AnsiProc; procedure TSynSTSyn.RoundOpenProc; begin Inc(Run); - case FLine[Run] of + case fLine[Run] of '*': begin Inc(Run); - if FRange = rsAsm then - FRange := rsAnsiAsm + if fRange = rsAsm then + fRange := rsAnsiAsm else - FRange := rsAnsi; - FTokenID := tkComment; + fRange := rsAnsi; + fTokenID := tkComment; if not IsLineEnd(Run) then AnsiProc; end; '.': begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; procedure TSynSTSyn.SemicolonProc; begin Inc(Run); - FTokenID := tkSymbol; - if FRange = rsProperty then - FRange := rsUnknown; + fTokenID := tkSymbol; + if fRange = rsProperty then + fRange := rsUnknown; end; procedure TSynSTSyn.SlashProc; begin Inc(Run); - if FLine[Run] = '/' then begin - FTokenID := tkComment; + if fLine[Run] = '/' then begin + fTokenID := tkComment; repeat Inc(Run); until IsLineEnd(Run); end else - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynSTSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynSTSyn.StringProc; begin - FTokenID := tkString; + fTokenID := tkString; Inc(Run); while not IsLineEnd(Run) do begin - if FLine[Run] = #39 then + if fLine[Run] = #39 then begin Inc(Run); - if FLine[Run] <> #39 then + if fLine[Run] <> #39 then Break; end; Inc(Run); @@ -484,26 +477,26 @@ procedure TSynSTSyn.StringProc; procedure TSynSTSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynSTSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynSTSyn.Next; begin - FAsmStart := False; - FTokenPos := Run; - case FRange of + fAsmStart := False; + fTokenPos := Run; + case fRange of rsAnsi, rsAnsiAsm: AnsiProc; rsBor, rsBorAsm: BorProc; else - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; @@ -516,7 +509,7 @@ procedure TSynSTSyn.Next; '{': BraceOpenProc; '}', '!', '"', '%', '&', '('..'/', ':'..'@', '['..'^', '`', '~': begin - case FLine[Run] of + case fLine[Run] of '(': RoundOpenProc; '.': PointProc; ';': SemicolonProc; @@ -538,11 +531,11 @@ procedure TSynSTSyn.Next; function TSynSTSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; else Result := nil; end; @@ -550,31 +543,31 @@ function TSynSTSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribute function TSynSTSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynSTSyn.GetTokenID: TtkTokenKind; begin - if not FAsmStart and (FRange = rsAsm) - and not (FTokenID in [tkNull, tkComment, tkSpace]) + if not fAsmStart and (fRange = rsAsm) + and not (fTokenId in [tkNull, tkComment, tkSpace]) then Result := tkAsm else - Result := FTokenID; + Result := fTokenId; end; function TSynSTSyn.GetTokenAttribute: TSynHighlighterAttributes; begin case GetTokenID of - tkAsm: Result := FAsmAttri; - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FSymbolAttri; + tkAsm: Result := fAsmAttri; + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fSymbolAttri; else Result := nil; end; @@ -587,17 +580,17 @@ function TSynSTSyn.GetTokenKind: Integer; function TSynSTSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; procedure TSynSTSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; procedure TSynSTSyn.ResetRange; begin - FRange:= rsUnknown; + fRange:= rsUnknown; end; class function TSynSTSyn.GetLanguageName: string; @@ -607,16 +600,14 @@ class function TSynSTSyn.GetLanguageName: string; function TSynSTSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterST; + Result := fDefaultFilter <> SYNS_FilterST; end; -class function TSynSTSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynSTSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangST; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynSTSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterSml.pas b/Ext/SynEdit/Source/SynHighlighterSml.pas index aa83a37..f8f7c5f 100644 --- a/Ext/SynEdit/Source/SynHighlighterSml.pas +++ b/Ext/SynEdit/Source/SynHighlighterSml.pas @@ -27,13 +27,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterSml.pas,v 1.14.2.6 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides SynEdit with a Standard ML syntax highlighter, with extra options for the standard Basis library.) @@ -72,20 +65,20 @@ interface type TSynSMLSyn = class(TSynCustomHighlighter) private - FBasis: Boolean; - FRange: TRangeState; + fBasis: Boolean; + fRange: TRangeState; FTokenID: TtkTokenKind; - FIdentFuncTable: array[0..70] of TIdentFuncTableFunc; - FCharacterAttri: TSynHighlighterAttributes; - FCommentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FOperatorAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FSyntaxErrorAttri: TSynHighlighterAttributes; + fIdentFuncTable: array[0..70] of TIdentFuncTableFunc; + fCharacterAttri: TSynHighlighterAttributes; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fOperatorAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fSyntaxErrorAttri: TSynHighlighterAttributes; function IsValidMLCharacter: Boolean; function AltFunc(Index: Integer): TtkTokenKind; function KeyWordFunc(Index: Integer): TtkTokenKind; @@ -110,11 +103,11 @@ TSynSMLSyn = class(TSynCustomHighlighter) procedure StringEndProc; procedure PoundProc; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; function GetRange: Pointer; override; procedure ResetRange; override; procedure SetRange(Value: Pointer); override; @@ -129,25 +122,25 @@ TSynSMLSyn = class(TSynCustomHighlighter) function IsIdentChar(AChar: WideChar): Boolean; override; procedure Next; override; published - property CharacterAttri: TSynHighlighterAttributes read FCharacterAttri - write FCharacterAttri; - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property OperatorAttri: TSynHighlighterAttributes read FOperatorAttri - write FOperatorAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; - property SyntaxErrorAttri: TSynHighlighterAttributes read FSyntaxErrorAttri - write FSyntaxErrorAttri; + property CharacterAttri: TSynHighlighterAttributes read fCharacterAttri + write fCharacterAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property OperatorAttri: TSynHighlighterAttributes read fOperatorAttri + write fOperatorAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; + property SyntaxErrorAttri: TSynHighlighterAttributes read fSyntaxErrorAttri + write fSyntaxErrorAttri; property Basis: Boolean read FBasis write FBasis default True; end; @@ -157,7 +150,7 @@ implementation SynEditStrConst; const - KeyWords: array[0..40] of UnicodeString = ( + KeyWords: array[0..40] of string = ( 'abstype', 'and', 'andalso', 'as', 'case', 'datatype', 'do', 'else', 'end', 'eqtype', 'exception', 'fn', 'fun', 'functor', 'handle', 'if', 'in', 'include', 'infix', 'infixr', 'let', 'local', 'nonfix', 'of', 'op', 'open', @@ -182,7 +175,7 @@ function TSynSMLSyn.HashKey(Str: PWideChar): Cardinal; Inc(Str); end; Result := Result mod 71; - FStringLen := Str - FToIdent; + fStringLen := Str - fToIdent; end; {$Q+} @@ -190,10 +183,10 @@ function TSynSMLSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; @@ -202,20 +195,20 @@ procedure TSynSMLSyn.InitIdent; var i: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; + fIdentFuncTable[i] := AltFunc; - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if @FIdentFuncTable[i] = nil then - FIdentFuncTable[i] := KeyWordFunc; + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if @fIdentFuncTable[i] = nil then + fIdentFuncTable[i] := KeyWordFunc; end; function TSynSMLSyn.IsValidMLCharacter: Boolean; function IsABNRTChar(Run: Integer): Boolean; begin - case FLine[Run] of + case fLine[Run] of 'a', 'b', 'n', 'r', 't': Result := True; else @@ -224,22 +217,22 @@ function TSynSMLSyn.IsValidMLCharacter: Boolean; end; var - ASCIIStr: UnicodeString; + ASCIIStr: string; ASCIICode, Error: Integer; begin Result := False; - if (FLine[Run] = '"') then - if (Run > 2) and (FLine[Run - 1] <> '\') and (FLine[Run - 2] = '"') then + if (fLine[Run] = '"') then + if (Run > 2) and (fLine[Run - 1] <> '\') and (fLine[Run - 2] = '"') then Result := True - else if (Run > 3) and (FLine[Run - 1] = '\') and (FLine[Run - 2] = '\') - and (FLine[Run - 3] = '"') then + else if (Run > 3) and (fLine[Run - 1] = '\') and (fLine[Run - 2] = '\') + and (fLine[Run - 3] = '"') then Result := True else if (Run > 3) and IsABNRTChar(Run - 1) and - (FLine[Run - 2] = '\') and (FLine[Run - 3] = '"') then + (fLine[Run - 2] = '\') and (fLine[Run - 3] = '"') then Result := True - else if (Run > 5) and (FLine[Run - 4] = '\') and (FLine[Run - 5] = '"') then + else if (Run > 5) and (fLine[Run - 4] = '\') and (fLine[Run - 5] = '"') then begin - ASCIIStr := copy(FLine, Run - 2, 3); + ASCIIStr := copy(fLine, Run - 2, 3); Val(ASCIIStr, ASCIICode, Error); if (Error = 0) and (ASCIICode >= 0) and (ASCIICode <= 255) then Result := True @@ -263,81 +256,80 @@ constructor TSynSMLSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := True; - - FCharacterAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter); - FCharacterAttri.Foreground := clBlue; - AddAttribute(FCharacterAttri); - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - FCommentAttri.Foreground := clNavy; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - FKeyAttri.Foreground := clGreen; - AddAttribute(FKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - FNumberAttri.Foreground := clRed; - AddAttribute(FNumberAttri); - FOperatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrOperator, SYNS_FriendlyAttrOperator); - FOperatorAttri.Foreground := clMaroon; - AddAttribute(FOperatorAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - FStringAttri.Foreground := clBlue; - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); - FSyntaxErrorAttri := TSynHighlighterAttributes.Create(SYNS_AttrSyntaxError, SYNS_FriendlyAttrSyntaxError); - FSyntaxErrorAttri.Foreground := clRed; - FSyntaxErrorAttri.Style := [fsBold]; - AddAttribute(FSyntaxErrorAttri); + fCaseSensitive := True; + + fCharacterAttri := TSynHighlighterAttributes.Create(SYNS_AttrCharacter, SYNS_FriendlyAttrCharacter); + fCharacterAttri.Foreground := clBlue; + AddAttribute(fCharacterAttri); + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + fCommentAttri.Foreground := clNavy; + AddAttribute(fCommentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + fKeyAttri.Foreground := clGreen; + AddAttribute(fKeyAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + fNumberAttri.Foreground := clRed; + AddAttribute(fNumberAttri); + fOperatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrOperator, SYNS_FriendlyAttrOperator); + fOperatorAttri.Foreground := clMaroon; + AddAttribute(fOperatorAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + fStringAttri.Foreground := clBlue; + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); + fSyntaxErrorAttri := TSynHighlighterAttributes.Create(SYNS_AttrSyntaxError, SYNS_FriendlyAttrSyntaxError); + fSyntaxErrorAttri.Foreground := clRed; + fSyntaxErrorAttri.Style := [fsBold]; + AddAttribute(fSyntaxErrorAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FDefaultFilter := SYNS_FilterSML; + fDefaultFilter := SYNS_FilterSML; Basis := True; end; procedure TSynSMLSyn.CRProc; begin - FTokenID := tkSpace; - case FLine[Run + 1] of + fTokenID := tkSpace; + Case FLine[Run + 1] of #10: Inc(Run, 2); - else - Inc(Run); + else Inc(Run); end; end; procedure TSynSMLSyn.ColonProc; begin Inc(Run); - if Basis and (FLine[Run] = ':') then + if Basis and (fLine[Run] = ':') then begin - FTokenID := tkOperator; + fTokenID := tkOperator; Inc(Run); end - else FTokenID := tkSymbol; + else fTokenID := tkSymbol; end; procedure TSynSMLSyn.IdentProc; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do Inc(Run); + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynSMLSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynSMLSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -345,7 +337,7 @@ procedure TSynSMLSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', 'u', 'U', 'l', 'L', 'x', 'X', 'e', 'E', 'f', 'F': Result := True; else @@ -355,12 +347,11 @@ procedure TSynSMLSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of - '.': if FLine[Run + 1] = '.' then - Break; + '.': if FLine[Run + 1] = '.' then Break; end; Inc(Run); end; @@ -369,42 +360,42 @@ procedure TSynSMLSyn.NumberProc; procedure TSynSMLSyn.OperatorProc; begin Inc(Run); - FTokenID := tkOperator; + fTokenID := tkOperator; end; procedure TSynSMLSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynSMLSyn.StringProc; begin - FTokenID := tkString; + fTokenID := tkString; repeat - if FLine[Run] = '\' then + if fLine[Run] = '\' then begin - case FLine[Run + 1] of + case fLine[Run + 1] of '"', '\': Inc(Run); #00: begin Inc(Run); - FRange := rsMultilineString; + fRange := rsMultilineString; Exit; end; end; end; Inc(Run); - until IsLineEnd(Run) or (FLine[Run] = '"'); + until IsLineEnd(Run) or (fLine[Run] = '"'); if FLine[Run] = '"' then Inc(Run); end; procedure TSynSMLSyn.StringEndProc; begin - FTokenID := tkString; + fTokenID := tkString; case FLine[Run] of #0: @@ -424,20 +415,20 @@ procedure TSynSMLSyn.StringEndProc; end; end; - FRange := rsUnknown; + fRange := rsUnknown; repeat case FLine[Run] of #0, #10, #13: Break; '\': begin - case FLine[Run + 1] of + case fLine[Run + 1] of '"', '\': Inc(Run); #00: begin Inc(Run); - FRange := rsMultilineString; + fRange := rsMultilineString; Exit; end; end; @@ -445,7 +436,7 @@ procedure TSynSMLSyn.StringEndProc; '"': Break; end; Inc(Run); - until IsLineEnd(Run) or (FLine[Run] = '"'); + until IsLineEnd(Run) or (fLine[Run] = '"'); if FLine[Run] = '"' then Inc(Run); end; @@ -453,33 +444,33 @@ procedure TSynSMLSyn.StringEndProc; procedure TSynSMLSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynSMLSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynSMLSyn.BasisOpProc; begin Inc(Run); - if Basis then FTokenID := tkOperator else FTokenID := tkIdentifier; + if Basis then fTokenID := tkOperator else fTokenID := tkIdentifier; end; procedure TSynSMLSyn.PoundProc; begin Inc(Run); - if (FLine[Run] = '"') then + if (fLine[Run] = '"') then CharacterProc else - FTokenID := tkIdentifier; + fTokenID := tkIdentifier; end; procedure TSynSMLSyn.CharacterProc; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; @@ -487,14 +478,14 @@ procedure TSynSMLSyn.CharacterProc; begin repeat Inc(Run); - until IsLineEnd(Run) or (FLine[Run] = '"'); + until IsLineEnd(Run) or (fLine[Run] = '"'); if IsValidMLCharacter then - FTokenID := tkCharacter + fTokenID := tkCharacter else begin - if FLine[Run] = '"' then Inc(Run); - FTokenID := tkSyntaxError; + if fLine[Run] = '"' then Inc(Run); + fTokenID := tkSyntaxError; end; end end @@ -503,31 +494,31 @@ procedure TSynSMLSyn.CharacterProc; procedure TSynSMLSyn.RoundBracketOpenProc; begin Inc(Run); - if (FLine[Run] = '*') then + if (fLine[Run] = '*') then begin - FRange := rsComment; + fRange := rsComment; CommentProc; - FTokenID := tkComment; + fTokenID := tkComment; end else - FTokenID := tkIdentifier; + fTokenID := tkIdentifier; end; procedure TSynSMLSyn.CommentProc; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LFProc; #13: CRProc; else begin - FTokenID := tkComment; + fTokenID := tkComment; repeat - if (FLine[Run] = '*') and - (FLine[Run + 1] = ')') then + if (fLine[Run] = '*') and + (fLine[Run + 1] = ')') then begin Inc(Run, 2); - FRange := rsUnknown; + fRange := rsUnknown; Break; end; if not IsLineEnd(Run) then @@ -539,15 +530,15 @@ procedure TSynSMLSyn.CommentProc; procedure TSynSMLSyn.Next; begin - FTokenPos := Run; - case FRange of + fTokenPos := Run; + case fRange of rsComment: CommentProc; rsMultilineString: StringEndProc; else begin - FRange := rsUnknown; + fRange := rsUnknown; - case FLine[Run] of + case fLine[Run] of #13: CRProc; '#': PoundProc; ':': ColonProc; @@ -571,12 +562,12 @@ procedure TSynSMLSyn.Next; function TSynSMLSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -584,40 +575,40 @@ function TSynSMLSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribut function TSynSMLSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynSMLSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynSMLSyn.GetTokenAttribute: TSynHighlighterAttributes; begin case GetTokenID of - tkCharacter: Result := FCharacterAttri; - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkOperator: Result := FOperatorAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkSyntaxError: Result := FSyntaxErrorAttri; - tkUnknown: Result := FIdentifierAttri; + tkCharacter: Result := fCharacterAttri; + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkOperator: Result := fOperatorAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkSyntaxError: Result := fSyntaxErrorAttri; + tkUnknown: Result := fIdentifierAttri; else Result := nil; end; end; function TSynSMLSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; function TSynSMLSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterSML; + Result := fDefaultFilter <> SYNS_FilterSML; end; function TSynSMLSyn.IsIdentChar(AChar: WideChar): Boolean; @@ -635,7 +626,7 @@ class function TSynSMLSyn.GetLanguageName: string; Result := SYNS_LangSML; end; -function TSynSMLSyn.GetSampleSource: UnicodeString; +function TSynSMLSyn.GetSampleSource: string; begin Result := '(* Syntax highlighting *)'#13#10 + 'load "Real";'#13#10 + @@ -651,26 +642,24 @@ function TSynSMLSyn.GetSampleSource: UnicodeString; procedure TSynSMLSyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; end; procedure TSynSMLSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; function TSynSMLSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; -class function TSynSMLSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynSMLSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangSML; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynSMLSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterTclTk.pas b/Ext/SynEdit/Source/SynHighlighterTclTk.pas index 9f394b1..27f16a6 100644 --- a/Ext/SynEdit/Source/SynHighlighterTclTk.pas +++ b/Ext/SynEdit/Source/SynHighlighterTclTk.pas @@ -27,13 +27,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterTclTk.pas,v 1.18.2.12 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a TCL/Tk highlighter for SynEdit) @@ -51,6 +44,7 @@ interface uses Windows, + Registry, Graphics, SynEditTypes, SynEditHighlighter, @@ -67,25 +61,25 @@ interface type TSynTclTkSyn = class(TSynCustomHighlighter) private - FRange: TRangeState; + fRange: TRangeState; FTokenID: TtkTokenKind; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FSecondKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FCommentAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FOptionsAttri: TSynHighlighterAttributes; - FVariableAttri: TSynHighlighterAttributes; - FPathAttri: TSynHighlighterAttributes; - FKeyWords: TUnicodeStrings; - FSecondKeys: TUnicodeStrings; - FTixWords: TUnicodeStrings; - FTixKeyAttri: TSynHighlighterAttributes; - FWidgetWords: TUnicodeStrings; - FWidgetKeyAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fSecondKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fCommentAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fOptionsAttri: TSynHighlighterAttributes; + fVariableAttri: TSynHighlighterAttributes; + fPathAttri: TSynHighlighterAttributes; + fKeyWords: TStrings; + fSecondKeys: TStrings; + fTixWords: TStrings; + fTixKeyAttri: TSynHighlighterAttributes; + fWidgetWords: TStrings; + fWidgetKeyAttri: TSynHighlighterAttributes; procedure BraceOpenProc; procedure PointCommaProc; procedure CRProc; @@ -105,18 +99,18 @@ TSynTclTkSyn = class(TSynCustomHighlighter) procedure PathProc; procedure MinusProc; procedure SymbolProc; - procedure SetKeyWords(const Value: TUnicodeStrings); - procedure SetSecondKeys(const Value: TUnicodeStrings); + procedure SetKeyWords(const Value: TStrings); + procedure SetSecondKeys(const Value: TStrings); function IsKeywordListStored: Boolean; function IsSecondKeywordListStored: Boolean; - function InternalIsKeyword(const AKeyword: UnicodeString; - KeyWordList: TUnicodeStrings; ACaseSensitive: Boolean = False): Boolean; + function InternalIsKeyword(const AKeyword: string; + KeyWordList: TStrings; ACaseSensitive: Boolean = False): Boolean; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -125,7 +119,7 @@ TSynTclTkSyn = class(TSynCustomHighlighter) function GetEol: Boolean; override; function GetRange: Pointer; override; function GetTokenID: TtkTokenKind; - function IsKeyword(const AKeyword: UnicodeString): Boolean; override; + function IsKeyword(const AKeyword: string): Boolean; override; function GetTokenAttribute: TSynHighlighterAttributes; override; function GetTokenKind: Integer; override; procedure Next; override; @@ -134,38 +128,38 @@ TSynTclTkSyn = class(TSynCustomHighlighter) function SaveToRegistry(RootKey: HKEY; Key: string): Boolean; override; function LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property KeyWords: TUnicodeStrings read FKeyWords write SetKeyWords + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property KeyWords: TStrings read fKeyWords write SetKeyWords stored IsKeywordListStored; - property SecondKeyAttri: TSynHighlighterAttributes read FSecondKeyAttri - write FSecondKeyAttri; - property SecondKeyWords: TUnicodeStrings read FSecondKeys write SetSecondKeys + property SecondKeyAttri: TSynHighlighterAttributes read fSecondKeyAttri + write fSecondKeyAttri; + property SecondKeyWords: TStrings read fSecondKeys write SetSecondKeys stored IsSecondKeywordListStored; - property TixKeyAttri: TSynHighlighterAttributes read FTixKeyAttri - write FTixKeyAttri; - property TixWords: TUnicodeStrings read FTixWords; - property WidgetKeyAttri: TSynHighlighterAttributes read FWidgetKeyAttri - write FWidgetKeyAttri; - property WidgetWords: TUnicodeStrings read FWidgetWords; - - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; - property OptionsAttri: TSynHighlighterAttributes read FOptionsAttri - write FOptionsAttri; - property PathAttri: TSynHighlighterAttributes read FPathAttri - write FPathAttri; - property VariableAttri: TSynHighlighterAttributes read FVariableAttri - write FVariableAttri; + property TixKeyAttri: TSynHighlighterAttributes read fTixKeyAttri + write fTixKeyAttri; + property TixWords: TStrings read fTixWords; + property WidgetKeyAttri: TSynHighlighterAttributes read fWidgetKeyAttri + write fWidgetKeyAttri; + property WidgetWords: TStrings read fWidgetWords; + + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; + property OptionsAttri: TSynHighlighterAttributes read fOptionsAttri + write fOptionsAttri; + property PathAttri: TSynHighlighterAttributes read fPathAttri + write fPathAttri; + property VariableAttri: TSynHighlighterAttributes read fVariableAttri + write fVariableAttri; end; implementation @@ -174,11 +168,11 @@ implementation SynEditStrConst; const - TclTkKeys: array[0..128] of UnicodeString = ( + TclTkKeys: array[0..128] of string = ( 'after', 'append', 'array', 'auto_execok', 'auto_import', 'auto_load', 'auto_mkindex', 'auto_mkindex_old', 'auto_qualify', 'auto_reset', 'base', 'bgerror', 'binary', 'body', 'break', 'catch', 'cd', 'class', 'clock', - 'close', 'code', 'concat', 'configbody', 'constructor', 'continue', 'dde', + 'close', 'code', 'concat', 'configbody', 'constructor', 'continue', 'dde', 'delete', 'destructor', 'else', 'elseif', 'encoding', 'ensemble', 'eof', 'error', 'eval', 'exec', 'exit', 'expr', 'fblocked', 'fconfigure', 'fcopy', 'file', 'fileevent', 'filename', 'find', 'flush', 'for', 'foreach', @@ -196,7 +190,7 @@ implementation 'update', 'uplevel', 'upvar', 'variable', 'vwait', 'while' ); - SecondTclTkKeys: array[0..91] of UnicodeString = ( + SecondTclTkKeys: array[0..91] of string = ( 'bell', 'bind', 'bindidproc', 'bindproc', 'bindtags', 'bitmap', 'button', 'canvas', 'checkbutton', 'clipboard', 'colors', 'combobox', 'console', 'cursors', 'debug', 'destroy', 'entry', 'event', 'exp_after', 'exp_before', @@ -214,7 +208,7 @@ implementation 'tkerror', 'tkvars', 'tkwait', 'toplevel', 'wait', 'winfo', 'wm' ); - TixKeys: array[0..43] of UnicodeString = ( + TixKeys: array[0..43] of string = ( 'compound', 'pixmap', 'tix', 'tixballoon', 'tixbuttonbox', 'tixchecklist', 'tixcombobox', 'tixcontrol', 'tixdestroy', 'tixdirlist', 'tixdirselectdialog', 'tixdirtree', 'tixdisplaystyle', 'tixexfileselectbox', @@ -227,7 +221,7 @@ implementation 'tixstdbuttonbox', 'tixtlist', 'tixtree', 'tixutils', 'tixwish' ); - WidgetKeys: array[0..32] of UnicodeString = ( + WidgetKeys: array[0..32] of string = ( 'ArrowButton', 'Button', 'ButtonBox', 'BWidget', 'ComboBox', 'Dialog', 'DragSite', 'DropSite', 'DynamicHelp', 'Entry', 'Label', 'LabelEntry', 'LabelFrame', 'ListBox', 'MainFrame', 'MessageDlg', 'NoteBook', @@ -237,11 +231,11 @@ implementation 'Widget' ); -function TSynTclTkSyn.InternalIsKeyword(const AKeyword: UnicodeString; - KeyWordList: TUnicodeStrings; ACaseSensitive: Boolean = False): Boolean; +function TSynTclTkSyn.InternalIsKeyword(const AKeyword: string; + KeyWordList: TStrings; ACaseSensitive: Boolean = False): Boolean; var First, Last, I, Compare: Integer; - Token: UnicodeString; + Token: string; begin First := 0; Last := KeyWordList.Count - 1; @@ -249,11 +243,11 @@ function TSynTclTkSyn.InternalIsKeyword(const AKeyword: UnicodeString; if ACaseSensitive then Token := AKeyword else - Token := SynWideLowerCase(AKeyword); + Token := SysUtils.AnsiLowerCase(AKeyword); while First <= Last do begin I := (First + Last) shr 1; - Compare := WideCompareStr(KeyWordList[i], Token); + Compare := CompareStr(KeyWordList[i], Token); if Compare = 0 then begin Result := True; @@ -264,103 +258,103 @@ function TSynTclTkSyn.InternalIsKeyword(const AKeyword: UnicodeString; end; end; -function TSynTclTkSyn.IsKeyword(const AKeyword: UnicodeString): Boolean; +function TSynTclTkSyn.IsKeyword(const AKeyword: string): Boolean; begin - Result := InternalIsKeyword(AKeyword, FWidgetWords, True) or - InternalIsKeyword(AKeyword, FTixWords) or - InternalIsKeyword(AKeyword, FKeyWords) or - InternalIsKeyword(AKeyword, FSecondKeys); + Result := InternalIsKeyword(AKeyword, fWidgetWords, True) or + InternalIsKeyword(AKeyword, fTixWords) or + InternalIsKeyword(AKeyword, fKeyWords) or + InternalIsKeyword(AKeyword, fSecondKeys); end; constructor TSynTclTkSyn.Create(AOwner: TComponent); var - i: Integer; + I: Integer; begin inherited Create(AOwner); - FCaseSensitive := False; - - FKeyWords := TUnicodeStringList.Create; - TUnicodeStringList(FKeyWords).Sorted := True; - TUnicodeStringList(FKeyWords).Duplicates := dupIgnore; - FSecondKeys := TUnicodeStringList.Create; - TUnicodeStringList(FSecondKeys).Sorted := True; - TUnicodeStringList(FSecondKeys).Duplicates := dupIgnore; - FTixWords := TUnicodeStringList.Create; - TUnicodeStringList(FTixWords).Sorted := True; - TUnicodeStringList(FTixWords).Duplicates := dupIgnore; - FWidgetWords := TUnicodeStringList.Create; - TUnicodeStringList(FWidgetWords).Sorted := True; - TUnicodeStringList(FWidgetWords).Duplicates := dupIgnore; - FKeyWords.BeginUpdate; - for i := Low(TclTkKeys) to High(TclTkKeys) do - FKeyWords.Add(TclTkKeys[i]); - FKeyWords.EndUpdate; - FSecondKeys.BeginUpdate; - for i := Low(SecondTclTkKeys) to High(SecondTclTkKeys) do - FSecondKeys.Add(SecondTclTkKeys[i]); - FSecondKeys.EndUpdate; - FTixWords.BeginUpdate; - for i := Low(TixKeys) to High(TixKeys) do - FTixWords.Add(TixKeys[i]); - FTixWords.EndUpdate; - FWidgetWords.BeginUpdate; - for i := Low(WidgetKeys) to High(WidgetKeys) do - FWidgetWords.Add(WidgetKeys[i]); - FWidgetWords.EndUpdate; - - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); - FSecondKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); - FSecondKeyAttri.Style := [fsBold]; - AddAttribute(FSecondKeyAttri); - - FTixKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrTixKeyWords, SYNS_FriendlyAttrTixKeyWords); - FTixKeyAttri.Style := [fsBold, fsItalic]; - AddAttribute(FTixKeyAttri); - - FWidgetKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrWidgetWords, SYNS_FriendlyAttrWidgetWords); - FWidgetKeyAttri.Style := [fsBold, fsItalic]; - AddAttribute(FWidgetKeyAttri); - - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); + fCaseSensitive := False; + + fKeyWords := TStringList.Create; + TStringList(fKeyWords).Sorted := True; + TStringList(fKeyWords).Duplicates := dupIgnore; + fSecondKeys := TStringList.Create; + TStringList(fSecondKeys).Sorted := True; + TStringList(fSecondKeys).Duplicates := dupIgnore; + fTixWords := TStringList.Create; + TStringList(fTixWords).Sorted := True; + TStringList(fTixWords).Duplicates := dupIgnore; + fWidgetWords := TStringList.Create; + TStringList(fWidgetWords).Sorted := True; + TStringList(fWidgetWords).Duplicates := dupIgnore; + fKeyWords.BeginUpdate; + for I := Low(TclTkKeys) to High(TclTkKeys) do + FKeyWords.Add(TclTkKeys[I]); + fKeyWords.EndUpdate; + fSecondKeys.BeginUpdate; + for I := Low(SecondTclTkKeys) to High(SecondTclTkKeys) do + fSecondKeys.Add(SecondTclTkKeys[I]); + fSecondKeys.EndUpdate; + fTixWords.BeginUpdate; + for I := Low(TixKeys) to High(TixKeys) do + FTixWords.Add(TixKeys[I]); + fTixWords.EndUpdate; + fWidgetWords.BeginUpdate; + for I := Low(WidgetKeys) to High(WidgetKeys) do + FWidgetWords.Add(WidgetKeys[I]); + fWidgetWords.EndUpdate; + + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + AddAttribute(fCommentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); + fSecondKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); + fSecondKeyAttri.Style := [fsBold]; + AddAttribute(fSecondKeyAttri); + + fTixKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrTixKeyWords, SYNS_FriendlyAttrTixKeyWords); + fTixKeyAttri.Style := [fsBold, fsItalic]; + AddAttribute(fTixKeyAttri); + + fWidgetKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrWidgetWords, SYNS_FriendlyAttrWidgetWords); + fWidgetKeyAttri.Style := [fsBold, fsItalic]; + AddAttribute(fWidgetKeyAttri); + + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); SetAttributesOnChange(DefHighlightChange); - FOptionsAttri := TSynHighlighterAttributes.Create(SYNS_AttrOptions, SYNS_FriendlyAttrOptions); - AddAttribute(FOptionsAttri); - FVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); - AddAttribute(FVariableAttri); - FPathAttri := TSynHighlighterAttributes.Create(SYNS_AttrPath, SYNS_FriendlyAttrPath); - AddAttribute(FPathAttri); + fOptionsAttri := TSynHighlighterAttributes.Create(SYNS_AttrOptions, SYNS_FriendlyAttrOptions); + AddAttribute(fOptionsAttri); + fVariableAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); + AddAttribute(fVariableAttri); + fPathAttri := TSynHighlighterAttributes.Create(SYNS_AttrPath, SYNS_FriendlyAttrPath); + AddAttribute(fPathAttri); - FRange := rsUnknown; - FDefaultFilter := SYNS_FilterTclTk; + fRange := rsUnknown; + fDefaultFilter := SYNS_FilterTclTk; end; destructor TSynTclTkSyn.Destroy; begin - FWidgetWords.Free; - FTixWords.Free; - FSecondKeys.Free; - FKeyWords.Free; + fWidgetWords.Free; + fTixWords.Free; + fSecondKeys.Free; + fKeyWords.Free; inherited Destroy; end; procedure TSynTclTkSyn.AnsiProc; begin - FTokenID := tkComment; + fTokenID := tkComment; case FLine[Run] of #0: begin @@ -381,11 +375,11 @@ procedure TSynTclTkSyn.AnsiProc; end; while not IsLineEnd(Run) do - if FLine[Run] = '*' then + if fLine[Run] = '*' then begin - if FLine[Run + 1] = ')' then + if fLine[Run + 1] = ')' then begin - FRange := rsUnknown; + fRange := rsUnKnown; Inc(Run, 2); Break; end @@ -398,7 +392,7 @@ procedure TSynTclTkSyn.AnsiProc; procedure TSynTclTkSyn.PasStyleProc; begin - FTokenID := tkComment; + fTokenID := tkComment; case FLine[Run] of #0: begin @@ -421,7 +415,7 @@ procedure TSynTclTkSyn.PasStyleProc; while not IsLineEnd(Run) do if FLine[Run] = '}' then begin - FRange := rsUnknown; + fRange := rsUnKnown; Inc(Run); Break; end @@ -431,7 +425,7 @@ procedure TSynTclTkSyn.PasStyleProc; procedure TSynTclTkSyn.CStyleProc; begin - FTokenID := tkComment; + fTokenID := tkComment; case FLine[Run] of #0: begin @@ -452,11 +446,11 @@ procedure TSynTclTkSyn.CStyleProc; end; while not IsLineEnd(Run) do - if FLine[Run] = '*' then + if fLine[Run] = '*' then begin - if FLine[Run + 1] = '/' then + if fLine[Run + 1] = '/' then begin - FRange := rsUnknown; + fRange := rsUnKnown; Inc(Run, 2); Break; end @@ -469,18 +463,18 @@ procedure TSynTclTkSyn.CStyleProc; procedure TSynTclTkSyn.BraceOpenProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynTclTkSyn.PointCommaProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynTclTkSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; case FLine[Run + 1] of #10: Inc(Run, 2); else Inc(Run); @@ -489,28 +483,28 @@ procedure TSynTclTkSyn.CRProc; procedure TSynTclTkSyn.IdentProc; begin - while IsIdentChar(FLine[Run]) do Inc(Run); - if InternalIsKeyword(GetToken, FWidgetWords, True) then - FTokenID := tkWidgetKey - else if InternalIsKeyword(GetToken, FTixWords) then - FTokenID := tkTixKey - else if InternalIsKeyword(GetToken, FKeyWords) then - FTokenID := tkKey - else if InternalIsKeyword(GetToken, FSecondKeys) then - FTokenID := tkSecondKey + while IsIdentChar(fLine[Run]) do Inc(Run); + if InternalIsKeyword(GetToken, fWidgetWords, True) then + fTokenId := tkWidgetKey + else if InternalIsKeyword(GetToken, fTixWords) then + fTokenId := tkTixKey + else if InternalIsKeyword(GetToken, fKeyWords) then + fTokenId := tkKey + else if InternalIsKeyword(GetToken, fSecondKeys) then + fTokenId := tkSecondKey else - FTokenID := tkIdentifier; + fTokenId := tkIdentifier; end; procedure TSynTclTkSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynTclTkSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -518,7 +512,7 @@ procedure TSynTclTkSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', 'e', 'E': Result := True; else @@ -528,7 +522,7 @@ procedure TSynTclTkSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of @@ -542,14 +536,14 @@ procedure TSynTclTkSyn.NumberProc; procedure TSynTclTkSyn.RoundOpenProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenId := tkSymbol; end; procedure TSynTclTkSyn.SlashProc; begin if FLine[Run] = '#' then begin - FTokenID := tkComment; + fTokenID := tkComment; while not IsLineEnd(Run) do Inc(Run); end else @@ -562,13 +556,13 @@ procedure TSynTclTkSyn.SlashProc; procedure TSynTclTkSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynTclTkSyn.StringProc; begin - FTokenID := tkString; + fTokenID := tkString; if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2); repeat @@ -581,18 +575,18 @@ procedure TSynTclTkSyn.StringProc; procedure TSynTclTkSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnKnown; + fTokenID := tkUnKnown; end; procedure TSynTclTkSyn.Next; begin - FTokenPos := Run; - case FRange of + fTokenPos := Run; + case fRange of rsAnsi: AnsiProc; rsPasStyle: PasStyleProc; rsCStyle: CStyleProc; else - case FLine[Run] of + case fLine[Run] of '-': MinusProc; '#': SlashProc; '{': BraceOpenProc; @@ -618,12 +612,12 @@ procedure TSynTclTkSyn.Next; function TSynTclTkSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -631,36 +625,36 @@ function TSynTclTkSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttrib function TSynTclTkSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynTclTkSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; function TSynTclTkSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynTclTkSyn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkSecondKey: Result := FSecondKeyAttri; - tkTixKey: Result := FTixKeyAttri; - tkWidgetKey: Result := FWidgetKeyAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkOptions: Result := FOptionsAttri; - tkVariable: Result := FVariableAttri; - tkPath: Result := FPathAttri; - tkUnknown: Result := FSymbolAttri; + case fTokenID of + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkSecondKey: Result := fSecondKeyAttri; + tkTixKey: Result := fTixKeyAttri; + tkWidgetKey: Result := fWidgetKeyAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkOptions: Result := fOptionsAttri; + tkVariable: Result := fVariableAttri; + tkPath: Result := fPathAttri; + tkUnknown: Result := fSymbolAttri; else Result := nil; end; @@ -668,52 +662,52 @@ function TSynTclTkSyn.GetTokenAttribute: TSynHighlighterAttributes; function TSynTclTkSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; procedure TSynTclTkSyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; end; procedure TSynTclTkSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; -procedure TSynTclTkSyn.SetKeyWords(const Value: TUnicodeStrings); +procedure TSynTclTkSyn.SetKeyWords(const Value: TStrings); var - i: Integer; + I: Integer; begin if Value <> nil then begin Value.BeginUpdate; - for i := 0 to Value.Count - 1 do - Value[i] := SynWideUpperCase(Value[i]); + for I := 0 to Value.Count - 1 do + Value[I] := SysUtils.AnsiUpperCase(Value[I]); Value.EndUpdate; end; - FKeyWords.Assign(Value); + fKeyWords.Assign(Value); DefHighLightChange(nil); end; -procedure TSynTclTkSyn.SetSecondKeys(const Value: TUnicodeStrings); +procedure TSynTclTkSyn.SetSecondKeys(const Value: TStrings); var - i: Integer; + I: Integer; begin if Value <> nil then begin Value.BeginUpdate; - for i := 0 to Value.Count - 1 do - Value[i] := SynWideUpperCase(Value[i]); + for I := 0 to Value.Count - 1 do + Value[I] := SysUtils.AnsiUpperCase(Value[I]); Value.EndUpdate; end; - FSecondKeys.Assign(Value); + fSecondKeys.Assign(Value); DefHighLightChange(nil); end; function TSynTclTkSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterTclTk; + Result := fDefaultFilter <> SYNS_FilterTclTk; end; class function TSynTclTkSyn.GetLanguageName: string; @@ -723,9 +717,9 @@ class function TSynTclTkSyn.GetLanguageName: string; function TSynTclTkSyn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; var - r: TBetterRegistry; + r: TRegistry; begin - r := TBetterRegistry.Create; + r := TRegistry.Create; try r.RootKey := RootKey; if r.OpenKeyReadOnly(Key) then @@ -742,19 +736,18 @@ function TSynTclTkSyn.LoadFromRegistry(RootKey: HKEY; Key: string): Boolean; function TSynTclTkSyn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean; var - r: TBetterRegistry; + r: TRegistry; begin - r:= TBetterRegistry.Create; + r:= TRegistry.Create; try r.RootKey := RootKey; - if r.OpenKey(Key,true) then begin - {$IFNDEF SYN_COMPILER_25_UP} - Result := true; - {$ENDIF} + if r.OpenKey(Key, True) then + begin r.WriteString('KeyWords', KeyWords.Text); Result := inherited SaveToRegistry(RootKey, Key); end - else Result := False; + else + Result := False; finally r.Free; end; @@ -762,11 +755,11 @@ function TSynTclTkSyn.SaveToRegistry(RootKey: HKEY; Key: string): Boolean; function TSynTclTkSyn.IsKeywordListStored: Boolean; var - Keys: TUnicodeStringList; + Keys: TStringList; DefKey: Integer; Index: Integer; begin - Keys := TUnicodeStringList.Create; + Keys := TStringList.Create; try Keys.Assign(KeyWords); Index := 0; @@ -785,7 +778,7 @@ function TSynTclTkSyn.IsKeywordListStored: Boolean; end; end; -function TSynTclTkSyn.GetSampleSource: UnicodeString; +function TSynTclTkSyn.GetSampleSource: string; begin Result := '#!/usr/local/tclsh8.0'#13#10 + @@ -795,7 +788,7 @@ function TSynTclTkSyn.GetSampleSource: UnicodeString; '}'; end; -class function TSynTclTkSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynTclTkSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangTclTk; end; @@ -809,23 +802,23 @@ procedure TSynTclTkSyn.MinusProc; OK := False; Inc(Run); { minus like symbol } - if CharInSet(FLine[Run], ['0'..'9']) then + if CharInSet(fLine[Run], ['0'..'9']) then FTokenID := tkSymbol else { special option -- } - if (FLine[Run] = '-') and CharInSet(FLine[Run + 1], EmptyChars) then + if (fLine[Run] = '-') and CharInSet(fLine[Run + 1], EmptyChars) then begin OK := True; Inc(Run); end { normal options -options } else begin - if CharInSet(FLine[Run], ['a'..'z', 'A'..'Z']) then + if CharInSet(fLine[Run], ['a'..'z', 'A'..'Z']) then begin Inc(Run); while CharInSet(FLine[Run], ['a'..'z', 'A'..'Z']) do Inc(Run); - OK := CharInSet(FLine[Run], EmptyChars); + OK := CharInSet(fLine[Run], EmptyChars); end { bad option syntax } else @@ -842,7 +835,7 @@ procedure TSynTclTkSyn.PathProc; begin if CharInSet(FLine[Run + 1], ['a'..'z', 'A'..'Z']) then begin - FTokenID := tkPath; + fTokenID := tkPath; Inc(Run); while CharInSet(FLine[Run], ['a'..'z', 'A'..'Z', '0'..'9']) do Inc(Run); end @@ -855,18 +848,18 @@ procedure TSynTclTkSyn.PathProc; procedure TSynTclTkSyn.VariableProc; begin - FTokenID := tkVariable; + fTokenId := tkVariable; Inc(Run); while CharInSet(FLine[Run], ['_', '0'..'9', 'A'..'Z', 'a'..'z']) do Inc(Run); end; function TSynTclTkSyn.IsSecondKeywordListStored: Boolean; var - Keys: TUnicodeStringList; + Keys: TStringList; DefKey: Integer; Index: Integer; begin - Keys := TUnicodeStringList.Create; + Keys := TStringList.Create; try Keys.Assign(SecondKeyWords); Index := 0; @@ -892,7 +885,5 @@ procedure TSynTclTkSyn.SymbolProc; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynTclTkSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterTeX.pas b/Ext/SynEdit/Source/SynHighlighterTeX.pas index 1968e59..e7ec9c4 100644 --- a/Ext/SynEdit/Source/SynHighlighterTeX.pas +++ b/Ext/SynEdit/Source/SynHighlighterTeX.pas @@ -25,14 +25,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterTeX.pas,v 1.5.2.5 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file from sproessig@bs-webdesign.de - -The unit SynHighlighterTeX provides SynEdit with a TeX highlighter. - -Known Issues: -------------------------------------------------------------------------------} unit SynHighlighterTeX; @@ -55,16 +47,16 @@ interface type TSynTeXSyn = class(TSynCustomHighlighter) private - FTokenID: TtkTokenKind; - FTextAttri: TSynHighlighterAttributes; - FControlSequenceAttri: TSynHighlighterAttributes; - FMathmodeAttri: TSynHighlighterAttributes; - FCommentAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FBracketAttri: TSynHighlighterAttributes; - FBraceAttri: TSynHighlighterAttributes; - - function CreateHighlighterAttributes(Name: string; FriendlyName: UnicodeString; + fTokenID: TtkTokenKind; + fTextAttri: TSynHighlighterAttributes; + fControlSequenceAttri: TSynHighlighterAttributes; + fMathmodeAttri: TSynHighlighterAttributes; + fCommentAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fBracketAttri: TSynHighlighterAttributes; + fBraceAttri: TSynHighlighterAttributes; + + function CreateHighlighterAttributes(Name: string; FriendlyName: string; Foreground, Background: TColor; FontStyles: TFontStyles): TSynHighlighterAttributes; procedure CRProc; procedure TextProc; @@ -79,11 +71,11 @@ TSynTeXSyn = class(TSynCustomHighlighter) procedure BracketCloseProc; procedure MathmodeProc; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; @@ -94,20 +86,21 @@ TSynTeXSyn = class(TSynCustomHighlighter) function GetTokenKind: Integer; override; procedure Next; override; published - property CommentAttri : TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property TextAttri: TSynHighlighterAttributes read FTextAttri - write FTextAttri; - property ControlSequenceAttri: TSynHighlighterAttributes read FControlSequenceAttri - write FControlSequenceAttri; - property MathmodeAttri: TSynHighlighterAttributes read FMathmodeAttri - write FMathmodeAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property BraceAttri: TSynHighlighterAttributes read FBraceAttri - write FBraceAttri; - property BracketAttri: TSynHighlighterAttributes read FBracketAttri - write FBracketAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property TextAttri: TSynHighlighterAttributes read fTextAttri + write fTextAttri; + property ControlSequenceAttri: TSynHighlighterAttributes read +fControlSequenceAttri + write fControlSequenceAttri; + property MathmodeAttri: TSynHighlighterAttributes read fMathmodeAttri + write fMathmodeAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property BraceAttri: TSynHighlighterAttributes read fBraceAttri + write fBraceAttri; + property BracketAttri: TSynHighlighterAttributes read fBracketAttri + write fBracketAttri; end; implementation @@ -119,38 +112,38 @@ constructor TSynTeXSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCommentAttri := CreateHighlighterAttributes(SYNS_AttrComment, SYNS_FriendlyAttrComment, clTeal, clNone, []); - AddAttribute(FCommentAttri); + fCommentAttri := CreateHighlighterAttributes(SYNS_AttrComment, SYNS_FriendlyAttrComment, clTeal, clNone, []); + AddAttribute(fCommentAttri); - FTextAttri := CreateHighlighterAttributes(SYNS_AttrText, SYNS_FriendlyAttrText, clBlack, clNone, []); - AddAttribute(FTextAttri); + fTextAttri := CreateHighlighterAttributes(SYNS_AttrText, SYNS_FriendlyAttrText, clBlack, clNone, []); + AddAttribute(fTextAttri); - FMathmodeAttri := CreateHighlighterAttributes(SYNS_AttrMathmode, SYNS_FriendlyAttrMathmode, clOlive, clNone, + fMathmodeAttri := CreateHighlighterAttributes(SYNS_AttrMathmode, SYNS_FriendlyAttrMathmode, clOlive, clNone, [fsbold]); - AddAttribute(FMathmodeAttri); + AddAttribute(fMathmodeAttri); - FSpaceAttri := CreateHighlighterAttributes(SYNS_AttrSpace, SYNS_FriendlyAttrSpace, clNone, clWhite, []); - AddAttribute(FSpaceAttri); + fSpaceAttri := CreateHighlighterAttributes(SYNS_AttrSpace, SYNS_FriendlyAttrSpace, clNone, clWhite, []); + AddAttribute(fSpaceAttri); - FControlSequenceAttri := CreateHighlighterAttributes(SYNS_AttrTexCommand, SYNS_FriendlyAttrTexCommand, clBlue, + fControlSequenceAttri := CreateHighlighterAttributes(SYNS_AttrTexCommand, SYNS_FriendlyAttrTexCommand, clBlue, clWhite, [fsBold]); - AddAttribute(FControlSequenceAttri); + AddAttribute(fControlSequenceAttri); - FBracketAttri := CreateHighlighterAttributes(SYNS_AttrSquareBracket, SYNS_FriendlyAttrSquareBracket, clPurple, + fBracketAttri := CreateHighlighterAttributes(SYNS_AttrSquareBracket, SYNS_FriendlyAttrSquareBracket, clPurple, clNone, []); - AddAttribute(FBracketAttri); + AddAttribute(fBracketAttri); - FBraceAttri:= CreateHighlighterAttributes(SYNS_AttrRoundBracket, SYNS_FriendlyAttrRoundBracket, clRed, + fBraceAttri:= CreateHighlighterAttributes(SYNS_AttrRoundBracket, SYNS_FriendlyAttrRoundBracket, clRed, clNone, [fsBold]); - AddAttribute(FBraceAttri); + AddAttribute(fBraceAttri); SetAttributesOnChange(DefHighlightChange); - FDefaultFilter := SYNS_FilterTeX; + fDefaultFilter := SYNS_FilterTeX; end; { Create } procedure TSynTeXSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; case FLine[Run + 1] of #10: Inc(Run, 2); else Inc(Run); @@ -160,56 +153,56 @@ procedure TSynTeXSyn.CRProc; procedure TSynTeXSyn.SpaceProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; { SpaceProc } procedure TSynTeXSyn.TextProc; begin - FTokenID := tkText; + fTokenID := tkText; Inc(Run); end; { TextProc } procedure TSynTeXSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; { SpaceProc } procedure TSynTeXSyn.BraceOpenProc; begin - FTokenID := tkBrace; + fTokenID := tkBrace; Inc(Run); end; { BraceOpen } procedure TSynTeXSyn.BraceCloseProc; begin - FTokenID := tkBrace; + fTokenID := tkBrace; Inc(Run); end; { BraceClose } procedure TSynTeXSyn.BracketOpenProc; begin - FTokenID := tkBracket; + fTokenID := tkBracket; Inc(Run); end; { BracketOpen } procedure TSynTeXSyn.BracketCloseProc; begin - FTokenID := tkBracket; + fTokenID := tkBracket; Inc(Run); end; { BracketClose } procedure TSynTeXSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; { NullProc } procedure TSynTeXSyn.CommentProc; begin - FTokenID := tkComment; + fTokenID := tkComment; repeat case fLine[Run] of #0, #10: Break; @@ -221,34 +214,34 @@ procedure TSynTeXSyn.CommentProc; procedure TSynTeXSyn.MathModeProc; begin - FTokenID := tkMathMode; - Inc(Run); + fTokenID := tkMathMode; + Inc(Run); end; { MathModeProc } procedure TSynTeXSyn.ControlSequenceProc; begin - FTokenID := tkControlSequence; - repeat - case fLine[Run] of - #0..#31: Break; //No Control Chars ! - #48..#57: Break; //No Numbers ! - #33..#47, #58..#64, //Just the Characters that - #91, #93,#94, #123, //only can follow to '\' - #125, #126: - begin - if (FLine[Run-1] = '\') then - Inc(Run,1); - Break; - end; - end; - Inc(Run); - until fLine[Run] = #32; - Exit; + fTokenID := tkControlSequence; + repeat + case fLine[Run] of + #0..#31: Break; //No Control Chars ! + #48..#57: Break; //No Numbers ! + #33..#47, #58..#64, //Just the Characters that + #91, #93,#94, #123, //only can follow to '\' + #125, #126: + begin + if (fLine[Run-1]='\') then + Inc(Run,1); + Break; + end; + end; + Inc(Run); + until fLine[Run] = #32; + Exit; end; { ControlSequenceProc } procedure TSynTeXSyn.Next; begin - FTokenPos := Run; + fTokenPos := Run; case fLine[Run] of #0: NullProc; #10: LFProc; @@ -270,32 +263,32 @@ function TSynTeXSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; else Result := nil; end; end; function TSynTeXSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; { GetDefaultAttribute } function TSynTeXSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; { GetTokenID } function TSynTeXSyn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkComment: Result := FCommentAttri; - tkText: Result := FTextAttri; - tkControlSequence: Result := FControlSequenceAttri; - tkMathMode: Result := FMathmodeAttri; - tkSpace: Result := FSpaceAttri; - tkBrace: Result := FBraceAttri; - tkBracket: Result := FBracketAttri; + case fTokenID of + tkComment: Result := fCommentAttri; + tkText: Result := fTextAttri; + tkControlSequence: Result := fControlSequenceAttri; + tkMathMode: Result := fMathmodeAttri; + tkSpace: Result := fSpaceAttri; + tkBrace: Result := fBraceAttri; + tkBracket: Result := fBracketAttri; else Result := nil; end; @@ -303,12 +296,12 @@ function TSynTeXSyn.GetTokenAttribute: TSynHighlighterAttributes; function TSynTeXSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; { GetTokenKind } function TSynTeXSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterTeX; + Result := fDefaultFilter <> SYNS_FilterTeX; end; class function TSynTeXSyn.GetLanguageName: string; @@ -316,7 +309,7 @@ class function TSynTeXSyn.GetLanguageName: string; Result := SYNS_LangTeX; end; { GetLanguageName } -function TSynTeXSyn.CreateHighlighterAttributes(Name: string; FriendlyName: UnicodeString; +function TSynTeXSyn.CreateHighlighterAttributes(Name: string; FriendlyName: string; Foreground, Background: TColor; FontStyles: TFontStyles): TSynHighlighterAttributes; begin Result := TSynHighlighterAttributes.Create(Name, FriendlyName); @@ -325,23 +318,20 @@ function TSynTeXSyn.CreateHighlighterAttributes(Name: string; FriendlyName: Unic Result.Style := FontStyles; end; -function TSynTeXSyn.GetSampleSource: UnicodeString; +function TSynTeXSyn.GetSampleSource: string; begin - Result := - '\documentclass[a4paper]{article}'+#13#10+ - '% LaTeX sample source'+#13#10+ - '\begin{document}'+#13#10+ - 'Here is a formula: $ (2x + 3)*5y $'+#13#10+ - '\end{document}'; + Result:='\documentclass[a4paper]{article}'+#13#10+ + '% LaTeX sample source'+#13#10+ + '\begin{document}'+#13#10+ + 'Here is a formula: $ (2x + 3)*5y $'+#13#10+ + '\end{document}'; end; -class function TSynTeXSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynTeXSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangTeX; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynTeXSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterUNIXShellScript.pas b/Ext/SynEdit/Source/SynHighlighterUNIXShellScript.pas index c67f8c0..c2ed811 100644 --- a/Ext/SynEdit/Source/SynHighlighterUNIXShellScript.pas +++ b/Ext/SynEdit/Source/SynHighlighterUNIXShellScript.pas @@ -1,4 +1,4 @@ -{------------------------------------------------------------------------------- +{------------------------------------------------------------------------------- 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 @@ -12,7 +12,7 @@ The Initial Author of this file is Stefan Ascher. Portions by Jan Verhoeven (http://jansfreeware.com/jfdelphi.htm) "Heredoc" syntax highlighting implementation by Marko Njezic. -Unicode translation by Maël Hörz. +Unicode translation by Maël Hörz. All Rights Reserved. Contributors to the SynEdit and mwEdit projects are listed in the @@ -27,13 +27,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterUNIXShellScript.pas,v 1.7.2.11 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a UNIX Shell Script highlighter for SynEdit) @@ -76,21 +69,21 @@ interface type TSynUNIXShellScriptSyn = class(TSynCustomHighlighter) private - FRange: TRangeState; + fRange: TRangeState; {$IFDEF SYN_HEREDOC} - FHeredocLength: Byte; - FHeredocChecksum: Word; + fHeredocLength: Byte; + fHeredocChecksum: Word; {$ENDIF} FTokenID: TtkTokenKind; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FSecondKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FCommentAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FVarAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fSecondKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fCommentAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fVarAttri: TSynHighlighterAttributes; procedure BraceOpenProc; procedure PointCommaProc; procedure CRProc; @@ -111,12 +104,12 @@ TSynUNIXShellScriptSyn = class(TSynCustomHighlighter) procedure HeredocProc; {$ENDIF} protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; procedure NextProcedure; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -125,31 +118,31 @@ TSynUNIXShellScriptSyn = class(TSynCustomHighlighter) function GetEol: Boolean; override; function GetRange: Pointer; override; function GetTokenID: TtkTokenKind; - function IsKeyword(const AKeyword: UnicodeString): Boolean; override; - function IsSecondKeyWord(AToken: UnicodeString): Boolean; + function IsKeyword(const AKeyword: string): Boolean; override; + function IsSecondKeyWord(AToken: string): Boolean; function GetTokenAttribute: TSynHighlighterAttributes; override; function GetTokenKind: Integer; override; procedure Next; override; procedure SetRange(Value: Pointer); override; procedure ResetRange; override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property SecondKeyAttri: TSynHighlighterAttributes read FSecondKeyAttri - write FSecondKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; - property VarAttri: TSynHighlighterAttributes read FVarAttri - write FVarAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property SecondKeyAttri: TSynHighlighterAttributes read fSecondKeyAttri + write fSecondKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; + property VarAttri: TSynHighlighterAttributes read fVarAttri + write fVarAttri; end; implementation @@ -159,7 +152,7 @@ implementation SynEditStrConst; const - ShellScriptKeys: array[0..109] of UnicodeString = ( + ShellScriptKeys: array[0..109] of string = ( 'awk', 'banner', 'basename', 'bdiff', 'bg', 'break', 'case', 'cat', 'cc', 'cd', 'chdir', 'chgrp', 'chmod', 'chown', 'clear', 'compress', 'continue', 'cp', 'cpio', 'cut', 'date', 'dd', 'df', 'diff', 'do', 'done', 'dtpad', @@ -174,27 +167,27 @@ implementation 'uuencode', 'vi', 'wait', 'wc', 'while', 'who', 'xtern', 'zcat', 'zip' ); - ShellScriptSecondKeys: array[0..22] of UnicodeString = ( + ShellScriptSecondKeys: array[0..22] of string = ( 'cdpath', 'editor', 'home', 'ifs', 'lang', 'lc_messages', 'lc_type', 'ld_library_path', 'logname', 'mail', 'mailcheck', 'mailpath', 'manpath', 'path', 'ps1', 'ps2', 'pwd', 'shacct', 'shell', 'shlib_path', 'term', 'termcap', 'tz' ); -function TSynUNIXShellScriptSyn.IsKeyword(const AKeyword: UnicodeString): Boolean; +function TSynUNIXShellScriptSyn.IsKeyword(const AKeyword: string): Boolean; var First, Last, I, Compare: Integer; - Token: UnicodeString; + Token: string; begin First := 0; Last := High(ShellScriptKeys); Result := False; - Token := SynWideLowerCase(AKeyword); + Token := SysUtils.AnsiLowerCase(AKeyword); while First <= Last do begin I := (First + Last) shr 1; - Compare := WideCompareStr(ShellScriptKeys[I], Token); + Compare := CompareStr(ShellScriptKeys[I], Token); if Compare = 0 then begin Result := True; @@ -205,19 +198,19 @@ function TSynUNIXShellScriptSyn.IsKeyword(const AKeyword: UnicodeString): Boolea end; end; { IsKeyWord } -function TSynUNIXShellScriptSyn.IsSecondKeyWord(AToken: UnicodeString): Boolean; +function TSynUNIXShellScriptSyn.IsSecondKeyWord(AToken: string): Boolean; var First, Last, I, Compare: Integer; - Token: UnicodeString; + Token: string; begin First := 0; Last := High(ShellScriptSecondKeys); Result := False; - Token := SynWideLowerCase(AToken); + Token := SysUtils.AnsiLowerCase(AToken); while First <= Last do begin I := (First + Last) shr 1; - Compare := WideCompareStr(ShellScriptSecondKeys[i], Token); + Compare := CompareStr(ShellScriptSecondKeys[i], Token); if Compare = 0 then begin Result := True; @@ -231,36 +224,36 @@ function TSynUNIXShellScriptSyn.IsSecondKeyWord(AToken: UnicodeString): Boolean; constructor TSynUNIXShellScriptSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := False; - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Foreground := clGreen; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Foreground := clNavy; - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); - FSecondKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); - AddAttribute(FSecondKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - FNumberAttri.Foreground := clBlue; - AddAttribute(FNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - FStringAttri.Foreground := clMaroon; - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - FSymbolAttri.Foreground := clRed; - AddAttribute(FSymbolAttri); - FVarAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); - FVarAttri.Foreground := clPurple; - AddAttribute(FVarAttri); + fCaseSensitive := False; + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Foreground := clGreen; + AddAttribute(fCommentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Foreground := clNavy; + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); + fSecondKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); + AddAttribute(fSecondKeyAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + fNumberAttri.Foreground := clBlue; + AddAttribute(fNumberAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + fStringAttri.Foreground := clMaroon; + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + fSymbolAttri.Foreground := clRed; + AddAttribute(fSymbolAttri); + fVarAttri := TSynHighlighterAttributes.Create(SYNS_AttrVariable, SYNS_FriendlyAttrVariable); + fVarAttri.Foreground := clPurple; + AddAttribute(fVarAttri); SetAttributesOnChange(DefHighlightChange); - FRange := rsUnknown; - FDefaultFilter := SYNS_FilterUNIXShellScript; + fRange := rsUnknown; + fDefaultFilter := SYNS_FilterUNIXShellScript; end; { Create } destructor TSynUNIXShellScriptSyn.Destroy; @@ -273,7 +266,7 @@ procedure TSynUNIXShellScriptSyn.DollarProc; cc: WideChar; begin Inc(Run); - FTokenID := tkVariable; + fTokenID := tkVariable; if IsLineEnd(Run) then Exit; cc := FLine[Run]; Inc(Run); @@ -297,45 +290,45 @@ procedure TSynUNIXShellScriptSyn.DotProc; function TestDot: Boolean; var - i: Integer; + I: Integer; begin Result := False; - i := Run; - Inc(i); - while CharInSet(FLine[i], ['a'..'z', 'A'..'Z']) do - Inc(i); - if i > (Run + 1) then + I := Run; + Inc(I); + while CharInSet(FLine[I], ['a'..'z', 'A'..'Z']) do + Inc(I); + if I > (Run + 1) then Result := True; if Result then - Run := i; + Run := I; end; begin // Don't highlight filenames like filename.zip if TestDot then - FTokenID := tkIdentifier + fTokenID := tkIdentifier else begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; procedure TSynUNIXShellScriptSyn.BraceOpenProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynUNIXShellScriptSyn.PointCommaProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynUNIXShellScriptSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; case FLine[Run + 1] of #10: Inc(Run, 2); else Inc(Run); @@ -344,26 +337,26 @@ procedure TSynUNIXShellScriptSyn.CRProc; procedure TSynUNIXShellScriptSyn.IdentProc; begin - while IsIdentChar(FLine[Run]) do Inc(Run); + while IsIdentChar(fLine[Run]) do Inc(Run); if IsKeyWord(GetToken) then begin - FTokenID := tkKey; + fTokenId := tkKey; Exit; end else - FTokenID := tkIdentifier; + fTokenId := tkIdentifier; if IsSecondKeyWord(GetToken) then - FTokenID := tkSecondKey + fTokenId := tkSecondKey else if fLine[Run] = '=' then FTokenID := tkVariable else - FTokenID := tkIdentifier; + fTokenId := tkIdentifier; end; procedure TSynUNIXShellScriptSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; @@ -391,7 +384,7 @@ procedure TSynUNIXShellScriptSyn.LowerProc; {$IFDEF SYN_HEREDOC} if FLine[Run + 1] = '<' then begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; SkipRun := 0; QuoteChar := #0; @@ -421,25 +414,25 @@ procedure TSynUNIXShellScriptSyn.LowerProc; if Len > 255 then begin - FTokenID := tkUnknown; + fTokenID := tkUnknown; Exit; end; if (QuoteChar <> #0) and (FLine[Run + SkipRun + Len] <> QuoteChar) then begin - FTokenID := tkUnknown; + fTokenID := tkUnknown; Exit; end; if IndentedHeredoc then - FRange := rsIndentedHeredoc + fRange := rsIndentedHeredoc else - FRange := rsHeredoc; - FHeredocLength := Len; - FHeredocChecksum := CalcFCS(FLine[Run + SkipRun], Len); + fRange := rsHeredoc; + fHeredocLength := Len; + fHeredocChecksum := CalcFCS(FLine[Run + SkipRun], Len); Inc(Run, SkipRun + Len); - FTokenID := tkString; + fTokenID := tkString; end else Inc(Run, 2); @@ -448,13 +441,13 @@ procedure TSynUNIXShellScriptSyn.LowerProc; {$ENDIF} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; procedure TSynUNIXShellScriptSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -472,7 +465,7 @@ procedure TSynUNIXShellScriptSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of @@ -486,7 +479,7 @@ procedure TSynUNIXShellScriptSyn.NumberProc; procedure TSynUNIXShellScriptSyn.RoundOpenProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenId := tkSymbol; end; procedure TSynUNIXShellScriptSyn.SlashProc; @@ -495,7 +488,7 @@ procedure TSynUNIXShellScriptSyn.SlashProc; begin // Perl Styled Comment Inc(Run); - FTokenID := tkComment; + fTokenID := tkComment; while not IsLineEnd(Run) do begin Inc(Run); @@ -504,14 +497,14 @@ procedure TSynUNIXShellScriptSyn.SlashProc; else begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; procedure TSynUNIXShellScriptSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; @@ -521,7 +514,7 @@ procedure TSynUNIXShellScriptSyn.StringProc; begin // Single and Double Quotes. - FTokenID := tkString; + fTokenID := tkString; QuoteChar := FLine[Run]; // either " or ' if (FLine[Run + 1] = QuoteChar) and (FLine[Run + 2] = QuoteChar) then Inc(Run, 2); @@ -535,7 +528,7 @@ procedure TSynUNIXShellScriptSyn.StringProc; procedure TSynUNIXShellScriptSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; {$IFDEF SYN_HEREDOC} @@ -557,23 +550,23 @@ procedure TSynUNIXShellScriptSyn.HeredocProc; var i: Integer; begin - if IsLineEnd(Run) and (FTokenPos = Run) then + if IsLineEnd(Run) and (fTokenPos = Run) then begin NextProcedure; Exit; end; - FTokenID := tkString; + fTokenID := tkString; - if FRange = rsIndentedHeredoc then - while FLine[Run] in [WideChar(#9), WideChar(#32)] do Inc(Run); + if fRange = rsIndentedHeredoc then + while FLine[Run] in [#$0009, #$0020] do Inc(Run); - if ((Run = 0) and (FRange = rsHeredoc)) or (FRange = rsIndentedHeredoc) then + if ((Run = 0) and (fRange = rsHeredoc)) or (fRange = rsIndentedHeredoc) then begin i := 0; while not IsLineEnd(FLine[Run + i]) do begin - if i > FHeredocLength then + if i > fHeredocLength then begin SkipToEOL; Exit; @@ -581,15 +574,15 @@ procedure TSynUNIXShellScriptSyn.HeredocProc; Inc(i); end; - if i <> FHeredocLength then + if i <> fHeredocLength then begin SkipToEOL; Exit; end; - if (CalcFCS(FLine[Run], i) = FHeredocChecksum) then + if (CalcFCS(FLine[Run], i) = fHeredocChecksum) then begin - FRange := rsUnknown; + fRange := rsUnknown; Run := Run + i; Exit; end; @@ -601,9 +594,9 @@ procedure TSynUNIXShellScriptSyn.HeredocProc; procedure TSynUNIXShellScriptSyn.Next; begin - FTokenPos := Run; + fTokenPos := Run; {$IFDEF SYN_HEREDOC} - if FRange in [rsHeredoc, rsIndentedHeredoc] then + if fRange in [rsHeredoc, rsIndentedHeredoc] then HeredocProc else {$ENDIF} @@ -637,12 +630,12 @@ procedure TSynUNIXShellScriptSyn.NextProcedure; function TSynUNIXShellScriptSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -650,7 +643,7 @@ function TSynUNIXShellScriptSyn.GetDefaultAttribute(Index: Integer): TSynHighlig function TSynUNIXShellScriptSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynUNIXShellScriptSyn.GetRange: Pointer; @@ -660,38 +653,38 @@ function TSynUNIXShellScriptSyn.GetRange: Pointer; {$ENDIF} begin {$IFDEF SYN_HEREDOC} - RangePointer.Range := Ord(FRange); + RangePointer.Range := Ord(fRange); RangePointer.Length := 0; RangePointer.Checksum := 0; - if FRange in [rsHeredoc, rsIndentedHeredoc] then + if fRange in [rsHeredoc, rsIndentedHeredoc] then begin - RangePointer.Length := FHeredocLength; - RangePointer.Checksum := FHeredocChecksum; + RangePointer.Length := fHeredocLength; + RangePointer.Checksum := fHeredocChecksum; end; Result := RangePointer.Ptr; {$ELSE} - Result := Pointer(FRange); + Result := Pointer(fRange); {$ENDIF} end; function TSynUNIXShellScriptSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynUNIXShellScriptSyn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkSecondKey: Result := FSecondKeyAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkVariable: Result := FVarAttri; - tkUnknown: Result := FSymbolAttri; + case fTokenID of + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkSecondKey: Result := fSecondKeyAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkVariable: Result := fVarAttri; + tkUnknown: Result := fSymbolAttri; else Result := nil; end; @@ -699,42 +692,42 @@ function TSynUNIXShellScriptSyn.GetTokenAttribute: TSynHighlighterAttributes; function TSynUNIXShellScriptSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; procedure TSynUNIXShellScriptSyn.ResetRange; begin - FRange := rsUnknown; + fRange := rsUnknown; {$IFDEF SYN_HEREDOC} - FHeredocLength := 0; - FHeredocChecksum := 0; + fHeredocLength := 0; + fHeredocChecksum := 0; {$ENDIF} end; procedure TSynUNIXShellScriptSyn.SetRange(Value: Pointer); {$IFDEF SYN_HEREDOC} var - RangePointer : TRangePointer; + RangePointer: TRangePointer; {$ENDIF} begin {$IFDEF SYN_HEREDOC} RangePointer := TRangePointer(Value); - FRange := TRangeState(RangePointer.Range); - FHeredocLength := 0; - FHeredocChecksum := 0; - if FRange in [rsHeredoc, rsIndentedHeredoc] then + fRange := TRangeState(RangePointer.Range); + fHeredocLength := 0; + fHeredocChecksum := 0; + if fRange in [rsHeredoc, rsIndentedHeredoc] then begin - FHeredocLength := RangePointer.Length; - FHeredocChecksum := RangePointer.Checksum; + fHeredocLength := RangePointer.Length; + fHeredocChecksum := RangePointer.Checksum; end; {$ELSE} - FRange := TRangeState(Value); + fRange := TRangeState(Value); {$ENDIF} end; function TSynUNIXShellScriptSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterUNIXShellScript; + Result := fDefaultFilter <> SYNS_FilterUNIXShellScript; end; class function TSynUNIXShellScriptSyn.GetLanguageName: string; @@ -742,7 +735,7 @@ class function TSynUNIXShellScriptSyn.GetLanguageName: string; Result := SYNS_LangNameUNIXShellScript; end; -function TSynUNIXShellScriptSyn.GetSampleSource: UnicodeString; +function TSynUNIXShellScriptSyn.GetSampleSource: string; begin Result := '######################################'#13#10 + '# Here is a comment about some stuff #'#13#10 + @@ -761,7 +754,7 @@ function TSynUNIXShellScriptSyn.GetSampleSource: UnicodeString; 'esac'; end; -class function TSynUNIXShellScriptSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynUNIXShellScriptSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangNameUNIXShellScript; end; @@ -769,11 +762,9 @@ class function TSynUNIXShellScriptSyn.GetFriendlyLanguageName: UnicodeString; procedure TSynUNIXShellScriptSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynUNIXShellScriptSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterURI.pas b/Ext/SynEdit/Source/SynHighlighterURI.pas index f6244b9..b0d5ec9 100644 --- a/Ext/SynEdit/Source/SynHighlighterURI.pas +++ b/Ext/SynEdit/Source/SynHighlighterURI.pas @@ -25,11 +25,6 @@ If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: SynHighlighterURI.pas,v 1.16.2.9 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of SynEdit from the SynEdit home page, -located at http://SynEdit.SourceForge.net - -------------------------------------------------------------------------------} { @abstract(Provides an URI syntax highlighter for SynEdit) @@ -73,6 +68,7 @@ interface uses + Windows, Graphics, SynEditTypes, SynEditHighlighter, @@ -88,18 +84,18 @@ interface PIdentFuncTableFunc = ^TIdentFuncTableFunc; TIdentFuncTableFunc = function (Key: Integer): TtkTokenKind of object; - TAlreadyVisitedURIFunc = function (URI: UnicodeString): Boolean of object; + TAlreadyVisitedURIFunc = function (URI: string): Boolean of object; TSynURISyn = class(TSynCustomHighlighter) private - FMayBeProtocol: PWideChar; - FTokenID: TtkTokenKind; - FIdentFuncTable: array[0..15] of TIdentFuncTableFunc; - FIdentifierAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FURIAttri: TSynHighlighterAttributes; - FVisitedURIAttri: TSynHighlighterAttributes; - FAlreadyVisitedURI: TAlreadyVisitedURIFunc; + fMayBeProtocol: PWideChar; + fTokenID: TtkTokenKind; + fIdentFuncTable: array[0..15] of TIdentFuncTableFunc; + fIdentifierAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fURIAttri: TSynHighlighterAttributes; + fVisitedURIAttri: TSynHighlighterAttributes; + fAlreadyVisitedURI: TAlreadyVisitedURIFunc; function HashKey(Str: PWideChar): Integer; procedure InitIdent; @@ -140,13 +136,13 @@ TSynURISyn = class(TSynCustomHighlighter) procedure SetURIAttri(const Value: TSynHighlighterAttributes); procedure SetVisitedURIAttri(const Value: TSynHighlighterAttributes); protected - function GetSampleSource: UnicodeString; override; - function IsCurrentToken(const Token: UnicodeString): Boolean; override; + function GetSampleSource: string; override; + function IsCurrentToken(const Token: string): Boolean; override; function IsFilterStored: Boolean; override; procedure SetAlreadyVisitedURIFunc(Value: TAlreadyVisitedURIFunc); public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -159,8 +155,8 @@ TSynURISyn = class(TSynCustomHighlighter) function IsIdentChar(AChar: WideChar): Boolean; override; procedure Next; override; published - property URIAttri: TSynHighlighterAttributes read FURIAttri write SetURIAttri; - property VisitedURIAttri: TSynHighlighterAttributes read FVisitedURIAttri + property URIAttri: TSynHighlighterAttributes read fURIAttri write SetURIAttri; + property VisitedURIAttri: TSynHighlighterAttributes read fVisitedURIAttri write SetVisitedURIAttri; end; @@ -174,7 +170,7 @@ implementation SynEditStrConst; const - KeyWords: array[0..15] of UnicodeString = ( + KeyWords: array[0..15] of string = ( '', 'http://', '', 'https://', 'news:', 'gopher://', '', 'prospero://', 'news://', 'www', 'nntp://', 'ftp://', 'wais://', '', 'telnet://', 'mailto:' ); @@ -206,42 +202,42 @@ function TSynURISyn.HashKey(Str: PWideChar): Integer; Inc(Str); end; - FStringLen := Str - FMayBeProtocol; + fStringLen := Str - fMayBeProtocol; end; procedure TSynURISyn.InitIdent; var - i: Integer; + I: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - FIdentFuncTable[i] := AltFunc; + for I := Low(fIdentFuncTable) to High(fIdentFuncTable) do + fIdentFuncTable[I] := AltFunc; - FIdentFuncTable[11] := FuncFtp; - FIdentFuncTable[5] := FuncGopher; - FIdentFuncTable[1] := FuncHttp; - FIdentFuncTable[3] := FuncHttps; - FIdentFuncTable[15] := FuncMailto; - FIdentFuncTable[4] := FuncNews; - FIdentFuncTable[8] := FuncNews; - FIdentFuncTable[10] := FuncNntp; - FIdentFuncTable[7] := FuncProspero; - FIdentFuncTable[14] := FuncTelnet; - FIdentFuncTable[12] := FuncWais; - FIdentFuncTable[9] := FuncWeb; -end; - -function TSynURISyn.IsCurrentToken(const Token: UnicodeString): Boolean; + fIdentFuncTable[11] := FuncFtp; + fIdentFuncTable[5] := FuncGopher; + fIdentFuncTable[1] := FuncHttp; + fIdentFuncTable[3] := FuncHttps; + fIdentFuncTable[15] := FuncMailto; + fIdentFuncTable[4] := FuncNews; + fIdentFuncTable[8] := FuncNews; + fIdentFuncTable[10] := FuncNntp; + fIdentFuncTable[7] := FuncProspero; + fIdentFuncTable[14] := FuncTelnet; + fIdentFuncTable[12] := FuncWais; + fIdentFuncTable[9] := FuncWeb; +end; + +function TSynURISyn.IsCurrentToken(const Token: string): Boolean; var I: Integer; Temp: PWideChar; begin - Temp := FMayBeProtocol; - if Length(Token) = FStringLen then + Temp := fMayBeProtocol; + if Length(Token) = fStringLen then begin Result := True; - for i := 1 to FStringLen do + for I := 1 to fStringLen do begin - if Temp^ <> Token[i] then + if Temp^ <> Token[I] then begin Result := False; Break; @@ -261,76 +257,76 @@ function TSynURISyn.AltFunc(Key: Integer): TtkTokenKind; constructor TSynURISyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := False; + fCaseSensitive := False; - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - FURIAttri := TSynHighlighterAttributes.Create(SYNS_AttrURI, SYNS_FriendlyAttrURI); - FURIAttri.Foreground := clBlue; - FURIAttri.Style := [fsUnderline]; - AddAttribute(FURIAttri); + fURIAttri := TSynHighlighterAttributes.Create(SYNS_AttrURI, SYNS_FriendlyAttrURI); + fURIAttri.Foreground := clBlue; + fURIAttri.Style := [fsUnderline]; + AddAttribute(fURIAttri); - FVisitedURIAttri := TSynHighlighterAttributes.Create(SYNS_AttrVisitedURI, SYNS_FriendlyAttrVisitedURI); - FVisitedURIAttri.Foreground := clPurple; - FVisitedURIAttri.Style := [fsUnderline]; - AddAttribute(FVisitedURIAttri); + fVisitedURIAttri := TSynHighlighterAttributes.Create(SYNS_AttrVisitedURI, SYNS_FriendlyAttrVisitedURI); + fVisitedURIAttri.Foreground := clPurple; + fVisitedURIAttri.Style := [fsUnderline]; + AddAttribute(fVisitedURIAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FDefaultFilter := SYNS_FilterURI; + fDefaultFilter := SYNS_FilterURI; end; destructor TSynURISyn.Destroy; begin inherited; //the other attributes are automatically freed because of AddAttribute() - FSpaceAttri.Free; - FIdentifierAttri.Free; + fSpaceAttri.Free; + fIdentifierAttri.Free; end; procedure TSynURISyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then + if fLine[Run] = #10 then Inc(Run); end; procedure TSynURISyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynURISyn.NullProc; begin - if Run < FLineLen + 1 then + if Run < fLineLen + 1 then begin Inc(Run); - FTokenID := tkNullChar; + fTokenID := tkNullChar; end else - FTokenID := tkNull + fTokenID := tkNull end; procedure TSynURISyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynURISyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynURISyn.Next; begin - FTokenPos := Run; - case FLine[Run] of + fTokenPos := Run; + case fLine[Run] of #13: CRProc; #10: LFProc; #0: NullProc; @@ -345,10 +341,10 @@ procedure TSynURISyn.Next; function TSynURISyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_URI: Result := FURIAttri; - SYN_ATTR_VISITEDURI: Result := FVisitedURIAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_URI: Result := fURIAttri; + SYN_ATTR_VISITEDURI: Result := fVisitedURIAttri; else Result := nil; end; @@ -356,7 +352,7 @@ function TSynURISyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribut function TSynURISyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynURISyn.GetTokenAttribute: TSynHighlighterAttributes; @@ -364,7 +360,7 @@ function TSynURISyn.GetTokenAttribute: TSynHighlighterAttributes; Visited: Boolean; begin case GetTokenID of - tkSpace: Result := FSpaceAttri; + tkSpace: Result := fSpaceAttri; tkFtpLink, tkGopherLink, tkHttpLink, tkHttpsLink, tkMailtoLink, tkNewsLink, tkNntpLink, tkProsperoLink, tkTelnetLink, tkWaisLink, tkWebLink: begin @@ -372,23 +368,23 @@ function TSynURISyn.GetTokenAttribute: TSynHighlighterAttributes; if Assigned(FAlreadyVisitedURI) then Visited := FAlreadyVisitedURI(GetToken); if Visited then - Result := FVisitedURIAttri + Result := fVisitedURIAttri else - Result := FURIAttri; + Result := fURIAttri; end; - tkUnknown: Result := FIdentifierAttri; + tkUnknown: Result := fIdentifierAttri; else Result := nil; end; end; function TSynURISyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynURISyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; class function TSynURISyn.GetLanguageName: string; @@ -396,7 +392,7 @@ class function TSynURISyn.GetLanguageName: string; Result := SYNS_LangURI; end; -function TSynURISyn.GetSampleSource: UnicodeString; +function TSynURISyn.GetSampleSource: string; begin Result := 'Universal Resource Identifier highlighting'#13#10#13#10 + 'http://www.somewhere.org'#13#10 + @@ -409,12 +405,12 @@ function TSynURISyn.GetSampleSource: UnicodeString; function TSynURISyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterURI; + Result := fDefaultFilter <> SYNS_FilterURI; end; function TSynURISyn.IsIdentChar(AChar: WideChar): Boolean; begin - Result := SynIsCharAlphaNumeric(AChar); + Result := IsCharAlphaNumeric(AChar); end; procedure TSynURISyn.SetAlreadyVisitedURIFunc(Value: TAlreadyVisitedURIFunc); @@ -424,12 +420,12 @@ procedure TSynURISyn.SetAlreadyVisitedURIFunc(Value: TAlreadyVisitedURIFunc); procedure TSynURISyn.SetURIAttri(const Value: TSynHighlighterAttributes); begin - FURIAttri.Assign(Value); + fURIAttri.Assign(Value); end; procedure TSynURISyn.SetVisitedURIAttri(const Value: TSynHighlighterAttributes); begin - FVisitedURIAttri.Assign(Value); + fVisitedURIAttri.Assign(Value); end; procedure TSynURISyn.ProtocolProc; @@ -437,17 +433,17 @@ procedure TSynURISyn.ProtocolProc; Key: Integer; begin if IsValidEmailAddress then - FTokenID := tkMailtoLink + fTokenID := tkMailtoLink else begin - FMayBeProtocol := FLine + Run; - Key := HashKey(FMayBeProtocol); - Inc(Run, FStringLen); + fMayBeProtocol := fLine + Run; + Key := HashKey(fMayBeProtocol); + Inc(Run, fStringLen); if Key <= 15 then - FTokenID := FIdentFuncTable[Key](Key) + fTokenID := fIdentFuncTable[Key](Key) else - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; end; @@ -542,7 +538,7 @@ function TSynURISyn.FuncWeb(Key: Integer): TtkTokenKind; function TSynURISyn.IsAlphaNum(AChar: WideChar): Boolean; begin - Result := SynIsCharAlphaNumeric(AChar); + Result := IsCharAlphaNumeric(AChar); end; function TSynURISyn.IsMark(AChar: WideChar): Boolean; @@ -604,11 +600,11 @@ function TSynURISyn.IsValidEmailAddress: Boolean; AtPos := -1; DotPos := -1; - while IsEMailAddressChar(FLine[Run]) do + while IsEMailAddressChar(fLine[Run]) do begin - if FLine[Run] = '@' then + if fLine[Run] = '@' then AtPos := Run - else if FLine[Run] = '.' then + else if fLine[Run] = '.' then // reject array of dots: "neighbour" dots are not allowed if (Run = StartPos) or (DotPos >= 0) and (DotPos = Run - 1) then Break @@ -617,10 +613,10 @@ function TSynURISyn.IsValidEmailAddress: Boolean; Inc(Run); end; - while (Run > StartPos) and (IsNeverAtEMailAddressEnd(FLine[Run - 1])) do + while (Run > StartPos) and (IsNeverAtEMailAddressEnd(fLine[Run - 1])) do Dec(Run); - while (DotPos >= Run) or (DotPos > -1) and (FLine[DotPos] <> '.') do + while (DotPos >= Run) or (DotPos > -1) and (fLine[DotPos] <> '.') do Dec(DotPos); Result := (StartPos < AtPos) and (AtPos < Run - 1) and (DotPos > AtPos + 1); @@ -634,17 +630,17 @@ function TSynURISyn.IsValidURI: Boolean; function IsRelativePath: Boolean; begin Result := (DotPos - 1 >= 0) and - ((FLine[DotPos - 1] = '/') and (FLine[DotPos + 2] = '/')) or - ((FLine[DotPos - 1] = '\') and (FLine[DotPos + 2] = '\')); + ((fLine[DotPos - 1] = '/') and (fLine[DotPos + 2] = '/')) or + ((fLine[DotPos - 1] = '\') and (fLine[DotPos + 2] = '\')); end; begin ProtocolEndPos := Run; DotPos := -1; - while IsURIChar(FLine[Run]) do + while IsURIChar(fLine[Run]) do begin - if FLine[Run] = '.' then + if fLine[Run] = '.' then // reject array of dots: "neighbour" dots are not allowed if (DotPos >= 0) and (DotPos = Run - 1) and not IsRelativePath then Break @@ -653,7 +649,7 @@ function TSynURISyn.IsValidURI: Boolean; Inc(Run); end; - while (Run > ProtocolEndPos) and IsNeverAtEnd(FLine[Run - 1]) do + while (Run > ProtocolEndPos) and IsNeverAtEnd(fLine[Run - 1]) do Dec(Run); Result := Run > ProtocolEndPos; @@ -666,8 +662,8 @@ function TSynURISyn.IsValidWebLink: Boolean; function IsRelativePath: Boolean; begin Result := (DotPos - 1 >= 0) and - ((FLine[DotPos - 1] = '/') and (FLine[DotPos + 2] = '/')) or - ((FLine[DotPos - 1] = '\') and (FLine[DotPos + 2] = '\')); + ((fLine[DotPos - 1] = '/') and (fLine[DotPos + 2] = '/')) or + ((fLine[DotPos - 1] = '\') and (fLine[DotPos + 2] = '\')); end; begin @@ -675,9 +671,9 @@ function TSynURISyn.IsValidWebLink: Boolean; DotPos := -1; SecondDotPos := -1; - while IsURIChar(FLine[Run]) do + while IsURIChar(fLine[Run]) do begin - if FLine[Run] = '.' then + if fLine[Run] = '.' then // reject array of dots: "neighbour" dots are not allowed if (DotPos >= 0) and (DotPos = Run - 1) and not IsRelativePath then Break @@ -690,20 +686,18 @@ function TSynURISyn.IsValidWebLink: Boolean; Inc(Run); end; - while (Run > WWWEndPos) and IsNeverAtEnd(FLine[Run - 1]) do + while (Run > WWWEndPos) and IsNeverAtEnd(fLine[Run - 1]) do Dec(Run); - Result := (Run > WWWEndPos) and (FLine[WWWEndPos] = '.') and + Result := (Run > WWWEndPos) and (fLine[WWWEndPos] = '.') and (SecondDotPos > WWWEndPos + 1) and (SecondDotPos < Run); end; -class function TSynURISyn.GetFriendlyLanguageName: UnicodeString; +class function TSynURISyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangURI; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynURISyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterUnreal.pas b/Ext/SynEdit/Source/SynHighlighterUnreal.pas index d27eca5..11cf77f 100644 --- a/Ext/SynEdit/Source/SynHighlighterUnreal.pas +++ b/Ext/SynEdit/Source/SynHighlighterUnreal.pas @@ -26,13 +26,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterUnreal.pas,v 1.17.2.8 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a Unreal syntax highlighter for SynEdit) @@ -84,30 +77,30 @@ interface xtkSquareOpen, xtkStar, xtkSubtract, xtkSubtractAssign, xtkXor, xtkXorAssign); - TRangeState = (rsANil, rsAnsiC, rsDirective, rsDirectiveComment, rsUnknown); + TRangeState = (rsANil, rsAnsiC, rsDirective, rsDirectiveComment, rsUnKnown); PIdentFuncTableFunc = ^TIdentFuncTableFunc; TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; TSynUnrealSyn = class(TSynCustomHighlighter) private - FRange: TRangeState; + fRange: TRangeState; FRoundCount: Integer; FSquareCount: Integer; FTokenID: TtkTokenKind; FExtTokenID: TxtkTokenKind; - FIdentFuncTable: array[0..732] of TIdentFuncTableFunc; - FCommentAttri: TSynHighlighterAttributes; - FDirecAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FInvalidAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FKey2Attri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FString2Attri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; + fIdentFuncTable: array[0..732] of TIdentFuncTableFunc; + fCommentAttri: TSynHighlighterAttributes; + fDirecAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fInvalidAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fKey2Attri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fString2Attri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; function AltFunc(Index: Integer): TtkTokenKind; function FuncAbstract(Index: Integer): TtkTokenKind; function FuncAlways(Index: Integer): TtkTokenKind; @@ -293,13 +286,13 @@ TSynUnrealSyn = class(TSynCustomHighlighter) procedure UnknownProc; protected function GetExtTokenID: TxtkTokenKind; - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; procedure NextProcedure; public class function GetCapabilities: TSynHighlighterCapabilities; override; class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; @@ -316,26 +309,26 @@ TSynUnrealSyn = class(TSynCustomHighlighter) procedure EnumUserSettings(settings: TStrings); override; property ExtTokenID: TxtkTokenKind read GetExtTokenID; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property DirecAttri: TSynHighlighterAttributes read FDirecAttri - write FDirecAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property InvalidAttri: TSynHighlighterAttributes read FInvalidAttri - write FInvalidAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property Key2Attri: TSynHighlighterAttributes read FKey2Attri write FKey2Attri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SingleStringAttri: TSynHighlighterAttributes read FString2Attri - write FString2Attri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property DirecAttri: TSynHighlighterAttributes read fDirecAttri + write fDirecAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property InvalidAttri: TSynHighlighterAttributes read fInvalidAttri + write fInvalidAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property Key2Attri: TSynHighlighterAttributes read fKey2Attri write fKey2Attri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SingleStringAttri: TSynHighlighterAttributes read fString2Attri + write fString2Attri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; end; implementation @@ -344,7 +337,7 @@ implementation SynEditStrConst; const - KeyWords: array[0..142] of UnicodeString = ( + KeyWords: array[0..142] of string = ( 'abstract', 'always', 'array', 'arraycount', 'assert', 'auto', 'automated', 'bool', 'boundingbox', 'boundingvolume', 'break', 'button', 'byte', 'cache', 'cacheexempt', 'case', 'catch', 'class', 'coerce', 'collapsecategories', @@ -424,7 +417,7 @@ function TSynUnrealSyn.HashKey(Str: PWideChar): Cardinal; Inc(Str); end; Result := Result mod 733; - FStringLen := Str - FToIdent; + fStringLen := Str - fToIdent; end; {$Q+} @@ -432,10 +425,10 @@ function TSynUnrealSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; @@ -444,153 +437,153 @@ procedure TSynUnrealSyn.InitIdent; var i: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; - - FIdentFuncTable[410] := FuncAbstract; - FIdentFuncTable[71] := FuncAlways; - FIdentFuncTable[219] := FuncArray; - FIdentFuncTable[554] := FuncArraycount; - FIdentFuncTable[294] := FuncAssert; - FIdentFuncTable[681] := FuncAuto; - FIdentFuncTable[477] := FuncAutomated; - FIdentFuncTable[364] := FuncBool; - FIdentFuncTable[249] := FuncBoundingbox; - FIdentFuncTable[109] := FuncBoundingvolume; - FIdentFuncTable[675] := FuncBreak; - FIdentFuncTable[544] := FuncButton; - FIdentFuncTable[727] := FuncByte; - FIdentFuncTable[380] := FuncCache; - FIdentFuncTable[499] := FuncCacheexempt; - FIdentFuncTable[160] := FuncCase; - FIdentFuncTable[567] := FuncCatch; - FIdentFuncTable[635] := FuncClass; - FIdentFuncTable[64] := FuncCoerce; - FIdentFuncTable[147] := FuncCollapsecategories; - FIdentFuncTable[245] := FuncColor; - FIdentFuncTable[314] := FuncConfig; - FIdentFuncTable[231] := FuncConst; - FIdentFuncTable[510] := FuncContinue; - FIdentFuncTable[287] := FuncCoords; - FIdentFuncTable[11] := FuncCpptext; - FIdentFuncTable[355] := FuncCross; - FIdentFuncTable[189] := FuncDefault; - FIdentFuncTable[454] := FuncDefaultproperties; - FIdentFuncTable[425] := FuncDelegate; - FIdentFuncTable[70] := FuncDelete; - FIdentFuncTable[458] := FuncDependson; - FIdentFuncTable[696] := FuncDeprecated; - FIdentFuncTable[120] := FuncDo; - FIdentFuncTable[60] := FuncDontcollapsecategories; - FIdentFuncTable[475] := FuncDot; - FIdentFuncTable[49] := FuncEach; - FIdentFuncTable[470] := FuncEdfindable; - FIdentFuncTable[558] := FuncEditconst; - FIdentFuncTable[286] := FuncEditconstarray; - FIdentFuncTable[159] := FuncEditinline; - FIdentFuncTable[596] := FuncEditinlinenew; - FIdentFuncTable[545] := FuncEditinlinenotify; - FIdentFuncTable[614] := FuncEditinlineuse; - FIdentFuncTable[229] := FuncElse; - FIdentFuncTable[448] := FuncEnum; - FIdentFuncTable[569] := FuncEnumcount; - FIdentFuncTable[697] := FuncEvent; - FIdentFuncTable[605] := FuncExec; - FIdentFuncTable[698] := FuncExpands; - FIdentFuncTable[302] := FuncExplicit; - FIdentFuncTable[224] := FuncExport; - FIdentFuncTable[164] := FuncExportstructs; - FIdentFuncTable[491] := FuncExtends; - FIdentFuncTable[292] := FuncFalse; - FIdentFuncTable[662] := FuncFinal; - FIdentFuncTable[498] := FuncFloat; - FIdentFuncTable[706] := FuncFor; - FIdentFuncTable[613] := FuncForeach; - FIdentFuncTable[542] := FuncFunction; - FIdentFuncTable[330] := FuncGlobal; - FIdentFuncTable[176] := FuncGlobalconfig; - FIdentFuncTable[197] := FuncGoto; - FIdentFuncTable[89] := FuncGuid; - FIdentFuncTable[606] := FuncHidecategories; - FIdentFuncTable[278] := FuncHidedropdown; - FIdentFuncTable[618] := FuncHideparent; - FIdentFuncTable[445] := FuncIf; - FIdentFuncTable[344] := FuncIgnores; - FIdentFuncTable[348] := FuncImport; - FIdentFuncTable[342] := FuncInit; - FIdentFuncTable[620] := FuncInput; - FIdentFuncTable[615] := FuncInsert; - FIdentFuncTable[648] := FuncInstanced; - FIdentFuncTable[372] := FuncInt; - FIdentFuncTable[520] := FuncIntrinsic; - FIdentFuncTable[205] := FuncInvariant; - FIdentFuncTable[462] := FuncIterator; - FIdentFuncTable[6] := FuncLatent; - FIdentFuncTable[24] := FuncLength; - FIdentFuncTable[166] := FuncLocal; - FIdentFuncTable[152] := FuncLocalized; - FIdentFuncTable[154] := FuncLong; - FIdentFuncTable[182] := FuncMesh; - FIdentFuncTable[493] := FuncModel; - FIdentFuncTable[336] := FuncMutable; - FIdentFuncTable[611] := FuncName; - FIdentFuncTable[311] := FuncNative; - FIdentFuncTable[526] := FuncNativereplication; - FIdentFuncTable[407] := FuncNew; - FIdentFuncTable[128] := FuncNoexport; - FIdentFuncTable[468] := FuncNone; - FIdentFuncTable[428] := FuncNoteditinlinenew; - FIdentFuncTable[532] := FuncNotplaceable; - FIdentFuncTable[389] := FuncNousercreate; - FIdentFuncTable[548] := FuncOperator; - FIdentFuncTable[265] := FuncOptional; - FIdentFuncTable[485] := FuncOut; - FIdentFuncTable[517] := FuncParseconfig; - FIdentFuncTable[726] := FuncPerobjectconfig; - FIdentFuncTable[401] := FuncPlaceable; - FIdentFuncTable[385] := FuncPlane; - FIdentFuncTable[575] := FuncPointer; - FIdentFuncTable[529] := FuncPostoperator; - FIdentFuncTable[33] := FuncPreoperator; - FIdentFuncTable[103] := FuncPrivate; - FIdentFuncTable[134] := FuncProtected; - FIdentFuncTable[512] := FuncRegister; - FIdentFuncTable[106] := FuncReliable; - FIdentFuncTable[121] := FuncRemove; - FIdentFuncTable[253] := FuncReplication; - FIdentFuncTable[593] := FuncReturn; - FIdentFuncTable[440] := FuncRng; - FIdentFuncTable[178] := FuncRot; - FIdentFuncTable[94] := FuncRotator; - FIdentFuncTable[691] := FuncSafereplace; - FIdentFuncTable[450] := FuncScale; - FIdentFuncTable[119] := FuncScriptconst; - FIdentFuncTable[651] := FuncSelf; - FIdentFuncTable[386] := FuncShowcategories; - FIdentFuncTable[646] := FuncSimulated; - FIdentFuncTable[97] := FuncSingular; - FIdentFuncTable[370] := FuncSkip; - FIdentFuncTable[295] := FuncSound; - FIdentFuncTable[142] := FuncState; - FIdentFuncTable[713] := FuncStatic; - FIdentFuncTable[213] := FuncStop; - FIdentFuncTable[729] := FuncString; - FIdentFuncTable[354] := FuncStruct; - FIdentFuncTable[626] := FuncSuper; - FIdentFuncTable[636] := FuncSwitch; - FIdentFuncTable[345] := FuncTexture; - FIdentFuncTable[453] := FuncTransient; - FIdentFuncTable[192] := FuncTravel; - FIdentFuncTable[714] := FuncTrue; - FIdentFuncTable[108] := FuncUnreliable; - FIdentFuncTable[173] := FuncUntil; - FIdentFuncTable[619] := FuncVar; - FIdentFuncTable[658] := FuncVect; - FIdentFuncTable[543] := FuncVector; - FIdentFuncTable[730] := FuncVoid; - FIdentFuncTable[303] := FuncWhile; - FIdentFuncTable[367] := FuncWithin; + fIdentFuncTable[i] := AltFunc; + + fIdentFuncTable[410] := FuncAbstract; + fIdentFuncTable[71] := FuncAlways; + fIdentFuncTable[219] := FuncArray; + fIdentFuncTable[554] := FuncArraycount; + fIdentFuncTable[294] := FuncAssert; + fIdentFuncTable[681] := FuncAuto; + fIdentFuncTable[477] := FuncAutomated; + fIdentFuncTable[364] := FuncBool; + fIdentFuncTable[249] := FuncBoundingbox; + fIdentFuncTable[109] := FuncBoundingvolume; + fIdentFuncTable[675] := FuncBreak; + fIdentFuncTable[544] := FuncButton; + fIdentFuncTable[727] := FuncByte; + fIdentFuncTable[380] := FuncCache; + fIdentFuncTable[499] := FuncCacheexempt; + fIdentFuncTable[160] := FuncCase; + fIdentFuncTable[567] := FuncCatch; + fIdentFuncTable[635] := FuncClass; + fIdentFuncTable[64] := FuncCoerce; + fIdentFuncTable[147] := FuncCollapsecategories; + fIdentFuncTable[245] := FuncColor; + fIdentFuncTable[314] := FuncConfig; + fIdentFuncTable[231] := FuncConst; + fIdentFuncTable[510] := FuncContinue; + fIdentFuncTable[287] := FuncCoords; + fIdentFuncTable[11] := FuncCpptext; + fIdentFuncTable[355] := FuncCross; + fIdentFuncTable[189] := FuncDefault; + fIdentFuncTable[454] := FuncDefaultproperties; + fIdentFuncTable[425] := FuncDelegate; + fIdentFuncTable[70] := FuncDelete; + fIdentFuncTable[458] := FuncDependson; + fIdentFuncTable[696] := FuncDeprecated; + fIdentFuncTable[120] := FuncDo; + fIdentFuncTable[60] := FuncDontcollapsecategories; + fIdentFuncTable[475] := FuncDot; + fIdentFuncTable[49] := FuncEach; + fIdentFuncTable[470] := FuncEdfindable; + fIdentFuncTable[558] := FuncEditconst; + fIdentFuncTable[286] := FuncEditconstarray; + fIdentFuncTable[159] := FuncEditinline; + fIdentFuncTable[596] := FuncEditinlinenew; + fIdentFuncTable[545] := FuncEditinlinenotify; + fIdentFuncTable[614] := FuncEditinlineuse; + fIdentFuncTable[229] := FuncElse; + fIdentFuncTable[448] := FuncEnum; + fIdentFuncTable[569] := FuncEnumcount; + fIdentFuncTable[697] := FuncEvent; + fIdentFuncTable[605] := FuncExec; + fIdentFuncTable[698] := FuncExpands; + fIdentFuncTable[302] := FuncExplicit; + fIdentFuncTable[224] := FuncExport; + fIdentFuncTable[164] := FuncExportstructs; + fIdentFuncTable[491] := FuncExtends; + fIdentFuncTable[292] := FuncFalse; + fIdentFuncTable[662] := FuncFinal; + fIdentFuncTable[498] := FuncFloat; + fIdentFuncTable[706] := FuncFor; + fIdentFuncTable[613] := FuncForeach; + fIdentFuncTable[542] := FuncFunction; + fIdentFuncTable[330] := FuncGlobal; + fIdentFuncTable[176] := FuncGlobalconfig; + fIdentFuncTable[197] := FuncGoto; + fIdentFuncTable[89] := FuncGuid; + fIdentFuncTable[606] := FuncHidecategories; + fIdentFuncTable[278] := FuncHidedropdown; + fIdentFuncTable[618] := FuncHideparent; + fIdentFuncTable[445] := FuncIf; + fIdentFuncTable[344] := FuncIgnores; + fIdentFuncTable[348] := FuncImport; + fIdentFuncTable[342] := FuncInit; + fIdentFuncTable[620] := FuncInput; + fIdentFuncTable[615] := FuncInsert; + fIdentFuncTable[648] := FuncInstanced; + fIdentFuncTable[372] := FuncInt; + fIdentFuncTable[520] := FuncIntrinsic; + fIdentFuncTable[205] := FuncInvariant; + fIdentFuncTable[462] := FuncIterator; + fIdentFuncTable[6] := FuncLatent; + fIdentFuncTable[24] := FuncLength; + fIdentFuncTable[166] := FuncLocal; + fIdentFuncTable[152] := FuncLocalized; + fIdentFuncTable[154] := FuncLong; + fIdentFuncTable[182] := FuncMesh; + fIdentFuncTable[493] := FuncModel; + fIdentFuncTable[336] := FuncMutable; + fIdentFuncTable[611] := FuncName; + fIdentFuncTable[311] := FuncNative; + fIdentFuncTable[526] := FuncNativereplication; + fIdentFuncTable[407] := FuncNew; + fIdentFuncTable[128] := FuncNoexport; + fIdentFuncTable[468] := FuncNone; + fIdentFuncTable[428] := FuncNoteditinlinenew; + fIdentFuncTable[532] := FuncNotplaceable; + fIdentFuncTable[389] := FuncNousercreate; + fIdentFuncTable[548] := FuncOperator; + fIdentFuncTable[265] := FuncOptional; + fIdentFuncTable[485] := FuncOut; + fIdentFuncTable[517] := FuncParseconfig; + fIdentFuncTable[726] := FuncPerobjectconfig; + fIdentFuncTable[401] := FuncPlaceable; + fIdentFuncTable[385] := FuncPlane; + fIdentFuncTable[575] := FuncPointer; + fIdentFuncTable[529] := FuncPostoperator; + fIdentFuncTable[33] := FuncPreoperator; + fIdentFuncTable[103] := FuncPrivate; + fIdentFuncTable[134] := FuncProtected; + fIdentFuncTable[512] := FuncRegister; + fIdentFuncTable[106] := FuncReliable; + fIdentFuncTable[121] := FuncRemove; + fIdentFuncTable[253] := FuncReplication; + fIdentFuncTable[593] := FuncReturn; + fIdentFuncTable[440] := FuncRng; + fIdentFuncTable[178] := FuncRot; + fIdentFuncTable[94] := FuncRotator; + fIdentFuncTable[691] := FuncSafereplace; + fIdentFuncTable[450] := FuncScale; + fIdentFuncTable[119] := FuncScriptconst; + fIdentFuncTable[651] := FuncSelf; + fIdentFuncTable[386] := FuncShowcategories; + fIdentFuncTable[646] := FuncSimulated; + fIdentFuncTable[97] := FuncSingular; + fIdentFuncTable[370] := FuncSkip; + fIdentFuncTable[295] := FuncSound; + fIdentFuncTable[142] := FuncState; + fIdentFuncTable[713] := FuncStatic; + fIdentFuncTable[213] := FuncStop; + fIdentFuncTable[729] := FuncString; + fIdentFuncTable[354] := FuncStruct; + fIdentFuncTable[626] := FuncSuper; + fIdentFuncTable[636] := FuncSwitch; + fIdentFuncTable[345] := FuncTexture; + fIdentFuncTable[453] := FuncTransient; + fIdentFuncTable[192] := FuncTravel; + fIdentFuncTable[714] := FuncTrue; + fIdentFuncTable[108] := FuncUnreliable; + fIdentFuncTable[173] := FuncUntil; + fIdentFuncTable[619] := FuncVar; + fIdentFuncTable[658] := FuncVect; + fIdentFuncTable[543] := FuncVector; + fIdentFuncTable[730] := FuncVoid; + fIdentFuncTable[303] := FuncWhile; + fIdentFuncTable[367] := FuncWithin; end; function TSynUnrealSyn.AltFunc(Index: Integer): TtkTokenKind; @@ -1748,42 +1741,42 @@ constructor TSynUnrealSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := False; - - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style:= [fsItalic]; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar); - AddAttribute(FInvalidAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style:= [fsBold]; - AddAttribute(FKeyAttri); - FKey2Attri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); - FKey2Attri.Style:= [fsBold]; - AddAttribute(FKey2Attri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FString2Attri := TSynHighlighterAttributes.Create(SYNS_AttrSingleString, SYNS_FriendlyAttrSingleString); - AddAttribute(FString2Attri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); - FDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective); - AddAttribute(FDirecAttri); + fCaseSensitive := False; + + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style:= [fsItalic]; + AddAttribute(fCommentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fInvalidAttri := TSynHighlighterAttributes.Create(SYNS_AttrIllegalChar, SYNS_FriendlyAttrIllegalChar); + AddAttribute(fInvalidAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style:= [fsBold]; + AddAttribute(fKeyAttri); + fKey2Attri := TSynHighlighterAttributes.Create(SYNS_AttrSecondReservedWord, SYNS_FriendlyAttrSecondReservedWord); + fKey2Attri.Style:= [fsBold]; + AddAttribute(fKey2Attri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); + fString2Attri := TSynHighlighterAttributes.Create(SYNS_AttrSingleString, SYNS_FriendlyAttrSingleString); + AddAttribute(fString2Attri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); + fDirecAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective); + AddAttribute(fDirecAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FRange := rsUnknown; - FDefaultFilter := SYNS_FilterCPP; + fRange := rsUnknown; + fDefaultFilter := SYNS_FilterCPP; end; { Create } procedure TSynUnrealSyn.AnsiCProc; begin - FTokenID := tkComment; + fTokenID := tkComment; case FLine[Run] of #0: begin @@ -1805,26 +1798,25 @@ procedure TSynUnrealSyn.AnsiCProc; while not IsLineEnd(Run) do case FLine[Run] of '*': - if FLine[Run + 1] = '/' then + if fLine[Run + 1] = '/' then begin Inc(Run, 2); - if FRange = rsDirectiveComment then - FRange := rsDirective + if fRange = rsDirectiveComment then + fRange := rsDirective else - FRange := rsUnknown; + fRange := rsUnKnown; Break; end else Inc(Run); - #10, #13: - Break; - else - Inc(Run); + #10: Break; + #13: Break; + else Inc(Run); end; end; procedure TSynUnrealSyn.AndSymbolProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; case FLine[Run + 1] of '=': {and assign} begin @@ -1846,7 +1838,7 @@ procedure TSynUnrealSyn.AndSymbolProc; procedure TSynUnrealSyn.AsciiCharProc; begin - FTokenID := tkString2; + fTokenID := tkString2; repeat if IsLineEnd(Run) then Break; if FLine[Run] = #92 then {backslash} @@ -1860,28 +1852,28 @@ procedure TSynUnrealSyn.AsciiCharProc; procedure TSynUnrealSyn.BraceCloseProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenId := tkSymbol; FExtTokenID := xtkBraceClose; end; procedure TSynUnrealSyn.BraceOpenProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenId := tkSymbol; FExtTokenID := xtkBraceOpen; end; procedure TSynUnrealSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run + 1] = #10 then Inc(Run); + if fLine[Run + 1] = #10 then Inc(Run); end; procedure TSynUnrealSyn.ColonProc; begin - FTokenID := tkSymbol; - case FLine[Run + 1] of + fTokenID := tkSymbol; + Case FLine[Run + 1] of ':': {scope resolution operator} begin Inc(Run, 2); @@ -1898,7 +1890,7 @@ procedure TSynUnrealSyn.ColonProc; procedure TSynUnrealSyn.CommaProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkComma; end; @@ -1907,28 +1899,28 @@ procedure TSynUnrealSyn.DirectiveProc; if IsLineEnd(Run) then begin if (Run <= 0) then - FRange := rsUnknown; + fRange := rsUnknown; NextProcedure; end else begin - FTokenID := tkDirective; - while TRUE do - case FLine[Run] of + fTokenID := tkDirective; + while True do + case fLine[Run] of '/': // comment? begin - if FLine[Run + 1] = '/' then // is end of directive as well + if fLine[Run + 1] = '/' then // is end of directive as well Break - else if FLine[Run + 1] = '*' then + else if fLine[Run + 1] = '*' then begin // might be embedded only - FRange := rsDirectiveComment; + fRange := rsDirectiveComment; Break; end else Inc(Run); end; #0, #10, #13: begin - FRange := rsUnknown; + fRange := rsUnknown; Break; end; else Inc(Run); @@ -1938,7 +1930,7 @@ procedure TSynUnrealSyn.DirectiveProc; procedure TSynUnrealSyn.EqualProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; case FLine[Run + 1] of '=': {logical equal} begin @@ -1955,7 +1947,7 @@ procedure TSynUnrealSyn.EqualProc; procedure TSynUnrealSyn.GreaterProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; case FLine[Run + 1] of '=': {greater than or equal to} begin @@ -1985,27 +1977,27 @@ procedure TSynUnrealSyn.GreaterProc; procedure TSynUnrealSyn.QuestionProc; begin - FTokenID := tkSymbol; {conditional} + fTokenID := tkSymbol; {conditional} FExtTokenID := xtkQuestion; Inc(Run); end; procedure TSynUnrealSyn.IdentProc; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do Inc(Run); + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynUnrealSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynUnrealSyn.LowerProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; case FLine[Run + 1] of '=': {less than or equal to} begin @@ -2035,7 +2027,7 @@ procedure TSynUnrealSyn.LowerProc; procedure TSynUnrealSyn.MinusProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; case FLine[Run + 1] of '=': {subtract assign} begin @@ -2062,7 +2054,7 @@ procedure TSynUnrealSyn.MinusProc; procedure TSynUnrealSyn.ModSymbolProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; case FLine[Run + 1] of '=': {mod assign} begin @@ -2079,7 +2071,7 @@ procedure TSynUnrealSyn.ModSymbolProc; procedure TSynUnrealSyn.NotSymbolProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; case FLine[Run + 1] of '=': {not equal} begin @@ -2096,7 +2088,7 @@ procedure TSynUnrealSyn.NotSymbolProc; procedure TSynUnrealSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -2104,7 +2096,7 @@ procedure TSynUnrealSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', 'A'..'F', 'a'..'f', '.', 'u', 'U', 'l', 'L', 'x', 'X': Result := True; else @@ -2114,13 +2106,12 @@ procedure TSynUnrealSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do begin case FLine[Run] of '.': - if FLine[Run + 1] = '.' then - Break; + if FLine[Run + 1] = '.' then Break; end; Inc(Run); end; @@ -2128,7 +2119,7 @@ procedure TSynUnrealSyn.NumberProc; procedure TSynUnrealSyn.OrSymbolProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; case FLine[Run + 1] of '=': {or assign} begin @@ -2150,7 +2141,7 @@ procedure TSynUnrealSyn.OrSymbolProc; procedure TSynUnrealSyn.PlusProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; case FLine[Run + 1] of '=': {add assign} begin @@ -2172,7 +2163,7 @@ procedure TSynUnrealSyn.PlusProc; procedure TSynUnrealSyn.PointProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; if (FLine[Run + 1] = '.') and (FLine[Run + 2] = '.') then begin {ellipse} Inc(Run, 3); @@ -2188,7 +2179,7 @@ procedure TSynUnrealSyn.PointProc; procedure TSynUnrealSyn.RoundCloseProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkRoundClose; Dec(FRoundCount); end; @@ -2204,7 +2195,7 @@ procedure TSynUnrealSyn.RoundOpenProc; procedure TSynUnrealSyn.SemiColonProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkSemiColon; end; @@ -2213,32 +2204,32 @@ procedure TSynUnrealSyn.SlashProc; case FLine[Run + 1] of '/': {c++ style comments} begin - FTokenID := tkComment; + fTokenID := tkComment; Inc(Run, 2); while not IsLineEnd(Run) do Inc(Run); end; '*': {c style comments} begin - FTokenID := tkComment; - if FRange <> rsDirectiveComment then - FRange := rsAnsiC; + fTokenID := tkComment; + if fRange <> rsDirectiveComment then + fRange := rsAnsiC; Inc(Run, 2); while not IsLineEnd(Run) do - case FLine[Run] of + case fLine[Run] of '*': - if FLine[Run + 1] = '/' then + if fLine[Run + 1] = '/' then begin Inc(Run, 2); - if FRange = rsDirectiveComment then - FRange := rsDirective + if fRange = rsDirectiveComment then + fRange := rsDirective else - FRange := rsUnknown; + fRange := rsUnKnown; Break; end else Inc(Run); #10, #13: begin - if FRange = rsDirectiveComment then - FRange := rsAnsiC; + if fRange = rsDirectiveComment then + fRange := rsAnsiC; Break; end; else Inc(Run); @@ -2247,13 +2238,13 @@ procedure TSynUnrealSyn.SlashProc; '=': {divide assign} begin Inc(Run, 2); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkDivideAssign; end; else {divide} begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkDivide; end; end; @@ -2262,14 +2253,14 @@ procedure TSynUnrealSyn.SlashProc; procedure TSynUnrealSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynUnrealSyn.SquareCloseProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkSquareClose; Dec(FSquareCount); end; @@ -2277,14 +2268,14 @@ procedure TSynUnrealSyn.SquareCloseProc; procedure TSynUnrealSyn.SquareOpenProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; FExtTokenID := xtkSquareOpen; Inc(FSquareCount); end; procedure TSynUnrealSyn.StarProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; case FLine[Run + 1] of '=': {multiply assign} begin @@ -2301,11 +2292,10 @@ procedure TSynUnrealSyn.StarProc; procedure TSynUnrealSyn.StringProc; begin - FTokenID := tkString; + fTokenID := tkString; if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2); repeat - if IsLineEnd(Run) then - Break; + if IsLineEnd(Run) then Break; if FLine[Run] = #92 then {backslash} case FLine[Run + 1] of #10: Inc(Run); {line continuation character} @@ -2319,7 +2309,7 @@ procedure TSynUnrealSyn.StringProc; procedure TSynUnrealSyn.DollarSignProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(run); end; @@ -2327,14 +2317,14 @@ procedure TSynUnrealSyn.DollarSignProc; procedure TSynUnrealSyn.TildeProc; begin Inc(Run); {bitwise complement} - FTokenID := tkSymbol; + fTokenId := tkSymbol; FExtTokenID := xtkBitComplement; end; procedure TSynUnrealSyn.XOrSymbolProc; begin - FTokenID := tkSymbol; - case FLine[Run + 1] of + fTokenID := tkSymbol; + Case FLine[Run + 1] of '=': {xor assign} begin Inc(Run, 2); @@ -2351,18 +2341,18 @@ procedure TSynUnrealSyn.XOrSymbolProc; procedure TSynUnrealSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynUnrealSyn.Next; begin - FTokenPos := Run; - case FRange of + fTokenPos := Run; + case fRange of rsAnsiC, rsDirectiveComment: AnsiCProc; rsDirective: DirectiveProc; else begin - FRange := rsUnknown; + fRange := rsUnknown; NextProcedure end; end; @@ -2371,7 +2361,7 @@ procedure TSynUnrealSyn.Next; procedure TSynUnrealSyn.NextProcedure; begin - case FLine[Run] of + case fLine[Run] of '&': AndSymbolProc; #39: AsciiCharProc; '}': BraceCloseProc; @@ -2413,12 +2403,12 @@ procedure TSynUnrealSyn.NextProcedure; function TSynUnrealSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -2426,17 +2416,17 @@ function TSynUnrealSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttri function TSynUnrealSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynUnrealSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; function TSynUnrealSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynUnrealSyn.GetExtTokenID: TxtkTokenKind; @@ -2447,24 +2437,24 @@ function TSynUnrealSyn.GetExtTokenID: TxtkTokenKind; function TSynUnrealSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterCPP; + Result := fDefaultFilter <> SYNS_FilterCPP; end; { IsFilterStored } function TSynUnrealSyn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkComment: Result := FCommentAttri; - tkDirective: Result := FDirecAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkKey2: Result := FKey2Attri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkString2: Result := FString2Attri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FInvalidAttri; + case fTokenID of + tkComment: Result := fCommentAttri; + tkDirective: Result := fDirecAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkKey2: Result := fKey2Attri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkString2: Result := fString2Attri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fInvalidAttri; else Result := nil; end; end; @@ -2476,18 +2466,18 @@ function TSynUnrealSyn.GetTokenKind: Integer; procedure TSynUnrealSyn.ResetRange; begin - FRange:= rsUnknown; + fRange:= rsUnknown; end; procedure TSynUnrealSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; procedure TSynUnrealSyn.EnumUserSettings(settings: TStrings); begin { returns the user settings that exist in the registry } - with TBetterRegistry.Create do + with TRegistry.Create do begin try RootKey := HKEY_LOCAL_MACHINE; @@ -2510,7 +2500,7 @@ function TSynUnrealSyn.UseUserSettings(settingIndex: Integer): Boolean; // index into TStrings returned by EnumUserSettings // Possible return values: // true : settings were read and used -// False: problem reading settings or invalid version specified - old settings +// false: problem reading settings or invalid version specified - old settings // were preserved function ReadCPPBSettings(settingIndex: Integer): Boolean; @@ -2519,12 +2509,12 @@ function TSynUnrealSyn.UseUserSettings(settingIndex: Integer): Boolean; function ReadCPPB1(settingTag: string; attri: TSynHighlighterAttributes; name: string): Boolean; var - i: Integer; + I: Integer; begin - for i := 1 to Length(name) do - if name[i] = ' ' then name[i] := '_'; + for I := 1 to Length(name) do + if name[I] = ' ' then name[I] := '_'; Result := attri.LoadFromBorlandRegistry(HKEY_CURRENT_USER, - '\SOFTWARE\Borland\C++Builder\'+settingTag+'\Highlight',name,true); + '\SOFTWARE\Borland\C++Builder\'+settingTag+'\Highlight',name, True); end; { ReadCPPB1 } function ReadCPPB3OrMore(settingTag: string; attri: TSynHighlighterAttributes; key: string): Boolean; @@ -2539,7 +2529,9 @@ function TSynUnrealSyn.UseUserSettings(settingIndex: Integer): Boolean; if (settingTag[1] = '1') then Result := ReadCPPB1(settingTag,attri,key) else Result := ReadCPPB3OrMore(settingTag,attri,key); - except Result := False; end; + except + Result := False; + end; end; { ReadCPPBSetting } var @@ -2558,7 +2550,8 @@ function TSynUnrealSyn.UseUserSettings(settingIndex: Integer): Boolean; sl := TStringList.Create; try EnumUserSettings(sl); - if settingIndex >= sl.Count then Result := False + if settingIndex >= sl.Count then + Result := False else begin tmpStringAttri := TSynHighlighterAttributes.Create('', ''); tmpNumberAttri := TSynHighlighterAttributes.Create('', ''); @@ -2569,36 +2562,36 @@ function TSynUnrealSyn.UseUserSettings(settingIndex: Integer): Boolean; tmpInvalidAttri := TSynHighlighterAttributes.Create('', ''); tmpSpaceAttri := TSynHighlighterAttributes.Create('', ''); tmpDirecAttri := TSynHighlighterAttributes.Create('', ''); - tmpStringAttri .Assign(FStringAttri); - tmpNumberAttri .Assign(FNumberAttri); - tmpKeyAttri .Assign(FKeyAttri); - tmpSymbolAttri .Assign(FSymbolAttri); - tmpCommentAttri .Assign(FCommentAttri); - tmpIdentifierAttri.Assign(FIdentifierAttri); - tmpInvalidAttri .Assign(FInvalidAttri); - tmpSpaceAttri .Assign(FSpaceAttri); - tmpDirecAttri .Assign(FDirecAttri); - Result := ReadCPPBSetting(sl[settingIndex],FCommentAttri,'Comment') and - ReadCPPBSetting(sl[settingIndex],FIdentifierAttri,'Identifier') and - ReadCPPBSetting(sl[settingIndex],FInvalidAttri,'Illegal Char') and - ReadCPPBSetting(sl[settingIndex],FKeyAttri,'Reserved word') and - ReadCPPBSetting(sl[settingIndex],FNumberAttri,'Integer') and - ReadCPPBSetting(sl[settingIndex],FSpaceAttri,'Whitespace') and - ReadCPPBSetting(sl[settingIndex],FStringAttri,'String') and - ReadCPPBSetting(sl[settingIndex],FSymbolAttri,'Symbol') and - ReadCPPBSetting(sl[settingIndex],FDirecAttri,'Preprocessor'); + tmpStringAttri .Assign(fStringAttri); + tmpNumberAttri .Assign(fNumberAttri); + tmpKeyAttri .Assign(fKeyAttri); + tmpSymbolAttri .Assign(fSymbolAttri); + tmpCommentAttri .Assign(fCommentAttri); + tmpIdentifierAttri.Assign(fIdentifierAttri); + tmpInvalidAttri .Assign(fInvalidAttri); + tmpSpaceAttri .Assign(fSpaceAttri); + tmpDirecAttri .Assign(fDirecAttri); + Result := ReadCPPBSetting(sl[settingIndex],fCommentAttri,'Comment') and + ReadCPPBSetting(sl[settingIndex],fIdentifierAttri,'Identifier') and + ReadCPPBSetting(sl[settingIndex],fInvalidAttri,'Illegal Char') and + ReadCPPBSetting(sl[settingIndex],fKeyAttri,'Reserved word') and + ReadCPPBSetting(sl[settingIndex],fNumberAttri,'Integer') and + ReadCPPBSetting(sl[settingIndex],fSpaceAttri,'Whitespace') and + ReadCPPBSetting(sl[settingIndex],fStringAttri,'String') and + ReadCPPBSetting(sl[settingIndex],fSymbolAttri,'Symbol') and + ReadCPPBSetting(sl[settingIndex],fDirecAttri,'Preprocessor'); if not Result then begin - FStringAttri .Assign(tmpStringAttri); - FString2Attri .Assign(tmpStringAttri); - FNumberAttri .Assign(tmpNumberAttri); - FKeyAttri .Assign(tmpKeyAttri); - FKey2Attri .Assign(tmpKeyAttri); - FSymbolAttri .Assign(tmpSymbolAttri); - FCommentAttri .Assign(tmpCommentAttri); - FIdentifierAttri.Assign(tmpIdentifierAttri); - FInvalidAttri.Assign(tmpInvalidAttri); - FSpaceAttri .Assign(tmpSpaceAttri); - FDirecAttri .Assign(tmpDirecAttri); + fStringAttri .Assign(tmpStringAttri); + fString2Attri .Assign(tmpStringAttri); + fNumberAttri .Assign(tmpNumberAttri); + fKeyAttri .Assign(tmpKeyAttri); + fKey2Attri .Assign(tmpKeyAttri); + fSymbolAttri .Assign(tmpSymbolAttri); + fCommentAttri .Assign(tmpCommentAttri); + fIdentifierAttri.Assign(tmpIdentifierAttri); + fInvalidAttri.Assign(tmpInvalidAttri); + fSpaceAttri .Assign(tmpSpaceAttri); + fDirecAttri .Assign(tmpDirecAttri); end; tmpStringAttri .Free; tmpNumberAttri .Free; @@ -2629,7 +2622,7 @@ class function TSynUnrealSyn.GetCapabilities: TSynHighlighterCapabilities; Result := inherited GetCapabilities + [hcUserSettings]; end; -function TSynUnrealSyn.GetSampleSource: UnicodeString; +function TSynUnrealSyn.GetSampleSource: string; begin Result := '//----Comment-----------------------------------------------------------'#13#10+ 'class TestObject expands Object native;'#13#10+ @@ -2651,13 +2644,11 @@ function TSynUnrealSyn.GetSampleSource: UnicodeString; '}'; end; -class function TSynUnrealSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynUnrealSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangUnreal; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynUnrealSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterVB.pas b/Ext/SynEdit/Source/SynHighlighterVB.pas index 75d1484..2bc4905 100644 --- a/Ext/SynEdit/Source/SynHighlighterVB.pas +++ b/Ext/SynEdit/Source/SynHighlighterVB.pas @@ -11,7 +11,7 @@ The Original Code is: SynHighlighterVB.pas, released 2000-04-20. The Original Code is based on the wbADSP21xxSyn.pas file from the mwEdit component suite by Martin Waldenburg and other developers, the Initial -Author of this file is Max Horvßth. +Author of this file is Max Horv-th. Unicode translation by Maël Hörz. All Rights Reserved. @@ -27,17 +27,10 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterVB.pas,v 1.14.2.7 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a Visual Basic highlighter for SynEdit) -@author(Max Horvßth , converted to SynEdit by David Muir ) +@author(Max Horv-th , converted to SynEdit by David Muir ) @created(5 December 1999, converted to SynEdit April 21, 2000) @lastmod(2000-06-23) The SynHighlighterVB unit provides SynEdit with a Visual Basic (.bas) highlighter. @@ -50,32 +43,37 @@ interface uses - Windows, Messages, Controls, Graphics, Registry, + System.Classes, + System.SysUtils, + System.Win.Registry, + System.RegularExpressions, + Vcl.Graphics, SynEditHighlighter, SynEditTypes, SynUnicode, - SysUtils, - Classes; + SynEditCodeFolding; type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, - tkString, tkSymbol, tkUnknown); + TtkTokenKind = (tkSymbol, tkKey, tkComment, tkIdentifier, tkNull, tkNumber, tkSpace, + tkString, tkUnknown); PIdentFuncTableFunc = ^TIdentFuncTableFunc; TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; type - TSynVBSyn = class(TSynCustomHighlighter) + TSynVBSyn = class(TSynCustomCodeFoldingHighlighter) private FTokenID: TtkTokenKind; - FIdentFuncTable: array[0..1422] of TIdentFuncTableFunc; - FCommentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; + fIdentFuncTable: array[0..1510] of TIdentFuncTableFunc; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + RE_BlockBegin: TRegEx; + RE_BlockEnd: TRegEx; function AltFunc(Index: Integer): TtkTokenKind; function KeyWordFunc(Index: Integer): TtkTokenKind; function FuncRem(Index: Integer): TtkTokenKind; @@ -96,11 +94,11 @@ TSynVBSyn = class(TSynCustomHighlighter) procedure StringProc; procedure UnknownProc; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; @@ -110,136 +108,149 @@ TSynVBSyn = class(TSynCustomHighlighter) function GetTokenAttribute: TSynHighlighterAttributes; override; function GetTokenKind: Integer; override; procedure Next; override; + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; + procedure AdjustFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings); override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; end; implementation uses + SynEditMiscProcs, SynEditStrConst; const - KeyWords: array[0..213] of UnicodeString = ( - 'abs', 'and', 'appactivate', 'array', 'as', 'asc', 'atn', 'attribute', - 'base', 'beep', 'begin', 'boolean', 'byte', 'call', 'case', 'cbool', - 'cbyte', 'ccur', 'cdate', 'cdbl', 'chdir', 'chdrive', 'chr', 'cint', - 'circle', 'class', 'clear', 'clng', 'close', 'command', 'compare', 'const', - 'cos', 'createobject', 'csng', 'cstr', 'curdir', 'currency', 'cvar', - 'cverr', 'date', 'dateadd', 'datediff', 'datepart', 'dateserial', - 'datevalue', 'ddb', 'deftype', 'dim', 'dir', 'do', 'doevents', 'double', - 'each', 'else', 'elseif', 'empty', 'end', 'environ', 'eof', 'eqv', 'erase', - 'err', 'error', 'exit', 'exp', 'explicit', 'fileattr', 'filecopy', - 'filedatetime', 'filelen', 'fix', 'for', 'form', 'format', 'freefile', - 'function', 'fv', 'get', 'getattr', 'getobject', 'gosub', 'goto', 'hex', - 'hour', 'if', 'iif', 'imp', 'input', 'instr', 'int', 'integer', 'ipmt', - 'irr', 'is', 'isarray', 'isdate', 'isempty', 'iserror', 'ismissing', - 'isnull', 'isnumeric', 'isobject', 'kill', 'lbound', 'lcase', 'left', 'len', - 'let', 'line', 'loc', 'lock', 'lof', 'log', 'long', 'loop', 'lset', 'ltrim', - 'me', 'mid', 'minute', 'mirr', 'mkdir', 'mod', 'module', 'month', 'msgbox', - 'name', 'new', 'next', 'not', 'nothing', 'now', 'nper', 'npv', 'object', - 'oct', 'on', 'open', 'option', 'or', 'pmt', 'ppmt', 'print', 'private', - 'property', 'pset', 'public', 'put', 'pv', 'qbcolor', 'raise', 'randomize', - 'rate', 'redim', 'rem', 'reset', 'resume', 'return', 'rgb', 'right', - 'rmdir', 'rnd', 'rset', 'rtrim', 'second', 'seek', 'select', 'sendkeys', - 'set', 'setattr', 'sgn', 'shell', 'sin', 'single', 'sln', 'space', 'spc', - 'sqr', 'static', 'stop', 'str', 'strcomp', 'strconv', 'string', 'sub', - 'switch', 'syd', 'system', 'tab', 'tan', 'then', 'time', 'timer', - 'timeserial', 'timevalue', 'to', 'trim', 'typename', 'ubound', 'ucase', - 'unlock', 'until', 'val', 'variant', 'vartype', 'version', 'weekday', - 'wend', 'while', 'width', 'with', 'write', 'xor' + {added keywords: catch, try, import} + KeyWords: array[0..225] of string = ( + 'abs', 'and', 'appactivate', 'array', 'as', 'asc', 'atn', 'attribute', + 'base', 'beep', 'begin', 'boolean', 'byref', 'byte', 'byval', 'call', + 'case', 'catch', 'cbool', 'cbyte', 'ccur', 'cdate', 'cdbl', 'cint', + 'circle', 'class', 'clear', 'clng', 'close', 'command', 'compare', 'const', + 'cos', 'createobject', 'csng', 'cstr', 'curdir', 'currency', 'cvar', + 'cverr', 'date', 'dateadd', 'datediff', 'datepart', 'dateserial', + 'datevalue', 'ddb', 'deftype', 'dim', 'dir', 'do', 'doevents', 'double', + 'each', 'else', 'elseif', 'empty', 'end', 'enum', 'environ', 'eof', 'eqv', + 'erase', 'err', 'error', 'exit', 'exp', 'explicit', 'false', 'fileattr', + 'filecopy', 'filedatetime', 'filelen', 'fix', 'for', 'form', 'format', + 'freefile', 'friend', 'function', 'fv', 'get', 'getattr', 'getobject', + 'gosub', 'goto', 'hex', 'hour', 'chdir', 'chdrive', 'chr', 'if', 'iif', + 'imp', 'imports', 'input', 'instr', 'int', 'integer', 'ipmt', 'irr', 'is', + 'isarray', 'isdate', 'isempty', 'iserror', 'ismissing', 'isnull', + 'isnumeric', 'isobject', 'kill', 'lbound', 'lcase', 'left', 'len', 'let', + 'line', 'loc', 'local', 'lock', 'lof', 'log', 'long', 'loop', 'lset', + 'ltrim', 'me', 'mid', 'minute', 'mirr', 'mkdir', 'mod', 'module', 'month', + 'msgbox', 'name', 'new', 'next', 'not', 'nothing', 'now', 'nper', 'npv', + 'object', 'oct', 'on', 'open', 'option', 'or', 'pmt', 'ppmt', 'print', + 'private', 'property', 'pset', 'public', 'put', 'pv', 'qbcolor', 'raise', + 'randomize', 'rate', 'redim', 'rem', 'reset', 'resume', 'return', 'rgb', + 'right', 'rmdir', 'rnd', 'rset', 'rtrim', 'second', 'seek', 'select', + 'sendkeys', 'set', 'setattr', 'sgn', 'shell', 'sin', 'single', 'sln', + 'space', 'spc', 'sqr', 'static', 'step', 'stop', 'str', 'strcomp', + 'strconv', 'string', 'sub', 'switch', 'syd', 'system', 'tab', 'tan', 'then', + 'time', 'timer', 'timeserial', 'timevalue', 'to', 'trim', 'true', 'try', + 'typename', 'typeof', 'ubound', 'ucase', 'unlock', 'until', 'val', + 'variant', 'vartype', 'version', 'weekday', 'wend', 'while', 'width', + 'with', 'write', 'xor' ); - KeyIndices: array[0..1422] of Integer = ( - -1, 117, 59, -1, 10, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 152, -1, -1, - -1, 22, -1, -1, -1, -1, 111, -1, -1, -1, -1, -1, -1, -1, -1, 115, 19, -1, - -1, -1, 160, -1, -1, -1, -1, -1, -1, -1, -1, 14, -1, -1, 34, -1, 54, -1, -1, - 31, 161, -1, 87, -1, 173, -1, -1, -1, -1, 76, -1, -1, -1, 138, -1, -1, -1, - -1, -1, 176, -1, 177, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 193, -1, - 178, -1, -1, -1, -1, -1, -1, 72, -1, -1, -1, -1, -1, -1, 131, -1, -1, -1, - -1, -1, -1, 188, -1, -1, -1, -1, -1, -1, -1, 194, 209, -1, -1, -1, 88, -1, - 120, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 170, -1, -1, -1, -1, 185, -1, - -1, -1, -1, 198, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, 73, -1, 157, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 67, -1, -1, -1, 130, -1, 82, -1, -1, 99, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 186, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 168, -1, -1, -1, - 206, 40, -1, -1, 143, 202, -1, -1, -1, -1, -1, 158, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 114, -1, -1, -1, 89, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 174, -1, 146, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 97, 69, -1, 29, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 127, -1, -1, -1, -1, 184, -1, -1, - -1, 153, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 199, 48, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 112, 90, -1, -1, -1, -1, -1, -1, 179, -1, -1, -1, -1, -1, -1, -1, 119, - -1, -1, -1, 25, -1, -1, -1, -1, -1, 74, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 125, -1, -1, -1, -1, -1, -1, -1, 126, -1, -1, -1, 65, -1, -1, - -1, 134, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, 155, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 150, -1, -1, -1, -1, -1, -1, -1, 86, -1, 147, 148, -1, -1, -1, - -1, -1, 107, 164, 203, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, 103, -1, -1, - -1, -1, -1, 68, -1, -1, 101, 32, 201, -1, -1, -1, -1, -1, -1, 95, -1, -1, - 124, 0, -1, -1, -1, -1, -1, -1, -1, -1, -1, 79, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 172, -1, 23, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 207, -1, -1, -1, -1, -1, -1, -1, 175, -1, 129, -1, - -1, -1, -1, -1, -1, -1, 30, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 58, -1, -1, 141, -1, -1, -1, 181, -1, -1, -1, 166, 80, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 197, -1, -1, 133, 28, -1, -1, -1, 21, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, -1, -1, -1, -1, -1, 36, -1, -1, - -1, -1, -1, -1, 104, -1, 12, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 92, -1, -1, 180, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 108, -1, 151, -1, -1, -1, -1, -1, -1, -1, -1, -1, 9, -1, - 156, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 205, -1, -1, -1, -1, -1, - -1, -1, -1, 136, 55, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 53, -1, -1, -1, -1, -1, -1, -1, -1, 100, -1, -1, -1, 51, 70, -1, -1, -1, -1, - 204, -1, -1, -1, -1, -1, -1, 24, -1, -1, 71, -1, -1, -1, -1, -1, 45, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 210, -1, 94, 84, - -1, -1, 189, -1, -1, -1, -1, -1, 128, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, 122, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 83, -1, - -1, -1, -1, -1, -1, -1, 38, -1, 213, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 162, -1, -1, -1, -1, -1, -1, -1, -1, -1, 17, -1, -1, -1, 47, 18, - 187, -1, -1, 137, 105, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 182, -1, 4, 75, -1, -1, -1, -1, -1, -1, 118, -1, -1, -1, -1, - -1, 20, 60, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, - -1, -1, -1, 93, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 81, -1, -1, -1, - -1, -1, -1, -1, -1, 110, -1, -1, -1, -1, -1, -1, -1, -1, -1, 167, -1, -1, - -1, 26, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 132, -1, -1, 196, -1, -1, -1, 85, - -1, -1, -1, -1, 140, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 78, 11, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 200, -1, -1, - 169, -1, -1, -1, -1, 159, -1, -1, 56, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, 211, -1, -1, -1, -1, -1, -1, 2, -1, -1, -1, -1, -1, - -1, -1, -1, -1, 44, -1, -1, -1, -1, 61, 15, -1, 27, -1, -1, -1, -1, 6, -1, - -1, -1, -1, -1, -1, -1, -1, 113, 39, -1, -1, -1, -1, -1, 91, -1, -1, 77, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 171, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - 145, -1, 195, 52, -1, -1, -1, -1, -1, -1, -1, -1, 1, -1, -1, -1, -1, -1, -1, - 57, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 7, -1, -1, 33, -1, -1, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, 96, -1, - 106, -1, 139, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, 212, 5, -1, 190, -1, -1, 49, 50, -1, -1, -1, -1, -1, -1, 46, 3, -1, - 109, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 165, -1, -1, - -1, 16, -1, -1, -1, -1, -1, 144, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 183, -1, -1, -1, 13, 135, -1, -1, -1, -1, 121, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, 163, -1, -1, -1, -1, -1, -1, -1, - 41, 149, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 123, -1, -1, -1, 208, -1, -1, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 191, -1, -1, - 43, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, - 37, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 154, -1 + KeyIndices: array[0..1510] of Integer = ( + 100, -1, -1, -1, -1, -1, -1, -1, 91, -1, -1, -1, 140, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 7, -1, -1, -1, -1, 74, + -1, -1, -1, 176, -1, -1, 181, 146, 171, -1, -1, -1, -1, 5, -1, -1, -1, -1, + -1, -1, -1, -1, 184, 213, -1, -1, -1, 31, -1, -1, 145, -1, 28, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 141, -1, -1, -1, -1, + 203, 195, -1, -1, 159, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 225, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 46, -1, -1, -1, -1, -1, + -1, 175, 211, -1, -1, -1, 186, -1, -1, 174, -1, -1, -1, -1, -1, -1, 149, -1, + -1, -1, -1, 193, -1, 192, -1, -1, -1, -1, -1, -1, -1, -1, 180, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 169, -1, 131, -1, -1, -1, -1, -1, -1, 33, -1, 44, -1, 118, -1, + -1, 54, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 150, -1, -1, -1, -1, -1, + -1, -1, -1, 183, -1, -1, -1, -1, 167, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 107, 57, -1, -1, 173, -1, -1, -1, -1, 38, + -1, 139, -1, -1, -1, -1, -1, -1, -1, -1, 185, -1, 125, -1, -1, -1, 201, -1, + -1, -1, -1, 49, -1, -1, -1, -1, -1, -1, 161, 130, -1, -1, -1, -1, -1, -1, + -1, -1, 19, -1, -1, 119, -1, 36, -1, -1, -1, -1, 219, -1, -1, 114, -1, -1, + -1, 56, -1, -1, -1, -1, 103, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 23, 190, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 214, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 116, -1, -1, -1, -1, -1, -1, -1, -1, 177, -1, -1, + -1, 18, 222, -1, -1, 94, -1, -1, -1, -1, -1, -1, -1, 202, -1, -1, -1, -1, + -1, -1, -1, -1, 188, -1, -1, -1, 223, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 47, -1, -1, -1, -1, -1, 3, 115, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 143, -1, -1, -1, -1, -1, -1, 154, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 191, -1, -1, -1, -1, -1, -1, -1, -1, -1, 95, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 16, 67, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 200, 182, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, 132, -1, 134, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 142, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 217, -1, -1, -1, -1, -1, -1, 165, -1, -1, -1, -1, + -1, 189, 72, 39, 187, -1, -1, -1, -1, -1, 194, 29, -1, -1, -1, 17, -1, -1, + 84, 79, -1, -1, -1, 40, 37, -1, 71, -1, -1, 55, -1, -1, -1, -1, -1, 75, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 166, -1, 80, 104, -1, -1, -1, 113, -1, + -1, -1, -1, -1, 76, -1, -1, -1, 148, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 92, -1, -1, -1, -1, -1, -1, 66, -1, -1, -1, 178, -1, -1, + 147, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 24, -1, -1, -1, -1, 198, + 48, -1, -1, -1, 197, 216, -1, -1, -1, -1, -1, -1, -1, 70, -1, -1, 123, -1, + -1, 204, -1, -1, -1, -1, -1, -1, 210, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, 215, -1, -1, -1, -1, -1, -1, -1, -1, 0, + -1, -1, -1, -1, 126, -1, -1, -1, -1, 12, -1, -1, -1, -1, 220, -1, 117, -1, + -1, -1, -1, -1, 101, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 208, -1, + -1, 22, 41, -1, -1, -1, -1, -1, 168, -1, 157, -1, -1, -1, -1, 162, -1, -1, + -1, -1, -1, -1, -1, 34, -1, -1, -1, -1, -1, -1, -1, 52, -1, -1, -1, -1, -1, + -1, -1, 82, -1, 120, -1, 61, -1, -1, -1, -1, -1, -1, -1, -1, 163, -1, 6, 86, + -1, -1, -1, 164, -1, 11, -1, -1, -1, -1, -1, -1, -1, -1, 27, -1, -1, -1, -1, + 50, -1, -1, -1, -1, 69, -1, -1, -1, -1, -1, -1, -1, 60, -1, -1, -1, -1, -1, + 158, -1, 68, -1, -1, -1, -1, -1, 221, -1, -1, -1, -1, 64, -1, -1, -1, 83, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 42, -1, 179, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 35, -1, -1, -1, -1, -1, -1, + -1, -1, 199, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 212, -1, 207, -1, -1, -1, -1, -1, -1, 122, -1, -1, -1, 99, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, 160, -1, -1, -1, -1, 30, 13, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 218, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + 151, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 59, -1, -1, -1, -1, -1, -1, -1, -1, 144, -1, 53, -1, + -1, -1, -1, -1, -1, 102, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, 93, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 96, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 106, -1, -1, + -1, -1, -1, -1, 15, -1, -1, -1, -1, 135, -1, -1, -1, -1, -1, 156, -1, -1, + 105, -1, -1, -1, -1, 133, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 43, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, 1, -1, 4, 20, -1, -1, -1, 155, -1, -1, -1, 170, + -1, -1, -1, 2, -1, -1, -1, -1, -1, 73, -1, -1, 65, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, 97, 172, 89, -1, -1, -1, 10, -1, -1, -1, -1, -1, -1, + -1, -1, -1, 108, -1, -1, -1, 224, -1, -1, -1, -1, -1, 14, -1, -1, -1, 112, + -1, -1, -1, 127, -1, -1, 63, -1, -1, -1, 124, -1, 209, -1, -1, -1, 206, -1, + -1, -1, -1, -1, -1, -1, 85, -1, -1, -1, -1, -1, 81, -1, -1, -1, -1, -1, -1, + -1, -1, 121, -1, -1, -1, -1, 136, -1, -1, -1, 51, -1, -1, -1, 58, -1, -1, + 110, -1, -1, -1, -1, -1, -1, 45, -1, -1, -1, -1, -1, -1, -1, 88, -1, -1, -1, + -1, 153, 62, -1, -1, -1, -1, -1, -1, 109, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 196, -1, -1, -1, -1, 137, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, 205, -1, -1, 26, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 25, -1, -1, -1, 9, 152, -1, 138, -1, + -1, 128, 129, -1, -1, 78, -1, -1, -1, -1, -1, -1, 8, -1, -1, 90, 77, -1, -1, + -1, -1, -1, 111, -1, 98, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, + -1, -1, -1, -1, 87, -1, -1, -1, -1 ); {$Q-} @@ -248,11 +259,11 @@ function TSynVBSyn.HashKey(Str: PWideChar): Cardinal; Result := 0; while IsIdentChar(Str^) do begin - Result := Result * 251 + Ord(Str^) * 749; + Result := Result * 573 + Ord(Str^) * 524; Inc(Str); end; - Result := Result mod 1423; - FStringLen := Str - FToIdent; + Result := Result mod 1511; + fStringLen := Str - fToIdent; end; {$Q+} @@ -260,10 +271,10 @@ function TSynVBSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var Key: Cardinal; begin - FToIdent := MayBe; + fToIdent := MayBe; Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + if Key <= High(fIdentFuncTable) then + Result := fIdentFuncTable[Key](KeyIndices[Key]) else Result := tkIdentifier; end; @@ -272,15 +283,15 @@ procedure TSynVBSyn.InitIdent; var i: Integer; begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; + fIdentFuncTable[i] := AltFunc; - FIdentFuncTable[436] := FuncRem; + fIdentFuncTable[842] := FuncRem; - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if @FIdentFuncTable[i] = nil then - FIdentFuncTable[i] := KeyWordFunc; + for i := Low(fIdentFuncTable) to High(fIdentFuncTable) do + if @fIdentFuncTable[i] = nil then + fIdentFuncTable[i] := KeyWordFunc; end; function TSynVBSyn.AltFunc(Index: Integer): TtkTokenKind; @@ -301,7 +312,7 @@ function TSynVBSyn.FuncRem(Index: Integer): TtkTokenKind; if IsCurrentToken(KeyWords[Index]) then begin ApostropheProc; - FStringLen := 0; + fStringLen := 0; Result := tkComment; end else @@ -312,38 +323,225 @@ constructor TSynVBSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := False; - - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style:= [fsItalic]; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style:= [fsBold]; - AddAttribute(FKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); + fCaseSensitive := False; + + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style:= [fsItalic]; + AddAttribute(fCommentAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style:= [fsBold]; + AddAttribute(fKeyAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); SetAttributesOnChange(DefHighlightChange); InitIdent; - FDefaultFilter := SYNS_FilterVisualBASIC; + fDefaultFilter := SYNS_FilterVisualBASIC; + + RE_BlockBegin := CompiledRegEx('\b(sub |function |private sub |private function |if |for |select case)\b', [roIgnoreCase]); + RE_BlockEnd := CompiledRegEx('\b(end sub|end function|end if|next|end select)\b', [roIgnoreCase]); +end; + +const + FT_Standard = 1; // begin end, class end, record end + FT_Comment = 11; + FT_CodeDeclaration = 16; + FT_CodeDeclarationWithBody = 17; + FT_Implementation = 18; + +procedure TSynVBSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); +var + CurLine: string; + Line: Integer; + ok: Boolean; + + function BlockDelimiter(Line: Integer): Boolean; + var + Index: Integer; + mcb: TMatchCollection; + mce: TMatchCollection; + match: TMatch; + begin + Result := False; + + mcb := RE_BlockBegin.Matches(CurLine); + if mcb.Count > 0 then + begin + // Char must have proper highlighting (ignore stuff inside comments...) + Index := mcb.Item[0].Index; + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then + begin + ok := False; + // And ignore lines with both opening and closing chars in them + for match in Re_BlockEnd.Matches(CurLine) do + if match.Index > Index then + begin + OK := True; + Break; + end; + if not OK then begin + FoldRanges.StartFoldRange(Line + 1, FT_Standard); + Result := True; + end; + end; + end + else + begin + mce := RE_BlockEnd.Matches(CurLine); + if mce.Count > 0 then + begin + Index := mce.Item[0].Index; + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then + begin + FoldRanges.StopFoldRange(Line + 1, FT_Standard); + Result := True; + end; + end; + end; + end; + + function FoldRegion(Line: Integer): Boolean; + var + S: string; + begin + Result := False; + S := TrimLeft(CurLine); + if Uppercase(Copy(S, 1, 7)) = '#REGION' then + begin + FoldRanges.StartFoldRange(Line + 1, FoldRegionType); + Result := True; + end + else if Uppercase(Copy(S, 1, 11)) = '#END REGION' then + begin + FoldRanges.StopFoldRange(Line + 1, FoldRegionType); + Result := True; + end; + end; + +begin + for Line := FromLine to ToLine do + begin + // Deal first with Multiline statements + + CurLine := LinesToScan[Line]; + + // Skip empty lines + if CurLine = '' then begin + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end; + + // Find Fold regions + if FoldRegion(Line) then + Continue; + + // Find begin or end (Fold Type 1) + if not BlockDelimiter(Line) then + FoldRanges.NoFoldInfo(Line + 1); + end; //for Line +end; + +procedure TSynVBSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings); +{ + Provide folding for procedures and functions included nested ones. +} +var + i, j, SkipTo: Integer; + ImplementationIndex: Integer; + FoldRange: TSynFoldRange; + mc: TMatchCollection; +begin + ImplementationIndex := - 1; + for i := FoldRanges.Ranges.Count - 1 downto 0 do + begin + if FoldRanges.Ranges.List[i].FoldType = FT_Implementation then + ImplementationIndex := i + else + if FoldRanges.Ranges.List[i].FoldType = FT_CodeDeclaration then + begin + if ImplementationIndex >= 0 then begin + // Code declaration in the Interface part of a unit + FoldRanges.Ranges.Delete(i); + Dec(ImplementationIndex); + Continue; + end; + // Examine the following ranges + SkipTo := 0; + j := i + 1; + while J < FoldRanges.Ranges.Count do begin + FoldRange := FoldRanges.Ranges.List[j]; + Inc(j); + case FoldRange.FoldType of + // Nested procedure or function + FT_CodeDeclarationWithBody: + begin + SkipTo := FoldRange.ToLine; + Continue; + end; + FT_Standard: + // possibly begin end; + if FoldRange.ToLine <= SkipTo then + Continue + else + begin + mc := RE_BlockBegin.Matches(LinesToScan[FoldRange.FromLine - 1]); + if mc.Count > 0 then + begin + if mc.Item[0].Value.ToLower = 'begin' then + begin + // function or procedure followed by begin end block + // Adjust ToLine + FoldRanges.Ranges.List[i].ToLine := FoldRange.ToLine; + FoldRanges.Ranges.List[i].FoldType := FT_CodeDeclarationWithBody; + Break + end else + begin + // class or record declaration follows, so + FoldRanges.Ranges.Delete(i); + Break; + end; + end else + Assert(False, 'TSynVBSSyn.AdjustFoldRanges'); + end; + else + begin + if FoldRange.ToLine <= SkipTo then + Continue + else begin + // Otherwise delete + // eg. function definitions within a class definition + FoldRanges.Ranges.Delete(i); + Break + end; + end; + end; + end; + end; + end; + if ImplementationIndex >= 0 then + // Looks better without it + //FoldRanges.Ranges.List[ImplementationIndex].ToLine := LinesToScan.Count; + FoldRanges.Ranges.Delete(ImplementationIndex); end; procedure TSynVBSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenId := tkSymbol; end; procedure TSynVBSyn.ApostropheProc; begin - FTokenID := tkComment; + fTokenID := tkComment; repeat Inc(Run); until IsLineEnd(Run); @@ -351,17 +549,16 @@ procedure TSynVBSyn.ApostropheProc; procedure TSynVBSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then Inc(Run); + if fLine[Run] = #10 then Inc(Run); end; procedure TSynVBSyn.DateProc; begin - FTokenID := tkString; + fTokenID := tkString; repeat - if IsLineEnd(Run) then - Break; + if IsLineEnd(Run) then Break; Inc(Run); until FLine[Run] = '#'; if not IsLineEnd(Run) then Inc(Run); @@ -369,34 +566,34 @@ procedure TSynVBSyn.DateProc; procedure TSynVBSyn.GreaterProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if FLine[Run] = '=' then Inc(Run); + if fLine[Run] = '=' then Inc(Run); end; procedure TSynVBSyn.IdentProc; begin - FTokenID := IdentKind(FLine + Run); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do Inc(Run); + fTokenID := IdentKind(fLine + Run); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynVBSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynVBSyn.LowerProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '>']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '>']) then Inc(Run); end; procedure TSynVBSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -404,7 +601,7 @@ procedure TSynVBSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', 'e', 'E': Result := True; else @@ -414,24 +611,23 @@ procedure TSynVBSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do Inc(Run); end; procedure TSynVBSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynVBSyn.StringProc; begin - FTokenID := tkString; + fTokenID := tkString; if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2); repeat - if IsLineEnd(Run) then - Break; + if IsLineEnd(Run) then Break; Inc(Run); until FLine[Run] = #34; if not IsLineEnd(Run) then Inc(Run); @@ -440,13 +636,13 @@ procedure TSynVBSyn.StringProc; procedure TSynVBSyn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynVBSyn.Next; begin - FTokenPos := Run; - case FLine[Run] of + fTokenPos := Run; + case fLine[Run] of '&': SymbolProc; #39: ApostropheProc; '}': SymbolProc; @@ -482,12 +678,12 @@ function TSynVBSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -495,37 +691,37 @@ function TSynVBSyn.GetDefaultAttribute(Index: Integer): function TSynVBSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynVBSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynVBSyn.GetTokenAttribute: TSynHighlighterAttributes; begin case GetTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FIdentifierAttri; + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fIdentifierAttri; else Result := nil; end; end; function TSynVBSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; function TSynVBSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterVisualBASIC; + Result := fDefaultFilter <> SYNS_FilterVisualBASIC; end; class function TSynVBSyn.GetLanguageName: string; @@ -533,7 +729,7 @@ class function TSynVBSyn.GetLanguageName: string; Result := SYNS_LangVisualBASIC; end; -function TSynVBSyn.GetSampleSource: UnicodeString; +function TSynVBSyn.GetSampleSource: string; begin Result := ''' Syntax highlighting'#13#10+ 'Function PrintNumber'#13#10+ @@ -553,13 +749,11 @@ function TSynVBSyn.GetSampleSource: UnicodeString; 'End Function'; end; -class function TSynVBSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynVBSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangVisualBASIC; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynVBSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterVBScript.pas b/Ext/SynEdit/Source/SynHighlighterVBScript.pas index b2d85ed..3588e59 100644 --- a/Ext/SynEdit/Source/SynHighlighterVBScript.pas +++ b/Ext/SynEdit/Source/SynHighlighterVBScript.pas @@ -27,13 +27,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterVBScript.pas,v 1.14.2.7 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a VBScript highlighter for SynEdit) @@ -51,44 +44,50 @@ interface uses - Graphics, - Registry, - SynEditHighlighter, + System.SysUtils, + System.Classes, + System.Generics.Defaults, + System.Generics.Collections, + Vcl.Graphics, SynEditTypes, - SynUnicode, - SysUtils, - Classes; + SynEditHighlighter, + System.RegularExpressions, + SynEditCodeFolding; + +const + SYNS_AttrConst = 'Constant'; type - TtkTokenKind = (tkComment, tkIdentifier, tkKey, tkNull, tkNumber, tkSpace, - tkString, tkSymbol, tkUnknown); + TtkTokenKind = (tkSymbol, tkKey, tkComment, tkConst, tkIdentifier, tkNull, + tkNumber, tkSpace, tkString, tkFunction, tkUnknown); PIdentFuncTableFunc = ^TIdentFuncTableFunc; TIdentFuncTableFunc = function (Index: Integer): TtkTokenKind of object; type - TSynVBScriptSyn = class(TSynCustomHighLighter) + TSynVBScriptSyn = class(TSynCustomCodeFoldingHighlighter) private FTokenID: TtkTokenKind; - FCommentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - FIdentFuncTable: array[0..268] of TIdentFuncTableFunc; - function AltFunc(Index: Integer): TtkTokenKind; - function KeyWordFunc(Index: Integer): TtkTokenKind; - function FuncRem(Index: Integer): TtkTokenKind; - function HashKey(Str: PWideChar): Cardinal; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + fFunctionAttri: TSynHighlighterAttributes; + fCOnstAttri: TSynHighlighterAttributes; + FKeywords: TDictionary; + RE_BlockBegin: TRegEx; + RE_BlockEnd: TRegEx; + procedure DoAddKeyword(AKeyword: string; AKind: Integer); function IdentKind(MayBe: PWideChar): TtkTokenKind; - procedure InitIdent; procedure ApostropheProc; procedure CRProc; procedure DateProc; procedure GreaterProc; procedure IdentProc; + procedure REMProc; procedure LFProc; procedure LowerProc; procedure NullProc; @@ -98,13 +97,14 @@ TSynVBScriptSyn = class(TSynCustomHighLighter) procedure SymbolProc; procedure UnknownProc; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; + destructor Destroy; override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override; function GetEol: Boolean; override; @@ -112,155 +112,338 @@ TSynVBScriptSyn = class(TSynCustomHighLighter) function GetTokenAttribute: TSynHighlighterAttributes; override; function GetTokenKind: Integer; override; procedure Next; override; + procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; + procedure AdjustFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings); override; published - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri - write FIdentifierAttri; - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri - write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri - write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property ConstAttri: TSynHighlighterAttributes read fCOnstAttri + write fConstAttri; + property FunctionAttri: TSynHighlighterAttributes read fFunctionAttri + write fFunctionAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri + write fIdentifierAttri; + property KeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri + write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri + write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; end; implementation uses + SynEditMiscProcs, SynEditStrConst; const - KeyWords: array[0..83] of UnicodeString = ( - 'and', 'as', 'boolean', 'byref', 'byte', 'byval', 'call', 'case', 'class', - 'const', 'currency', 'debug', 'dim', 'do', 'double', 'each', 'else', - 'elseif', 'empty', 'end', 'endif', 'enum', 'eqv', 'erase', 'error', 'event', - 'exit', 'explicit', 'false', 'for', 'function', 'get', 'goto', 'if', 'imp', - 'implements', 'in', 'integer', 'is', 'let', 'like', 'long', 'loop', 'lset', - 'me', 'mod', 'new', 'next', 'not', 'nothing', 'null', 'on', 'option', - 'optional', 'or', 'paramarray', 'preserve', 'private', 'property', 'public', - 'raiseevent', 'randomize', 'redim', 'rem', 'resume', 'rset', 'select', - 'set', 'shared', 'single', 'static', 'stop', 'sub', 'then', 'to', 'true', - 'type', 'typeof', 'until', 'variant', 'wend', 'while', 'with', 'xor' - ); - - KeyIndices: array[0..268] of Integer = ( - -1, -1, -1, -1, -1, -1, -1, -1, 56, -1, 77, -1, 78, -1, 37, 19, 75, -1, -1, - -1, -1, -1, -1, -1, 12, -1, 66, -1, -1, -1, -1, -1, 35, -1, -1, -1, 46, 41, - 36, -1, -1, 83, 33, 40, 34, -1, -1, -1, -1, 54, 24, 51, -1, -1, -1, -1, -1, - -1, -1, 76, -1, 68, -1, 1, -1, 7, -1, -1, 8, -1, -1, -1, -1, -1, -1, -1, -1, - -1, 57, -1, 79, -1, -1, -1, 5, -1, -1, -1, -1, 4, -1, -1, -1, 43, 72, -1, - 44, -1, -1, -1, -1, -1, -1, -1, 48, -1, -1, 69, -1, -1, 16, 70, 80, -1, 53, - 47, 58, -1, -1, -1, -1, -1, -1, 63, -1, -1, -1, -1, 59, -1, 65, 39, -1, -1, - -1, -1, 6, -1, 55, -1, 67, -1, -1, -1, -1, -1, -1, 22, -1, -1, -1, 74, 50, - -1, -1, -1, 64, -1, -1, -1, -1, -1, -1, 31, 20, 23, -1, -1, 61, 27, 38, -1, - -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 10, -1, - -1, -1, 3, -1, -1, 71, -1, -1, -1, -1, 11, 0, -1, -1, 82, 13, 15, 2, 30, 29, - 14, -1, -1, 42, 49, 81, -1, 9, -1, -1, 62, 25, 60, -1, -1, 45, -1, -1, -1, - -1, -1, -1, -1, -1, 26, 28, -1, -1, -1, -1, 21, -1, -1, -1, -1, -1, -1, -1, - 17, -1, -1, -1, -1, -1, 32, -1, -1, -1, -1, -1, -1, -1, -1, 52, 73, -1, -1, - 18 - ); - -{$Q-} -function TSynVBScriptSyn.HashKey(Str: PWideChar): Cardinal; + Keywords: string = + 'and, as, boolean, byref, byte, byval, call, case, class, const, currency,' + + 'default, description , dim, do, double, each, else, elseif, empty, end,' + + 'endif, enum, eqv, error, event, exit, explicit, false, firstindex , for,' + + 'function, get, global , goto, helpcontext , helpfile , if, ignorecase, imp,' + + 'implements, in, integer, is, length , let, like, long, loop, lset, me, mod,' + + 'new, next, not, nothing, null, number , on, option, optional, or, paramarray,' + + 'pattern, preserve, private, property, public, raiseevent, redim, resume,' + + 'rset, select, set, shared, single, source , static, sub, submatches, then,' + + 'to, true, type, typeof, until, value, variant, wend, while, with, xor'; + + FunctionConsts: string = + 'vbabort, vbabortretryignore, vbapplicationmodal, vbarray, vbbinarycompare,' + + 'vbblack, vbblue, vbboolean, vbbyte, vbcancel, vbcr, vbcritical, vbcrlf,' + + 'vbcurrency, vbcyan, vbdatabasecompare, vbdataobject, vbdate, vbdecimal,' + + 'vbdefaultbutton1, vbdefaultbutton2, vbdefaultbutton3, vbdefaultbutton4,' + + 'vbdouble, vbempty, vberror, vbexclamation, vbfalse, vbfirstfourdays,' + + 'vbfirstfullweek, vbfirstjan1, vbformfeed, vbfriday, vbgeneraldate, vbgreen,' + + 'vbignore, vbinformation, vbinteger, vblf, vblong, vblongdate, vblongtime,' + + 'vbmagenta, vbmonday, vbmsgboxhelpbutton, vbmsgboxright, vbmsgboxrtlreading,' + + 'vbmsgboxsetforeground, vbnewline, vbno, vbnull, vbnullchar, vbnullstring,' + + 'vbobject, vbobjecterror, vbok, vbokcancel, vbokonly, vbquestion, vbred,' + + 'vbretry, vbretrycancel, vbsaturday, vbshortdate, vbshorttime, vbsingle,' + + 'vbstring, vbsunday, vbsystemmodal, vbtab, vbtextcompare, vbthursday, vbtrue,' + + 'vbtuesday, vbusedefault, vbusesystem, vbusesystemdayofweek, vbvariant,' + + 'vbverticaltab, vbwednesday, vbwhite, vbyellow, vbyes, vbyesno, vbyesnocancel'; + + Functions: string = + 'abs, anchor, array, asc, ascb, ascw, atn, cbool, cbyte, ccur, cdate, cdbl,' + + 'chr, chrb, chrw, cint, class_initialize, class_terminate, clear, clng, cos,' + + 'createcomponent, createobject, csng, cstr, date, dateadd,' + + 'datediff, datepart, dateserial, datevalue, day, debug, dictionary, document,' + + 'element, erase, err, escape, eval, execute, executeglobal, exp,' + + 'filesystemobject, filter, fix, form, formatcurrency, formatdatetime,' + + 'formatnumber, formatpercent, getlocale, getobject, getref,' + + 'getresource, hex, history, hour, inputbox, instr, instrb, instrrev, int,' + + 'isarray, isdate, isempty, isnull, isnumeric, isobject, join, lbound, lcase,' + + 'left, leftb, len, lenb, link, loadpicture, location, log, ltrim, mid, midb,' + + 'minute, month, monthname, msgbox, navigator, now, oct, raise, randomize,' + + 'regexp, rem, replace, rgb, right, rightb, rnd, round, rtrim, scriptengine,' + + 'scriptenginebuildversion, scriptenginemajorversion, scriptengineminorversion,' + + 'second, setlocale, sgn, sin, space, split, sqr, step, stop, strcomp, string,' + + 'strreverse, tan, test, textstream, time, timer, timeserial, timevalue, trim,' + + 'typename, ubound, ucase, unescape, vartype, weekday, weekdayname, window,' + + 'write, writeline, year'; + +procedure TSynVBScriptSyn.DoAddKeyword(AKeyword: string; AKind: Integer); begin - Result := 0; - while IsIdentChar(Str^) do - begin - Result := Result * 713 + Ord(Str^) * 134; - Inc(Str); - end; - Result := Result mod 269; - FStringLen := Str - FToIdent; + if not FKeywords.ContainsKey(AKeyword) then + FKeywords.Add(AKeyword, TtkTokenKind(AKind)); end; -{$Q+} function TSynVBScriptSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; var - Key: Cardinal; + S: string; begin - FToIdent := MayBe; - Key := HashKey(MayBe); - if Key <= High(FIdentFuncTable) then - Result := FIdentFuncTable[Key](KeyIndices[Key]) + fToIdent := MayBe; + while IsIdentChar(MayBe^) do + Inc(Maybe); + fStringLen := Maybe - fToIdent; + SetString(S, fToIdent, fStringLen); + if FKeywords.ContainsKey(S) then + Result := FKeywords[S] else Result := tkIdentifier; end; -procedure TSynVBScriptSyn.InitIdent; -var - i: Integer; +constructor TSynVBScriptSyn.Create(AOwner: TComponent); begin - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if KeyIndices[i] = -1 then - FIdentFuncTable[i] := AltFunc; + inherited Create(AOwner); - FIdentFuncTable[123] := FuncRem; + fCaseSensitive := False; + // Create the keywords dictionary case-insensitive + FKeywords := TDictionary.Create(TIStringComparer.Ordinal); + + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + AddAttribute(fCommentAttri); + + fConstAttri := TSynHighlighterAttributes.Create(SYNS_AttrConst, SYNS_AttrConst); + fConstAttri.Style := [fsbold]; + AddAttribute(fConstAttri); + + fFunctionAttri := TSynHighlighterAttributes.Create(SYNS_AttrSystem, SYNS_FriendlyAttrSystem); + AddAttribute(fFunctionAttri); + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + AddAttribute(fIdentifierAttri); + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + AddAttribute(fKeyAttri); + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + AddAttribute(fNumberAttri); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + AddAttribute(fSpaceAttri); + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + AddAttribute(fStringAttri); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + AddAttribute(fSymbolAttri); + SetAttributesOnChange(DefHighlightChange); + fDefaultFilter := SYNS_FilterVBScript; - for i := Low(FIdentFuncTable) to High(FIdentFuncTable) do - if @FIdentFuncTable[i] = nil then - FIdentFuncTable[i] := KeyWordFunc; -end; + EnumerateKeywords(Ord(tkKey), KeyWords, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkConst), FunctionConsts, IsIdentChar, DoAddKeyword); + EnumerateKeywords(Ord(tkFunction), Functions, IsIdentChar, DoAddKeyword); -function TSynVBScriptSyn.AltFunc(Index: Integer): TtkTokenKind; -begin - Result := tkIdentifier; + RE_BlockBegin := CompiledRegEx('\b^(sub |function |private sub |private function |class )\b', [roIgnoreCase]); + RE_BlockEnd := CompiledRegEx('\b^(end sub|end function|end class)\b', [roIgnoreCase]); end; -function TSynVBScriptSyn.KeyWordFunc(Index: Integer): TtkTokenKind; +destructor TSynVBScriptSyn.Destroy; begin - if IsCurrentToken(KeyWords[Index]) then - Result := tkKey - else - Result := tkIdentifier + fKeywords.Free; + inherited Destroy; end; -function TSynVBScriptSyn.FuncRem(Index: Integer): TtkTokenKind; +const + FT_Standard = 1; // begin end, class end, record end + FT_Comment = 11; + FT_CodeDeclaration = 16; + FT_CodeDeclarationWithBody = 17; + FT_Implementation = 18; + +procedure TSynVBScriptSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); +var + CurLine: string; + Line: Integer; + ok: Boolean; + + function BlockDelimiter(Line: Integer): Boolean; + var + Index: Integer; + mcb: TMatchCollection; + mce: TMatchCollection; + match: TMatch; + begin + Result := False; + + mcb := RE_BlockBegin.Matches(CurLine); + if mcb.Count > 0 then + begin + // Char must have proper highlighting (ignore stuff inside comments...) + Index := mcb.Item[0].Index; + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then + begin + ok := False; + // And ignore lines with both opening and closing chars in them + for match in Re_BlockEnd.Matches(CurLine) do + if match.Index > Index then + begin + OK := True; + Break; + end; + if not OK then begin + FoldRanges.StartFoldRange(Line + 1, FT_Standard); + Result := True; + end; + end; + end + else + begin + mce := RE_BlockEnd.Matches(CurLine); + if mce.Count > 0 then + begin + Index := mce.Item[0].Index; + if GetHighlighterAttriAtRowCol(LinesToScan, Line, Index) <> fCommentAttri then + begin + FoldRanges.StopFoldRange(Line + 1, FT_Standard); + Result := True; + end; + end; + end; + end; + + function FoldRegion(Line: Integer): Boolean; + var + S: string; + begin + Result := False; + S := TrimLeft(CurLine); + if Uppercase(Copy(S, 1, 7)) = '''REGION' then + begin + FoldRanges.StartFoldRange(Line + 1, FoldRegionType); + Result := True; + end + else if Uppercase(Copy(S, 1, 10)) = '''ENDREGION' then + begin + FoldRanges.StopFoldRange(Line + 1, FoldRegionType); + Result := True; + end; + end; + begin - if IsCurrentToken(KeyWords[Index]) then + for Line := FromLine to ToLine do begin - ApostropheProc; - FStringLen := 0; - Result := tkComment; - end - else - Result := tkIdentifier; + // Deal first with Multiline statements + + CurLine := LinesToScan[Line]; + + // Skip empty lines + if CurLine = '' then begin + FoldRanges.NoFoldInfo(Line + 1); + Continue; + end; + + // Find Fold regions + if FoldRegion(Line) then + Continue; + + // Find begin or end (Fold Type 1) + if not BlockDelimiter(Line) then + FoldRanges.NoFoldInfo(Line + 1); + end; //for Line end; -constructor TSynVBScriptSyn.Create(AOwner: TComponent); +procedure TSynVBScriptSyn.AdjustFoldRanges(FoldRanges: TSynFoldRanges; + LinesToScan: TStrings); +{ + Provide folding for procedures and functions included nested ones. +} +var + i, j, SkipTo: Integer; + ImplementationIndex: Integer; + FoldRange: TSynFoldRange; + mc: TMatchCollection; begin - inherited Create(AOwner); - - FCaseSensitive := False; - - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - AddAttribute(FCommentAttri); - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - AddAttribute(FIdentifierAttri); - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - AddAttribute(FNumberAttri); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - AddAttribute(FSpaceAttri); - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - AddAttribute(FStringAttri); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - AddAttribute(FSymbolAttri); - SetAttributesOnChange(DefHighlightChange); - FDefaultFilter := SYNS_FilterVBScript; - InitIdent; + ImplementationIndex := - 1; + for i := FoldRanges.Ranges.Count - 1 downto 0 do + begin + if FoldRanges.Ranges.List[i].FoldType = FT_Implementation then + ImplementationIndex := i + else if FoldRanges.Ranges.List[i].FoldType = FT_CodeDeclaration then + begin + if ImplementationIndex >= 0 then begin + // Code declaration in the Interface part of a unit + FoldRanges.Ranges.Delete(i); + Dec(ImplementationIndex); + Continue; + end; + // Examine the following ranges + SkipTo := 0; + j := i + 1; + while J < FoldRanges.Ranges.Count do begin + FoldRange := FoldRanges.Ranges.List[j]; + Inc(j); + case FoldRange.FoldType of + // Nested procedure or function + FT_CodeDeclarationWithBody: + begin + SkipTo := FoldRange.ToLine; + Continue; + end; + FT_Standard: + // possibly begin end; + if FoldRange.ToLine <= SkipTo then + Continue + else + begin + mc := RE_BlockBegin.Matches(LinesToScan[FoldRange.FromLine - 1]); + if mc.Count > 0 then + begin + if mc.Item[0].Value.ToLower = 'begin' then + begin + // function or procedure followed by begin end block + // Adjust ToLine + FoldRanges.Ranges.List[i].ToLine := FoldRange.ToLine; + FoldRanges.Ranges.List[i].FoldType := FT_CodeDeclarationWithBody; + Break + end else + begin + // class or record declaration follows, so + FoldRanges.Ranges.Delete(i); + Break; + end; + end else + Assert(False, 'TSynVBSSyn.AdjustFoldRanges'); + end; + else + begin + if FoldRange.ToLine <= SkipTo then + Continue + else begin + // Otherwise delete + // eg. function definitions within a class definition + FoldRanges.Ranges.Delete(i); + Break + end; + end; + end; + end; + end; + end; + if ImplementationIndex >= 0 then + // Looks better without it + //FoldRanges.Ranges.List[ImplementationIndex].ToLine := LinesToScan.Count; + FoldRanges.Ranges.Delete(ImplementationIndex); end; procedure TSynVBScriptSyn.ApostropheProc; begin - FTokenID := tkComment; + fTokenID := tkComment; repeat Inc(Run); until IsLineEnd(Run); @@ -268,17 +451,16 @@ procedure TSynVBScriptSyn.ApostropheProc; procedure TSynVBScriptSyn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then Inc(Run); + if fLine[Run] = #10 then Inc(Run); end; procedure TSynVBScriptSyn.DateProc; begin - FTokenID := tkString; + fTokenID := tkString; repeat - if IsLineEnd(Run) then - Break; + if IsLineEnd(Run) then Break; Inc(Run); until FLine[Run] = '#'; if not IsLineEnd(Run) then Inc(Run); @@ -286,34 +468,35 @@ procedure TSynVBScriptSyn.DateProc; procedure TSynVBScriptSyn.GreaterProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if FLine[Run] = '=' then Inc(Run); + if fLine[Run] = '=' then Inc(Run); end; procedure TSynVBScriptSyn.IdentProc; begin - FTokenID := IdentKind((FLine + Run)); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do Inc(Run); + fTokenID := IdentKind((fLine + Run)); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do + Inc(Run); end; procedure TSynVBScriptSyn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynVBScriptSyn.LowerProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '>']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '>']) then Inc(Run); end; procedure TSynVBScriptSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -321,7 +504,7 @@ procedure TSynVBScriptSyn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', 'e', 'E': Result := True; else @@ -331,24 +514,23 @@ procedure TSynVBScriptSyn.NumberProc; begin Inc(Run); - FTokenID := tkNumber; + fTokenID := tkNumber; while IsNumberChar do Inc(Run); end; procedure TSynVBScriptSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynVBScriptSyn.StringProc; begin - FTokenID := tkString; + fTokenID := tkString; if (FLine[Run + 1] = #34) and (FLine[Run + 2] = #34) then Inc(Run, 2); repeat - if IsLineEnd(Run) then - Break; + if IsLineEnd(Run) then Break; Inc(Run); until FLine[Run] = #34; if not IsLineEnd(Run) then Inc(Run); @@ -357,24 +539,25 @@ procedure TSynVBScriptSyn.StringProc; procedure TSynVBScriptSyn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; procedure TSynVBScriptSyn.UnknownProc; begin Inc(Run); - FTokenID := tkIdentifier; + fTokenID := tkIdentifier; end; procedure TSynVBScriptSyn.Next; begin - FTokenPos := Run; - case FLine[Run] of + fTokenPos := Run; + case fLine[Run] of #39: ApostropheProc; #13: CRProc; '#': DateProc; '>': GreaterProc; - 'A'..'Z', 'a'..'z', '_': IdentProc; + 'A'..'Q', 'S'..'Z', 'a'..'q', 's'..'z', '_': IdentProc; + 'R', 'r': REMProc; #10: LFProc; '<': LowerProc; #0: NullProc; @@ -392,12 +575,12 @@ function TSynVBScriptSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -405,37 +588,39 @@ function TSynVBScriptSyn.GetDefaultAttribute(Index: Integer): function TSynVBScriptSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynVBScriptSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynVBScriptSyn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FIdentifierAttri; + case fTokenID of + tkComment: Result := fCommentAttri; + tkConst: Result := fCOnstAttri; + tkIdentifier: Result := fIdentifierAttri; + tkFunction: Result := fFunctionAttri; + tkKey: Result := fKeyAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fIdentifierAttri; else Result := nil; end; end; function TSynVBScriptSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; function TSynVBScriptSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterVBScript; + Result := fDefaultFilter <> SYNS_FilterVBScript; end; class function TSynVBScriptSyn.GetLanguageName: string; @@ -443,7 +628,7 @@ class function TSynVBScriptSyn.GetLanguageName: string; Result := SYNS_LangVBSScript; end; -function TSynVBScriptSyn.GetSampleSource: UnicodeString; +function TSynVBScriptSyn.GetSampleSource: string; begin Result := ''' Syntax highlighting'#13#10 + 'function printNumber()'#13#10 + @@ -455,13 +640,23 @@ function TSynVBScriptSyn.GetSampleSource: UnicodeString; 'end function'; end; -class function TSynVBScriptSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynVBScriptSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangVBSScript; end; +procedure TSynVBScriptSyn.REMProc; +begin + if CharInSet(FLine[Run+1], ['E', 'e']) and + CharInSet(FLine[Run+2], ['M', 'm']) and (FLine[Run+3] <= #32) then + ApostropheProc + else + begin + fTokenID := tkIdentifier; + IdentProc; + end; +end; + initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynVBScriptSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterVrml97.pas b/Ext/SynEdit/Source/SynHighlighterVrml97.pas index 5656a9e..81c599f 100644 --- a/Ext/SynEdit/Source/SynHighlighterVrml97.pas +++ b/Ext/SynEdit/Source/SynHighlighterVrml97.pas @@ -28,13 +28,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynHighlighterVrml97.pas,v 1.6.2.8 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} { @abstract(Provides a Vrml97/X3D/JavaScript highlighter for SynEdit) @@ -73,17 +66,13 @@ interface uses - Windows, - Messages, - Registry, - Controls, - Graphics, + System.SysUtils, + System.Classes, + System.Generics.Defaults, + System.Generics.Collections, + Vcl.Graphics, SynEditTypes, - SynEditHighlighter, - SynHighlighterHashEntries, - SynUnicode, - SysUtils, - Classes; + SynEditHighlighter; type TtkTokenKind = ( @@ -122,41 +111,39 @@ interface type TSynVrml97Syn = class(TSynCustomHighLighter) private - FRange: TRangeState; - FIsDoctype: Boolean; + fRange: TRangeState; + isDoctype: Boolean; FTokenID: TtkTokenKind; - FCommentAttri: TSynHighlighterAttributes; - FIdentifierAttri: TSynHighlighterAttributes; - FKeyAttri: TSynHighlighterAttributes; - FNonReservedKeyAttri: TSynHighlighterAttributes; - FEventAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FStringAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; - - FVrmlAppearanceAttri: TSynHighlighterAttributes; - FVrmlAttributeAttri: TSynHighlighterAttributes; - FVrmlDefinitionAttri: TSynHighlighterAttributes; - FVrmlEventAttri: TSynHighlighterAttributes; - FVrmlGroupingAttri: TSynHighlighterAttributes; - FVrmlInterpolatorAttri: TSynHighlighterAttributes; - FVrmlLightAttri: TSynHighlighterAttributes; - FVrmlNodeAttri: TSynHighlighterAttributes; - FVrmlParameterAttri: TSynHighlighterAttributes; - FVrmlprotoAttri: TSynHighlighterAttributes; - FVrmlSensorAttri: TSynHighlighterAttributes; - FVrmlShapeAttri: TSynHighlighterAttributes; - FVrmlShape_HintAttri: TSynHighlighterAttributes; - FVrmlTime_dependentAttri: TSynHighlighterAttributes; - FVrmlViewpointAttri: TSynHighlighterAttributes; - FVrmlWorldInfoAttri: TSynHighlighterAttributes; - FX3DDocTypeAttri: TSynHighlighterAttributes; - FX3DHeaderAttri: TSynHighlighterAttributes; - - FKeywords: TSynHashEntryList; - procedure DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); - function HashKey(Str: PWideChar): Integer; + fCommentAttri: TSynHighlighterAttributes; + fIdentifierAttri: TSynHighlighterAttributes; + fKeyAttri: TSynHighlighterAttributes; + fNonReservedKeyAttri: TSynHighlighterAttributes; + fEventAttri: TSynHighlighterAttributes; + fNumberAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fStringAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; + + fVrmlAppearanceAttri: TSynHighlighterAttributes; + fVrmlAttributeAttri: TSynHighlighterAttributes; + fVrmlDefinitionAttri: TSynHighlighterAttributes; + fVrmlEventAttri: TSynHighlighterAttributes; + fVrmlGroupingAttri: TSynHighlighterAttributes; + fVrmlInterpolatorAttri: TSynHighlighterAttributes; + fVrmlLightAttri: TSynHighlighterAttributes; + fVrmlNodeAttri: TSynHighlighterAttributes; + fVrmlParameterAttri: TSynHighlighterAttributes; + fVrmlprotoAttri: TSynHighlighterAttributes; + fVrmlSensorAttri: TSynHighlighterAttributes; + fVrmlShapeAttri: TSynHighlighterAttributes; + fVrmlShape_HintAttri: TSynHighlighterAttributes; + fVrmlTime_dependentAttri: TSynHighlighterAttributes; + fVrmlViewpointAttri: TSynHighlighterAttributes; + fVrmlWorldInfoAttri: TSynHighlighterAttributes; + fX3DDocTypeAttri: TSynHighlighterAttributes; + fX3DHeaderAttri: TSynHighlighterAttributes; + FKeywords: TDictionary; + procedure DoAddKeyword(AKeyword: string; AKind: Integer); function IdentKind(MayBe: PWideChar): TtkTokenKind; procedure AndSymbolProc; procedure CommentProc; @@ -182,13 +169,13 @@ TSynVrml97Syn = class(TSynCustomHighLighter) procedure StringProc; procedure SymbolProc; procedure UnknownProc; - function NextTokenIs(T: UnicodeString): Boolean; + function NextTokenIs(T: string): Boolean; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; destructor Destroy; override; @@ -203,49 +190,50 @@ TSynVrml97Syn = class(TSynCustomHighLighter) procedure SetRange(Value: Pointer); override; procedure ResetRange; override; published - property NonReservedKeyAttri: TSynHighlighterAttributes read FNonReservedKeyAttri write FNonReservedKeyAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri write FSpaceAttri; - property StringAttri: TSynHighlighterAttributes read FStringAttri write FStringAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri write FSymbolAttri; - property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; - property IdentifierAttri: TSynHighlighterAttributes read FIdentifierAttri write FIdentifierAttri; - property EcmaScriptKeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property EcmaScriptEventAttri: TSynHighlighterAttributes read FEventAttri write FEventAttri; - - property VrmlAppearanceAttri: TSynHighlighterAttributes read FVrmlAppearanceAttri write FVrmlAppearanceAttri; - property VrmlAttributeAttri: TSynHighlighterAttributes read FVrmlAttributeAttri write FVrmlAttributeAttri; - property VrmlDefinitionAttri: TSynHighlighterAttributes read FVrmlDefinitionAttri write FVrmlDefinitionAttri; - property VrmlEventAttri: TSynHighlighterAttributes read FVrmlEventAttri write FVrmlEventAttri; - property VrmlGroupingAttri: TSynHighlighterAttributes read FVrmlGroupingAttri write FVrmlGroupingAttri; - property VrmlInterpolatorAttri: TSynHighlighterAttributes read FVrmlInterpolatorAttri write FVrmlInterpolatorAttri; - property VrmlLightAttri: TSynHighlighterAttributes read FVrmlLightAttri write FVrmlLightAttri; - property VrmlNodeAttri: TSynHighlighterAttributes read FVrmlNodeAttri write FVrmlNodeAttri; - property VrmlParameterAttri: TSynHighlighterAttributes read FVrmlParameterAttri write FVrmlParameterAttri; - property VrmlprotoAttri: TSynHighlighterAttributes read FVrmlprotoAttri write FVrmlprotoAttri; - property VrmlSensorAttri: TSynHighlighterAttributes read FVrmlSensorAttri write FVrmlSensorAttri; - property VrmlShapeAttri: TSynHighlighterAttributes read FVrmlShapeAttri write FVrmlShapeAttri; - property VrmlShape_HintAttri: TSynHighlighterAttributes read FVrmlShape_HintAttri write FVrmlShape_HintAttri; - property VrmlTime_dependentAttri: TSynHighlighterAttributes read FVrmlTime_dependentAttri write FVrmlTime_dependentAttri; - property VrmlViewpointAttri: TSynHighlighterAttributes read FVrmlViewpointAttri write FVrmlViewpointAttri; - property VrmlWorldInfoAttri: TSynHighlighterAttributes read FVrmlWorldInfoAttri write FVrmlWorldInfoAttri; - property X3DDocTypeAttri: TSynHighlighterAttributes read FX3DDocTypeAttri write FX3DDocTypeAttri; - property X3DHeaderAttri: TSynHighlighterAttributes read FX3DHeaderAttri write FX3DHeaderAttri; + property NonReservedKeyAttri: TSynHighlighterAttributes read fNonReservedKeyAttri write fNonReservedKeyAttri; + property NumberAttri: TSynHighlighterAttributes read fNumberAttri write fNumberAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri write fSpaceAttri; + property StringAttri: TSynHighlighterAttributes read fStringAttri write fStringAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri write fSymbolAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri write fCommentAttri; + property IdentifierAttri: TSynHighlighterAttributes read fIdentifierAttri write fIdentifierAttri; + property EcmaScriptKeyAttri: TSynHighlighterAttributes read fKeyAttri write fKeyAttri; + property EcmaScriptEventAttri: TSynHighlighterAttributes read fEventAttri write fEventAttri; + + property VrmlAppearanceAttri: TSynHighlighterAttributes read fVrmlAppearanceAttri write fVrmlAppearanceAttri; + property VrmlAttributeAttri: TSynHighlighterAttributes read fVrmlAttributeAttri write fVrmlAttributeAttri; + property VrmlDefinitionAttri: TSynHighlighterAttributes read fVrmlDefinitionAttri write fVrmlDefinitionAttri; + property VrmlEventAttri: TSynHighlighterAttributes read fVrmlEventAttri write fVrmlEventAttri; + property VrmlGroupingAttri: TSynHighlighterAttributes read fVrmlGroupingAttri write fVrmlGroupingAttri; + property VrmlInterpolatorAttri: TSynHighlighterAttributes read fVrmlInterpolatorAttri write fVrmlInterpolatorAttri; + property VrmlLightAttri: TSynHighlighterAttributes read fVrmlLightAttri write fVrmlLightAttri; + property VrmlNodeAttri: TSynHighlighterAttributes read fVrmlNodeAttri write fVrmlNodeAttri; + property VrmlParameterAttri: TSynHighlighterAttributes read fVrmlParameterAttri write fVrmlParameterAttri; + property VrmlprotoAttri: TSynHighlighterAttributes read fVrmlprotoAttri write fVrmlprotoAttri; + property VrmlSensorAttri: TSynHighlighterAttributes read fVrmlSensorAttri write fVrmlSensorAttri; + property VrmlShapeAttri: TSynHighlighterAttributes read fVrmlShapeAttri write fVrmlShapeAttri; + property VrmlShape_HintAttri: TSynHighlighterAttributes read fVrmlShape_HintAttri write fVrmlShape_HintAttri; + property VrmlTime_dependentAttri: TSynHighlighterAttributes read fVrmlTime_dependentAttri write fVrmlTime_dependentAttri; + property VrmlViewpointAttri: TSynHighlighterAttributes read fVrmlViewpointAttri write fVrmlViewpointAttri; + property VrmlWorldInfoAttri: TSynHighlighterAttributes read fVrmlWorldInfoAttri write fVrmlWorldInfoAttri; + property X3DDocTypeAttri: TSynHighlighterAttributes read fX3DDocTypeAttri write fX3DDocTypeAttri; + property X3DHeaderAttri: TSynHighlighterAttributes read fX3DHeaderAttri write fX3DHeaderAttri; end; implementation uses + SynEditMiscProcs, SynEditStrConst; const - Events: UnicodeString = + Events: string = 'onAbort, onBlur, onChange, onClick, onDblClick, onError, onFocus, ' + 'onKeyDown, onKeyPress, onKeyUp, onLoad, onMouseDown, onMouseMove, ' + 'onMouseOut, onMouseOver, onMouseUp, onReset, onSelect, onSubmit, ' + 'onUnload'; - KeyWords: UnicodeString = + KeyWords: string = 'abstract, boolean, break, byte, callee, case, catch, char, class, ' + 'const, constructor, continue, debugger, default, delete, do, DOCTYPE, ' + 'double, else, enum, export, extends, false, final, finally, float, for, ' + @@ -255,7 +243,7 @@ implementation 'super, switch, synchronized, this, throw, throws, transient, true, try, ' + 'typeof, var, void, while, with, xml'; - NonReservedKeys: UnicodeString = + NonReservedKeys: string = 'abs, acos, action, alert, align, alinkColor, all, All, anchor, anchors, ' + 'appCodeName, Applet, applets, appName, appVersion, Area, arguments, ' + 'Arguments, Array, asin, atan, atan2, back, background, bgColor, big, ' + @@ -300,12 +288,12 @@ implementation 'version, visibility, vlinkColor, vspace, watch, width, window, Window, ' + 'write, writeln, zIndex'; - VrmlAppearances: UnicodeString = + VrmlAppearances: string = 'Appearance, ImageTexture, Material, NurbsTextureSurface, PixelTexture, ' + 'TextureBackground, TextureCoordinate, TextureCoordinateGenerator, ' + 'TextureTransform'; - VrmlAttributes: UnicodeString = + VrmlAttributes: string = 'addChildren, ambientIntensity, appearance, attenuation, autoOffset, ' + 'avatarSize, axisOfRotation, backUrl, bboxCenter, bboxSize, beamWidth, ' + 'beginCap, bindTime, bottom, bottomRadius, bottomUrl, ccw, center, children, ' + @@ -338,33 +326,33 @@ implementation 'visibilityLimit, visibilityRange, whichChoice, xDimension, xSpacing, ' + 'zDimension, zSpacing'; - VrmlDefinitions: UnicodeString = + VrmlDefinitions: string = 'MFColor, MFFloat, MFInt32, MFNode, MFRotation, MFString, MFTime, ' + 'MFVec2f, MFVec3f, SFBool, SFColor, SFFloat, SFImage, SFInt32, SFNode, ' + 'SFRotation, SFString, SFTime, SFVec2f, SFVec3f'; - VrmlEvents: UnicodeString = + VrmlEvents: string = 'eventIn, eventOut, exposedField, field'; - VrmlGroupings: UnicodeString = + VrmlGroupings: string = 'Anchor, Billboard, Collision, ESPDUTransform, Group, Inline, LOD, ' + 'NurbsGroup, ReceiverPdu, SignalPdu, StaticGroup, Switch, Transform, ' + 'Transform2D, TransmitterPdu'; - VrmlInterpolators: UnicodeString = + VrmlInterpolators: string = 'ColorInterpolator, CoordinateInterpolator, CoordinateInterpolator2D, ' + 'GeoPositionInterpolator, NormalInterpolator, NurbsPositionInterpolator, ' + 'OrientationInterpolator, PositionInterpolator, PositionInterpolator2D, ' + 'ScalarInterpolator'; - VrmlLights: UnicodeString = + VrmlLights: string = 'DirectionalLight, PointLight, SpotLight'; - VrmlNodes: UnicodeString = + VrmlNodes: string = 'Background, Color, Coordinate, CoordinateDeformer, Fog, FontStyle, ' + 'Joint, NavigationInfo, Normal, Script, Site, Sound'; - VrmlParameters: UnicodeString = + VrmlParameters: string = 'ALL, AUTO, BINDINGS, BOLD, BOTTOM, CENTER, CLAMP, CLOCKWISE, CONVEX, ' + 'COUNTERCLOCKWISE, CULLING, DEFAULT, DEFAULTS, Displacer, ENUMS, FACE, FALSE, ' + 'FAMILY, FILE, FORMAT, ITALIC, JUSTIFICATION, LEFT, NONE, NULL, OFF, ON, ' + @@ -373,7 +361,7 @@ implementation 'STYLE, TRUE, TYPE, UNKNOWN_FACE_TYPE, UNKNOWN_ORDERING, ' + 'UNKNOWN_SHAPE_TYPE, WRAP'; - VrmlProtos: UnicodeString = + VrmlProtos: string = 'DEF, EXTERNPROTO, IS, PROTO, ROUTE, Scene, TO, USE, VRML, X3D, ' + 'X3DAppearanceNode, X3DAppearanceChildNode, X3DBackgroundNode, X3DBindableNode, ' + 'X3DBoundedObject, X3DChildNode, X3DColorNode, X3DComposedGeometryNode, ' + @@ -389,257 +377,222 @@ implementation 'X3DTextureTransformNode, X3DTimeDependentNode, X3DTouchSensorNode, ' + 'X3DTriggerNode, X3DUrlObject'; - VrmlSensors: UnicodeString = + VrmlSensors: string = 'BooleanFilter, BooleanSequencer, BooleanToggle, BooleanTrigger, ' + 'CylinderSensor, GeoTouchSensor, IntegerTrigger, KeySensor, LoadSensor, ' + 'PlaneSensor, ProximitySensor, SphereSensor, StringSensor, TimeSensor, ' + 'TouchSensor, VisibilitySensor'; - VrmlShapes: UnicodeString = + VrmlShapes: string = 'Arc2D, ArcClose2D, Box, Circle2D, Cone, Contour2D, ContourPolyline2D, ' + 'Cylinder, Disk2D, ElevationGrid, Humanoid, NurbsCurve, NurbsCurve2D, ' + 'NurbsSurface, PointSet, Polyline2D, Polypoint2D, Rectangle2D, Segment, ' + 'Shape, Shape2D, Sphere, Text, TriangleFanSet, TriangleSet, TriangleSet2D, ' + 'TriangleStripSet, TrimmedSurface'; - VrmlShape_Hints: UnicodeString = + VrmlShape_Hints: string = 'Extrusion, IndexedFaceSet, IndexedLineSet'; - VrmlTime_dependents: UnicodeString = + VrmlTime_dependents: string = 'AudioClip, IntegerSequencer, MovieTexture, TimeTrigger'; - VrmlViewpoints: UnicodeString = + VrmlViewpoints: string = 'GeoViewpoint, Viewpoint'; - VrmlWorldInfos: UnicodeString = + VrmlWorldInfos: string = 'WorldInfo'; -procedure TSynVrml97Syn.DoAddKeyword(AKeyword: UnicodeString; AKind: Integer); -var - HashValue: Integer; +procedure TSynVrml97Syn.DoAddKeyword(AKeyword: string; AKind: Integer); begin - HashValue := HashKey(PWideChar(AKeyword)); - FKeywords[HashValue] := TSynHashEntry.Create(AKeyword, AKind); -end; - -function TSynVrml97Syn.HashKey(Str: PWideChar): Integer; - - function GetOrd: Integer; - begin - case Str^ of - 'a'..'z': Result := 1 + Ord(Str^) - Ord('a'); - 'A'..'Z': Result := 27 + Ord(Str^) - Ord('A'); - '0'..'9': Result := 54 + Ord(Str^) - Ord('0'); - '_': Result := 53; - else Result := 0; - end - end; - -begin - Result := 0; - while IsIdentChar(Str^) do - begin -{$IFOPT Q-} - Result := 7 * Result + GetOrd; -{$ELSE} - Result := (7 * Result + GetOrd) and $FFFFFF; -{$ENDIF} - Inc(Str); - end; - Result := Result and $FF; // 255 - FStringLen := Str - FToIdent; + if not FKeywords.ContainsKey(AKeyword) then + FKeywords.Add(AKeyword, TtkTokenKind(AKind)); end; function TSynVrml97Syn.IdentKind(MayBe: PWideChar): TtkTokenKind; var - Entry: TSynHashEntry; + S: string; begin - FToIdent := MayBe; - Entry := FKeywords[HashKey(MayBe)]; - while Assigned(Entry) do - begin - if Entry.KeywordLen > FStringLen then - Break - else if Entry.KeywordLen = FStringLen then - if IsCurrentToken(Entry.Keyword) then - begin - Result := TtkTokenKind(Entry.Kind); - Exit; - end; - Entry := Entry.Next; - end; - Result := tkIdentifier; + fToIdent := MayBe; + while IsIdentChar(MayBe^) do + Inc(Maybe); + fStringLen := Maybe - fToIdent; + SetString(S, fToIdent, fStringLen); + if FKeywords.ContainsKey(S) then + Result := FKeywords[S] + else + Result := tkIdentifier; end; constructor TSynVrml97Syn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := True; - - FKeywords := TSynHashEntryList.Create; - FIsDoctype := False; - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Style := [fsItalic]; - FCommentAttri.Foreground := clNavy; - FCommentAttri.Background := clGray; - AddAttribute(FCommentAttri); - - FIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); - FIdentifierAttri.Style := []; - FIdentifierAttri.Foreground := clNavy; - FIdentifierAttri.Background := clWhite; - AddAttribute(FIdentifierAttri); - - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); - FKeyAttri.Style := [fsBold]; - FKeyAttri.Foreground := clRed; - FKeyAttri.Background := clWhite; - AddAttribute(FKeyAttri); - - FNonReservedKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); - FNonReservedKeyAttri.Style := [fsItalic]; - FNonReservedKeyAttri.Foreground := clBlack; - FNonReservedKeyAttri.Background := clWhite; - AddAttribute(FNonReservedKeyAttri); - - FEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrEvent, SYNS_FriendlyAttrEvent); - FEventAttri.Style := [fsItalic]; - FEventAttri.Foreground := clNavy; - FEventAttri.Background := clWhite; - AddAttribute(FEventAttri); - - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - FEventAttri.Style := [fsItalic]; - FEventAttri.Foreground := clNavy; - FEventAttri.Background := clWhite; - AddAttribute(FNumberAttri); - - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); - FSpaceAttri.Style := [fsItalic]; - FSpaceAttri.Foreground := clNavy; - AddAttribute(FSpaceAttri); - - FStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - FStringAttri.Style := [fsItalic]; - FStringAttri.Foreground := clNavy; - FStringAttri.Background := clWhite; - AddAttribute(FStringAttri); - - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - FSymbolAttri.Style := [fsItalic]; - FSymbolAttri.Foreground := clNavy; - FSymbolAttri.Background := clWhite; - AddAttribute(FSymbolAttri); + fCaseSensitive := True; + + // Create the keywords dictionary case-sensitive + FKeywords := TDictionary.Create; + isDoctype := False; + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fCommentAttri.Style := [fsItalic]; + fCommentAttri.Foreground := clNavy; + fCommentAttri.Background := clGray; + AddAttribute(fCommentAttri); + + fIdentifierAttri := TSynHighlighterAttributes.Create(SYNS_AttrIdentifier, SYNS_FriendlyAttrIdentifier); + fIdentifierAttri.Style := []; + fIdentifierAttri.Foreground := clNavy; + fIdentifierAttri.Background := clWhite; + AddAttribute(fIdentifierAttri); + + fKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrReservedWord, SYNS_FriendlyAttrReservedWord); + fKeyAttri.Style := [fsBold]; + fKeyAttri.Foreground := clRed; + fKeyAttri.Background := clWhite; + AddAttribute(fKeyAttri); + + fNonReservedKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrNonReservedKeyword, SYNS_FriendlyAttrNonReservedKeyword); + fNonReservedKeyAttri.Style := [fsItalic]; + fNonReservedKeyAttri.Foreground := clBlack; + fNonReservedKeyAttri.Background := clWhite; + AddAttribute(fNonReservedKeyAttri); + + fEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrEvent, SYNS_FriendlyAttrEvent); + fEventAttri.Style := [fsItalic]; + fEventAttri.Foreground := clNavy; + fEventAttri.Background := clWhite; + AddAttribute(fEventAttri); + + fNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); + fEventAttri.Style := [fsItalic]; + fEventAttri.Foreground := clNavy; + fEventAttri.Background := clWhite; + AddAttribute(fNumberAttri); + + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrSpace, SYNS_FriendlyAttrSpace); + fSpaceAttri.Style := [fsItalic]; + fSpaceAttri.Foreground := clNavy; + AddAttribute(fSpaceAttri); + + fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); + fStringAttri.Style := [fsItalic]; + fStringAttri.Foreground := clNavy; + fStringAttri.Background := clWhite; + AddAttribute(fStringAttri); + + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + fSymbolAttri.Style := [fsItalic]; + fSymbolAttri.Foreground := clNavy; + fSymbolAttri.Background := clWhite; + AddAttribute(fSymbolAttri); //-- vrml - FVrmlAppearanceAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlAppearance, SYNS_FriendlyAttrVrmlAppearance); - FVrmlAppearanceAttri.Style := [fsItalic]; - FVrmlAppearanceAttri.Foreground := clNavy; - FVrmlAppearanceAttri.Background := clWhite; - AddAttribute(FVrmlAppearanceAttri); - - FVrmlAttributeAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlAttribute, SYNS_FriendlyAttrVrmlAttribute); - FVrmlAttributeAttri.Style := [fsItalic]; - FVrmlAttributeAttri.Foreground := clNavy; - FVrmlAttributeAttri.Background := clGray; - AddAttribute(FVrmlAttributeAttri); - - FVrmlDefinitionAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlDefinition, SYNS_FriendlyAttrVrmlDefinition); - FVrmlDefinitionAttri.Style := [fsItalic]; - FVrmlDefinitionAttri.Foreground := clNavy; - FVrmlDefinitionAttri.Background := clRed; - AddAttribute(FVrmlDefinitionAttri); - - FVrmlEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlEvent, SYNS_FriendlyAttrVrmlEvent); - FVrmlEventAttri.Style := [fsBold]; - FVrmlEventAttri.Foreground := clRed; - FVrmlEventAttri.Background := clWhite; - AddAttribute(FVrmlEventAttri); - - FVrmlGroupingAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlGrouping, SYNS_FriendlyAttrVrmlGrouping); - FVrmlGroupingAttri.Style := [fsBold]; - FVrmlGroupingAttri.Foreground := clNavy; - FVrmlGroupingAttri.Background := clWhite; - AddAttribute(FVrmlGroupingAttri); - - FVrmlInterpolatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlInterpolator, SYNS_FriendlyAttrVrmlInterpolator); - FVrmlInterpolatorAttri.Style := [fsItalic]; - FVrmlInterpolatorAttri.Foreground := clLime; - FVrmlInterpolatorAttri.Background := clWhite; - AddAttribute(FVrmlInterpolatorAttri); - - FVrmlLightAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlLight, SYNS_FriendlyAttrVrmlLight); - FVrmlLightAttri.Style := [fsItalic]; - FVrmlLightAttri.Foreground := clTeal; - FVrmlLightAttri.Background := clWhite; - AddAttribute(FVrmlLightAttri); - - FVrmlNodeAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlNode, SYNS_FriendlyAttrVrmlNode); - FVrmlNodeAttri.Style := [fsItalic, fsBold]; - FVrmlNodeAttri.Foreground := clGreen; - FVrmlNodeAttri.Background := clWhite; - AddAttribute(FVrmlNodeAttri); - - FVrmlParameterAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlParameter, SYNS_FriendlyAttrVrmlParameter); - FVrmlParameterAttri.Style := [fsBold]; - FVrmlParameterAttri.Foreground := $F0CAA6; //clSkyBlue - FVrmlParameterAttri.Background := clWhite; - AddAttribute(FVrmlParameterAttri); - - FVrmlprotoAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlProto, SYNS_FriendlyAttrVrmlProto); - FVrmlprotoAttri.Style := [fsBold]; - FVrmlprotoAttri.Foreground := clRed; - FVrmlprotoAttri.Background := clWhite; - AddAttribute(FVrmlprotoAttri); - - FVrmlSensorAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlSensor, SYNS_FriendlyAttrVrmlSensor); - FVrmlSensorAttri.Style := [fsBold]; - FVrmlSensorAttri.Foreground := clOlive; - FVrmlSensorAttri.Background := clWhite; - AddAttribute(FVrmlSensorAttri); - - FVrmlShapeAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlShape, SYNS_FriendlyAttrVrmlShape); - FVrmlShapeAttri.Style := [fsBold]; - FVrmlShapeAttri.Foreground := clPurple; - FVrmlShapeAttri.Background := clWhite; - AddAttribute(FVrmlShapeAttri); - - FVrmlShape_HintAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlShape_Hint, SYNS_FriendlyAttrVrmlShape_Hint); - FVrmlShape_HintAttri.Style := [fsItalic]; - FVrmlShape_HintAttri.Foreground := clPurple; - FVrmlShape_HintAttri.Background := clWhite; - AddAttribute(FVrmlShape_HintAttri); - - FVrmlTime_dependentAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlTime_dependent, SYNS_FriendlyAttrVrmlTime_dependent); - FVrmlTime_dependentAttri.Style := [fsItalic]; - FVrmlTime_dependentAttri.Foreground := clOlive; - FVrmlTime_dependentAttri.Background := clWhite; - AddAttribute(FVrmlTime_dependentAttri); - - FVrmlViewpointAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlViewpoint, SYNS_FriendlyAttrVrmlViewpoint); - FVrmlViewpointAttri.Style := [fsItalic]; - FVrmlViewpointAttri.Foreground := clGreen; - FVrmlViewpointAttri.Background := clWhite; - AddAttribute(FVrmlViewpointAttri); - - FVrmlWorldInfoAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlWorldInfo, SYNS_FriendlyAttrVrmlWorldInfo); - FVrmlWorldInfoAttri.Style := [fsItalic]; - FVrmlWorldInfoAttri.Foreground := clMaroon; - FVrmlWorldInfoAttri.Background := clWhite; - AddAttribute(FVrmlWorldInfoAttri); - - FX3DDocTypeAttri := TSynHighLighterAttributes.Create(SYNS_AttrX3DDocType, SYNS_FriendlyAttrX3DDocType); - FX3DDocTypeAttri.Style := [fsItalic]; - FX3DDocTypeAttri.Foreground := clMaroon; - FX3DDocTypeAttri.Background := clWhite; - AddAttribute(FX3DDocTypeAttri); - - FX3DHeaderAttri := TSynHighLighterAttributes.Create(SYNS_AttrX3DHeader, SYNS_FriendlyAttrX3DHeader); - FX3DHeaderAttri.Style := [fsItalic]; - FX3DHeaderAttri.Foreground := clMaroon; - FX3DHeaderAttri.Background := clWhite; - AddAttribute(FX3DHeaderAttri); + fVrmlAppearanceAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlAppearance, SYNS_FriendlyAttrVrmlAppearance); + fVrmlAppearanceAttri.Style := [fsItalic]; + fVrmlAppearanceAttri.Foreground := clNavy; + fVrmlAppearanceAttri.Background := clWhite; + AddAttribute(fVrmlAppearanceAttri); + + fVrmlAttributeAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlAttribute, SYNS_FriendlyAttrVrmlAttribute); + fVrmlAttributeAttri.Style := [fsItalic]; + fVrmlAttributeAttri.Foreground := clNavy; + fVrmlAttributeAttri.Background := clGray; + AddAttribute(fVrmlAttributeAttri); + + fVrmlDefinitionAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlDefinition, SYNS_FriendlyAttrVrmlDefinition); + fVrmlDefinitionAttri.Style := [fsItalic]; + fVrmlDefinitionAttri.Foreground := clNavy; + fVrmlDefinitionAttri.Background := clRed; + AddAttribute(fVrmlDefinitionAttri); + + fVrmlEventAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlEvent, SYNS_FriendlyAttrVrmlEvent); + fVrmlEventAttri.Style := [fsBold]; + fVrmlEventAttri.Foreground := clRed; + fVrmlEventAttri.Background := clWhite; + AddAttribute(fVrmlEventAttri); + + fVrmlGroupingAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlGrouping, SYNS_FriendlyAttrVrmlGrouping); + fVrmlGroupingAttri.Style := [fsBold]; + fVrmlGroupingAttri.Foreground := clNavy; + fVrmlGroupingAttri.Background := clWhite; + AddAttribute(fVrmlGroupingAttri); + + fVrmlInterpolatorAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlInterpolator, SYNS_FriendlyAttrVrmlInterpolator); + fVrmlInterpolatorAttri.Style := [fsItalic]; + fVrmlInterpolatorAttri.Foreground := clLime; + fVrmlInterpolatorAttri.Background := clWhite; + AddAttribute(fVrmlInterpolatorAttri); + + fVrmlLightAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlLight, SYNS_FriendlyAttrVrmlLight); + fVrmlLightAttri.Style := [fsItalic]; + fVrmlLightAttri.Foreground := clTeal; + fVrmlLightAttri.Background := clWhite; + AddAttribute(fVrmlLightAttri); + + fVrmlNodeAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlNode, SYNS_FriendlyAttrVrmlNode); + fVrmlNodeAttri.Style := [fsItalic, fsBold]; + fVrmlNodeAttri.Foreground := clGreen; + fVrmlNodeAttri.Background := clWhite; + AddAttribute(fVrmlNodeAttri); + + fVrmlParameterAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlParameter, SYNS_FriendlyAttrVrmlParameter); + fVrmlParameterAttri.Style := [fsBold]; + fVrmlParameterAttri.Foreground := $F0CAA6; //clSkyBlue + fVrmlParameterAttri.Background := clWhite; + AddAttribute(fVrmlParameterAttri); + + fVrmlprotoAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlProto, SYNS_FriendlyAttrVrmlProto); + fVrmlprotoAttri.Style := [fsBold]; + fVrmlprotoAttri.Foreground := clRed; + fVrmlprotoAttri.Background := clWhite; + AddAttribute(fVrmlprotoAttri); + + fVrmlSensorAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlSensor, SYNS_FriendlyAttrVrmlSensor); + fVrmlSensorAttri.Style := [fsBold]; + fVrmlSensorAttri.Foreground := clOlive; + fVrmlSensorAttri.Background := clWhite; + AddAttribute(fVrmlSensorAttri); + + fVrmlShapeAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlShape, SYNS_FriendlyAttrVrmlShape); + fVrmlShapeAttri.Style := [fsBold]; + fVrmlShapeAttri.Foreground := clPurple; + fVrmlShapeAttri.Background := clWhite; + AddAttribute(fVrmlShapeAttri); + + fVrmlShape_HintAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlShape_Hint, SYNS_FriendlyAttrVrmlShape_Hint); + fVrmlShape_HintAttri.Style := [fsItalic]; + fVrmlShape_HintAttri.Foreground := clPurple; + fVrmlShape_HintAttri.Background := clWhite; + AddAttribute(fVrmlShape_HintAttri); + + fVrmlTime_dependentAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlTime_dependent, SYNS_FriendlyAttrVrmlTime_dependent); + fVrmlTime_dependentAttri.Style := [fsItalic]; + fVrmlTime_dependentAttri.Foreground := clOlive; + fVrmlTime_dependentAttri.Background := clWhite; + AddAttribute(fVrmlTime_dependentAttri); + + fVrmlViewpointAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlViewpoint, SYNS_FriendlyAttrVrmlViewpoint); + fVrmlViewpointAttri.Style := [fsItalic]; + fVrmlViewpointAttri.Foreground := clGreen; + fVrmlViewpointAttri.Background := clWhite; + AddAttribute(fVrmlViewpointAttri); + + fVrmlWorldInfoAttri := TSynHighlighterAttributes.Create(SYNS_AttrVrmlWorldInfo, SYNS_FriendlyAttrVrmlWorldInfo); + fVrmlWorldInfoAttri.Style := [fsItalic]; + fVrmlWorldInfoAttri.Foreground := clMaroon; + fVrmlWorldInfoAttri.Background := clWhite; + AddAttribute(fVrmlWorldInfoAttri); + + fX3DDocTypeAttri := TSynHighLighterAttributes.Create(SYNS_AttrX3DDocType, SYNS_FriendlyAttrX3DDocType); + fX3DDocTypeAttri.Style := [fsItalic]; + fX3DDocTypeAttri.Foreground := clMaroon; + fX3DDocTypeAttri.Background := clWhite; + AddAttribute(fX3DDocTypeAttri); + + fX3DHeaderAttri := TSynHighLighterAttributes.Create(SYNS_AttrX3DHeader, SYNS_FriendlyAttrX3DHeader); + fX3DHeaderAttri.Style := [fsItalic]; + fX3DHeaderAttri.Foreground := clMaroon; + fX3DHeaderAttri.Background := clWhite; + AddAttribute(fX3DHeaderAttri); SetAttributesOnChange(DefHighlightChange); EnumerateKeywords(Ord(tkEvent), Events, IsIdentChar, DoAddKeyword); @@ -662,31 +615,31 @@ constructor TSynVrml97Syn.Create(AOwner: TComponent); EnumerateKeywords(Ord(tkVrmlViewpoint), VrmlViewpoints, IsIdentChar, DoAddKeyword); EnumerateKeywords(Ord(tkVrmlWorldInfo), VrmlWorldInfos, IsIdentChar, DoAddKeyword); - FDefaultFilter := SYNS_FilterVrml97; - FRange := rsNormalText; + fDefaultFilter := SYNS_FilterVrml97; + fRange := rsNormalText; end; destructor TSynVrml97Syn.Destroy; begin - FKeywords.Free; + fKeywords.Free; inherited Destroy; end; procedure TSynVrml97Syn.AndSymbolProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '&']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '&']) then Inc(Run); end; -function TSynVrml97Syn.NextTokenIs(T: UnicodeString): Boolean; +function TSynVrml97Syn.NextTokenIs(T: string): Boolean; var I, Len: Integer; begin Result := True; Len := Length(T); for I := 1 to Len do - if (FLine[Run + I] <> T[I]) then + if (fLine[Run + I] <> T[I]) then begin Result := False; Break; @@ -695,17 +648,17 @@ function TSynVrml97Syn.NextTokenIs(T: UnicodeString): Boolean; procedure TSynVrml97Syn.InCommentProc; begin - if (FLine[Run + 1] = '-') and (FLine[Run + 2] = '-') then + if (fLine[Run + 1] = '-') and (fLine[Run + 2] = '-') then begin Inc(Run); - FTokenID := tkComment; - FRange := rsComment; + fTokenID := tkComment; + fRange := rsComment; Inc(Run, 2); repeat Inc(Run); - if (FLine[Run] = '-') and (FLine[Run + 1] = '-') then + if (fLine[Run] = '-') and (fLine[Run + 1] = '-') then begin - FRange := rsNormalText; + fRange := rsNormalText; Inc(Run, 2); Break; end; @@ -716,11 +669,11 @@ procedure TSynVrml97Syn.InCommentProc; procedure TSynVrml97Syn.DiesisCommentProc; begin - if FLine[Run] = #0 then + if fLine[Run] = #0 then NullProc else begin - FTokenID := tkComment; + fTokenID := tkComment; repeat Inc(Run); until IsLineEnd(Run); @@ -730,25 +683,25 @@ procedure TSynVrml97Syn.DiesisCommentProc; procedure TSynVrml97Syn.X3DHeaderOpenProc; begin Inc(Run); - FRange := rsX3DHeader; + fRange := rsX3DHeader; X3DHeaderProc; - FTokenID := tkX3DHeader; + fTokenID := tkX3DHeader; end; procedure TSynVrml97Syn.X3DHeaderProc; begin - case FLine[Run] of + case fLine[Run] of #0 :NullProc; #10 :LFProc; #13 :CRProc; else begin - FTokenID := tkX3DHeader; + fTokenID := tkX3DHeader; repeat - if (FLine[Run] = '?') then + if (fLine[Run] = '?') then begin Inc(Run, 1); - FRange := rsNormalText; + fRange := rsNormalText; Break; end; if not IsLineEnd(Run) then @@ -762,38 +715,38 @@ procedure TSynVrml97Syn.X3DDocTypeOpenProc; begin if NextTokenIs('DOCTYPE') then begin - FRange := rsX3DDocType; + fRange := rsX3DDocType; X3DDocTypeProc; - FTokenID := tkX3DDocType; + fTokenID := tkX3DDocType; end else if NextTokenIs('--') then begin - FRange := rsComment; + fRange := rsComment; InCommentProc; - FTokenID := tkComment; + fTokenID := tkComment; end else begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); end; end; procedure TSynVrml97Syn.X3DDocTypeProc; begin - case FLine[Run] of + case fLine[Run] of #0 :NullProc; #10 :LFProc; #13 :CRProc; else begin - FTokenID := tkX3DDocType; + fTokenID := tkX3DDocType; repeat - if (FLine[Run + 1] = '>') then + if (fLine[Run + 1] = '>') then begin Inc(Run, 1); - FRange := rsNormalText; + fRange := rsNormalText; Break; end; if not IsLineEnd(Run) then @@ -805,17 +758,17 @@ procedure TSynVrml97Syn.X3DDocTypeProc; procedure TSynVrml97Syn.CommentProc; begin - if FLine[Run] = #0 then + if fLine[Run] = #0 then NullProc else begin - FTokenID := tkComment; + fTokenID := tkComment; repeat - if ((FLine[Run] = '*') and (FLine[Run + 1] = '/')) + if ((fLine[Run] = '*') and (fLine[Run + 1] = '/')) or - ((FLine[Run] = '-') and (FLine[Run + 1] = '-')) then + ((fLine[Run] = '-') and (fLine[Run + 1] = '-')) then begin - FRange := rsNormalText; + fRange := rsNormalText; Inc(Run, 2); Break; end; @@ -826,42 +779,42 @@ procedure TSynVrml97Syn.CommentProc; procedure TSynVrml97Syn.CRProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then Inc(Run); + if fLine[Run] = #10 then Inc(Run); end; procedure TSynVrml97Syn.IdentProc; begin - FTokenID := IdentKind(FLine + Run); - Inc(Run, FStringLen); - while IsIdentChar(FLine[Run]) do + fTokenID := IdentKind(fLine + Run); + Inc(Run, fStringLen); + while IsIdentChar(fLine[Run]) do Inc(Run); end; procedure TSynVrml97Syn.LFProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynVrml97Syn.MinusProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '-', '>']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '-', '>']) then Inc(Run); end; procedure TSynVrml97Syn.ModSymbolProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if FLine[Run] = '=' then Inc(Run); + if fLine[Run] = '=' then Inc(Run); end; procedure TSynVrml97Syn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; @@ -869,7 +822,7 @@ procedure TSynVrml97Syn.NumberProc; function IsNumberChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', '.', 'a'..'f', 'A'..'F', 'x', 'X': Result := True; else @@ -881,7 +834,7 @@ procedure TSynVrml97Syn.NumberProc; idx1: Integer; // token[1] isHex: Boolean; begin - FTokenID := tkNumber; + fTokenID := tkNumber; isHex := False; idx1 := Run; Inc(Run); @@ -911,45 +864,45 @@ procedure TSynVrml97Syn.NumberProc; procedure TSynVrml97Syn.OrSymbolProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '|']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '|']) then Inc(Run); end; procedure TSynVrml97Syn.PlusProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if CharInSet(FLine[Run], ['=', '+']) then Inc(Run); + if CharInSet(fLine[Run], ['=', '+']) then Inc(Run); end; procedure TSynVrml97Syn.PointProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if (FLine[Run] = '.') and (FLine[Run + 1] = '.') then Inc(Run, 2); + if (fLine[Run] = '.') and (fLine[Run + 1] = '.') then Inc(Run, 2); end; procedure TSynVrml97Syn.SlashProc; begin Inc(Run); - case FLine[Run] of + case fLine[Run] of '/' : begin - FTokenID := tkComment; + fTokenID := tkComment; repeat Inc(Run); until IsLineEnd(Run); end; '*' : begin - FTokenID := tkComment; - FRange := rsComment; + fTokenID := tkComment; + fRange := rsComment; repeat Inc(Run); - if (FLine[Run] = '*') and (FLine[Run + 1] = '/') then + if (fLine[Run] = '*') and (fLine[Run + 1] = '/') then begin - FRange := rsNormalText; + fRange := rsNormalText; Inc(Run, 2); Break; end; @@ -958,37 +911,36 @@ procedure TSynVrml97Syn.SlashProc; '=' : begin Inc(Run); - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; else - FTokenID := tkSymbol; + fTokenID := tkSymbol; end; end; procedure TSynVrml97Syn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; + fTokenID := tkSpace; while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynVrml97Syn.StarProc; begin - FTokenID := tkSymbol; + fTokenID := tkSymbol; Inc(Run); - if FLine[Run] = '=' then Inc(Run); + if fLine[Run] = '=' then Inc(Run); end; procedure TSynVrml97Syn.StringProc; var - l_strChar: UnicodeString; + l_strChar: string; begin - FTokenID := tkString; + fTokenID := tkString; l_strChar := FLine[Run]; // We could have '"' or #39 if (FLine[Run + 1] = l_strChar) and (FLine[Run + 2] = l_strChar) then Inc(Run, 2); repeat - if IsLineEnd(Run) then - Break; + if IsLineEnd(Run) then Break; Inc(Run); until (FLine[Run] = l_strChar) and (FLine[Pred(Run)] <> '\'); if not IsLineEnd(Run) then @@ -998,24 +950,24 @@ procedure TSynVrml97Syn.StringProc; procedure TSynVrml97Syn.SymbolProc; begin Inc(Run); - FTokenID := tkSymbol; + fTokenId := tkSymbol; end; procedure TSynVrml97Syn.UnknownProc; begin Inc(Run); - FTokenID := tkUnknown; + fTokenID := tkUnknown; end; procedure TSynVrml97Syn.Next; begin - FTokenPos := Run; - case FRange of + fTokenPos := Run; + case fRange of rsX3DHeader: X3DHeaderProc; rsX3DDocType: X3DDocTypeProc; rsComment: CommentProc; else - case FLine[Run] of + case fLine[Run] of '&': AndSymbolProc; #13: CRProc; '#': DiesisCommentProc; @@ -1041,15 +993,15 @@ procedure TSynVrml97Syn.Next; inherited; end; -function TSynVrml97Syn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; +function TSynVrml97Syn.GetDefaultAttribute(Index :Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FIdentifierAttri; - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_STRING: Result := FStringAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fIdentifierAttri; + SYN_ATTR_KEYWORD: Result := fKeyAttri; + SYN_ATTR_STRING: Result := fStringAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -1057,51 +1009,51 @@ function TSynVrml97Syn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttri function TSynVrml97Syn.GetEol: Boolean; begin - Result := FTokenID = tkNull; + Result := fTokenID = tkNull; end; function TSynVrml97Syn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; function TSynVrml97Syn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynVrml97Syn.GetTokenAttribute: TSynHighlighterAttributes; begin case GetTokenID of - tkComment: Result := FCommentAttri; - tkIdentifier: Result := FIdentifierAttri; - tkKey: Result := FKeyAttri; - tkNonReservedKey: Result := FNonReservedKeyAttri; - tkEvent: Result := FEventAttri; - tkNumber: Result := FNumberAttri; - tkSpace: Result := FSpaceAttri; - tkString: Result := FStringAttri; - tkSymbol: Result := FSymbolAttri; - tkUnknown: Result := FIdentifierAttri; + tkComment: Result := fCommentAttri; + tkIdentifier: Result := fIdentifierAttri; + tkKey: Result := fKeyAttri; + tkNonReservedKey: Result := fNonReservedKeyAttri; + tkEvent: Result := fEventAttri; + tkNumber: Result := fNumberAttri; + tkSpace: Result := fSpaceAttri; + tkString: Result := fStringAttri; + tkSymbol: Result := fSymbolAttri; + tkUnknown: Result := fIdentifierAttri; // vrml - tkVrmlAppearance: Result := FVrmlAppearanceAttri; - tkVrmlAttribute: Result := FVrmlAttributeAttri; - tkVrmlDefinition: Result := FVrmlDefinitionAttri; - tkVrmlEvent: Result := FVrmlEventAttri; - tkVrmlGrouping: Result := FVrmlGroupingAttri; - tkVrmlInterpolator: Result := FVrmlInterpolatorAttri; - tkVrmlLight: Result := FVrmlLightAttri; - tkVrmlNode: Result := FVrmlNodeAttri; - tkVrmlParameter: Result := FVrmlParameterAttri; - tkVrmlproto: Result := FVrmlprotoAttri; - tkVrmlSensor: Result := FVrmlSensorAttri; - tkVrmlShape: Result := FVrmlShapeAttri; - tkVrmlShape_Hint: Result := FVrmlShape_HintAttri; - tkVrmlTime_dependent: Result := FVrmlTime_dependentAttri; - tkVrmlViewpoint: Result := FVrmlViewpointAttri; - tkVrmlWorldInfo: Result := FVrmlWorldInfoAttri; - tkX3DDocType: Result := FX3DDocTypeAttri; - tkX3DHeader: Result := FX3DHeaderAttri; + tkVrmlAppearance: Result := fVrmlAppearanceAttri; + tkVrmlAttribute: Result := fVrmlAttributeAttri; + tkVrmlDefinition: Result := fVrmlDefinitionAttri; + tkVrmlEvent: Result := fVrmlEventAttri; + tkVrmlGrouping: Result := fVrmlGroupingAttri; + tkVrmlInterpolator: Result := fVrmlInterpolatorAttri; + tkVrmlLight: Result := fVrmlLightAttri; + tkVrmlNode: Result := fVrmlNodeAttri; + tkVrmlParameter: Result := fVrmlParameterAttri; + tkVrmlproto: Result := fVrmlprotoAttri; + tkVrmlSensor: Result := fVrmlSensorAttri; + tkVrmlShape: Result := fVrmlShapeAttri; + tkVrmlShape_Hint: Result := fVrmlShape_HintAttri; + tkVrmlTime_dependent: Result := fVrmlTime_dependentAttri; + tkVrmlViewpoint: Result := fVrmlViewpointAttri; + tkVrmlWorldInfo: Result := fVrmlWorldInfoAttri; + tkX3DDocType: Result := fX3DDocTypeAttri; + tkX3DHeader: Result := fX3DHeaderAttri; //-- else Result := nil; @@ -1110,22 +1062,22 @@ function TSynVrml97Syn.GetTokenAttribute: TSynHighlighterAttributes; function TSynVrml97Syn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; procedure TSynVrml97Syn.ResetRange; begin - FRange := rsNormalText; + fRange := rsNormalText; end; procedure TSynVrml97Syn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; function TSynVrml97Syn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterVrml97; + Result := fDefaultFilter <> SYNS_FilterVrml97; end; class function TSynVrml97Syn.GetLanguageName: string; @@ -1133,7 +1085,7 @@ class function TSynVrml97Syn.GetLanguageName: string; Result := SYNS_LangVrml97; end; -function TSynVrml97Syn.GetSampleSource: UnicodeString; +function TSynVrml97Syn.GetSampleSource: string; begin Result := '#VRML V2.0 utf8'#13#10 + @@ -1194,13 +1146,11 @@ function TSynVrml97Syn.GetSampleSource: UnicodeString; '}'; end; -class function TSynVrml97Syn.GetFriendlyLanguageName: UnicodeString; +class function TSynVrml97Syn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangVrml97; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynVrml97Syn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterWebIDL.pas b/Ext/SynEdit/Source/SynHighlighterWebIDL.pas index 47726f9..fe488d8 100644 --- a/Ext/SynEdit/Source/SynHighlighterWebIDL.pas +++ b/Ext/SynEdit/Source/SynHighlighterWebIDL.pas @@ -26,12 +26,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -------------------------------------------------------------------------------} unit SynHighlighterWebIDL; @@ -343,7 +337,7 @@ function TSynWebIDLSyn.HashKey(Str: PWideChar): Cardinal; while IsIdentChar(Str^) do begin Result := Result * 622 + Ord(Str^) * 657; - inc(Str); + Inc(Str); end; Result := Result mod 59; fStringLen := Str - fToIdent; @@ -673,15 +667,15 @@ function TSynWebIDLSyn.IdentKind(MayBe: PWideChar): TtkTokenKind; procedure TSynWebIDLSyn.SpaceProc; begin - inc(Run); + Inc(Run); fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynWebIDLSyn.NullProc; begin fTokenID := tkNull; - inc(Run); + Inc(Run); end; procedure TSynWebIDLSyn.NumberProc; @@ -746,9 +740,9 @@ procedure TSynWebIDLSyn.QuestionMarkProc; procedure TSynWebIDLSyn.CRProc; begin fTokenID := tkSpace; - inc(Run); + Inc(Run); if fLine[Run] = #10 then - inc(Run); + Inc(Run); end; procedure TSynWebIDLSyn.GreaterProc; @@ -768,7 +762,7 @@ procedure TSynWebIDLSyn.LessProc; procedure TSynWebIDLSyn.LFProc; begin fTokenID := tkSpace; - inc(Run); + Inc(Run); end; procedure TSynWebIDLSyn.SlashProc; @@ -888,7 +882,7 @@ procedure TSynWebIDLSyn.SquareCloseProc; procedure TSynWebIDLSyn.UnknownProc; begin - inc(Run); + Inc(Run); fTokenID := tkUnknown; end; @@ -1042,7 +1036,5 @@ function TSynWebIDLSyn.GetRange: Pointer; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynWebIDLSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterXML.pas b/Ext/SynEdit/Source/SynHighlighterXML.pas index 8fdc1a4..c48e85f 100644 --- a/Ext/SynEdit/Source/SynHighlighterXML.pas +++ b/Ext/SynEdit/Source/SynHighlighterXML.pas @@ -26,11 +26,6 @@ If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: SynHighlighterXML.pas,v 1.11.2.6 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - History: ------------------------------------------------------------------------------- 2000-11-30 Removed mHashTable and MakeIdentTable per Michael Hieke @@ -61,9 +56,6 @@ interface SynEditHighlighter, SynUnicode, SysUtils, -{$IFDEF SYN_CodeFolding} - SynEditCodeFolding, -{$ENDIF} Classes; type @@ -93,27 +85,23 @@ interface rsDocTypeQuoteEntityRef} ); -{$IFDEF SYN_CodeFolding} - TSynXMLSyn = class(TSynCustomCodeFoldingHighlighter) -{$ELSE} TSynXMLSyn = class(TSynCustomHighlighter) -{$ENDIF} private - FRange: TRangeState; - FTokenID: TtkTokenKind; - FElementAttri: TSynHighlighterAttributes; - FSpaceAttri: TSynHighlighterAttributes; - FTextAttri: TSynHighlighterAttributes; - FEntityRefAttri: TSynHighlighterAttributes; - FProcessingInstructionAttri: TSynHighlighterAttributes; - FCDATAAttri: TSynHighlighterAttributes; - FCommentAttri: TSynHighlighterAttributes; - FDocTypeAttri: TSynHighlighterAttributes; - FAttributeAttri: TSynHighlighterAttributes; - FnsAttributeAttri: TSynHighlighterAttributes; - FAttributeValueAttri: TSynHighlighterAttributes; - FnsAttributeValueAttri: TSynHighlighterAttributes; - FSymbolAttri: TSynHighlighterAttributes; + fRange: TRangeState; + fTokenID: TtkTokenKind; + fElementAttri: TSynHighlighterAttributes; + fSpaceAttri: TSynHighlighterAttributes; + fTextAttri: TSynHighlighterAttributes; + fEntityRefAttri: TSynHighlighterAttributes; + fProcessingInstructionAttri: TSynHighlighterAttributes; + fCDATAAttri: TSynHighlighterAttributes; + fCommentAttri: TSynHighlighterAttributes; + fDocTypeAttri: TSynHighlighterAttributes; + fAttributeAttri: TSynHighlighterAttributes; + fnsAttributeAttri: TSynHighlighterAttributes; + fAttributeValueAttri: TSynHighlighterAttributes; + fnsAttributeValueAttri: TSynHighlighterAttributes; + fSymbolAttri: TSynHighlighterAttributes; FWantBracesParsed: Boolean; procedure NullProc; procedure CarriageReturnProc; @@ -133,17 +121,17 @@ TSynXMLSyn = class(TSynCustomHighlighter) procedure EqualProc; procedure IdentProc; procedure NextProcedure; - function NextTokenIs(Token: UnicodeString): Boolean; + function NextTokenIs(Token: string): Boolean; procedure EntityRefProc; procedure QEntityRefProc; procedure AEntityRefProc; protected - function GetSampleSource: UnicodeString; override; + function GetSampleSource: string; override; function IsFilterStored: Boolean; override; function IsNameChar: Boolean; virtual; public class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; + class function GetFriendlyLanguageName: string; override; public constructor Create(AOwner: TComponent); override; function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; @@ -156,38 +144,34 @@ TSynXMLSyn = class(TSynCustomHighlighter) procedure Next; override; procedure SetRange(Value: Pointer); override; procedure ResetRange; override; -{$IFDEF SYN_CodeFolding} - procedure ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine: Integer; ToLine: Integer); override; -{$ENDIF} published - property ElementAttri: TSynHighlighterAttributes read FElementAttri - write FElementAttri; - property AttributeAttri: TSynHighlighterAttributes read FAttributeAttri - write FAttributeAttri; + property ElementAttri: TSynHighlighterAttributes read fElementAttri + write fElementAttri; + property AttributeAttri: TSynHighlighterAttributes read fAttributeAttri + write fAttributeAttri; property NamespaceAttributeAttri: TSynHighlighterAttributes - read FnsAttributeAttri write FnsAttributeAttri; + read fnsAttributeAttri write fnsAttributeAttri; property AttributeValueAttri: TSynHighlighterAttributes - read FAttributeValueAttri write FAttributeValueAttri; + read fAttributeValueAttri write fAttributeValueAttri; property NamespaceAttributeValueAttri: TSynHighlighterAttributes - read FnsAttributeValueAttri write FnsAttributeValueAttri; - property TextAttri: TSynHighlighterAttributes read FTextAttri - write FTextAttri; - property CDATAAttri: TSynHighlighterAttributes read FCDATAAttri - write FCDATAAttri; - property EntityRefAttri: TSynHighlighterAttributes read FEntityRefAttri - write FEntityRefAttri; + read fnsAttributeValueAttri write fnsAttributeValueAttri; + property TextAttri: TSynHighlighterAttributes read fTextAttri + write fTextAttri; + property CDATAAttri: TSynHighlighterAttributes read fCDATAAttri + write fCDATAAttri; + property EntityRefAttri: TSynHighlighterAttributes read fEntityRefAttri + write fEntityRefAttri; property ProcessingInstructionAttri: TSynHighlighterAttributes - read FProcessingInstructionAttri write FProcessingInstructionAttri; - property CommentAttri: TSynHighlighterAttributes read FCommentAttri - write FCommentAttri; - property DocTypeAttri: TSynHighlighterAttributes read FDocTypeAttri - write FDocTypeAttri; - property SpaceAttri: TSynHighlighterAttributes read FSpaceAttri - write FSpaceAttri; - property SymbolAttri: TSynHighlighterAttributes read FSymbolAttri - write FSymbolAttri; - property WantBracesParsed : Boolean read FWantBracesParsed + read fProcessingInstructionAttri write fProcessingInstructionAttri; + property CommentAttri: TSynHighlighterAttributes read fCommentAttri + write fCommentAttri; + property DocTypeAttri: TSynHighlighterAttributes read fDocTypeAttri + write fDocTypeAttri; + property SpaceAttri: TSynHighlighterAttributes read fSpaceAttri + write fSpaceAttri; + property SymbolAttri: TSynHighlighterAttributes read fSymbolAttri + write fSymbolAttri; + property WantBracesParsed: Boolean read FWantBracesParsed write FWantBracesParsed default True; end; @@ -200,109 +184,111 @@ constructor TSynXMLSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - FCaseSensitive := True; + fCaseSensitive := True; - FElementAttri := TSynHighlighterAttributes.Create(SYNS_AttrElementName, SYNS_FriendlyAttrElementName); - FTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText); - FSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrWhitespace, SYNS_FriendlyAttrWhitespace); - FEntityRefAttri := TSynHighlighterAttributes.Create(SYNS_AttrEntityReference, SYNS_FriendlyAttrEntityReference); - FProcessingInstructionAttri := TSynHighlighterAttributes.Create( + fElementAttri := TSynHighlighterAttributes.Create(SYNS_AttrElementName, SYNS_FriendlyAttrElementName); + fTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText); + fSpaceAttri := TSynHighlighterAttributes.Create(SYNS_AttrWhitespace, SYNS_FriendlyAttrWhitespace); + fEntityRefAttri := TSynHighlighterAttributes.Create(SYNS_AttrEntityReference, SYNS_FriendlyAttrEntityReference); + fProcessingInstructionAttri := TSynHighlighterAttributes.Create( SYNS_AttrProcessingInstr, SYNS_FriendlyAttrProcessingInstr); - FCDATAAttri := TSynHighlighterAttributes.Create(SYNS_AttrCDATASection, SYNS_FriendlyAttrCDATASection); - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FDocTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDOCTYPESection, SYNS_FriendlyAttrDOCTYPESection); - FAttributeAttri := TSynHighlighterAttributes.Create(SYNS_AttrAttributeName, SYNS_FriendlyAttrAttributeName); - FnsAttributeAttri := TSynHighlighterAttributes.Create( + fCDATAAttri := TSynHighlighterAttributes.Create(SYNS_AttrCDATASection, SYNS_FriendlyAttrCDATASection); + fCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); + fDocTypeAttri := TSynHighlighterAttributes.Create(SYNS_AttrDOCTYPESection, SYNS_FriendlyAttrDOCTYPESection); + fAttributeAttri := TSynHighlighterAttributes.Create(SYNS_AttrAttributeName, SYNS_FriendlyAttrAttributeName); + fnsAttributeAttri := TSynHighlighterAttributes.Create( SYNS_AttrNamespaceAttrName, SYNS_FriendlyAttrNamespaceAttrName); - FAttributeValueAttri := TSynHighlighterAttributes.Create( + fAttributeValueAttri := TSynHighlighterAttributes.Create( SYNS_AttrAttributeValue, SYNS_FriendlyAttrAttributeValue); - FnsAttributeValueAttri := TSynHighlighterAttributes.Create( + fnsAttributeValueAttri := TSynHighlighterAttributes.Create( SYNS_AttrNamespaceAttrValue, SYNS_FriendlyAttrNamespaceAttrValue); - FSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); + fSymbolAttri := TSynHighlighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); - FElementAttri.Foreground := clMaroon; - FElementAttri.Style := [fsBold]; + fElementAttri.Foreground := clMaroon; + fElementAttri.Style := [fsBold]; - FDocTypeAttri.Foreground := clblue; - FDocTypeAttri.Style := [fsItalic]; + fDocTypeAttri.Foreground := clblue; + fDocTypeAttri.Style := [fsItalic]; - FCDATAAttri.Foreground := clOlive; - FCDATAAttri.Style := [fsItalic]; + fCDATAAttri.Foreground := clOlive; + fCDATAAttri.Style := [fsItalic]; - FEntityRefAttri.Foreground := clblue; - FEntityRefAttri.Style := [fsbold]; + fEntityRefAttri.Foreground := clblue; + fEntityRefAttri.Style := [fsbold]; - FProcessingInstructionAttri.Foreground:= clblue; - FProcessingInstructionAttri.Style:= []; + fProcessingInstructionAttri.Foreground:= clblue; + fProcessingInstructionAttri.Style:= []; - FTextAttri.Foreground := clBlack; - FTextAttri.Style := [fsBold]; + fTextAttri.Foreground := clBlack; + fTextAttri.Style := [fsBold]; - FAttributeAttri.Foreground := clMaroon; - FAttributeAttri.Style := []; + fAttributeAttri.Foreground := clMaroon; + fAttributeAttri.Style := []; - FnsAttributeAttri.Foreground := clRed; - FnsAttributeAttri.Style := []; + fnsAttributeAttri.Foreground := clRed; + fnsAttributeAttri.Style := []; - FAttributeValueAttri.Foreground := clNavy; - FAttributeValueAttri.Style := [fsBold]; + fAttributeValueAttri.Foreground := clNavy; + fAttributeValueAttri.Style := [fsBold]; - FnsAttributeValueAttri.Foreground := clRed; - FnsAttributeValueAttri.Style := [fsBold]; + fnsAttributeValueAttri.Foreground := clRed; + fnsAttributeValueAttri.Style := [fsBold]; - FCommentAttri.Background := clSilver; - FCommentAttri.Foreground := clGray; - FCommentAttri.Style := [fsbold, fsItalic]; + fCommentAttri.Background := clSilver; + fCommentAttri.Foreground := clGray; + fCommentAttri.Style := [fsbold, fsItalic]; - FSymbolAttri.Foreground := clblue; - FSymbolAttri.Style := []; + fSymbolAttri.Foreground := clblue; + fSymbolAttri.Style := []; - AddAttribute(FSymbolAttri); - AddAttribute(FProcessingInstructionAttri); - AddAttribute(FDocTypeAttri); - AddAttribute(FCommentAttri); - AddAttribute(FElementAttri); - AddAttribute(FAttributeAttri); - AddAttribute(FnsAttributeAttri); - AddAttribute(FAttributeValueAttri); - AddAttribute(FnsAttributeValueAttri); - AddAttribute(FEntityRefAttri); - AddAttribute(FCDATAAttri); - AddAttribute(FSpaceAttri); - AddAttribute(FTextAttri); + AddAttribute(fSymbolAttri); + AddAttribute(fProcessingInstructionAttri); + AddAttribute(fDocTypeAttri); + AddAttribute(fCommentAttri); + AddAttribute(fElementAttri); + AddAttribute(fAttributeAttri); + AddAttribute(fnsAttributeAttri); + AddAttribute(fAttributeValueAttri); + AddAttribute(fnsAttributeValueAttri); + AddAttribute(fEntityRefAttri); + AddAttribute(fCDATAAttri); + AddAttribute(fSpaceAttri); + AddAttribute(fTextAttri); SetAttributesOnChange(DefHighlightChange); - FRange := rsText; - FDefaultFilter := SYNS_FilterXML; + fRange := rsText; + fDefaultFilter := SYNS_FilterXML; + + fBrackets := '<>()[]'; end; procedure TSynXMLSyn.NullProc; begin - FTokenID := tkNull; + fTokenID := tkNull; Inc(Run); end; procedure TSynXMLSyn.CarriageReturnProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); - if FLine[Run] = #10 then Inc(Run); + if fLine[Run] = #10 then Inc(Run); end; procedure TSynXMLSyn.LineFeedProc; begin - FTokenID := tkSpace; + fTokenID := tkSpace; Inc(Run); end; procedure TSynXMLSyn.SpaceProc; begin Inc(Run); - FTokenID := tkSpace; - while FLine[Run] <= #32 do + fTokenID := tkSpace; + while fLine[Run] <= #32 do begin - if CharInSet(FLine[Run], [#0, #9, #10, #13]) then Break; + if CharInSet(fLine[Run], [#0, #9, #10, #13]) then break; Inc(Run); end; end; @@ -310,67 +296,67 @@ procedure TSynXMLSyn.SpaceProc; procedure TSynXMLSyn.LessThanProc; begin Inc(Run); - if (FLine[Run] = '/') then + if (fLine[Run] = '/') then Inc(Run); - if (FLine[Run] = '!') then + if (fLine[Run] = '!') then begin if NextTokenIs('--') then begin - FTokenID := tkSymbol; - FRange := rsComment; + fTokenID := tkSymbol; + fRange := rsComment; Inc(Run, 3); end else if NextTokenIs('DOCTYPE') then begin - FTokenID := tkDocType; - FRange := rsDocType; + fTokenID := tkDocType; + fRange := rsDocType; Inc(Run, 7); end else if NextTokenIs('[CDATA[') then begin - FTokenID := tkCDATA; - FRange := rsCDATA; + fTokenID := tkCDATA; + fRange := rsCDATA; Inc(Run, 7); end else begin - FTokenID := tkSymbol; - FRange := rsElement; + fTokenID := tkSymbol; + fRange := rsElement; Inc(Run); end; end - else if FLine[Run]= '?' then + else if fLine[Run]= '?' then begin - FTokenID := tkProcessingInstruction; - FRange := rsProcessingInstruction; + fTokenID := tkProcessingInstruction; + fRange := rsProcessingInstruction; Inc(Run); end else begin - FTokenID := tkSymbol; - FRange := rsElement; + fTokenID := tkSymbol; + fRange := rsElement; end; end; procedure TSynXMLSyn.GreaterThanProc; begin - FTokenID := tkSymbol; - FRange:= rsText; + fTokenId := tkSymbol; + fRange:= rsText; Inc(Run); end; procedure TSynXMLSyn.CommentProc; begin - if (FLine[Run] = '-') and (FLine[Run + 1] = '-') and (FLine[Run + 2] = '>') then + if (fLine[Run] = '-') and (fLine[Run + 1] = '-') and (fLine[Run + 2] = '>') then begin - FTokenID := tkSymbol; - FRange := rsText; + fTokenID := tkSymbol; + fRange := rsText; Inc(Run, 3); Exit; end; - FTokenID := tkComment; + fTokenID := tkComment; if IsLineEnd(Run) then begin @@ -380,9 +366,9 @@ procedure TSynXMLSyn.CommentProc; while not IsLineEnd(Run) do begin - if (FLine[Run] = '-') and (FLine[Run + 1] = '-') and (FLine[Run + 2] = '>') then + if (fLine[Run] = '-') and (fLine[Run + 1] = '-') and (fLine[Run + 2] = '>') then begin - FRange := rsComment; + fRange := rsComment; Break; end; Inc(Run); @@ -391,7 +377,7 @@ procedure TSynXMLSyn.CommentProc; procedure TSynXMLSyn.ProcessingInstructionProc; begin - FTokenID := tkProcessingInstruction; + fTokenID := tkProcessingInstruction; if IsLineEnd(Run) then begin NextProcedure; @@ -400,10 +386,10 @@ procedure TSynXMLSyn.ProcessingInstructionProc; while not IsLineEnd(Run) do begin - if (FLine[Run] = '>') and (FLine[Run - 1] = '?') + if (fLine[Run] = '>') and (fLine[Run - 1] = '?') then begin - FRange := rsText; + fRange := rsText; Inc(Run); Break; end; @@ -413,7 +399,7 @@ procedure TSynXMLSyn.ProcessingInstructionProc; procedure TSynXMLSyn.DocTypeProc; begin - FTokenID := tkDocType; + fTokenID := tkDocType; if IsLineEnd(Run) then begin @@ -421,17 +407,17 @@ procedure TSynXMLSyn.DocTypeProc; Exit; end; - case FRange of + case fRange of rsDocType: begin while not IsLineEnd(Run) do begin - case FLine[Run] of + case fLine[Run] of '[': begin while True do begin Inc(Run); - case FLine[Run] of + case fLine[Run] of ']': begin Inc(Run); @@ -439,14 +425,14 @@ procedure TSynXMLSyn.DocTypeProc; end; #0, #10, #13: begin - FRange := rsDocTypeSquareBraces; + fRange := rsDocTypeSquareBraces; Exit; end; end; end; end; '>': begin - FRange := rsAttribute; + fRange := rsAttribute; Inc(Run); Break; end; @@ -458,9 +444,9 @@ procedure TSynXMLSyn.DocTypeProc; begin while not IsLineEnd(Run) do begin - if (FLine[Run] = ']') then + if (fLine[Run] = ']') then begin - FRange := rsDocType; + fRange := rsDocType; Inc(Run); Exit; end; @@ -472,7 +458,7 @@ procedure TSynXMLSyn.DocTypeProc; procedure TSynXMLSyn.CDATAProc; begin - FTokenID := tkCDATA; + fTokenID := tkCDATA; if IsLineEnd(Run) then begin NextProcedure; @@ -481,10 +467,10 @@ procedure TSynXMLSyn.CDATAProc; while not IsLineEnd(Run) do begin - if (FLine[Run] = '>') and (FLine[Run - 1] = ']') + if (fLine[Run] = '>') and (fLine[Run - 1] = ']') then begin - FRange := rsText; + fRange := rsText; Inc(Run); Break; end; @@ -494,19 +480,19 @@ procedure TSynXMLSyn.CDATAProc; procedure TSynXMLSyn.ElementProc; begin - if FLine[Run] = '/' then Inc(Run); + if fLine[Run] = '/' then Inc(Run); while IsNameChar do Inc(Run); - FRange := rsAttribute; - FTokenID := tkElement; + fRange := rsAttribute; + fTokenID := tkElement; end; procedure TSynXMLSyn.AttributeProc; begin //Check if we are starting on a closing quote - if CharInSet(FLine[Run], [#34, #39]) then + if CharInSet(fLine[Run], [#34, #39]) then begin - FTokenID := tkSymbol; - FRange := rsAttribute; + fTokenID := tkSymbol; + fRange := rsAttribute; Inc(Run); Exit; end; @@ -515,47 +501,47 @@ procedure TSynXMLSyn.AttributeProc; //Check if this is an xmlns: attribute if (Pos('xmlns', GetToken) > 0) then begin - FTokenID := tknsAttribute; - FRange := rsnsEqual; + fTokenID := tknsAttribute; + fRange := rsnsEqual; end else begin - FTokenID := tkAttribute; - FRange := rsEqual; + fTokenID := tkAttribute; + fRange := rsEqual; end; end; procedure TSynXMLSyn.EqualProc; begin - if FRange = rsnsEqual then - FTokenID := tknsEqual + if fRange = rsnsEqual then + fTokenID := tknsEqual else - FTokenID := tkEqual; + fTokenID := tkEqual; while not IsLineEnd(Run) do begin - if (FLine[Run] = '/') then + if (fLine[Run] = '/') then begin - FTokenID := tkSymbol; - FRange := rsElement; + fTokenID := tkSymbol; + fRange := rsElement; Inc(Run); Exit; end - else if (FLine[Run] = #34) then + else if (fLine[Run] = #34) then begin - if FRange = rsnsEqual then - FRange := rsnsQuoteAttrValue + if fRange = rsnsEqual then + fRange := rsnsQuoteAttrValue else - FRange := rsQuoteAttrValue; + fRange := rsQuoteAttrValue; Inc(Run); Exit; end - else if (FLine[Run] = #39) then + else if (fLine[Run] = #39) then begin - if FRange = rsnsEqual then - FRange := rsnsAPosAttrValue + if fRange = rsnsEqual then + fRange := rsnsAPosAttrValue else - FRange := rsAPosAttrValue; + fRange := rsAPosAttrValue; Inc(Run); Exit; end; @@ -565,115 +551,115 @@ procedure TSynXMLSyn.EqualProc; procedure TSynXMLSyn.QAttributeValueProc; begin - if FRange = rsnsQuoteAttrValue then - FTokenID := tknsQuoteAttrValue + if fRange = rsnsQuoteAttrValue then + fTokenID := tknsQuoteAttrValue else - FTokenID := tkQuoteAttrValue; + fTokenID := tkQuoteAttrValue; - while not (IsLineEnd(Run) or (FLine[Run] = '&') or (FLine[Run] = #34)) do + while not (IsLineEnd(Run) or (fLine[Run] = '&') or (fLine[Run] = #34)) do Inc(Run); - if FLine[Run] = '&' then + if fLine[Run] = '&' then begin - if FRange = rsnsQuoteAttrValue then - FRange := rsnsQuoteEntityRef + if fRange = rsnsQuoteAttrValue then + fRange := rsnsQuoteEntityRef else - FRange := rsQuoteEntityRef; + fRange := rsQuoteEntityRef; Exit; end - else if FLine[Run] <> #34 then + else if fLine[Run] <> #34 then Exit; - FRange := rsAttribute; + fRange := rsAttribute; end; procedure TSynXMLSyn.AAttributeValueProc; begin - if FRange = rsnsAPosAttrValue then - FTokenID := tknsAPosAttrValue + if fRange = rsnsAPosAttrValue then + fTokenID := tknsAPosAttrValue else - FTokenID := tkAPosAttrValue; + fTokenID := tkAPosAttrValue; - while not (IsLineEnd(Run) or (FLine[Run] = '&') or (FLine[Run] = #39)) do + while not (IsLineEnd(Run) or (fLine[Run] = '&') or (fLine[Run] = #39)) do Inc(Run); - if FLine[Run] = '&' then + if fLine[Run] = '&' then begin - if FRange = rsnsAPosAttrValue then - FRange := rsnsAPosEntityRef + if fRange = rsnsAPosAttrValue then + fRange := rsnsAPosEntityRef else - FRange := rsAPosEntityRef; + fRange := rsAPosEntityRef; Exit; end - else if FLine[Run] <> #39 then + else if fLine[Run] <> #39 then Exit; - FRange := rsAttribute; + fRange := rsAttribute; end; procedure TSynXMLSyn.TextProc; begin - if (FLine[Run] <= #31) or (FLine[Run] = '<') then + if (fLine[Run] <= #31) or (fLine[Run] = '<') then begin NextProcedure; Exit; end; - FTokenID := tkText; - while not ((FLine[Run] <= #31) or (FLine[Run] = '<') or (FLine[Run] = '&')) do + fTokenID := tkText; + while not ((fLine[Run] <= #31) or (fLine[Run] = '<') or (fLine[Run] = '&')) do Inc(Run); - if (FLine[Run] = '&') then + if (fLine[Run] = '&') then begin - FRange := rsEntityRef; + fRange := rsEntityRef; Exit; end; end; procedure TSynXMLSyn.EntityRefProc; begin - FTokenID := tkEntityRef; - FRange := rsEntityRef; - while not ((FLine[Run] <= #32) or (FLine[Run] = ';')) do Inc(Run); - if (FLine[Run] = ';') then Inc(Run); - FRange := rsText; + fTokenID := tkEntityRef; + fRange := rsEntityRef; + while not ((fLine[Run] <= #32) or (fLine[Run] = ';')) do Inc(Run); + if (fLine[Run] = ';') then Inc(Run); + fRange := rsText; end; procedure TSynXMLSyn.QEntityRefProc; begin - if FRange = rsnsQuoteEntityRef then - FTokenID := tknsQuoteEntityRef + if fRange = rsnsQuoteEntityRef then + fTokenID := tknsQuoteEntityRef else - FTokenID := tkQuoteEntityRef; + fTokenID := tkQuoteEntityRef; - while not ((FLine[Run] <= #32) or (FLine[Run] = ';')) do Inc(Run); - if (FLine[Run] = ';') then Inc(Run); + while not ((fLine[Run] <= #32) or (fLine[Run] = ';')) do Inc(Run); + if (fLine[Run] = ';') then Inc(Run); - if FRange = rsnsQuoteEntityRef then - FRange := rsnsQuoteAttrValue + if fRange = rsnsQuoteEntityRef then + fRange := rsnsQuoteAttrValue else - FRange := rsQuoteAttrValue; + fRange := rsQuoteAttrValue; end; procedure TSynXMLSyn.AEntityRefProc; begin - if FRange = rsnsAPosEntityRef then - FTokenID := tknsAPosEntityRef + if fRange = rsnsAPosEntityRef then + fTokenID := tknsAPosEntityRef else - FTokenID := tkAPosEntityRef; + fTokenID := tkAPosEntityRef; - while not ((FLine[Run] <= #32) or (FLine[Run] = ';')) do Inc(Run); - if (FLine[Run] = ';') then Inc(Run); + while not ((fLine[Run] <= #32) or (fLine[Run] = ';')) do Inc(Run); + if (fLine[Run] = ';') then Inc(Run); - if FRange = rsnsAPosEntityRef then - FRange := rsnsAPosAttrValue + if fRange = rsnsAPosEntityRef then + fRange := rsnsAPosAttrValue else - FRange := rsAPosAttrValue; + fRange := rsAPosAttrValue; end; procedure TSynXMLSyn.IdentProc; begin - case FRange of + case fRange of rsElement: begin ElementProc; @@ -712,8 +698,8 @@ procedure TSynXMLSyn.IdentProc; procedure TSynXMLSyn.Next; begin - FTokenPos := Run; - case FRange of + fTokenPos := Run; + case fRange of rsText: TextProc; rsComment: CommentProc; rsProcessingInstruction: ProcessingInstructionProc; @@ -728,7 +714,7 @@ procedure TSynXMLSyn.Next; procedure TSynXMLSyn.NextProcedure; begin - case FLine[Run] of + case fLine[Run] of #0: NullProc; #10: LineFeedProc; #13: CarriageReturnProc; @@ -739,14 +725,14 @@ procedure TSynXMLSyn.NextProcedure; end; end; -function TSynXMLSyn.NextTokenIs(Token: UnicodeString): Boolean; +function TSynXMLSyn.NextTokenIs(Token: string): Boolean; var I, Len: Integer; begin Result := True; Len := Length(Token); for I := 1 to Len do - if (FLine[Run + I] <> Token[I]) then + if (fLine[Run + I] <> Token[I]) then begin Result:= False; Break; @@ -756,11 +742,11 @@ function TSynXMLSyn.NextTokenIs(Token: UnicodeString): Boolean; function TSynXMLSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; begin case Index of - SYN_ATTR_COMMENT: Result := FCommentAttri; - SYN_ATTR_IDENTIFIER: Result := FAttributeAttri; - SYN_ATTR_KEYWORD: Result := FElementAttri; - SYN_ATTR_WHITESPACE: Result := FSpaceAttri; - SYN_ATTR_SYMBOL: Result := FSymbolAttri; + SYN_ATTR_COMMENT: Result := fCommentAttri; + SYN_ATTR_IDENTIFIER: Result := fAttributeAttri; + SYN_ATTR_KEYWORD: Result := fElementAttri; + SYN_ATTR_WHITESPACE: Result := fSpaceAttri; + SYN_ATTR_SYMBOL: Result := fSymbolAttri; else Result := nil; end; @@ -768,38 +754,38 @@ function TSynXMLSyn.GetDefaultAttribute(Index: Integer): TSynHighlighterAttribut function TSynXMLSyn.GetEol: Boolean; begin - Result := Run = FLineLen + 1; + Result := Run = fLineLen + 1; end; function TSynXMLSyn.GetTokenID: TtkTokenKind; begin - Result := FTokenID; + Result := fTokenId; end; function TSynXMLSyn.GetTokenAttribute: TSynHighlighterAttributes; begin - case FTokenID of - tkElement: Result:= FElementAttri; - tkAttribute: Result:= FAttributeAttri; - tknsAttribute: Result:= FnsAttributeAttri; - tkEqual: Result:= FSymbolAttri; - tknsEqual: Result:= FSymbolAttri; - tkQuoteAttrValue: Result:= FAttributeValueAttri; - tkAPosAttrValue: Result:= FAttributeValueAttri; - tknsQuoteAttrValue: Result:= FnsAttributeValueAttri; - tknsAPosAttrValue: Result:= FnsAttributeValueAttri; - tkText: Result:= FTextAttri; - tkCDATA: Result:= FCDATAAttri; - tkEntityRef: Result:= FEntityRefAttri; - tkQuoteEntityRef: Result:= FEntityRefAttri; - tkAposEntityRef: Result:= FEntityRefAttri; - tknsQuoteEntityRef: Result:= FEntityRefAttri; - tknsAposEntityRef: Result:= FEntityRefAttri; - tkProcessingInstruction: Result:= FProcessingInstructionAttri; - tkComment: Result:= FCommentAttri; - tkDocType: Result:= FDocTypeAttri; - tkSymbol: Result:= FSymbolAttri; - tkSpace: Result:= FSpaceAttri; + case fTokenID of + tkElement: Result:= fElementAttri; + tkAttribute: Result:= fAttributeAttri; + tknsAttribute: Result:= fnsAttributeAttri; + tkEqual: Result:= fSymbolAttri; + tknsEqual: Result:= fSymbolAttri; + tkQuoteAttrValue: Result:= fAttributeValueAttri; + tkAPosAttrValue: Result:= fAttributeValueAttri; + tknsQuoteAttrValue: Result:= fnsAttributeValueAttri; + tknsAPosAttrValue: Result:= fnsAttributeValueAttri; + tkText: Result:= fTextAttri; + tkCDATA: Result:= fCDATAAttri; + tkEntityRef: Result:= fEntityRefAttri; + tkQuoteEntityRef: Result:= fEntityRefAttri; + tkAposEntityRef: Result:= fEntityRefAttri; + tknsQuoteEntityRef: Result:= fEntityRefAttri; + tknsAposEntityRef: Result:= fEntityRefAttri; + tkProcessingInstruction: Result:= fProcessingInstructionAttri; + tkComment: Result:= fCommentAttri; + tkDocType: Result:= fDocTypeAttri; + tkSymbol: Result:= fSymbolAttri; + tkSpace: Result:= fSpaceAttri; else Result := nil; end; @@ -807,152 +793,37 @@ function TSynXMLSyn.GetTokenAttribute: TSynHighlighterAttributes; function TSynXMLSyn.GetTokenKind: Integer; begin - Result := Ord(FTokenID); + Result := Ord(fTokenId); end; function TSynXMLSyn.GetRange: Pointer; begin - Result := Pointer(FRange); + Result := Pointer(fRange); end; procedure TSynXMLSyn.SetRange(Value: Pointer); begin - FRange := TRangeState(Value); + fRange := TRangeState(Value); end; procedure TSynXMLSyn.ResetRange; begin - FRange := rsText; -end; - -{$IFDEF SYN_CodeFolding} -procedure TSynXMLSyn.ScanForFoldRanges(FoldRanges: TSynFoldRanges; - LinesToScan: TStrings; FromLine, ToLine: Integer); -var - Line: Integer; - CurLine: string; - RunPos: Integer; - IsClosing: Boolean; - IndentLevel, CurLevel: Integer; -begin - IndentLevel := 0; - for Line := FromLine to ToLine do - begin - CurLine := LinesToScan[Line]; - RunPos := 1; - - // skip empty lines - if CurLine = '' then - begin - FoldRanges.NoFoldInfo(Line + 1); - Continue; - end; - - CurLevel := 0; - while RunPos <= Length(CurLine) do - begin - // scan for open tag - if CurLine[RunPos] = '<' then - begin - Inc(RunPos); - if RunPos = Length(CurLine) then - break; - - // get tag type (prolog, closing or malformed - case CurLine[RunPos] of - '?' : - begin - // skip to end and continue - Inc(RunPos); - while RunPos <= Length(CurLine) do - begin - if CurLine[RunPos] = '?' then - begin - break; - end; - Inc(RunPos); - end; - Continue; - end; - - '/' : - begin - Inc(RunPos); - if RunPos = Length(CurLine) then - break; - IsClosing := True; - end; - '>' : - begin - // malformed tag (without any tag name) -> skip - Inc(RunPos); - continue; - end; - else - IsClosing := False; - end; - - // scan for tag end-marker - while RunPos <= Length(CurLine) do - begin - - if CurLine[RunPos] = '>' then - begin - // decrease the current level if it's a closing tag - if IsClosing then - Dec(CurLevel) - else - // eventually increase the current level if it's not an empty tag - if not (CurLine[RunPos - 1] = '/') then - Inc(CurLevel); - - Inc(RunPos); - break; - end; - - Inc(RunPos); - end; - end; - Inc(RunPos); - end; - - // check whether the current level has changed, otherwise continue - if (CurLevel = 0) then - begin - FoldRanges.NoFoldInfo(Line + 1); - Continue; - end; - - // the level has changed, but in what direction? - if CurLevel > 0 then - begin - // start a new fold range for the next indent level - IndentLevel := IndentLevel + CurLevel; - FoldRanges.StartFoldRange(Line + 1, 1, IndentLevel); - end - else - begin - // stop the fold range for the current indent level and decrease - FoldRanges.StopFoldRange(Line + 1, 1, IndentLevel); - IndentLevel := IndentLevel + CurLevel; - end; - end; //for Line + fRange := rsText; end; -{$ENDIF} function TSynXMLSyn.IsFilterStored: Boolean; begin - Result := FDefaultFilter <> SYNS_FilterXML; + Result := fDefaultFilter <> SYNS_FilterXML; end; { TODO: In fact every Number also non-arabics and every letter also German umlauts can be used. Something like IsAlphaNumericCharW should be used instead. } function TSynXMLSyn.IsNameChar: Boolean; begin - case FLine[Run] of + case fLine[Run] of '0'..'9', 'a'..'z', 'A'..'Z', '_', '.', ':', '-': Result := True; - else if FLine[Run] > 'À' then // TODO: this here is very vague, see above + else if fLine[Run] > 'À' then // TODO: this here is very vague, see above Result := True else Result := False; @@ -964,25 +835,22 @@ class function TSynXMLSyn.GetLanguageName: string; Result := SYNS_LangXML; end; -function TSynXMLSyn.GetSampleSource: UnicodeString; +function TSynXMLSyn.GetSampleSource: string; begin - Result := - ''#13#10+ - ''#13#10+ - ''#13#10+ - ''#13#10+ - ' '#13#10+ - ''; + Result:= ''#13#10+ + ''#13#10+ + ''#13#10+ + ''#13#10+ + ' '#13#10+ + ''; end; -class function TSynXMLSyn.GetFriendlyLanguageName: UnicodeString; +class function TSynXMLSyn.GetFriendlyLanguageName: string; begin Result := SYNS_FriendlyLangXML; end; initialization -{$IFNDEF SYN_CPPB_1} RegisterPlaceableHighlighter(TSynXMLSyn); -{$ENDIF} end. diff --git a/Ext/SynEdit/Source/SynHighlighterYAML.pas b/Ext/SynEdit/Source/SynHighlighterYAML.pas index bcfb9bf..b9fe645 100644 --- a/Ext/SynEdit/Source/SynHighlighterYAML.pas +++ b/Ext/SynEdit/Source/SynHighlighterYAML.pas @@ -8,10 +8,8 @@ WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for the specific language governing rights and limitations under the License. -Code template generated with SynGen. -The original code is: C:\Delphi\Components\UniSynEdit\SynGen\yaml.pas, released 2008-06-13. Description: YAML Syntax Parser/Highlighter -The initial author of this file is Kiriakos. +The initial author of this file is PyScripter. Copyright (c) 2008, all rights reserved. Contributors to the SynEdit and mwEdit projects are listed in the @@ -26,29 +24,20 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -------------------------------------------------------------------------------} unit SynHighlighterYAML; -{$I SynEdit.inc} - interface uses - Graphics, - SynEditHighlighter, - SysUtils, - Classes, - SynUnicode; + System.SysUtils, + System.Classes, + Vcl.Graphics, + SynEditHighlighter; //State constants -Const +const rsUnknown = 0; rsValue = 1; rsLiteralStart = 2; @@ -57,6 +46,7 @@ interface rsString2 = 5; rsDirective = 6; rsDocDelimiter = 7; + type TtkTokenKind = ( tkComment, @@ -95,7 +85,7 @@ TSynYAMLSyn = class(TSynCustomHighlighter) fDirectiveAttri: TSynHighlighterAttributes; fAnchorAttri: TSynHighlighterAttributes; fErrorAttri: TSynHighlighterAttributes; - fTempSpaceAttri : TSynHighlighterAttributes; + fTempSpaceAttri: TSynHighlighterAttributes; procedure KeyProc; procedure LiteralProc; procedure LiteralMarkProc; @@ -148,62 +138,20 @@ TSynYAMLSyn = class(TSynCustomHighlighter) property ErrorAttri: TSynHighlighterAttributes read fErrorAttri write fErrorAttri; end; -const - SYNS_LangYAML = 'YAML'; - SYNS_AttrDocumentDelimiter = 'DocumentDelimiter'; - SYNS_AttrKey = 'Key'; - SYNS_AttrNumericValue = 'NumericValue'; - SYNS_AttrTextValue = 'TextValue'; - SYNS_AttrAnchor = 'Anchor'; - SYNS_AttrTag = 'Tag'; - -resourcestring - SYNS_FilterYAML = 'YAML files (*.yaml)|*.yaml'; - SYNS_FriendlyLangYAML = 'YAML'; - SYNS_FriendlyAttrDocumentDelimiter = 'Document Delimiter'; - SYNS_FriendlyAttrKey = 'Key'; - SYNS_FriendlyAttrNumericValue = 'Numeric Value'; - SYNS_FriendlyAttrTextValue = 'Text Value'; - SYNS_FriendlyAttrTag = 'Tag'; - SYNS_FriendlyAttrAnchor = 'Anchor'; - implementation uses - Windows, + System.Character, + System.Math, + Winapi.Windows, SynEditStrConst, - Math; - -//Funzioni contenute in uCommonFunctions.pas del progetto pyScripter -function CalcIndent(S : string; TabWidth : integer = 4): integer; -Var - i : integer; -begin - Result := 0; - for i := 1 to Length(S) do - if S[i] = #9 then - Inc(Result, TabWidth) - else if S[i] = ' ' then - Inc(Result) - else - break; -end; - -function StrIsLeft(AText, ALeft: PWideChar): Boolean; -(* checks if AText starts with ALeft *) -begin - while (ALeft^ <> #0) and (AText^ <> #0) and (ALeft^ = AText^) do begin - Inc(ALeft); - Inc(AText); - end; - Result := ALeft^ = #0; -end; + SynEditMiscProcs; procedure TSynYAMLSyn.SpaceProc; begin - inc(Run); + Inc(Run); fTokenID := tkSpace; - while (FLine[Run] <= #32) and not IsLineEnd(Run) do inc(Run); + while (FLine[Run] <= #32) and not IsLineEnd(Run) do Inc(Run); end; procedure TSynYAMLSyn.StringProc1; @@ -240,22 +188,22 @@ procedure TSynYAMLSyn.StringProc2; procedure TSynYAMLSyn.TagProc; begin while not (IsLineEnd(Run) or (FLine[Run] <= #32)) do - inc(Run); + Inc(Run); fTokenID := tkTag; end; procedure TSynYAMLSyn.NullProc; begin fTokenID := tkNull; - inc(Run); + Inc(Run); end; procedure TSynYAMLSyn.CRProc; begin fTokenID := tkSpace; - inc(Run); + Inc(Run); if fLine[Run] = #10 then - inc(Run); + Inc(Run); end; destructor TSynYAMLSyn.Destroy; @@ -268,7 +216,7 @@ procedure TSynYAMLSyn.DirectiveProc; begin fTokenID := tkDirective; while not IsLineEnd(Run) do - inc(Run); + Inc(Run); LongRec(fRange).Lo := rsUnknown; end; @@ -276,18 +224,18 @@ procedure TSynYAMLSyn.DocDelimiterProc; begin fTokenID := tkDocDelimiter; while not IsLineEnd(Run) do - inc(Run); + Inc(Run); end; procedure TSynYAMLSyn.DoSetLine(const Value: UnicodeString; LineNumber: Integer); -Const - sDocStart : UnicodeString = '---'; - sDocEnd : UnicodeString = '...'; -Var - NewIndent : integer; +const + sDocStart: UnicodeString = '---'; + sDocEnd: UnicodeString = '...'; +var + NewIndent: Integer; begin inherited; - NewIndent := CalcIndent(fLineStr); + NewIndent := LeftSpaces(fLineStr, False); if LongRec(fRange).Lo = rsDocDelimiter then LongRec(fRange).Lo := rsUnknown; @@ -295,7 +243,7 @@ procedure TSynYAMLSyn.DoSetLine(const Value: UnicodeString; LineNumber: Integer) if fLine^ = '%' then begin LongRec(fRange).Lo := rsDirective; LongRec(fRange).Hi := NewIndent; - end else if StrIsLeft(FLine, PWideChar(sDocStart)) or StrIsLeft(FLine, PWideChar(sDocEnd)) then begin + end else if FLineStr.StartsWith(sDocStart) or FLineStr.StartsWith(sDocEnd) then begin LongRec(fRange).Lo := rsDocDelimiter; LongRec(fRange).Hi := NewIndent; end else if (LongRec(fRange).Lo = rsLiteralStart) then begin @@ -324,7 +272,7 @@ procedure TSynYAMLSyn.FoldedLiteralMarkProc; procedure TSynYAMLSyn.LFProc; begin fTokenID := tkSpace; - inc(Run); + Inc(Run); end; procedure TSynYAMLSyn.ListItemProc; @@ -353,13 +301,13 @@ procedure TSynYAMLSyn.LiteralProc; begin fTokenID := tkLiteral; while (not IsLineEnd(Run)) and (FLine[Run] <> '#') do - inc(Run); + Inc(Run); end; procedure TSynYAMLSyn.AnchorProc; begin while not (IsLineEnd(Run) or (FLine[Run] <= #32)) do - inc(Run); + Inc(Run); fTokenID := tkAnchor; end; @@ -367,13 +315,13 @@ procedure TSynYAMLSyn.CommentProc; begin fTokenID := tkComment; while not IsLineEnd(Run) do - inc(Run); + Inc(Run); end; constructor TSynYAMLSyn.Create(AOwner: TComponent); begin inherited Create(AOwner); - fCaseSensitive := False; + fCaseSensitive := True; fCommentAttri := TSynHighLighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); fCommentAttri.Foreground := clGray; @@ -400,7 +348,7 @@ constructor TSynYAMLSyn.Create(AOwner: TComponent); fSymbolAttri := TSynHighLighterAttributes.Create(SYNS_AttrSymbol, SYNS_FriendlyAttrSymbol); fSymbolAttri.Style := [fsBold]; - fSymbolAttri.Foreground := clBlue; + fSymbolAttri.Foreground := $FF8844; AddAttribute(fSymbolAttri); fTagAttri := TSynHighLighterAttributes.Create(SYNS_AttrTag, SYNS_FriendlyAttrTag); @@ -412,7 +360,7 @@ constructor TSynYAMLSyn.Create(AOwner: TComponent); AddAttribute(fTextValueAttri); fStringAttri := TSynHighlighterAttributes.Create(SYNS_AttrString, SYNS_FriendlyAttrString); - fStringAttri.Foreground := clBlue; + fStringAttri.Foreground := $FF8844; AddAttribute(fStringAttri); fDirectiveAttri := TSynHighlighterAttributes.Create(SYNS_AttrDirective, SYNS_FriendlyAttrDirective); @@ -446,7 +394,7 @@ procedure TSynYAMLSyn.KeyProc; if FLine[Run] = ' ' then Inc(Run); fTokenID := tkKey; - break; + Break; end else Inc(Run); end; @@ -454,20 +402,20 @@ procedure TSynYAMLSyn.KeyProc; procedure TSynYAMLSyn.UnknownProc; begin - inc(Run); + Inc(Run); fTokenID := tkUnknown; end; procedure TSynYAMLSyn.ValueProc; -Var - Start : Integer; - Val : UnicodeString; - FloatVal : Extended; +var + Start: Integer; + Val: UnicodeString; + FloatVal: Extended; begin Start := Run; fTokenID := tkLiteral; while (not IsLineEnd(Run)) and (FLine[Run] <> '#') do - inc(Run); + Inc(Run); Val := Copy(FLineStr, Start, Run - Start + 1); if TryStrToFloat(Trim(Val), FloatVal) then fTokenId := tkNumericValue; @@ -477,8 +425,8 @@ procedure TSynYAMLSyn.Next; begin fTokenPos := Run; case LongRec(fRange).Lo of - rsDirective : DirectiveProc; - rsString1 : + rsDirective: DirectiveProc; + rsString1: case fLine[Run] of #0: NullProc; #10: LFProc; @@ -486,7 +434,7 @@ procedure TSynYAMLSyn.Next; else StringProc1; end; - rsString2 : + rsString2: case fLine[Run] of #0: NullProc; #10: LFProc; @@ -494,7 +442,7 @@ procedure TSynYAMLSyn.Next; else StringProc2; end; - rsDocDelimiter : + rsDocDelimiter: case fLine[Run] of #0: NullProc; #10: LFProc; @@ -502,7 +450,7 @@ procedure TSynYAMLSyn.Next; else DocDelimiterProc; end; - rsLiteralStart : + rsLiteralStart: case fLine[Run] of #0: NullProc; #10: LFProc; @@ -511,7 +459,7 @@ procedure TSynYAMLSyn.Next; else UnknownProc; end; - rsLiteral : + rsLiteral: case fLine[Run] of #0: NullProc; #10: LFProc; @@ -520,7 +468,7 @@ procedure TSynYAMLSyn.Next; else LiteralProc; end; - rsValue : + rsValue: case fLine[Run] of #0: NullProc; #10: LFProc; @@ -529,7 +477,7 @@ procedure TSynYAMLSyn.Next; '|': LiteralMarkProc; '>': FoldedLiteralMarkProc; '-': ListItemProc; - '&', '*' : AnchorProc; + '&', '*': AnchorProc; '"': begin Inc(Run); @@ -624,12 +572,7 @@ function TSynYAMLSyn.GetTokenKind: Integer; function TSynYAMLSyn.IsIdentChar(AChar: WideChar): Boolean; begin - case AChar of - '_', '0'..'9', 'a'..'z', 'A'..'Z': - Result := True; - else - Result := False; - end; + Result := AChar.IsLetterOrDigit or (AChar = '_'); end; function TSynYAMLSyn.GetSampleSource: UnicodeString; @@ -675,6 +618,11 @@ function TSynYAMLSyn.IsFilterStored: Boolean; Result := fDefaultFilter <> SYNS_FilterYAML; end; +class function TSynYAMLSyn.GetFriendlyLanguageName: UnicodeString; +begin + Result := SYNS_FriendlyLangYAML; +end; + class function TSynYAMLSyn.GetLanguageName: string; begin Result := SYNS_LangYAML; @@ -695,14 +643,6 @@ function TSynYAMLSyn.GetRange: Pointer; Result := Pointer(fRange); end; -{$IFNDEF SYN_CPPB_1} -class function TSynYAMLSyn.GetFriendlyLanguageName: UnicodeString; -begin - Result := SYNS_FriendlyLangYAML; -end; - initialization - RegisterPlaceableHighlighter(TSynYAMLSyn); -{$ENDIF} -end. \ No newline at end of file +end. diff --git a/Ext/SynEdit/Source/SynHighlighterZPL.pas b/Ext/SynEdit/Source/SynHighlighterZPL.pas deleted file mode 100644 index 5000e03..0000000 --- a/Ext/SynEdit/Source/SynHighlighterZPL.pas +++ /dev/null @@ -1,322 +0,0 @@ -{------------------------------------------------------------------------------- -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: C:\radw3\dpr\bin\SynHighlighterZPL.pas, released 2020-05-03. -Description: Syntax Parser/Highlighter -The initial author of this file is chtilux. -Copyright (c) 2020, all rights reserved. - -Contributors to the SynEdit and mwEdit projects are listed in the -Contributors.txt file. - -Alternatively, the contents of this file may be used under the terms of the -GNU General Public License Version 2 or later (the "GPL"), in which case -the provisions of the GPL are applicable instead of those above. -If you wish to allow use of your version of this file only under the terms -of the GPL and not to allow others to use your version of this file -under the MPL, indicate your decision by deleting the provisions above and -replace them with the notice and other provisions required by the GPL. -If you do not delete the provisions above, a recipient may use your version -of this file under either the MPL or the GPL. - -$Id: $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - --------------------------------------------------------------------------------} - -unit SynHighlighterZPL; - -{$I SynEdit.inc} - -interface - -uses - Graphics, - SynEditTypes, - SynEditHighlighter, - SynUnicode, - SysUtils, - Classes; - -type - TtkTokenKind = (tkNull, tkKey, tkText, tkComment, tkNumber); - - TSynZPLSyn = class(TSynCustomHighlighter) - private - FTokenID: TtkTokenKind; - FKeyAttri: TSynHighlighterAttributes; - FTextAttri: TSynHighlighterAttributes; - FCommentAttri: TSynHighlighterAttributes; - FNumberAttri: TSynHighlighterAttributes; - FFieldDataAttri: TSynHighlighterAttributes; - pvFieldData: Boolean; - pvGraphic: Boolean; - FCommentScript: boolean; - - procedure NullProc; - procedure KeyProc; - procedure TextProc; - procedure SlashProc; - procedure NumberProc; - procedure SetCommentScript(const Value: boolean); - protected - function GetDefaultAttribute(Index: Integer): TSynHighlighterAttributes; override; - function GetSampleSource: UnicodeString; override; - public - class function GetLanguageName: string; override; - class function GetFriendlyLanguageName: UnicodeString; override; - public - constructor Create(AOwner: TComponent); override; - function GetEol: Boolean; override; - function GetTokenAttribute: TSynHighlighterAttributes; override; - function GetTokenKind: Integer; override; - procedure Next; override; - published - property KeyAttri: TSynHighlighterAttributes read FKeyAttri write FKeyAttri; - property TextAttri: TSynHighlighterAttributes read FTextAttri write FTextAttri; - property CommentAttri: TSynHighlighterAttributes read FCommentAttri write FCommentAttri; - property NumberAttri: TSynHighlighterAttributes read FNumberAttri write FNumberAttri; - property FieldDataAttri: TSynHighlighterAttributes read FFieldDataAttri write FFieldDataAttri; - (* // is not a ZPL comment, but in my needs yes (for scripting), so set - commentScript to False to disable // comments *) - property CommentScript: boolean read FCommentScript write SetCommentScript default True; - end; - -implementation - -uses - SynEditStrConst; - -resourcestring - SYNS_FilterZPL = '*.zpl;*.zplx'; - SYNS_LangZPL = 'ZPL'; - SYNS_FriendlyLangZPL = 'ZPL'; - -{ TMyHighlighter } - -constructor TSynZPLSyn.Create(AOwner: TComponent); -begin - inherited; - pvFieldData := False; - pvGraphic := False; - FCommentScript := True; - - FKeyAttri := TSynHighlighterAttributes.Create(SYNS_AttrKey, SYNS_FriendlyAttrKey); - FKeyAttri.Foreground := clMaroon; - FKeyAttri.Style := [fsBold]; - AddAttribute(FKeyAttri); - - FTextAttri := TSynHighlighterAttributes.Create(SYNS_AttrText, SYNS_FriendlyAttrText); - AddAttribute(FTextAttri); - - FCommentAttri := TSynHighlighterAttributes.Create(SYNS_AttrComment, SYNS_FriendlyAttrComment); - FCommentAttri.Foreground := clGreen; - FCommentAttri.Style := [fsItalic]; - AddAttribute(FCommentAttri); - - FNumberAttri := TSynHighlighterAttributes.Create(SYNS_AttrNumber, SYNS_FriendlyAttrNumber); - FNumberAttri.Foreground := clNavy; - AddAttribute(FNumberAttri); - - FFieldDataAttri := TSynHighlighterAttributes.Create(SYNS_AttrDataType, SYNS_FriendlyAttrDataType); - FFieldDataAttri.Foreground := clNavy; - FFieldDataAttri.Style := [fsBold]; - AddAttribute(FFieldDataAttri); - - SetAttributesOnChange(DefHighlightChange); - - FDefaultFilter := SYNS_FilterZPL; -end; - -function TSynZPLSyn.GetDefaultAttribute( - Index: Integer): TSynHighlighterAttributes; -begin - case Index of - SYN_ATTR_KEYWORD: Result := FKeyAttri; - SYN_ATTR_COMMENT: Result := FCommentAttri; - else - Result := nil; - end; -end; - -function TSynZPLSyn.GetEol: Boolean; -begin - Result := Run = FLineLen + 1; -end; - -class function TSynZPLSyn.GetFriendlyLanguageName: UnicodeString; -begin - Result := SYNS_FriendlyLangZPL; -end; - -class function TSynZPLSyn.GetLanguageName: string; -begin - Result := SYNS_LangZPL; -end; - -function TSynZPLSyn.GetTokenAttribute: TSynHighlighterAttributes; -begin - case FTokenID of - tkKey: Result := FKeyAttri; - tkText: begin - if not pvFieldData then - Result := FTextAttri - else - Result := FFieldDataAttri; - end; - tkComment: Result := FCommentAttri; - tkNumber: begin - if not pvGraphic then - Result := FNumberAttri - else - Result := FTextAttri; - end; - else - Result := nil; - end; -end; - -function TSynZPLSyn.GetTokenKind: Integer; -begin - Result := Ord(FTokenID); -end; - -procedure TSynZPLSyn.KeyProc; -var - lcComment: boolean; -begin - pvFieldData := (Run < Length(FLineStr)-1-2) and (FLine[Run] = '^') and (UpCase(FLine[Run+1]) = 'F') and (UpCase(FLine[Run+2]) = 'D'); - pvGraphic := (Run < Length(FLineStr)-1-2) and (FLine[Run] = '~') and (UpCase(FLine[Run+1]) = 'D') and (UpCase(FLine[Run+2]) = 'G'); - lcComment := (Run < Length(FLineStr)-1-2) and (FLine[Run] = '^') and (UpCase(FLine[Run+1]) = 'F') and (UpCase(FLine[Run+2]) = 'X'); - if not lcComment then - begin - FTokenID := tkKey; - if Run < Length(FLineStr)-2 then - Inc(Run,3) - else - Inc(Run); - end - else - begin - FTokenID := tkComment; - Inc(Run); - while FLine[Run] <> #0 do - case FLine[Run] of - #10, #13: - Break; - else - Inc(Run); - end; - end; -end; - -procedure TSynZPLSyn.Next; -begin - case FLine[Run] of - #0: NullProc; - '^': KeyProc; - '~': KeyProc; - '/': SlashProc; - '0'..'9': NumberProc; - else - TextProc; - end; - inherited; -end; - -procedure TSynZPLSyn.NullProc; -begin - FTokenID := tkNull; - Inc(Run); -end; - -procedure TSynZPLSyn.NumberProc; - function IsNumberChar: Boolean; - begin - case fLine[Run] of - '0'..'9', '.', 'e', 'E': - Result := True; - else - Result := False; - end; - end; -begin - Inc(Run); - FTokenID := tkNumber; - while IsNumberChar do Inc(Run); -end; - -procedure TSynZPLSyn.SetCommentScript(const Value: boolean); -begin - FCommentScript := Value; -end; - -procedure TSynZPLSyn.SlashProc; -begin - // if it is not column 0 mark as tkText and get out of here - if (Run > 0) or not(FCommentScript) then - begin - FTokenID := tkText; - Inc(Run); - Exit; - end; - - // this is column 0 ok it is a comment - FTokenID := tkComment; - Inc(Run); - while FLine[Run] <> #0 do - case FLine[Run] of - #10, #13: - Break; - else - Inc(Run); - end; -end; - -procedure TSynZPLSyn.TextProc; - - function IsTextChar: Boolean; - begin - case fLine[Run] of - 'a'..'z', 'A'..'Z': - Result := True; - else - Result := False; - end; - end; - -begin - FTokenID := tkText; - Inc(Run); - while FLine[Run] <> #0 do - if IsTextChar then - Inc(Run) - else - Break; -end; - -function TSynZPLSyn.GetSampleSource: UnicodeString; -begin - Result := - '^XA'#13#10+ - '^LH30,6161'#13#10+ - '^FO20,10'#13#10+ - '^ADN,90,50'#13#10+ - '^FDHello^FS'#13#10+ - '^XZ'; -end; - -initialization -{$IFNDEF SYN_CPPB_1} - RegisterPlaceableHighlighter(TSynZPLSyn); -{$ENDIF} -end. diff --git a/Ext/SynEdit/Source/SynMacroRecorder.pas b/Ext/SynEdit/Source/SynMacroRecorder.pas index 0657348..2de1c76 100644 --- a/Ext/SynEdit/Source/SynMacroRecorder.pas +++ b/Ext/SynEdit/Source/SynMacroRecorder.pas @@ -26,13 +26,6 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynMacroRecorder.pas,v 1.31.2.3 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: -------------------------------------------------------------------------------} unit SynMacroRecorder; @@ -53,16 +46,9 @@ interface SynEditPlugins, SynEditTypes, SynUnicode, -{$IFDEF UNICODE} - WideStrUtils, -{$ENDIF} Classes; -{$IFDEF SYN_COMPILER_3_UP} resourcestring -{$ELSE} -const -{$ENDIF} sCannotRecord = 'Cannot record macro; already recording or playing'; sCannotPlay = 'Cannot playback macro; already playing or recording'; sCannotPause = 'Can only pause when recording'; @@ -74,9 +60,9 @@ interface TSynMacroEvent = class(TObject) protected - FRepeatCount: Byte; - function GetAsString: UnicodeString; virtual; abstract; - procedure InitEventParameters(aStr: UnicodeString); virtual; abstract; + fRepeatCount: Byte; + function GetAsString: string; virtual; abstract; + procedure InitEventParameters(aStr: string); virtual; abstract; public constructor Create; virtual; procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); @@ -86,15 +72,15 @@ TSynMacroEvent = class(TObject) procedure LoadFromStream(aStream: TStream); virtual; abstract; procedure SaveToStream(aStream: TStream); virtual; abstract; procedure Playback(aEditor: TCustomSynEdit); virtual; abstract; - property AsString: UnicodeString read GetAsString; - property RepeatCount: Byte read FRepeatCount write FRepeatCount; + property AsString: string read GetAsString; + property RepeatCount: Byte read fRepeatCount write fRepeatCount; end; TSynBasicEvent = class(TSynMacroEvent) protected - FCommand: TSynEditorCommand; - function GetAsString: UnicodeString; override; - procedure InitEventParameters(aStr: UnicodeString); override; + fCommand: TSynEditorCommand; + function GetAsString: string; override; + procedure InitEventParameters(aStr: string); override; public procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); override; @@ -102,14 +88,14 @@ TSynBasicEvent = class(TSynMacroEvent) procedure SaveToStream(aStream: TStream); override; procedure Playback(aEditor: TCustomSynEdit); override; public - property Command: TSynEditorCommand read FCommand write FCommand; + property Command: TSynEditorCommand read fCommand write fCommand; end; TSynCharEvent = class(TSynMacroEvent) protected - FKey: WideChar; - function GetAsString: UnicodeString; override; - procedure InitEventParameters(aStr: UnicodeString); override; + fKey: WideChar; + function GetAsString: string; override; + procedure InitEventParameters(aStr: string); override; public procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); override; @@ -117,14 +103,14 @@ TSynCharEvent = class(TSynMacroEvent) procedure SaveToStream(aStream: TStream); override; procedure Playback(aEditor: TCustomSynEdit); override; public - property Key: WideChar read FKey write FKey; + property Key: WideChar read fKey write fKey; end; TSynStringEvent = class(TSynMacroEvent) protected - FString: UnicodeString; - function GetAsString: UnicodeString; override; - procedure InitEventParameters(aStr: UnicodeString); override; + fString: string; + function GetAsString: string; override; + procedure InitEventParameters(aStr: string); override; public procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); override; @@ -132,14 +118,14 @@ TSynStringEvent = class(TSynMacroEvent) procedure SaveToStream(aStream: TStream); override; procedure Playback(aEditor: TCustomSynEdit); override; public - property Value: UnicodeString read FString write FString; + property Value: string read fString write fString; end; TSynPositionEvent = class(TSynBasicEvent) protected - FPosition: TBufferCoord; - function GetAsString: UnicodeString; override; - procedure InitEventParameters(aStr: UnicodeString); override; + fPosition: TBufferCoord; + function GetAsString: string; override; + procedure InitEventParameters(aStr: string); override; public procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); override; @@ -147,12 +133,12 @@ TSynPositionEvent = class(TSynBasicEvent) procedure SaveToStream(aStream: TStream); override; procedure Playback(aEditor: TCustomSynEdit); override; public - property Position: TBufferCoord read FPosition write FPosition; + property Position: TBufferCoord read fPosition write fPosition; end; TSynDataEvent = class(TSynBasicEvent) protected - FData: Pointer; + fData: Pointer; public procedure Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); override; @@ -170,42 +156,46 @@ TCustomSynMacroRecorder = class; OnStateChange: occurs right after start playing, recording, pausing or stopping SaveMarkerPos: - if true, Bookmark position is recorded in the macro. Otherwise, the Bookmark + if True, Bookmark position is recorded in the macro. Otherwise, the Bookmark is created in the position the Caret is at the time of playback. } TCustomSynMacroRecorder = class(TAbstractSynHookerPlugin) private - FShortCuts: array [TSynMacroCommand] of TShortCut; - FOnStateChange: TNotifyEvent; - FOnUserCommand: TSynUserCommandEvent; - FMacroName: string; - FSaveMarkerPos: boolean; + fShortCuts: array [TSynMacroCommand] of TShortCut; + fOnStateChange: TNotifyEvent; + fOnUserCommand: TSynUserCommandEvent; + fMacroName: string; + fSaveMarkerPos: Boolean; function GetEvent(aIndex: Integer): TSynMacroEvent; function GetEventCount: Integer; - function GetAsString: UnicodeString; - procedure SetAsString(const Value: UnicodeString); + function GetAsString: string; + function GetPlaybackCommandID: TSynEditorCommand; + function GetPlaybackShortCut(const Index: Integer): TShortCut; + function GetRecordCommandID: TSynEditorCommand; + function GetRecordShortCut(const Index: Integer): TShortCut; + procedure SetAsString(const Value: string); protected - FCurrentEditor: TCustomSynEdit; - FState: TSynMacroState; - FEvents: TList; - FCommandIDs: array [TSynMacroCommand] of TSynEditorCommand; + fCurrentEditor: TCustomSynEdit; + fState: TSynMacroState; + fEvents: TList; + fCommandIDs: array [TSynMacroCommand] of TSynEditorCommand; procedure SetShortCut(const Index: Integer; const Value: TShortCut); - function GetIsEmpty: boolean; + function GetIsEmpty: Boolean; procedure StateChanged; procedure DoAddEditor(aEditor: TCustomSynEdit); override; procedure DoRemoveEditor(aEditor: TCustomSynEdit); override; - procedure OnCommand(Sender: TObject; AfterProcessing: boolean; - var Handled: boolean; var Command: TSynEditorCommand; var aChar: WideChar; - Data, HandlerData: Pointer); override; + procedure OnCommand(Sender: TObject; AfterProcessing: Boolean; + var Handled: Boolean; var Command: TSynEditorCommand; var aChar: WideChar; + Data: pointer; HandlerData: pointer); override; function CreateMacroEvent(aCmd: TSynEditorCommand): TSynMacroEvent; protected - property RecordCommandID: TSynEditorCommand read FCommandIDs[mcRecord]; - property PlaybackCommandID: TSynEditorCommand read FCommandIDs[mcPlayback]; + property RecordCommandID: TSynEditorCommand read GetRecordCommandID; + property PlaybackCommandID: TSynEditorCommand read GetPlaybackCommandID; public constructor Create(aOwner: TComponent); override; destructor Destroy; override; - procedure Error(const aMsg: String); + procedure Error(const aMsg: string); procedure AddEditor(aEditor: TCustomSynEdit); procedure RemoveEditor(aEditor: TCustomSynEdit); procedure RecordMacro(aEditor: TCustomSynEdit); @@ -213,33 +203,31 @@ TCustomSynMacroRecorder = class(TAbstractSynHookerPlugin) procedure Stop; procedure Pause; procedure Resume; - property IsEmpty: boolean read GetIsEmpty; - property State: TSynMacroState read FState; + property IsEmpty: Boolean read GetIsEmpty; + property State: TSynMacroState read fState; procedure Clear; - procedure AddEvent(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); + procedure AddEvent(aCmd: TSynEditorCommand; aChar: WideChar; aData: pointer); procedure InsertEvent(aIndex: Integer; aCmd: TSynEditorCommand; aChar: WideChar; - aData: Pointer); + aData: pointer); procedure AddCustomEvent(aEvent: TSynMacroEvent); procedure InsertCustomEvent(aIndex: Integer; aEvent: TSynMacroEvent); procedure DeleteEvent(aIndex: Integer); procedure LoadFromStream(aSrc: TStream); - procedure LoadFromStreamEx(aSrc: TStream; aClear: boolean); + procedure LoadFromStreamEx(aSrc: TStream; aClear: Boolean); procedure SaveToStream(aDest: TStream); - procedure LoadFromFile(aFilename : string); - procedure SaveToFile(aFilename : string); + procedure LoadFromFile(aFilename: string); + procedure SaveToFile(aFilename: string); property EventCount: Integer read GetEventCount; property Events[aIndex: Integer]: TSynMacroEvent read GetEvent; - property RecordShortCut: TShortCut index Ord(mcRecord) - read FShortCuts[mcRecord] write SetShortCut; - property PlaybackShortCut: TShortCut index Ord(mcPlayback) - read FShortCuts[mcPlayback] write SetShortCut; - property SaveMarkerPos: boolean read FSaveMarkerPos - write FSaveMarkerPos default False; - property AsString: UnicodeString read GetAsString write SetAsString; - property MacroName: string read FMacroName write FMacroName; - property OnStateChange: TNotifyEvent read FOnStateChange write FOnStateChange; - property OnUserCommand: TSynUserCommandEvent read FOnUserCommand - write FOnUserCommand; + property RecordShortCut: TShortCut index Ord(mcRecord) read GetRecordShortCut write SetShortCut; + property PlaybackShortCut: TShortCut index Ord(mcPlayback) read GetPlaybackShortCut write SetShortCut; + property SaveMarkerPos: Boolean read fSaveMarkerPos + write fSaveMarkerPos default False; + property AsString: string read GetAsString write SetAsString; + property MacroName: string read fMacroName write fMacroName; + property OnStateChange: TNotifyEvent read fOnStateChange write fOnStateChange; + property OnUserCommand: TSynUserCommandEvent read fOnUserCommand + write fOnUserCommand; end; TSynMacroRecorder = class(TCustomSynMacroRecorder) @@ -256,9 +244,7 @@ implementation uses Forms, SynEditMiscProcs, -{$IFDEF SYN_COMPILER_6_UP} RTLConsts, -{$ENDIF} SysUtils; { TSynDataEvent } @@ -266,25 +252,25 @@ implementation procedure TSynDataEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); begin - FCommand := aCmd; + fCommand := aCmd; Assert(aChar = #0); - FData := aData; + fData := aData; end; procedure TSynDataEvent.LoadFromStream(aStream: TStream); begin - aStream.Read(FData, SizeOf(FData)); + aStream.Read(fData, SizeOf(fData)); end; procedure TSynDataEvent.Playback(aEditor: TCustomSynEdit); begin - aEditor.CommandProcessor(Command, #0, FData); + aEditor.CommandProcessor(Command, #0, fData); end; procedure TSynDataEvent.SaveToStream(aStream: TStream); begin inherited; - aStream.Write(FData, SizeOf(FData)); + aStream.Write(fData, SizeOf(fData)); end; { TCustomSynMacroRecorder } @@ -300,7 +286,7 @@ procedure TCustomSynMacroRecorder.AddEditor(aEditor: TCustomSynEdit); end; procedure TCustomSynMacroRecorder.AddEvent(aCmd: TSynEditorCommand; - aChar: WideChar; aData: Pointer); + aChar: WideChar; aData: pointer); begin InsertEvent(EventCount, aCmd, aChar, aData); end; @@ -310,31 +296,31 @@ procedure TCustomSynMacroRecorder.Clear; I: Integer; Obj: TObject; begin - if Assigned(FEvents) then + if Assigned(fEvents) then begin - for I := FEvents.Count-1 downto 0 do + for I := fEvents.Count-1 downto 0 do begin - Obj := FEvents[I]; - FEvents.Delete(I); + Obj := fEvents[I]; + fEvents.Delete(I); Obj.Free; end; - FreeAndNil(FEvents); + FreeAndNil(fEvents); end; end; constructor TCustomSynMacroRecorder.Create(aOwner: TComponent); begin inherited; - FMacroName := 'unnamed'; - FCommandIDs[mcRecord] := NewPluginCommand; - FCommandIDs[mcPlayback] := NewPluginCommand; - FShortCuts[mcRecord] := Menus.ShortCut(Ord('R'), [ssCtrl, ssShift]); - FShortCuts[mcPlayback] := Menus.ShortCut(Ord('P'), [ssCtrl, ssShift]); + fMacroName := 'unnamed'; + fCommandIDs[mcRecord] := NewPluginCommand; + fCommandIDs[mcPlayback] := NewPluginCommand; + fShortCuts[mcRecord] := Menus.ShortCut(Ord('R'), [ssCtrl, ssShift]); + fShortCuts[mcPlayback] := Menus.ShortCut(Ord('P'), [ssCtrl, ssShift]); end; function TCustomSynMacroRecorder.CreateMacroEvent(aCmd: TSynEditorCommand): TSynMacroEvent; - function WantDefaultEvent(var aEvent: TSynMacroEvent): boolean; + function WantDefaultEvent(var aEvent: TSynMacroEvent): Boolean; begin if Assigned(OnUserCommand) then OnUserCommand(Self, aCmd, aEvent); @@ -367,8 +353,8 @@ procedure TCustomSynMacroRecorder.DeleteEvent(aIndex: Integer); var iObj: Pointer; begin - iObj := FEvents[aIndex]; - FEvents.Delete(aIndex); + iObj := fEvents[aIndex]; + fEvents.Delete(aIndex); TObject(iObj).Free; end; @@ -392,39 +378,39 @@ procedure TCustomSynMacroRecorder.DoRemoveEditor(aEditor: TCustomSynEdit); UnHookEditor(aEditor, PlaybackCommandID, PlaybackShortCut); end; -procedure TCustomSynMacroRecorder.Error(const aMsg: String); +procedure TCustomSynMacroRecorder.Error(const aMsg: string); begin raise Exception.Create(aMsg); end; function TCustomSynMacroRecorder.GetEvent(aIndex: Integer): TSynMacroEvent; begin - Result := TSynMacroEvent(FEvents[aIndex]); + Result := TSynMacroEvent(fEvents[aIndex]); end; function TCustomSynMacroRecorder.GetEventCount: Integer; begin - if FEvents = nil then + if fEvents = nil then Result := 0 else - Result := FEvents.Count; + Result := fEvents.Count; end; -function TCustomSynMacroRecorder.GetIsEmpty: boolean; +function TCustomSynMacroRecorder.GetIsEmpty: Boolean; begin - Result := (FEvents = nil) or (FEvents.Count = 0); + Result := (fEvents = nil) or (fEvents.Count = 0); end; procedure TCustomSynMacroRecorder.InsertCustomEvent(aIndex: Integer; aEvent: TSynMacroEvent); begin - if FEvents = nil then - FEvents := TList.Create; - FEvents.Insert(aIndex, aEvent); + if fEvents = nil then + fEvents := TList.Create; + fEvents.Insert(aIndex, aEvent); end; procedure TCustomSynMacroRecorder.InsertEvent(aIndex: Integer; - aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); + aCmd: TSynEditorCommand; aChar: WideChar; aData: pointer); var iEvent: TSynMacroEvent; begin @@ -444,7 +430,7 @@ procedure TCustomSynMacroRecorder.LoadFromStream(aSrc: TStream); end; procedure TCustomSynMacroRecorder.LoadFromStreamEx(aSrc: TStream; - aClear: boolean); + aClear: Boolean); var iCommand: TSynEditorCommand; iEvent: TSynMacroEvent; @@ -453,40 +439,40 @@ procedure TCustomSynMacroRecorder.LoadFromStreamEx(aSrc: TStream; Stop; if aClear then Clear; - FEvents := TList.Create; + fEvents := TList.Create; aSrc.Read(cnt, sizeof(cnt)); i := 0; - FEvents.Capacity := aSrc.Size div SizeOf(TSynEditorCommand); + fEvents.Capacity := aSrc.Size div SizeOf(TSynEditorCommand); while (aSrc.Position < aSrc.Size) and (i < cnt) do begin aSrc.Read(iCommand, SizeOf(TSynEditorCommand)); iEvent := CreateMacroEvent(iCommand); iEvent.Initialize(iCommand, #0, nil); iEvent.LoadFromStream(aSrc); - FEvents.Add(iEvent); + fEvents.Add(iEvent); Inc(i); end; end; // TODO: Sender could be also something else then a TCustomSynedit(namely a TObject) but the code below assumes it is a TCustomSynedit even if Sender is of type TObject. procedure TCustomSynMacroRecorder.OnCommand(Sender: TObject; - AfterProcessing: boolean; var Handled: boolean; + AfterProcessing: Boolean; var Handled: Boolean; var Command: TSynEditorCommand; var aChar: WideChar; Data, - HandlerData: Pointer); + HandlerData: pointer); var iEvent: TSynMacroEvent; begin if AfterProcessing then begin - if (Sender = FCurrentEditor) and (State = msRecording) and (not Handled) then + if (Sender = fCurrentEditor) and (State = msRecording) and (not Handled) then begin iEvent := CreateMacroEvent(Command); iEvent.Initialize(Command, aChar, Data); - FEvents.Add(iEvent); + fEvents.Add(iEvent); if SaveMarkerPos and (Command >= ecSetMarker0) and (Command <= ecSetMarker9) and (Data = nil) then begin - TSynPositionEvent(iEvent).Position := FCurrentEditor.CaretXY; + TSynPositionEvent(iEvent).Position := fCurrentEditor.CaretXY; end; end; end @@ -532,7 +518,7 @@ procedure TCustomSynMacroRecorder.Pause; begin if State <> msRecording then Error(sCannotPause); - FState := msPaused; + fState := msPaused; StateChanged; end; @@ -542,7 +528,7 @@ procedure TCustomSynMacroRecorder.PlaybackMacro(aEditor: TCustomSynEdit); begin if State <> msStopped then Error(sCannotPlay); - FState := msPlaying; + fState := msPlaying; try StateChanged; for cEvent := 0 to EventCount -1 do @@ -554,7 +540,7 @@ procedure TCustomSynMacroRecorder.PlaybackMacro(aEditor: TCustomSynEdit); finally if State = msPlaying then begin - FState := msStopped; + fState := msStopped; StateChanged; end; end; @@ -562,13 +548,13 @@ procedure TCustomSynMacroRecorder.PlaybackMacro(aEditor: TCustomSynEdit); procedure TCustomSynMacroRecorder.RecordMacro(aEditor: TCustomSynEdit); begin - if FState <> msStopped then + if fState <> msStopped then Error(sCannotRecord); Clear; - FEvents := TList.Create; - FEvents.Capacity := 512; - FState := msRecording; - FCurrentEditor := aEditor; + fEvents := TList.Create; + fEvents.Capacity := 512; + fState := msRecording; + fCurrentEditor := aEditor; StateChanged; end; @@ -579,9 +565,9 @@ procedure TCustomSynMacroRecorder.RemoveEditor(aEditor: TCustomSynEdit); procedure TCustomSynMacroRecorder.Resume; begin - if FState <> msPaused then + if fState <> msPaused then Error(sCannotResume); - FState := msRecording; + fState := msRecording; StateChanged; end; @@ -600,21 +586,21 @@ procedure TCustomSynMacroRecorder.SetShortCut(const Index: Integer; var cEditor: Integer; begin - if FShortCuts[TSynMacroCommand(Index)] <> Value then + if fShortCuts[TSynMacroCommand(Index)] <> Value then begin if Assigned(fEditors) then if Value <> 0 then begin for cEditor := 0 to fEditors.Count -1 do - HookEditor(Editors[cEditor], FCommandIDs[TSynMacroCommand(Index)], - FShortCuts[TSynMacroCommand(Index)], Value); + HookEditor(Editors[cEditor], fCommandIDs[TSynMacroCommand(Index)], + fShortCuts[TSynMacroCommand(Index)], Value); end else begin for cEditor := 0 to fEditors.Count -1 do - UnHookEditor(Editors[cEditor], FCommandIDs[TSynMacroCommand(Index)], - FShortCuts[TSynMacroCommand(Index)]); + UnHookEditor(Editors[cEditor], fCommandIDs[TSynMacroCommand(Index)], + fShortCuts[TSynMacroCommand(Index)]); end; - FShortCuts[TSynMacroCommand(Index)] := Value; + fShortCuts[TSynMacroCommand(Index)] := Value; end; end; @@ -626,24 +612,24 @@ procedure TCustomSynMacroRecorder.StateChanged; procedure TCustomSynMacroRecorder.Stop; begin - if FState = msStopped then + if fState = msStopped then Exit; - FState := msStopped; - FCurrentEditor := nil; - if FEvents.Count = 0 then - FreeAndNil(FEvents); + fState := msStopped; + fCurrentEditor := nil; + if fEvents.Count = 0 then + FreeAndNil(fEvents); StateChanged; end; -function TCustomSynMacroRecorder.GetAsString: UnicodeString; +function TCustomSynMacroRecorder.GetAsString: string; var i: Integer; - eStr: UnicodeString; + eStr: string; begin Result := 'macro ' + MacroName + #13#10 + 'begin' + #13#10; - if Assigned(FEvents) then + if Assigned(fEvents) then begin - for i := 0 to FEvents.Count -1 do + for i := 0 to fEvents.Count -1 do begin eStr := Events[i].AsString; if eStr <> '' then @@ -653,32 +639,52 @@ function TCustomSynMacroRecorder.GetAsString: UnicodeString; Result := Result + 'end'; end; -procedure TCustomSynMacroRecorder.SetAsString(const Value: UnicodeString); +function TCustomSynMacroRecorder.GetPlaybackCommandID: TSynEditorCommand; +begin + Result := fCommandIDs[mcPlayback]; +end; + +function TCustomSynMacroRecorder.GetPlaybackShortCut(const Index: Integer): TShortCut; +begin + Result := fShortCuts[mcPlayback]; +end; + +function TCustomSynMacroRecorder.GetRecordCommandID: TSynEditorCommand; +begin + Result := fCommandIDs[mcRecord]; +end; + +function TCustomSynMacroRecorder.GetRecordShortCut(const Index: Integer): TShortCut; +begin + Result := fShortCuts[mcRecord]; +end; + +procedure TCustomSynMacroRecorder.SetAsString(const Value: string); var i, p, Cmd: Integer; - S: TUnicodeStrings; - cmdStr: UnicodeString; + S: TStrings; + cmdStr: string; iEvent: TSynMacroEvent; begin Stop; Clear; - FEvents := TList.Create; + fEvents := TList.Create; // process file line by line and create events - S := TUnicodeStringList.Create; + S := TStringList.Create; try S.Text := Value; for i := 0 to S.Count - 1 do begin - cmdStr := WideTrim(S[i]); + cmdStr := Trim(S[i]); p := Pos(' ', cmdStr); if p = 0 then p := Length(cmdStr) + 1; Cmd := ecNone; - if IdentToEditorCommand(Copy(cmdStr, 1, p - 1), Longint(Cmd)) then // D2 needs type-cast + if IdentToEditorCommand(Copy(cmdStr, 1, p - 1), Cmd) then // D2 needs type-cast begin Delete(cmdStr, 1, p); iEvent := CreateMacroEvent(Cmd); try - FEvents.Add(iEvent); + fEvents.Add(iEvent); iEvent.InitEventParameters(cmdStr); except iEvent.Free; @@ -717,7 +723,7 @@ procedure TCustomSynMacroRecorder.SaveToFile(aFilename: string); { TSynBasicEvent } -function TSynBasicEvent.GetAsString: UnicodeString; +function TSynBasicEvent.GetAsString: string; var Ident: string; begin @@ -727,10 +733,10 @@ function TSynBasicEvent.GetAsString: UnicodeString; Result := Result + ' ' + IntToStr(RepeatCount); end; -procedure TSynBasicEvent.InitEventParameters(aStr: UnicodeString); +procedure TSynBasicEvent.InitEventParameters(aStr: string); begin // basic events have no parameters but can contain an optional repeat count - RepeatCount := StrToIntDef(WideTrim(aStr), 1); + RepeatCount := StrToIntDef(Trim(aStr), 1); end; procedure TSynBasicEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; @@ -745,7 +751,7 @@ procedure TSynBasicEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; procedure TSynBasicEvent.LoadFromStream(aStream: TStream); begin - aStream.Read(FRepeatCount, SizeOf(FRepeatCount)); + aStream.Read(fRepeatCount, SizeOf(fRepeatCount)); end; procedure TSynBasicEvent.Playback(aEditor: TCustomSynEdit); @@ -764,7 +770,7 @@ procedure TSynBasicEvent.SaveToStream(aStream: TStream); { TSynCharEvent } -function TSynCharEvent.GetAsString: UnicodeString; +function TSynCharEvent.GetAsString: string; var Ident: string; begin @@ -774,7 +780,7 @@ function TSynCharEvent.GetAsString: UnicodeString; Result := Result + ' ' + IntToStr(RepeatCount); end; -procedure TSynCharEvent.InitEventParameters(aStr: UnicodeString); +procedure TSynCharEvent.InitEventParameters(aStr: string); begin // aStr should be a Key value one character in length // with an optional repeat count whitespace separated @@ -783,7 +789,7 @@ procedure TSynCharEvent.InitEventParameters(aStr: UnicodeString); else Key := ' '; Delete(aStr, 1, 1); // if possible delete the first character - RepeatCount := StrToIntDef(WideTrim(aStr), 1); + RepeatCount := StrToIntDef(Trim(aStr), 1); end; procedure TSynCharEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; @@ -795,8 +801,8 @@ procedure TSynCharEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; procedure TSynCharEvent.LoadFromStream(aStream: TStream); begin - aStream.Read(FKey, SizeOf(Key)); - aStream.Read(FRepeatCount, SizeOf(FRepeatCount)); + aStream.Read(fKey, SizeOf(Key)); + aStream.Read(fRepeatCount, SizeOf(fRepeatCount)); end; procedure TSynCharEvent.Playback(aEditor: TCustomSynEdit); @@ -818,7 +824,7 @@ procedure TSynCharEvent.SaveToStream(aStream: TStream); { TSynPositionEvent } -function TSynPositionEvent.GetAsString: UnicodeString; +function TSynPositionEvent.GetAsString: string; begin Result := inherited GetAsString; // add position data here @@ -827,14 +833,14 @@ function TSynPositionEvent.GetAsString: UnicodeString; Result := Result + ' ' + IntToStr(RepeatCount); end; -procedure TSynPositionEvent.InitEventParameters(aStr: UnicodeString); +procedure TSynPositionEvent.InitEventParameters(aStr: string); var i, o, c, x, y: Integer; - valStr: UnicodeString; + valStr: string; begin inherited; // aStr should be (x, y) with optional repeat count whitespace separated - aStr := WideTrim(aStr); + aStr := Trim(aStr); i := Pos(',', aStr); o := Pos('(', aStr); c := Pos(')', aStr); @@ -844,13 +850,13 @@ procedure TSynPositionEvent.InitEventParameters(aStr: UnicodeString); valStr := Copy(aStr, o + 1, i - o - 1); x := StrToIntDef(valStr, 1); Delete(aStr, 1, i); - aStr := WideTrim(aStr); + aStr := Trim(aStr); c := Pos(')', aStr); valStr := Copy(aStr, 1, c - 1); y := StrToIntDef(valStr, 1); Position := BufferCoord(x, y); Delete(aStr, 1, c); - aStr := WideTrim(aStr); + aStr := Trim(aStr); RepeatCount := StrToIntDef(aStr, 1); end; end; @@ -867,7 +873,7 @@ procedure TSynPositionEvent.Initialize(aCmd: TSynEditorCommand; procedure TSynPositionEvent.LoadFromStream(aStream: TStream); begin - aStream.Read(FPosition, SizeOf(Position)); + aStream.Read(fPosition, SizeOf(Position)); end; procedure TSynPositionEvent.Playback(aEditor: TCustomSynEdit); @@ -886,34 +892,34 @@ procedure TSynPositionEvent.SaveToStream(aStream: TStream); { TSynStringEvent } -function TSynStringEvent.GetAsString: UnicodeString; +function TSynStringEvent.GetAsString: string; var Ident: string; begin EditorCommandToIdent(ecString, Ident); - Result := Ident + ' ' + WideQuotedStr(Value, #39); + Result := Ident + ' ' + AnsiQuotedStr(Value, #39); if RepeatCount > 1 then Result := Result + ' ' + IntToStr(RepeatCount); end; -procedure TSynStringEvent.InitEventParameters(aStr: UnicodeString); +procedure TSynStringEvent.InitEventParameters(aStr: string); var o, c: Integer; - valStr: UnicodeString; + valStr: string; begin // aStr = 'test' with optional whitespace separated repeat count o := Pos('''', aStr); - c := WideLastDelimiter('''', aStr); + c := LastDelimiter('''', aStr); valStr := Copy(aStr, o + 1, c - o - 1); - Value := UnicodeStringReplace(valStr, '''''', '''', [rfReplaceAll]); + Value := StringReplace(valStr, '''''', '''', [rfReplaceAll]); Delete(aStr, 1, c); - RepeatCount := StrToIntDef(WideTrim(aStr), 1); + RepeatCount := StrToIntDef(Trim(aStr), 1); end; procedure TSynStringEvent.Initialize(aCmd: TSynEditorCommand; aChar: WideChar; aData: Pointer); begin - Value := UnicodeString(aData); + Value := string(aData); end; procedure TSynStringEvent.LoadFromStream(aStream: TStream); @@ -926,11 +932,11 @@ procedure TSynStringEvent.LoadFromStream(aStream: TStream); try FillMemory(Buff, l, 0); aStream.Read(Buff^, l * sizeof(WideChar)); - FString := Buff; + fString := Buff; finally FreeMem(Buff); end; - aStream.Read(FRepeatCount, sizeof(FRepeatCount)); + aStream.Read(fRepeatCount, sizeof(fRepeatCount)); end; procedure TSynStringEvent.Playback(aEditor: TCustomSynEdit); @@ -960,7 +966,7 @@ procedure TSynStringEvent.SaveToStream(aStream: TStream); GetMem(Buff, l * sizeof(WideChar)); try FillMemory(Buff, l, 0); - WStrCopy(Buff, PWideChar(Value)); + StrCopy(Buff, PWideChar(Value)); aStream.Write(Buff^, l * sizeof(WideChar)); finally FreeMem(Buff); @@ -974,7 +980,7 @@ procedure TSynStringEvent.SaveToStream(aStream: TStream); constructor TSynMacroEvent.Create; begin inherited Create; - FRepeatCount := 1; + fRepeatCount := 1; end; end. diff --git a/Ext/SynEdit/Source/SynMemo.pas b/Ext/SynEdit/Source/SynMemo.pas deleted file mode 100644 index 541791f..0000000 --- a/Ext/SynEdit/Source/SynMemo.pas +++ /dev/null @@ -1,260 +0,0 @@ -{------------------------------------------------------------------------------- -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: SynMemo.pas, released 2000-04-07. -The Original Code is based on mwCustomEdit.pas by Martin Waldenburg, part of -the mwEdit component suite. -Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. -Unicode translation by Maël Hörz. -All Rights Reserved. - -Contributors to the SynEdit and mwEdit projects are listed in the -Contributors.txt file. - -Alternatively, the contents of this file may be used under the terms of the -GNU General Public License Version 2 or later (the "GPL"), in which case -the provisions of the GPL are applicable instead of those above. -If you wish to allow use of your version of this file only under the terms -of the GPL and not to allow others to use your version of this file -under the MPL, indicate your decision by deleting the provisions above and -replace them with the notice and other provisions required by the GPL. -If you do not delete the provisions above, a recipient may use your version -of this file under either the MPL or the GPL. - -$Id: SynMemo.pas,v 1.15.2.3 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: - - several EM_XXX messages aren't handled yet; - - EM_XXX messages aren't implemented on CLX, although this could be useful; --------------------------------------------------------------------------------} - -unit SynMemo; - -{$I SynEdit.inc} - -interface - -uses - RichEdit, - Windows, - Messages, - SynEdit, - SynEditTextBuffer, - SynEditTypes, - SysUtils, - Classes; - -type - TSynMemo = class(TSynEdit) - private - // EM_XXX see winuser.h (PSDK August 2001) - procedure EMGetSel(var Message: TMessage); message EM_GETSEL; - procedure EMSetSel(var Message: TMessage); message EM_SETSEL; - procedure EMGetModify(var Message: TMessage); message EM_GETMODIFY; - procedure EMSetModify(var Message: TMessage); message EM_SETMODIFY; - procedure EMGetLineCount(var Message: TMessage); message EM_GETLINECOUNT; - procedure EMGetSelText(var Message: TMessage); message EM_GETSELTEXT; //richedit.h - procedure EMReplaceSel(var Message: TMessage); message EM_REPLACESEL; - procedure EMGetLine(var Message: TMessage); message EM_GETLINE; - procedure EMCanUndo(var Message: TMessage); message EM_CANUNDO; - procedure EMUndo(var Message: TMessage); message EM_UNDO; - procedure EMGetFirstVisibleLine(var Message: TMessage); message EM_GETFIRSTVISIBLELINE; - procedure EMCharFromPos(var Message: TMessage); message EM_CHARFROMPOS; - end; - -implementation - -uses -{$IFDEF SYN_COMPILER_18_UP} - AnsiStrings, -{$ENDIF} -{$IFDEF UNICODE} - WideStrUtils, -{$ENDIF} - SynUnicode, - SynEditMiscProcs; - -{ TSynMemo } - -// EM_GETSEL -// wParam = (WPARAM) (LPDWORD) lpdwStart; // receives starting position -// lParam = (LPARAM) (LPDWORD) lpdwEnd; // receives ending position -procedure TSynMemo.EMGetSel(var Message: TMessage); -var - s, e: Integer; -begin - s := GetSelStart; - e := GetSelEnd; - if Message.wParam <> 0 then PDWORD(Message.wParam)^ := s; - if Message.lParam <> 0 then PDWORD(Message.lParam)^ := e; - Message.Result := MakeLong(s, e) -end; - -// EM_SETSEL -// wParam = (WPARAM) (INT) nStart; // starting position -// lParam = (LPARAM) (INT) nEnd; // ending position -procedure TSynMemo.EMSetSel(var Message: TMessage); -begin - SetSelStart(Message.wParam); - SetSelEnd(Message.lParam); -end; - -procedure TSynMemo.EMSetModify(var Message: TMessage); -begin - Modified := Message.wParam <> 0; -end; - -procedure TSynMemo.EMGetModify(var Message: TMessage); -begin - Message.Result := Integer(Modified); -end; - -procedure TSynMemo.EMGetLineCount(var Message: TMessage); -begin - //(WPARAM) wParam, // not used; must be zero - //(LPARAM) lParam // not used; must be zero - Message.Result := Lines.Count; -end; - -procedure TSynMemo.EMGetSelText(var Message: TMessage); -begin - if Message.lParam <> 0 then - begin - if IsWindowUnicode(Handle) then - WStrLCopy(PWideChar(Message.lParam), PWideChar(SelText), Length(SelText)) - else - {$IFDEF SYN_COMPILER_18_UP}AnsiStrings.{$ENDIF}StrLCopy(PAnsiChar(Message.lParam), PAnsiChar(AnsiString(SelText)), Length(SelText)); - Message.Result := Length(SelText); - end; -end; - - -// EM_REPLACESEL -// fCanUndo = (BOOL) wParam ; // flag that specifies whether replacement can be undone -// lpszReplace = (LPCTSTR) lParam ; // pointer to replacement text string -// see PasteFromClipboard CF_TEXT - use common function ? -// or use SetSelText/SetSelTextPrimitive (no undo) -procedure TSynMemo.EMReplaceSel(var Message: TMessage); -var - StartOfBlock: TBufferCoord; - EndOfBlock: TBufferCoord; -begin - if ReadOnly then Exit; - DoOnPaintTransient(ttBefore); - BeginUndoBlock; - try - if SelAvail and (Message.WParam <> 0){???} then - UndoList.AddChange(crDelete, BlockBegin, BlockEnd, SelText, SelectionMode); - StartOfBlock := BlockBegin; - EndOfBlock := BlockEnd; - BlockBegin := StartOfBlock; - BlockEnd := EndOfBlock; - LockUndo; - try - if IsWindowUnicode(Handle) then - SelText := PWideChar(Message.lParam) - else - SelText := UnicodeString(PAnsiChar(Message.lParam)) - finally - UnlockUndo; - end; - if (Message.WParam <> 0){???} then - UndoList.AddChange(crPaste, StartOfBlock, BlockEnd, SelText, smNormal); - finally - EndUndoBlock; - end; - EnsureCursorPosVisible; - // Selection should have changed... - StatusChanged([scSelection]); - - DoOnPaintTransient(ttAfter); -end; - -// wParam = line number -// lParam = line string (PAnsiChar/PWideChar) -// no terminating #0 -procedure TSynMemo.EMGetLine(var Message: TMessage); -var - DestAnsi, SourceAnsi: PAnsiChar; - DestWide, SourceWide: PWideChar; -begin - if {$IFNDEF SYN_COMPILER_16_UP}(Message.WParam >= 0) and {$ENDIF}(Integer(Message.WParam) < Lines.Count) then - begin - if IsWindowUnicode(Handle) then - begin - DestWide := PWideChar(Message.LParam); - SourceWide := PWideChar(Lines[Message.WParam]); - WStrLCopy(DestWide, SourceWide, PWord(Message.LParam)^); - Message.Result := WStrLen(DestWide); - end - else - begin - DestAnsi := PAnsiChar(Message.LParam); - SourceAnsi := PAnsiChar(AnsiString(Lines[Message.WParam])); - {$IFDEF SYN_COMPILER_18_UP}AnsiStrings.{$ENDIF}StrLCopy(DestAnsi, SourceAnsi, PWord(Message.LParam)^); - Message.Result := {$IFDEF SYN_COMPILER_18_UP}AnsiStrings.{$ENDIF}StrLen(DestAnsi); - end - end - else - Message.Result := 0; -end; - -//(WPARAM) wParam, // not used; must be zero -//(LPARAM) lParam // not used; must be zero -procedure TSynMemo.EMCanUndo(var Message: TMessage); -begin - Message.Result := Integer(CanUndo); -end; - -//(WPARAM) wParam, // not used; must be zero -//(LPARAM) lParam // not used; must be zero -procedure TSynMemo.EMUndo(var Message: TMessage); -begin - Message.Result := Integer(CanUndo); - Undo; -end; - -//(WPARAM) wParam, // not used; must be zero -//(LPARAM) lParam // not used; must be zero -procedure TSynMemo.EMGetFirstVisibleLine(var Message: TMessage); -begin - Message.Result := TopLine; -end; - -//(WPARAM) wParam, // not used; must be zero -//(LPARAM) lParam // point coordinates -procedure TSynMemo.EMCharFromPos(var Message: TMessage); -var - vPos: TBufferCoord; - i: Integer; -begin - vPos := DisplayToBufferPos(PixelsToRowColumn(Message.LParamLo, Message.LParamHi)); - - Dec(vPos.Line); - if vPos.Line >= Lines.Count then - vPos.Char := 1 - else if vPos.Char > Length(Lines[vPos.Line]) then - vPos.Char := Length(Lines[vPos.Line]) + 1; // ??? - - i := vPos.Line; - while i > 0 do - begin - Dec(i); - Inc(vPos.Char, Length(Lines[i]) + 2); - end; - - //todo: this can't be right, CharIndex can easily overflow - Message.Result := MakeLong(vPos.Char{CharIndex}, vPos.Line{Line zero based}); -end; - -end. diff --git a/Ext/SynEdit/Source/SynOmniSetupDialog.dfm b/Ext/SynEdit/Source/SynOmniSetupDialog.dfm new file mode 100644 index 0000000..88dc67b --- /dev/null +++ b/Ext/SynEdit/Source/SynOmniSetupDialog.dfm @@ -0,0 +1,946 @@ +object SynOmniSynSetup: TSynOmniSynSetup + Left = 917 + Top = 105 + HelpContext = 115 + BorderIcons = [biSystemMenu, biHelp] + BorderStyle = bsDialog + Caption = 'Omni Highlighter Setup' + ClientHeight = 561 + ClientWidth = 563 + Color = clBtnFace + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -12 + Font.Name = 'Segoe UI' + Font.Style = [] + Position = poMainFormCenter + ShowHint = True + OnCreate = FormCreate + DesignSize = ( + 563 + 561) + TextHeight = 15 + object lGeneralName: TLabel + Left = 8 + Top = 8 + Width = 35 + Height = 15 + Caption = 'Name:' + end + object lMasks: TLabel + Left = 178 + Top = 6 + Width = 182 + Height = 15 + Caption = 'File extensions, comma-separated:' + end + object edLanguagelName: TEdit + Left = 8 + Top = 24 + Width = 164 + Height = 23 + TabOrder = 0 + OnChange = edLanguagelNameChange + end + object gbComment: TGroupBox + Left = 8 + Top = 150 + Width = 346 + Height = 221 + Caption = 'Comment styles:' + TabOrder = 2 + object Bevel1: TBevel + Left = 170 + Top = 16 + Width = 9 + Height = 194 + Shape = bsLeftLine + end + object cCommentAnsi: TCheckBox + Left = 8 + Top = 16 + Width = 57 + Height = 17 + Hint = 'Pascal' + Caption = '(*'#8230'*)' + TabOrder = 0 + OnClick = edLanguagelNameChange + end + object cCommentPas: TCheckBox + Left = 8 + Top = 32 + Width = 57 + Height = 17 + Hint = 'Pascal' + Caption = '{'#8230'}' + TabOrder = 1 + OnClick = edLanguagelNameChange + end + object cCommentC: TCheckBox + Left = 8 + Top = 96 + Width = 57 + Height = 17 + Hint = 'Ansi' + Caption = '/*'#8230'*/' + TabOrder = 5 + OnClick = edLanguagelNameChange + end + object cCommentSpec: TCheckBox + Left = 284 + Top = 16 + Width = 49 + Height = 17 + Caption = '/' + TabOrder = 43 + OnClick = edLanguagelNameChange + end + object cCommentBas: TCheckBox + Left = 183 + Top = 160 + Width = 33 + Height = 17 + Hint = 'Basic based' + Caption = #8230' ;' + TabOrder = 31 + OnClick = edLanguagelNameChange + end + object cCommentFox: TCheckBox + Left = 231 + Top = 112 + Width = 41 + Height = 17 + Caption = '* &&&&' + TabOrder = 38 + OnClick = edLanguagelNameChange + end + object cCommentREM: TCheckBox + Left = 284 + Top = 80 + Width = 57 + Height = 17 + Hint = 'MS-Dos Bat' + Caption = 'REM ::' + TabOrder = 47 + OnClick = edLanguagelNameChange + end + object cCommentExcl: TCheckBox + Left = 183 + Top = 32 + Width = 33 + Height = 17 + Caption = '!' + TabOrder = 24 + OnClick = edLanguagelNameChange + end + object cCommentBy: TCheckBox + Left = 183 + Top = 112 + Width = 33 + Height = 17 + Caption = '@' + TabOrder = 28 + OnClick = edLanguagelNameChange + end + object cCommentSharp: TCheckBox + Left = 183 + Top = 16 + Width = 33 + Height = 17 + Caption = '#' + TabOrder = 23 + OnClick = edLanguagelNameChange + end + object cCommentSlash: TCheckBox + Left = 284 + Top = 48 + Width = 41 + Height = 17 + Caption = '//' + TabOrder = 45 + OnClick = edLanguagelNameChange + end + object cCommentPercent: TCheckBox + Left = 183 + Top = 48 + Width = 33 + Height = 17 + Caption = '%' + TabOrder = 25 + OnClick = edLanguagelNameChange + end + object cCommentSinglQ: TCheckBox + Left = 183 + Top = 80 + Width = 33 + Height = 17 + Caption = #39 + TabOrder = 26 + OnClick = edLanguagelNameChange + end + object cCommentSQL: TCheckBox + Left = 231 + Top = 80 + Width = 33 + Height = 17 + Hint = 'SQL' + Caption = '--' + TabOrder = 36 + OnClick = edLanguagelNameChange + end + object cCommentDblQ: TCheckBox + Left = 183 + Top = 96 + Width = 33 + Height = 17 + Caption = '"' + TabOrder = 27 + OnClick = edLanguagelNameChange + end + object cCommentFortran: TCheckBox + Left = 231 + Top = 48 + Width = 33 + Height = 17 + Hint = 'Fortran' + Caption = 'C' + TabOrder = 34 + OnClick = edLanguagelNameChange + end + object cCommentCStar: TCheckBox + Left = 231 + Top = 64 + Width = 33 + Height = 17 + Caption = 'C*' + TabOrder = 35 + OnClick = edLanguagelNameChange + end + object cCommentDollar: TCheckBox + Left = 8 + Top = 176 + Width = 65 + Height = 17 + Caption = '$('#8230'$) $*' + TabOrder = 10 + OnClick = edLanguagelNameChange + end + object cCommentLBracket: TCheckBox + Left = 183 + Top = 144 + Width = 33 + Height = 17 + Caption = '{' + TabOrder = 30 + OnClick = edLanguagelNameChange + end + object cCommentPoco: TCheckBox + Left = 231 + Top = 128 + Width = 41 + Height = 17 + Hint = 'Poco' + Caption = '* ;' + TabOrder = 39 + OnClick = edLanguagelNameChange + end + object cCommentSmart: TCheckBox + Left = 8 + Top = 64 + Width = 57 + Height = 17 + Hint = 'Smarty' + Caption = '{*'#8230'*}' + TabOrder = 3 + OnClick = edLanguagelNameChange + end + object cCommentHaskell: TCheckBox + Left = 8 + Top = 48 + Width = 57 + Height = 17 + Hint = 'Haskell' + Caption = '{-'#8230'-}' + TabOrder = 2 + OnClick = edLanguagelNameChange + end + object cCommentPipe: TCheckBox + Left = 183 + Top = 128 + Width = 33 + Height = 17 + Hint = 'Baan4GL' + Caption = '|' + TabOrder = 29 + OnClick = edLanguagelNameChange + end + object cCommentWebFocus: TCheckBox + Left = 231 + Top = 96 + Width = 41 + Height = 17 + Hint = 'WebFocus' + Caption = '-*' + TabOrder = 37 + OnClick = edLanguagelNameChange + end + object cCommentD: TCheckBox + Left = 8 + Top = 80 + Width = 57 + Height = 17 + Hint = 'D language' + Caption = '/+'#8230'+/' + TabOrder = 4 + OnClick = edLanguagelNameChange + end + object cCommentJCL: TCheckBox + Left = 8 + Top = 112 + Width = 57 + Height = 17 + Hint = 'IBM mainframe JCL' + Caption = '//*'#8230'*//' + TabOrder = 6 + OnClick = edLanguagelNameChange + end + object cCommentDMIS: TCheckBox + Left = 231 + Top = 32 + Width = 33 + Height = 17 + Hint = 'DMIS - Dimensional Measuring Interface Specification' + Caption = '$$' + TabOrder = 33 + OnClick = edLanguagelNameChange + end + object cCommentVLisp: TCheckBox + Left = 8 + Top = 160 + Width = 49 + Height = 17 + Hint = 'VLisp (AutoCad)' + Caption = ';|'#8230'|;' + TabOrder = 9 + OnClick = edLanguagelNameChange + end + object cCommentDead: TCheckBox + Left = 88 + Top = 64 + Width = 65 + Height = 17 + Hint = 'Jovial language (Algol derivative)' + Caption = '"'#8230'"' + TabOrder = 15 + OnClick = edLanguagelNameChange + end + object cCommentCLisp: TCheckBox + Left = 88 + Top = 16 + Width = 65 + Height = 17 + Hint = 'CLisp (AutoCad)' + Caption = '#|'#8230'|#' + TabOrder = 12 + OnClick = edLanguagelNameChange + end + object cComment2Excl: TCheckBox + Left = 88 + Top = 48 + Width = 65 + Height = 17 + Hint = 'Mynx' + Caption = '!!'#8230' !!' + TabOrder = 14 + OnClick = edLanguagelNameChange + end + object cCommentCPL: TCheckBox + Left = 231 + Top = 16 + Width = 33 + Height = 17 + Hint = 'CPL' + Caption = '$' + TabOrder = 32 + OnClick = edLanguagelNameChange + end + object cCommentDollarMulti: TCheckBox + Left = 8 + Top = 144 + Width = 57 + Height = 17 + Hint = 'Crossing, Vissim' + Caption = '$'#8230'$' + TabOrder = 8 + OnClick = edLanguagelNameChange + end + object cCommentForth: TCheckBox + Left = 88 + Top = 80 + Width = 57 + Height = 17 + Hint = 'Forth' + Caption = '( '#8230' ) \' + TabOrder = 16 + OnClick = edLanguagelNameChange + end + object cCommentHTML: TCheckBox + Left = 8 + Top = 128 + Width = 57 + Height = 17 + Hint = 'HTML' + Caption = '' + TabOrder = 7 + end + object cCommentTab: TCheckBox + Left = 284 + Top = 96 + Width = 59 + Height = 17 + Hint = 'TAB key' + Caption = 'Tab' + TabOrder = 48 + OnClick = edLanguagelNameChange + end + object cCommentStars: TCheckBox + Left = 231 + Top = 144 + Width = 33 + Height = 17 + Hint = 'Odin, Abaqus' + Caption = '**' + TabOrder = 40 + OnClick = edLanguagelNameChange + end + object cCommentLua: TCheckBox + Left = 88 + Top = 96 + Width = 57 + Height = 17 + Hint = 'LUA' + Caption = '--[[ '#8230' ]]' + TabOrder = 17 + OnClick = edLanguagelNameChange + end + object cCommentPCL: TCheckBox + Left = 231 + Top = 160 + Width = 33 + Height = 17 + Hint = 'PCL extension' + Caption = '!*' + TabOrder = 41 + OnClick = edLanguagelNameChange + end + object cCommentLilypond: TCheckBox + Left = 88 + Top = 112 + Width = 65 + Height = 17 + Hint = 'Lilypond' + Caption = '%('#8230'%)' + TabOrder = 18 + OnClick = edLanguagelNameChange + end + object cCommentSpace: TCheckBox + Left = 284 + Top = 112 + Width = 59 + Height = 17 + Hint = 'Descript.ion' + Caption = 'Space' + TabOrder = 49 + OnClick = edLanguagelNameChange + end + object cCommentJCL2: TCheckBox + Left = 284 + Top = 64 + Width = 41 + Height = 17 + Caption = '//*' + TabOrder = 46 + OnClick = edLanguagelNameChange + end + object cCommentAutomaton: TCheckBox + Left = 183 + Top = 64 + Width = 41 + Height = 17 + Hint = 'Automaton' + Caption = '%%' + TabOrder = 50 + OnClick = edLanguagelNameChange + end + object cCommentLineC: TCheckBox + Left = 284 + Top = 32 + Width = 49 + Height = 17 + Caption = '/*' + TabOrder = 44 + OnClick = edLanguagelNameChange + end + object cCommentOkuma: TCheckBox + Left = 88 + Top = 128 + Width = 57 + Height = 17 + Hint = 'OKUMA, OSP' + Caption = '('#8230')' + TabOrder = 19 + OnClick = edLanguagelNameChange + end + object cCommentHeller: TCheckBox + Left = 88 + Top = 144 + Width = 65 + Height = 17 + Hint = 'HELLER, UniPro CNC-90' + Caption = '(*'#8230') (/'#8230')' + TabOrder = 20 + OnClick = edLanguagelNameChange + end + object cCommentPwShell: TCheckBox + Left = 88 + Top = 160 + Width = 57 + Height = 17 + Hint = 'Power Shell' + Caption = '<#'#8230'#>' + TabOrder = 21 + OnClick = edLanguagelNameChange + end + object cCommentDash: TCheckBox + Left = 284 + Top = 128 + Width = 49 + Height = 17 + Hint = 'MEGA' + Caption = '-' + TabOrder = 51 + OnClick = edLanguagelNameChange + end + object cCommentSS: TCheckBox + Left = 88 + Top = 176 + Width = 57 + Height = 17 + Hint = 'From * to ;' + Caption = '*'#8230' ;' + TabOrder = 22 + OnClick = edLanguagelNameChange + end + object cCommentBackSlash: TCheckBox + Left = 284 + Top = 144 + Width = 49 + Height = 17 + Hint = '4680 Basic' + Caption = '\' + TabOrder = 52 + OnClick = edLanguagelNameChange + end + object cCommentAngleBracket: TCheckBox + Left = 284 + Top = 160 + Width = 49 + Height = 17 + Caption = '<<<' + TabOrder = 53 + OnClick = edLanguagelNameChange + end + object cCommentINI: TCheckBox + Left = 183 + Top = 176 + Width = 33 + Height = 17 + Hint = 'INI file based' + Caption = ';' + TabOrder = 54 + OnClick = edLanguagelNameChange + end + object cCommentTexInfo: TCheckBox + Left = 8 + Top = 192 + Width = 95 + Height = 17 + Hint = 'TexInfo comment @c. @ignore ... @end ignore, @bye' + Caption = '@c, @ignore' + TabOrder = 11 + OnClick = edLanguagelNameChange + end + object cCommentEuklid: TCheckBox + Left = 231 + Top = 176 + Width = 33 + Height = 17 + Hint = 'Euklid+' + Caption = '..' + TabOrder = 42 + OnClick = edLanguagelNameChange + end + object cCommentAutoIt: TCheckBox + Left = 88 + Top = 32 + Width = 75 + Height = 17 + Hint = 'AutoIt3' + Caption = '#cs .. #ce' + TabOrder = 13 + OnClick = edLanguagelNameChange + end + end + object gbStrings: TGroupBox + Left = 8 + Top = 380 + Width = 166 + Height = 137 + Caption = 'Strings:' + TabOrder = 3 + object rSingleQuote: TCheckBox + AlignWithMargins = True + Left = 5 + Top = 20 + Width = 156 + Height = 17 + Align = alTop + Caption = 'Single quotation marks' + Checked = True + State = cbChecked + TabOrder = 0 + OnClick = edLanguagelNameChange + end + object rDoubleQuote: TCheckBox + Left = 5 + Top = 39 + Width = 145 + Height = 17 + Caption = 'Double quotes' + TabOrder = 1 + OnClick = edLanguagelNameChange + end + object rApostropheQuote: TCheckBox + Left = 5 + Top = 58 + Width = 145 + Height = 17 + Caption = 'Inverted apostrophes' + TabOrder = 2 + OnClick = edLanguagelNameChange + end + object eEscChar: TEdit + Left = 128 + Top = 81 + Width = 25 + Height = 23 + MaxLength = 1 + TabOrder = 3 + Text = '\' + end + object cEscString: TCheckBox + Left = 5 + Top = 84 + Width = 98 + Height = 17 + Caption = 'String escapes' + TabOrder = 4 + OnClick = edLanguagelNameChange + end + end + object bLoad: TButton + Left = 16 + Top = 527 + Width = 65 + Height = 25 + Anchors = [akLeft, akBottom] + Caption = '&Load' + TabOrder = 5 + OnClick = bLoadClick + end + object bSave: TButton + Left = 88 + Top = 527 + Width = 65 + Height = 25 + Anchors = [akLeft, akBottom] + Caption = '&Save' + Enabled = False + TabOrder = 6 + OnClick = bSaveClick + end + object btnCancel: TButton + Left = 460 + Top = 527 + Width = 75 + Height = 25 + Anchors = [akLeft, akRight, akBottom] + Cancel = True + Caption = '&Cancel' + ModalResult = 2 + TabOrder = 7 + end + object edFileType: TEdit + Left = 178 + Top = 25 + Width = 182 + Height = 23 + CharCase = ecLowerCase + TabOrder = 1 + OnChange = edLanguagelNameChange + OnKeyPress = edFileTypeKeyPress + end + object gbMisc: TGroupBox + Left = 180 + Top = 380 + Width = 174 + Height = 137 + Caption = 'Other Options:' + TabOrder = 4 + object cRubySymbols: TCheckBox + Left = 8 + Top = 74 + Width = 137 + Height = 17 + Caption = 'Ruby symbols' + TabOrder = 0 + OnClick = edLanguagelNameChange + end + object cPHPVariable: TCheckBox + Left = 8 + Top = 56 + Width = 137 + Height = 17 + Caption = 'PHP style variables' + TabOrder = 1 + OnClick = edLanguagelNameChange + end + object cVectors: TCheckBox + Left = 8 + Top = 38 + Width = 137 + Height = 17 + Caption = 'Vectors' + TabOrder = 2 + OnClick = edLanguagelNameChange + end + object cHTML: TCheckBox + Left = 8 + Top = 20 + Width = 164 + Height = 17 + Caption = 'HTML' + TabOrder = 3 + OnClick = edLanguagelNameChange + end + object cPreprocessors: TCheckBox + Left = 8 + Top = 92 + Width = 137 + Height = 17 + Caption = 'Preprocesor' + TabOrder = 4 + OnClick = edLanguagelNameChange + end + object cLabel: TCheckBox + Left = 8 + Top = 114 + Width = 137 + Height = 17 + Caption = 'Label' + Checked = True + State = cbChecked + TabOrder = 5 + OnClick = edLanguagelNameChange + end + end + object btnOK: TButton + Left = 373 + Top = 528 + Width = 75 + Height = 25 + Anchors = [akLeft, akRight, akBottom] + Caption = '&OK' + Default = True + ModalResult = 1 + TabOrder = 8 + end + object gProperties: TGroupBox + Left = 8 + Top = 53 + Width = 352 + Height = 84 + TabOrder = 9 + object lCodeFoldingType: TLabel + Left = 14 + Top = 37 + Width = 98 + Height = 15 + Caption = 'Code folding type:' + end + object lKeyWordChars: TLabel + Left = 14 + Top = 58 + Width = 169 + Height = 15 + Caption = 'Allowed characters in keywords:' + end + object cCaseSensitive: TCheckBox + Left = 14 + Top = 14 + Width = 185 + Height = 17 + Caption = 'Case sensitive' + TabOrder = 0 + OnClick = edLanguagelNameChange + end + object cbCodeFolding: TComboBox + Left = 224 + Top = 29 + Width = 109 + Height = 23 + Style = csDropDownList + TabOrder = 1 + OnChange = edLanguagelNameChange + end + object eKeyWordChars: TEdit + Left = 224 + Top = 56 + Width = 109 + Height = 22 + Font.Charset = EASTEUROPE_CHARSET + Font.Color = clWindowText + Font.Height = -11 + Font.Name = 'Courier New' + Font.Style = [fsBold] + ParentFont = False + TabOrder = 2 + Text = '_' + OnChange = edLanguagelNameChange + end + end + object gbxKeywords: TGroupBox + Left = 366 + Top = 8 + Width = 194 + Height = 509 + Anchors = [akLeft, akTop, akRight, akBottom] + Caption = 'Keywords:' + TabOrder = 10 + object pageKeyWords: TPageControl + Left = 2 + Top = 17 + Width = 190 + Height = 490 + ActivePage = tsKeyWords1 + Align = alClient + TabOrder = 0 + TabWidth = 30 + object tsKeyWords1: TTabSheet + Caption = '1' + object mKeyWords: TMemo + Left = 0 + Top = 0 + Width = 182 + Height = 434 + Align = alTop + ScrollBars = ssVertical + TabOrder = 0 + WordWrap = False + OnChange = edLanguagelNameChange + end + object cKW1StartWith: TCheckBox + AlignWithMargins = True + Left = 3 + Top = 440 + Width = 176 + Height = 17 + Align = alBottom + Caption = 'Keyword prefixes' + TabOrder = 1 + end + end + object tsKeyWords2: TTabSheet + Caption = '2' + ImageIndex = 1 + object mResWords: TMemo + Left = 0 + Top = 0 + Width = 182 + Height = 433 + Align = alTop + ScrollBars = ssVertical + TabOrder = 0 + WordWrap = False + OnChange = edLanguagelNameChange + end + object cKW2StartWith: TCheckBox + AlignWithMargins = True + Left = 3 + Top = 440 + Width = 176 + Height = 17 + Align = alBottom + Caption = 'Keyword prefixes' + TabOrder = 1 + end + end + object tsKeyWords3: TTabSheet + Caption = '3' + ImageIndex = 3 + object mKeyWords2: TMemo + Left = 0 + Top = 0 + Width = 182 + Height = 434 + Align = alTop + ScrollBars = ssVertical + TabOrder = 0 + WordWrap = False + OnChange = edLanguagelNameChange + end + object cKW3StartWith: TCheckBox + AlignWithMargins = True + Left = 3 + Top = 440 + Width = 176 + Height = 17 + Align = alBottom + Caption = 'Keyword prefixes' + TabOrder = 1 + end + end + object tsKeyWords4: TTabSheet + Caption = '4' + ImageIndex = 2 + object mKeyWords3: TMemo + Left = 0 + Top = 0 + Width = 182 + Height = 433 + Align = alTop + ScrollBars = ssVertical + TabOrder = 0 + WordWrap = False + OnChange = edLanguagelNameChange + end + object cKW4StartWith: TCheckBox + AlignWithMargins = True + Left = 3 + Top = 440 + Width = 176 + Height = 17 + Align = alBottom + Caption = 'Keyword prefixes' + TabOrder = 1 + end + end + end + end + object OpenDialog: TOpenDialog + DefaultExt = '.ini' + Filter = 'HighLighters (*.ini)|*.ini' + Left = 408 + Top = 40 + end +end diff --git a/Ext/SynEdit/Source/SynOmniSetupDialog.pas b/Ext/SynEdit/Source/SynOmniSetupDialog.pas new file mode 100644 index 0000000..927712d --- /dev/null +++ b/Ext/SynEdit/Source/SynOmniSetupDialog.pas @@ -0,0 +1,473 @@ +unit SynOmniSetupDialog; + +interface + +uses + Winapi.Windows, + Winapi.Messages, + System.UITypes, + System.Classes, + Vcl.Dialogs, + Vcl.Controls, + Vcl.Forms, + Vcl.StdCtrls, + Vcl.ComCtrls, + Vcl.ExtCtrls, + SynHighlighterOmni; + +type + TSynOmniSynSetup = class(TForm) + lGeneralName: TLabel; + lMasks: TLabel; + edLanguagelName: TEdit; + gbComment: TGroupBox; + cCommentAnsi: TCheckBox; + cCommentPas: TCheckBox; + cCommentC: TCheckBox; + cCommentSpec: TCheckBox; + cCommentBas: TCheckBox; + cCommentFox: TCheckBox; + gbStrings: TGroupBox; + bLoad: TButton; + bSave: TButton; + btnCancel: TButton; + edFileType: TEdit; + cCommentREM: TCheckBox; + cCommentExcl: TCheckBox; + rSingleQuote: TCheckBox; + rDoubleQuote: TCheckBox; + cCommentBy: TCheckBox; + cCommentSharp: TCheckBox; + cCommentSlash: TCheckBox; + cCommentPercent: TCheckBox; + cCommentSinglQ: TCheckBox; + gbMisc: TGroupBox; + cCommentSQL: TCheckBox; + cCommentDblQ: TCheckBox; + cCommentFortran: TCheckBox; + cCommentCStar: TCheckBox; + cCommentDollar: TCheckBox; + pageKeyWords: TPageControl; + tsKeyWords1: TTabSheet; + tsKeyWords2: TTabSheet; + tsKeyWords4: TTabSheet; + tsKeyWords3: TTabSheet; + mKeyWords: TMemo; + mResWords: TMemo; + mKeyWords3: TMemo; + mKeyWords2: TMemo; + cCommentLBracket: TCheckBox; + cCommentPoco: TCheckBox; + cCommentSmart: TCheckBox; + cCommentHaskell: TCheckBox; + cCommentPipe: TCheckBox; + cCommentWebFocus: TCheckBox; + cCommentD: TCheckBox; + cCommentJCL: TCheckBox; + cCommentDMIS: TCheckBox; + cCommentVLisp: TCheckBox; + cCommentDead: TCheckBox; + cCommentCLisp: TCheckBox; + cComment2Excl: TCheckBox; + cCommentCPL: TCheckBox; + cCommentDollarMulti: TCheckBox; + Bevel1: TBevel; + cCommentForth: TCheckBox; + cCommentHTML: TCheckBox; + cCommentTab: TCheckBox; + cCommentStars: TCheckBox; + cCommentLua: TCheckBox; + cCommentPCL: TCheckBox; + cCommentLilypond: TCheckBox; + cCommentSpace: TCheckBox; + cCommentJCL2: TCheckBox; + cCommentAutomaton: TCheckBox; + cCommentLineC: TCheckBox; + cCommentOkuma: TCheckBox; + cCommentHeller: TCheckBox; + cCommentPwShell: TCheckBox; + cCommentDash: TCheckBox; + cCommentSS: TCheckBox; + cCommentBackSlash: TCheckBox; + cCommentAngleBracket: TCheckBox; + cCommentINI: TCheckBox; + cCommentTexInfo: TCheckBox; + cCommentEuklid: TCheckBox; + rApostropheQuote: TCheckBox; + cCommentAutoIt: TCheckBox; + cKW2StartWith: TCheckBox; + cKW1StartWith: TCheckBox; + cKW3StartWith: TCheckBox; + cKW4StartWith: TCheckBox; + OpenDialog: TOpenDialog; + cRubySymbols: TCheckBox; + cPHPVariable: TCheckBox; + cVectors: TCheckBox; + cHTML: TCheckBox; + btnOK: TButton; + cPreprocessors: TCheckBox; + eEscChar: TEdit; + cEscString: TCheckBox; + cLabel: TCheckBox; + gProperties: TGroupBox; + cCaseSensitive: TCheckBox; + cbCodeFolding: TComboBox; + eKeyWordChars: TEdit; + lCodeFoldingType: TLabel; + lKeyWordChars: TLabel; + gbxKeywords: TGroupBox; + procedure edLanguagelNameChange(Sender: TObject); + procedure edFileTypeKeyPress(Sender: TObject; var Key: Char); + procedure bLoadClick(Sender: TObject); + procedure bSaveClick(Sender: TObject); + procedure FormCreate(Sender: TObject); + private + procedure LoadFromHighligther(OmniHL: TSynOmniSyn); + procedure SaveToHighligther(OmniHL: TSynOmniSyn); + + procedure SaveHighLighterToFile(const AName: string); + procedure LoadHighLighterFromFile(const AName: string); + end; + +function EditOmniHighlighter(OmniHL: TSynOmniSyn; HighlighterDir: string = ''): Boolean; + +implementation + +{$R *.DFM} + +uses + System.TypInfo, + System.SysUtils, + System.Math, + System.IniFiles, + SynEditStrConst; + +procedure TSynOmniSynSetup.edLanguagelNameChange(Sender: TObject); +begin + bSave.Enabled := edLanguagelName.Text <> ''; +end; + +procedure TSynOmniSynSetup.edFileTypeKeyPress(Sender: TObject; + var Key: Char); +begin + if not CharInSet(Key, [#0..#31, '0'..'9', 'a'..'z', 'A'..'Z', '+', ',', '*', '.', '-', '_']) then Key := #0; +end; + +procedure TSynOmniSynSetup.bLoadClick(Sender: TObject); +begin + Update; + if OpenDialog.Execute then + begin + LoadHighLighterFromFile(OpenDialog.FileName); + OpenDialog.InitialDir := ExtractFileDir(OpenDialog.FileName); + end; +end; + +procedure TSynOmniSynSetup.bSaveClick(Sender: TObject); +begin + with TSaveDialog.Create(nil) do + begin + InitialDir := OpenDialog.InitialDir; + Filter := OpenDialog.Filter; + DefaultExt := OpenDialog.DefaultExt; + FileName := edLanguagelName.Text + DefaultExt; + if Execute then + SaveHighLighterToFile(FileName); + end; +end; + +procedure TSynOmniSynSetup.LoadFromHighligther(OmniHL: TSynOmniSyn); +var + Str: string; + Idx: Integer; +begin + edLanguagelName.Text := OmniHL.LangName; + + Idx := OmniHL.DefaultFilter.IndexOf('|'); + if Idx >= 0 then + begin + Str := OmniHL.DefaultFilter.Substring(Idx + 1); + edFileType.Text := StringReplace(Str, ';', ',', [rfReplaceAll]); + end + else + edFileType.Text := ''; + + cHTML.Checked := OmniHL.HighLighterGroup = hgHTML; + { Comments } + cCommentAnsi.Checked := csAnsiStyle in OmniHL.Comments; + cCommentPas.Checked := csPasStyle in OmniHL.Comments; + cCommentC.Checked := csCStyle in OmniHL.Comments; + cCommentDollar.Checked := csDollar in OmniHL.Comments; + cCommentSmart.Checked := csSmartStyle in OmniHL.Comments; + cCommentHaskell.Checked := csHaskell in OmniHL.Comments; + cCommentD.Checked := csDStyle in OmniHL.Comments; + cCommentJCL.Checked := csJCLStyle in OmniHL.Comments; + cCommentVLisp.Checked := csVLisp in OmniHL.Comments; + cCommentCLisp.Checked := csCLisp in OmniHL.Comments; + cCommentDead.Checked := csDead in OmniHL.Comments; + cComment2Excl.Checked := cs2Excl in OmniHL.Comments; + cCommentDollarMulti.Checked := csDollarMulti in OmniHL.Comments; + cCommentForth.Checked := csForth in OmniHL.Comments; + cCommentHTML.Checked := csHTML in OmniHL.Comments; + cCommentLua.Checked := csLUA in OmniHL.Comments; + cCommentLilypond.Checked := csLilypond in OmniHL.Comments; + cCommentOkuma.Checked := csOkuma in OmniHL.Comments; + cCommentHeller.Checked := csHeller in OmniHL.Comments; + cCommentPwShell.Checked := csPwShell in OmniHL.Comments; + cCommentSS.Checked := csStarSemicol in OmniHL.Comments; + cCommentTexInfo.Checked := csTexInfo in OmniHL.Comments; + cCommentAutoIt.Checked := csAutoit in OmniHL.Comments; + + { Single line comments } + cCommentCPL.Checked := csCPL in OmniHL.SingleLineComments; + cCommentSpec.Checked := csSpecStyle in OmniHL.SingleLineComments; + cCommentBackSlash.Checked := csBackSlashStyle in OmniHL.SingleLineComments; + cCommentLineC.Checked := csLineC in OmniHL.SingleLineComments; + cCommentBas.Checked := csBasStyle in OmniHL.SingleLineComments; + cCommentINI.Checked := csINIStyle in OmniHL.SingleLineComments; + cCommentFox.Checked := csFoxStyle in OmniHL.SingleLineComments; + cCommentREM.Checked := csBatStyle in OmniHL.SingleLineComments; + cCommentExcl.Checked := csExclStyle in OmniHL.SingleLineComments; + cCommentBy.Checked := csByStyle in OmniHL.SingleLineComments; + cCommentSharp.Checked := csSharpStyle in OmniHL.SingleLineComments; + cCommentSlash.Checked := csSlashStyle in OmniHL.SingleLineComments; + cCommentPercent.Checked := csPercentStyle in OmniHL.SingleLineComments; + cCommentAutomaton.Checked := csAutomaton in OmniHL.SingleLineComments; + cCommentSinglQ.Checked := csSinglQStyle in OmniHL.SingleLineComments; + cCommentDblQ.Checked := csDblQStyle in OmniHL.SingleLineComments; + cCommentSQL.Checked := csSQLStyle in OmniHL.SingleLineComments; + cCommentCStar.Checked := csCStar in OmniHL.SingleLineComments; + cCommentFortran.Checked := csFortran in OmniHL.SingleLineComments; + cCommentLBracket.Checked := csLeftBracket in OmniHL.SingleLineComments; + cCommentPoco.Checked := csPocoStyle in OmniHL.SingleLineComments; + cCommentPipe.Checked := csPipe in OmniHL.SingleLineComments; + cCommentWebFocus.Checked := csWebFocus in OmniHL.SingleLineComments; + cCommentDMIS.Checked := csDMISStyle in OmniHL.SingleLineComments; + cCommentTab.Checked := csTabKey in OmniHL.SingleLineComments; + cCommentStars.Checked := cs2Stars in OmniHL.SingleLineComments; + cCommentPCL.Checked := csPCL in OmniHL.SingleLineComments; + cCommentEuklid.Checked := csEuklid in OmniHL.SingleLineComments; + cCommentSpace.Checked := csSpace in OmniHL.SingleLineComments; + cCommentJCL2.Checked := csJCL in OmniHL.SingleLineComments; + cCommentDash.Checked := csDash in OmniHL.SingleLineComments; + cCommentAngleBracket.Checked := csAngleBrackets in OmniHL.SingleLineComments; + + { String delimeters } + rSingleQuote.Checked := sdSingleQuote in OmniHL.StringDelim; + rApostropheQuote.Checked := sdApostropheQuote in OmniHL.StringDelim; + rDoubleQuote.Checked := sdDoubleQuote in OmniHL.StringDelim; + + cEscString.Checked := OmniHL.EscapedStrings; + eEscChar.Text := OmniHL.EscapeChar; + + cPreprocessors.Checked := OmniHL.DetectPreprocessor; + cLabel.Checked := OmniHL.HasLabel; + cVectors.Checked := OmniHL.VectorSupport; + cPHPVariable.Checked := OmniHL.PHPVariable; + cRubySymbols.Checked := OmniHL.RubySymbols; + + cCaseSensitive.Checked := OmniHL.CaseSensitive; + cbCodeFolding.ItemIndex := Integer(OmniHL.CodeFoldingType); + + cKW1StartWith.Checked := OmniHL.KW1StartWith; + cKW2StartWith.Checked := OmniHL.KW2StartWith; + cKW3StartWith.Checked := OmniHL.KW3StartWith; + cKW4StartWith.Checked := OmniHL.KW4StartWith; + + mKeyWords.Clear; mKeyWords.Lines.AddStrings(OmniHL.KeyWords); + mResWords.Clear; mResWords.Lines.AddStrings(OmniHL.ResWords); + mKeyWords2.Clear; mKeyWords2.Lines.AddStrings(OmniHL.KeyWords2); + mKeyWords3.Clear; mKeyWords3.Lines.AddStrings(OmniHL.KeyWords3); + eKeyWordChars.Text := OmniHL.KeyWordChars; +end; + +procedure TSynOmniSynSetup.LoadHighLighterFromFile(const AName: string); +var + Loaded: Boolean; +begin + var OmniHL := TSynOmniSyn.Create(nil); + try + try + Loaded := OmniHL.LoadFromIniFile(AName); + except + Loaded := False; + end; + if not Loaded then + MessageDlg(Format(SYNS_LoadError, [AName]), mtError, [mbOK], 0) + else + LoadFromHighligther(OmniHL); + finally + OmniHL.Free; + end; +end; + +function UserCompareText(List: TStringList; Index1, Index2: Integer): Integer; +begin + Result := CompareText(List.Strings[Index1], List.Strings[Index2]); +end; + +function UserCompareStr(List: TStringList; Index1, Index2: Integer): Integer; +begin + Result := CompareStr(List.Strings[Index1], List.Strings[Index2]); +end; + + +procedure TSynOmniSynSetup.SaveToHighligther(OmniHL: TSynOmniSyn); +var + Str: string; + CommentStyles: TCommentStyles; + SingleLineComments: TSingleLineComments; +begin + OmniHL.LangName := edLanguagelName.Text; + Str := StringReplace(edFileType.Text, ',', ';', [rfReplaceAll]); + OmniHL.DefaultFilter := + Format('%s %s (%s)|%2:s', [OmniHL.LangName, SYNS_Files, Str]); + if cHTML.Checked then + OmniHL.HighLighterGroup := hgHTML + else + OmniHL.HighLighterGroup := hgNone; + CommentStyles := []; + SingleLineComments := []; + { Comments } + if cCommentAnsi.Checked then Include(CommentStyles, csAnsiStyle); + if cCommentPas.Checked then Include(CommentStyles, csPasStyle); + if cCommentC.Checked then Include(CommentStyles, csCStyle); + if cCommentDollar.Checked then Include(CommentStyles, csDollar); + if cCommentSmart.Checked then Include(CommentStyles, csSmartStyle); + if cCommentHaskell.Checked then Include(CommentStyles, csHaskell); + if cCommentD.Checked then Include(CommentStyles, csDStyle); + if cCommentJCL.Checked then Include(CommentStyles, csJCLStyle); + if cCommentVLisp.Checked then Include(CommentStyles, csVLisp); + if cCommentCLisp.Checked then Include(CommentStyles, csCLisp); + if cCommentDead.Checked then Include(CommentStyles, csDead); + if cComment2Excl.Checked then Include(CommentStyles, cs2Excl); + if cCommentDollarMulti.Checked then Include(CommentStyles, csDollarMulti); + if cCommentForth.Checked then Include(CommentStyles, csForth); + if cCommentHTML.Checked then Include(CommentStyles, csHTML); + if cCommentLua.Checked then Include(CommentStyles, csLUA); + if cCommentLilypond.Checked then Include(CommentStyles, csLilypond); + if cCommentOkuma.Checked then Include(CommentStyles, csOkuma); + if cCommentHeller.Checked then Include(CommentStyles, csHeller); + if cCommentPwShell.Checked then Include(CommentStyles, csPwShell); + if cCommentSS.Checked then Include(CommentStyles, csStarSemicol); + if cCommentTexInfo.Checked then Include(CommentStyles, csTexInfo); + if cCommentAutoIt.Checked then Include(CommentStyles, csAutoit); + + { Single line comments } + if cCommentCPL.Checked then Include(SingleLineComments, csCPL); + if cCommentSpec.Checked then Include(SingleLineComments, csSpecStyle); + if cCommentBackSlash.Checked then Include(SingleLineComments, csBackSlashStyle); + if cCommentLineC.Checked then Include(SingleLineComments, csLineC); + if cCommentBas.Checked then Include(SingleLineComments, csBasStyle); + if cCommentINI.Checked then Include(SingleLineComments, csINIStyle); + if cCommentFox.Checked then Include(SingleLineComments, csFoxStyle); + if cCommentREM.Checked then Include(SingleLineComments, csBatStyle); + if cCommentExcl.Checked then Include(SingleLineComments, csExclStyle); + if cCommentBy.Checked then Include(SingleLineComments, csByStyle); + if cCommentSharp.Checked then Include(SingleLineComments, csSharpStyle); + if cCommentSlash.Checked then Include(SingleLineComments, csSlashStyle); + if cCommentPercent.Checked then Include(SingleLineComments, csPercentStyle); + if cCommentAutomaton.Checked then Include(SingleLineComments, csAutomaton); + if cCommentSinglQ.Checked then Include(SingleLineComments, csSinglQStyle); + if cCommentDblQ.Checked then Include(SingleLineComments, csDblQStyle); + if cCommentSQL.Checked then Include(SingleLineComments, csSQLStyle); + if cCommentCStar.Checked then Include(SingleLineComments, csCStar); + if cCommentFortran.Checked then Include(SingleLineComments, csFortran); + if cCommentLBracket.Checked then Include(SingleLineComments, csLeftBracket); + if cCommentPoco.Checked then Include(SingleLineComments, csPocoStyle); + if cCommentPipe.Checked then Include(SingleLineComments, csPipe); + if cCommentWebFocus.Checked then Include(SingleLineComments, csWebFocus); + if cCommentDMIS.Checked then Include(SingleLineComments, csDMISStyle); + if cCommentTab.Checked then Include(SingleLineComments, csTabKey); + if cCommentStars.Checked then Include(SingleLineComments, cs2Stars); + if cCommentPCL.Checked then Include(SingleLineComments, csPCL); + if cCommentEuklid.Checked then Include(SingleLineComments, csEuklid); + if cCommentSpace.Checked then Include(SingleLineComments, csSpace); + if cCommentJCL2.Checked then Include(SingleLineComments, csJCL); + if cCommentDash.Checked then Include(SingleLineComments, csDash); + if cCommentAngleBracket.Checked then Include(SingleLineComments, csAngleBrackets); + + OmniHL.Comments := CommentStyles; + OmniHL.SingleLineComments := SingleLineComments; + + { String delimeters } + OmniHL.StringDelim := []; + if rSingleQuote.Checked then + OmniHL.StringDelim := OmniHL.StringDelim + [sdSingleQuote]; + if rApostropheQuote.Checked then + OmniHL.StringDelim := OmniHL.StringDelim + [sdApostropheQuote]; + if rDoubleQuote.Checked then + OmniHL.StringDelim := OmniHL.StringDelim + [sdDoubleQuote]; + + + OmniHL.EscapedStrings := cEscString.Checked; + if eEscChar.Text <> '' then + OmniHL.EscapeChar := eEscChar.Text[1] + else + OmniHL.EscapeChar := '\'; + OmniHL.DetectPreprocessor := cPreprocessors.Checked; + OmniHL.HasLabel := cLabel.Checked; + OmniHL.VectorSupport := cVectors.Checked; + OmniHL.PHPVariable := cPHPVariable.Checked; + OmniHL.RubySymbols := cRubySymbols.Checked; + + OmniHL.CaseSensitive := cCaseSensitive.Checked; + OmniHL.CodeFoldingType := TCodeFoldingType(cbCodeFolding.ItemIndex); + + OmniHL.KW1StartWith := cKW1StartWith.Checked; + OmniHL.KW2StartWith := cKW2StartWith.Checked; + OmniHL.KW3StartWith := cKW3StartWith.Checked; + OmniHL.KW4StartWith := cKW4StartWith.Checked;; + + OmniHL.SetKeyWordsCompat(mKeyWords.Lines, OmniHL.KeyWords); + OmniHL.SetKeyWordsCompat(mResWords.Lines, OmniHL.ResWords); + OmniHL.SetKeyWordsCompat(mKeyWords2.Lines, OmniHL.KeyWords2); + OmniHL.SetKeyWordsCompat(mKeyWords3.Lines, OmniHL.KeyWords3); + OmniHL.KeyWordChars := eKeyWordChars.Text; +end; + +procedure TSynOmniSynSetup.SaveHighLighterToFile(const AName: string); +var + Saved: Boolean; +begin + var OmniHL := TSynOmniSyn.Create(nil); + try + SaveToHighligther(OmniHL); + try + Saved := OmniHL.SaveToIniFile(AName); + except + Saved := False; + end; + if not Saved then + MessageDlg(Format(SYNS_SaveError, [AName]), mtError, [mbOK], 0); + finally + OmniHL.Free; + end; +end; + +procedure TSynOmniSynSetup.FormCreate(Sender: TObject); +var + I: TCodeFoldingType; +begin + for I := Low(TCodeFoldingType) to High(TCodeFoldingType) do + cbCodeFolding.Items.Add( + Copy(GetEnumName(TypeInfo(TCodeFoldingType), Integer(I)), 4)); +end; + +function EditOmniHighlighter(OmniHL: TSynOmniSyn; HighlighterDir: string): Boolean; +begin + Result := False; + with TSynOmniSynSetup.Create(nil) do + begin + LoadFromHighligther(OmniHL); + OpenDialog.InitialDir := HighlighterDir; + if ShowModal = mrOK then + begin + SaveToHighligther(OmniHL); + Result := True; + end; + Release; + end; +end; + +end. diff --git a/Ext/SynEdit/Source/SynRegExpr.pas b/Ext/SynEdit/Source/SynRegExpr.pas deleted file mode 100644 index d3b3524..0000000 --- a/Ext/SynEdit/Source/SynRegExpr.pas +++ /dev/null @@ -1,4107 +0,0 @@ -{$IFNDEF QSYNREGEXPR} -unit SynRegExpr; -{$ENDIF} - -{ - TRegExpr class library - Delphi Regular Expressions - - Copyright (c) 1999-2004 Andrey V. Sorokin, St.Petersburg, Russia - - You may use this software in any kind of development, - including comercial, redistribute, and modify it freely, - under the following restrictions : - 1. This software is provided as it is, without any kind of - warranty given. Use it at Your own risk.The author is not - responsible for any consequences of use of this software. - 2. The origin of this software may not be mispresented, You - must not claim that You wrote the original software. If - You use this software in any kind of product, it would be - appreciated that there in a information box, or in the - documentation would be an acknowledgement like - - Partial Copyright (c) 2004 Andrey V. Sorokin - http://RegExpStudio.com - mailto:anso@mail.ru - - 3. You may not have any income from distributing this source - (or altered version of it) to other developers. When You - use this product in a comercial package, the source may - not be charged seperatly. - 4. Altered versions must be plainly marked as such, and must - not be misrepresented as being the original software. - 5. RegExp Studio application and all the visual components as - well as documentation is not part of the TRegExpr library - and is not free for usage. - - mailto:anso@mail.ru - http://RegExpStudio.com - http://anso.da.ru/ -} - -interface - -{$INCLUDE SynEdit.inc} - -// ======== Determine compiler -{$IFDEF VER80} Sorry, TRegExpr is for 32-bits Delphi only. Delphi 1 is not supported (and whos really care today?!). {$ENDIF} - -// ======== Define base compiler options -{$BOOLEVAL OFF} -{$EXTENDEDSYNTAX ON} -{$LONGSTRINGS ON} -{$OPTIMIZATION ON} -{$IFDEF SYN_COMPILER_6_UP} - {$WARN SYMBOL_PLATFORM OFF} // Suppress .Net warnings -{$ENDIF} -{$IFDEF SYN_COMPILER_7_UP} - {$WARN UNSAFE_CAST OFF} // Suppress .Net warnings - {$WARN UNSAFE_TYPE OFF} // Suppress .Net warnings - {$WARN UNSAFE_CODE OFF} // Suppress .Net warnings -{$ENDIF} -{$IFDEF FPC} - {$MODE DELPHI} // Delphi-compatible mode in FreePascal -{$ENDIF} - -// ======== Define options for TRegExpr engine -{$DEFINE SynRegUniCode} // Unicode support -{$DEFINE RegExpPCodeDump} // p-code dumping (see Dump method) -{$IFNDEF FPC} // the option is not supported in FreePascal - {$DEFINE reRealExceptionAddr} // exceptions will point to appropriate source line, not to Error procedure -{$ENDIF} -{$DEFINE ComplexBraces} // support braces in complex cases -{$IFNDEF SynRegUniCode} // the option applicable only for non-UniCode mode - {$DEFINE UseSetOfChar} // Significant optimization by using set of char -{$ENDIF} -{$IFDEF UseSetOfChar} - {$DEFINE UseFirstCharSet} // Fast skip between matches for r.e. that starts with determined set of chars -{$ENDIF} - -// ======== Define Pascal-language options -// Define 'UseAsserts' option (do not edit this definitions). -// Asserts used to catch 'strange bugs' in TRegExpr implementation (when something goes -// completely wrong). You can swith asserts on/off with help of {$C+}/{$C-} compiler options. -{$IFDEF SYN_COMPILER_3_UP} {$DEFINE UseAsserts} {$ENDIF} -{$IFDEF FPC} {$DEFINE UseAsserts} {$ENDIF} - -// Define 'use subroutine parameters default values' option (do not edit this definition). -{$IFDEF SYN_COMPILER_4_UP} {$DEFINE DefParam} {$ENDIF} - -// Define 'OverMeth' options, to use method overloading (do not edit this definitions). -{$IFDEF SYN_COMPILER_5_UP} {$DEFINE OverMeth} {$ENDIF} -{$IFDEF FPC} {$DEFINE OverMeth} {$ENDIF} - -uses - SynUnicode, - Classes, // TStrings in Split method - SysUtils; // Exception - -type - {$IFDEF SynRegUniCode} - PRegExprChar = PWideChar; - RegExprString = UnicodeString; - REChar = WideChar; - {$ELSE} - PRegExprChar = PChar; - RegExprString = AnsiString; //###0.952 was string - REChar = Char; - {$ENDIF} - TREOp = REChar; // internal p-code type //###0.933 - PREOp = ^TREOp; - TRENextOff = Integer; // internal Next "pointer" (offset to current p-code) //###0.933 - PRENextOff = ^TRENextOff; // used for extracting Next "pointers" from compiled r.e. //###0.933 - TREBracesArg = Integer; // type of {m,n} arguments - PREBracesArg = ^TREBracesArg; - -const - REOpSz = SizeOf (TREOp) div SizeOf (REChar); // size of p-code in RegExprString units - RENextOffSz = SizeOf (TRENextOff) div SizeOf (REChar); // size of Next 'pointer' -"- - REBracesArgSz = SizeOf (TREBracesArg) div SizeOf (REChar); // size of BRACES arguments -"- - -type - TRegExprInvertCaseFunction = function (const Ch: REChar): REChar of object; - -const - EscChar = '\'; // 'Escape'-char ('\' in common r.e.) used for escaping metachars (\w, \d etc). - RegExprModifierI: Boolean = False; // default value for ModifierI - RegExprModifierR: Boolean = True; // default value for ModifierR - RegExprModifierS: Boolean = True; // default value for ModifierS - RegExprModifierG: Boolean = True; // default value for ModifierG - RegExprModifierM: Boolean = False; // default value for ModifierM - RegExprModifierX: Boolean = False; // default value for ModifierX - RegExprSpaceChars: RegExprString = // default value for SpaceChars - ' '#$9#$A#$D#$C; - RegExprWordChars: RegExprString = // default value for WordChars - '0123456789' //###0.940 - + 'abcdefghijklmnopqrstuvwxyz' - + 'ABCDEFGHIJKLMNOPQRSTUVWXYZ_'; - RegExprLineSeparators: RegExprString =// default value for LineSeparators - #$d#$a{$IFDEF SynRegUniCode}+#$b#$c#$2028#$2029#$85{$ENDIF}; //###0.947 - RegExprLinePairedSeparator : RegExprString =// default value for LinePairedSeparator - #$d#$a; - { if You need Unix-styled line separators (only \n), then use: - RegExprLineSeparators = #$a; - RegExprLinePairedSeparator = ''; - } - - -const - NSUBEXP = 15; // max number of subexpression //###0.929 - // Cannot be more than NSUBEXPMAX - // Be carefull - don't use values which overflow CLOSE opcode - // (in this case you'll get compiler erorr). - // Big NSUBEXP will cause more slow work and more stack required - NSUBEXPMAX = 255; // Max possible value for NSUBEXP. //###0.945 - // Don't change it! It's defined by internal TRegExpr design. - - MaxBracesArg = $7FFFFFFF - 1; // max value for {n,m} arguments //###0.933 - - {$IFDEF ComplexBraces} - LoopStackMax = 10; // max depth of loops stack //###0.925 - {$ENDIF} - - TinySetLen = 3; - // if range includes more then TinySetLen chars, //###0.934 - // then use full (32 bytes) ANYOFFULL instead of ANYOF[BUT]TINYSET - // !!! Attension ! If you change TinySetLen, you must - // change code marked as "//!!!TinySet" - -type -{$IFDEF UseSetOfChar} - PSetOfREChar = ^TSetOfREChar; - TSetOfREChar = set of REChar; -{$ENDIF} - - TRegExpr = class; - - TRegExprReplaceFunction = function (ARegExpr: TRegExpr): string of object; - - TRegExpr = class - private - startp : array [0 .. NSUBEXP - 1] of PRegExprChar; // founded expr starting points - endp : array [0 .. NSUBEXP - 1] of PRegExprChar; // founded expr end points - - {$IFDEF ComplexBraces} - LoopStack : array [1 .. LoopStackMax] of Integer; // state before entering loop - LoopStackIdx : Integer; // 0 - out of all loops - {$ENDIF} - - // The "internal use only" fields to pass info from compile - // to execute that permits the execute phase to run lots faster on - // simple cases. - regstart : REChar; // char that must begin a match; '\0' if none obvious - reganch : REChar; // is the match anchored (at beginning-of-line only)? - regmust : PRegExprChar; // string (pointer into program) that match must include, or nil - regmlen : Integer; // length of regmust string - // Regstart and reganch permit very fast decisions on suitable starting points - // for a match, cutting down the work a lot. Regmust permits fast rejection - // of lines that cannot possibly match. The regmust tests are costly enough - // that regcomp() supplies a regmust only if the r.e. contains something - // potentially expensive (at present, the only such thing detected is * or + - // at the start of the r.e., which can involve a lot of backup). Regmlen is - // supplied because the test in regexec() needs it and regcomp() is computing - // it anyway. - {$IFDEF UseFirstCharSet} //###0.929 - FirstCharSet : TSetOfREChar; - {$ENDIF} - - // work variables for Exec's routins - save stack in recursion} - reginput : PRegExprChar; // String-input pointer. - fInputStart : PRegExprChar; // Pointer to first char of input string. - fInputEnd : PRegExprChar; // Pointer to char AFTER last char of input string - - // work variables for compiler's routines - regparse : PRegExprChar; // Input-scan pointer. - regnpar : Integer; // count. - regdummy : REChar; - regcode : PRegExprChar; // Code-emit pointer; @regdummy = don't. - regsize : Integer; // Code size. - - regexpbeg : PRegExprChar; // only for error handling. Contains - // pointer to beginning of r.e. while compiling - fExprIsCompiled : Boolean; // True if r.e. successfully compiled - - // programm is essentially a linear encoding - // of a nondeterministic finite-state machine (aka syntax charts or - // "railroad normal form" in parsing technology). Each node is an opcode - // plus a "next" pointer, possibly plus an operand. "Next" pointers of - // all nodes except BRANCH implement concatenation; a "next" pointer with - // a BRANCH on both ends of it is connecting two alternatives. (Here we - // have one of the subtle syntax dependencies: an individual BRANCH (as - // opposed to a collection of them) is never concatenated with anything - // because of operator precedence.) The operand of some types of node is - // a literal string; for others, it is a node leading into a sub-FSM. In - // particular, the operand of a BRANCH node is the first node of the branch. - // (NB this is *not* a tree structure: the tail of the branch connects - // to the thing following the set of BRANCHes.) The opcodes are: - programm : PRegExprChar; // Unwarranted chumminess with compiler. - - fExpression : PRegExprChar; // source of compiled r.e. - fInputString : PRegExprChar; // input string - - FLastError : Integer; // see Error, LastError - - fModifiers : Integer; // modifiers - fCompModifiers : Integer; // compiler's copy of modifiers - fProgModifiers : Integer; // modifiers values from last programm compilation - - fSpaceChars : RegExprString; //###0.927 - fWordChars : RegExprString; //###0.929 - fInvertCase : TRegExprInvertCaseFunction; //###0.927 - - FLineSeparators : RegExprString; //###0.941 - fLinePairedSeparatorAssigned : Boolean; - fLinePairedSeparatorHead, - fLinePairedSeparatorTail : REChar; - {$IFNDEF SynRegUniCode} - FLineSeparatorsSet : set of REChar; - {$ENDIF} - - procedure InvalidateProgramm; - // Mark programm as have to be [re]compiled - - function IsProgrammOk : Boolean; //###0.941 - // Check if we can use precompiled r.e. or - // [re]compile it if something changed - - function GetExpression : RegExprString; - procedure SetExpression (const s : RegExprString); - - function GetModifierStr : RegExprString; - class function ParseModifiersStr (const AModifiers : RegExprString; - var AModifiersInt : Integer) : Boolean; //###0.941 class function now - // Parse AModifiers string and return True and set AModifiersInt - // if it's in format 'ismxrg-ismxrg'. - procedure SetModifierStr (const AModifiers : RegExprString); - - function GetModifier (AIndex : Integer) : Boolean; - procedure SetModifier (AIndex : Integer; ASet : Boolean); - - procedure Error (AErrorID : Integer); virtual; // error handler. - // Default handler raise exception ERegExpr with - // Message = ErrorMsg (AErrorID), ErrorCode = AErrorID - // and CompilerErrorPos = value of property CompilerErrorPos. - - - {==================== Compiler section ===================} - function CompileRegExpr (exp : PRegExprChar) : Boolean; - // compile a regular expression into internal code - - procedure Tail (p : PRegExprChar; val : PRegExprChar); - // set the next-pointer at the end of a node chain - - procedure OpTail (p : PRegExprChar; val : PRegExprChar); - // regoptail - regtail on operand of first argument; nop if operandless - - function EmitNode (op : TREOp) : PRegExprChar; - // regnode - emit a node, return location - - procedure EmitC (b : REChar); - // emit (if appropriate) a byte of code - - procedure InsertOperator (op : TREOp; opnd : PRegExprChar; sz : Integer); //###0.90 - // insert an operator in front of already-emitted operand - // Means relocating the operand. - - function ParseReg (paren : Integer; var flagp : Integer) : PRegExprChar; - // regular expression, i.e. main body or parenthesized thing - - function ParseBranch (var flagp : Integer) : PRegExprChar; - // one alternative of an | operator - - function ParsePiece (var flagp : Integer) : PRegExprChar; - // something followed by possible [*+?] - - function ParseAtom (var flagp : Integer) : PRegExprChar; - // the lowest level - - function GetCompilerErrorPos : Integer; - // current pos in r.e. - for error hanling - - {$IFDEF UseFirstCharSet} //###0.929 - procedure FillFirstCharSet (prog : PRegExprChar); - {$ENDIF} - - {===================== Mathing section ===================} - function regrepeat (p : PRegExprChar; AMax : Integer) : Integer; - // repeatedly match something simple, report how many - - function regnext (p : PRegExprChar) : PRegExprChar; - // dig the "next" pointer out of a node - - function MatchPrim (prog : PRegExprChar) : Boolean; - // recursively matching routine - - function ExecPrim (AOffset: Integer) : Boolean; - // Exec for stored InputString - - {$IFDEF RegExpPCodeDump} - function DumpOp (op : REChar) : RegExprString; - {$ENDIF} - - function GetSubExprMatchCount : Integer; - function GetMatchPos (Idx : Integer) : Integer; - function GetMatchLen (Idx : Integer) : Integer; - function GetMatch (Idx : Integer) : RegExprString; - - function GetInputString : RegExprString; - procedure SetInputString (const AInputString : RegExprString); - - {$IFNDEF UseSetOfChar} - function StrScanCI (s : PRegExprChar; ch : REChar) : PRegExprChar; //###0.928 - {$ENDIF} - - procedure SetLineSeparators (const AStr : RegExprString); - procedure SetLinePairedSeparator (const AStr : RegExprString); - function GetLinePairedSeparator : RegExprString; - - public - constructor Create; - destructor Destroy; override; - - class function VersionMajor : Integer; //###0.944 - class function VersionMinor : Integer; //###0.944 - - property Expression : RegExprString read GetExpression write SetExpression; - // Regular expression. - // For optimization, TRegExpr will automatically compiles it into 'P-code' - // (You can see it with help of Dump method) and stores in internal - // structures. Real [re]compilation occures only when it really needed - - // while calling Exec[Next], Substitute, Dump, etc - // and only if Expression or other P-code affected properties was changed - // after last [re]compilation. - // If any errors while [re]compilation occures, Error method is called - // (by default Error raises exception - see below) - - property ModifierStr : RegExprString read GetModifierStr write SetModifierStr; - // Set/get default values of r.e.syntax modifiers. Modifiers in - // r.e. (?ismx-ismx) will replace this default values. - // If you try to set unsupported modifier, Error will be called - // (by defaul Error raises exception ERegExpr). - - property ModifierI : Boolean index 1 read GetModifier write SetModifier; - // Modifier /i - caseinsensitive, initialized from RegExprModifierI - - property ModifierR : Boolean index 2 read GetModifier write SetModifier; - // Modifier /r - use r.e.syntax extended for russian, - // (was property ExtSyntaxEnabled in previous versions) - // If True, then à-ÿ additional include russian letter '¸', - // À-ß additional include '¨', and à-ß include all russian symbols. - // You have to turn it off if it may interfere with you national alphabet. - // , initialized from RegExprModifierR - - property ModifierS : Boolean index 3 read GetModifier write SetModifier; - // Modifier /s - '.' works as any char (else as [^\n]), - // , initialized from RegExprModifierS - - property ModifierG : Boolean index 4 read GetModifier write SetModifier; - // Switching off modifier /g switchs all operators in - // non-greedy style, so if ModifierG = False, then - // all '*' works as '*?', all '+' as '+?' and so on. - // , initialized from RegExprModifierG - - property ModifierM : Boolean index 5 read GetModifier write SetModifier; - // Treat string as multiple lines. That is, change `^' and `$' from - // matching at only the very start or end of the string to the start - // or end of any line anywhere within the string. - // , initialized from RegExprModifierM - - property ModifierX : Boolean index 6 read GetModifier write SetModifier; - // Modifier /x - eXtended syntax, allow r.e. text formatting, - // see description in the help. Initialized from RegExprModifierX - - function Exec (const AInputString : RegExprString) : Boolean; {$IFDEF OverMeth} overload; - {$IFNDEF FPC} // I do not know why FreePascal cannot overload methods with empty param list - function Exec : Boolean; overload; //###0.949 - {$ENDIF} - function Exec (AOffset: Integer) : Boolean; overload; //###0.949 - {$ENDIF} - // match a programm against a string AInputString - // !!! Exec store AInputString into InputString property - // For Delphi 5 and higher available overloaded versions - first without - // parameter (uses already assigned to InputString property value) - // and second that has Integer parameter and is same as ExecPos - - function ExecNext : Boolean; - // find next match: - // ExecNext; - // works same as - // if MatchLen [0] = 0 then ExecPos (MatchPos [0] + 1) - // else ExecPos (MatchPos [0] + MatchLen [0]); - // but it's more simpler ! - // Raises exception if used without preceeding SUCCESSFUL call to - // Exec* (Exec, ExecPos, ExecNext). So You always must use something like - // if Exec (InputString) then repeat { proceed results} until not ExecNext; - - function ExecPos (AOffset: Integer {$IFDEF DefParam}= 1{$ENDIF}) : Boolean; - // find match for InputString starting from AOffset position - // (AOffset=1 - first char of InputString) - - property InputString : RegExprString read GetInputString write SetInputString; - // returns current input string (from last Exec call or last assign - // to this property). - // Any assignment to this property clear Match* properties ! - - function Substitute (const ATemplate : RegExprString) : RegExprString; - // Returns ATemplate with '$&' or '$0' replaced by whole r.e. - // occurence and '$n' replaced by occurence of subexpression #n. - // Since v.0.929 '$' used instead of '\' (for future extensions - // and for more Perl-compatibility) and accept more then one digit. - // If you want place into template raw '$' or '\', use prefix '\' - // Example: '1\$ is $2\\rub\\' -> '1$ is \rub\' - // If you want to place raw digit after '$n' you must delimit - // n with curly braces '{}'. - // Example: 'a$12bc' -> 'abc' - // 'a${1}2bc' -> 'a2bc'. - - procedure Split (AInputStr : RegExprString; APieces : TStrings); - // Split AInputStr into APieces by r.e. occurencies - // Internally calls Exec[Next] - - function Replace (AInputStr : RegExprString; - const AReplaceStr : RegExprString; - AUseSubstitution : Boolean{$IFDEF DefParam}= False{$ENDIF}) //###0.946 - : RegExprString; {$IFDEF OverMeth} overload; - function Replace (AInputStr : RegExprString; - AReplaceFunc : TRegExprReplaceFunction) - : RegExprString; overload; - {$ENDIF} - function ReplaceEx (AInputStr : RegExprString; - AReplaceFunc : TRegExprReplaceFunction) - : RegExprString; - // Returns AInputStr with r.e. occurencies replaced by AReplaceStr - // If AUseSubstitution is True, then AReplaceStr will be used - // as template for Substitution methods. - // For example: - // Expression := '({-i}block|var)\s*\(\s*([^ ]*)\s*\)\s*'; - // Replace ('BLOCK( test1)', 'def "$1" value "$2"', True); - // will return: def 'BLOCK' value 'test1' - // Replace ('BLOCK( test1)', 'def "$1" value "$2"') - // will return: def "$1" value "$2" - // Internally calls Exec[Next] - // Overloaded version and ReplaceEx operate with call-back function, - // so You can implement really complex functionality. - - property SubExprMatchCount : Integer read GetSubExprMatchCount; - // Number of subexpressions has been found in last Exec* call. - // If there are no subexpr. but whole expr was found (Exec* returned True), - // then SubExprMatchCount=0, if no subexpressions nor whole - // r.e. found (Exec* returned False) then SubExprMatchCount=-1. - // Note, that some subexpr. may be not found and for such - // subexpr. MathPos=MatchLen=-1 and Match=''. - // For example: Expression := '(1)?2(3)?'; - // Exec ('123'): SubExprMatchCount=2, Match[0]='123', [1]='1', [2]='3' - // Exec ('12'): SubExprMatchCount=1, Match[0]='12', [1]='1' - // Exec ('23'): SubExprMatchCount=2, Match[0]='23', [1]='', [2]='3' - // Exec ('2'): SubExprMatchCount=0, Match[0]='2' - // Exec ('7') - return False: SubExprMatchCount=-1 - - property MatchPos [Idx : Integer] : Integer read GetMatchPos; - // pos of entrance subexpr. #Idx into tested in last Exec* - // string. First subexpr. have Idx=1, last - MatchCount, - // whole r.e. have Idx=0. - // Returns -1 if in r.e. no such subexpr. or this subexpr. - // not found in input string. - - property MatchLen [Idx : Integer] : Integer read GetMatchLen; - // len of entrance subexpr. #Idx r.e. into tested in last Exec* - // string. First subexpr. have Idx=1, last - MatchCount, - // whole r.e. have Idx=0. - // Returns -1 if in r.e. no such subexpr. or this subexpr. - // not found in input string. - // Remember - MatchLen may be 0 (if r.e. match empty string) ! - - property Match [Idx : Integer] : RegExprString read GetMatch; - // == copy (InputString, MatchPos [Idx], MatchLen [Idx]) - // Returns '' if in r.e. no such subexpr. or this subexpr. - // not found in input string. - - function LastError : Integer; - // Returns ID of last error, 0 if no errors (unusable if - // Error method raises exception) and clear internal status - // into 0 (no errors). - - function ErrorMsg (AErrorID : Integer) : RegExprString; virtual; - // Returns Error message for error with ID = AErrorID. - - property CompilerErrorPos : Integer read GetCompilerErrorPos; - // Returns pos in r.e. there compiler stopped. - // Usefull for error diagnostics - - property SpaceChars : RegExprString read fSpaceChars write fSpaceChars; //###0.927 - // Contains chars, treated as /s (initially filled with RegExprSpaceChars - // global constant) - - property WordChars : RegExprString read fWordChars write fWordChars; //###0.929 - // Contains chars, treated as /w (initially filled with RegExprWordChars - // global constant) - - property LineSeparators : RegExprString read FLineSeparators write SetLineSeparators; //###0.941 - // line separators (like \n in Unix) - - property LinePairedSeparator : RegExprString read GetLinePairedSeparator write SetLinePairedSeparator; //###0.941 - // paired line separator (like \r\n in DOS and Windows). - // must contain exactly two chars or no chars at all - - class function InvertCaseFunction (const Ch : REChar) : REChar; - // Converts Ch into upper case if it in lower case or in lower - // if it in upper (uses current system local setings) - - property InvertCase : TRegExprInvertCaseFunction read fInvertCase write fInvertCase; //##0.935 - // Set this property if you want to override case-insensitive functionality. - // Create set it to RegExprInvertCaseFunction (InvertCaseFunction by default) - - procedure Compile; //###0.941 - // [Re]compile r.e. Usefull for example for GUI r.e. editors (to check - // all properties validity). - - {$IFDEF RegExpPCodeDump} - function Dump : RegExprString; - // dump a compiled regexp in vaguely comprehensible form - {$ENDIF} - end; - - ERegExpr = class (Exception) - public - ErrorCode : Integer; - CompilerErrorPos : Integer; - end; - -const - RegExprInvertCaseFunction : TRegExprInvertCaseFunction = {$IFDEF FPC} nil {$ELSE} TRegExpr.InvertCaseFunction{$ENDIF}; - // defaul for InvertCase property - -function ExecRegExpr (const ARegExpr, AInputStr : RegExprString) : Boolean; -// True if string AInputString match regular expression ARegExpr -// ! will raise exeption if syntax errors in ARegExpr - -procedure SplitRegExpr (const ARegExpr, AInputStr : RegExprString; APieces : TStrings); -// Split AInputStr into APieces by r.e. ARegExpr occurencies - -function ReplaceRegExpr (const ARegExpr, AInputStr, AReplaceStr : RegExprString; - AUseSubstitution : Boolean{$IFDEF DefParam}= False{$ENDIF}) : RegExprString; //###0.947 -// Returns AInputStr with r.e. occurencies replaced by AReplaceStr -// If AUseSubstitution is True, then AReplaceStr will be used -// as template for Substitution methods. -// For example: -// ReplaceRegExpr ('({-i}block|var)\s*\(\s*([^ ]*)\s*\)\s*', -// 'BLOCK( test1)', 'def "$1" value "$2"', True) -// will return: def 'BLOCK' value 'test1' -// ReplaceRegExpr ('({-i}block|var)\s*\(\s*([^ ]*)\s*\)\s*', -// 'BLOCK( test1)', 'def "$1" value "$2"') -// will return: def "$1" value "$2" - -function QuoteRegExprMetaChars (const AStr : RegExprString) : RegExprString; -// Replace all metachars with its safe representation, -// for example 'abc$cd.(' converts into 'abc\$cd\.\(' -// This function usefull for r.e. autogeneration from -// user input - -function RegExprSubExpressions (const ARegExpr : string; - ASubExprs : TStrings; AExtendedSyntax : Boolean{$IFDEF DefParam}= False{$ENDIF}) : Integer; -// Makes list of subexpressions found in ARegExpr r.e. -// In ASubExps every item represent subexpression, -// from first to last, in format: -// String - subexpression text (without '()') -// low word of Object - starting position in ARegExpr, including '(' -// if exists! (first position is 1) -// high word of Object - length, including starting '(' and ending ')' -// if exist! -// AExtendedSyntax - must be True if modifier /m will be On while -// using the r.e. -// Usefull for GUI editors of r.e. etc (You can find example of using -// in TestRExp.dpr project) -// Returns -// 0 Success. No unbalanced brackets was found; -// -1 There are not enough closing brackets ')'; -// -(n+1) At position n was found opening '[' without //###0.942 -// corresponding closing ']'; -// n At position n was found closing bracket ')' without -// corresponding opening '('. -// If Result <> 0, then ASubExpr can contain empty items or illegal ones - - -implementation - -uses -{$IFDEF MSWINDOWS} - Windows; // CharUpper/Lower -{$ELSE} - Libc; //Qt.pas from Borland does not expose char handling functions -{$ENDIF} - -const - TRegExprVersionMajor : Integer = 0; - TRegExprVersionMinor : Integer = 952; - // TRegExpr.VersionMajor/Minor return values of this constants - - MaskModI = 1; // modifier /i bit in fModifiers - MaskModR = 2; // -"- /r - MaskModS = 4; // -"- /s - MaskModG = 8; // -"- /g - MaskModM = 16; // -"- /m - MaskModX = 32; // -"- /x - -{$IFDEF SynRegUniCode} - XIgnoredChars = ' '#9#$d#$a; -{$ELSE} - XIgnoredChars = [' ', #9, #$d, #$a]; -{$ENDIF} - -{=============================================================} -{=================== UnicodeString functions ====================} -{=============================================================} - -{$IFDEF SynRegUniCode} - -function StrPCopy (Dest: PRegExprChar; const Source: RegExprString): PRegExprChar; -var - i, Len : Integer; -begin - Len := length (Source); //###0.932 - for i := 1 to Len do - Dest [i - 1] := Source [i]; - Dest [Len] := #0; - Result := Dest; -end; { of function StrPCopy ---------------------------------------------------------------} - -function StrLCopy (Dest, Source: PRegExprChar; MaxLen: Cardinal): PRegExprChar; -var - i: Integer; -begin - for i := 0 to MaxLen - 1 do - Dest [i] := Source [i]; - Result := Dest; -end; { of function StrLCopy ---------------------------------------------------------------} - -function StrLen (Str: PRegExprChar): Cardinal; -begin - Result := 0; - while Str [result] <> #0 do - Inc (Result); -end; { of function StrLen ---------------------------------------------------------------} - -function StrPos (Str1, Str2: PRegExprChar): PRegExprChar; -var - n: Integer; -begin - Result := nil; - n := Pos (RegExprString (Str2), RegExprString (Str1)); - if n = 0 then - Exit; - Result := Str1 + n - 1; -end; { of function StrPos ---------------------------------------------------------------} - -function StrLComp (Str1, Str2: PRegExprChar; MaxLen: Cardinal): Integer; -var - S1, S2: RegExprString; -begin - S1 := Str1; - S2 := Str2; - if Copy (S1, 1, MaxLen) > Copy (S2, 1, MaxLen) then - Result := 1 - else - if Copy (S1, 1, MaxLen) < Copy (S2, 1, MaxLen) then - Result := -1 - else - Result := 0; -end; { function StrLComp ---------------------------------------------------------------} - -function StrScan (Str: PRegExprChar; Chr: WideChar): PRegExprChar; -begin - Result := nil; - while (Str^ <> #0) and (Str^ <> Chr) do - Inc (Str); - if (Str^ <> #0) then - Result := Str; -end; { of function StrScan ---------------------------------------------------------------} - -{$ENDIF} - - -{=============================================================} -{===================== Global functions ======================} -{=============================================================} - -function ExecRegExpr (const ARegExpr, AInputStr : RegExprString) : Boolean; -var - r : TRegExpr; -begin - r := TRegExpr.Create; - try - r.Expression := ARegExpr; - Result := r.Exec (AInputStr); - finally - r.Free; - end; -end; { of function ExecRegExpr ---------------------------------------------------------------} - -procedure SplitRegExpr (const ARegExpr, AInputStr : RegExprString; APieces : TStrings); -var r : TRegExpr; -begin - APieces.Clear; - r := TRegExpr.Create; - try - r.Expression := ARegExpr; - r.Split (AInputStr, APieces); - finally - r.Free; - end; -end; { of procedure SplitRegExpr ---------------------------------------------------------------} - -function ReplaceRegExpr (const ARegExpr, AInputStr, AReplaceStr : RegExprString; - AUseSubstitution : Boolean{$IFDEF DefParam}= False{$ENDIF}) : RegExprString; -begin - with TRegExpr.Create do - try - Expression := ARegExpr; - Result := Replace (AInputStr, AReplaceStr, AUseSubstitution); - finally - Free; - end; -end; { of function ReplaceRegExpr ---------------------------------------------------------------} - -function QuoteRegExprMetaChars (const AStr : RegExprString) : RegExprString; -const - RegExprMetaSet : RegExprString = '^$.[()|?+*'+EscChar+'{' - + ']}'; // - this last are additional to META. - // Very similar to META array, but slighly changed. - // !Any changes in META array must be synchronized with this set. -var - i, i0, Len : Integer; -begin - Result := ''; - Len := length (AStr); - i := 1; - i0 := i; - while i <= Len do - begin - if Pos (AStr [i], RegExprMetaSet) > 0 then - begin - Result := Result + System.Copy (AStr, i0, i - i0) - + EscChar + AStr [i]; - i0 := i + 1; - end; - inc (i); - end; - Result := Result + System.Copy (AStr, i0, MaxInt); // Tail -end; { of function QuoteRegExprMetaChars ---------------------------------------------------------------} - -function RegExprSubExpressions (const ARegExpr : string; - ASubExprs : TStrings; AExtendedSyntax : Boolean{$IFDEF DefParam}= False{$ENDIF}) : Integer; -type - TStackItemRec = record //###0.945 - SubExprIdx : Integer; - StartPos : Integer; - end; - TStackArray = packed array [0 .. NSUBEXPMAX - 1] of TStackItemRec; -var - Len, SubExprLen : Integer; - i, i0 : Integer; - Modif : Integer; - Stack : ^TStackArray; //###0.945 - StackIdx, StackSz : Integer; -begin - Result := 0; // no unbalanced brackets found at this very moment - - ASubExprs.Clear; // I don't think that adding to non empty list - // can be usefull, so I simplified algorithm to work only with empty list - - Len := length (ARegExpr); // some optimization tricks - - // first we have to calculate number of subexpression to reserve - // space in Stack array (may be we'll reserve more then need, but - // it's faster then memory reallocation during parsing) - StackSz := 1; // add 1 for entire r.e. - for i := 1 to Len do - if ARegExpr [i] = '(' then - inc (StackSz); -// SetLength (Stack, StackSz); //###0.945 - GetMem (Stack, SizeOf (TStackItemRec) * StackSz); - try - StackIdx := 0; - i := 1; - while (i <= Len) do - begin - case ARegExpr [i] of - '(': - begin - if (i < Len) and (ARegExpr [i + 1] = '?') then - begin - // this is not subexpression, but comment or other - // Perl extension. We must check is it (?ismxrg-ismxrg) - // and change AExtendedSyntax if /x is changed. - inc (i, 2); // skip '(?' - i0 := i; - while (i <= Len) and (ARegExpr [i] <> ')') do - inc (i); - if i > Len then - Result := -1 // unbalansed '(' - else - if TRegExpr.ParseModifiersStr (System.Copy (ARegExpr, i, i - i0), Modif) then - AExtendedSyntax := (Modif and MaskModX) <> 0; - end - else - begin // subexpression starts - ASubExprs.Add (''); // just reserve space - with Stack [StackIdx] do - begin - SubExprIdx := ASubExprs.Count - 1; - StartPos := i; - end; - inc (StackIdx); - end; - end; - ')': - begin - if StackIdx = 0 then - Result := i // unbalanced ')' - else - begin - dec (StackIdx); - with Stack [StackIdx] do - begin - SubExprLen := i - StartPos + 1; - ASubExprs.Objects [SubExprIdx] := - TObject (StartPos or (SubExprLen shL 16)); - ASubExprs [SubExprIdx] := System.Copy ( - ARegExpr, StartPos + 1, SubExprLen - 2); // add without brackets - end; - end; - end; - EscChar: - inc (i); // skip quoted symbol - '[': - begin - // we have to skip character ranges at once, because they can - // contain '#', and '#' in it must NOT be recognized as eXtended - // comment beginning! - i0 := i; - inc (i); - if ARegExpr [i] = ']' // cannot be 'emty' ranges - this interpretes - then inc (i); // as ']' by itself - while (i <= Len) and (ARegExpr [i] <> ']') do - if ARegExpr [i] = EscChar then - inc (i, 2) // skip 'escaped' char to prevent stopping at '\]' - else - inc (i); - if (i > Len) or (ARegExpr [i] <> ']') then - Result := - (i0 + 1); // unbalansed '[' - end; - '#': - if AExtendedSyntax then - begin - // skip eXtended comments - while (i <= Len) and (ARegExpr [i] <> #$d) and (ARegExpr [i] <> #$a) - // do not use [#$d, #$a] due to UniCode compatibility - do inc (i); - while (i + 1 <= Len) and ((ARegExpr [i + 1] = #$d) or (ARegExpr [i + 1] = #$a)) - do inc (i); // attempt to work with different kinds of line separators - // now we are at the line separator that must be skipped. - end; - // here is no 'else' clause - we simply skip ordinary chars - end; // of case - inc (i); // skip scanned char - // ! can move after Len due to skipping quoted symbol - end; - - // check brackets balance - if StackIdx <> 0 then - Result := -1; // unbalansed '(' - - // check if entire r.e. added - if (ASubExprs.Count = 0) - or ((Integer (ASubExprs.Objects [0]) and $FFFF) <> 1) - or (((Integer (ASubExprs.Objects [0]) shr 16) and $FFFF) <> Len) - // whole r.e. wasn't added because it isn't bracketed - // well, we add it now: - then ASubExprs.InsertObject (0, ARegExpr, TObject ((Len ShL 16) or 1)); - - finally - FreeMem (Stack); - end; -end; { of function RegExprSubExpressions ---------------------------------------------------------------} - - - -const - MAGIC = TREOp (216);// programm signature - -// name opcode opnd? meaning - EEND = TREOp (0); // - End of program - BOL = TREOp (1); // - Match "" at beginning of line - EOL = TREOp (2); // - Match "" at end of line - ANY = TREOp (3); // - Match any one character - ANYOF = TREOp (4); // Str Match any character in string Str - ANYBUT = TREOp (5); // Str Match any char. not in string Str - BRANCH = TREOp (6); // Node Match this alternative, or the next - BACK = TREOp (7); // - Jump backward (Next < 0) - EXACTLY = TREOp (8); // Str Match string Str - NOTHING = TREOp (9); // - Match empty string - STAR = TREOp (10); // Node Match this (simple) thing 0 or more times - PLUS = TREOp (11); // Node Match this (simple) thing 1 or more times - ANYDIGIT = TREOp (12); // - Match any digit (equiv [0-9]) - NOTDIGIT = TREOp (13); // - Match not digit (equiv [0-9]) - ANYLETTER = TREOp (14); // - Match any letter from property WordChars - NOTLETTER = TREOp (15); // - Match not letter from property WordChars - ANYSPACE = TREOp (16); // - Match any space char (see property SpaceChars) - NOTSPACE = TREOp (17); // - Match not space char (see property SpaceChars) - BRACES = TREOp (18); // Node,Min,Max Match this (simple) thing from Min to Max times. - // Min and Max are TREBracesArg - COMMENT = TREOp (19); // - Comment ;) - EXACTLYCI = TREOp (20); // Str Match string Str case insensitive - ANYOFCI = TREOp (21); // Str Match any character in string Str, case insensitive - ANYBUTCI = TREOp (22); // Str Match any char. not in string Str, case insensitive - LOOPENTRY = TREOp (23); // Node Start of loop (Node - LOOP for this loop) - LOOP = TREOp (24); // Node,Min,Max,LoopEntryJmp - back jump for LOOPENTRY. - // Min and Max are TREBracesArg - // Node - next node in sequence, - // LoopEntryJmp - associated LOOPENTRY node addr - ANYOFTINYSET= TREOp (25); // Chrs Match any one char from Chrs (exactly TinySetLen chars) - ANYBUTTINYSET=TREOp (26); // Chrs Match any one char not in Chrs (exactly TinySetLen chars) - ANYOFFULLSET= TREOp (27); // Set Match any one char from set of char - // - very fast (one CPU instruction !) but takes 32 bytes of p-code - BSUBEXP = TREOp (28); // Idx Match previously matched subexpression #Idx (stored as REChar) //###0.936 - BSUBEXPCI = TREOp (29); // Idx -"- in case-insensitive mode - - // Non-Greedy Style Ops //###0.940 - STARNG = TREOp (30); // Same as START but in non-greedy mode - PLUSNG = TREOp (31); // Same as PLUS but in non-greedy mode - BRACESNG = TREOp (32); // Same as BRACES but in non-greedy mode - LOOPNG = TREOp (33); // Same as LOOP but in non-greedy mode - - // Multiline mode \m - BOLML = TREOp (34); // - Match "" at beginning of line - EOLML = TREOp (35); // - Match "" at end of line - ANYML = TREOp (36); // - Match any one character - - // Word boundary - BOUND = TREOp (37); // Match "" between words //###0.943 - NOTBOUND = TREOp (38); // Match "" not between words //###0.943 - - // !!! Change OPEN value if you add new opcodes !!! - - OPEN = TREOp (39); // - Mark this point in input as start of \n - // OPEN + 1 is \1, etc. - CLOSE = TREOp (ord (OPEN) + NSUBEXP); - // - Analogous to OPEN. - - // !!! Don't add new OpCodes after CLOSE !!! - -// We work with p-code thru pointers, compatible with PRegExprChar. -// Note: all code components (TRENextOff, TREOp, TREBracesArg, etc) -// must have lengths that can be divided by SizeOf (REChar) ! -// A node is TREOp of opcode followed Next "pointer" of TRENextOff type. -// The Next is a offset from the opcode of the node containing it. -// An operand, if any, simply follows the node. (Note that much of -// the code generation knows about this implicit relationship!) -// Using TRENextOff=Integer speed up p-code processing. - -// Opcodes description: -// -// BRANCH The set of branches constituting a single choice are hooked -// together with their "next" pointers, since precedence prevents -// anything being concatenated to any individual branch. The -// "next" pointer of the last BRANCH in a choice points to the -// thing following the whole choice. This is also where the -// final "next" pointer of each individual branch points; each -// branch starts with the operand node of a BRANCH node. -// BACK Normal "next" pointers all implicitly point forward; BACK -// exists to make loop structures possible. -// STAR,PLUS,BRACES '?', and complex '*' and '+', are implemented as -// circular BRANCH structures using BACK. Complex '{min,max}' -// - as pair LOOPENTRY-LOOP (see below). Simple cases (one -// character per match) are implemented with STAR, PLUS and -// BRACES for speed and to minimize recursive plunges. -// LOOPENTRY,LOOP {min,max} are implemented as special pair -// LOOPENTRY-LOOP. Each LOOPENTRY initialize loopstack for -// current level. -// OPEN,CLOSE are numbered at compile time. - - -{=============================================================} -{================== Error handling section ===================} -{=============================================================} - -const - reeOk = 0; - reeCompNullArgument = 100; - reeCompRegexpTooBig = 101; - reeCompParseRegTooManyBrackets = 102; - reeCompParseRegUnmatchedBrackets = 103; - reeCompParseRegUnmatchedBrackets2 = 104; - reeCompParseRegJunkOnEnd = 105; - reePlusStarOperandCouldBeEmpty = 106; - reeNestedSQP = 107; - reeBadHexDigit = 108; - reeInvalidRange = 109; - reeParseAtomTrailingBackSlash = 110; - reeNoHexCodeAfterBSlashX = 111; - reeHexCodeAfterBSlashXTooBig = 112; - reeUnmatchedSqBrackets = 113; - reeInternalUrp = 114; - reeQPSBFollowsNothing = 115; - reeTrailingBackSlash = 116; - reeRarseAtomInternalDisaster = 119; - reeBRACESArgTooBig = 122; - reeBracesMinParamGreaterMax = 124; - reeUnclosedComment = 125; - reeComplexBracesNotImplemented = 126; - reeUrecognizedModifier = 127; - reeBadLinePairedSeparator = 128; - reeRegRepeatCalledInappropriately = 1000; - reeMatchPrimMemoryCorruption = 1001; - reeMatchPrimCorruptedPointers = 1002; - reeNoExpression = 1003; - reeCorruptedProgram = 1004; - reeNoInpitStringSpecified = 1005; - reeOffsetMustBeGreaterThen0 = 1006; - reeExecNextWithoutExec = 1007; - reeGetInputStringWithoutInputString = 1008; - reeDumpCorruptedOpcode = 1011; - reeModifierUnsupported = 1013; - reeLoopStackExceeded = 1014; - reeLoopWithoutEntry = 1015; - reeBadPCodeImported = 2000; - -function TRegExpr.ErrorMsg (AErrorID : Integer) : RegExprString; -begin - case AErrorID of - reeOk: Result := 'No errors'; - reeCompNullArgument: Result := 'TRegExpr(comp): Null Argument'; - reeCompRegexpTooBig: Result := 'TRegExpr(comp): Regexp Too Big'; - reeCompParseRegTooManyBrackets: Result := 'TRegExpr(comp): ParseReg Too Many ()'; - reeCompParseRegUnmatchedBrackets: Result := 'TRegExpr(comp): ParseReg Unmatched ()'; - reeCompParseRegUnmatchedBrackets2: Result := 'TRegExpr(comp): ParseReg Unmatched ()'; - reeCompParseRegJunkOnEnd: Result := 'TRegExpr(comp): ParseReg Junk On End'; - reePlusStarOperandCouldBeEmpty: Result := 'TRegExpr(comp): *+ Operand Could Be Empty'; - reeNestedSQP: Result := 'TRegExpr(comp): Nested *?+'; - reeBadHexDigit: Result := 'TRegExpr(comp): Bad Hex Digit'; - reeInvalidRange: Result := 'TRegExpr(comp): Invalid [] Range'; - reeParseAtomTrailingBackSlash: Result := 'TRegExpr(comp): Parse Atom Trailing \'; - reeNoHexCodeAfterBSlashX: Result := 'TRegExpr(comp): No Hex Code After \x'; - reeHexCodeAfterBSlashXTooBig: Result := 'TRegExpr(comp): Hex Code After \x Is Too Big'; - reeUnmatchedSqBrackets: Result := 'TRegExpr(comp): Unmatched []'; - reeInternalUrp: Result := 'TRegExpr(comp): Internal Urp'; - reeQPSBFollowsNothing: Result := 'TRegExpr(comp): ?+*{ Follows Nothing'; - reeTrailingBackSlash: Result := 'TRegExpr(comp): Trailing \'; - reeRarseAtomInternalDisaster: Result := 'TRegExpr(comp): RarseAtom Internal Disaster'; - reeBRACESArgTooBig: Result := 'TRegExpr(comp): BRACES Argument Too Big'; - reeBracesMinParamGreaterMax: Result := 'TRegExpr(comp): BRACE Min Param Greater then Max'; - reeUnclosedComment: Result := 'TRegExpr(comp): Unclosed (?#Comment)'; - reeComplexBracesNotImplemented: Result := 'TRegExpr(comp): If you want take part in beta-testing BRACES ''{min,max}'' and non-greedy ops ''*?'', ''+?'', ''??'' for complex cases - remove ''.'' from {.$DEFINE ComplexBraces}'; - reeUrecognizedModifier: Result := 'TRegExpr(comp): Urecognized Modifier'; - reeBadLinePairedSeparator: Result := 'TRegExpr(comp): LinePairedSeparator must countain two different chars or no chars at all'; - - reeRegRepeatCalledInappropriately: Result := 'TRegExpr(exec): RegRepeat Called Inappropriately'; - reeMatchPrimMemoryCorruption: Result := 'TRegExpr(exec): MatchPrim Memory Corruption'; - reeMatchPrimCorruptedPointers: Result := 'TRegExpr(exec): MatchPrim Corrupted Pointers'; - reeNoExpression: Result := 'TRegExpr(exec): Not Assigned Expression Property'; - reeCorruptedProgram: Result := 'TRegExpr(exec): Corrupted Program'; - reeNoInpitStringSpecified: Result := 'TRegExpr(exec): No Input String Specified'; - reeOffsetMustBeGreaterThen0: Result := 'TRegExpr(exec): Offset Must Be Greater Then 0'; - reeExecNextWithoutExec: Result := 'TRegExpr(exec): ExecNext Without Exec[Pos]'; - reeGetInputStringWithoutInputString: Result := 'TRegExpr(exec): GetInputString Without InputString'; - reeDumpCorruptedOpcode: Result := 'TRegExpr(dump): Corrupted Opcode'; - reeLoopStackExceeded: Result := 'TRegExpr(exec): Loop Stack Exceeded'; - reeLoopWithoutEntry: Result := 'TRegExpr(exec): Loop Without LoopEntry !'; - - reeBadPCodeImported: Result := 'TRegExpr(misc): Bad p-code imported'; - else - Result := 'Unknown error'; - end; -end; { of procedure TRegExpr.Error ---------------------------------------------------------------} - -function TRegExpr.LastError : Integer; -begin - Result := FLastError; - FLastError := reeOk; -end; { of function TRegExpr.LastError ---------------------------------------------------------------} - - -{=============================================================} -{===================== Common section ========================} -{=============================================================} - -class function TRegExpr.VersionMajor : Integer; //###0.944 -begin - Result := TRegExprVersionMajor; -end; { of class function TRegExpr.VersionMajor ---------------------------------------------------------------} - -class function TRegExpr.VersionMinor : Integer; //###0.944 -begin - Result := TRegExprVersionMinor; -end; { of class function TRegExpr.VersionMinor ---------------------------------------------------------------} - -constructor TRegExpr.Create; -begin - inherited; - programm := nil; - fExpression := nil; - fInputString := nil; - - regexpbeg := nil; - fExprIsCompiled := False; - - ModifierI := RegExprModifierI; - ModifierR := RegExprModifierR; - ModifierS := RegExprModifierS; - ModifierG := RegExprModifierG; - ModifierM := RegExprModifierM; //###0.940 - - SpaceChars := RegExprSpaceChars; //###0.927 - WordChars := RegExprWordChars; //###0.929 - fInvertCase := RegExprInvertCaseFunction; //###0.927 - - FLineSeparators := RegExprLineSeparators; //###0.941 - LinePairedSeparator := RegExprLinePairedSeparator; //###0.941 -end; { of constructor TRegExpr.Create ---------------------------------------------------------------} - -destructor TRegExpr.Destroy; -begin - if programm <> nil then - FreeMem (programm); - if fExpression <> nil then - FreeMem (fExpression); - if fInputString <> nil then - FreeMem (fInputString); -end; { of destructor TRegExpr.Destroy ---------------------------------------------------------------} - -class function TRegExpr.InvertCaseFunction (const Ch : REChar) : REChar; -begin - {$IFDEF SynRegUniCode} - if Ch >= #128 then - Result := Ch - else - {$ENDIF} - begin - Result := {$IFDEF FPC}AnsiUpperCase (Ch) [1]{$ELSE} {$IFDEF MSWINDOWS}REChar (CharUpper (PChar (Ch))){$ELSE}REChar (toupper (Integer (Ch))){$ENDIF} {$ENDIF}; - if Result = Ch then - Result := {$IFDEF FPC}AnsiLowerCase (Ch) [1]{$ELSE} {$IFDEF MSWINDOWS}REChar (CharLower (PChar (Ch))){$ELSE}REChar(tolower (Integer (Ch))){$ENDIF} {$ENDIF}; - end; -end; { of function TRegExpr.InvertCaseFunction ---------------------------------------------------------------} - -function TRegExpr.GetExpression : RegExprString; -begin - if fExpression <> nil then - Result := fExpression - else - Result := ''; -end; { of function TRegExpr.GetExpression ---------------------------------------------------------------} - -procedure TRegExpr.SetExpression (const s : RegExprString); -var - Len : Integer; //###0.950 -begin - if (s <> fExpression) or not fExprIsCompiled then begin - fExprIsCompiled := False; - if fExpression <> nil then begin - FreeMem (fExpression); - fExpression := nil; - end; - if s <> '' then begin - Len := length (s); //###0.950 - GetMem (fExpression, (Len + 1) * SizeOf (REChar)); -// StrPCopy (fExpression, s); //###0.950 replaced due to StrPCopy limitation of 255 chars - {$IFDEF SynRegUniCode} - StrPCopy (fExpression, Copy (s, 1, Len)); //###0.950 - {$ELSE} - StrLCopy (fExpression, PRegExprChar (s), Len); //###0.950 - {$ENDIF SynRegUniCode} - - InvalidateProgramm; //###0.941 - end; - end; -end; { of procedure TRegExpr.SetExpression ---------------------------------------------------------------} - -function TRegExpr.GetSubExprMatchCount : Integer; -begin - if Assigned (fInputString) then begin - Result := NSUBEXP - 1; - while (Result > 0) and ((startp [Result] = nil) - or (endp [Result] = nil)) - do dec (Result); - end - else Result := -1; -end; { of function TRegExpr.GetSubExprMatchCount ---------------------------------------------------------------} - -function TRegExpr.GetMatchPos (Idx : Integer) : Integer; -begin - if (Idx >= 0) and (Idx < NSUBEXP) and Assigned (fInputString) - and Assigned (startp [Idx]) and Assigned (endp [Idx]) then begin - Result := (startp [Idx] - fInputString) + 1; - end - else Result := -1; -end; { of function TRegExpr.GetMatchPos ---------------------------------------------------------------} - -function TRegExpr.GetMatchLen (Idx : Integer) : Integer; -begin - if (Idx >= 0) and (Idx < NSUBEXP) and Assigned (fInputString) - and Assigned (startp [Idx]) and Assigned (endp [Idx]) then begin - Result := endp [Idx] - startp [Idx]; - end - else Result := -1; -end; { of function TRegExpr.GetMatchLen ---------------------------------------------------------------} - -function TRegExpr.GetMatch (Idx : Integer) : RegExprString; -begin - if (Idx >= 0) and (Idx < NSUBEXP) and Assigned (fInputString) - and Assigned (startp [Idx]) and Assigned (endp [Idx]) - //then Result := copy (fInputString, MatchPos [Idx], MatchLen [Idx]) //###0.929 - then SetString (Result, startp [idx], endp [idx] - startp [idx]) - else Result := ''; -end; { of function TRegExpr.GetMatch ---------------------------------------------------------------} - -function TRegExpr.GetModifierStr : RegExprString; -begin - Result := '-'; - - if ModifierI - then Result := 'i' + Result - else Result := Result + 'i'; - if ModifierR - then Result := 'r' + Result - else Result := Result + 'r'; - if ModifierS - then Result := 's' + Result - else Result := Result + 's'; - if ModifierG - then Result := 'g' + Result - else Result := Result + 'g'; - if ModifierM - then Result := 'm' + Result - else Result := Result + 'm'; - if ModifierX - then Result := 'x' + Result - else Result := Result + 'x'; - - if Result [length (Result)] = '-' // remove '-' if all modifiers are 'On' - then System.Delete (Result, length (Result), 1); -end; { of function TRegExpr.GetModifierStr ---------------------------------------------------------------} - -class function TRegExpr.ParseModifiersStr (const AModifiers : RegExprString; - var AModifiersInt: Integer) : Boolean; -// !!! Be carefull - this is class function and must not use object instance fields -var - i : Integer; - IsOn : Boolean; - Mask : Integer; -begin - Result := True; - IsOn := True; - {$IFNDEF SYN_COMPILER_24_UP} - {$IFDEF WIN32} - Mask := 0; // prevent compiler warning - {$ENDIF} - {$ENDIF} - for i := 1 to length (AModifiers) do - if AModifiers [i] = '-' - then IsOn := False - else begin - if Pos (AModifiers [i], 'iI') > 0 - then Mask := MaskModI - else if Pos (AModifiers [i], 'rR') > 0 - then Mask := MaskModR - else if Pos (AModifiers [i], 'sS') > 0 - then Mask := MaskModS - else if Pos (AModifiers [i], 'gG') > 0 - then Mask := MaskModG - else if Pos (AModifiers [i], 'mM') > 0 - then Mask := MaskModM - else if Pos (AModifiers [i], 'xX') > 0 - then Mask := MaskModX - else begin - Result := False; - Exit; - end; - if IsOn - then AModifiersInt := AModifiersInt or Mask - else AModifiersInt := AModifiersInt and not Mask; - end; -end; { of function TRegExpr.ParseModifiersStr ---------------------------------------------------------------} - -procedure TRegExpr.SetModifierStr (const AModifiers : RegExprString); -begin - if not ParseModifiersStr (AModifiers, fModifiers) - then Error (reeModifierUnsupported); -end; { of procedure TRegExpr.SetModifierStr ---------------------------------------------------------------} - -function TRegExpr.GetModifier (AIndex : Integer) : Boolean; -var - Mask : Integer; -begin - Result := False; - case AIndex of - 1: Mask := MaskModI; - 2: Mask := MaskModR; - 3: Mask := MaskModS; - 4: Mask := MaskModG; - 5: Mask := MaskModM; - 6: Mask := MaskModX; - else begin - Error (reeModifierUnsupported); - Exit; - end; - end; - Result := (fModifiers and Mask) <> 0; -end; { of function TRegExpr.GetModifier ---------------------------------------------------------------} - -procedure TRegExpr.SetModifier (AIndex : Integer; ASet : Boolean); -var - Mask : Integer; -begin - case AIndex of - 1: Mask := MaskModI; - 2: Mask := MaskModR; - 3: Mask := MaskModS; - 4: Mask := MaskModG; - 5: Mask := MaskModM; - 6: Mask := MaskModX; - else begin - Error (reeModifierUnsupported); - Exit; - end; - end; - if ASet - then fModifiers := fModifiers or Mask - else fModifiers := fModifiers and not Mask; -end; { of procedure TRegExpr.SetModifier ---------------------------------------------------------------} - - -{=============================================================} -{==================== Compiler section =======================} -{=============================================================} - -procedure TRegExpr.InvalidateProgramm; -begin - if programm <> nil then begin - FreeMem (programm); - programm := nil; - end; -end; { of procedure TRegExpr.InvalidateProgramm ---------------------------------------------------------------} - -procedure TRegExpr.Compile; //###0.941 -begin - if fExpression = nil then begin // No Expression assigned - Error (reeNoExpression); - Exit; - end; - CompileRegExpr (fExpression); -end; { of procedure TRegExpr.Compile ---------------------------------------------------------------} - -function TRegExpr.IsProgrammOk : Boolean; -{$IFNDEF SynRegUniCode} -var - i : Integer; - {$ENDIF} -begin - Result := False; - - // check modifiers - if fModifiers <> fProgModifiers //###0.941 - then InvalidateProgramm; - - // can we optimize line separators by using sets? - {$IFNDEF SynRegUniCode} - FLineSeparatorsSet := []; - for i := 1 to length (FLineSeparators) do - System.Include (FLineSeparatorsSet, FLineSeparators [i]); - {$ENDIF} - - // [Re]compile if needed - if programm = nil - then Compile; //###0.941 - - // check [re]compiled programm - if programm = nil - then Exit // error was set/raised by Compile (was reeExecAfterCompErr) - else if programm [0] <> MAGIC // Program corrupted. - then Error (reeCorruptedProgram) - else Result := True; -end; { of function TRegExpr.IsProgrammOk ---------------------------------------------------------------} - -procedure TRegExpr.Tail (p : PRegExprChar; val : PRegExprChar); -// set the next-pointer at the end of a node chain - var - scan : PRegExprChar; - temp : PRegExprChar; -// i : int64; - begin - if p = @regdummy - then Exit; - // Find last node. - scan := p; - REPEAT - temp := regnext (scan); - if temp = nil - then BREAK; - scan := temp; - UNTIL False; - // Set Next 'pointer' - if val < scan - then PRENextOff (scan + REOpSz)^ := - (scan - val) //###0.948 - // work around PWideChar subtraction bug (Delphi uses - // shr after subtraction to calculate widechar distance %-( ) - // so, if difference is negative we have .. the "feature" :( - // I could wrap it in $IFDEF UniCode, but I didn't because - // "P – Q computes the difference between the address given - // by P (the higher address) and the address given by Q (the - // lower address)" - Delphi help quotation. - else PRENextOff (scan + REOpSz)^ := val - scan; //###0.933 - end; { of procedure TRegExpr.Tail ---------------------------------------------------------------} - -procedure TRegExpr.OpTail (p : PRegExprChar; val : PRegExprChar); -// regtail on operand of first argument; nop if operandless - begin - // "Operandless" and "op != BRANCH" are synonymous in practice. - if (p = nil) or (p = @regdummy) or (PREOp (p)^ <> BRANCH) - then Exit; - Tail (p + REOpSz + RENextOffSz, val); //###0.933 - end; { of procedure TRegExpr.OpTail ---------------------------------------------------------------} - -function TRegExpr.EmitNode (op : TREOp) : PRegExprChar; //###0.933 -// emit a node, return location - begin - Result := regcode; - if Result <> @regdummy then begin - PREOp (regcode)^ := op; - inc (regcode, REOpSz); - PRENextOff (regcode)^ := 0; // Next "pointer" := nil - inc (regcode, RENextOffSz); - end - else inc (regsize, REOpSz + RENextOffSz); // compute code size without code generation - end; { of function TRegExpr.EmitNode ---------------------------------------------------------------} - -procedure TRegExpr.EmitC (b : REChar); -// emit a byte to code - begin - if regcode <> @regdummy then begin - regcode^ := b; - inc (regcode); - end - else inc (regsize); // Type of p-code pointer always is ^REChar - end; { of procedure TRegExpr.EmitC ---------------------------------------------------------------} - -procedure TRegExpr.InsertOperator (op : TREOp; opnd : PRegExprChar; sz : Integer); -// insert an operator in front of already-emitted operand -// Means relocating the operand. - var - src, dst, place : PRegExprChar; - i : Integer; - begin - if regcode = @regdummy then begin - inc (regsize, sz); - Exit; - end; - src := regcode; - inc (regcode, sz); - dst := regcode; - while src > opnd do begin - dec (dst); - dec (src); - dst^ := src^; - end; - place := opnd; // Op node, where operand used to be. - PREOp (place)^ := op; - inc (place, REOpSz); - for i := 1 + REOpSz to sz do begin - place^ := #0; - inc (place); - end; - end; { of procedure TRegExpr.InsertOperator ---------------------------------------------------------------} - -function strcspn (s1 : PRegExprChar; s2 : PRegExprChar) : Integer; -// find length of initial segment of s1 consisting -// entirely of characters not from s2 - var scan1, scan2 : PRegExprChar; - begin - Result := 0; - scan1 := s1; - while scan1^ <> #0 do begin - scan2 := s2; - while scan2^ <> #0 do - if scan1^ = scan2^ - then Exit - else inc (scan2); - inc (Result); - inc (scan1) - end; - end; { of function strcspn ---------------------------------------------------------------} - -const -// Flags to be passed up and down. - HASWIDTH = 01; // Known never to match nil string. - SIMPLE = 02; // Simple enough to be STAR/PLUS/BRACES operand. - SPSTART = 04; // Starts with * or +. - WORST = 0; // Worst case. - META : array [0 .. 12] of REChar = ( - '^', '$', '.', '[', '(', ')', '|', '?', '+', '*', EscChar, '{', #0); - // Any modification must be synchronized with QuoteRegExprMetaChars !!! - -{$IFDEF SynRegUniCode} - RusRangeLo : array [0 .. 33] of REChar = - (#$430,#$431,#$432,#$433,#$434,#$435,#$451,#$436,#$437, - #$438,#$439,#$43A,#$43B,#$43C,#$43D,#$43E,#$43F, - #$440,#$441,#$442,#$443,#$444,#$445,#$446,#$447, - #$448,#$449,#$44A,#$44B,#$44C,#$44D,#$44E,#$44F,#0); - RusRangeHi : array [0 .. 33] of REChar = - (#$410,#$411,#$412,#$413,#$414,#$415,#$401,#$416,#$417, - #$418,#$419,#$41A,#$41B,#$41C,#$41D,#$41E,#$41F, - #$420,#$421,#$422,#$423,#$424,#$425,#$426,#$427, - #$428,#$429,#$42A,#$42B,#$42C,#$42D,#$42E,#$42F,#0); - RusRangeLoLow = #$430{'à'}; - RusRangeLoHigh = #$44F{'ÿ'}; - RusRangeHiLow = #$410{'À'}; - RusRangeHiHigh = #$42F{'ß'}; -{$ELSE} - RusRangeLo = 'àáâãäå¸æçèéêëìíîïðñòóôõö÷øùúûüýþÿ'; - RusRangeHi = 'ÀÁÂÃÄŨÆÇÈÉÊËÌÍÎÏÐÑÒÓÔÕÖ×ØÙÚÛÜÝÞß'; - RusRangeLoLow = 'à'; - RusRangeLoHigh = 'ÿ'; - RusRangeHiLow = 'À'; - RusRangeHiHigh = 'ß'; -{$ENDIF} - -function TRegExpr.CompileRegExpr (exp : PRegExprChar) : Boolean; -// compile a regular expression into internal code -// We can't allocate space until we know how big the compiled form will be, -// but we can't compile it (and thus know how big it is) until we've got a -// place to put the code. So we cheat: we compile it twice, once with code -// generation turned off and size counting turned on, and once "for real". -// This also means that we don't allocate space until we are sure that the -// thing really will compile successfully, and we never have to move the -// code and thus invalidate pointers into it. (Note that it has to be in -// one piece because free() must be able to free it all.) -// Beware that the optimization-preparation code in here knows about some -// of the structure of the compiled regexp. - var - scan, longest : PRegExprChar; - len : cardinal; - flags : Integer; - begin - Result := False; // life too dark - - regparse := nil; // for correct error handling - regexpbeg := exp; - try - - if programm <> nil then begin - FreeMem (programm); - programm := nil; - end; - - if exp = nil then begin - Error (reeCompNullArgument); - Exit; - end; - - fProgModifiers := fModifiers; - // well, may it's paranoia. I'll check it later... !!!!!!!! - - // First pass: determine size, legality. - fCompModifiers := fModifiers; - regparse := exp; - regnpar := 1; - regsize := 0; - regcode := @regdummy; - EmitC (MAGIC); - if ParseReg (0, flags) = nil - then Exit; - - // Small enough for 2-bytes programm pointers ? - // ###0.933 no real p-code length limits now :))) -// if regsize >= 64 * 1024 then begin -// Error (reeCompRegexpTooBig); -// Exit; -// end; - - // Allocate space. - GetMem (programm, regsize * SizeOf (REChar)); - - // Second pass: emit code. - fCompModifiers := fModifiers; - regparse := exp; - regnpar := 1; - regcode := programm; - EmitC (MAGIC); - if ParseReg (0, flags) = nil - then Exit; - - // Dig out information for optimizations. - {$IFDEF UseFirstCharSet} //###0.929 - FirstCharSet := []; - FillFirstCharSet (programm + REOpSz); - {$ENDIF} - regstart := #0; // Worst-case defaults. - reganch := #0; - regmust := nil; - regmlen := 0; - scan := programm + REOpSz; // First BRANCH. - if PREOp (regnext (scan))^ = EEND then begin // Only one top-level choice. - scan := scan + REOpSz + RENextOffSz; - - // Starting-point info. - if PREOp (scan)^ = EXACTLY - then regstart := (scan + REOpSz + RENextOffSz)^ - else if PREOp (scan)^ = BOL - then inc (reganch); - - // If there's something expensive in the r.e., find the longest - // literal string that must appear and make it the regmust. Resolve - // ties in favor of later strings, since the regstart check works - // with the beginning of the r.e. and avoiding duplication - // strengthens checking. Not a strong reason, but sufficient in the - // absence of others. - if (flags and SPSTART) <> 0 then begin - longest := nil; - len := 0; - while scan <> nil do begin - if (PREOp (scan)^ = EXACTLY) - and (strlen (scan + REOpSz + RENextOffSz) >= len) then begin - longest := scan + REOpSz + RENextOffSz; - len := strlen (longest); - end; - scan := regnext (scan); - end; - regmust := longest; - regmlen := len; - end; - end; - - Result := True; - - finally begin - if not Result - then InvalidateProgramm; - regexpbeg := nil; - fExprIsCompiled := Result; //###0.944 - end; - end; - - end; { of function TRegExpr.CompileRegExpr ---------------------------------------------------------------} - -function TRegExpr.ParseReg (paren : Integer; var flagp : Integer) : PRegExprChar; -// regular expression, i.e. main body or parenthesized thing -// Caller must absorb opening parenthesis. -// Combining parenthesis handling with the base level of regular expression -// is a trifle forced, but the need to tie the tails of the branches to what -// follows makes it hard to avoid. - var - ret, br, ender : PRegExprChar; - parno : Integer; - flags : Integer; - SavedModifiers : Integer; - begin - Result := nil; - flagp := HASWIDTH; // Tentatively. - parno := 0; // eliminate compiler stupid warning - SavedModifiers := fCompModifiers; - - // Make an OPEN node, if parenthesized. - if paren <> 0 then begin - if regnpar >= NSUBEXP then begin - Error (reeCompParseRegTooManyBrackets); - Exit; - end; - parno := regnpar; - inc (regnpar); - ret := EmitNode (TREOp (ord (OPEN) + parno)); - end - else ret := nil; - - // Pick up the branches, linking them together. - br := ParseBranch (flags); - if br = nil then begin - Result := nil; - Exit; - end; - if ret <> nil - then Tail (ret, br) // OPEN -> first. - else ret := br; - if (flags and HASWIDTH) = 0 - then flagp := flagp and not HASWIDTH; - flagp := flagp or flags and SPSTART; - while (regparse^ = '|') do begin - inc (regparse); - br := ParseBranch (flags); - if br = nil then begin - Result := nil; - Exit; - end; - Tail (ret, br); // BRANCH -> BRANCH. - if (flags and HASWIDTH) = 0 - then flagp := flagp and not HASWIDTH; - flagp := flagp or flags and SPSTART; - end; - - // Make a closing node, and hook it on the end. - if paren <> 0 - then ender := EmitNode (TREOp (ord (CLOSE) + parno)) - else ender := EmitNode (EEND); - Tail (ret, ender); - - // Hook the tails of the branches to the closing node. - br := ret; - while br <> nil do begin - OpTail (br, ender); - br := regnext (br); - end; - - // Check for proper termination. - if paren <> 0 then - if regparse^ <> ')' then begin - Error (reeCompParseRegUnmatchedBrackets); - Exit; - end - else inc (regparse); // skip trailing ')' - if (paren = 0) and (regparse^ <> #0) then begin - if regparse^ = ')' - then Error (reeCompParseRegUnmatchedBrackets2) - else Error (reeCompParseRegJunkOnEnd); - Exit; - end; - fCompModifiers := SavedModifiers; // restore modifiers of parent - Result := ret; - end; { of function TRegExpr.ParseReg ---------------------------------------------------------------} - -function TRegExpr.ParseBranch (var flagp : Integer) : PRegExprChar; -// one alternative of an | operator -// Implements the concatenation operator. - var - ret, chain, latest : PRegExprChar; - flags : Integer; - begin - flagp := WORST; // Tentatively. - - ret := EmitNode (BRANCH); - chain := nil; - while (regparse^ <> #0) and (regparse^ <> '|') - and (regparse^ <> ')') do begin - latest := ParsePiece (flags); - if latest = nil then begin - Result := nil; - Exit; - end; - flagp := flagp or flags and HASWIDTH; - if chain = nil // First piece. - then flagp := flagp or flags and SPSTART - else Tail (chain, latest); - chain := latest; - end; - if chain = nil // Loop ran zero times. - then EmitNode (NOTHING); - Result := ret; - end; { of function TRegExpr.ParseBranch ---------------------------------------------------------------} - -function TRegExpr.ParsePiece (var flagp : Integer) : PRegExprChar; -// something followed by possible [*+?{] -// Note that the branching code sequences used for ? and the general cases -// of * and + and { are somewhat optimized: they use the same NOTHING node as -// both the endmarker for their branch list and the body of the last branch. -// It might seem that this node could be dispensed with entirely, but the -// endmarker role is not redundant. - function parsenum (AStart, AEnd : PRegExprChar) : TREBracesArg; - begin - Result := 0; - if AEnd - AStart + 1 > 8 then begin // prevent stupid scanning - Error (reeBRACESArgTooBig); - Exit; - end; - while AStart <= AEnd do begin - Result := Result * 10 + (ord (AStart^) - ord ('0')); - inc (AStart); - end; - if (Result > MaxBracesArg) or (Result < 0) then begin - Error (reeBRACESArgTooBig); - Exit; - end; - end; - - var - op : REChar; - NonGreedyOp, NonGreedyCh : Boolean; //###0.940 - TheOp : TREOp; //###0.940 - NextNode : PRegExprChar; - flags : Integer; - BracesMin, Bracesmax : TREBracesArg; - p, savedparse : PRegExprChar; - - procedure EmitComplexBraces (ABracesMin, ABracesMax : TREBracesArg; - ANonGreedyOp : Boolean); //###0.940 - {$IFDEF ComplexBraces} - var - off : Integer; - {$ENDIF} - begin - {$IFNDEF ComplexBraces} - Error (reeComplexBracesNotImplemented); - {$ELSE} - if ANonGreedyOp - then TheOp := LOOPNG - else TheOp := LOOP; - InsertOperator (LOOPENTRY, Result, REOpSz + RENextOffSz); - NextNode := EmitNode (TheOp); - if regcode <> @regdummy then begin - off := (Result + REOpSz + RENextOffSz) - - (regcode - REOpSz - RENextOffSz); // back to Atom after LOOPENTRY - PREBracesArg (regcode)^ := ABracesMin; - inc (regcode, REBracesArgSz); - PREBracesArg (regcode)^ := ABracesMax; - inc (regcode, REBracesArgSz); - PRENextOff (regcode)^ := off; - inc (regcode, RENextOffSz); - end - else inc (regsize, REBracesArgSz * 2 + RENextOffSz); - Tail (Result, NextNode); // LOOPENTRY -> LOOP - if regcode <> @regdummy then - Tail (Result + REOpSz + RENextOffSz, NextNode); // Atom -> LOOP - {$ENDIF} - end; - - procedure EmitSimpleBraces (ABracesMin, ABracesMax : TREBracesArg; - ANonGreedyOp : Boolean); //###0.940 - begin - if ANonGreedyOp //###0.940 - then TheOp := BRACESNG - else TheOp := BRACES; - InsertOperator (TheOp, Result, REOpSz + RENextOffSz + REBracesArgSz * 2); - if regcode <> @regdummy then begin - PREBracesArg (Result + REOpSz + RENextOffSz)^ := ABracesMin; - PREBracesArg (Result + REOpSz + RENextOffSz + REBracesArgSz)^ := ABracesMax; - end; - end; - - begin - Result := ParseAtom (flags); - if Result = nil - then Exit; - - op := regparse^; - if not ((op = '*') or (op = '+') or (op = '?') or (op = '{')) then begin - flagp := flags; - Exit; - end; - if ((flags and HASWIDTH) = 0) and (op <> '?') then begin - Error (reePlusStarOperandCouldBeEmpty); - Exit; - end; - - case op of - '*': begin - flagp := WORST or SPSTART; - NonGreedyCh := (regparse + 1)^ = '?'; //###0.940 - NonGreedyOp := NonGreedyCh or ((fCompModifiers and MaskModG) = 0); //###0.940 - if (flags and SIMPLE) = 0 then begin - if NonGreedyOp //###0.940 - then EmitComplexBraces (0, MaxBracesArg, NonGreedyOp) - else begin // Emit x* as (x&|), where & means "self". - InsertOperator (BRANCH, Result, REOpSz + RENextOffSz); // Either x - OpTail (Result, EmitNode (BACK)); // and loop - OpTail (Result, Result); // back - Tail (Result, EmitNode (BRANCH)); // or - Tail (Result, EmitNode (NOTHING)); // nil. - end - end - else begin // Simple - if NonGreedyOp //###0.940 - then TheOp := STARNG - else TheOp := STAR; - InsertOperator (TheOp, Result, REOpSz + RENextOffSz); - end; - if NonGreedyCh //###0.940 - then inc (regparse); // Skip extra char ('?') - end; { of case '*'} - '+': begin - flagp := WORST or SPSTART or HASWIDTH; - NonGreedyCh := (regparse + 1)^ = '?'; //###0.940 - NonGreedyOp := NonGreedyCh or ((fCompModifiers and MaskModG) = 0); //###0.940 - if (flags and SIMPLE) = 0 then begin - if NonGreedyOp //###0.940 - then EmitComplexBraces (1, MaxBracesArg, NonGreedyOp) - else begin // Emit x+ as x(&|), where & means "self". - NextNode := EmitNode (BRANCH); // Either - Tail (Result, NextNode); - Tail (EmitNode (BACK), Result); // loop back - Tail (NextNode, EmitNode (BRANCH)); // or - Tail (Result, EmitNode (NOTHING)); // nil. - end - end - else begin // Simple - if NonGreedyOp //###0.940 - then TheOp := PLUSNG - else TheOp := PLUS; - InsertOperator (TheOp, Result, REOpSz + RENextOffSz); - end; - if NonGreedyCh //###0.940 - then inc (regparse); // Skip extra char ('?') - end; { of case '+'} - '?': begin - flagp := WORST; - NonGreedyCh := (regparse + 1)^ = '?'; //###0.940 - NonGreedyOp := NonGreedyCh or ((fCompModifiers and MaskModG) = 0); //###0.940 - if NonGreedyOp then begin //###0.940 // We emit x?? as x{0,1}? - if (flags and SIMPLE) = 0 - then EmitComplexBraces (0, 1, NonGreedyOp) - else EmitSimpleBraces (0, 1, NonGreedyOp); - end - else begin // greedy '?' - InsertOperator (BRANCH, Result, REOpSz + RENextOffSz); // Either x - Tail (Result, EmitNode (BRANCH)); // or - NextNode := EmitNode (NOTHING); // nil. - Tail (Result, NextNode); - OpTail (Result, NextNode); - end; - if NonGreedyCh //###0.940 - then inc (regparse); // Skip extra char ('?') - end; { of case '?'} - '{': begin - savedparse := regparse; - // !!!!!!!!!!!! - // Filip Jirsak's note - what will happen, when we are at the end of regparse? - inc (regparse); - p := regparse; - while Pos (regparse^, '0123456789') > 0 // MUST appear - do inc (regparse); - if (regparse^ <> '}') and (regparse^ <> ',') or (p = regparse) then begin - regparse := savedparse; - flagp := flags; - Exit; - end; - BracesMin := parsenum (p, regparse - 1); - if regparse^ = ',' then begin - inc (regparse); - p := regparse; - while Pos (regparse^, '0123456789') > 0 - do inc (regparse); - if regparse^ <> '}' then begin - regparse := savedparse; - Exit; - end; - if p = regparse - then BracesMax := MaxBracesArg - else BracesMax := parsenum (p, regparse - 1); - end - else BracesMax := BracesMin; // {n} == {n,n} - if BracesMin > BracesMax then begin - Error (reeBracesMinParamGreaterMax); - Exit; - end; - if BracesMin > 0 - then flagp := WORST; - if BracesMax > 0 - then flagp := flagp or HASWIDTH or SPSTART; - - NonGreedyCh := (regparse + 1)^ = '?'; //###0.940 - NonGreedyOp := NonGreedyCh or ((fCompModifiers and MaskModG) = 0); //###0.940 - if (flags and SIMPLE) <> 0 - then EmitSimpleBraces (BracesMin, BracesMax, NonGreedyOp) - else EmitComplexBraces (BracesMin, BracesMax, NonGreedyOp); - if NonGreedyCh //###0.940 - then inc (regparse); // Skip extra char '?' - end; { of case '{'} -// else // here we can't be - end; { of case op} - - inc (regparse); - if (regparse^ = '*') or (regparse^ = '+') or (regparse^ = '?') or (regparse^ = '{') then begin - Error (reeNestedSQP); - Exit; - end; - end; { of function TRegExpr.ParsePiece ---------------------------------------------------------------} - -function TRegExpr.ParseAtom (var flagp : Integer) : PRegExprChar; -// the lowest level -// Optimization: gobbles an entire sequence of ordinary characters so that -// it can turn them into a single node, which is smaller to store and -// faster to run. Backslashed characters are exceptions, each becoming a -// separate node; the code is simpler that way and it's not worth fixing. - var - ret : PRegExprChar; - flags : Integer; - RangeBeg, RangeEnd : REChar; - CanBeRange : Boolean; - len : Integer; - ender : REChar; - begmodfs : PRegExprChar; - - {$IFDEF UseSetOfChar} //###0.930 - RangePCodeBeg : PRegExprChar; - RangePCodeIdx : Integer; - RangeIsCI : Boolean; - RangeSet : TSetOfREChar; - RangeLen : Integer; - RangeChMin, RangeChMax : REChar; - {$ENDIF} - - procedure EmitExactly (ch : REChar); - begin - if (fCompModifiers and MaskModI) <> 0 - then ret := EmitNode (EXACTLYCI) - else ret := EmitNode (EXACTLY); - EmitC (ch); - EmitC (#0); - flagp := flagp or HASWIDTH or SIMPLE; - end; - - procedure EmitStr (const s : RegExprString); - var i : Integer; - begin - for i := 1 to length (s) - do EmitC (s [i]); - end; - - function HexDig (ch : REChar) : Integer; - begin - Result := 0; - if (ch >= 'a') and (ch <= 'f') - then ch := REChar (ord (ch) - (ord ('a') - ord ('A'))); - if (ch < '0') or (ch > 'F') or ((ch > '9') and (ch < 'A')) then begin - Error (reeBadHexDigit); - Exit; - end; - Result := ord (ch) - ord ('0'); - if ch >= 'A' - then Result := Result - (ord ('A') - ord ('9') - 1); - end; - - function EmitRange (AOpCode : REChar) : PRegExprChar; - begin - {$IFDEF UseSetOfChar} - case AOpCode of - ANYBUTCI, ANYBUT: - Result := EmitNode (ANYBUTTINYSET); - else // ANYOFCI, ANYOF - Result := EmitNode (ANYOFTINYSET); - end; - case AOpCode of - ANYBUTCI, ANYOFCI: - RangeIsCI := True; - else // ANYBUT, ANYOF - RangeIsCI := False; - end; - RangePCodeBeg := regcode; - RangePCodeIdx := regsize; - RangeLen := 0; - RangeSet := []; - RangeChMin := #255; - RangeChMax := #0; - {$ELSE} - Result := EmitNode (AOpCode); - // ToDo: - // !!!!!!!!!!!!! Implement ANYOF[BUT]TINYSET generation for UniCode !!!!!!!!!! - {$ENDIF} - end; - -{$IFDEF UseSetOfChar} - procedure EmitRangeCPrim (b : REChar); //###0.930 - begin - if b in RangeSet - then Exit; - inc (RangeLen); - if b < RangeChMin - then RangeChMin := b; - if b > RangeChMax - then RangeChMax := b; - Include (RangeSet, b); - end; - {$ENDIF} - - procedure EmitRangeC (b : REChar); - {$IFDEF UseSetOfChar} - var - Ch : REChar; - {$ENDIF} - begin - CanBeRange := False; - {$IFDEF UseSetOfChar} - if b <> #0 then begin - EmitRangeCPrim (b); //###0.930 - if RangeIsCI - then EmitRangeCPrim (InvertCase (b)); //###0.930 - end - else begin - {$IFDEF UseAsserts} - Assert (RangeLen > 0, 'TRegExpr.ParseAtom(subroutine EmitRangeC): empty range'); // impossible, but who knows.. - Assert (RangeChMin <= RangeChMax, 'TRegExpr.ParseAtom(subroutine EmitRangeC): RangeChMin > RangeChMax'); // impossible, but who knows.. - {$ENDIF} - if RangeLen <= TinySetLen then begin // emit "tiny set" - if regcode = @regdummy then begin - regsize := RangePCodeIdx + TinySetLen; // RangeChMin/Max !!! - Exit; - end; - regcode := RangePCodeBeg; - for Ch := RangeChMin to RangeChMax do //###0.930 - if Ch in RangeSet then begin - regcode^ := Ch; - inc (regcode); - end; - // fill rest: - while regcode < RangePCodeBeg + TinySetLen do begin - regcode^ := RangeChMax; - inc (regcode); - end; - end - else begin - if regcode = @regdummy then begin - regsize := RangePCodeIdx + SizeOf (TSetOfREChar); - Exit; - end; - if (RangePCodeBeg - REOpSz - RENextOffSz)^ = ANYBUTTINYSET - then RangeSet := [#0 .. #255] - RangeSet; - PREOp (RangePCodeBeg - REOpSz - RENextOffSz)^ := ANYOFFULLSET; - regcode := RangePCodeBeg; - Move (RangeSet, regcode^, SizeOf (TSetOfREChar)); - inc (regcode, SizeOf (TSetOfREChar)); - end; - end; - {$ELSE} - EmitC (b); - {$ENDIF} - end; - - procedure EmitSimpleRangeC (b : REChar); - begin - RangeBeg := b; - EmitRangeC (b); - CanBeRange := True; - end; - - procedure EmitRangeStr (const s : RegExprString); - var i : Integer; - begin - for i := 1 to length (s) - do EmitRangeC (s [i]); - end; - - function UnQuoteChar (var APtr : PRegExprChar) : REChar; //###0.934 - begin - case APtr^ of - 't': Result := #$9; // tab (HT/TAB) - 'n': Result := #$a; // newline (NL) - 'r': Result := #$d; // car.return (CR) - 'f': Result := #$c; // form feed (FF) - 'a': Result := #$7; // alarm (bell) (BEL) - 'e': Result := #$1b; // escape (ESC) - 'x': begin // hex char - Result := #0; - inc (APtr); - if APtr^ = #0 then begin - Error (reeNoHexCodeAfterBSlashX); - Exit; - end; - if APtr^ = '{' then begin // \x{nnnn} //###0.936 - repeat - inc (APtr); - if APtr^ = #0 then begin - Error (reeNoHexCodeAfterBSlashX); - Exit; - end; - if APtr^ <> '}' then begin - if (Ord (Result) - shr (SizeOf (REChar) * 8 - 4)) and $F <> 0 then begin - Error (reeHexCodeAfterBSlashXTooBig); - Exit; - end; - Result := REChar ((Ord (Result) ShL 4) or HexDig (APtr^)); - // HexDig will cause Error if bad hex digit found - end - else BREAK; - until False; - end - else begin - Result := REChar (HexDig (APtr^)); - // HexDig will cause Error if bad hex digit found - inc (APtr); - if APtr^ = #0 then begin - Error (reeNoHexCodeAfterBSlashX); - Exit; - end; - Result := REChar ((Ord (Result) ShL 4) or HexDig (APtr^)); - // HexDig will cause Error if bad hex digit found - end; - end; - else Result := APtr^; - end; - end; - - begin - Result := nil; - flagp := WORST; // Tentatively. - - inc (regparse); - case (regparse - 1)^ of - '^': if ((fCompModifiers and MaskModM) = 0) - or ((FLineSeparators = '') and not fLinePairedSeparatorAssigned) - then ret := EmitNode (BOL) - else ret := EmitNode (BOLML); - '$': if ((fCompModifiers and MaskModM) = 0) - or ((FLineSeparators = '') and not fLinePairedSeparatorAssigned) - then ret := EmitNode (EOL) - else ret := EmitNode (EOLML); - '.': - if (fCompModifiers and MaskModS) <> 0 then begin - ret := EmitNode (ANY); - flagp := flagp or HASWIDTH or SIMPLE; - end - else begin // not /s, so emit [^:LineSeparators:] - ret := EmitNode (ANYML); - flagp := flagp or HASWIDTH; // not so simple ;) -// ret := EmitRange (ANYBUT); -// EmitRangeStr (LineSeparators); //###0.941 -// EmitRangeStr (LinePairedSeparator); // !!! isn't correct if have to accept only paired -// EmitRangeC (#0); -// flagp := flagp or HASWIDTH or SIMPLE; - end; - '[': begin - if regparse^ = '^' then begin // Complement of range. - if (fCompModifiers and MaskModI) <> 0 - then ret := EmitRange (ANYBUTCI) - else ret := EmitRange (ANYBUT); - inc (regparse); - end - else - if (fCompModifiers and MaskModI) <> 0 - then ret := EmitRange (ANYOFCI) - else ret := EmitRange (ANYOF); - - CanBeRange := False; - - if (regparse^ = ']') then begin - EmitSimpleRangeC (regparse^); // []-a] -> ']' .. 'a' - inc (regparse); - end; - - while (regparse^ <> #0) and (regparse^ <> ']') do begin - if (regparse^ = '-') - and ((regparse + 1)^ <> #0) and ((regparse + 1)^ <> ']') - and CanBeRange then begin - inc (regparse); - RangeEnd := regparse^; - if RangeEnd = EscChar then begin - {$IFDEF SynRegUniCode} //###0.935 - if (ord ((regparse + 1)^) < 256) - and (ansichar ((regparse + 1)^) - in ['d', 'D', 's', 'S', 'w', 'W']) then begin - {$ELSE} - if (regparse + 1)^ in ['d', 'D', 's', 'S', 'w', 'W'] then begin - {$ENDIF} - EmitRangeC ('-'); // or treat as error ?!! - CONTINUE; - end; - inc (regparse); - RangeEnd := UnQuoteChar (regparse); - end; - - // r.e.ranges extension for russian - if ((fCompModifiers and MaskModR) <> 0) - and (RangeBeg = RusRangeLoLow) and (RangeEnd = RusRangeLoHigh) then begin - EmitRangeStr (RusRangeLo); - end - else if ((fCompModifiers and MaskModR) <> 0) - and (RangeBeg = RusRangeHiLow) and (RangeEnd = RusRangeHiHigh) then begin - EmitRangeStr (RusRangeHi); - end - else if ((fCompModifiers and MaskModR) <> 0) - and (RangeBeg = RusRangeLoLow) and (RangeEnd = RusRangeHiHigh) then begin - EmitRangeStr (RusRangeLo); - EmitRangeStr (RusRangeHi); - end - else begin // standard r.e. handling - if RangeBeg > RangeEnd then begin - Error (reeInvalidRange); - Exit; - end; - inc (RangeBeg); - EmitRangeC (RangeEnd); // prevent infinite loop if RangeEnd=$ff - while RangeBeg < RangeEnd do begin //###0.929 - EmitRangeC (RangeBeg); - inc (RangeBeg); - end; - end; - inc (regparse); - end - else begin - if regparse^ = EscChar then begin - inc (regparse); - if regparse^ = #0 then begin - Error (reeParseAtomTrailingBackSlash); - Exit; - end; - case regparse^ of // r.e.extensions - 'd': EmitRangeStr ('0123456789'); - 'w': EmitRangeStr (WordChars); - 's': EmitRangeStr (SpaceChars); - else EmitSimpleRangeC (UnQuoteChar (regparse)); - end; { of case} - end - else EmitSimpleRangeC (regparse^); - inc (regparse); - end; - end; { of while} - EmitRangeC (#0); - if regparse^ <> ']' then begin - Error (reeUnmatchedSqBrackets); - Exit; - end; - inc (regparse); - flagp := flagp or HASWIDTH or SIMPLE; - end; - '(': begin - if regparse^ = '?' then begin - // check for extended Perl syntax : (?..) - if (regparse + 1)^ = '#' then begin // (?#comment) - inc (regparse, 2); // find closing ')' - while (regparse^ <> #0) and (regparse^ <> ')') - do inc (regparse); - if regparse^ <> ')' then begin - Error (reeUnclosedComment); - Exit; - end; - inc (regparse); // skip ')' - ret := EmitNode (COMMENT); // comment - end - else begin // modifiers ? - inc (regparse); // skip '?' - begmodfs := regparse; - while (regparse^ <> #0) and (regparse^ <> ')') - do inc (regparse); - if (regparse^ <> ')') - or not ParseModifiersStr (copy (begmodfs, 1, (regparse - begmodfs)), fCompModifiers) then begin - Error (reeUrecognizedModifier); - Exit; - end; - inc (regparse); // skip ')' - ret := EmitNode (COMMENT); // comment -// Error (reeQPSBFollowsNothing); -// Exit; - end; - end - else begin - ret := ParseReg (1, flags); - if ret = nil then begin - Result := nil; - Exit; - end; - flagp := flagp or flags and (HASWIDTH or SPSTART); - end; - end; - #0, '|', ')': begin // Supposed to be caught earlier. - Error (reeInternalUrp); - Exit; - end; - '?', '+', '*': begin - Error (reeQPSBFollowsNothing); - Exit; - end; - EscChar: begin - if regparse^ = #0 then begin - Error (reeTrailingBackSlash); - Exit; - end; - case regparse^ of // r.e.extensions - 'b': ret := EmitNode (BOUND); //###0.943 - 'B': ret := EmitNode (NOTBOUND); //###0.943 - 'A': ret := EmitNode (BOL); //###0.941 - 'Z': ret := EmitNode (EOL); //###0.941 - 'd': begin // r.e.extension - any digit ('0' .. '9') - ret := EmitNode (ANYDIGIT); - flagp := flagp or HASWIDTH or SIMPLE; - end; - 'D': begin // r.e.extension - not digit ('0' .. '9') - ret := EmitNode (NOTDIGIT); - flagp := flagp or HASWIDTH or SIMPLE; - end; - 's': begin // r.e.extension - any space char - {$IFDEF UseSetOfChar} - ret := EmitRange (ANYOF); - EmitRangeStr (SpaceChars); - EmitRangeC (#0); - {$ELSE} - ret := EmitNode (ANYSPACE); - {$ENDIF} - flagp := flagp or HASWIDTH or SIMPLE; - end; - 'S': begin // r.e.extension - not space char - {$IFDEF UseSetOfChar} - ret := EmitRange (ANYBUT); - EmitRangeStr (SpaceChars); - EmitRangeC (#0); - {$ELSE} - ret := EmitNode (NOTSPACE); - {$ENDIF} - flagp := flagp or HASWIDTH or SIMPLE; - end; - 'w': begin // r.e.extension - any english char / digit / '_' - {$IFDEF UseSetOfChar} - ret := EmitRange (ANYOF); - EmitRangeStr (WordChars); - EmitRangeC (#0); - {$ELSE} - ret := EmitNode (ANYLETTER); - {$ENDIF} - flagp := flagp or HASWIDTH or SIMPLE; - end; - 'W': begin // r.e.extension - not english char / digit / '_' - {$IFDEF UseSetOfChar} - ret := EmitRange (ANYBUT); - EmitRangeStr (WordChars); - EmitRangeC (#0); - {$ELSE} - ret := EmitNode (NOTLETTER); - {$ENDIF} - flagp := flagp or HASWIDTH or SIMPLE; - end; - '1' .. '9': begin //###0.936 - if (fCompModifiers and MaskModI) <> 0 - then ret := EmitNode (BSUBEXPCI) - else ret := EmitNode (BSUBEXP); - EmitC (REChar (ord (regparse^) - ord ('0'))); - flagp := flagp or HASWIDTH or SIMPLE; - end; - else EmitExactly (UnQuoteChar (regparse)); - end; { of case} - inc (regparse); - end; - else begin - dec (regparse); - if ((fCompModifiers and MaskModX) <> 0) and // check for eXtended syntax - ((regparse^ = '#') - or ({$IFDEF SynRegUniCode}StrScan (XIgnoredChars, regparse^) <> nil //###0.947 - {$ELSE}regparse^ in XIgnoredChars{$ENDIF})) then begin //###0.941 \x - if regparse^ = '#' then begin // Skip eXtended comment - // find comment terminator (group of \n and/or \r) - while (regparse^ <> #0) and (regparse^ <> #$d) and (regparse^ <> #$a) - do inc (regparse); - while (regparse^ = #$d) or (regparse^ = #$a) // skip comment terminator - do inc (regparse); // attempt to support different type of line separators - end - else begin // Skip the blanks! - while {$IFDEF SynRegUniCode}StrScan (XIgnoredChars, regparse^) <> nil //###0.947 - {$ELSE}regparse^ in XIgnoredChars{$ENDIF} - do inc (regparse); - end; - ret := EmitNode (COMMENT); // comment - end - else begin - len := strcspn (regparse, META); - if len <= 0 then - if regparse^ <> '{' then begin - Error (reeRarseAtomInternalDisaster); - Exit; - end - else len := strcspn (regparse + 1, META) + 1; // bad {n,m} - compile as EXATLY - ender := (regparse + len)^; - if (len > 1) - and ((ender = '*') or (ender = '+') or (ender = '?') or (ender = '{')) - then dec (len); // Back off clear of ?+*{ operand. - flagp := flagp or HASWIDTH; - if len = 1 - then flagp := flagp or SIMPLE; - if (fCompModifiers and MaskModI) <> 0 - then ret := EmitNode (EXACTLYCI) - else ret := EmitNode (EXACTLY); - while (len > 0) - and (((fCompModifiers and MaskModX) = 0) or (regparse^ <> '#')) do begin - if ((fCompModifiers and MaskModX) = 0) or not ( //###0.941 - {$IFDEF SynRegUniCode}StrScan (XIgnoredChars, regparse^) <> nil //###0.947 - {$ELSE}regparse^ in XIgnoredChars{$ENDIF} ) - then EmitC (regparse^); - inc (regparse); - dec (len); - end; - EmitC (#0); - end; { of if not comment} - end; { of case else} - end; { of case} - - Result := ret; - end; { of function TRegExpr.ParseAtom ---------------------------------------------------------------} - -function TRegExpr.GetCompilerErrorPos : Integer; - begin - Result := 0; - if (regexpbeg = nil) or (regparse = nil) - then Exit; // not in compiling mode ? - Result := regparse - regexpbeg; - end; { of function TRegExpr.GetCompilerErrorPos ---------------------------------------------------------------} - - -{=============================================================} -{===================== Matching section ======================} -{=============================================================} - -{$IFNDEF UseSetOfChar} -function TRegExpr.StrScanCI (s : PRegExprChar; ch : REChar) : PRegExprChar; //###0.928 - now method of TRegExpr - begin - while (s^ <> #0) and (s^ <> ch) and (s^ <> InvertCase (ch)) - do inc (s); - if s^ <> #0 - then Result := s - else Result := nil; - end; { of function TRegExpr.StrScanCI ---------------------------------------------------------------} -{$ENDIF} - -function TRegExpr.regrepeat (p : PRegExprChar; AMax : Integer) : Integer; -// repeatedly match something simple, report how many - var - scan : PRegExprChar; - opnd : PRegExprChar; - TheMax : Integer; - {Ch,} InvCh : REChar; //###0.931 - sestart, seend : PRegExprChar; //###0.936 - begin - Result := 0; - scan := reginput; - opnd := p + REOpSz + RENextOffSz; //OPERAND - TheMax := fInputEnd - scan; - if TheMax > AMax - then TheMax := AMax; - case PREOp (p)^ of - ANY: begin - // note - ANYML cannot be proceeded in regrepeat because can skip - // more than one char at once - Result := TheMax; - inc (scan, Result); - end; - EXACTLY: begin // in opnd can be only ONE char !!! -// Ch := opnd^; // store in register //###0.931 - while (Result < TheMax) and (opnd^ = scan^) do begin - inc (Result); - inc (scan); - end; - end; - EXACTLYCI: begin // in opnd can be only ONE char !!! -// Ch := opnd^; // store in register //###0.931 - while (Result < TheMax) and (opnd^ = scan^) do begin // prevent unneeded InvertCase //###0.931 - inc (Result); - inc (scan); - end; - if Result < TheMax then begin //###0.931 - InvCh := InvertCase (opnd^); // store in register - while (Result < TheMax) and - ((opnd^ = scan^) or (InvCh = scan^)) do begin - inc (Result); - inc (scan); - end; - end; - end; - BSUBEXP: begin //###0.936 - sestart := startp [ord (opnd^)]; - if sestart = nil - then Exit; - seend := endp [ord (opnd^)]; - if seend = nil - then Exit; - repeat - opnd := sestart; - while opnd < seend do begin - if (scan >= fInputEnd) or (scan^ <> opnd^) - then Exit; - inc (scan); - inc (opnd); - end; - inc (Result); - reginput := scan; - until Result >= AMax; - end; - BSUBEXPCI: begin //###0.936 - sestart := startp [ord (opnd^)]; - if sestart = nil - then Exit; - seend := endp [ord (opnd^)]; - if seend = nil - then Exit; - repeat - opnd := sestart; - while opnd < seend do begin - if (scan >= fInputEnd) or - ((scan^ <> opnd^) and (scan^ <> InvertCase (opnd^))) - then Exit; - inc (scan); - inc (opnd); - end; - inc (Result); - reginput := scan; - until Result >= AMax; - end; - ANYDIGIT: - while (Result < TheMax) and - (scan^ >= '0') and (scan^ <= '9') do begin - inc (Result); - inc (scan); - end; - NOTDIGIT: - while (Result < TheMax) and - ((scan^ < '0') or (scan^ > '9')) do begin - inc (Result); - inc (scan); - end; - {$IFNDEF UseSetOfChar} //###0.929 - ANYLETTER: - while (Result < TheMax) and - (Pos (scan^, fWordChars) > 0) //###0.940 - { ((scan^ >= 'a') and (scan^ <= 'z') !! I've forgotten (>='0') and (<='9') - or (scan^ >= 'A') and (scan^ <= 'Z') or (scan^ = '_'))} do begin - inc (Result); - inc (scan); - end; - NOTLETTER: - while (Result < TheMax) and - (Pos (scan^, fWordChars) <= 0) //###0.940 - { not ((scan^ >= 'a') and (scan^ <= 'z') !! I've forgotten (>='0') and (<='9') - or (scan^ >= 'A') and (scan^ <= 'Z') - or (scan^ = '_'))} do begin - inc (Result); - inc (scan); - end; - ANYSPACE: - while (Result < TheMax) and - (Pos (scan^, fSpaceChars) > 0) do begin - inc (Result); - inc (scan); - end; - NOTSPACE: - while (Result < TheMax) and - (Pos (scan^, fSpaceChars) <= 0) do begin - inc (Result); - inc (scan); - end; - {$ENDIF} - ANYOFTINYSET: begin - while (Result < TheMax) and //!!!TinySet - ((scan^ = opnd^) or (scan^ = (opnd + 1)^) - or (scan^ = (opnd + 2)^)) do begin - inc (Result); - inc (scan); - end; - end; - ANYBUTTINYSET: begin - while (Result < TheMax) and //!!!TinySet - (scan^ <> opnd^) and (scan^ <> (opnd + 1)^) - and (scan^ <> (opnd + 2)^) do begin - inc (Result); - inc (scan); - end; - end; - {$IFDEF UseSetOfChar} //###0.929 - ANYOFFULLSET: begin - while (Result < TheMax) and - (scan^ in PSetOfREChar (opnd)^) do begin - inc (Result); - inc (scan); - end; - end; - {$ELSE} - ANYOF: - while (Result < TheMax) and - (StrScan (opnd, scan^) <> nil) do begin - inc (Result); - inc (scan); - end; - ANYBUT: - while (Result < TheMax) and - (StrScan (opnd, scan^) = nil) do begin - inc (Result); - inc (scan); - end; - ANYOFCI: - while (Result < TheMax) and (StrScanCI (opnd, scan^) <> nil) do begin - inc (Result); - inc (scan); - end; - ANYBUTCI: - while (Result < TheMax) and (StrScanCI (opnd, scan^) = nil) do begin - inc (Result); - inc (scan); - end; - {$ENDIF} - else begin // Oh dear. Called inappropriately. - Result := 0; // Best compromise. - Error (reeRegRepeatCalledInappropriately); - Exit; - end; - end; { of case} - reginput := scan; - end; { of function TRegExpr.regrepeat ---------------------------------------------------------------} - -function TRegExpr.regnext (p : PRegExprChar) : PRegExprChar; -// dig the "next" pointer out of a node - var offset : TRENextOff; - begin - if p = @regdummy then begin - Result := nil; - Exit; - end; - offset := PRENextOff (p + REOpSz)^; //###0.933 inlined NEXT - if offset = 0 - then Result := nil - else Result := p + offset; - end; { of function TRegExpr.regnext ---------------------------------------------------------------} - -function TRegExpr.MatchPrim (prog : PRegExprChar) : Boolean; -// recursively matching routine -// Conceptually the strategy is simple: check to see whether the current -// node matches, call self recursively to see whether the rest matches, -// and then act accordingly. In practice we make some effort to avoid -// recursion, in particular by going through "ordinary" nodes (that don't -// need to know whether the rest of the match failed) by a loop instead of -// by recursion. - var - scan : PRegExprChar; // Current node. - next : PRegExprChar; // Next node. - len : Integer; - opnd : PRegExprChar; - no : Integer; - save : PRegExprChar; - nextch : REChar; - BracesMin, BracesMax : Integer; // we use Integer instead of TREBracesArg for better support */+ - {$IFDEF ComplexBraces} - SavedLoopStack : array [1 .. LoopStackMax] of Integer; // :(( very bad for recursion - SavedLoopStackIdx : Integer; //###0.925 - {$ENDIF} - begin - Result := False; - scan := prog; - - while scan <> nil do begin - len := PRENextOff (scan + 1)^; //###0.932 inlined regnext - if len = 0 - then next := nil - else next := scan + len; - - case scan^ of - NOTBOUND, //###0.943 //!!! think about UseSetOfChar !!! - BOUND: - if (scan^ = BOUND) - xor ( - ((reginput = fInputStart) or (Pos ((reginput - 1)^, fWordChars) <= 0)) - and (reginput^ <> #0) and (Pos (reginput^, fWordChars) > 0) - or - (reginput <> fInputStart) and (Pos ((reginput - 1)^, fWordChars) > 0) - and ((reginput^ = #0) or (Pos (reginput^, fWordChars) <= 0))) - then Exit; - - BOL: if reginput <> fInputStart - then Exit; - EOL: if reginput^ <> #0 - then Exit; - BOLML: if reginput > fInputStart then begin - nextch := (reginput - 1)^; - if (nextch <> fLinePairedSeparatorTail) - or ((reginput - 1) <= fInputStart) - or ((reginput - 2)^ <> fLinePairedSeparatorHead) - then begin - if (nextch = fLinePairedSeparatorHead) - and (reginput^ = fLinePairedSeparatorTail) - then Exit; // don't stop between paired separator - if - {$IFNDEF SynRegUniCode} - not (nextch in FLineSeparatorsSet) - {$ELSE} - (pos (nextch, FLineSeparators) <= 0) - {$ENDIF} - then Exit; - end; - end; - EOLML: if reginput^ <> #0 then begin - nextch := reginput^; - if (nextch <> fLinePairedSeparatorHead) - or ((reginput + 1)^ <> fLinePairedSeparatorTail) - then begin - if (nextch = fLinePairedSeparatorTail) - and (reginput > fInputStart) - and ((reginput - 1)^ = fLinePairedSeparatorHead) - then Exit; // don't stop between paired separator - if - {$IFNDEF SynRegUniCode} - not (nextch in FLineSeparatorsSet) - {$ELSE} - (pos (nextch, FLineSeparators) <= 0) - {$ENDIF} - then Exit; - end; - end; - ANY: begin - if reginput^ = #0 - then Exit; - inc (reginput); - end; - ANYML: begin //###0.941 - if (reginput^ = #0) - or ((reginput^ = fLinePairedSeparatorHead) - and ((reginput + 1)^ = fLinePairedSeparatorTail)) - or {$IFNDEF SynRegUniCode} (reginput^ in FLineSeparatorsSet) - {$ELSE} (pos (reginput^, FLineSeparators) > 0) {$ENDIF} - then Exit; - inc (reginput); - end; - ANYDIGIT: begin - if (reginput^ = #0) or (reginput^ < '0') or (reginput^ > '9') - then Exit; - inc (reginput); - end; - NOTDIGIT: begin - if (reginput^ = #0) or ((reginput^ >= '0') and (reginput^ <= '9')) - then Exit; - inc (reginput); - end; - {$IFNDEF UseSetOfChar} //###0.929 - ANYLETTER: begin - if (reginput^ = #0) or (Pos (reginput^, fWordChars) <= 0) //###0.943 - then Exit; - inc (reginput); - end; - NOTLETTER: begin - if (reginput^ = #0) or (Pos (reginput^, fWordChars) > 0) //###0.943 - then Exit; - inc (reginput); - end; - ANYSPACE: begin - if (reginput^ = #0) or not (Pos (reginput^, fSpaceChars) > 0) //###0.943 - then Exit; - inc (reginput); - end; - NOTSPACE: begin - if (reginput^ = #0) or (Pos (reginput^, fSpaceChars) > 0) //###0.943 - then Exit; - inc (reginput); - end; - {$ENDIF} - EXACTLYCI: begin - opnd := scan + REOpSz + RENextOffSz; // OPERAND - // Inline the first character, for speed. - if (opnd^ <> reginput^) - and (InvertCase (opnd^) <> reginput^) - then Exit; - len := strlen (opnd); - //###0.929 begin - no := len; - save := reginput; - while no > 1 do begin - inc (save); - inc (opnd); - if (opnd^ <> save^) - and (InvertCase (opnd^) <> save^) - then Exit; - dec (no); - end; - //###0.929 end - inc (reginput, len); - end; - EXACTLY: begin - opnd := scan + REOpSz + RENextOffSz; // OPERAND - // Inline the first character, for speed. - if opnd^ <> reginput^ - then Exit; - len := strlen (opnd); - //###0.929 begin - no := len; - save := reginput; - while no > 1 do begin - inc (save); - inc (opnd); - if opnd^ <> save^ - then Exit; - dec (no); - end; - //###0.929 end - inc (reginput, len); - end; - BSUBEXP: begin //###0.936 - no := ord ((scan + REOpSz + RENextOffSz)^); - if startp [no] = nil - then Exit; - if endp [no] = nil - then Exit; - save := reginput; - opnd := startp [no]; - while opnd < endp [no] do begin - if (save >= fInputEnd) or (save^ <> opnd^) - then Exit; - inc (save); - inc (opnd); - end; - reginput := save; - end; - BSUBEXPCI: begin //###0.936 - no := ord ((scan + REOpSz + RENextOffSz)^); - if startp [no] = nil - then Exit; - if endp [no] = nil - then Exit; - save := reginput; - opnd := startp [no]; - while opnd < endp [no] do begin - if (save >= fInputEnd) or - ((save^ <> opnd^) and (save^ <> InvertCase (opnd^))) - then Exit; - inc (save); - inc (opnd); - end; - reginput := save; - end; - ANYOFTINYSET: begin - if (reginput^ = #0) or //!!!TinySet - ((reginput^ <> (scan + REOpSz + RENextOffSz)^) - and (reginput^ <> (scan + REOpSz + RENextOffSz + 1)^) - and (reginput^ <> (scan + REOpSz + RENextOffSz + 2)^)) - then Exit; - inc (reginput); - end; - ANYBUTTINYSET: begin - if (reginput^ = #0) or //!!!TinySet - (reginput^ = (scan + REOpSz + RENextOffSz)^) - or (reginput^ = (scan + REOpSz + RENextOffSz + 1)^) - or (reginput^ = (scan + REOpSz + RENextOffSz + 2)^) - then Exit; - inc (reginput); - end; - {$IFDEF UseSetOfChar} //###0.929 - ANYOFFULLSET: begin - if (reginput^ = #0) - or not (reginput^ in PSetOfREChar (scan + REOpSz + RENextOffSz)^) - then Exit; - inc (reginput); - end; - {$ELSE} - ANYOF: begin - if (reginput^ = #0) or (StrScan (scan + REOpSz + RENextOffSz, reginput^) = nil) - then Exit; - inc (reginput); - end; - ANYBUT: begin - if (reginput^ = #0) or (StrScan (scan + REOpSz + RENextOffSz, reginput^) <> nil) - then Exit; - inc (reginput); - end; - ANYOFCI: begin - if (reginput^ = #0) or (StrScanCI (scan + REOpSz + RENextOffSz, reginput^) = nil) - then Exit; - inc (reginput); - end; - ANYBUTCI: begin - if (reginput^ = #0) or (StrScanCI (scan + REOpSz + RENextOffSz, reginput^) <> nil) - then Exit; - inc (reginput); - end; - {$ENDIF} - NOTHING: ; - COMMENT: ; - BACK: ; - Succ (OPEN) .. TREOp (Ord (OPEN) + NSUBEXP - 1) : begin //###0.929 - no := ord (scan^) - ord (OPEN); -// save := reginput; - save := startp [no]; //###0.936 - startp [no] := reginput; //###0.936 - Result := MatchPrim (next); - if not Result //###0.936 - then startp [no] := save; -// if Result and (startp [no] = nil) -// then startp [no] := save; - // Don't set startp if some later invocation of the same - // parentheses already has. - Exit; - end; - Succ (CLOSE) .. TREOp (Ord (CLOSE) + NSUBEXP - 1): begin //###0.929 - no := ord (scan^) - ord (CLOSE); -// save := reginput; - save := endp [no]; //###0.936 - endp [no] := reginput; //###0.936 - Result := MatchPrim (next); - if not Result //###0.936 - then endp [no] := save; -// if Result and (endp [no] = nil) -// then endp [no] := save; - // Don't set endp if some later invocation of the same - // parentheses already has. - Exit; - end; - BRANCH: begin - if (next^ <> BRANCH) // No choice. - then next := scan + REOpSz + RENextOffSz // Avoid recursion - else begin - repeat - save := reginput; - Result := MatchPrim (scan + REOpSz + RENextOffSz); - if Result - then Exit; - reginput := save; - scan := regnext (scan); - until (scan = nil) or (scan^ <> BRANCH); - Exit; - end; - end; - {$IFDEF ComplexBraces} - LOOPENTRY: begin //###0.925 - no := LoopStackIdx; - inc (LoopStackIdx); - if LoopStackIdx > LoopStackMax then begin - Error (reeLoopStackExceeded); - Exit; - end; - save := reginput; - LoopStack [LoopStackIdx] := 0; // init loop counter - Result := MatchPrim (next); // execute LOOP - LoopStackIdx := no; // cleanup - if Result - then Exit; - reginput := save; - Exit; - end; - LOOP, LOOPNG: begin //###0.940 - if LoopStackIdx <= 0 then begin - Error (reeLoopWithoutEntry); - Exit; - end; - opnd := scan + PRENextOff (scan + REOpSz + RENextOffSz + 2 * REBracesArgSz)^; - BracesMin := PREBracesArg (scan + REOpSz + RENextOffSz)^; - BracesMax := PREBracesArg (scan + REOpSz + RENextOffSz + REBracesArgSz)^; - save := reginput; - if LoopStack [LoopStackIdx] >= BracesMin then begin // Min alredy matched - we can work - if scan^ = LOOP then begin - // greedy way - first try to max deep of greed ;) - if LoopStack [LoopStackIdx] < BracesMax then begin - inc (LoopStack [LoopStackIdx]); - no := LoopStackIdx; - Result := MatchPrim (opnd); - LoopStackIdx := no; - if Result - then Exit; - reginput := save; - end; - dec (LoopStackIdx); // Fail. May be we are too greedy? ;) - Result := MatchPrim (next); - if not Result - then reginput := save; - Exit; - end - else begin - // non-greedy - try just now - Result := MatchPrim (next); - if Result - then Exit - else reginput := save; // failed - move next and try again - if LoopStack [LoopStackIdx] < BracesMax then begin - inc (LoopStack [LoopStackIdx]); - no := LoopStackIdx; - Result := MatchPrim (opnd); - LoopStackIdx := no; - if Result - then Exit; - reginput := save; - end; - dec (LoopStackIdx); // Failed - back up - Exit; - end - end - else begin // first match a min_cnt times - inc (LoopStack [LoopStackIdx]); - no := LoopStackIdx; - Result := MatchPrim (opnd); - LoopStackIdx := no; - if Result - then Exit; - dec (LoopStack [LoopStackIdx]); - reginput := save; - Exit; - end; - end; - {$ENDIF} - STAR, PLUS, BRACES, STARNG, PLUSNG, BRACESNG: begin - // Lookahead to avoid useless match attempts when we know - // what character comes next. - nextch := #0; - if next^ = EXACTLY - then nextch := (next + REOpSz + RENextOffSz)^; - BracesMax := MaxInt; // infinite loop for * and + //###0.92 - if (scan^ = STAR) or (scan^ = STARNG) - then BracesMin := 0 // STAR - else if (scan^ = PLUS) or (scan^ = PLUSNG) - then BracesMin := 1 // PLUS - else begin // BRACES - BracesMin := PREBracesArg (scan + REOpSz + RENextOffSz)^; - BracesMax := PREBracesArg (scan + REOpSz + RENextOffSz + REBracesArgSz)^; - end; - save := reginput; - opnd := scan + REOpSz + RENextOffSz; - if (scan^ = BRACES) or (scan^ = BRACESNG) - then inc (opnd, 2 * REBracesArgSz); - - if (scan^ = PLUSNG) or (scan^ = STARNG) or (scan^ = BRACESNG) then begin - // non-greedy mode - BracesMax := regrepeat (opnd, BracesMax); // don't repeat more than BracesMax - // Now we know real Max limit to move forward (for recursion 'back up') - // In some cases it can be faster to check only Min positions first, - // but after that we have to check every position separtely instead - // of fast scannig in loop. - no := BracesMin; - while no <= BracesMax do begin - reginput := save + no; - // If it could work, try it. - if (nextch = #0) or (reginput^ = nextch) then begin - {$IFDEF ComplexBraces} - System.Move (LoopStack, SavedLoopStack, SizeOf (LoopStack)); //###0.925 - SavedLoopStackIdx := LoopStackIdx; - {$ENDIF} - if MatchPrim (next) then begin - Result := True; - Exit; - end; - {$IFDEF ComplexBraces} - System.Move (SavedLoopStack, LoopStack, SizeOf (LoopStack)); - LoopStackIdx := SavedLoopStackIdx; - {$ENDIF} - end; - inc (no); // Couldn't or didn't - move forward. - end; { of while} - Exit; - end - else begin // greedy mode - no := regrepeat (opnd, BracesMax); // don't repeat more than max_cnt - while no >= BracesMin do begin - // If it could work, try it. - if (nextch = #0) or (reginput^ = nextch) then begin - {$IFDEF ComplexBraces} - System.Move (LoopStack, SavedLoopStack, SizeOf (LoopStack)); //###0.925 - SavedLoopStackIdx := LoopStackIdx; - {$ENDIF} - if MatchPrim (next) then begin - Result := True; - Exit; - end; - {$IFDEF ComplexBraces} - System.Move (SavedLoopStack, LoopStack, SizeOf (LoopStack)); - LoopStackIdx := SavedLoopStackIdx; - {$ENDIF} - end; - dec (no); // Couldn't or didn't - back up. - reginput := save + no; - end; { of while} - Exit; - end; - end; - EEND: begin - Result := True; // Success! - Exit; - end; - else begin - Error (reeMatchPrimMemoryCorruption); - Exit; - end; - end; { of case scan^} - scan := next; - end; { of while scan <> nil} - - // We get here only if there's trouble -- normally "case EEND" is the - // terminating point. - Error (reeMatchPrimCorruptedPointers); - end; { of function TRegExpr.MatchPrim ---------------------------------------------------------------} - -{$IFDEF UseFirstCharSet} //###0.929 -procedure TRegExpr.FillFirstCharSet (prog : PRegExprChar); - var - scan : PRegExprChar; // Current node. - next : PRegExprChar; // Next node. - opnd : PRegExprChar; - min_cnt : Integer; - begin - scan := prog; - while scan <> nil do begin - next := regnext (scan); - case PREOp (scan)^ of - BSUBEXP, BSUBEXPCI: begin //###0.938 - FirstCharSet := [#0 .. #255]; // :((( we cannot - // optimize r.e. if it starts with back reference - Exit; - end; - BOL, BOLML: ; // Exit; //###0.937 - EOL, EOLML: begin //###0.948 was empty in 0.947, was Exit in 0.937 - Include (FirstCharSet, #0); - if ModifierM - then begin - opnd := PRegExprChar (LineSeparators); - while opnd^ <> #0 do begin - Include (FirstCharSet, opnd^); - inc (opnd); - end; - end; - Exit; - end; - BOUND, NOTBOUND: ; //###0.943 ?!! - ANY, ANYML: begin // we can better define ANYML !!! - FirstCharSet := [#0 .. #255]; //###0.930 - Exit; - end; - ANYDIGIT: begin - FirstCharSet := FirstCharSet + ['0' .. '9']; - Exit; - end; - NOTDIGIT: begin - FirstCharSet := FirstCharSet + ([#0 .. #255] - ['0' .. '9']); //###0.948 FirstCharSet was forgotten - Exit; - end; - EXACTLYCI: begin - Include (FirstCharSet, (scan + REOpSz + RENextOffSz)^); - Include (FirstCharSet, InvertCase ((scan + REOpSz + RENextOffSz)^)); - Exit; - end; - EXACTLY: begin - Include (FirstCharSet, (scan + REOpSz + RENextOffSz)^); - Exit; - end; - ANYOFFULLSET: begin - FirstCharSet := FirstCharSet + PSetOfREChar (scan + REOpSz + RENextOffSz)^; - Exit; - end; - ANYOFTINYSET: begin - //!!!TinySet - Include (FirstCharSet, (scan + REOpSz + RENextOffSz)^); - Include (FirstCharSet, (scan + REOpSz + RENextOffSz + 1)^); - Include (FirstCharSet, (scan + REOpSz + RENextOffSz + 2)^); - // ... // up to TinySetLen - Exit; - end; - ANYBUTTINYSET: begin - //!!!TinySet - FirstCharSet := FirstCharSet + ([#0 .. #255] - [ //###0.948 FirstCharSet was forgotten - (scan + REOpSz + RENextOffSz)^, - (scan + REOpSz + RENextOffSz + 1)^, - (scan + REOpSz + RENextOffSz + 2)^]); - // ... // up to TinySetLen - Exit; - end; - NOTHING: ; - COMMENT: ; - BACK: ; - Succ (OPEN) .. TREOp (Ord (OPEN) + NSUBEXP - 1) : begin //###0.929 - FillFirstCharSet (next); - Exit; - end; - Succ (CLOSE) .. TREOp (Ord (CLOSE) + NSUBEXP - 1): begin //###0.929 - FillFirstCharSet (next); - Exit; - end; - BRANCH: begin - if (PREOp (next)^ <> BRANCH) // No choice. - then next := scan + REOpSz + RENextOffSz // Avoid recursion. - else begin - repeat - FillFirstCharSet (scan + REOpSz + RENextOffSz); - scan := regnext (scan); - until (scan = nil) or (PREOp (scan)^ <> BRANCH); - Exit; - end; - end; - {$IFDEF ComplexBraces} - LOOPENTRY: begin //###0.925 -// LoopStack [LoopStackIdx] := 0; //###0.940 line removed - FillFirstCharSet (next); // execute LOOP - Exit; - end; - LOOP, LOOPNG: begin //###0.940 - opnd := scan + PRENextOff (scan + REOpSz + RENextOffSz + REBracesArgSz * 2)^; - min_cnt := PREBracesArg (scan + REOpSz + RENextOffSz)^; - FillFirstCharSet (opnd); - if min_cnt = 0 - then FillFirstCharSet (next); - Exit; - end; - {$ENDIF} - STAR, STARNG: //###0.940 - FillFirstCharSet (scan + REOpSz + RENextOffSz); - PLUS, PLUSNG: begin //###0.940 - FillFirstCharSet (scan + REOpSz + RENextOffSz); - Exit; - end; - BRACES, BRACESNG: begin //###0.940 - opnd := scan + REOpSz + RENextOffSz + REBracesArgSz * 2; - min_cnt := PREBracesArg (scan + REOpSz + RENextOffSz)^; // BRACES - FillFirstCharSet (opnd); - if min_cnt > 0 - then Exit; - end; - EEND: begin - FirstCharSet := [#0 .. #255]; //###0.948 - Exit; - end; - else begin - Error (reeMatchPrimMemoryCorruption); - Exit; - end; - end; { of case scan^} - scan := next; - end; { of while scan <> nil} - end; { of procedure FillFirstCharSet ---------------------------------------------------------------} -{$ENDIF} - -function TRegExpr.Exec (const AInputString : RegExprString) : Boolean; - begin - InputString := AInputString; - Result := ExecPrim (1); - end; { of function TRegExpr.Exec ---------------------------------------------------------------} - -{$IFDEF OverMeth} -{$IFNDEF FPC} -function TRegExpr.Exec : Boolean; - begin - Result := ExecPrim (1); - end; { of function TRegExpr.Exec ---------------------------------------------------------------} -{$ENDIF} -function TRegExpr.Exec (AOffset: Integer) : Boolean; - begin - Result := ExecPrim (AOffset); - end; { of function TRegExpr.Exec ---------------------------------------------------------------} -{$ENDIF} - -function TRegExpr.ExecPos (AOffset: Integer {$IFDEF DefParam}= 1{$ENDIF}) : Boolean; - begin - Result := ExecPrim (AOffset); - end; { of function TRegExpr.ExecPos ---------------------------------------------------------------} - -function TRegExpr.ExecPrim (AOffset: Integer) : Boolean; - procedure ClearMatchs; - // Clears matchs array - var i : Integer; - begin - for i := 0 to NSUBEXP - 1 do begin - startp [i] := nil; - endp [i] := nil; - end; - end; { of procedure ClearMatchs; -..............................................................} - function RegMatch (str : PRegExprChar) : Boolean; - // try match at specific point - begin - //###0.949 removed clearing of start\endp - reginput := str; - Result := MatchPrim (programm + REOpSz); - if Result then begin - startp [0] := str; - endp [0] := reginput; - end; - end; { of function RegMatch -..............................................................} - var - s : PRegExprChar; - StartPtr: PRegExprChar; - InputLen : Integer; - begin - Result := False; // Be paranoid... - - ClearMatchs; //###0.949 - // ensure that Match cleared either if optimization tricks or some error - // will lead to leaving ExecPrim without actual search. That is - // importent for ExecNext logic and so on. - - if not IsProgrammOk //###0.929 - then Exit; - - // Check InputString presence - if not Assigned (fInputString) then begin - Error (reeNoInpitStringSpecified); - Exit; - end; - - InputLen := length (fInputString); - - //Check that the start position is not negative - if AOffset < 1 then begin - Error (reeOffsetMustBeGreaterThen0); - Exit; - end; - // Check that the start position is not longer than the line - // If so then Exit with nothing found - if AOffset > (InputLen + 1) // for matching empty string after last char. - then Exit; - - StartPtr := fInputString + AOffset - 1; - - // If there is a "must appear" string, look for it. - if regmust <> nil then begin - s := StartPtr; - repeat - s := StrScan (s, regmust [0]); - if s <> nil then begin - if StrLComp (s, regmust, regmlen) = 0 - then BREAK; // Found it. - inc (s); - end; - until s = nil; - if s = nil // Not present. - then Exit; - end; - - // Mark beginning of line for ^ . - fInputStart := fInputString; - - // Pointer to end of input stream - for - // pascal-style string processing (may include #0) - fInputEnd := fInputString + InputLen; - - {$IFDEF ComplexBraces} - // no loops started - LoopStackIdx := 0; //###0.925 - {$ENDIF} - - // Simplest case: anchored match need be tried only once. - if reganch <> #0 then begin - Result := RegMatch (StartPtr); - Exit; - end; - - // Messy cases: unanchored match. - s := StartPtr; - if regstart <> #0 then // We know what char it must start with. - repeat - s := StrScan (s, regstart); - if s <> nil then begin - Result := RegMatch (s); - if Result - then Exit - else ClearMatchs; //###0.949 - inc (s); - end; - until s = nil - else begin // We don't - general case. - repeat //###0.948 - {$IFDEF UseFirstCharSet} - if s^ in FirstCharSet - then Result := RegMatch (s); - {$ELSE} - Result := RegMatch (s); - {$ENDIF} - if Result or (s^ = #0) // Exit on a match or after testing the end-of-string. - then Exit - else ClearMatchs; //###0.949 - inc (s); - until False; -(* optimized and fixed by Martin Fuller - empty strings - were not allowed to pass thru in UseFirstCharSet mode - {$IFDEF UseFirstCharSet} //###0.929 - while s^ <> #0 do begin - if s^ in FirstCharSet - then Result := RegMatch (s); - if Result - then Exit; - inc (s); - end; - {$ELSE} - repeat - Result := RegMatch (s); - if Result - then Exit; - inc (s); - until s^ = #0; - {$ENDIF} -*) - end; - // Failure -end; { of function TRegExpr.ExecPrim ---------------------------------------------------------------} - -function TRegExpr.ExecNext : Boolean; -var - offset : Integer; -begin - Result := False; - if not Assigned (startp[0]) or not Assigned (endp[0]) then - begin - Error (reeExecNextWithoutExec); - Exit; - end; -// Offset := MatchPos [0] + MatchLen [0]; -// if MatchLen [0] = 0 - Offset := endp [0] - fInputString + 1; //###0.929 - if endp [0] = startp [0] then //###0.929 - inc (Offset); // prevent infinite looping if empty string match r.e. - Result := ExecPrim (Offset); -end; { of function TRegExpr.ExecNext ---------------------------------------------------------------} - -function TRegExpr.GetInputString : RegExprString; -begin - if not Assigned (fInputString) then - begin - Error (reeGetInputStringWithoutInputString); - Exit; - end; - Result := fInputString; -end; { of function TRegExpr.GetInputString ---------------------------------------------------------------} - -procedure TRegExpr.SetInputString (const AInputString : RegExprString); -var - Len : Integer; - i : Integer; -begin - // clear Match* - before next Exec* call it's undefined - for i := 0 to NSUBEXP - 1 do - begin - startp [i] := nil; - endp [i] := nil; - end; - - // need reallocation of input string buffer ? - Len := length (AInputString); - if Assigned (fInputString) and (Length (fInputString) <> Len) then - begin - FreeMem (fInputString); - fInputString := nil; - end; - // buffer [re]allocation - if not Assigned (fInputString) then - GetMem (fInputString, (Len + 1) * SizeOf (REChar)); - - // copy input string into buffer - {$IFDEF SynRegUniCode} -// StrPCopy (fInputString, Copy (AInputString, 1, Len)); //###0.927 - StrPCopy (fInputString, AInputString); //KV Copy above is wastefull. Do not really understand why is there. - {$ELSE} - StrLCopy (fInputString, PRegExprChar (AInputString), Len); - {$ENDIF} - - { - fInputString : string; - fInputStart, fInputEnd : PRegExprChar; - - SetInputString: - fInputString := AInputString; - UniqueString (fInputString); - fInputStart := PChar (fInputString); - Len := length (fInputString); - fInputEnd := PRegExprChar (Integer (fInputStart) + Len); ?? - !! startp/endp âñå ðàâíî áóäåò îïàñíî èñïîëüçîâàòü ? - } -end; { of procedure TRegExpr.SetInputString ---------------------------------------------------------------} - -procedure TRegExpr.SetLineSeparators (const AStr : RegExprString); -begin - if AStr <> FLineSeparators then - begin - FLineSeparators := AStr; - InvalidateProgramm; - end; -end; { of procedure TRegExpr.SetLineSeparators ---------------------------------------------------------------} - -procedure TRegExpr.SetLinePairedSeparator (const AStr : RegExprString); -begin - if length (AStr) = 2 then - begin - if AStr [1] = AStr [2] then - begin - // it's impossible for our 'one-point' checking to support - // two chars separator for identical chars - Error (reeBadLinePairedSeparator); - Exit; - end; - if not fLinePairedSeparatorAssigned - or (AStr [1] <> fLinePairedSeparatorHead) - or (AStr [2] <> fLinePairedSeparatorTail) then - begin - fLinePairedSeparatorAssigned := True; - fLinePairedSeparatorHead := AStr [1]; - fLinePairedSeparatorTail := AStr [2]; - InvalidateProgramm; - end; - end - else if length (AStr) = 0 then - begin - if fLinePairedSeparatorAssigned then - begin - fLinePairedSeparatorAssigned := False; - InvalidateProgramm; - end; - end - else - Error (reeBadLinePairedSeparator); -end; { of procedure TRegExpr.SetLinePairedSeparator ---------------------------------------------------------------} - -function TRegExpr.GetLinePairedSeparator : RegExprString; - begin - if fLinePairedSeparatorAssigned then begin - {$IFDEF SynRegUniCode} - // Here is some UniCode 'magic' - // If You do know better decision to concatenate - // two WideChars, please, let me know! - Result := fLinePairedSeparatorHead; //###0.947 - Result := Result + fLinePairedSeparatorTail; - {$ELSE} - Result := fLinePairedSeparatorHead + fLinePairedSeparatorTail; - {$ENDIF} - end - else Result := ''; - end; { of function TRegExpr.GetLinePairedSeparator ---------------------------------------------------------------} - -function TRegExpr.Substitute (const ATemplate : RegExprString) : RegExprString; -// perform substitutions after a regexp match -// completely rewritten in 0.929 - var - TemplateLen : Integer; - TemplateBeg, TemplateEnd : PRegExprChar; - p, p0, ResultPtr : PRegExprChar; - ResultLen : Integer; - n : Integer; - Ch : REChar; - - function ParseVarName (var APtr : PRegExprChar) : Integer; - // extract name of variable (digits, may be enclosed with - // curly braces) from APtr^, uses TemplateEnd !!! - const - Digits = ['0' .. '9']; - var - p : PRegExprChar; - Delimited : Boolean; - begin - Result := 0; - p := APtr; - Delimited := (p < TemplateEnd) and (p^ = '{'); - if Delimited then - inc (p); // skip left curly brace - if (p < TemplateEnd) and (p^ = '&') then - inc (p) // this is '$&' or '${&}' - else - while (p < TemplateEnd) and - {$IFDEF SynRegUniCode} //###0.935 - (ord (p^) < 256) and (ansichar (p^) in Digits) - {$ELSE} - (p^ in Digits) - {$ENDIF} do - begin - Result := Result * 10 + (ord (p^) - ord ('0')); //###0.939 - inc (p); - end; - if Delimited then - if (p < TemplateEnd) and (p^ = '}') then - inc (p) // skip right curly brace - else - p := APtr; // isn't properly terminated - if p = APtr then - Result := -1; // no valid digits found or no right curly brace - APtr := p; - end; - -begin - // Check programm and input string - if not IsProgrammOk then - Exit; - if not Assigned (fInputString) then - begin - Error (reeNoInpitStringSpecified); - Exit; - end; - // Prepare for working - TemplateLen := length (ATemplate); - if TemplateLen = 0 then // prevent nil pointers - begin - Result := ''; - Exit; - end; - TemplateBeg := Pointer (ATemplate); - TemplateEnd := TemplateBeg + TemplateLen; - // Count result length for speed optimization. - ResultLen := 0; - p := TemplateBeg; - while p < TemplateEnd do begin - Ch := p^; - inc (p); - if Ch = '$' - then n := ParseVarName (p) - else n := -1; - if n >= 0 then begin - if (n < NSUBEXP) and Assigned (startp [n]) and Assigned (endp [n]) - then inc (ResultLen, endp [n] - startp [n]); - end - else begin - if (Ch = EscChar) and (p < TemplateEnd) - then inc (p); // quoted or special char followed - inc (ResultLen); - end; - end; - // Get memory. We do it once and it significant speed up work ! - if ResultLen = 0 then begin - Result := ''; - Exit; - end; - SetString (Result, nil, ResultLen); - // Fill Result - ResultPtr := Pointer (Result); - p := TemplateBeg; - while p < TemplateEnd do - begin - Ch := p^; - inc (p); - if Ch = '$' then - n := ParseVarName (p) - else - n := -1; - if n >= 0 then - begin - p0 := startp [n]; - if (n < NSUBEXP) and Assigned (p0) and Assigned (endp [n]) then - while p0 < endp [n] do - begin - ResultPtr^ := p0^; - inc (ResultPtr); - inc (p0); - end; - end - else - begin - if (Ch = EscChar) and (p < TemplateEnd) then // quoted or special char followed - begin - Ch := p^; - inc (p); - end; - ResultPtr^ := Ch; - inc (ResultPtr); - end; - end; -end; { of function TRegExpr.Substitute ---------------------------------------------------------------} - -procedure TRegExpr.Split (AInputStr : RegExprString; APieces : TStrings); -var - PrevPos: Integer; -begin - PrevPos := 1; - if Exec (AInputStr) then - repeat - APieces.Add (System.Copy (AInputStr, PrevPos, MatchPos [0] - PrevPos)); - PrevPos := MatchPos [0] + MatchLen [0]; - until not ExecNext; - APieces.Add (System.Copy (AInputStr, PrevPos, MaxInt)); // Tail -end; { of procedure TRegExpr.Split ---------------------------------------------------------------} - -function TRegExpr.Replace (AInputStr : RegExprString; const AReplaceStr : RegExprString; - AUseSubstitution : Boolean{$IFDEF DefParam}= False{$ENDIF}) : RegExprString; -var - PrevPos : Integer; -begin - Result := ''; - PrevPos := 1; - if Exec (AInputStr) then - repeat - Result := Result + System.Copy (AInputStr, PrevPos, MatchPos [0] - PrevPos); - if AUseSubstitution then //###0.946 - Result := Result + Substitute (AReplaceStr) - else - Result := Result + AReplaceStr; - PrevPos := MatchPos [0] + MatchLen [0]; - until not ExecNext; - Result := Result + System.Copy (AInputStr, PrevPos, MaxInt); // Tail -end; { of function TRegExpr.Replace ---------------------------------------------------------------} - -function TRegExpr.ReplaceEx (AInputStr : RegExprString; - AReplaceFunc : TRegExprReplaceFunction) - : RegExprString; -var - PrevPos : Integer; -begin - Result := ''; - PrevPos := 1; - if Exec (AInputStr) then - repeat - Result := Result + System.Copy (AInputStr, PrevPos, MatchPos [0] - PrevPos) - + AReplaceFunc (Self); - PrevPos := MatchPos [0] + MatchLen [0]; - until not ExecNext; - Result := Result + System.Copy (AInputStr, PrevPos, MaxInt); // Tail -end; { of function TRegExpr.ReplaceEx ---------------------------------------------------------------} - - -{$IFDEF OverMeth} -function TRegExpr.Replace (AInputStr: RegExprString; - AReplaceFunc: TRegExprReplaceFunction): RegExprString; -begin - ReplaceEx (AInputStr, AReplaceFunc); -end; { of function TRegExpr.Replace ---------------------------------------------------------------} -{$ENDIF} - -{=============================================================} -{====================== Debug section ========================} -{=============================================================} - -{$IFDEF RegExpPCodeDump} -function TRegExpr.DumpOp (op : TREOp) : RegExprString; -// printable representation of opcode -begin - case op of - BOL: Result := 'BOL'; - EOL: Result := 'EOL'; - BOLML: Result := 'BOLML'; - EOLML: Result := 'EOLML'; - BOUND: Result := 'BOUND'; //###0.943 - NOTBOUND: Result := 'NOTBOUND'; //###0.943 - ANY: Result := 'ANY'; - ANYML: Result := 'ANYML'; //###0.941 - ANYLETTER: Result := 'ANYLETTER'; - NOTLETTER: Result := 'NOTLETTER'; - ANYDIGIT: Result := 'ANYDIGIT'; - NOTDIGIT: Result := 'NOTDIGIT'; - ANYSPACE: Result := 'ANYSPACE'; - NOTSPACE: Result := 'NOTSPACE'; - ANYOF: Result := 'ANYOF'; - ANYBUT: Result := 'ANYBUT'; - ANYOFCI: Result := 'ANYOF/CI'; - ANYBUTCI: Result := 'ANYBUT/CI'; - BRANCH: Result := 'BRANCH'; - EXACTLY: Result := 'EXACTLY'; - EXACTLYCI: Result := 'EXACTLY/CI'; - NOTHING: Result := 'NOTHING'; - COMMENT: Result := 'COMMENT'; - BACK: Result := 'BACK'; - EEND: Result := 'END'; - BSUBEXP: Result := 'BSUBEXP'; - BSUBEXPCI: Result := 'BSUBEXP/CI'; - Succ (OPEN) .. TREOp (Ord (OPEN) + NSUBEXP - 1): //###0.929 - Result := Format ('OPEN[%d]', [ord (op) - ord (OPEN)]); - Succ (CLOSE) .. TREOp (Ord (CLOSE) + NSUBEXP - 1): //###0.929 - Result := Format ('CLOSE[%d]', [ord (op) - ord (CLOSE)]); - STAR: Result := 'STAR'; - PLUS: Result := 'PLUS'; - BRACES: Result := 'BRACES'; - {$IFDEF ComplexBraces} - LOOPENTRY: Result := 'LOOPENTRY'; //###0.925 - LOOP: Result := 'LOOP'; //###0.925 - LOOPNG: Result := 'LOOPNG'; //###0.940 - {$ENDIF} - ANYOFTINYSET: Result:= 'ANYOFTINYSET'; - ANYBUTTINYSET:Result:= 'ANYBUTTINYSET'; - {$IFDEF UseSetOfChar} //###0.929 - ANYOFFULLSET: Result:= 'ANYOFFULLSET'; - {$ENDIF} - STARNG: Result := 'STARNG'; //###0.940 - PLUSNG: Result := 'PLUSNG'; //###0.940 - BRACESNG: Result := 'BRACESNG'; //###0.940 - else Error (reeDumpCorruptedOpcode); - end; {of case op} - Result := ':' + Result; -end; { of function TRegExpr.DumpOp ---------------------------------------------------------------} - -function TRegExpr.Dump : RegExprString; -// dump a regexp in vaguely comprehensible form -var - s : PRegExprChar; - op : TREOp; // Arbitrary non-END op. - next : PRegExprChar; - i : Integer; - Diff : Integer; -{$IFDEF UseSetOfChar} //###0.929 - Ch : REChar; -{$ENDIF} -begin - if not IsProgrammOk then //###0.929 - Exit; - - op := EXACTLY; - Result := ''; - s := programm + REOpSz; - while op <> EEND do // While that wasn't END last time... - begin - op := s^; - Result := Result + Format ('%2d%s', [s - programm, DumpOp (s^)]); // Where, what. - next := regnext (s); - if next = nil then // Next ptr. - Result := Result + ' (0)' - else - begin - if next > s then //###0.948 PWideChar subtraction workaround (see comments in Tail method for details) - Diff := next - s - else - Diff := - (s - next); - Result := Result + Format (' (%d) ', [(s - programm) + Diff]); - end; - inc (s, REOpSz + RENextOffSz); - if (op = ANYOF) or (op = ANYOFCI) or (op = ANYBUT) or (op = ANYBUTCI) - or (op = EXACTLY) or (op = EXACTLYCI) then - begin - // Literal string, where present. - while s^ <> #0 do - begin - Result := Result + s^; - inc (s); - end; - inc (s); - end; - if (op = ANYOFTINYSET) or (op = ANYBUTTINYSET) then - begin - for i := 1 to TinySetLen do - begin - Result := Result + s^; - inc (s); - end; - end; - if (op = BSUBEXP) or (op = BSUBEXPCI) then - begin - Result := Result + ' \' + IntToStr (Ord (s^)); - inc (s); - end; - {$IFDEF UseSetOfChar} //###0.929 - if op = ANYOFFULLSET then - begin - for Ch := #0 to #255 do - if Ch in PSetOfREChar (s)^ then - if Ch < ' ' then - Result := Result + '#' + IntToStr (Ord (Ch)) //###0.936 - else - Result := Result + Ch; - inc (s, SizeOf (TSetOfREChar)); - end; - {$ENDIF} - if (op = BRACES) or (op = BRACESNG) then - begin //###0.941 - // show min/max argument of BRACES operator - Result := Result + Format ('{%d,%d}', [PREBracesArg (s)^, PREBracesArg (s + REBracesArgSz)^]); - inc (s, REBracesArgSz * 2); - end; - {$IFDEF ComplexBraces} - if (op = LOOP) or (op = LOOPNG) then - begin //###0.940 - Result := Result + Format (' -> (%d) {%d,%d}', [(s - programm - - (REOpSz + RENextOffSz)) + PRENextOff (s + 2 * REBracesArgSz)^, - PREBracesArg (s)^, PREBracesArg (s + REBracesArgSz)^]); - inc (s, 2 * REBracesArgSz + RENextOffSz); - end; - {$ENDIF} - Result := Result + #$d#$a; - end; { of while} - - // Header fields of interest. - - if regstart <> #0 then - Result := Result + 'start ' + regstart; - if reganch <> #0 then - Result := Result + 'anchored '; - if regmust <> nil then - Result := Result + 'must have ' + regmust; - {$IFDEF UseFirstCharSet} //###0.929 - Result := Result + #$d#$a'FirstCharSet:'; - for Ch := #0 to #255 do - if Ch in FirstCharSet then - begin - if Ch < ' ' then - Result := Result + '#' + IntToStr(Ord(Ch)) //###0.948 - else - Result := Result + Ch; - end; - {$ENDIF} - Result := Result + #$d#$a; -end; { of function TRegExpr.Dump ---------------------------------------------------------------} -{$ENDIF} - -{$IFDEF reRealExceptionAddr} -{$OPTIMIZATION ON} -// ReturnAddr works correctly only if compiler optimization is ON -// I placed this method at very end of unit because there are no -// way to restore compiler optimization flag ... -{$ENDIF} -procedure TRegExpr.Error (AErrorID : Integer); - -{$IFDEF reRealExceptionAddr} - function ReturnAddr : Pointer; //###0.938 - asm - mov eax,[ebp+4] - end; -{$ENDIF} - -var - e : ERegExpr; -begin - FLastError := AErrorID; // dummy stub - useless because will raise exception - if AErrorID < 1000 then // compilation error ? - e := ERegExpr.Create (ErrorMsg (AErrorID) // yes - show error pos - + ' (pos ' + IntToStr (CompilerErrorPos) + ')') - else - e := ERegExpr.Create (ErrorMsg (AErrorID)); - e.ErrorCode := AErrorID; - e.CompilerErrorPos := CompilerErrorPos; - raise - e -{$IFDEF reRealExceptionAddr} - At ReturnAddr; //###0.938 -{$ENDIF} -end; { of procedure TRegExpr.Error ---------------------------------------------------------------} - -(* - PCode persistence: - FirstCharSet - programm, regsize - regstart // -> programm - reganch // -> programm - regmust, regmlen // -> programm - fExprIsCompiled -*) - -// be carefull - placed here code will be always compiled with -// compiler optimization flag - -{$IFDEF FPC} -initialization - RegExprInvertCaseFunction := TRegExpr.InvertCaseFunction; - -{$ENDIF} -end. diff --git a/Ext/SynEdit/Source/SynSpellCheck.dcr b/Ext/SynEdit/Source/SynSpellCheck.dcr new file mode 100644 index 0000000000000000000000000000000000000000..cb2c6d05fd4111d19e310fdee1558af73398be4e GIT binary patch literal 484 zcmbu3I}XAy42J(A7KTb489Q9^l*3)B0*p6Dk!Y$`5iwAh&y*XMU zLJ0Jl&;`|HbF{W|M*36Y@EPFx!g0o~cT-VxLo7vv!fc#RT1tpWonRegk+DM{wWM^> Ozb&prskPqlcl!nlEedP^ literal 0 HcmV?d00001 diff --git a/Ext/SynEdit/Source/SynSpellCheck.pas b/Ext/SynEdit/Source/SynSpellCheck.pas new file mode 100644 index 0000000..f37ca68 --- /dev/null +++ b/Ext/SynEdit/Source/SynSpellCheck.pas @@ -0,0 +1,1058 @@ +{------------------------------------------------------------------------------- +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. + +Alternatively, the contents of this file may be used under the terms of the +GNU General Public License Version 2 or later (the "GPL"), in which case +the provisions of the GPL are applicable instead of those above. +If you wish to allow use of your version of this file only under the terms +of the GPL and not to allow others to use your version of this file +under the MPL, indicate your decision by deleting the provisions above and +replace them with the notice and other provisions required by the GPL. +If you do not delete the provisions above, a recipient may use your version +of this file under either the MPL or the GPL. +-------------------------------------------------------------------------------} + + +unit SynSpellCheck; +{$I synedit.inc} +{$WARN SYMBOL_PLATFORM OFF} + +interface + +uses + Winapi.Windows, + Winapi.ActiveX, + System.UITypes, + System.SysUtils, + System.Classes, + System.Generics.Collections, + Vcl.Graphics, + Vcl.ActnList, + SynEdit, + SynEditMiscClasses; + +{$REGION 'Spell Checking Interfaces'} + +// *********************************************************************// +// GUIDS declared in the TypeLibrary. Following prefixes are used: +// Type Libraries : LIBID_xxxx +// CoClasses : CLASS_xxxx +// DISPInterfaces : DIID_xxxx +// Non-DISP interfaces: IID_xxxx +// *********************************************************************// +const + IID_ISpellCheckerFactory: TGUID = '{8E018A9D-2415-4677-BF08-794EA61F94BB}'; + IID_IUserDictionariesRegistrar: TGUID = '{AA176B85-0E12-4844-8E1A-EEF1DA77F586}'; + IID_IEnumString: TGUID = '{00000101-0000-0000-C000-000000000046}'; + IID_ISpellChecker: TGUID = '{B6FD0B71-E2BC-4653-8D05-F197E412770B}'; + IID_IEnumSpellingError: TGUID = '{803E3BD4-2828-4410-8290-418D1D73C762}'; + IID_ISpellingError: TGUID = '{B7C82D61-FBE8-4B47-9B27-6C0D2E0DE0A3}'; + IID_ISpellCheckerChangedEventHandler: TGUID = '{0B83A5B0-792F-4EAB-9799-ACF52C5ED08A}'; + IID_IOptionDescription: TGUID = '{432E5F85-35CF-4606-A801-6F70277E1D7A}'; + CLASS_SpellCheckerFactory: TGUID = '{7AB36653-1796-484B-BDFA-E74F1DB7C1DC}'; + +// *********************************************************************// +// Declaration of Enumerations defined in Type Library +// *********************************************************************// +// Constants for enum CORRECTIVE_ACTION +type + CORRECTIVE_ACTION = TOleEnum; + TCorrectiveAction = (secaNone, secaSuggestions, secaReplace, secaDelete); +const + CORRECTIVE_ACTION_NONE = $00000000; + CORRECTIVE_ACTION_GET_SUGGESTIONS = $00000001; + CORRECTIVE_ACTION_REPLACE = $00000002; + CORRECTIVE_ACTION_DELETE = $00000003; + +type + +// *********************************************************************// +// Forward declaration of types defined in TypeLibrary +// *********************************************************************// + ISpellCheckerFactory = interface; + IUserDictionariesRegistrar = interface; + ISpellChecker = interface; + IEnumSpellingError = interface; + ISpellingError = interface; + ISpellCheckerChangedEventHandler = interface; + IOptionDescription = interface; + +// *********************************************************************// +// Declaration of CoClasses defined in Type Library +// (NOTE: Here we map each CoClass to its Default Interface) +// *********************************************************************// + SpellCheckerFactory = ISpellCheckerFactory; + + +// *********************************************************************// +// Interface: ISpellCheckerFactory +// Flags: (0) +// GUID: {8E018A9D-2415-4677-BF08-794EA61F94BB} +// *********************************************************************// + ISpellCheckerFactory = interface(IUnknown) + ['{8E018A9D-2415-4677-BF08-794EA61F94BB}'] + function Get_SupportedLanguages(out value: IEnumString): HResult; stdcall; + function IsSupported(languageTag: PWideChar; out value: Integer): HResult; stdcall; + function CreateSpellChecker(languageTag: PWideChar; out value: ISpellChecker): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: IUserDictionariesRegistrar +// Flags: (0) +// GUID: {AA176B85-0E12-4844-8E1A-EEF1DA77F586} +// *********************************************************************// + IUserDictionariesRegistrar = interface(IUnknown) + ['{AA176B85-0E12-4844-8E1A-EEF1DA77F586}'] + function RegisterUserDictionary(dictionaryPath: PWideChar; languageTag: PWideChar): HResult; stdcall; + function UnregisterUserDictionary(dictionaryPath: PWideChar; languageTag: PWideChar): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: ISpellChecker +// Flags: (0) +// GUID: {B6FD0B71-E2BC-4653-8D05-F197E412770B} +// *********************************************************************// + ISpellChecker = interface(IUnknown) + ['{B6FD0B71-E2BC-4653-8D05-F197E412770B}'] + function Get_languageTag(out value: PWideChar): HResult; stdcall; + function Check(text: PWideChar; out value: IEnumSpellingError): HResult; stdcall; + function Suggest(word: PWideChar; out value: IEnumString): HResult; stdcall; + function Add(word: PWideChar): HResult; stdcall; + function Ignore(word: PWideChar): HResult; stdcall; + function AutoCorrect(from: PWideChar; to_: PWideChar): HResult; stdcall; + function GetOptionValue(optionId: PWideChar; out value: Byte): HResult; stdcall; + function Get_OptionIds(out value: IEnumString): HResult; stdcall; + function Get_Id(out value: PWideChar): HResult; stdcall; + function Get_LocalizedName(out value: PWideChar): HResult; stdcall; + function add_SpellCheckerChanged(const handler: ISpellCheckerChangedEventHandler; + out eventCookie: LongWord): HResult; stdcall; + function remove_SpellCheckerChanged(eventCookie: LongWord): HResult; stdcall; + function GetOptionDescription(optionId: PWideChar; out value: IOptionDescription): HResult; stdcall; + function ComprehensiveCheck(text: PWideChar; out value: IEnumSpellingError): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: ISpellChecker2 +// Flags: (0) +// GUID: {E7ED1C71-87F7-4378-A840-C9200DACEE47} +// *********************************************************************// + ISpellChecker2 = interface(ISpellChecker) + ['{E7ED1C71-87F7-4378-A840-C9200DACEE47}'] + function Remove(word: PWideChar): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: IEnumSpellingError +// Flags: (0) +// GUID: {803E3BD4-2828-4410-8290-418D1D73C762} +// *********************************************************************// + IEnumSpellingError = interface(IUnknown) + ['{803E3BD4-2828-4410-8290-418D1D73C762}'] + function Next(out value: ISpellingError): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: ISpellingError +// Flags: (0) +// GUID: {B7C82D61-FBE8-4B47-9B27-6C0D2E0DE0A3} +// *********************************************************************// + ISpellingError = interface(IUnknown) + ['{B7C82D61-FBE8-4B47-9B27-6C0D2E0DE0A3}'] + function Get_StartIndex(out value: LongWord): HResult; stdcall; + function Get_Length(out value: LongWord): HResult; stdcall; + function Get_CorrectiveAction(out value: CORRECTIVE_ACTION): HResult; stdcall; + function Get_Replacement(out value: PWideChar): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: ISpellCheckerChangedEventHandler +// Flags: (0) +// GUID: {0B83A5B0-792F-4EAB-9799-ACF52C5ED08A} +// *********************************************************************// + ISpellCheckerChangedEventHandler = interface(IUnknown) + ['{0B83A5B0-792F-4EAB-9799-ACF52C5ED08A}'] + function Invoke(const sender: ISpellChecker): HResult; stdcall; + end; + +// *********************************************************************// +// Interface: IOptionDescription +// Flags: (0) +// GUID: {432E5F85-35CF-4606-A801-6F70277E1D7A} +// *********************************************************************// + IOptionDescription = interface(IUnknown) + ['{432E5F85-35CF-4606-A801-6F70277E1D7A}'] + function Get_Id(out value: PWideChar): HResult; stdcall; + function Get_Heading(out value: PWideChar): HResult; stdcall; + function Get_Description(out value: PWideChar): HResult; stdcall; + function Get_Labels(out value: IEnumString): HResult; stdcall; + end; + +{$ENDREGION 'Spell Checking Interfaces'} + + TUnderlineStyle = (usCorelWordPerfect, usMicrosoftWord); + +{$REGION 'TSpellCheckPlugin'} + + TSynSpellCheck = class; + + TSpellCheckPlugin = class(TSynEditPlugin) + private + procedure RegisterIndicatorSpec; + procedure Changed(LangId: Boolean = False); + protected + FSynSpellCheck: TSynSpellCheck; + { Procedures } + procedure LinesInserted(FirstLine, Count: Integer); override; + procedure LinePut(aIndex: Integer; const OldLine: string); override; + public + constructor Create(AOwner: TCustomSynEdit); + { Properties } + end; + +{$REGION 'TSpellCheckPlugin'} + +{$REGION 'TSynSpellCheck'} + + { Singleton class you can/need only have one instance in your application} + TSynSpellCheck = class(TComponent) + public + const SpellErrorIndicatorId: TGUID = '{CAD19326-12B3-4190-9241-99DE3FDDE214}'; + class var GlobalInstance: TSynSpellCheck; + private type + TWorkItem = record + Token: string; + TokenPos: Integer; + constructor Create(AToken: string; ATokenPos: Integer); + end; + private + FLanguageCode: string; + FSpellChecker: ISpellChecker; + FEditor: TCustomSynEdit; + FEditors: TList; + FPlugins: TList; + FUnderlineStyle: TUnderlineStyle; + FPenColor: TColor; + FAttributesChecked: TStrings; + FUpdateCount: Integer; + FCheckAsYouType: Boolean; + FDictionaryNA: Boolean; + FWorkList: TList; + FOnChange: TNotifyEvent; + procedure CreateSpellChecker; + procedure SetLanguageCode(const Value: string); + procedure SetEditor(const Value: TCustomSynEdit); + procedure SetPenColor(const Value: TColor); + procedure SetUnderlineStyle(const Value: TUnderlineStyle); + procedure SetAttributesChecked(const Value: TStrings); + class var FSpellCheckFactory: ISpellCheckerFactory; + procedure SetCheckAsYouType(const Value: Boolean); + protected + procedure Notification(AComponent: TComponent; + Operation: TOperation); override; + function SpellCheckLine(Editor: TCustomSynEdit; Line: Integer; + StartChar:Integer = 0; EndChar: Integer = MaxInt; ErrorPos: Integer = -1): + ISpellingError; + class function SpellCheckFactory: ISpellCheckerFactory; + public + constructor Create(AOwner: TComponent); override; + destructor Destroy; override; + procedure BeginUpdate; + procedure EndUpdate; + procedure Changed(LangId: Boolean = False); + function AddEditor(AEditor: TCustomSynEdit): Integer; + function RemoveEditor(AEditor: TCustomSynEdit): Boolean; + // Spell checking actions applied to FEditor + procedure CheckFile; + procedure CheckLine; + procedure CheckSelection; + procedure CheckWord; + procedure ClearErrors(Invalidate: Boolean = True); + function ErrorAtPos(BC: TBufferCoord): ISpellingError; + // provides access to to the SpellChecker interface + function SpellChecker: ISpellChecker; + property LanguageCode: string read FLanguageCode write SetLanguageCode; + class function SupportedLanguages: TArray; + published + property PenColor: TColor read FPenColor write SetPenColor default clRed; + property UnderlineStyle: TUnderlineStyle read FUnderlineStyle + write SetUnderlineStyle default usMicrosoftWord; + property AttributesChecked: TStrings read FAttributesChecked + write SetAttributesChecked; + property Editor: TCustomSynEdit read FEditor write SetEditor; + property CheckAsYouType: Boolean read FCheckAsYouType write SetCheckAsYouType; + property OnChange: TNotifyEvent read FOnChange write FOnChange; + end; + +{$ENDREGION 'TSynSpellCheck'} + +{$REGION 'Spell Check Actions'} + + TSynSpellCheckAction = class abstract (TAction) + // base class for spell check actions + private + FControl: TCustomSynEdit; + procedure SetControl(Value: TCustomSynEdit); + protected + function GetControl(Target: TObject): TCustomSynEdit; virtual; + procedure Notification(AComponent: TComponent; Operation: TOperation); override; + public + destructor Destroy; override; + function HandlesTarget(Target: TObject): Boolean; override; + procedure UpdateTarget(Target: TObject); override; + property Control: TCustomSynEdit read FControl write SetControl; + end; + + TSynSpellCheckFile = class(TSynSpellCheckAction) + procedure ExecuteTarget(Target: TObject); override; + end; + + TSynSpellCheckLine = class(TSynSpellCheckAction) + procedure ExecuteTarget(Target: TObject); override; + end; + + TSynSpellCheckSelection = class(TSynSpellCheckAction) + procedure ExecuteTarget(Target: TObject); override; + end; + + TSynSpellCheckWord = class(TSynSpellCheckAction) + procedure ExecuteTarget(Target: TObject); override; + end; + + TSynSpellClearErrors = class(TSynSpellCheckAction) + procedure ExecuteTarget(Target: TObject); override; + end; + + TSynSpellCheckAsYouType = class(TAction) + function HandlesTarget(Target: TObject): Boolean; override; + procedure UpdateTarget(Target: TObject); override; + procedure ExecuteTarget(Target: TObject); override; + end; + + TSynSpellErrorAction = class abstract(TSynSpellCheckAction) + procedure UpdateTarget(Target: TObject); override; + end; + + TSynSpellErrorReplace = class(TSynSpellErrorAction) + procedure ExecuteTarget(Target: TObject); override; + end; + + TSynSpellErrorAdd = class(TSynSpellErrorAction) + procedure ExecuteTarget(Target: TObject); override; + end; + + TSynSpellErrorIgnoreOnce = class(TSynSpellErrorAction) + procedure ExecuteTarget(Target: TObject); override; + end; + + TSynSpellErrorIgnore = class(TSynSpellErrorAction) + procedure ExecuteTarget(Target: TObject); override; + end; + + TSynSpellErrorDelete = class(TSynSpellErrorAction) + procedure ExecuteTarget(Target: TObject); override; + end; + +{$ENDREGION 'Spell Check Actions'} + +implementation + +uses + Winapi.Messages, + System.Math, + System.Win.ComObj, + SynEditTypes, + SynUnicode, + SynDWrite, + SynEditMiscProcs, + SynEditHighlighter, + SynHighlighterURI, + SynEditTextBuffer; + +resourcestring + SYNS_SingletonSynSpellCheck = + 'You can not and do not need to create more than one instance of TSynSpellCheck'; + +{$REGION 'TSynSpellCheck Implementation'} + +function TSynSpellCheck.AddEditor(AEditor: TCustomSynEdit): Integer; +var + Plugin: TSpellCheckPlugin; +begin + // Adds an Editor and returns its index in the list + Result := FEditors.IndexOf(AEditor); + if Result < 0 then + begin + FEditors.Add(AEditor); + AEditor.FreeNotification(Self); + Plugin := TSpellCheckPlugin.Create(AEditor); + Plugin.FSynSpellCheck := Self; + Plugin.Changed; + FPlugins.Add(Plugin); + end; +end; + +procedure TSynSpellCheck.BeginUpdate; +begin + Inc(FUpdateCount); +end; + +procedure TSynSpellCheck.CheckFile; +var + Line: Integer; +begin + if not Assigned(FEditor) then Exit; + + ClearErrors(False); + + for Line := 1 to FEditor.Lines.Count do + SpellCheckLine(FEditor, Line); + Editor.Invalidate; +end; + +procedure TSynSpellCheck.CheckSelection; +var + BB, BE: TBufferCoord; + Line: Integer; +begin + if not Assigned(FEditor) then Exit; + BB := Editor.BlockBegin; + BE := Editor.BlockEnd; + + if BB.Line = BE.Line then + SpellCheckLine(FEditor, BB.Line, BB.Char, BE.Char) + else + begin + // First line + SpellCheckLine(FEditor, BB.Line, BB.Char); + for Line := BB.Line + 1 to BE.Line - 1 do + SpellCheckLine(FEditor, Line); + // Last line + SpellCheckLine(FEditor, BE.Line, 1, BE.Char); + end; + FEditor.InvalidateSelection; +end; + +procedure TSynSpellCheck.CheckLine; +begin + if not Assigned(FEditor) then Exit; + + TCustomSynEdit(FEditor).Indicators.Clear(SpellErrorIndicatorId, + False, TCustomSynEdit(FEditor).CaretY); + SpellCheckLine(TCustomSynEdit(FEditor), TCustomSynEdit(FEditor).CaretY); + Editor.InvalidateLine(TCustomSynEdit(FEditor).CaretY); +end; + +procedure TSynSpellCheck.CheckWord; +var + BB, BE: TBufferCoord; +begin + if not Assigned(FEditor) then Exit; + + BB := FEditor.WordStart; + BE := FEditor.WordEnd; + + if BB >= BE then Exit; + + SpellCheckLine(TCustomSynEdit(FEditor), BB.Line, BB.Char, BE.Char); + FEditor.InvalidateRange(BB, BE); +end; + +procedure TSynSpellCheck.ClearErrors(Invalidate: Boolean = True); +begin + if not Assigned(FEditor) then Exit; + TCustomSynEdit(FEditor).Indicators.Clear(SpellErrorIndicatorId, Invalidate); +end; + +procedure TSynSpellCheck.Changed(LangId: Boolean); +var + Plugin: TSpellCheckPlugin; +begin + if FUpdateCount = 0 then + begin + for Plugin in FPlugins do + Plugin.Changed(LangId); + + if Assigned(FOnChange) then + FOnChange(Self); + end; +end; + +constructor TSynSpellCheck.Create(AOwner: TComponent); +begin + if Assigned(GlobalInstance) then + raise ESynError.CreateRes(@SYNS_SingletonSynSpellCheck); + + inherited Create(AOwner); + FLanguageCode := UserLocaleName; + FPenColor := clRed; + FUnderlineStyle := usMicrosoftWord; + FEditors := TList.Create; + FPlugins := TList.Create; + FAttributesChecked := TStringList.Create; + with FAttributesChecked do + begin + Add('Comment'); + Add('Text'); + Add('String'); + Add('Documentation'); + end; + FWorkList := TList.Create; + GlobalInstance := Self; +end; + +procedure TSynSpellCheck.CreateSpellChecker; +begin + FSpellChecker := nil; + + if not Assigned(SpellCheckFactory()) then + begin + FDictionaryNA := True; + Exit; + end; + + try + CheckOSError(SpellCheckFactory.CreateSpellChecker( + PChar(FLanguageCode), FSpellChecker)); + except + FDictionaryNA := True; + end; +end; + +destructor TSynSpellCheck.Destroy; +var + Ed: TCustomSynEdit; +begin + GlobalInstance := nil; + if Assigned(FEditors) then + for Ed in FEditors do + Ed.RemoveFreeNotification(Self); + FEditors.Free; + FPlugins.Free; + FAttributesChecked.Free; + FWorkList.Free; + inherited; +end; + +procedure TSynSpellCheck.EndUpdate; +begin + Dec(FUpdateCount); + Changed; +end; + +function TSynSpellCheck.ErrorAtPos(BC: TBufferCoord): ISpellingError; +var + Indicator: TSynIndicator; +begin + if not Assigned(FEditor) then Exit; + + if not FEditor.Indicators.IndicatorAtPos(BC, SpellErrorIndicatorId, Indicator) then + Exit; + + Result := SpellCheckLine(FEditor, BC.Line, 0, MaxInt, BC.Char); +end; + +procedure TSynSpellCheck.Notification(AComponent: TComponent; + Operation: TOperation); +begin + if (AComponent is TCustomSynEdit) and (Operation = opRemove) then + RemoveEditor(TCustomSynEdit(AComponent)); + inherited; +end; + +function TSynSpellCheck.RemoveEditor(AEditor: TCustomSynEdit): Boolean; +var + Index: Integer; +begin + Index := FEditors.IndexOf(AEditor); + Result := Index >= 0; + + if Result then + begin + AEditor.RemoveFreeNotification(Self); + FEditors.Delete(Index); + FPlugins[Index].Free; + FPlugins.Delete(Index); + if FEditor = AEditor then + FEditor := nil; + end; +end; + +procedure TSynSpellCheck.SetAttributesChecked(const Value: TStrings); +begin + FAttributesChecked.Assign(Value); + Changed; +end; + +procedure TSynSpellCheck.SetCheckAsYouType(const Value: Boolean); +begin + if Value <> FCheckAsYouType then + begin + FCheckAsYouType := Value; + Changed; + end; +end; + +procedure TSynSpellCheck.SetEditor(const Value: TCustomSynEdit); +begin + if Value <> FEditor then + begin + FEditor := Value; + if Assigned(Value) then + AddEditor(Value); + end; +end; + +procedure TSynSpellCheck.SetLanguageCode(const Value: string); +begin + if FLanguageCode <> Value then + begin + FLanguageCode := Value; + FDictionaryNA := False; + if Assigned(FSpellChecker) then + CreateSpellChecker; + Changed; + end; +end; + +procedure TSynSpellCheck.SetPenColor(const Value: TColor); +begin + if FPenColor <> Value then + begin + FPenColor := Value; + Changed; + end; +end; + +procedure TSynSpellCheck.SetUnderlineStyle(const Value: TUnderlineStyle); +begin + if FUnderlineStyle <> Value then + begin + FUnderlineStyle := Value; + Changed; + end; +end; + +function TSynSpellCheck.SpellChecker: ISpellChecker; +begin + if FDictionaryNA then Exit(nil); + + if not Assigned(FSpellChecker) then + CreateSpellChecker; + Result := FSpellChecker; +end; + +class function TSynSpellCheck.SpellCheckFactory: ISpellCheckerFactory; +begin + // Windows 8 required + if not TOSVersion.Check(6, 2) then + Exit(nil); + + if not Assigned(FSpellCheckFactory) then + FSpellCheckFactory := CreateComObject(CLASS_SpellCheckerFactory) as ISpellCheckerFactory; + Result := FSpellCheckFactory; +end; + +function TSynSpellCheck.SpellCheckLine(Editor: TCustomSynEdit; Line: + Integer; StartChar:Integer = 0; EndChar: Integer = MaxInt; + ErrorPos: Integer = -1): ISpellingError; +{ The core spell checking function. Spells checks a whole or part of + a line. If ErrorPos > 0 then instead of adding indicators, it returns the + SpellingError at the ErrorPos + + Spell checking may cause repainting due to the appartment thread model + marshalling via the Windows message queue. Hence the use of the WorkList + to avoid messing up the highlighter scanning, which is not reentrant} + + procedure SpellCheckToken(const Token: string; TokenPos: Integer = 0); + var + SpellingErrors: IEnumSpellingError; + SpellingError: ISpellingError; + StartIndex, Len: LongWord; + begin + CheckOSError(SpellChecker.Check(PChar(Token), SpellingErrors)); + while SpellingErrors.Next(SpellingError) = S_OK do + begin + SpellingError.Get_StartIndex(StartIndex); + SpellingError.Get_Length(Len); + + if (Integer(StartIndex) + 1 < StartChar) then Continue; + if (Integer(StartIndex + Len) > EndChar) then Break; + + if ErrorPos < 0 then + Editor.Indicators.Add(Line, + TSynIndicator.Create(SpellErrorIndicatorId, + Integer(StartIndex) + TokenPos + 1, + Integer(StartIndex) + TokenPos + 1 + Integer(Len)), False) + else if InRange(ErrorPos - TokenPos, StartIndex + 1, StartIndex + Len) then + begin + Result := SpellingError; + Exit; + end; + end; + end; + +var + SLine, Token: string; + Attri: TSynHighlighterAttributes; + TokenPos: Integer; + WorkItem: TWorkItem; +begin + Result := nil; + if not Assigned(SpellChecker()) then Exit; + + SLine := Editor.Lines[Line - 1]; + if SLine = '' then Exit; + + if Assigned(Editor.Highlighter) and not (Editor.Highlighter is TSynUriSyn) then + begin + if Line > 1 then + Editor.Highlighter.SetRange(TSynEditStringList(Editor.Lines).Ranges[Line - 2]) + else + Editor.Highlighter.ResetRange; + Editor.Highlighter.SetLine(SLine, Line); + + FWorkList.Clear; + while not Editor.HighLighter.GetEol do + begin + TokenPos := Editor.HighLighter.GetTokenPos; //TokenPos is zero based + Token := Editor.HighLighter.GetToken; + + if TokenPos >= EndChar then Break; + if TokenPos + Token.Length < StartChar then Continue; + + Attri := Editor.HighLighter.GetTokenAttribute; + if (Token <> '') and (not Assigned(Attri) or + (FAttributesChecked.IndexOf(Attri.Name) >= 0)) + then + FWorkList.Add(TWorkItem.Create(Token,TokenPos)); + + Editor.HighLighter.Next; + end; + + for WorkItem in FWorkList do + begin + SpellCheckToken(WorkItem.Token, WorkItem.TokenPos); + + // Check if ErrorPos >= 0 and we found the error + if Assigned(Result) then Exit; + end; + end + else + SpellCheckToken(SLine); +end; + +class function TSynSpellCheck.SupportedLanguages: TArray; +var + Languages: IEnumString; + Lang: PChar; + Fetched: LongInt; +begin + SetLength(Result, 0); + if not Assigned(SpellCheckFactory()) then Exit; + + SpellCheckFactory.Get_SupportedLanguages(Languages); + while Languages.Next(1, Lang, @Fetched) = S_OK do + begin + Result := Result + [string(Lang)]; + CoTaskMemFree(Lang); + end; +end; + +{$ENDREGION 'TSynSpellCheck'} + + +{$REGION 'TSpellCheckPlugin Implementation'} + +procedure TSpellCheckPlugin.Changed(LangId: Boolean); +begin + if LangId then + Editor.Indicators.Clear(FSynSpellCheck.SpellErrorIndicatorId); + RegisterIndicatorSpec; + if Editor.HandleAllocated then + Editor.Invalidate; +end; + +constructor TSpellCheckPlugin.Create(AOwner: TCustomSynEdit); +begin + inherited; + FHandlers := [phLinesInserted, phLinePut]; +end; + +procedure TSpellCheckPlugin.LinePut(aIndex: Integer; const OldLine: string); +var + Line: string; + Len1, Len2: Integer; + StartingPos: Integer; +begin + if Editor <> FSynSpellCheck.Editor then Exit; // Chained editors + + if Assigned(FSynSpellCheck.SpellChecker()) and FSynSpellCheck.CheckAsYouType then + begin + Line := Editor.Lines[aIndex]; + LineDiff(Line, OldLine, StartingPos, Len1, Len2); + if (Len1 <> 0) or (Len2 <> 1) or not Editor.IsIdentChar(Line[StartingPos]) then + FSynSpellCheck.SpellCheckLine(Editor, aIndex + 1); + end; +end; + +procedure TSpellCheckPlugin.LinesInserted(FirstLine, Count: Integer); +var + Line: Integer; +begin + if Editor <> FSynSpellCheck.Editor then Exit; + + if Assigned(FSynSpellCheck.SpellChecker()) and FSynSpellCheck.CheckAsYouType then + for Line := FirstLine + 1 to FirstLine + Count do + FSynSpellCheck.SpellCheckLine(Editor, Line); +end; + +procedure TSpellCheckPlugin.RegisterIndicatorSpec; +var + Spec: TSynIndicatorSpec; +begin + if FSynSpellCheck.UnderlineStyle = usMicrosoftWord then + Spec.Style := sisSquiggleMicrosoftWord + else + Spec.Style := sisSquiggleWordPerfect; + Spec.Foreground := D2D1ColorF(FSynSpellCheck.PenColor); + + Editor.Indicators.RegisterSpec(FSynSpellCheck.SpellErrorIndicatorId, Spec); + if Editor.HandleAllocated then + Editor.Invalidate; +end; + +{$ENDREGION 'TSpellCheckPlugin'} + +{$REGION 'SpellCheck Actions implementation'} + +destructor TSynSpellCheckAction.Destroy; +begin + if Assigned(FControl) then + FControl.RemoveFreeNotification(Self); + inherited; +end; + +function TSynSpellCheckAction.GetControl(Target: TObject): TCustomSynEdit; +begin + { We could hard cast Target as a TCustomSynEdit since HandlesTarget "should" be + called before ExecuteTarget and UpdateTarget, however, we're being safe. } + Result := Target as TCustomSynEdit; +end; + +function TSynSpellCheckAction.HandlesTarget(Target: TObject): Boolean; +begin + Result := Assigned(TSynSpellCheck.GlobalInstance) and + (((Control <> nil) and (Target = Control) or + (Control = nil) and (Target is TCustomSynEdit)) + and TCustomSynEdit(Target).Focused); +end; + +procedure TSynSpellCheckAction.Notification(AComponent: TComponent; + Operation: TOperation); +begin + inherited Notification(AComponent, Operation); + if (Operation = opRemove) and (AComponent = Control) then Control := nil; +end; + +procedure TSynSpellCheckAction.SetControl(Value: TCustomSynEdit); +begin + if Value <> FControl then + begin + FControl := Value; + if Value <> nil then Value.FreeNotification(Self); + end; +end; + +procedure TSynSpellCheckAction.UpdateTarget(Target: TObject); +begin + Enabled := Assigned(TSynSpellCheck.GlobalInstance.SpellChecker()); +end; + +{ TSynSpellCheckFile } + +procedure TSynSpellCheckFile.ExecuteTarget(Target: TObject); +begin + TSynSpellCheck.GlobalInstance.Editor := GetControl(Target); + TSynSpellCheck.GlobalInstance.CheckFile; +end; + +{ TSynSpellCheckLine } + +procedure TSynSpellCheckLine.ExecuteTarget(Target: TObject); +begin + TSynSpellCheck.GlobalInstance.Editor := GetControl(Target); + TSynSpellCheck.GlobalInstance.CheckLine; +end; + +{ TSynSpellCheckSelection } + +procedure TSynSpellCheckSelection.ExecuteTarget(Target: TObject); +begin + TSynSpellCheck.GlobalInstance.Editor := GetControl(Target); + TSynSpellCheck.GlobalInstance.CheckSelection; +end; + +{ TSpellCheckWord } + +procedure TSynSpellCheckWord.ExecuteTarget(Target: TObject); +begin + TSynSpellCheck.GlobalInstance.Editor := GetControl(Target); + TSynSpellCheck.GlobalInstance.CheckWord; +end; + +{ TSpellClearErros } + +procedure TSynSpellClearErrors.ExecuteTarget(Target: TObject); +begin + TSynSpellCheck.GlobalInstance.Editor := GetControl(Target); + TSynSpellCheck.GlobalInstance.ClearErrors; +end; + +{ TSynSpellCheckAsYouType } + +procedure TSynSpellCheckAsYouType.ExecuteTarget(Target: TObject); +begin + TSynSpellCheck.GlobalInstance.CheckAsYouType := + not TSynSpellCheck.GlobalInstance.CheckAsYouType; +end; + +function TSynSpellCheckAsYouType.HandlesTarget(Target: TObject): Boolean; +begin + Result := True; +end; + +procedure TSynSpellCheckAsYouType.UpdateTarget(Target: TObject); +begin + Enabled := Assigned(TSynSpellCheck.GlobalInstance.SpellChecker()); + Checked := TSynSpellCheck.GlobalInstance.CheckAsYouType; +end; + +{ TSynSpellErrorAction } +procedure TSynSpellErrorAction.UpdateTarget(Target: TObject); +var + Ed: TCustomSynEdit; + Indicator: TSynIndicator; +begin + inherited; + if Enabled then + begin + Ed := TCustomSynEdit(Target); + Enabled := Ed.Indicators.IndicatorAtPos(Ed.CaretXY, Indicator) and + (Indicator.Id = TSynSpellCheck.SpellErrorIndicatorId); + end; +end; + +{ TSynSpellErrorAdd } + +procedure TSynSpellErrorAdd.ExecuteTarget(Target: TObject); +var + AWord: string; + Ed: TCustomSynEdit; + Indicator: TSynIndicator; +begin + Ed := TCustomSynEdit(Target); + if Ed.Indicators.IndicatorAtPos(Ed.CaretXY, Indicator) and + (Indicator.Id = TSynSpellCheck.SpellErrorIndicatorId) then + begin + Ed.Indicators.Clear(Ed.CaretY, Indicator); + AWord := Copy(Ed.Lines[Ed.CaretY - 1], Indicator.CharStart, + Indicator.CharEnd - Indicator.CharStart); + TSynSpellCheck.GlobalInstance.SpellChecker.Add(PChar(AWord)); + end; +end; + +{ TSynSpellErrorReplace } + +procedure TSynSpellErrorReplace.ExecuteTarget(Target: TObject); +var + Line: string; + Ed: TCustomSynEdit; + Indicator: TSynIndicator; +begin + Ed := TCustomSynEdit(Target); + if Ed.Indicators.IndicatorAtPos(Ed.CaretXY, Indicator) and + (Indicator.Id = TSynSpellCheck.SpellErrorIndicatorId) then + begin + Line := Ed.Lines[Ed.CaretY -1]; + Delete(Line, Indicator.CharStart, Indicator.CharEnd - Indicator.CharStart); + Insert(Caption, Line, Indicator.CharStart); + Ed.Lines[Ed.CaretY -1] := Line; + TSynSpellCheck.GlobalInstance.CheckLine; + + TSynSpellCheck.GlobalInstance.Editor := Ed; + TSynSpellCheck.GlobalInstance.CheckLine; + end; +end; + +{ TSynSpellErrorIgnoreOnce } + +procedure TSynSpellErrorIgnoreOnce.ExecuteTarget(Target: TObject); +var + Ed: TCustomSynEdit; + Indicator: TSynIndicator; +begin + Ed := TCustomSynEdit(Target); + if Ed.Indicators.IndicatorAtPos(Ed.CaretXY, Indicator) and + (Indicator.Id = TSynSpellCheck.SpellErrorIndicatorId) + then + Ed.Indicators.Clear(Ed.CaretY, Indicator); +end; + +{ TSynSpellErrorIgnore } + +procedure TSynSpellErrorIgnore.ExecuteTarget(Target: TObject); +var + AWord: string; + Ed: TCustomSynEdit; + Indicator: TSynIndicator; +begin + Ed := TCustomSynEdit(Target); + if Ed.Indicators.IndicatorAtPos(Ed.CaretXY, Indicator) and + (Indicator.Id = TSynSpellCheck.SpellErrorIndicatorId) then + begin + Ed.Indicators.Clear(Ed.CaretY, Indicator); + AWord := Copy(Ed.Lines[Ed.CaretY - 1], Indicator.CharStart, + Indicator.CharEnd - Indicator.CharStart); + TSynSpellCheck.GlobalInstance.SpellChecker.Ignore(PChar(AWord)); + end; +end; + +{ TSynSpellErrorDelete } + +procedure TSynSpellErrorDelete.ExecuteTarget(Target: TObject); +var + Ed: TCustomSynEdit; + Indicator: TSynIndicator; + Line: string; +begin + Ed := TCustomSynEdit(Target); + if Ed.Indicators.IndicatorAtPos(Ed.CaretXY, Indicator) and + (Indicator.Id = TSynSpellCheck.SpellErrorIndicatorId) then + begin + Line := Ed.Lines[Ed.CaretY -1]; + Delete(Line, Indicator.CharStart, Indicator.CharEnd - Indicator.CharStart + 1); + Ed.Lines[Ed.CaretY -1] := Line; + + TSynSpellCheck.GlobalInstance.Editor := Ed; + TSynSpellCheck.GlobalInstance.CheckLine; + end; +end; + +{$ENDREGION 'SpellCheck Actions implementation'} + +{ TSynSpellCheck.TWorkItem } + +constructor TSynSpellCheck.TWorkItem.Create(AToken: string; ATokenPos: Integer); +begin + Self.Token := AToken; + Self.TokenPos := ATokenPos; +end; + +end. diff --git a/Ext/SynEdit/Source/SynTextDrawer.pas b/Ext/SynEdit/Source/SynTextDrawer.pas deleted file mode 100644 index aba3fe3..0000000 --- a/Ext/SynEdit/Source/SynTextDrawer.pas +++ /dev/null @@ -1,1043 +0,0 @@ -{============================================================================== - Content: TSynTextDrawer, a helper class for drawing of - fixed-pitched font characters - ============================================================================== - The contents of this file are subject to the Mozilla Public License Ver. 1.0 - (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 HANAI Tohru's private delphi library. - ============================================================================== - The Initial Developer of the Original Code is HANAI Tohru (Japan) - Portions created by HANAI Tohru are Copyright (C) 1999. - All Rights Reserved. - ============================================================================== - Contributor(s): HANAI Tohru - Unicode translation by Maël Hörz. - ============================================================================== - History: 01/19/1999 HANAI Tohru - Initial Version - 02/13/1999 HANAI Tohru - Changed default intercharacter spacing - 09/09/1999 HANAI Tohru - Redesigned all. Simplified interfaces. - When drawing text now it uses TextOut + SetTextCharacter- - Extra insted ExtTextOut since ExtTextOut has a little - heavy behavior. - 09/10/1999 HANAI Tohru - Added code to call ExtTextOut because there is a problem - when TextOut called with italicized raster type font. - After this changing, ExtTextOut is called without the - last parameter `lpDx' and be with SetTextCharacterExtra. - This pair performs faster than with `lpDx'. - 09/14/1999 HANAI Tohru - Changed code for saving/restoring DC - 09/15/1999 HANAI Tohru - Added X/Y parameters to ExtTextOut. - 09/16/1999 HANAI Tohru - Redesigned for multi-bytes character drawing. - 09/19/1999 HANAI Tohru - Since TSynTextDrawer grew fat it was split into three - classes - TSynFontStock, TSynTextDrawer and TheTextDrawerEx. - Currently it should avoid TSynTextDrawer because it is - slower than TSynTextDrawer. - 09/25/1999 HANAI Tohru - Added internally definition of LeadBytes for Delphi 2 - 10/01/1999 HANAI Tohru - To save font resources, now all fonts data are shared - among all of TSynFontStock instances. With this changing, - there added a new class `TSynFontsInfoManager' to manage - those shared data. - 10/09/1999 HANAI Tohru - Added BaseStyle property to TheFontFont class. - ==============================================================================} - -// $Id: SynTextDrawer.pas,v 1.6.2.17 2008/09/17 13:59:12 maelh Exp $ - -// SynEdit note: The name had to be changed to get SynEdit to install -// together with mwEdit into the same Delphi installation - -unit SynTextDrawer; - -{$I SynEdit.inc} - -interface - -uses - {$IFDEF SYN_COMPILER_17_UP} - Types, UITypes, - {$ENDIF} - SynUnicode, - SynEditTypes, - SysUtils, - Classes, - Windows, - Graphics; - -const - FontStyleCount = Ord(High(TFontStyle)) + 1; - FontStyleCombineCount = (1 shl FontStyleCount); - -type - PIntegerArray = ^TIntegerArray; - TIntegerArray = array[0..MaxInt div SizeOf(Integer) - 1] of Integer; - - TSynStockFontPatterns = 0..FontStyleCombineCount - 1; - - PSynFontData = ^TSynFontData; - TSynFontData = record - Style: TFontStyles; - Handle: HFont; - CharAdv: Integer; - CharHeight: Integer; - end; - - PSynFontsData = ^TSynFontsData; - TSynFontsData = array[TSynStockFontPatterns] of TSynFontData; - - PSynSharedFontsInfo = ^TSynSharedFontsInfo; - TSynSharedFontsInfo = record - // reference counters - RefCount: Integer; - LockCount: Integer; - // font information - BaseFont: TFont; - BaseLF: TLogFont; - IsTrueType: Boolean; - FontsData: TSynFontsData; - end; - - { TSynStockFontManager } - - TSynFontsInfoManager = class - private - FFontsInfo: TList; - function FindFontsInfo(const LF: TLogFont): PSynSharedFontsInfo; - function CreateFontsInfo(ABaseFont: TFont; - const LF: TLogFont): PSynSharedFontsInfo; - procedure DestroyFontHandles(pFontsInfo: PSynSharedFontsInfo); - procedure RetrieveLogFontForComparison(ABaseFont: TFont; var LF: TLogFont); - public - constructor Create; - destructor Destroy; override; - - procedure LockFontsInfo(pFontsInfo: PSynSharedFontsInfo); - procedure UnLockFontsInfo(pFontsInfo: PSynSharedFontsInfo); - function GetFontsInfo(ABaseFont: TFont): PSynSharedFontsInfo; - procedure ReleaseFontsInfo(pFontsInfo: PSynSharedFontsInfo); - end; - - { TSynFontStock } - - TTextOutOptions = set of (tooOpaque, tooClipped); - - TSynExtTextOutProc = procedure (X, Y: Integer; fuOptions: TTextOutOptions; - const ARect: TRect; const Text: UnicodeString; Length: Integer) of object; - - ESynFontStockException = class(ESynError); - - TSynFontStock = class - private - // Private DC - FDC: HDC; - FDCRefCount: Integer; - - // Shared fonts - FpInfo: PSynSharedFontsInfo; - FUsingFontHandles: Boolean; - - // Current font - FCrntFont: HFONT; - FCrntStyle: TFontStyles; - FpCrntFontData: PSynFontData; - - // Local font info - FBaseLF: TLogFont; - function GetBaseFont: TFont; - function GetIsTrueType: Boolean; - protected - function InternalGetDC: HDC; virtual; - procedure InternalReleaseDC(Value: HDC); virtual; - function InternalCreateFont(Style: TFontStyles): HFONT; virtual; - function CalcFontAdvance(DC: HDC; pCharHeight: PInteger): Integer; virtual; - function GetCharAdvance: Integer; virtual; - function GetCharHeight: Integer; virtual; - function GetFontData(idx: Integer): PSynFontData; virtual; - procedure UseFontHandles; - procedure ReleaseFontsInfo; - procedure SetBaseFont(Value: TFont); virtual; - procedure SetStyle(Value: TFontStyles); virtual; - - property FontData[idx: Integer]: PSynFontData read GetFontData; - property FontsInfo: PSynSharedFontsInfo read FpInfo; - public - constructor Create(InitialFont: TFont); virtual; - destructor Destroy; override; - - procedure ReleaseFontHandles; virtual; - - property BaseFont: TFont read GetBaseFont; - property Style: TFontStyles read FCrntStyle write SetStyle; - property FontHandle: HFONT read FCrntFont; - property CharAdvance: Integer read GetCharAdvance; - property CharHeight: Integer read GetCharHeight; - property IsTrueType: Boolean read GetIsTrueType; - end; - - { TSynTextDrawer } - ESynTextDrawerException = class(ESynError); - - TSynTextDrawer = class(TObject) - private - FDC: HDC; - FSaveDC: Integer; - - // Font information - FFontStock: TSynFontStock; - FStockBitmap: TBitmap; - FCalcExtentBaseStyle: TFontStyles; - FBaseCharWidth: Integer; - FBaseCharHeight: Integer; - - // Current font and properties - FCrntFont: HFONT; - FETODist: PIntegerArray; - - // Current font attributes - FColor: TColor; - FBkColor: TColor; - FCharExtra: Integer; - - // Begin/EndDrawing calling count - FDrawingCount: Integer; - - // GetCharABCWidthsW cache - FCharABCWidthCache: array [0..127] of TABC; - FCharWidthCache: array [0..127] of Integer; - protected - procedure ReleaseETODist; virtual; - procedure AfterStyleSet; virtual; - procedure DoSetCharExtra(Value: Integer); virtual; - procedure FlushCharABCWidthCache; - function GetCachedABCWidth(c : Cardinal; var abc : TABC) : Boolean; - - property StockDC: HDC read FDC; - property DrawingCount: Integer read FDrawingCount; - property FontStock: TSynFontStock read FFontStock; - property BaseCharWidth: Integer read FBaseCharWidth; - property BaseCharHeight: Integer read FBaseCharHeight; - public - constructor Create(CalcExtentBaseStyle: TFontStyles; BaseFont: TFont); virtual; - destructor Destroy; override; - - function GetCharWidth: Integer; virtual; - function GetCharHeight: Integer; virtual; - - procedure BeginDrawing(DC: HDC); virtual; - procedure EndDrawing; virtual; - - procedure TextOut(X, Y: Integer; Text: PWideChar; Length: Integer); virtual; - procedure ExtTextOut(X, Y: Integer; Options: TTextOutOptions; ARect: TRect; - Text: PWideChar; Length: Integer); virtual; - function TextExtent(const Text: UnicodeString): TSize; overload; - function TextExtent(Text: PWideChar; Count: Integer): TSize; overload; - function TextWidth(const Char: WideChar): Integer; overload; - function TextWidth(const Text: UnicodeString): Integer; overload; - function TextWidth(Text: PWideChar; Count: Integer): Integer; overload; - procedure SetBaseFont(Value: TFont); virtual; - procedure SetBaseStyle(const Value: TFontStyles); virtual; - procedure SetStyle(Value: TFontStyles); virtual; - procedure SetForeColor(Value: TColor); virtual; - procedure SetBackColor(Value: TColor); virtual; - procedure SetCharExtra(Value: Integer); virtual; - procedure ReleaseTemporaryResources; virtual; - - property CharWidth: Integer read GetCharWidth; - property CharHeight: Integer read GetCharHeight; - property BaseFont: TFont write SetBaseFont; - property BaseStyle: TFontStyles write SetBaseStyle; - property ForeColor: TColor write SetForeColor; - property BackColor: TColor write SetBackColor; - property Style: TFontStyles write SetStyle; - property CharExtra: Integer read FCharExtra write SetCharExtra; - end; - -function GetFontsInfoManager: TSynFontsInfoManager; - -function UniversalExtTextOut(DC: HDC; X, Y: Integer; Options: TTextOutOptions; - Rect: TRect; Str: PWideChar; Count: Integer; ETODist: PIntegerArray): Boolean; - -implementation - -uses - Math -{$IFDEF SYN_UNISCRIBE} - , SynUsp10 -{$ENDIF} - ; - -var - GFontsInfoManager: TSynFontsInfoManager; - -{ utility routines } - -function GetFontsInfoManager: TSynFontsInfoManager; -begin - if not Assigned(GFontsInfoManager) then - GFontsInfoManager := TSynFontsInfoManager.Create; - Result := GFontsInfoManager; -end; - -// UniversalExtTextOut uses UniScribe where available for the best possible -// output quality. This also avoids a bug in (Ext)TextOut that surfaces when -// displaying a combination of Chinese and Korean text. -// -// See here for details: http://groups.google.com/group/microsoft.public.win32.programmer.international/browse_thread/thread/77cd596f2b96dc76/146300208098285c?lnk=st&q=font+substitution+problem#146300208098285c -function UniversalExtTextOut(DC: HDC; X, Y: Integer; Options: TTextOutOptions; - Rect: TRect; Str: PWideChar; Count: Integer; ETODist: PIntegerArray): Boolean; -{$IFDEF SYN_UNISCRIBE} -const - SSAnalyseFlags = SSA_GLYPHS or SSA_FALLBACK or SSA_LINK; - SpaceString: UnicodeString = ' '; -{$ENDIF} -var - TextOutFlags: DWORD; -{$IFDEF SYN_UNISCRIBE} - GlyphBufferSize: Integer; - saa: TScriptStringAnalysis; -{$ENDIF} -begin - TextOutFlags := 0; - if tooOpaque in Options then - TextOutFlags := TextOutFlags or ETO_OPAQUE; - if tooClipped in Options then - TextOutFlags := TextOutFlags or ETO_CLIPPED; - -{$IFDEF SYN_UNISCRIBE} - if Usp10IsInstalled then - begin - // UniScribe requires that the string contains at least one character. - // If UniversalExtTextOut should be used to fill the background we can just - // pass a string made of a space. - if Count <= 0 then - if tooOpaque in Options then - begin - // Clipping is necessary, since depending on X, Y the space will be - // printed outside Rect and potentially fill more than we want. - TextOutFlags := TextOutFlags or ETO_CLIPPED; - Str := PWideChar(SpaceString); - Count := 1; - end - else - begin - Result := False; - Exit; - end; - - // According to the MS Windows SDK (1.5 * Count + 16) is the recommended - // value for GlyphBufferSize (see documentation of cGlyphs parameter of - // ScriptStringAnalyse function) - GlyphBufferSize := (3 * Count) div 2 + 16; - - Result := Succeeded(ScriptStringAnalyse(DC, Str, Count, GlyphBufferSize, -1, - SSAnalyseFlags, 0, nil, nil, Pointer(ETODist), nil, nil, @saa)); - Result := Result and Succeeded(ScriptStringOut(saa, X, Y, TextOutFlags, - @Rect, 0, 0, False)); - Result := Result and Succeeded(ScriptStringFree(@saa)); - end - else -{$ENDIF} - begin - Result := ExtTextOutW(DC, X, Y, TextOutFlags, @Rect, Str, Count, - Pointer(ETODist)); - end; -end; - -{ TSynFontsInfoManager } - -procedure TSynFontsInfoManager.LockFontsInfo( - pFontsInfo: PSynSharedFontsInfo); -begin - Inc(pFontsInfo^.LockCount); -end; - -constructor TSynFontsInfoManager.Create; -begin - inherited; - - FFontsInfo := TList.Create; -end; - -function TSynFontsInfoManager.CreateFontsInfo(ABaseFont: TFont; - const LF: TLogFont): PSynSharedFontsInfo; -begin - New(Result); - FillChar(Result^, SizeOf(TSynSharedFontsInfo), 0); - with Result^ do - try - BaseFont := TFont.Create; - BaseFont.Assign(ABaseFont); - BaseLF := LF; - IsTrueType := (0 <> (TRUETYPE_FONTTYPE and LF.lfPitchAndFamily)); - except - Result^.BaseFont.Free; - Dispose(Result); - raise; - end; -end; - -procedure TSynFontsInfoManager.UnlockFontsInfo( - pFontsInfo: PSynSharedFontsInfo); -begin - with pFontsInfo^ do - begin - Dec(LockCount); - if 0 = LockCount then - DestroyFontHandles(pFontsInfo); - end; -end; - -destructor TSynFontsInfoManager.Destroy; -begin - GFontsInfoManager := nil; - - if Assigned(FFontsInfo) then - begin - while FFontsInfo.Count > 0 do - begin - Assert(1 = PSynSharedFontsInfo(FFontsInfo[FFontsInfo.Count - 1])^.RefCount); - ReleaseFontsInfo(PSynSharedFontsInfo(FFontsInfo[FFontsInfo.Count - 1])); - end; - FFontsInfo.Free; - end; - - inherited; -end; - -procedure TSynFontsInfoManager.DestroyFontHandles( - pFontsInfo: PSynSharedFontsInfo); -var - i: Integer; -begin - with pFontsInfo^ do - for i := Low(TSynStockFontPatterns) to High(TSynStockFontPatterns) do - with FontsData[i] do - if Handle <> 0 then - begin - DeleteObject(Handle); - Handle := 0; - end; -end; - -function TSynFontsInfoManager.FindFontsInfo( - const LF: TLogFont): PSynSharedFontsInfo; -var - i: Integer; -begin - for i := 0 to FFontsInfo.Count - 1 do - begin - Result := PSynSharedFontsInfo(FFontsInfo[i]); - if CompareMem(@(Result^.BaseLF), @LF, SizeOf(TLogFont)) then - Exit; - end; - Result := nil; -end; - -function TSynFontsInfoManager.GetFontsInfo(ABaseFont: TFont): PSynSharedFontsInfo; -var - LF: TLogFont; -begin - Assert(Assigned(ABaseFont)); - - RetrieveLogFontForComparison(ABaseFont, LF); - Result := FindFontsInfo(LF); - if not Assigned(Result) then - begin - Result := CreateFontsInfo(ABaseFont, LF); - FFontsInfo.Add(Result); - end; - - if Assigned(Result) then - Inc(Result^.RefCount); -end; - -procedure TSynFontsInfoManager.ReleaseFontsInfo(pFontsInfo: PSynSharedFontsInfo); -begin - Assert(Assigned(pFontsInfo)); - - with pFontsInfo^ do - begin - Assert(LockCount < RefCount, 'Call DeactivateFontsInfo before calling this.'); - if RefCount > 1 then - Dec(RefCount) - else - begin - FFontsInfo.Remove(pFontsInfo); - // free all objects - BaseFont.Free; - Dispose(pFontsInfo); - end; - end; -end; - -procedure TSynFontsInfoManager.RetrieveLogFontForComparison(ABaseFont: TFont; - var LF: TLogFont); -var - pEnd: PChar; -begin - GetObject(ABaseFont.Handle, SizeOf(TLogFont), @LF); - with LF do - begin - lfItalic := 0; - lfUnderline := 0; - lfStrikeOut := 0; - pEnd := StrEnd(lfFaceName); - FillChar(pEnd[1], @lfFaceName[High(lfFaceName)] - pEnd, 0); - end; -end; - -{ TSynFontStock } - -// CalcFontAdvance : Calculation a advance of a character of a font. -// [*]hCalcFont will be selected as FDC's font if FDC wouldn't be zero. -function TSynFontStock.CalcFontAdvance(DC: HDC; pCharHeight: PInteger): Integer; -var - TM: TTextMetric; - ABC: TABC; - HasABC: Boolean; -begin - // Calculate advance of a character. - // The following code uses ABC widths instead TextMetric.tmAveCharWidth - // because ABC widths always tells truth but tmAveCharWidth does not. - // A true-type font will have ABC widths but others like raster type will not - // so if the function fails then use TextMetric.tmAveCharWidth. - GetTextMetrics(DC, TM); - HasABC := GetCharABCWidths(DC, Ord('M'), Ord('M'), ABC); - if not HasABC then - begin - with ABC do - begin - abcA := 0; - abcB := TM.tmAveCharWidth; - abcC := 0; - end; - TM.tmOverhang := 0; - end; - - // Result(CharWidth) - with ABC do - Result := abcA + Integer(abcB) + abcC + TM.tmOverhang; - // pCharHeight - if Assigned(pCharHeight) then - pCharHeight^ := Abs(TM.tmHeight) {+ TM.tmInternalLeading}; -end; - -constructor TSynFontStock.Create(InitialFont: TFont); -begin - inherited Create; - - SetBaseFont(InitialFont); -end; - -destructor TSynFontStock.Destroy; -begin - ReleaseFontsInfo; - Assert(FDCRefCount = 0); - - inherited; -end; - -function TSynFontStock.GetBaseFont: TFont; -begin - Result := FpInfo^.BaseFont; -end; - -function TSynFontStock.GetCharAdvance: Integer; -begin - Result := FpCrntFontData^.CharAdv; -end; - -function TSynFontStock.GetCharHeight: Integer; -begin - Result := FpCrntFontData^.CharHeight; -end; - -function TSynFontStock.GetFontData(idx: Integer): PSynFontData; -begin - Result := @FpInfo^.FontsData[idx]; -end; - -function TSynFontStock.GetIsTrueType: Boolean; -begin - Result := FpInfo^.IsTrueType -end; - -function TSynFontStock.InternalCreateFont(Style: TFontStyles): HFONT; -const - Bolds: array[Boolean] of Integer = (400, 700); -begin - with FBaseLF do - begin - lfWeight := Bolds[fsBold in Style]; - lfItalic := Ord(BOOL(fsItalic in Style)); - lfUnderline := Ord(BOOL(fsUnderline in Style)); - lfStrikeOut := Ord(BOOL(fsStrikeOut in Style)); - end; - Result := CreateFontIndirect(FBaseLF); -end; - -function TSynFontStock.InternalGetDC: HDC; -begin - if FDCRefCount = 0 then - begin - Assert(FDC = 0); - FDC := GetDC(0); - end; - Inc(FDCRefCount); - Result := FDC; -end; - -procedure TSynFontStock.InternalReleaseDC(Value: HDC); -begin - Dec(FDCRefCount); - if FDCRefCount <= 0 then - begin - Assert((FDC <> 0) and (FDC = Value)); - ReleaseDC(0, FDC); - FDC := 0; - Assert(FDCRefCount = 0); - end; -end; - -procedure TSynFontStock.ReleaseFontHandles; -begin - if FUsingFontHandles then - with GetFontsInfoManager do - begin - UnlockFontsInfo(FpInfo); - FUsingFontHandles := False; - end; -end; - -procedure TSynFontStock.ReleaseFontsInfo; -begin - if Assigned(FpInfo) then - with GetFontsInfoManager do - begin - if FUsingFontHandles then - begin - UnlockFontsInfo(FpInfo); - FUsingFontHandles := False; - end; - ReleaseFontsInfo(FpInfo); - FpInfo := nil; - end; -end; - -procedure TSynFontStock.SetBaseFont(Value: TFont); -var - pInfo: PSynSharedFontsInfo; -begin - if Assigned(Value) then - begin - pInfo := GetFontsInfoManager.GetFontsInfo(Value); - if pInfo = FpInfo then - GetFontsInfoManager.ReleaseFontsInfo(pInfo) - else - begin - ReleaseFontsInfo; - FpInfo := pInfo; - FBaseLF := FpInfo^.BaseLF; - SetStyle(Value.Style); - end; - end - else - raise ESynFontStockException.Create('SetBaseFont: ''Value'' must be specified.'); -end; - -procedure TSynFontStock.SetStyle(Value: TFontStyles); -var - idx: Integer; - DC: HDC; - hOldFont: HFONT; - p: PSynFontData; -begin - Assert(SizeOf(TFontStyles) = 1, - 'TheTextDrawer.SetStyle: There''s more than four font styles but the current '+ - 'code expects only four styles.'); - - idx := Byte(Value); - Assert(idx <= High(TSynStockFontPatterns)); - - UseFontHandles; - p := FontData[idx]; - if FpCrntFontData = p then - Exit; - - FpCrntFontData := p; - with p^ do - if Handle <> 0 then - begin - FCrntFont := Handle; - FCrntStyle := Style; - Exit; - end; - - // create font - FCrntFont := InternalCreateFont(Value); - DC := InternalGetDC; - hOldFont := SelectObject(DC, FCrntFont); - - // retrieve height and advances of new font - with FpCrntFontData^ do - begin - Handle := FCrntFont; - CharAdv := CalcFontAdvance(DC, @CharHeight); - end; - - SelectObject(DC, hOldFont); - InternalReleaseDC(DC); -end; - -procedure TSynFontStock.UseFontHandles; -begin - if not FUsingFontHandles then - with GetFontsInfoManager do - begin - LockFontsInfo(FpInfo); - FUsingFontHandles := True; - end; -end; - -{ TSynTextDrawer } - -constructor TSynTextDrawer.Create(CalcExtentBaseStyle: TFontStyles; BaseFont: TFont); -begin - inherited Create; - - FFontStock := TSynFontStock.Create(BaseFont); - FStockBitmap := TBitmap.Create; - FCalcExtentBaseStyle := CalcExtentBaseStyle; - SetBaseFont(BaseFont); - FColor := clWindowText; - FBkColor := clWindow; -end; - -destructor TSynTextDrawer.Destroy; -begin - FStockBitmap.Free; - FFontStock.Free; - ReleaseETODist; - - inherited; -end; - -procedure TSynTextDrawer.ReleaseETODist; -begin - if Assigned(FETODist) then - begin - FreeMem(FETODist); - FETODist := nil; - end; -end; - -procedure TSynTextDrawer.BeginDrawing(DC: HDC); -begin - if (FDC = DC) then - Assert(FDC <> 0) - else - begin - Assert((FDC = 0) and (DC <> 0) and (FDrawingCount = 0)); - FDC := DC; - FSaveDC := SaveDC(DC); - SelectObject(DC, FCrntFont); - Windows.SetTextColor(DC, ColorToRGB(FColor)); - Windows.SetBkColor(DC, ColorToRGB(FBkColor)); - DoSetCharExtra(FCharExtra); - end; - Inc(FDrawingCount); -end; - -procedure TSynTextDrawer.EndDrawing; -begin - Assert(FDrawingCount >= 1); - Dec(FDrawingCount); - if FDrawingCount <= 0 then - begin - if FDC <> 0 then - RestoreDC(FDC, FSaveDC); - FSaveDC := 0; - FDC := 0; - FDrawingCount := 0; - end; -end; - -function TSynTextDrawer.GetCharWidth: Integer; -begin - Result := FBaseCharWidth + FCharExtra; -end; - -function TSynTextDrawer.GetCharHeight: Integer; -begin - Result := FBaseCharHeight; -end; - -procedure TSynTextDrawer.SetBaseFont(Value: TFont); -begin - if Assigned(Value) then - begin - FlushCharABCWidthCache; - ReleaseETODist; - FStockBitmap.Canvas.Font.Assign(Value); - FStockBitmap.Canvas.Font.Style := []; - with FFontStock do - begin - SetBaseFont(Value); - Style := FCalcExtentBaseStyle; - FBaseCharWidth := CharAdvance; - FBaseCharHeight := CharHeight; - end; - SetStyle(Value.Style); - end - else - raise ESynTextDrawerException.Create('SetBaseFont: ''Value'' must be specified.'); -end; - -procedure TSynTextDrawer.SetBaseStyle(const Value: TFontStyles); -begin - if FCalcExtentBaseStyle <> Value then - begin - FCalcExtentBaseStyle := Value; - FlushCharABCWidthCache; - ReleaseETODist; - with FFontStock do - begin - Style := Value; - FBaseCharWidth := CharAdvance; - FBaseCharHeight := CharHeight; - end; - end; -end; - -procedure TSynTextDrawer.SetStyle(Value: TFontStyles); -begin - with FFontStock do - begin - SetStyle(Value); - Self.FCrntFont := FontHandle; - end; - AfterStyleSet; -end; - -procedure TSynTextDrawer.AfterStyleSet; -begin - if FDC <> 0 then - SelectObject(FDC, FCrntFont); -end; - -procedure TSynTextDrawer.SetForeColor(Value: TColor); -begin - if FColor <> Value then - begin - FColor := Value; - if FDC <> 0 then - SetTextColor(FDC, ColorToRGB(Value)); - end; -end; - -procedure TSynTextDrawer.SetBackColor(Value: TColor); -begin - if FBkColor <> Value then - begin - FBkColor := Value; - if FDC <> 0 then - Windows.SetBkColor(FDC, ColorToRGB(Value)); - end; -end; - -procedure TSynTextDrawer.SetCharExtra(Value: Integer); -begin - if FCharExtra <> Value then - begin - FCharExtra := Value; - DoSetCharExtra(FCharExtra); - end; -end; - -procedure TSynTextDrawer.DoSetCharExtra(Value: Integer); -begin - if FDC <> 0 then - SetTextCharacterExtra(FDC, Value); -end; - -procedure TSynTextDrawer.FlushCharABCWidthCache; -begin - FillChar(FCharABCWidthCache, SizeOf(TABC) * Length(FCharABCWidthCache), 0); - FillChar(FCharWidthCache, SizeOf(Integer) * Length(FCharWidthCache), 0); -end; - -function TSynTextDrawer.GetCachedABCWidth(c: Cardinal; var abc: TABC) : Boolean; -begin - if c > High(FCharABCWidthCache) then - begin - Result := GetCharABCWidthsW(FDC, c, c, abc); - Exit; - end; - abc := FCharABCWidthCache[c]; - if (abc.abcA or Integer(abc.abcB) or abc.abcC) = 0 then - begin - Result := GetCharABCWidthsW(FDC, c, c, abc); - if Result then - FCharABCWidthCache[c] := abc; - end - else - Result := True; -end; - -procedure TSynTextDrawer.TextOut(X, Y: Integer; Text: PWideChar; - Length: Integer); -var - r: TRect; -begin - r := Rect(X, Y, X, Y); - UniversalExtTextOut(FDC, X, Y, [], r, Text, Length, nil); -end; - -procedure TSynTextDrawer.ExtTextOut(X, Y: Integer; Options: TTextOutOptions; - ARect: TRect; Text: PWideChar; Length: Integer); - - procedure InitETODist(CharWidth: Integer); - var - Size: TSize; - i: Integer; - begin - ReallocMem(FETODist, Length * SizeOf(Integer)); - for i := 0 to Length - 1 do - begin - Size := TextExtent(PWideChar(@Text[i]), 1); - if Size.cx <> CharWidth then - FETODist[i] := Ceil(Size.cx / CharWidth) * CharWidth - else FETODist[i] := CharWidth; - end; - end; - - procedure AdjustLastCharWidthAndRect; - var - LastChar: Cardinal; - RealCharWidth, CharWidth: Integer; - CharInfo: TABC; - tm: TTextMetricA; - begin - if Length <= 0 then Exit; - - LastChar := Ord(Text[Length - 1]); - CharWidth := FETODist[Length - 1]; - RealCharWidth := CharWidth; - if Win32PlatformIsUnicode then - begin - if GetCachedABCWidth(LastChar, CharInfo) then - begin - RealCharWidth := CharInfo.abcA + Integer(CharInfo.abcB); - if CharInfo.abcC >= 0 then - Inc(RealCharWidth, CharInfo.abcC); - end - else if LastChar < Ord(High(AnsiChar)) then - begin - GetTextMetricsA(FDC, tm); - RealCharWidth := tm.tmAveCharWidth + tm.tmOverhang; - end; - end - else if WideChar(LastChar) <= High(AnsiChar) then - begin - if GetCharABCWidthsA(FDC, LastChar, LastChar, CharInfo) then - begin - RealCharWidth := CharInfo.abcA + Integer(CharInfo.abcB); - if CharInfo.abcC >= 0 then - Inc(RealCharWidth, CharInfo.abcC); - end - else if LastChar < Ord(High(AnsiChar)) then - begin - GetTextMetricsA(FDC, tm); - RealCharWidth := tm.tmAveCharWidth + tm.tmOverhang; - end; - end; - if RealCharWidth > CharWidth then - Inc(ARect.Right, RealCharWidth - CharWidth); - FETODist[Length - 1] := Max(RealCharWidth, CharWidth); - end; - -begin - InitETODist(GetCharWidth); - AdjustLastCharWidthAndRect; - UniversalExtTextOut(FDC, X, Y, Options, ARect, Text, Length, FETODist); -end; - -procedure TSynTextDrawer.ReleaseTemporaryResources; -begin - FFontStock.ReleaseFontHandles; -end; - -function TSynTextDrawer.TextExtent(const Text: UnicodeString): TSize; -begin - Result := SynUnicode.TextExtent(FStockBitmap.Canvas, Text); -end; - -function TSynTextDrawer.TextExtent(Text: PWideChar; Count: Integer): TSize; -begin - Result := SynUnicode.GetTextSize(FStockBitmap.Canvas.Handle, Text, Count); -end; - -function TSynTextDrawer.TextWidth(const Char: WideChar): Integer; -var - c: Cardinal; -begin - c := Ord(Char); - if c <= High(FCharWidthCache) then - begin - Result := FCharWidthCache[c]; - if Result = 0 then - begin - Result := SynUnicode.TextExtent(FStockBitmap.Canvas, Char).cX; - FCharWidthCache[c] := Result; - end; - end - else - Result := SynUnicode.TextExtent(FStockBitmap.Canvas, Char).cX; -end; - -function TSynTextDrawer.TextWidth(const Text: UnicodeString): Integer; -var - c: Cardinal; -begin - if Length(Text) = 1 then - begin - c := Ord(Text[1]); - if c <= High(FCharWidthCache) then - begin - Result := FCharWidthCache[c]; - if Result = 0 then - begin - Result := SynUnicode.TextExtent(FStockBitmap.Canvas, Text).cX; - FCharWidthCache[c] := Result; - end; - Exit; - end; - end; - Result := SynUnicode.TextExtent(FStockBitmap.Canvas, Text).cX; -end; - -function TSynTextDrawer.TextWidth(Text: PWideChar; Count: Integer): Integer; -begin - Result := SynUnicode.GetTextSize(FStockBitmap.Canvas.Handle, Text, Count).cX; -end; - -initialization - -finalization - GFontsInfoManager.Free; - -end. diff --git a/Ext/SynEdit/Source/SynURIOpener.pas b/Ext/SynEdit/Source/SynURIOpener.pas index 0567dad..12eae46 100644 --- a/Ext/SynEdit/Source/SynURIOpener.pas +++ b/Ext/SynEdit/Source/SynURIOpener.pas @@ -40,20 +40,14 @@ http://www.mh-net.de.vu } -{$IFNDEF QSYNURIOPENER} unit SynURIOpener; -{$ENDIF} {$I SynEdit.inc} interface uses - {$IFDEF SYN_LINUX} - Xlib, - {$ELSE} Windows, - {$ENDIF} Controls, SynEditTypes, SynEdit, @@ -72,17 +66,6 @@ TSynURIOpener = class(TComponent) FURIHighlighter: TSynURISyn; FVisitedURIs: TStringList; - {$IFDEF SYN_LINUX} - FFtpClientCmd: string; - FGopherClientCmd: string; - FMailClientCmd: string; - FNewsClientCmd: string; - FNntpClientCmd: string; - FProsperoClientCmd: string; - FTelnetClientCmd: string; - FWaisClientCmd: string; - FWebBrowserCmd: string; - {$ENDIF} procedure OpenLink(URI: string; LinkType: Integer); function MouseInSynEdit: Boolean; protected @@ -102,44 +85,20 @@ TSynURIOpener = class(TComponent) public constructor Create(AOwner: TComponent); override; destructor Destroy; override; - function VisitedURI(URI: UnicodeString): Boolean; + function VisitedURI(URI: string): Boolean; published property CtrlActivatesLinks: Boolean read FCtrlActivatesLinks write FCtrlActivatesLinks default True; property Editor: TCustomSynEdit read FEditor write SetEditor; property URIHighlighter: TSynURISyn read FURIHighlighter write SetURIHighlighter; - {$IFDEF SYN_LINUX} - // examples how to set WebBrowserCmd; %s is the placeholder for the URI - // 'kfmclient openURL %s' - // 'mozilla %s' - // 'netscape %s' - // 'kfmclient exec %s' similar to Windows ShellExecute - // - // You should let the user set these properties as there is no command - // or environment variable valid/available on all UN*X-systems. - // It depends on what window-manager and browser is installed. - property FtpClientCmd: string read FFtpClientCmd write FFtpClientCmd; - property GopherClientCmd: string read FGopherClientCmd write FGopherClientCmd; - property MailClientCmd: string read FMailClientCmd write FMailClientCmd; - property NewsClientCmd: string read FNewsClientCmd write FNewsClientCmd; - property NntpClientCmd: string read FNntpClientCmd write FNntpClientCmd; - property ProsperoClientCmd: string read FProsperoClientCmd write FProsperoClientCmd; - property TelnetClientCmd: string read FTelnetClientCmd write FTelnetClientCmd; - property WaisClientCmd: string read FWaisClientCmd write FWaisClientCmd; - property WebBrowserCmd: string read FWebBrowserCmd write FWebBrowserCmd; - {$ENDIF} end; implementation uses - {$IFDEF SYN_LINUX} - Libc, - {$ELSE} ShellAPI, - {$ENDIF} Forms, SynEditHighlighter, SynEditKeyConst, @@ -169,11 +128,7 @@ function TSynURIOpener.MouseInSynEdit: Boolean; var pt: TPoint; begin - {$IFDEF SYN_COMPILER_6_UP} pt := Mouse.CursorPos; - {$ELSE} - GetCursorPos(pt); - {$ENDIF} Result := PtInRect(FEditor.ClientRect, FEditor.ScreenToClient(pt)) end; @@ -198,24 +153,15 @@ procedure TSynURIOpener.NewKeyUp(Sender: TObject; var Key: Word; end; function IsControlPressed: Boolean; -{$IFDEF SYN_LINUX} -var - keymap: TXQueryKeyMap; -{$ENDIF} begin -{$IFDEF SYN_LINUX} - XQueryKeymap(Xlib.PDisplay(QtDisplay), keymap); - Result := (Byte(keymap[4]) and $20 = $20); -{$ELSE} Result := GetAsyncKeyState(VK_CONTROL) <> 0; -{$ENDIF} end; procedure TSynURIOpener.NewMouseCursor(Sender: TObject; const aLineCharPos: TBufferCoord; var aCursor: TCursor); var TokenType, Start: Integer; - Token: UnicodeString; + Token: string; Attri: TSynHighlighterAttributes; begin FControlDown := IsControlPressed; @@ -248,7 +194,7 @@ procedure TSynURIOpener.NewMouseUp(Sender: TObject; Button: TMouseButton; var ptLineCol: TBufferCoord; TokenType, Start: Integer; - Token: UnicodeString; + Token: string; Attri: TSynHighlighterAttributes; begin if (Button <> mbLeft) or (FCtrlActivatesLinks and not FControlDown) or @@ -288,10 +234,6 @@ procedure TSynURIOpener.Notification(AComponent: TComponent; end; procedure TSynURIOpener.OpenLink(URI: string; LinkType: Integer); -{$IFDEF SYN_LINUX} -var - CmdLine: string; -{$ENDIF} begin FVisitedURIs.Add(URI); @@ -301,31 +243,7 @@ procedure TSynURIOpener.OpenLink(URI: string; LinkType: Integer); tkWebLink: URI := 'http://' + URI; end; - {$IFDEF SYN_LINUX} - case TtkTokenKind(LinkType) of - tkFtpLink: - CmdLine := Format(FFtpClientCmd, [URI]); - tkGopherLink: - CmdLine := Format(FGopherClientCmd, [URI]); - tkMailtoLink: - CmdLine := Format(FMailClientCmd, [URI]); - tkNewsLink: - CmdLine := Format(FNewsClientCmd, [URI]); - tkNntpLink: - CmdLine := Format(FNntpClientCmd, [URI]); - tkProsperoLink: - CmdLine := Format(FProsperoClientCmd, [URI]); - tkTelnetLink: - CmdLine := Format(FTelnetClientCmd, [URI]); - tkWaisLink: - CmdLine := Format(FWaisClientCmd, [URI]); - tkWebLink, tkHttpLink, tkHttpsLink: - CmdLine := Format(FWebBrowserCmd, [URI]); - end; - Libc.system(PAnsiChar(CmdLine + ' &')); // add an ampersand to return immediately - {$ELSE} ShellExecute(0, nil, PChar(URI), nil, nil, 1{SW_SHOWNORMAL}); - {$ENDIF} end; procedure TSynURIOpener.SetEditor(const Value: TCustomSynEdit); @@ -371,7 +289,7 @@ procedure TSynURIOpener.SetURIHighlighter(const Value: TSynURISyn); TAccessSynURISyn(FURIHighlighter).SetAlreadyVisitedURIFunc(VisitedURI); end; -function TSynURIOpener.VisitedURI(URI: UnicodeString): Boolean; +function TSynURIOpener.VisitedURI(URI: string): Boolean; var Dummy: Integer; begin diff --git a/Ext/SynEdit/Source/SynUnicode.pas b/Ext/SynEdit/Source/SynUnicode.pas index 59d7529..9ff17a4 100644 --- a/Ext/SynEdit/Source/SynUnicode.pas +++ b/Ext/SynEdit/Source/SynUnicode.pas @@ -1,4 +1,4 @@ -{------------------------------------------------------------------------------- +{------------------------------------------------------------------------------- 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 @@ -8,10 +8,8 @@ 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 SynUnicode.pas by Maël Hörz, released 2004-05-30. +The Original Code is SynUnicode.pas by Maël Hörz, released 2004-05-30. All Rights Reserved. -TUnicodeStrings/TUnicodeStringList-code (originally written by Mike Lischke) is based -on JclUnicode.pas which is part of the JCL (www.delphi-jedi.org). Contributors to the SynEdit and mwEdit projects are listed in the Contributors.txt file. @@ -26,61 +24,28 @@ If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: SynUnicode.pas,v 1.1.3.19 2012/11/07 08:54:20 CodehunterWorks Exp $ +------------------------------------------------------------------------------} -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Provides: -- Unicode(PWideChar) versions of the most important PAnsiChar-functions in - SysUtils and some functions unavailable in Delphi 5. -- An adapted and lighter version of TUnicodeStrings/TUnicodeStringList taken - from JCL, but made portable. -- function for loading and saving of Unicode files, and detecting the encoding -- Unicode clipboard support -- Unicode-version of TCanvas-methods -- Some character constants like CR&LF. - -Last Changes: -- 1.1.3.19: Added TUnicodeStringList.CustomSort --------------------------------------------------------------------------------} - -{$IFNDEF QSYNUNICODE} unit SynUnicode; -{$ENDIF} {$I SynEdit.inc} interface uses - {$IFDEF MSWINDOWS} Windows, - {$ENDIF} Messages, Controls, Forms, Graphics, Clipbrd, - {$IFDEF SYN_COMPILER_6_UP} Types, - {$ENDIF} Classes, SysUtils, - TypInfo; - -{$IFNDEF SYN_COMPILER_6_UP} -type - UTF8String = type string; - PUTF8String = ^UTF8String; -{$ENDIF} -{$IFNDEF UNICODE} -type - UnicodeString = WideString; -{$ENDIF} + TypInfo, + SynEditTypes; const - SLineBreak = {$IFDEF SYN_LINUX} #10 {$ELSE} #13#10 {$ENDIF}; UTF8BOM: array[0..2] of Byte = ($EF, $BB, $BF); UTF16BOMLE: array[0..1] of Byte = ($FF, $FE); UTF16BOMBE: array[0..1] of Byte = ($FE, $FF); @@ -88,3597 +53,323 @@ interface UTF32BOMBE: array[0..3] of Byte = ($00, $00, $FE, $FF); const - // constants describing range of the Unicode Private Use Area (Unicode 3.2) - PrivateUseLow = WideChar($E000); - PrivateUseHigh = WideChar($F8FF); - // filler char: helper for painting wide glyphs - FillerChar = PrivateUseLow; - -const - WideNull = WideChar(#0); - WideTabulator = WideChar(#9); - WideSpace = WideChar(#32); + WideNull = #$0000; + WideTab = #$0009; + WideSpace = #$0020; // logical line breaks - WideLF = WideChar(#10); - WideLineFeed = WideChar(#10); - WideVerticalTab = WideChar(#11); - WideFormFeed = WideChar(#12); - WideCR = WideChar(#13); - WideCarriageReturn = WideChar(#13); - WideCRLF = UnicodeString(#13#10); - WideLineSeparator = WideChar($2028); - WideParagraphSeparator = WideChar($2029); - - // byte order marks for Unicode files - // Unicode text files (in UTF-16 format) 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. - BOM_LSB_FIRST = WideChar($FEFF); - BOM_MSB_FIRST = WideChar($FFFE); - -type - TSaveFormat = (sfUTF16LSB, sfUTF16MSB, sfUTF8, sfAnsi); - -const - sfUnicodeLSB = sfUTF16LSB; - sfUnicodeMSB = sfUTF16MSB; - -type - TFontCharSet = 0..255; - -{$IFDEF UNICODE} - TUnicodeStrings = TStrings; -{$ELSE} -{ TUnicodeStrings } - - TUnicodeStrings = class; - - // Event used to give the application a chance to switch the way of how to save - // the text in TUnicodeStrings if the text contains characters not only from the - // ANSI block but the save type is ANSI. On triggering the event the application - // can change the property SaveUnicode as needed. This property is again checked - // after the callback returns. - TConfirmConversionEvent = procedure (Sender: TUnicodeStrings; var Allowed: Boolean) of object; - - TUnicodeStrings = class(TPersistent) - private - FUpdateCount: Integer; - FSaved: Boolean; // set in SaveToStream, True in case saving was successfull otherwise False - FOnConfirmConversion: TConfirmConversionEvent; - FSaveFormat: TSaveFormat; // overrides the FSaveUnicode flag, initialized when a file is loaded, - // expect losses if it is set to sfAnsi before saving - function GetCommaText: UnicodeString; - function GetName(Index: Integer): UnicodeString; - function GetValue(const Name: UnicodeString): UnicodeString; - procedure ReadData(Reader: TReader); - procedure SetCommaText(const Value: UnicodeString); - procedure SetValue(const Name, Value: UnicodeString); - procedure WriteData(Writer: TWriter); - function GetSaveUnicode: Boolean; - procedure SetSaveUnicode(const Value: Boolean); - protected - procedure DefineProperties(Filer: TFiler); override; - procedure DoConfirmConversion(var Allowed: Boolean); virtual; - procedure Error(const Msg: string; Data: Integer); - function Get(Index: Integer): UnicodeString; virtual; abstract; - function GetCapacity: Integer; virtual; - function GetCount: Integer; virtual; abstract; - function GetObject(Index: Integer): TObject; virtual; - function GetTextStr: UnicodeString; virtual; - procedure Put(Index: Integer; const S: UnicodeString); virtual; abstract; - procedure PutObject(Index: Integer; AObject: TObject); virtual; abstract; - procedure SetCapacity(NewCapacity: Integer); virtual; - procedure SetUpdateState(Updating: Boolean); virtual; - public - constructor Create; - - function Add(const S: UnicodeString): Integer; virtual; - function AddObject(const S: UnicodeString; AObject: TObject): Integer; virtual; - procedure Append(const S: UnicodeString); - procedure AddStrings(Strings: TStrings); overload; virtual; - procedure AddStrings(Strings: TUnicodeStrings); overload; virtual; - procedure Assign(Source: TPersistent); override; - procedure AssignTo(Dest: TPersistent); override; - procedure BeginUpdate; - procedure Clear; virtual; abstract; - procedure Delete(Index: Integer); virtual; abstract; - procedure EndUpdate; - function Equals(Strings: TUnicodeStrings): Boolean; - procedure Exchange(Index1, Index2: Integer); virtual; - function GetSeparatedText(Separators: UnicodeString): UnicodeString; virtual; - function GetText: PWideChar; virtual; - function IndexOf(const S: UnicodeString): Integer; virtual; - function IndexOfName(const Name: UnicodeString): Integer; - function IndexOfObject(AObject: TObject): Integer; - procedure Insert(Index: Integer; const S: UnicodeString); virtual; abstract; - procedure InsertObject(Index: Integer; const S: UnicodeString; AObject: TObject); - procedure LoadFromFile(const FileName: TFileName); virtual; - procedure LoadFromStream(Stream: TStream); virtual; - procedure Move(CurIndex, NewIndex: Integer); virtual; - procedure SaveToFile(const FileName: TFileName); overload; virtual; - procedure SaveToFile(const FileName: TFileName; WithBOM: Boolean); overload; virtual; - procedure SaveToStream(Stream: TStream; WithBOM: Boolean = True); virtual; - procedure SetTextStr(const Value: UnicodeString); virtual; - - property Capacity: Integer read GetCapacity write SetCapacity; - property CommaText: UnicodeString read GetCommaText write SetCommaText; - property Count: Integer read GetCount; - property Names[Index: Integer]: UnicodeString read GetName; - property Objects[Index: Integer]: TObject read GetObject write PutObject; - property Values[const Name: UnicodeString]: UnicodeString read GetValue write SetValue; - property Saved: Boolean read FSaved; - property SaveUnicode: Boolean read GetSaveUnicode write SetSaveUnicode default True; - property SaveFormat: TSaveFormat read FSaveFormat write FSaveFormat default sfUnicodeLSB; - property Strings[Index: Integer]: UnicodeString read Get write Put; default; - property Text: UnicodeString read GetTextStr write SetTextStr; - - property OnConfirmConversion: TConfirmConversionEvent read FOnConfirmConversion write FOnConfirmConversion; - end; -{$ENDIF} - -{$IFDEF UNICODE} - TUnicodeStringList = TStringList; -{$ELSE} -{ TUnicodeStringList } - - //----- TUnicodeStringList class - TDynWideCharArray = array of WideChar; - TUnicodeStringItem = record - {$IFDEF OWN_UnicodeString_MEMMGR} - FString: PWideChar; // "array of WideChar"; - {$ELSE} - FString: UnicodeString; - {$ENDIF OWN_UnicodeString_MEMMGR} - FObject: TObject; - end; - - TUnicodeStringList = class; - TUnicodeStringItemList = array of TUnicodeStringItem; - TUnicodeStringListSortCompare = function (AString1, AString2: UnicodeString): Integer; - - TUnicodeStringList = class(TUnicodeStrings) - private - FList: TUnicodeStringItemList; - FCount: Integer; - FSorted: Boolean; - FDuplicates: TDuplicates; - FOnChange: TNotifyEvent; - FOnChanging: TNotifyEvent; - procedure ExchangeItems(Index1, Index2: Integer); - procedure Grow; - procedure QuickSort(L, R: Integer); overload; - procedure QuickSort(L, R: Integer; SCompare: TUnicodeStringListSortCompare); overload; - procedure InsertItem(Index: Integer; const S: UnicodeString); - procedure SetSorted(Value: Boolean); - {$IFDEF OWN_UnicodeString_MEMMGR} - procedure SetListString(Index: Integer; const S: UnicodeString); - {$ENDIF OWN_UnicodeString_MEMMGR} - protected - procedure Changed; virtual; - procedure Changing; virtual; - function Get(Index: Integer): UnicodeString; override; - function GetCapacity: Integer; override; - function GetCount: Integer; override; - function GetObject(Index: Integer): TObject; override; - procedure Put(Index: Integer; const S: UnicodeString); override; - procedure PutObject(Index: Integer; AObject: TObject); override; - procedure SetCapacity(NewCapacity: Integer); override; - procedure SetUpdateState(Updating: Boolean); override; - public - destructor Destroy; override; - - function Add(const S: UnicodeString): Integer; override; - procedure Clear; override; - procedure Delete(Index: Integer); override; - procedure Exchange(Index1, Index2: Integer); override; - function Find(const S: UnicodeString; var Index: Integer): Boolean; virtual; - function IndexOf(const S: UnicodeString): Integer; override; - procedure Insert(Index: Integer; const S: UnicodeString); override; - procedure Sort; virtual; - procedure CustomSort(Compare: TUnicodeStringListSortCompare); virtual; - - property Duplicates: TDuplicates read FDuplicates write FDuplicates; - property Sorted: Boolean read FSorted write SetSorted; - property OnChange: TNotifyEvent read FOnChange write FOnChange; - property OnChanging: TNotifyEvent read FOnChanging write FOnChanging; - end; -{$ENDIF} - -{$IFNDEF UNICODE} -{ PWideChar versions of important PAnsiChar functions from SysUtils } -function WStrLen(const Str: PWideChar): Cardinal; -function WStrEnd(const Str: PWideChar): PWideChar; -function WStrMove(Dest: PWideChar; const Source: PWideChar; Count: Integer): PWideChar; -function WStrCopy(Dest: PWideChar; const Source: PWideChar): PWideChar; -function WStrLCopy(Dest: PWideChar; const Source: PWideChar; MaxLen: Cardinal): PWideChar; -function WStrCat(Dest: PWideChar; const Source: PWideChar): PWideChar; -function WStrScan(const Str: PWideChar; Chr: WideChar): PWideChar; -function WStrAlloc(Size: Cardinal): PWideChar; -function WStrNew(const Str: PWideChar): PWideChar; -procedure WStrDispose(Str: PWideChar); -{$ENDIF} - + WideLF = #$000A; + WideLineFeed = #$000A; + WideVerticalTab = #$000B; + WideFormFeed = #$000C; + WideCR = #$000D; + WideCarriageReturn = #$000D; + WideCRLF = string(#13#10); + WideLineSeparator = #$2028; + WideParagraphSeparator = #$2029; -{$IFNDEF SYN_COMPILER_6_UP} -{$IFDEF MSWINDOWS} -function UnicodeToUtf8(Dest: PAnsiChar; MaxDestBytes: Cardinal; - Source: PWideChar; SourceChars: Cardinal): Cardinal; -function Utf8ToUnicode(Dest: PWideChar; MaxDestChars: Cardinal; - Source: PAnsiChar; SourceBytes: Cardinal): Cardinal; -function UTF8Encode(const WS: UnicodeString): UTF8String; -function UTF8Decode(const S: UTF8String): UnicodeString; -function AnsiToUtf8(const S: string): UTF8String; -function Utf8ToAnsi(const S: UTF8String): string; - -function WideCompareStr(const S1, S2: UnicodeString): Integer; -function WideCompareText(const S1, S2: UnicodeString): Integer; -{$ENDIF} -{$ENDIF} - -// Kylix has them, but Delphi 5 doesn't and Delphi 6&7 versions are buggy -// in Win9X (fix taken from Troy Wolbrinks TntUnicode-package) -{$IFDEF MSWINDOWS} -{$IFNDEF UNICODE} var - DefaultSystemCodePage: Cardinal; // implicitly used when converting AnsiString <--> UnicodeString. -{$ENDIF} - -function WCharUpper(lpsz: PWideChar): PWideChar; -function WCharUpperBuff(lpsz: PWideChar; cchLength: DWORD): DWORD; -function WCharLower(lpsz: PWideChar): PWideChar; -function WCharLowerBuff(lpsz: PWideChar; cchLength: DWORD): DWORD; -{$ENDIF} -function SynWideUpperCase(const S: UnicodeString): UnicodeString; -function SynWideLowerCase(const S: UnicodeString): UnicodeString; -function SynIsCharAlpha(const C: WideChar): Boolean; -function SynIsCharAlphaNumeric(const C: WideChar): Boolean; -{$IFNDEF UNICODE} -function CharInSet(C: AnsiChar; const CharSet: TSysCharSet): Boolean; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} -function CharInSet(C: WideChar; const CharSet: TSysCharSet): Boolean; overload; {$IFDEF SUPPORTS_INLINE} inline; {$ENDIF} -{$ENDIF} + SynTabGlyph: WideChar = #$2192; //'->' + SynLineBreakGlyph: WideChar = #$21B2; + SynSpaceGlyph: WideChar = #$2219; //'·' -function WideLastDelimiter(const Delimiters, S: UnicodeString): Integer; -function UnicodeStringReplace(const S, OldPattern, NewPattern: UnicodeString; - Flags: TReplaceFlags): UnicodeString; + FlowControlChars: array[TSynFlowControl] of Char = + (WideNull, #$2BAD, #$2BAF, #$27A5); { functions taken from JCLUnicode.pas } -function WStrComp(Str1, Str2: PWideChar): Integer; -function WStrLComp(Str1, Str2: PWideChar; MaxLen: Cardinal): Integer; procedure StrSwapByteOrder(Str: PWideChar); -function WideQuotedStr(const S: UnicodeString; Quote: WideChar): UnicodeString; -function WideExtractQuotedStr(var Src: PWideChar; Quote: WideChar): UnicodeString; -function UnicodeStringOfChar(C: WideChar; Count: Cardinal): UnicodeString; -function WideTrim(const S: UnicodeString): UnicodeString; -function WideTrimLeft(const S: UnicodeString): UnicodeString; -function WideTrimRight(const S: UnicodeString): UnicodeString; -{$IFDEF MSWINDOWS} -function CharSetFromLocale(Language: LCID): TFontCharSet; -function CodePageFromLocale(Language: LCID): Integer; -function KeyboardCodePage: Word; -function KeyUnicode(C: AnsiChar): WideChar; -function StringToUnicodeStringEx(const S: AnsiString; CodePage: Word): UnicodeString; -function UnicodeStringToStringEx(const WS: UnicodeString; CodePage: Word): AnsiString; -{$ENDIF} - -{ functions providing same behavior on Win9x and WinNT based systems} -function GetTextSize(DC: HDC; Str: PWideChar; Count: Integer): TSize; - -{ Unicode versions of TCanvas-methods } -function TextExtent(ACanvas: TCanvas; const Text: UnicodeString): TSize; -function TextWidth(ACanvas: TCanvas; const Text: UnicodeString): Integer; -function TextHeight(ACanvas: TCanvas; const Text: UnicodeString): Integer; -procedure TextOut(ACanvas: TCanvas; X, Y: Integer; const Text: UnicodeString); -procedure TextRect(ACanvas: TCanvas; Rect: TRect; X, Y: Integer; - const Text: UnicodeString); { Unicode streaming-support } type TSynEncoding = (seUTF8, seUTF16LE, seUTF16BE, seAnsi); TSynEncodings = set of TSynEncoding; -{$IFDEF UNICODE} - TWideFileStream = TFileStream; -{$ELSE} - TWideFileStream = class(THandleStream) - public - constructor Create(const FileName: UnicodeString; Mode: Word); overload; - constructor Create(const FileName: UnicodeString; Mode: Word; Rights: Cardinal); overload; - destructor Destroy; override; - end; - -function WideFileOpen(const FileName: UnicodeString; Mode: LongWord): Integer; -function WideFileCreate(const FileName: UnicodeString): Integer; overload; -function WideFileCreate(const FileName: UnicodeString; Rights: Integer): Integer; overload; -{$ENDIF} - -function IsAnsiOnly(const WS: UnicodeString): Boolean; -function IsUTF8(Stream: TStream; out WithBOM: Boolean): Boolean; overload; -function IsUTF8(const FileName: UnicodeString; out WithBOM: Boolean): Boolean; overload; -function GetEncoding(const FileName: UnicodeString; out WithBOM: Boolean): TSynEncoding; overload; -function GetEncoding(Stream: TStream; out WithBOM: Boolean): TSynEncoding; overload; -procedure SaveToFile(const WS: UnicodeString; const FileName: UnicodeString; - Encoding: TSynEncoding; WithBom: Boolean = True); overload; -procedure SaveToFile(UnicodeStrings: TUnicodeStrings; const FileName: UnicodeString; - Encoding: TSynEncoding; WithBom: Boolean = True); overload; -function LoadFromFile(UnicodeStrings: TUnicodeStrings; const FileName: UnicodeString; - out WithBOM: Boolean): TSynEncoding; overload; -function LoadFromFile(UnicodeStrings: TUnicodeStrings; const FileName: UnicodeString; - Encoding: TSynEncoding; out WithBOM: Boolean): TSynEncoding; overload; -procedure SaveToStream(const WS: UnicodeString; Stream: TStream; - Encoding: TSynEncoding; WithBom: Boolean = True); overload; -procedure SaveToStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; - Encoding: TSynEncoding; WithBom: Boolean = True); overload; -function LoadFromStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; - out WithBOM: Boolean): TSynEncoding; overload; -function LoadFromStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; - Encoding: TSynEncoding; out WithBOM: Boolean): TSynEncoding; overload; -function LoadFromStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; - Encoding: TSynEncoding): TSynEncoding; overload; +function IsAnsiOnly(const WS: string): Boolean; +function IsUTF8(Stream: TStream; out WithBOM: Boolean; BytesToCheck: Integer = $4000): Boolean; overload; +function IsUTF8(const FileName: string; out WithBOM: Boolean; BytesToCheck: Integer = $4000): Boolean; overload; +function IsUTF8(const Bytes: TBytes; Start: Integer = 0; BytesToCheck: Integer = $4000): Boolean; overload; +function GetEncoding(const FileName: string; out WithBOM: Boolean): TEncoding; overload; +function GetEncoding(Stream: TStream; out WithBOM: Boolean): TEncoding; overload; function ClipboardProvidesText: Boolean; -function GetClipboardText: UnicodeString; -procedure SetClipboardText(const Text: UnicodeString); +function GetClipboardText: string; +procedure SetClipboardText(const Text: string); { misc functions } -{$IFNDEF UNICODE} -{$IFNDEF SYN_COMPILER_6_UP} -function GetWideStrProp(Instance: TObject; PropInfo: PPropInfo): UnicodeString; -procedure SetWideStrProp(Instance: TObject; PropInfo: PPropInfo; const Value: UnicodeString); -{$ENDIF} -procedure UnicodeDefineProperties(Filer: TFiler; Instance: TPersistent); -{$ENDIF} -{$IFDEF MSWINDOWS} function IsWideCharMappableToAnsi(const WC: WideChar): Boolean; -function IsUnicodeStringMappableToAnsi(const WS: UnicodeString): Boolean; -{$ENDIF} -{$IFDEF MSWINDOWS} var - Win32PlatformIsUnicode: Boolean; -{$ENDIF} + UserLocaleName: array [0..LOCALE_NAME_MAX_LENGTH - 1] of Char; implementation uses SynEditTextBuffer, - {$IFDEF SYN_UNISCRIBE} - SynUsp10, - {$ENDIF} Math, - {$IFDEF SYN_LINUX} - Libc, - {$ENDIF} - {$IFDEF USE_TNT_RUNTIME_SUPPORT} - TntSysUtils, TntClasses, - {$ENDIF} SysConst, - {$IFDEF SYN_COMPILER_6_UP} RTLConsts; - {$ELSE} - Consts; - {$ENDIF} - -{$IFNDEF UNICODE} -{ TUnicodeStrings } - -constructor TUnicodeStrings.Create; -begin - inherited; - FSaveFormat := sfUnicodeLSB; -end; - -function TUnicodeStrings.GetSaveUnicode: Boolean; -begin - Result := SaveFormat in [sfUTF16LSB, sfUTF16MSB, sfUTF8]; -end; - -procedure TUnicodeStrings.SetSaveUnicode(const Value: Boolean); -begin - if Value then - SaveFormat := sfUnicodeLSB - else - SaveFormat := sfAnsi; -end; - -function TUnicodeStrings.Add(const S: UnicodeString): Integer; -begin - Result := GetCount; - Insert(Result, S); -end; -function TUnicodeStrings.AddObject(const S: UnicodeString; AObject: TObject): Integer; -begin - Result := Add(S); - PutObject(Result, AObject); -end; - -procedure TUnicodeStrings.Append(const S: UnicodeString); +// exchanges in each character of the given string the low order and high order +// byte to go from LSB to MSB and vice versa. +// EAX contains address of string +procedure StrSwapByteOrder(Str: PWideChar); +var + P: PWord; begin - Add(S); + P := PWord(Str); + while P^ <> 0 do + begin + P^ := MakeWord(HiByte(P^), LoByte(P^)); + Inc(P); + end; end; -procedure TUnicodeStrings.AddStrings(Strings: TStrings); +function IsAnsiOnly(const WS: string): Boolean; var - I: Integer; -{$IFDEF MSWINDOWS} - S: UnicodeString; - CP: Integer; -{$ENDIF} + UsedDefaultChar: BOOL; begin - BeginUpdate; - try - {$IFDEF MSWINDOWS} - CP := CodePageFromLocale(GetThreadLocale); - for I := 0 to Strings.Count - 1 do - begin - S := StringToUnicodeStringEx(Strings[I], CP); - AddObject(S, Strings.Objects[I]); - end; - {$ELSE} - for I := 0 to Strings.Count - 1 do - AddObject(Strings[I], Strings.Objects[I]); - {$ENDIF} - finally - EndUpdate; - end; + WideCharToMultiByte(DefaultSystemCodePage, 0, PWideChar(WS), Length(WS), nil, 0, + nil, @UsedDefaultChar); + Result := not UsedDefaultChar; end; -procedure TUnicodeStrings.AddStrings(Strings: TUnicodeStrings); +function IsUTF8(const FileName: string; out WithBOM: Boolean; BytesToCheck: Integer): Boolean; var - I: Integer; + Stream: TStream; begin - Assert(Strings <> nil); - - BeginUpdate; + Stream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); try - for I := 0 to Strings.Count - 1 do - AddObject(Strings[I], Strings.Objects[I]); + Result := IsUTF8(Stream, WithBOM, BytesToCheck); finally - EndUpdate; + Stream.Free; end; end; -procedure TUnicodeStrings.Assign(Source: TPersistent); -// usual assignment routine, but able to assign wide and small strings -begin - if Source is TUnicodeStrings then - begin - BeginUpdate; - try - Clear; - AddStrings(TUnicodeStrings(Source)); - finally - EndUpdate; - end; - end - else - begin - if Source is TStrings then - begin - BeginUpdate; - try - Clear; - AddStrings(TStrings(Source)); - finally - EndUpdate; - end; - end - else - inherited Assign(Source); - end; -end; - -procedure TUnicodeStrings.AssignTo(Dest: TPersistent); -// need to do also assignment to old style TStrings, but this class doesn't know -// TUnicodeStrings, so we need to do it from here +// checks for a BOM in UTF-8 format or searches the first 4096 bytes for +// typical UTF-8 octet sequences +function IsUTF8(Stream: TStream; out WithBOM: Boolean; BytesToCheck: Integer): Boolean; var - I: Integer; + Buffer: TBytes; + BufferSize: Integer; + BomLen: Integer; + Encoding: TEncoding; begin - if Dest is TStrings then - begin - with Dest as TStrings do - begin - BeginUpdate; - try - Clear; - for I := 0 to Self.Count - 1 do - AddObject(Self[I], Self.Objects[I]); - finally - EndUpdate; - end; - end; - end - else - begin - if Dest is TUnicodeStrings then - begin - with Dest as TUnicodeStrings do - begin - BeginUpdate; - try - Clear; - AddStrings(Self); - finally - EndUpdate; - end; - end; - end - else - inherited; - end; -end; + // if Stream is nil, let Delphi raise the exception, by accessing Stream, + // to signal an invalid result -procedure TUnicodeStrings.BeginUpdate; -begin - if FUpdateCount = 0 then - SetUpdateState(True); - Inc(FUpdateCount); -end; + // start analysis at actual Stream.Position + BufferSize := Min(BytesToCheck, Stream.Size - Stream.Position); -procedure TUnicodeStrings.DefineProperties(Filer: TFiler); -// Defines a private property for the content of the list. -// There's a bug in the handling of text DFMs in Classes.pas which prevents -// UnicodeStrings from loading under some circumstances. Zbysek Hlinka -// (zhlinka att login dott cz) brought this to my attention and supplied also a solution. -// See ReadData and WriteData methods for implementation details. + // if no special characteristics are found it is not UTF-8 + Result := False; + WithBOM := False; - function DoWrite: Boolean; + if BufferSize > 0 then begin - if Filer.Ancestor <> nil then - begin - Result := True; - if Filer.Ancestor is TUnicodeStrings then - Result := not Equals(TUnicodeStrings(Filer.Ancestor)) - end - else - Result := Count > 0; - end; - -begin - Filer.DefineProperty('UnicodeStrings', ReadData, WriteData, DoWrite); -end; + SetLength(Buffer, BufferSize); + Stream.Read(Buffer, 0, BufferSize); + Stream.Seek(-BufferSize, soCurrent); -procedure TUnicodeStrings.DoConfirmConversion(var Allowed: Boolean); -begin - if Assigned(FOnConfirmConversion) then - FOnConfirmConversion(Self, Allowed); -end; + { first search for BOM } + Encoding := nil; + BomLen := TEncoding.GetBufferEncoding(Buffer, Encoding); + WithBOM := BOMLen > 0; + if Encoding = TEncoding.UTF8 then + Exit(True) + else if WithBom then + Exit(False); -procedure TUnicodeStrings.EndUpdate; -begin - Dec(FUpdateCount); - if FUpdateCount = 0 then - SetUpdateState(False); + { Now check the content for UTF8 sequences } + Result := IsUtf8(Buffer, 0, BytesToCheck); + end; end; -function TUnicodeStrings.Equals(Strings: TUnicodeStrings): Boolean; +function IsUTF8(const Bytes: TBytes; Start: Integer; BytesToCheck: Integer): Boolean; overload; +const + MinimumCountOfUTF8Strings = 1; var - I, Count: Integer; -begin - Assert(Strings <> nil); + Len, i, FoundUTF8Strings: Integer; - Result := False; - Count := GetCount; - if Count <> Strings.GetCount then - Exit; - for I := 0 to Count - 1 do - if Get(I) <> Strings.Get(I) then - Exit; - Result := True; -end; - -procedure TUnicodeStrings.Error(const Msg: string; Data: Integer); - - function ReturnAddr: Pointer; - asm - MOV EAX, [EBP + 4] + // 3 trailing bytes are the maximum in valid UTF-8 streams, + // so a count of 4 trailing bytes is enough to detect invalid UTF-8 streams + function CountOfTrailingBytes: Integer; + begin + Result := 0; + Inc(I); + while (I < Len) and (Result < 4) do + begin + if Bytes[I] in [$80..$BF] then + Inc(Result) + else + Break; + Inc(I); + end; end; begin - raise EStringListError.CreateFmt(Msg, [Data]) at ReturnAddr; + { NOTE: There is no 100% save way to detect UTF-8 streams. The bigger + MinimumCountOfUTF8Strings, the lower is the probability of + a false positive. On the other hand, a big MinimumCountOfUTF8Strings + makes it unlikely to detect files with only little usage of non + US-ASCII chars, like usual in European languages. } + Result := False; + Len := Min(Start + BytesToCheck, Length(Bytes)); + FoundUTF8Strings := 0; + I := Start; + while I < Len do + begin + case Bytes[I] of + $00..$7F: // skip US-ASCII characters as they could belong to various charsets + ; + $C2..$DF: + if CountOfTrailingBytes = 1 then + Inc(FoundUTF8Strings) + else + Break; + $E0: + begin + Inc(I); + if (I < Len) and (Bytes[I] in [$A0..$BF]) and (CountOfTrailingBytes = 1) then + Inc(FoundUTF8Strings) + else + Break; + end; + $E1..$EC, $EE..$EF: + if CountOfTrailingBytes = 2 then + Inc(FoundUTF8Strings) + else + Break; + $ED: + begin + Inc(I); + if (I < Len) and (Bytes[I] in [$80..$9F]) and (CountOfTrailingBytes = 1) then + Inc(FoundUTF8Strings) + else + Break; + end; + $F0: + begin + Inc(I); + if (I < Len) and (Bytes[I] in [$90..$BF]) and (CountOfTrailingBytes = 2) then + Inc(FoundUTF8Strings) + else + Break; + end; + $F1..$F3: + if CountOfTrailingBytes = 3 then + Inc(FoundUTF8Strings) + else + Break; + $F4: + begin + Inc(I); + if (I < Len) and (Bytes[I] in [$80..$8F]) and (CountOfTrailingBytes = 2) then + Inc(FoundUTF8Strings) + else + Break; + end; + $C0, $C1, $F5..$FF: // invalid UTF-8 bytes + Break; + $80..$BF: // trailing bytes are consumed when handling leading bytes, + // any occurence of "orphaned" trailing bytes is invalid UTF-8 + Break; + end; + + if FoundUTF8Strings >= MinimumCountOfUTF8Strings then + begin + Result := True; + Break; + end; + + Inc(I); + end; end; -procedure TUnicodeStrings.Exchange(Index1, Index2: Integer); +function GetEncoding(const FileName: string; out WithBOM: Boolean): TEncoding; var - TempObject: TObject; - TempString: UnicodeString; + Stream: TStream; begin - BeginUpdate; + Stream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); try - TempString := Strings[Index1]; - TempObject := Objects[Index1]; - Strings[Index1] := Strings[Index2]; - Objects[Index1] := Objects[Index2]; - Strings[Index2] := TempString; - Objects[Index2] := TempObject; + Result := GetEncoding(Stream, WithBOM); finally - EndUpdate; + Stream.Free; end; end; -function TUnicodeStrings.GetCapacity: Integer; -// Descendants may optionally override/replace this default implementation. -begin - Result := Count; -end; +function GetEncoding(Stream: TStream; out WithBOM: Boolean): TEncoding; -function TUnicodeStrings.GetCommaText: UnicodeString; -var - S: UnicodeString; - P: PWideChar; - I, Count: Integer; -begin - Count := GetCount; - if (Count = 1) and (Get(0) = '') then - Result := '""' - else + function TBytesEqual(A, B: TBytes; Len: Integer): Boolean; + var + I: Integer; begin - Result := ''; - for I := 0 to Count - 1 do - begin - S := Get(I); - P := PWideChar(S); - while not (P^ in [WideNull..WideSpace, WideChar('"'), WideChar(',')]) do - Inc(P); - if P^ <> WideNull then - S := WideQuotedStr(S, '"'); - Result := Result + S + ','; - end; - System.Delete(Result, Length(Result), 1); + Result := True; + for I := 0 to Len - 1 do + if A[I] <> B[I] then Exit(False) end; -end; -function TUnicodeStrings.GetName(Index: Integer): UnicodeString; var - P: Integer; + Buffer: TBytes; + Size: Integer; + Preamble: TBytes; begin - Result := Get(Index); - P := Pos('=', Result); - if P > 0 then - SetLength(Result, P - 1) - else - Result := ''; -end; + // if Stream is nil, let Delphi raise the exception, by accessing Stream, + // to signal an invalid result -function TUnicodeStrings.GetObject(Index: Integer): TObject; -begin - Result := nil; -end; + // start analysis at actual Stream.Position + Size := Stream.Size - Stream.Position; -function TUnicodeStrings.GetSeparatedText(Separators: UnicodeString): UnicodeString; -// Same as GetText but with customizable separator characters. -var - I, L, - Size, - Count, - SepSize: Integer; - P: PWideChar; - S: UnicodeString; -begin - Count := GetCount; - SepSize := Length(Separators); - Size := 0; - for I := 0 to Count - 1 do - Inc(Size, Length(Get(I)) + SepSize); - - // set one separator less, the last line does not need a trailing separator - SetLength(Result, Size - SepSize); - if Size > 0 then + // if no special characteristics are found it is probably ANSI + Result := TEncoding.ANSI; + + if IsUTF8(Stream, WithBOM) then Exit(TEncoding.UTF8); + + { try to detect UTF-16 by finding a BOM in UTF-16 format } + + // Check for Unicode + Preamble := TEncoding.Unicode.GetPreamble; + if Size >= Length(Preamble) then begin - P := Pointer(Result); - I := 0; - while True do + Setlength(Buffer, Length(Preamble)); + Stream.Read(Buffer, 0, Length(Preamble)); + Stream.Seek(-Length(Preamble), soCurrent); + if TBytesEqual(Preamble, Buffer, Length(Preamble)) then begin - S := Get(I); - L := Length(S); - if L <> 0 then - begin - // add current string - System.Move(Pointer(S)^, P^, 2 * L); - Inc(P, L); - end; - Inc(I); - if I = Count then - Break; - - // add separators - System.Move(Pointer(Separators)^, P^, SizeOf(WideChar) * SepSize); - Inc(P, SepSize); + WithBOM := True; + Exit(TEncoding.Unicode); end; end; -end; - -function TUnicodeStrings.GetTextStr: UnicodeString; -begin - Result := GetSeparatedText(WideCRLF); -end; - -function TUnicodeStrings.GetText: PWideChar; -begin - Result := WStrNew(PWideChar(GetTextStr)); -end; - -function TUnicodeStrings.GetValue(const Name: UnicodeString): UnicodeString; -var - I: Integer; -begin - I := IndexOfName(Name); - if I >= 0 then - Result := Copy(Get(I), Length(Name) + 2, MaxInt) - else - Result := ''; -end; - -function TUnicodeStrings.IndexOf(const S: UnicodeString): Integer; -begin - for Result := 0 to GetCount - 1 do - if WideCompareText(Get(Result), S) = 0 then - Exit; - Result := -1; -end; - -function TUnicodeStrings.IndexOfName(const Name: UnicodeString): Integer; -var - P: Integer; - S: UnicodeString; -begin - for Result := 0 to GetCount - 1 do + // Check for BigEndianUnicode + Preamble := TEncoding.BigEndianUnicode.GetPreamble; + if Size >= Length(Preamble) then begin - S := Get(Result); - P := Pos('=', S); - if (P > 0) and (WideCompareText(Copy(S, 1, P - 1), Name) = 0) then - Exit; + Setlength(Buffer, Length(Preamble)); + Stream.Read(Buffer, 0, Length(Preamble)); + Stream.Seek(-Length(Preamble), soCurrent); + if TBytesEqual(Preamble, Buffer, Length(Preamble)) then + begin + WithBOM := True; + Exit(TEncoding.BigEndianUnicode); + end; end; - Result := -1; end; -function TUnicodeStrings.IndexOfObject(AObject: TObject): Integer; +function ClipboardProvidesText: Boolean; begin - for Result := 0 to GetCount - 1 do - if GetObject(Result) = AObject then - Exit; - Result := -1; + Result := IsClipboardFormatAvailable(CF_UNICODETEXT); end; -procedure TUnicodeStrings.InsertObject(Index: Integer; const S: UnicodeString; AObject: TObject); +function GetClipboardText: string; begin - Insert(Index, S); - PutObject(Index, AObject); + Result := Clipboard.AsText; end; -procedure TUnicodeStrings.LoadFromFile(const FileName: TFileName); -var - Stream: TStream; +procedure SetClipboardText(const Text: string); begin - Stream := TFileStream.Create(FileName, fmOpenRead or fmShareDenyNone); - try - LoadFromStream(Stream); - finally - Stream.Free; - end; + Clipboard.AsText := Text; end; -procedure TUnicodeStrings.LoadFromStream(Stream: TStream); -// usual loader routine, but enhanced to handle byte order marks in stream -var - Size, - BytesRead: Integer; - ByteOrderMask: array[0..5] of Byte; // BOM size is max 5 bytes (cf: wikipedia) - // but it is easier to implement with a multiple of 2 - Loaded: Boolean; - SW: UnicodeString; - SA: AnsiString; -begin - BeginUpdate; - try - Loaded := False; - - Size := Stream.Size - Stream.Position; - BytesRead := Stream.Read(ByteOrderMask[0], SizeOf(ByteOrderMask)); - - // UTF16 LSB = Unicode LSB/LE - if (BytesRead >= 2) and (ByteOrderMask[0] = UTF16BOMLE[0]) - and (ByteOrderMask[1] = UTF16BOMLE[1]) then - begin - FSaveFormat := sfUTF16LSB; - SetLength(SW, (Size - 2) div SizeOf(WideChar)); - Assert((Size and 1) <> 1, 'Number of chars must be a multiple of 2'); - if BytesRead > 2 then - begin - System.Move(ByteOrderMask[2], SW[1], BytesRead - 2); // max 4 bytes = 2 widechars - if Size > BytesRead then - // first 2 chars (maximum) were copied by System.Move - Stream.Read(SW[3], Size - BytesRead); - end; - SetTextStr(SW); - Loaded := True; - end; - - // UTF16 MSB = Unicode MSB/BE - if (BytesRead >= 2) and (ByteOrderMask[0] = UTF16BOMBE[0]) - and (ByteOrderMask[1] = UTF16BOMBE[1]) then - begin - FSaveFormat := sfUTF16MSB; - SetLength(SW, (Size - 2) div SizeOf(WideChar)); - Assert((Size and 1) <> 1, 'Number of chars must be a multiple of 2'); - if BytesRead > 2 then - begin - System.Move(ByteOrderMask[2], SW[1] ,BytesRead - 2); // max 4 bytes = 2 widechars - if Size > BytesRead then - // first 2 chars (maximum) were copied by System.Move - Stream.Read(SW[3], Size - BytesRead); - StrSwapByteOrder(PWideChar(SW)); - end; - SetTextStr(SW); - Loaded := True; - end; - - // UTF8 - if (BytesRead >= 3) and (ByteOrderMask[0] = UTF8BOM[0]) - and (ByteOrderMask[1] = UTF8BOM[1]) and (ByteOrderMask[2] = UTF8BOM[2]) then - begin - FSaveFormat := sfUTF8; - SetLength(SA, (Size - 3) div SizeOf(AnsiChar)); - if BytesRead > 3 then - begin - System.Move(ByteOrderMask[3], SA[1], BytesRead - 3); // max 3 bytes = 3 chars - if Size > BytesRead then - // first 3 chars were copied by System.Move - Stream.Read(SA[4], Size - BytesRead); - SW := UTF8Decode(SA); - end; - SetTextStr(SW); - Loaded := True; - end; - - // default case (Ansi) - if not Loaded then - begin - FSaveFormat := sfAnsi; - SetLength(SA, Size div SizeOf(AnsiChar)); - if BytesRead > 0 then - begin - System.Move(ByteOrderMask[0], SA[1], BytesRead); // max 6 bytes = 6 chars - if Size > BytesRead then - Stream.Read(SA[7], Size - BytesRead); // first 6 chars were copied by System.Move - SW := UTF8Decode(SA); - if SW <> '' then - begin - FSaveFormat := sfUTF8; - SetTextStr(SW); - Loaded := True; - end; - end; - if not Loaded then - SetTextStr(SA); - end; - finally - EndUpdate; - end; -end; - -procedure TUnicodeStrings.Move(CurIndex, NewIndex: Integer); -var - TempObject: TObject; - TempString: UnicodeString; -begin - if CurIndex <> NewIndex then - begin - BeginUpdate; - try - TempString := Get(CurIndex); - TempObject := GetObject(CurIndex); - Delete(CurIndex); - InsertObject(NewIndex, TempString, TempObject); - finally - EndUpdate; - end; - end; -end; - -procedure TUnicodeStrings.ReadData(Reader: TReader); -begin - case Reader.NextValue of - vaLString, vaString: - SetTextStr(Reader.ReadString); - else - SetTextStr(Reader.ReadWideString); - end; -end; - -procedure TUnicodeStrings.SaveToFile(const FileName: TFileName); -var - Stream: TStream; -begin - Stream := TFileStream.Create(FileName, fmCreate); - try - SaveToStream(Stream); - finally - Stream.Free; - end; -end; - -procedure TUnicodeStrings.SaveToFile(const FileName: TFileName; WithBOM: Boolean); -var - Stream: TStream; -begin - Stream := TFileStream.Create(FileName, fmCreate); - try - SaveToStream(Stream, WithBOM); - finally - Stream.Free; - end; -end; - -procedure TUnicodeStrings.SaveToStream(Stream: TStream; WithBOM: Boolean = True); -// Saves the currently loaded text into the given stream. WithBOM determines whether to write a -// byte order mark or not. Note: when saved as ANSI text there will never be a BOM. -var - SW: UnicodeString; - SA: AnsiString; - Allowed: Boolean; - Run: PWideChar; -begin - // The application can decide in which format to save the content. - // If FSaveUnicode is False then all strings are saved in standard ANSI format - // which is also loadable by TStrings but you should be aware that all Unicode - // strings are then converted to ANSI based on the current system locale. - // An extra event is supplied to ask the user about the potential loss of - // information when converting Unicode to ANSI strings. - SW := GetTextStr; - Allowed := True; - FSaved := False; // be pessimistic - // A check for potential information loss makes only sense if the application has - // set an event to be used as call back to ask about the conversion. - if not SaveUnicode and Assigned(FOnConfirmConversion) then - begin - // application requests to save only ANSI characters, so check the text and - // call back in case information could be lost - Run := PWideChar(SW); - // only ask if there's at least one Unicode character in the text - while Run^ in [WideChar(#1)..WideChar(#255)] do - Inc(Run); - // Note: The application can still set FSaveUnicode to True in the callback. - if Run^ <> WideNull then - DoConfirmConversion(Allowed); - end; - - if Allowed then - begin - // only save if allowed - case SaveFormat of - sfUTF16LSB: - begin - if WithBOM then - Stream.WriteBuffer(UTF16BOMLE[0], SizeOf(UTF16BOMLE)); - Stream.WriteBuffer(SW[1], Length(SW) * SizeOf(WideChar)); - FSaved := True; - end; - sfUTF16MSB: - begin - if WithBOM then - Stream.WriteBuffer(UTF16BOMBE[0], SizeOf(UTF16BOMBE)); - StrSwapByteOrder(PWideChar(SW)); - Stream.WriteBuffer(SW[1], Length(SW) * SizeOf(WideChar)); - FSaved := True; - end; - sfUTF8: - begin - if WithBOM then - Stream.WriteBuffer(UTF8BOM[0], SizeOf(UTF8BOM)); - SA := UTF8Encode(SW); - Stream.WriteBuffer(SA[1], Length(SA) * SizeOf(AnsiChar)); - FSaved := True; - end; - sfAnsi: - begin - SA := SW; - Stream.WriteBuffer(SA[1], Length(SA) * SizeOf(AnsiChar)); - FSaved := True; - end; - end; - end; -end; - -procedure TUnicodeStrings.SetCapacity(NewCapacity: Integer); -begin - // do nothing - descendants may optionally implement this method -end; - -procedure TUnicodeStrings.SetCommaText(const Value: UnicodeString); -var - P, P1: PWideChar; - S: UnicodeString; -begin - BeginUpdate; - try - Clear; - P := PWideChar(Value); - while P^ in [WideChar(#1)..WideSpace] do - Inc(P); - while P^ <> WideNull do - begin - if P^ = '"' then - S := WideExtractQuotedStr(P, '"') - else - begin - P1 := P; - while (P^ > WideSpace) and (P^ <> ',') do - Inc(P); - SetString(S, P1, P - P1); - end; - Add(S); - - while P^ in [WideChar(#1)..WideSpace] do - Inc(P); - if P^ = ',' then - begin - repeat - Inc(P); - until not (P^ in [WideChar(#1)..WideSpace]); - end; - end; - finally - EndUpdate; - end; -end; - -procedure TUnicodeStrings.SetTextStr(const Value: UnicodeString); -var - Head, - Tail: PWideChar; - S: UnicodeString; -begin - BeginUpdate; - try - Clear; - Head := PWideChar(Value); - while Head^ <> WideNull do - begin - Tail := Head; - while not (Tail^ in [WideNull, WideLineFeed, WideCarriageReturn, WideVerticalTab, WideFormFeed]) and - (Tail^ <> WideLineSeparator) and (Tail^ <> WideParagraphSeparator) do - Inc(Tail); - SetString(S, Head, Tail - Head); - Add(S); - Head := Tail; - if Head^ <> WideNull then - begin - Inc(Head); - if (Tail^ = WideCarriageReturn) and (Head^ = WideLineFeed) then - Inc(Head); - end; - end; - finally - EndUpdate; - end; -end; - -procedure TUnicodeStrings.SetUpdateState(Updating: Boolean); -begin -end; - -procedure TUnicodeStrings.SetValue(const Name, Value: UnicodeString); -var - I : Integer; -begin - I := IndexOfName(Name); - if Value <> '' then - begin - if I < 0 then - I := Add(''); - Put(I, Name + '=' + Value); - end - else - begin - if I >= 0 then - Delete(I); - end; -end; - -procedure TUnicodeStrings.WriteData(Writer: TWriter); -begin - Writer.WriteWideString(GetTextStr); -end; - - -{ TUnicodeStringList } - -destructor TUnicodeStringList.Destroy; -begin - FOnChange := nil; - FOnChanging := nil; - Clear; - inherited; -end; - -function TUnicodeStringList.Add(const S: UnicodeString): Integer; -begin - if not Sorted then - Result := FCount - else - begin - if Find(S, Result) then - begin - case Duplicates of - dupIgnore: - Exit; - dupError: - Error(SDuplicateString, 0); - end; - end; - end; - InsertItem(Result, S); -end; - -procedure TUnicodeStringList.Changed; -begin - if (FUpdateCount = 0) and Assigned(FOnChange) then - FOnChange(Self); -end; - -procedure TUnicodeStringList.Changing; -begin - if (FUpdateCount = 0) and Assigned(FOnChanging) then - FOnChanging(Self); -end; - -procedure TUnicodeStringList.Clear; -{$IFDEF OWN_UnicodeString_MEMMGR} -var - I: Integer; -{$ENDIF OWN_UnicodeString_MEMMGR} -begin - if FCount <> 0 then - begin - Changing; - {$IFDEF OWN_UnicodeString_MEMMGR} - for I := 0 to FCount - 1 do - with FList[I] do - if TDynWideCharArray(FString) <> nil then - TDynWideCharArray(FString) := nil; - {$ENDIF OWN_UnicodeString_MEMMGR} - // this will automatically finalize the array - FList := nil; - FCount := 0; - SetCapacity(0); - Changed; - end; -end; - -procedure TUnicodeStringList.Delete(Index: Integer); -begin - if Cardinal(Index) >= Cardinal(FCount) then - Error(SListIndexError, Index); - Changing; - - {$IFDEF OWN_UnicodeString_MEMMGR} - SetListString(Index, ''); - {$ELSE} - FList[Index].FString := ''; - {$ENDIF OWN_UnicodeString_MEMMGR} - Dec(FCount); - if Index < FCount then - begin - System.Move(FList[Index + 1], FList[Index], (FCount - Index) * SizeOf(TUnicodeStringItem)); - Pointer(FList[FCount].FString) := nil; // avoid freeing the string, the address is now used in another element - end; - Changed; -end; - -procedure TUnicodeStringList.Exchange(Index1, Index2: Integer); -begin - if Cardinal(Index1) >= Cardinal(FCount) then - Error(SListIndexError, Index1); - if Cardinal(Index2) >= Cardinal(FCount) then - Error(SListIndexError, Index2); - Changing; - ExchangeItems(Index1, Index2); - Changed; -end; - -procedure TUnicodeStringList.ExchangeItems(Index1, Index2: Integer); -var - Temp: TUnicodeStringItem; -begin - Temp := FList[Index1]; - FList[Index1] := FList[Index2]; - FList[Index2] := Temp; -end; - -function TUnicodeStringList.Find(const S: UnicodeString; var Index: Integer): Boolean; -var - L, H, I, C: Integer; -begin - Result := False; - L := 0; - H := FCount - 1; - while L <= H do - begin - I := (L + H) shr 1; - C := WideCompareText(FList[I].FString, S); - if C < 0 then - L := I+1 - else - begin - H := I - 1; - if C = 0 then - begin - Result := True; - if Duplicates <> dupAccept then - L := I; - end; - end; - end; - Index := L; -end; - -function TUnicodeStringList.Get(Index: Integer): UnicodeString; -{$IFDEF OWN_UnicodeString_MEMMGR} -var - Len: Integer; -{$ENDIF OWN_UnicodeString_MEMMGR} -begin - if Cardinal(Index) >= Cardinal(FCount) then - Error(SListIndexError, Index); - {$IFDEF OWN_UnicodeString_MEMMGR} - with FList[Index] do - begin - Len := Length(TDynWideCharArray(FString)); - if Len > 0 then - begin - SetLength(Result, Len - 1); // exclude #0 - if Result <> '' then - System.Move(FString^, Result[1], Len * SizeOf(WideChar)); - end - else - Result := ''; - end; - {$ELSE} - Result := FList[Index].FString; - {$ENDIF OWN_UnicodeString_MEMMGR} -end; - -function TUnicodeStringList.GetCapacity: Integer; -begin - Result := Length(FList); -end; - -function TUnicodeStringList.GetCount: Integer; -begin - Result := FCount; -end; - -function TUnicodeStringList.GetObject(Index: Integer): TObject; -begin - if Cardinal(Index) >= Cardinal(FCount) then - Error(SListIndexError, Index); - Result := FList[Index].FObject; -end; - -procedure TUnicodeStringList.Grow; -var - Delta, - Len: Integer; -begin - Len := Length(FList); - if Len > 64 then - Delta := Len div 4 - else - begin - if Len > 8 then - Delta := 16 - else - Delta := 4; - end; - SetCapacity(Len + Delta); -end; - -function TUnicodeStringList.IndexOf(const S: UnicodeString): Integer; -begin - if not Sorted then - Result := inherited IndexOf(S) - else - if not Find(S, Result) then - Result := -1; -end; - -procedure TUnicodeStringList.Insert(Index: Integer; const S: UnicodeString); -begin - if Sorted then - Error(SSortedListError, 0); - if Cardinal(Index) > Cardinal(FCount) then - Error(SListIndexError, Index); - InsertItem(Index, S); -end; - -{$IFDEF OWN_UnicodeString_MEMMGR} -procedure TUnicodeStringList.SetListString(Index: Integer; const S: UnicodeString); -var - Len: Integer; - A: TDynWideCharArray; -begin - with FList[Index] do - begin - Pointer(A) := TDynWideCharArray(FString); - if A <> nil then - A := nil; // free memory - - Len := Length(S); - if Len > 0 then - begin - SetLength(A, Len + 1); // include #0 - System.Move(S[1], A[0], Len * SizeOf(WideChar)); - A[Len] := #0; - end; - - FString := PWideChar(A); - Pointer(A) := nil; // do not release the array on procedure exit - end; -end; -{$ENDIF OWN_UnicodeString_MEMMGR} - -procedure TUnicodeStringList.InsertItem(Index: Integer; const S: UnicodeString); -begin - Changing; - if FCount = Length(FList) then - Grow; - if Index < FCount then - System.Move(FList[Index], FList[Index + 1], (FCount - Index) * SizeOf(TUnicodeStringItem)); - with FList[Index] do - begin - Pointer(FString) := nil; // avoid freeing the string, the address is now used in another element - FObject := nil; - {$IFDEF OWN_UnicodeString_MEMMGR} - SetListString(Index, S); - {$ELSE} - FString := S; - {$ENDIF OWN_UnicodeString_MEMMGR} - end; - Inc(FCount); - Changed; -end; - -procedure TUnicodeStringList.Put(Index: Integer; const S: UnicodeString); -begin - if Sorted then - Error(SSortedListError, 0); - if Cardinal(Index) >= Cardinal(FCount) then - Error(SListIndexError, Index); - Changing; - - {$IFDEF OWN_UnicodeString_MEMMGR} - SetListString(Index, S); - {$ELSE} - FList[Index].FString := S; - {$ENDIF OWN_UnicodeString_MEMMGR} - Changed; -end; - -procedure TUnicodeStringList.PutObject(Index: Integer; AObject: TObject); -begin - if Cardinal(Index) >= Cardinal(FCount) then - Error(SListIndexError, Index); - Changing; - FList[Index].FObject := AObject; - Changed; -end; - -procedure TUnicodeStringList.QuickSort(L, R: Integer); -var - I, J: Integer; - P: UnicodeString; -begin - repeat - I := L; - J := R; - P := FList[(L + R) shr 1].FString; - repeat - while WideCompareText(FList[I].FString, P) < 0 do - Inc(I); - while WideCompareText(FList[J].FString, P) > 0 do - Dec(J); - if I <= J then - begin - ExchangeItems(I, J); - Inc(I); - Dec(J); - end; - until I > J; - if L < J then - QuickSort(L, J); - L := I; - until I >= R; -end; - -procedure TUnicodeStringList.QuickSort(L, R: Integer; SCompare: TUnicodeStringListSortCompare); -var - I, J: Integer; - P: UnicodeString; -begin - repeat - I := L; - J := R; - P := FList[(L + R) shr 1].FString; - repeat - while SCompare(FList[I].FString, P) < 0 do - Inc(I); - while SCompare(FList[J].FString, P) > 0 do - Dec(J); - if I <= J then - begin - ExchangeItems(I, J); - Inc(I); - Dec(J); - end; - until I > J; - if L < J then - QuickSort(L, J); - L := I; - until I >= R; -end; - -procedure TUnicodeStringList.CustomSort(Compare: TUnicodeStringListSortCompare); -begin - if not Sorted and (FCount > 1) then - begin - Changing; - QuickSort(0, FCount - 1, Compare); - Changed; - end; -end; - -procedure TUnicodeStringList.SetCapacity(NewCapacity: Integer); -begin - SetLength(FList, NewCapacity); - if NewCapacity < FCount then - FCount := NewCapacity; -end; - -procedure TUnicodeStringList.SetSorted(Value: Boolean); -begin - if FSorted <> Value then - begin - if Value then - Sort; - FSorted := Value; - end; -end; - -procedure TUnicodeStringList.SetUpdateState(Updating: Boolean); -begin - if Updating then - Changing - else - Changed; -end; - -procedure TUnicodeStringList.Sort; -begin - if not Sorted and (FCount > 1) then - begin - Changing; - QuickSort(0, FCount - 1); - Changed; - end; -end; -{$ENDIF} - -function WStrLen(const Str: PWideChar): Cardinal; -asm - MOV EDX,EDI - MOV EDI,EAX - MOV ECX,0FFFFFFFFH - XOR AX,AX - REPNE SCASW - MOV EAX,0FFFFFFFEH - SUB EAX,ECX - MOV EDI,EDX -end; - -function WStrEnd(const Str: PWideChar): PWideChar; -asm - MOV EDX,EDI - MOV EDI,EAX - MOV ECX,0FFFFFFFFH - XOR AX,AX - REPNE SCASW - LEA EAX,[EDI-2] - MOV EDI,EDX -end; - -function WStrMove(Dest: PWideChar; const Source: PWideChar; Count: Integer): PWideChar; -begin - Result := Dest; - System.Move(Source^, Dest^, Count * SizeOf(WideChar)); -end; - -function WStrCopy(Dest: PWideChar; const Source: PWideChar): PWideChar; -{$IFDEF SYN_COMPILER_16_UP} -begin - Result := SysUtils.StrCopy(Dest, Source) -{$ELSE} -asm - PUSH EDI - PUSH ESI - MOV ESI,EAX - MOV EDI,EDX - MOV ECX,0FFFFFFFFH - XOR AX,AX - REPNE SCASW - NOT ECX - MOV EDI,ESI - MOV ESI,EDX - MOV EDX,ECX - MOV EAX,EDI - SHR ECX,1 - REP MOVSD - MOV ECX,EDX - AND ECX,1 - REP MOVSW - POP ESI - POP EDI -{$ENDIF} -end; - -function WStrLCopy(Dest: PWideChar; const Source: PWideChar; MaxLen: Cardinal): PWideChar; -{$IFDEF SYN_COMPILER_16_UP} -begin - Result := SysUtils.StrLCopy(Dest, Source, MaxLen) -{$ELSE} -asm - PUSH EDI - PUSH ESI - PUSH EBX - MOV ESI,EAX - MOV EDI,EDX - MOV EBX,ECX - XOR AX,AX - TEST ECX,ECX - JZ @@1 - REPNE SCASW - JNE @@1 - Inc ECX -@@1: SUB EBX,ECX - MOV EDI,ESI - MOV ESI,EDX - MOV EDX,EDI - MOV ECX,EBX - SHR ECX,1 - REP MOVSD - MOV ECX,EBX - AND ECX,1 - REP MOVSW - STOSW - MOV EAX,EDX - POP EBX - POP ESI - POP EDI -{$ENDIF} -end; - -function WStrCat(Dest: PWideChar; const Source: PWideChar): PWideChar; -begin - WStrCopy(WStrEnd(Dest), Source); - Result := Dest; -end; - -function WStrScan(const Str: PWideChar; Chr: WideChar): PWideChar; -begin - Result := Str; - while Result^ <> Chr do - begin - if Result^ = #0 then - begin - Result := nil; - Exit; - end; - Inc(Result); - end; -end; - -function WStrAlloc(Size: Cardinal): PWideChar; -begin - Size := SizeOf(WideChar) * Size + SizeOf(Cardinal); - GetMem(Result, Size); - Cardinal(Pointer(Result)^) := Size; - Inc(PByte(Result), SizeOf(Cardinal)); -end; - -function WStrNew(const Str: PWideChar): PWideChar; -var - Size: Cardinal; -begin - if Str = nil then - Result := nil - else - begin - Size := WStrLen(Str) + 1; - Result := WStrMove(WStrAlloc(Size), Str, Size); - end; -end; - -procedure WStrDispose(Str: PWideChar); -begin - if Str <> nil then - begin - Dec(PByte(Str), SizeOf(Cardinal)); - FreeMem(Str, Cardinal(Pointer(Str)^)); - end; -end; - -{$IFNDEF SYN_COMPILER_6_UP} -{$IFDEF MSWINDOWS} -function UnicodeToUtf8(Dest: PAnsiChar; MaxDestBytes: Cardinal; - Source: PWideChar; SourceChars: Cardinal): Cardinal; -var - i, count: Cardinal; - c: Cardinal; -begin - Result := 0; - if Source = nil then Exit; - count := 0; - i := 0; - if Dest <> nil then - begin - 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 // $7F < Source[i] <= $7FF - begin - 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; - end - else - begin - while i < SourceChars do - begin - c := Integer(Source[i]); - Inc(i); - if c > $7F then - begin - if c > $7FF then - Inc(count); - Inc(count); - end; - Inc(count); - end; - end; - Result := count+1; // convert zero based index to byte count -end; - -function Utf8ToUnicode(Dest: PWideChar; MaxDestChars: Cardinal; - Source: PAnsiChar; SourceBytes: Cardinal): Cardinal; -var - i, count: Cardinal; - c: Byte; - wc: Cardinal; -begin - if Source = nil then - begin - Result := 0; - Exit; - end; - Result := Cardinal(-1); - count := 0; - i := 0; - if Dest <> nil then - begin - 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 Exit; // incomplete multibyte char - wc := wc and $3F; - if (wc and $20) <> 0 then - begin - c := Byte(Source[i]); - Inc(i); - if (c and $C0) <> $80 then Exit; // malformed trail byte or out of range char - if i >= SourceBytes then Exit; // incomplete multibyte char - wc := (wc shl 6) or (c and $3F); - end; - c := Byte(Source[i]); - Inc(i); - if (c and $C0) <> $80 then Exit; // malformed trail byte - - 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; - end - else - begin - while (i < SourceBytes) do - begin - c := Byte(Source[i]); - Inc(i); - if (c and $80) <> 0 then - begin - if i >= SourceBytes then Exit; // incomplete multibyte char - c := c and $3F; - if (c and $20) <> 0 then - begin - c := Byte(Source[i]); - Inc(i); - if (c and $C0) <> $80 then Exit; // malformed trail byte or out of range char - if i >= SourceBytes then Exit; // incomplete multibyte char - end; - c := Byte(Source[i]); - Inc(i); - if (c and $C0) <> $80 then Exit; // malformed trail byte - end; - Inc(count); - end; - end; - Result := count+1; -end; - -function Utf8Encode(const WS: UnicodeString): UTF8String; -var - L: Integer; - Temp: UTF8String; -begin - Result := ''; - if WS = '' then Exit; - SetLength(Temp, Length(WS) * 3); // SetLength includes space for null terminator - - L := UnicodeToUtf8(PAnsiChar(Temp), Length(Temp)+1, PWideChar(WS), Length(WS)); - if L > 0 then - SetLength(Temp, L-1) - else - Temp := ''; - Result := Temp; -end; - -function Utf8Decode(const S: UTF8String): UnicodeString; -var - L: Integer; - Temp: UnicodeString; -begin - Result := ''; - if S = '' then Exit; - SetLength(Temp, Length(S)); - - L := Utf8ToUnicode(PWideChar(Temp), Length(Temp)+1, PAnsiChar(S), Length(S)); - if L > 0 then - SetLength(Temp, L-1) - else - Temp := ''; - Result := Temp; -end; - -function AnsiToUtf8(const S: string): UTF8String; -begin - Result := Utf8Encode(S); -end; - -function Utf8ToAnsi(const S: UTF8String): string; -begin - Result := Utf8Decode(S); -end; - -function DumbItDownFor95(const S1, S2: UnicodeString; CmpFlags: Integer): Integer; -var - a1, a2: AnsiString; -begin - a1 := s1; - a2 := s2; - Result := CompareStringA(LOCALE_USER_DEFAULT, CmpFlags, PAnsiChar(a1), - Length(a1), PAnsiChar(a2), Length(a2)) - 2; -end; - -function WideCompareStr(const S1, S2: UnicodeString): Integer; -begin - SetLastError(0); - Result := CompareStringW(LOCALE_USER_DEFAULT, 0, PWideChar(S1), Length(S1), - PWideChar(S2), Length(S2)) - 2; - case GetLastError of - 0: ; - ERROR_CALL_NOT_IMPLEMENTED: Result := DumbItDownFor95(S1, S2, 0); - else - RaiseLastWin32Error; - end; -end; - -function WideCompareText(const S1, S2: UnicodeString): Integer; -begin - SetLastError(0); - Result := CompareStringW(LOCALE_USER_DEFAULT, NORM_IGNORECASE, PWideChar(S1), - Length(S1), PWideChar(S2), Length(S2)) - 2; - case GetLastError of - 0: ; - ERROR_CALL_NOT_IMPLEMENTED: Result := DumbItDownFor95(S1, S2, NORM_IGNORECASE); - else - RaiseLastWin32Error; - end; -end; -{$ENDIF} -{$ENDIF} - -{$IFDEF MSWINDOWS} -// The Win9X fix for SynWideUpperCase and SynWideLowerCase was taken -// from Troy Wolbrinks, TntUnicode-package. - -function WCharUpper(lpsz: PWideChar): PWideChar; -var - AStr: AnsiString; - WStr: UnicodeString; -begin - if Win32PlatformIsUnicode then - Result := Windows.CharUpperW(lpsz) - else - begin - if HiWord(Cardinal(lpsz)) = 0 then - begin - // literal char mode - Result := lpsz; - if IsWideCharMappableToAnsi(WideChar(lpsz)) then - begin - AStr := AnsiString(WideChar(lpsz)); // single character may be more than one byte - Windows.CharUpperA(PAnsiChar(AStr)); - WStr := UnicodeString(AStr); // should always be single wide char - if Length(WStr) = 1 then - Result := PWideChar(WStr[1]); - end - end - else - begin - // null-terminated string mode - Result := lpsz; - while lpsz^ <> #0 do - begin - lpsz^ := WideChar(SynUnicode.WCharUpper(PWideChar(lpsz^))); - Inc(lpsz); - end; - end; - end; -end; - -function WCharUpperBuff(lpsz: PWideChar; cchLength: DWORD): DWORD; -var - i: Integer; -begin - if Win32PlatformIsUnicode then - Result := Windows.CharUpperBuffW(lpsz, cchLength) - else - begin - Result := cchLength; - for i := 1 to cchLength do - begin - lpsz^ := WideChar(SynUnicode.WCharUpper(PWideChar(lpsz^))); - Inc(lpsz); - end; - end; -end; - -function WCharLower(lpsz: PWideChar): PWideChar; -var - AStr: AnsiString; - WStr: UnicodeString; -begin - if Win32PlatformIsUnicode then - Result := Windows.CharLowerW(lpsz) - else - begin - if HiWord(Cardinal(lpsz)) = 0 then - begin - // literal char mode - Result := lpsz; - if IsWideCharMappableToAnsi(WideChar(lpsz)) then - begin - AStr := AnsiString(WideChar(lpsz)); // single character may be more than one byte - Windows.CharLowerA(PAnsiChar(AStr)); - WStr := UnicodeString(AStr); // should always be single wide char - if Length(WStr) = 1 then - Result := PWideChar(WStr[1]); - end - end - else - begin - // null-terminated string mode - Result := lpsz; - while lpsz^ <> #0 do - begin - lpsz^ := WideChar(SynUnicode.WCharLower(PWideChar(lpsz^))); - Inc(lpsz); - end; - end; - end; -end; - -function WCharLowerBuff(lpsz: PWideChar; cchLength: DWORD): DWORD; -var - i: Integer; -begin - if Win32PlatformIsUnicode then - Result := Windows.CharLowerBuffW(lpsz, cchLength) - else - begin - Result := cchLength; - for i := 1 to cchLength do - begin - lpsz^ := WideChar(SynUnicode.WCharLower(PWideChar(lpsz^))); - Inc(lpsz); - end; - end; -end; - -function SynWideUpperCase(const S: UnicodeString): UnicodeString; -var - Len: Integer; -begin - Len := Length(S); - SetString(Result, PWideChar(S), Len); - if Len > 0 then - SynUnicode.WCharUpperBuff(Pointer(Result), Len); -end; - -function SynWideLowerCase(const S: UnicodeString): UnicodeString; -var - Len: Integer; -begin - Len := Length(S); - SetString(Result, PWideChar(S), Len); - if Len > 0 then - SynUnicode.WCharLowerBuff(Pointer(Result), Len); -end; -{$ELSE} -function SynWideUpperCase(const S: UnicodeString): UnicodeString; -begin - Result := WideUpperCase(S); -end; - -function SynWideLowerCase(const S: UnicodeString): UnicodeString; -begin - Result := WideLowerCase(S); -end; -{$ENDIF} - -{$IFDEF MSWINDOWS} -function SynIsCharAlpha(const C: WideChar): Boolean; -begin - if Win32PlatformIsUnicode then - Result := IsCharAlphaW(C) - else - // returns false if C is not mappable to ANSI - Result := IsCharAlphaA(AnsiChar(C)); -end; - -function SynIsCharAlphaNumeric(const C: WideChar): Boolean; -begin - if Win32PlatformIsUnicode then - Result := IsCharAlphaNumericW(C) - else - // returns false if C is not mappable to ANSI - Result := IsCharAlphaNumericA(AnsiChar(C)); -end; -{$ELSE} -function SynIsCharAlpha(const C: WideChar): Boolean; -begin - Result := IsAlpha(Integer(ch)) <> 0; -end; - -function SynIsCharAlphaNumeric(const C: WideChar): Boolean; -begin - Result := IsAlNum(Integer(ch)) <> 0; -end; -{$ENDIF} - -{$IFNDEF UNICODE} -function CharInSet(C: AnsiChar; const CharSet: TSysCharSet): Boolean; -begin - Result := C in CharSet; -end; - -function CharInSet(C: WideChar; const CharSet: TSysCharSet): Boolean; -begin - Result := (C < #$0100) and (AnsiChar(C) in CharSet); -end; -{$ENDIF} - -function WideLastDelimiter(const Delimiters, S: UnicodeString): Integer; -var - P: PWideChar; -begin - Result := Length(S); - P := PWideChar(Delimiters); - while Result > 0 do - begin - if (S[Result] <> #0) and (WStrScan(P, S[Result]) <> nil) then - Exit; - Dec(Result); - end; -end; - -function UnicodeStringReplace(const S, OldPattern, NewPattern: UnicodeString; - Flags: TReplaceFlags): UnicodeString; -var - SearchStr, Patt, NewStr: UnicodeString; - Offset: Integer; -begin - if rfIgnoreCase in Flags then - begin - SearchStr := SynWideUpperCase(S); - Patt := SynWideUpperCase(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; - -const - // data used to bring UTF-16 coded strings into correct UTF-32 order for correct comparation - UTF16Fixup: array[0..31] of Word = ( - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - $2000, $F800, $F800, $F800, $F800 - ); - -// Binary comparation of Str1 and Str2 with surrogate fix-up. -// Returns < 0 if Str1 is smaller in binary order than Str2, = 0 if both strings are -// equal and > 0 if Str1 is larger than Str2. -// -// This code is based on an idea of Markus W. Scherer (IBM). -// Note: The surrogate fix-up is necessary because some single value code points have -// larger values than surrogates which are in UTF-32 actually larger. -function WStrComp(Str1, Str2: PWideChar): Integer; -var - C1, C2: Word; - Run1, Run2: PWideChar; -begin - Run1 := Str1; - Run2 := Str2; - repeat - C1 := Word(Run1^); - C1 := Word(C1 + UTF16Fixup[C1 shr 11]); - C2 := Word(Run2^); - C2 := Word(C2 + UTF16Fixup[C2 shr 11]); - - // now C1 and C2 are in UTF-32-compatible order - Result := Integer(C1) - Integer(C2); - if(Result <> 0) or (C1 = 0) or (C2 = 0) then - Break; - Inc(Run1); - Inc(Run2); - until False; - - // If the strings have different lengths but the comparation returned equity so far - // then adjust the result so that the longer string is marked as the larger one. - if Result = 0 then - Result := (Run1 - Str1) - (Run2 - Str2); -end; - -// compares strings up to MaxLen code points -// see also StrCompW -function WStrLComp(Str1, Str2: PWideChar; MaxLen: Cardinal): Integer; -var - C1, C2: Word; -begin - if MaxLen > 0 then - begin - repeat - C1 := Word(Str1^); - C1 := Word(C1 + UTF16Fixup[C1 shr 11]); - C2 := Word(Str2^); - C2 := Word(C2 + UTF16Fixup[C2 shr 11]); - - // now C1 and C2 are in UTF-32-compatible order - { TODO : surrogates take up 2 words and are counted twice here, count them only once } - Result := Integer(C1) - Integer(C2); - Dec(MaxLen); - if(Result <> 0) or (C1 = 0) or (C2 = 0) or (MaxLen = 0) then - Break; - Inc(Str1); - Inc(Str2); - until False; - end - else - Result := 0; -end; - -// exchanges in each character of the given string the low order and high order -// byte to go from LSB to MSB and vice versa. -// EAX contains address of string -procedure StrSwapByteOrder(Str: PWideChar); -{$IFDEF SYN_COMPILER_16_UP} -var - P: PWord; -begin - P := PWord(Str); - while P^ <> 0 do - begin - P^ := MakeWord(HiByte(P^), LoByte(P^)); - Inc(P); - end; -{$ELSE} -asm - PUSH ESI - PUSH EDI - MOV ESI, EAX - MOV EDI, ESI - XOR EAX, EAX // clear high order byte to be able to use 32bit operand below -@@1: - LODSW - OR EAX, EAX - JZ @@2 - XCHG AL, AH - STOSW - JMP @@1 - - -@@2: - POP EDI - POP ESI -{$ENDIF} -end; - -// works like QuotedStr from SysUtils.pas but can insert any quotation character -function WideQuotedStr(const S: UnicodeString; Quote: WideChar): UnicodeString; -var - P, Src, - Dest: PWideChar; - AddCount: Integer; -begin - AddCount := 0; - P := WStrScan(PWideChar(S), Quote); - while (P <> nil) do - begin - Inc(P); - Inc(AddCount); - P := WStrScan(P, Quote); - end; - - if AddCount = 0 then - Result := Quote + S + Quote - else - begin - SetLength(Result, Length(S) + AddCount + 2); - Dest := PWideChar(Result); - Dest^ := Quote; - Inc(Dest); - Src := PWideChar(S); - P := WStrScan(Src, Quote); - repeat - Inc(P); - Move(Src^, Dest^, 2 * (P - Src)); - Inc(Dest, P - Src); - Dest^ := Quote; - Inc(Dest); - Src := P; - P := WStrScan(Src, Quote); - until P = nil; - P := WStrEnd(Src); - Move(Src^, Dest^, 2 * (P - Src)); - Inc(Dest, P - Src); - Dest^ := Quote; - end; -end; - -// extracts a string enclosed in quote characters given by Quote -function WideExtractQuotedStr(var Src: PWideChar; Quote: WideChar): UnicodeString; -var - P, Dest: PWideChar; - DropCount: Integer; -begin - Result := ''; - if (Src = nil) or (Src^ <> Quote) then - Exit; - - Inc(Src); - DropCount := 1; - P := Src; - Src := WStrScan(Src, Quote); - - while Src <> nil do // count adjacent pairs of quote chars - begin - Inc(Src); - if Src^ <> Quote then - Break; - Inc(Src); - Inc(DropCount); - Src := WStrScan(Src, Quote); - end; - - if Src = nil then - Src := WStrEnd(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 := PWideChar(Result); - Src := WStrScan(P, Quote); - while Src <> nil do - begin - Inc(Src); - if Src^ <> Quote then - Break; - Move(P^, Dest^, 2 * (Src - P)); - Inc(Dest, Src - P); - Inc(Src); - P := Src; - Src := WStrScan(Src, Quote); - end; - if Src = nil then - Src := WStrEnd(P); - Move(P^, Dest^, 2 * (Src - P - 1)); - end; -end; - -// returns a string of Count characters filled with C -function UnicodeStringOfChar(C: WideChar; Count: Cardinal): UnicodeString; -var - I: Integer; -begin - SetLength(Result, Count); - for I := 1 to Count do - Result[I] := C; -end; - -function WideTrim(const S: UnicodeString): UnicodeString; -var - I, L: Integer; -begin - L := Length(S); - I := 1; - while (I <= L) and (S[I] <= ' ') do Inc(I); - if I > L then - Result := '' - else - begin - while S[L] <= ' ' do Dec(L); - Result := Copy(S, I, L - I + 1); - end; -end; - -function WideTrimLeft(const S: UnicodeString): UnicodeString; -var - I, L: Integer; -begin - L := Length(S); - I := 1; - while (I <= L) and (S[I] <= ' ') do Inc(I); - Result := Copy(S, I, Maxint); -end; - -function WideTrimRight(const S: UnicodeString): UnicodeString; -var - I: Integer; -begin - I := Length(S); - while (I > 0) and (S[I] <= ' ') do Dec(I); - Result := Copy(S, 1, I); -end; - -{$IFDEF MSWINDOWS} -function TranslateCharsetInfoEx(lpSrc: PDWORD; var lpCs: TCharsetInfo; dwFlags: DWORD): BOOL; stdcall; - external 'gdi32.dll' name 'TranslateCharsetInfo'; - -function CharSetFromLocale(Language: LCID): TFontCharSet; -var - CP: Cardinal; - CSI: TCharsetInfo; -begin - CP:= CodePageFromLocale(Language); - TranslateCharsetInfoEx(Pointer(CP), CSI, TCI_SRCCODEPAGE); - Result:= CSI.ciCharset; -end; - -// determines the code page for a given locale -function CodePageFromLocale(Language: LCID): Integer; -var - Buf: array[0..6] of Char; -begin - GetLocaleInfo(Language, LOCALE_IDefaultAnsiCodePage, Buf, 6); - Result := StrToIntDef(Buf, GetACP); -end; - -function KeyboardCodePage: Word; -begin - Result := CodePageFromLocale(GetKeyboardLayout(0) and $FFFF); -end; - -// converts the given character (as it comes with a WM_CHAR message) into its -// corresponding Unicode character depending on the active keyboard layout -function KeyUnicode(C: AnsiChar): WideChar; -begin - MultiByteToWideChar(KeyboardCodePage, MB_USEGLYPHCHARS, @C, 1, @Result, 1); -end; - -function StringToUnicodeStringEx(const S: AnsiString; CodePage: Word): UnicodeString; -var - InputLength, - OutputLength: Integer; -begin - InputLength := Length(S); - OutputLength := MultiByteToWideChar(CodePage, 0, PAnsiChar(S), InputLength, - nil, 0); - SetLength(Result, OutputLength); - MultiByteToWideChar(CodePage, 0, PAnsiChar(S), InputLength, PWideChar(Result), - OutputLength); -end; - -function UnicodeStringToStringEx(const WS: UnicodeString; CodePage: Word): AnsiString; -var - InputLength, - OutputLength: Integer; -begin - InputLength := Length(WS); - OutputLength := WideCharToMultiByte(CodePage, 0, PWideChar(WS), InputLength, - nil, 0, nil, nil); - SetLength(Result, OutputLength); - WideCharToMultiByte(CodePage, 0, PWideChar(WS), InputLength, PAnsiChar(Result), - OutputLength, nil, nil); -end; -{$ENDIF} - -function GetTextSize(DC: HDC; Str: PWideChar; Count: Integer): TSize; -{$IFDEF SYN_UNISCRIBE} -const - SSAnalyseFlags = SSA_GLYPHS or SSA_FALLBACK or SSA_LINK; -{$ENDIF} -var - tm: TTextMetricA; - {$IFDEF SYN_UNISCRIBE} - GlyphBufferSize: Integer; - saa: TScriptStringAnalysis; - lpSize: PSize; - {$ENDIF} -begin - Result.cx := 0; - Result.cy := 0; - -{$IFDEF SYN_UNISCRIBE} - if Usp10IsInstalled then - begin - if Count <= 0 then Exit; - - // According to the MS Windows SDK (1.5 * Count + 16) is the recommended - // value for GlyphBufferSize (see documentation of cGlyphs parameter of - // ScriptStringAnalyse function) - GlyphBufferSize := (3 * Count) div 2 + 16; - - if Succeeded(ScriptStringAnalyse(DC, Str, Count, GlyphBufferSize, -1, - SSAnalyseFlags, 0, nil, nil, nil, nil, nil, @saa)) then - begin - lpSize := ScriptString_pSize(saa); - if lpSize <> nil then - begin - Result := lpSize^; - if Result.cx = 0 then - begin - GetTextMetricsA(DC, tm); - Result.cx := tm.tmAveCharWidth; - end; - end; - ScriptStringFree(@saa); - end; - end - else -{$ENDIF} - begin - GetTextExtentPoint32W(DC, Str, Count, Result); - if not Win32PlatformIsUnicode then - begin - GetTextMetricsA(DC, tm); - if tm.tmPitchAndFamily and TMPF_TRUETYPE <> 0 then - Result.cx := Result.cx - tm.tmOverhang - else - Result.cx := tm.tmAveCharWidth * Count; - end; - end; -end; - -type - TAccessCanvas = class(TCanvas) - end; - -function TextExtent(ACanvas: TCanvas; const Text: UnicodeString): TSize; -begin - with TAccessCanvas(ACanvas) do - begin - RequiredState([csHandleValid, csFontValid]); - Result := GetTextSize(Handle, PWideChar(Text), Length(Text)); - end; -end; - -function TextWidth(ACanvas: TCanvas; const Text: UnicodeString): Integer; -begin - Result := TextExtent(ACanvas, Text).cX; -end; - -function TextHeight(ACanvas: TCanvas; const Text: UnicodeString): Integer; -begin - Result := TextExtent(ACanvas, Text).cY; -end; - -procedure TextOut(ACanvas: TCanvas; X, Y: Integer; const Text: UnicodeString); -begin - with TAccessCanvas(ACanvas) do - begin - Changing; - RequiredState([csHandleValid, csFontValid, csBrushValid]); - if CanvasOrientation = coRightToLeft then - Inc(X, SynUnicode.TextWidth(ACanvas, Text) + 1); - Windows.ExtTextOutW(Handle, X, Y, TextFlags, nil, PWideChar(Text), - Length(Text), nil); - MoveTo(X + SynUnicode.TextWidth(ACanvas, Text), Y); - Changed; - end; -end; - -procedure TextRect(ACanvas: TCanvas; Rect: TRect; X, Y: Integer; - const Text: UnicodeString); -var - Options: Longint; -begin - with TAccessCanvas(ACanvas) do - begin - Changing; - RequiredState([csHandleValid, csFontValid, csBrushValid]); - Options := ETO_CLIPPED or TextFlags; - if Brush.Style <> bsClear then - Options := Options or ETO_OPAQUE; - if ((TextFlags and ETO_RTLREADING) <> 0) and - (CanvasOrientation = coRightToLeft) - then - Inc(X, SynUnicode.TextWidth(ACanvas, Text) + 1); - Windows.ExtTextOutW(Handle, X, Y, Options, @Rect, PWideChar(Text), - Length(Text), nil); - Changed; - end; -end; - -{$IFNDEF UNICODE} -{ TWideFileStream } - -constructor TWideFileStream.Create(const FileName: UnicodeString; Mode: Word); -begin -{$IFDEF MSWINDOWS} - Create(Filename, Mode, 0); -{$ELSE} - Create(Filename, Mode, FileAccessRights); -{$ENDIF} -end; - -constructor TWideFileStream.Create(const FileName: UnicodeString; Mode: Word; - Rights: Cardinal); -{$IFDEF USE_TNT_RUNTIME_SUPPORT} -var - ErrorMessage: UnicodeString; -{$ENDIF} -begin - if ((Mode and fmCreate) = fmCreate) then - begin - inherited Create(WideFileCreate(FileName, Rights)); - if Handle < 0 then - begin -{$IFDEF USE_TNT_RUNTIME_SUPPORT} - {$IFDEF SYN_COMPILER_7_UP} - ErrorMessage := WideSysErrorMessage(GetLastError); - raise EWideFCreateError.CreateResFmt(PResStringRec(@SFCreateErrorEx), - [WideExpandFileName(FileName), ErrorMessage]); - {$ELSE} - raise EWideFCreateError.CreateResFmt(@SFCreateError, [FileName]); - {$ENDIF} -{$ELSE} - {$IFDEF SYN_COMPILER_7_UP} - raise EFCreateError.CreateResFmt(PResStringRec(@SFCreateErrorEx), - [ExpandFileName(FileName), SysErrorMessage(GetLastError)]); - {$ELSE} - raise EFCreateError.CreateResFmt(PResStringRec(@SFCreateError), [FileName]); - {$ENDIF} -{$ENDIF} - end - end - else - begin - inherited Create(WideFileOpen(FileName, Mode)); - if Handle < 0 then - begin -{$IFDEF USE_TNT_RUNTIME_SUPPORT} - {$IFDEF SYN_COMPILER_7_UP} - ErrorMessage := WideSysErrorMessage(GetLastError); - raise EWideFOpenError.CreateResFmt(PResStringRec(@SFOpenErrorEx), - [WideExpandFileName(FileName), ErrorMessage]); - {$ELSE} - raise EWideFOpenError.CreateResFmt(@SFOpenError, [FileName]); - {$ENDIF} -{$ELSE} - {$IFDEF SYN_COMPILER_7_UP} - raise EFOpenError.CreateResFmt(PResStringRec(@SFOpenErrorEx), - [ExpandFileName(FileName), SysErrorMessage(GetLastError)]); - {$ELSE} - raise EFOpenError.CreateResFmt(PResStringRec(@SFOpenError), [FileName]); - {$ENDIF} -{$ENDIF} - end; - end; -end; - -destructor TWideFileStream.Destroy; -begin - if Handle >= 0 then FileClose(Handle); - inherited Destroy; -end; - -function WideFileOpen(const FileName: UnicodeString; Mode: LongWord): Integer; -{$IFDEF MSWINDOWS} -const - AccessMode: array[0..2] of LongWord = ( - GENERIC_READ, - GENERIC_WRITE, - GENERIC_READ or GENERIC_WRITE); - ShareMode: array[0..4] of LongWord = ( - 0, - 0, - FILE_SHARE_READ, - FILE_SHARE_WRITE, - FILE_SHARE_READ or FILE_SHARE_WRITE); -begin - Result := -1; - if ((Mode and 3) <= fmOpenReadWrite) and - ((Mode and $F0) <= fmShareDenyNone) then - begin - if Win32PlatformIsUnicode then - Result := Integer(CreateFileW(PWideChar(FileName), AccessMode[Mode and 3], - ShareMode[(Mode and $F0) shr 4], nil, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, 0)) - else - Result := Integer(CreateFileA(PAnsiChar(AnsiString(FileName)), AccessMode[Mode and 3], - ShareMode[(Mode and $F0) shr 4], nil, OPEN_EXISTING, - FILE_ATTRIBUTE_NORMAL, 0)); - end; -end; -{$ENDIF} -{$IFDEF SYN_LINUX} -const - ShareMode: array[0..fmShareDenyNone shr 4] of Byte = ( - 0, //No share mode specified - F_WRLCK, //fmShareExclusive - F_RDLCK, //fmShareDenyWrite - 0); //fmShareDenyNone -var - FileHandle, Tvar: Integer; - LockVar: TFlock; - smode: Byte; -begin - Result := -1; - if FileExists(FileName) and - ((Mode and 3) <= fmOpenReadWrite) and - ((Mode and $F0) <= fmShareDenyNone) then - begin - FileHandle := open(PChar(AnsiString(FileName)), (Mode and 3), FileAccessRights); - - if FileHandle = -1 then Exit; - - smode := Mode and $F0 shr 4; - if ShareMode[smode] <> 0 then - begin - with LockVar do - begin - l_whence := SEEK_SET; - l_start := 0; - l_len := 0; - l_type := ShareMode[smode]; - end; - Tvar := fcntl(FileHandle, F_SETLK, LockVar); - if Tvar = -1 then - begin - __close(FileHandle); - Exit; - end; - end; - Result := FileHandle; - end; -end; -{$ENDIF} - -function WideFileCreate(const FileName: UnicodeString): Integer; -{$IFDEF MSWINDOWS} -begin - if Win32PlatformIsUnicode then - Result := Integer(CreateFileW(PWideChar(FileName), GENERIC_READ or GENERIC_WRITE, - 0, nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0)) - else - Result := Integer(CreateFileA(PAnsiChar(AnsiString(FileName)), GENERIC_READ or GENERIC_WRITE, - 0, nil, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, 0)); -end; -{$ENDIF} -{$IFDEF SYN_LINUX} -begin - Result := FileCreate(FileName, FileAccessRights); -end; -{$ENDIF} - -function WideFileCreate(const FileName: UnicodeString; Rights: Integer): Integer; -{$IFDEF MSWINDOWS} -begin - Result := WideFileCreate(FileName); -end; -{$ENDIF} -{$IFDEF SYN_LINUX} -begin - Result := Integer(open(PChar(AnsiString(FileName)), O_RDWR or O_CREAT or O_TRUNC, Rights)); -end; -{$ENDIF} -{$ENDIF} - -function IsAnsiOnly(const WS: UnicodeString): Boolean; -{$IFDEF MSWINDOWS} -begin - Result := IsUnicodeStringMappableToAnsi(WS); -end; -{$ELSE} -var - Run: PWideChar; -begin - Run := PWideChar(WS); - while Run^ in [WideChar(#1)..WideChar(#255)] do - Inc(Run); - Result := Run^ = WideNull; -end; -{$ENDIF} - -function IsUTF8(const FileName: UnicodeString; out WithBOM: Boolean): Boolean; -var - Stream: TStream; -begin - Stream := TWideFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); - try - Result := IsUTF8(Stream, WithBOM); - finally - Stream.Free; - end; -end; - -// checks for a BOM in UTF-8 format or searches the first 4096 bytes for -// typical UTF-8 octet sequences -function IsUTF8(Stream: TStream; out WithBOM: Boolean): Boolean; -const - MinimumCountOfUTF8Strings = 1; - MaxBufferSize = $4000; -var - Buffer: array of Byte; - BufferSize, i, FoundUTF8Strings: Integer; - - // 3 trailing bytes are the maximum in valid UTF-8 streams, - // so a count of 4 trailing bytes is enough to detect invalid UTF-8 streams - function CountOfTrailingBytes: Integer; - begin - Result := 0; - Inc(i); - while (i < BufferSize) and (Result < 4) do - begin - if Buffer[i] in [$80..$BF] then - Inc(Result) - else - Break; - Inc(i); - end; - end; - -begin - // if Stream is nil, let Delphi raise the exception, by accessing Stream, - // to signal an invalid result - - // start analysis at actual Stream.Position - BufferSize := Min(MaxBufferSize, Stream.Size - Stream.Position); - - // if no special characteristics are found it is not UTF-8 - Result := False; - WithBOM := False; - - if BufferSize > 0 then - begin - SetLength(Buffer, BufferSize); - Stream.ReadBuffer(Buffer[0], BufferSize); - Stream.Seek(-BufferSize, soFromCurrent); - - { first search for BOM } - - if (BufferSize >= Length(UTF8BOM)) and CompareMem(@Buffer[0], @UTF8BOM[0], Length(UTF8BOM)) then - begin - WithBOM := True; - Result := True; - Exit; - end; - - { If no BOM was found, check for leading/trailing byte sequences, - which are uncommon in usual non UTF-8 encoded text. - - NOTE: There is no 100% save way to detect UTF-8 streams. The bigger - MinimumCountOfUTF8Strings, the lower is the probability of - a false positive. On the other hand, a big MinimumCountOfUTF8Strings - makes it unlikely to detect files with only little usage of non - US-ASCII chars, like usual in European languages. } - - FoundUTF8Strings := 0; - i := 0; - while i < BufferSize do - begin - case Buffer[i] of - $00..$7F: // skip US-ASCII characters as they could belong to various charsets - ; - $C2..$DF: - if CountOfTrailingBytes = 1 then - Inc(FoundUTF8Strings) - else - Break; - $E0: - begin - Inc(i); - if (i < BufferSize) and (Buffer[i] in [$A0..$BF]) and (CountOfTrailingBytes = 1) then - Inc(FoundUTF8Strings) - else - Break; - end; - $E1..$EC, $EE..$EF: - if CountOfTrailingBytes = 2 then - Inc(FoundUTF8Strings) - else - Break; - $ED: - begin - Inc(i); - if (i < BufferSize) and (Buffer[i] in [$80..$9F]) and (CountOfTrailingBytes = 1) then - Inc(FoundUTF8Strings) - else - Break; - end; - $F0: - begin - Inc(i); - if (i < BufferSize) and (Buffer[i] in [$90..$BF]) and (CountOfTrailingBytes = 2) then - Inc(FoundUTF8Strings) - else - Break; - end; - $F1..$F3: - if CountOfTrailingBytes = 3 then - Inc(FoundUTF8Strings) - else - Break; - $F4: - begin - Inc(i); - if (i < BufferSize) and (Buffer[i] in [$80..$8F]) and (CountOfTrailingBytes = 2) then - Inc(FoundUTF8Strings) - else - Break; - end; - $C0, $C1, $F5..$FF: // invalid UTF-8 bytes - Break; - $80..$BF: // trailing bytes are consumed when handling leading bytes, - // any occurence of "orphaned" trailing bytes is invalid UTF-8 - Break; - end; - - if FoundUTF8Strings = MinimumCountOfUTF8Strings then - begin - Result := True; - Break; - end; - - Inc(i); - end; - end; -end; - -function GetEncoding(const FileName: UnicodeString; out WithBOM: Boolean): TSynEncoding; -var - Stream: TStream; -begin - Stream := TWideFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); - try - Result := GetEncoding(Stream, WithBOM); - finally - Stream.Free; - end; -end; - -function GetEncoding(Stream: TStream; out WithBOM: Boolean): TSynEncoding; -var - BOM: WideChar; - Size: Integer; -begin - // if Stream is nil, let Delphi raise the exception, by accessing Stream, - // to signal an invalid result - - // start analysis at actual Stream.Position - Size := Stream.Size - Stream.Position; - - // if no special characteristics are found it is probably ANSI - Result := seAnsi; - - if IsUTF8(Stream, WithBOM) then - begin - Result := seUTF8; - Exit; - end; - - { try to detect UTF-16 by finding a BOM in UTF-16 format } - - if Size >= 2 then - begin - Stream.ReadBuffer(BOM, sizeof(BOM)); - Stream.Seek(-sizeof(BOM), soFromCurrent); - if BOM = WideChar(UTF16BOMLE) then - begin - Result := seUTF16LE; - WithBOM := True; - Exit; - end - else if BOM = WideChar(UTF16BOMBE) then - begin - Result := seUTF16BE; - WithBOM := True; - Exit; - end - end; -end; - -procedure SaveToFile(const WS: UnicodeString; const FileName: UnicodeString; - Encoding: TSynEncoding; WithBom: Boolean = True); -var - Stream: TStream; -begin - Stream := TWideFileStream.Create(FileName, fmCreate); - try - SaveToStream(WS, Stream, Encoding, WithBom); - finally - Stream.Free; - end; -end; - -procedure SaveToFile(UnicodeStrings: TUnicodeStrings; const FileName: UnicodeString; - Encoding: TSynEncoding; WithBom: Boolean = True); -var - Stream: TStream; -begin - Stream := TWideFileStream.Create(FileName, fmCreate); - try - SaveToStream(UnicodeStrings, Stream, Encoding, WithBom); - finally - Stream.Free; - end; -end; - -function LoadFromFile(UnicodeStrings: TUnicodeStrings; const FileName: UnicodeString; - out WithBOM: Boolean): TSynEncoding; -var - Stream: TStream; -begin - Stream := TWideFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); - try - Result := LoadFromStream(UnicodeStrings, Stream, WithBOM); - finally - Stream.Free; - end; -end; - -function LoadFromFile(UnicodeStrings: TUnicodeStrings; const FileName: UnicodeString; - Encoding: TSynEncoding; out WithBOM: Boolean): TSynEncoding; -var - Stream: TStream; -begin - Stream := TWideFileStream.Create(FileName, fmOpenRead or fmShareDenyWrite); - try - Result := LoadFromStream(UnicodeStrings, Stream, Encoding, WithBOM); - finally - Stream.Free; - end; -end; - -procedure SaveToStream(const WS: UnicodeString; Stream: TStream; Encoding: TSynEncoding; - WithBom: Boolean = True); -var - UTF16BOM: UnicodeString; - - UTF8Str: UTF8String; - AnsiStr: AnsiString; -begin - if WithBom then - case Encoding of - seUTF8: - Stream.WriteBuffer(UTF8BOM, 3); - seUTF16LE: - begin - UTF16BOM := BOM_LSB_FIRST; - Stream.WriteBuffer(PWideChar(UTF16BOM)^, 2); - end; - seUTF16BE: - begin - UTF16BOM := BOM_MSB_FIRST; - Stream.WriteBuffer(PWideChar(UTF16BOM)^, 2); - end; - end; - - case Encoding of - seUTF8: - begin - UTF8Str := UTF8Encode(WS); - Stream.WriteBuffer(UTF8Str[1], Length(UTF8Str)); - end; - seUTF16LE: - Stream.WriteBuffer(WS[1], Length(WS) * sizeof(WideChar)); - seUTF16BE: - begin - StrSwapByteOrder(PWideChar(WS)); - Stream.WriteBuffer(WS[1], Length(WS) * sizeof(WideChar)); - end; - seAnsi: - begin - AnsiStr := AnsiString(PWideChar(WS)); - Stream.WriteBuffer(AnsiStr[1], Length(AnsiStr)); - end; - end; -end; - -type - TSynEditStringListAccess = class(TSynEditStringList); - -procedure SaveToStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; - Encoding: TSynEncoding; WithBom: Boolean = True); -var - SText: UnicodeString; - SaveFStreaming: Boolean; -begin - // if UnicodeStrings or Stream is nil, let Delphi raise the exception to flag the error - - if UnicodeStrings is TSynEditStringList then - begin - SaveFStreaming := TSynEditStringListAccess(UnicodeStrings).FStreaming; - TSynEditStringListAccess(UnicodeStrings).FStreaming := True; - SText := UnicodeStrings.Text; - TSynEditStringListAccess(UnicodeStrings).FStreaming := SaveFStreaming; - end - else - SText := UnicodeStrings.Text; - SaveToStream(SText, Stream, Encoding, WithBom); -end; - -function LoadFromStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; - out WithBOM: Boolean): TSynEncoding; -var - Dummy: Boolean; -begin - Result := LoadFromStream(UnicodeStrings, Stream, GetEncoding(Stream, WithBOM), - Dummy); -end; - -function LoadFromStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; - Encoding: TSynEncoding): TSynEncoding; overload; -var - Dummy: Boolean; -begin - Result := LoadFromStream(UnicodeStrings, Stream, Encoding, Dummy); -end; - -function LoadFromStream(UnicodeStrings: TUnicodeStrings; Stream: TStream; - Encoding: TSynEncoding; out WithBOM: Boolean): TSynEncoding; -var - WideStr: UnicodeString; - UTF8Str: UTF8String; - AnsiStr: AnsiString; - Size: Integer; - - function SkipBOM: Boolean; - var - BOM: array of Byte; - begin - Result := False; - case Encoding of - seUTF8: - begin - SetLength(BOM, Min(Length(UTF8BOM), Size)); - Stream.ReadBuffer(BOM[0], Length(BOM)); - if (Length(BOM) <> Length(UTF8BOM)) or - not CompareMem(@BOM[0], @UTF8BOM[0], Length(UTF8BOM)) - then - Stream.Seek(-Length(BOM), {$IFDEF SYN_DELPHI_XE4_UP}soCurrent{$ELSE}soFromCurrent{$ENDIF}) - else - Result := True; - end; - seUTF16LE: - begin - SetLength(BOM, Min(Length(UTF16BOMLE), Size)); - Stream.ReadBuffer(BOM[0], Length(BOM)); - if (Length(BOM) <> Length(UTF16BOMLE)) or - not CompareMem(@BOM[0], @UTF16BOMLE[0], Length(UTF16BOMLE)) - then - Stream.Seek(-Length(BOM), {$IFDEF SYN_DELPHI_XE4_UP}soCurrent{$ELSE}soFromCurrent{$ENDIF}) - else - Result := True; - end; - seUTF16BE: - begin - SetLength(BOM, Min(Length(UTF16BOMBE), Size)); - Stream.ReadBuffer(BOM[0], Length(BOM)); - if (Length(BOM) <> Length(UTF16BOMBE)) or - not CompareMem(@BOM[0], @UTF16BOMBE[0], Length(UTF16BOMBE)) - then - Stream.Seek(-Length(BOM), {$IFDEF SYN_DELPHI_XE4_UP}soCurrent{$ELSE}soFromCurrent{$ENDIF}) - else - Result := True; - end; - end; - Size := Stream.Size - Stream.Position; - end; - -begin - // if UnicodeStrings or Stream is nil, let Delphi raise the exception to - // signal an invalid result - UnicodeStrings.BeginUpdate; - try - Result := Encoding; - // start decoding at actual Stream.Position - Size := Stream.Size - Stream.Position; - - // skip BOM, if it exists - WithBOM := SkipBOM; - - case Result of - seUTF8: - begin - SetLength(UTF8Str, Size); - Stream.ReadBuffer(UTF8Str[1], Size); -{$IFDEF UNICODE} - UnicodeStrings.Text := UTF8ToUnicodeString(UTF8Str); -{$ELSE} - UnicodeStrings.Text := UTF8Decode(UTF8Str); - UnicodeStrings.SaveFormat := sfUTF8; -{$ENDIF} - end; - seUTF16LE: - begin - SetLength(WideStr, Size div 2); - Stream.ReadBuffer(WideStr[1], Size); - UnicodeStrings.Text := WideStr; -{$IFNDEF UNICODE} - UnicodeStrings.SaveFormat := sfUTF16LSB; -{$ENDIF} - end; - seUTF16BE: - begin - SetLength(WideStr, Size div 2); - Stream.ReadBuffer(WideStr[1], Size); - StrSwapByteOrder(PWideChar(WideStr)); - UnicodeStrings.Text := WideStr; -{$IFNDEF UNICODE} - UnicodeStrings.SaveFormat := sfUTF16MSB; -{$ENDIF} - end; - seAnsi: - begin - SetLength(AnsiStr, Size); - Stream.ReadBuffer(AnsiStr[1], Size); - UnicodeStrings.Text := UnicodeString(AnsiStr); -{$IFNDEF UNICODE} - UnicodeStrings.SaveFormat := sfAnsi; -{$ENDIF} - end; - end; - finally - UnicodeStrings.EndUpdate - end -end; - -function ClipboardProvidesText: Boolean; -begin - Result := IsClipboardFormatAvailable(CF_TEXT) or IsClipboardFormatAvailable(CF_UNICODETEXT); -end; - -function GetClipboardText: UnicodeString; -var - Mem: HGLOBAL; - LocaleID: LCID; - P: PByte; -begin - Result := ''; - Clipboard.Open; - try - if Clipboard.HasFormat(CF_UNICODETEXT) then - begin - Mem := Clipboard.GetAsHandle(CF_UNICODETEXT); - try - if Mem <> 0 then - Result := PWideChar(GlobalLock(Mem)); - finally - if Mem <> 0 then GlobalUnlock(Mem); - end; - end - else - begin - LocaleID := 0; - Mem := Clipboard.GetAsHandle(CF_LOCALE); - try - if Mem <> 0 then LocaleID := PInteger(GlobalLock(Mem))^; - finally - if Mem <> 0 then GlobalUnlock(Mem); - end; - - Mem := Clipboard.GetAsHandle(CF_TEXT); - try - if Mem <> 0 then - begin - P := GlobalLock(Mem); - Result := StringToUnicodeStringEx(PAnsiChar(P), CodePageFromLocale(LocaleID)); - end - finally - if Mem <> 0 then GlobalUnlock(Mem); - end; - end; - finally - Clipboard.Close; - end; -end; - -procedure SetClipboardText(const Text: UnicodeString); -var - Mem: HGLOBAL; - P: PByte; - SLen: Integer; -begin - if Text = '' then Exit; - SLen := Length(Text); - Clipboard.Open; - try - Clipboard.Clear; - - // set ANSI text only on Win9X, WinNT automatically creates ANSI from Unicode - if Win32Platform <> VER_PLATFORM_WIN32_NT then - begin - Mem := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE, SLen + 1); - if Mem <> 0 then - begin - P := GlobalLock(Mem); - try - if P <> nil then - begin - Move(PAnsiChar(AnsiString(Text))^, P^, SLen + 1); - Clipboard.SetAsHandle(CF_TEXT, Mem); - end; - finally - GlobalUnlock(Mem); - end; - end; - end; - - // set unicode text, this also works on Win9X, even if the clipboard-viewer - // can't show it, Word 2000+ can paste it including the unicode only characters - Mem := GlobalAlloc(GMEM_MOVEABLE or GMEM_DDESHARE, - (SLen + 1) * sizeof(WideChar)); - if Mem <> 0 then - begin - P := GlobalLock(Mem); - try - if P <> nil then - begin - Move(PWideChar(Text)^, P^, (SLen + 1) * sizeof(WideChar)); - Clipboard.SetAsHandle(CF_UNICODETEXT, Mem); - end; - finally - GlobalUnlock(Mem); - end; - end; - // Don't free Mem! It belongs to the clipboard now, and it will free it - // when it is done with it. - finally - Clipboard.Close; - end; -end; - -{$IFNDEF UNICODE} -{$IFNDEF SYN_COMPILER_6_UP} -procedure AssignWideStr(var Dest: UnicodeString; const Source: UnicodeString); -begin - Dest := Source; -end; - -procedure IntGetWideStrProp(Instance: TObject; PropInfo: PPropInfo; - var Value: UnicodeString); assembler; -asm - { -> EAX Pointer to instance } - { EDX Pointer to property info } - { ECX Pointer to result string } - - PUSH ESI - PUSH EDI - MOV EDI,EDX - - MOV EDX,[EDI].TPropInfo.Index { pass index in EDX } - CMP EDX,$80000000 - JNE @@hasIndex - MOV EDX,ECX { pass value in EDX } -@@hasIndex: - MOV ESI,[EDI].TPropInfo.GetProc - CMP [EDI].TPropInfo.GetProc.Byte[3],$FE - JA @@isField - JB @@isStaticMethod - -@@isVirtualMethod: - MOVSX ESI,SI { sign extend slot offset } - ADD ESI,[EAX] { vmt + slot offset } - CALL DWORD PTR [ESI] - JMP @@exit - -@@isStaticMethod: - CALL ESI - JMP @@exit - -@@isField: - AND ESI,$00FFFFFF - MOV EDX,[EAX+ESI] - MOV EAX,ECX - CALL AssignWideStr - -@@exit: - POP EDI - POP ESI -end; - -function GetWideStrProp(Instance: TObject; PropInfo: PPropInfo): UnicodeString; -begin - IntGetWideStrProp(Instance, PropInfo, Result); -end; - -procedure SetWideStrProp(Instance: TObject; PropInfo: PPropInfo; - const Value: UnicodeString); assembler; -asm - { -> EAX Pointer to instance } - { EDX Pointer to property info } - { ECX Pointer to string value } - - PUSH ESI - PUSH EDI - MOV ESI,EDX - - MOV EDX,[ESI].TPropInfo.Index { pass index in EDX } - CMP EDX,$80000000 - JNE @@hasIndex - MOV EDX,ECX { pass value in EDX } -@@hasIndex: - MOV EDI,[ESI].TPropInfo.SetProc - CMP [ESI].TPropInfo.SetProc.Byte[3],$FE - JA @@isField - JB @@isStaticMethod - -@@isVirtualMethod: - MOVSX EDI,DI - ADD EDI,[EAX] - CALL DWORD PTR [EDI] - JMP @@exit - -@@isStaticMethod: - CALL EDI - JMP @@exit - -@@isField: - AND EDI,$00FFFFFF - ADD EAX,EDI - MOV EDX,ECX - CALL AssignWideStr - -@@exit: - POP EDI - POP ESI -end; -{$ENDIF} - -type - TUnicodeStringPropertyFiler = class - private - FInstance: TPersistent; - FPropInfo: PPropInfo; - procedure ReadData(Reader: TReader); - procedure WriteData(Writer: TWriter); - public - procedure DefineProperties(Filer: TFiler; Instance: TPersistent; PropName: AnsiString); - end; - - TWideCharPropertyFiler = class - private - FInstance: TPersistent; - FPropInfo: PPropInfo; - FWriter: TWriter; - procedure GetLookupInfo(var Ancestor: TPersistent; - var Root, LookupRoot, RootAncestor: TComponent); - procedure ReadData(Reader: TReader); - procedure WriteData(Writer: TWriter); - function ReadChar(Reader: TReader): WideChar; - public - procedure DefineProperties(Filer: TFiler; Instance: TPersistent; PropName: AnsiString); - end; - -type - TGetLookupInfoEvent = procedure(var Ancestor: TPersistent; - var Root, LookupRoot, RootAncestor: TComponent) of object; - -function AncestorIsValid(Ancestor: TPersistent; Root, RootAncestor: TComponent): Boolean; -begin - Result := (Ancestor <> nil) and (RootAncestor <> nil) and - Root.InheritsFrom(RootAncestor.ClassType); -end; - -function IsDefaultOrdPropertyValue(Instance: TObject; PropInfo: PPropInfo; - OnGetLookupInfo: TGetLookupInfoEvent): Boolean; -var - Ancestor: TPersistent; - LookupRoot: TComponent; - RootAncestor: TComponent; - Root: TComponent; - AncestorValid: Boolean; - Value: Longint; - Default: LongInt; -begin - Ancestor := nil; - Root := nil; - LookupRoot := nil; - RootAncestor := nil; - - if Assigned(OnGetLookupInfo) then - OnGetLookupInfo(Ancestor, Root, LookupRoot, RootAncestor); - - AncestorValid := AncestorIsValid(Ancestor, Root, RootAncestor); - - Result := True; - if (PropInfo^.GetProc <> nil) and (PropInfo^.SetProc <> nil) then - begin - Value := GetOrdProp(Instance, PropInfo); - if AncestorValid then - Result := Value = GetOrdProp(Ancestor, PropInfo) - else - begin - Default := PPropInfo(PropInfo)^.Default; - Result := (Default <> LongInt($80000000)) and (Value = Default); - end; - end; -end; - -procedure ReadError(S: string); -begin - raise EReadError.Create(S); -end; - -procedure PropValueError; -begin - ReadError(SInvalidPropertyValue); -end; - -{ TUnicodeStringPropertyFiler } - -procedure TUnicodeStringPropertyFiler.DefineProperties(Filer: TFiler; Instance: TPersistent; - PropName: AnsiString); - - function HasData: Boolean; - var - CurrPropValue: UnicodeString; - begin - // must be stored - Result := IsStoredProp(Instance, FPropInfo); - if Result - and (Filer.Ancestor <> nil) - and (GetPropInfo(Filer.Ancestor, PropName, [tkWString]) <> nil) then - begin - // must be different than ancestor - CurrPropValue := GetWideStrProp(Instance, FPropInfo); - Result := CurrPropValue <> GetWideStrProp(Filer.Ancestor, GetPropInfo(Filer.Ancestor, PropName)); - end; - if Result then - Result := GetWideStrProp(Instance, FPropInfo) <> ''; - end; - -begin - FInstance := Instance; - FPropInfo := GetPropInfo(Instance, PropName, [tkWString]); - if FPropInfo <> nil then - // must be published (and of type UnicodeString) - Filer.DefineProperty(PropName + 'W', ReadData, WriteData, HasData); - FInstance := nil; - FPropInfo := nil; -end; - -procedure TUnicodeStringPropertyFiler.ReadData(Reader: TReader); -begin - case Reader.NextValue of - vaLString, vaString: - SetWideStrProp(FInstance, FPropInfo, Reader.ReadString); - else - SetWideStrProp(FInstance, FPropInfo, Reader.ReadWideString); - end; -end; - -procedure TUnicodeStringPropertyFiler.WriteData(Writer: TWriter); -begin - Writer.WriteWideString(GetWideStrProp(FInstance, FPropInfo)); -end; - -{ TWideCharPropertyFiler } - -procedure TWideCharPropertyFiler.GetLookupInfo(var Ancestor: TPersistent; - var Root, LookupRoot, RootAncestor: TComponent); -begin - Ancestor := FWriter.Ancestor; - Root := FWriter.Root; - LookupRoot := FWriter.LookupRoot; - RootAncestor := FWriter.RootAncestor; -end; - -function TWideCharPropertyFiler.ReadChar(Reader: TReader): WideChar; -var - Temp: UnicodeString; -begin - case Reader.NextValue of - vaWString: - Temp := Reader.ReadWideString; - vaString: - Temp := Reader.ReadString; - else - PropValueError; - end; - - if Length(Temp) > 1 then - PropValueError; - Result := Temp[1]; -end; - -procedure TWideCharPropertyFiler.ReadData(Reader: TReader); -begin - SetOrdProp(FInstance, FPropInfo, Ord(ReadChar(Reader))); -end; - -type - TAccessWriter = class(TWriter) - end; - -procedure TWideCharPropertyFiler.WriteData(Writer: TWriter); -var - L: Integer; - Temp: UnicodeString; -begin - Temp := WideChar(GetOrdProp(FInstance, FPropInfo)); - - TAccessWriter(Writer).WriteValue(vaWString); - L := Length(Temp); - Writer.Write(L, SizeOf(Integer)); - Writer.Write(Pointer(@Temp[1])^, L * 2); -end; - -procedure TWideCharPropertyFiler.DefineProperties(Filer: TFiler; - Instance: TPersistent; PropName: AnsiString); - - function HasData: Boolean; - var - CurrPropValue: Integer; - begin - // must be stored - Result := IsStoredProp(Instance, FPropInfo); - if Result and (Filer.Ancestor <> nil) and - (GetPropInfo(Filer.Ancestor, PropName, [tkWChar]) <> nil) then - begin - // must be different than ancestor - CurrPropValue := GetOrdProp(Instance, FPropInfo); - Result := CurrPropValue <> GetOrdProp(Filer.Ancestor, GetPropInfo(Filer.Ancestor, PropName)); - end; - - if Result and (Filer is TWriter) then - begin - FWriter := TWriter(Filer); - Result := not IsDefaultOrdPropertyValue(Instance, FPropInfo, GetLookupInfo); - end; - end; - -begin - FInstance := Instance; - FPropInfo := GetPropInfo(Instance, PropName, [tkWChar]); - if FPropInfo <> nil then // must be published (and of type WideChar) - begin - // W suffix causes Delphi's native streaming system to ignore the property - // and let us do the reading. - Filer.DefineProperty(PropName + 'W', ReadData, WriteData, HasData); - end; - FInstance := nil; - FPropInfo := nil; -end; - -procedure UnicodeDefineProperties(Filer: TFiler; Instance: TPersistent); -var - I, Count: Integer; - PropInfo: PPropInfo; - PropList: PPropList; - UnicodeStringFiler: TUnicodeStringPropertyFiler; - WideCharFiler: TWideCharPropertyFiler; -begin - Count := GetTypeData(Instance.ClassInfo)^.PropCount; - if Count > 0 then - begin - UnicodeStringFiler := TUnicodeStringPropertyFiler.Create; - try - WideCharFiler := TWideCharPropertyFiler.Create; - try - GetMem(PropList, Count * SizeOf(Pointer)); - try - GetPropInfos(Instance.ClassInfo, PropList); - for I := 0 to Count - 1 do - begin - PropInfo := PropList^[I]; - if (PropInfo = nil) then - Break; - if (PropInfo.PropType^.Kind = tkWString) then - UnicodeStringFiler.DefineProperties(Filer, Instance, PropInfo.Name) - else if (PropInfo.PropType^.Kind = tkWChar) then - WideCharFiler.DefineProperties(Filer, Instance, PropInfo.Name) - end; - finally - FreeMem(PropList, Count * SizeOf(Pointer)); - end; - finally - WideCharFiler.Free; - end; - finally - UnicodeStringFiler.Free; - end; - end; -end; -{$ENDIF} - -{$IFDEF MSWINDOWS} -function IsWideCharMappableToAnsi(const WC: WideChar): Boolean; +function IsWideCharMappableToAnsi(const WC: WideChar): Boolean; var UsedDefaultChar: BOOL; begin @@ -3687,22 +378,9 @@ function IsWideCharMappableToAnsi(const WC: WideChar): Boolean; Result := not UsedDefaultChar; end; -function IsUnicodeStringMappableToAnsi(const WS: UnicodeString): Boolean; -var - UsedDefaultChar: BOOL; -begin - WideCharToMultiByte(DefaultSystemCodePage, 0, PWideChar(WS), Length(WS), nil, 0, - nil, @UsedDefaultChar); - Result := not UsedDefaultChar; -end; -{$ENDIF} - initialization -{$IFDEF MSWINDOWS} - Win32PlatformIsUnicode := (Win32Platform = VER_PLATFORM_WIN32_NT); - {$IFNDEF UNICODE} - DefaultSystemCodePage := GetACP; - {$ENDIF} -{$ENDIF} + Assert(TOSVersion.Check(6), 'Unsupported Windows version. Windows Vista or higher required'); + if LCIDToLocaleName(GetUserDefaultLCID, UserLocaleName, LOCALE_NAME_MAX_LENGTH, 0) = 0 then + RaiseLastOSError; end. diff --git a/Ext/SynEdit/Source/SynUsp10.pas b/Ext/SynEdit/Source/SynUsp10.pas deleted file mode 100644 index f0cda7b..0000000 --- a/Ext/SynEdit/Source/SynUsp10.pas +++ /dev/null @@ -1,2631 +0,0 @@ -{******************************************************************************} -{* *} -{* Copyright (c) Microsoft Corporation. All rights reserved. *} -{* *} -{* File: usp10.h *} -{* Content: USP - Unicode Complex Script processor *} -{* *} -{* Delphi / FreePascal adaptation by Alexey Barkovoy (clootie@clootie.ru) *} -(* *) -{* The original version from Alexey Barkovoy can be downloaded from: *} -{* http://clootie.ru *} -(* *) -(* Dynamic linking logic (similar to what the JCL does) by Maël Hörz. *) -(* *) -(* Latest version can be downloaded from http://mh-nexus.de/unisynedit.htm *) -(* or checked out from the Unicode branch of SynEdit CVS. *) -(* *) -{******************************************************************************} -{ } -{ The contents of this file are used with permission, 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/MPL-1.1.html } -{ } -{ 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. } -{ } -{ Alternatively, the contents of this file may be used under the terms of the } -{ GNU Lesser General Public License (the "LGPL License"), in which case the } -{ provisions of the LGPL License are applicable instead of those above. } -{ If you wish to allow use of your version of this file only under the terms } -{ of the LGPL License and not to allow others to use your version of this file } -{ under the MPL, indicate your decision by deleting the provisions above and } -{ replace them with the notice and other provisions required by the LGPL } -{ License. If you do not delete the provisions above, a recipient may use } -{ your version of this file under either the MPL or the LGPL License. } -{ } -{ For more information about the LGPL: http://www.gnu.org/copyleft/lesser.html } -{ } -{******************************************************************************} - -// $Id: SynUsp10.pas,v 1.1.2.2 2008/09/17 13:59:12 maelh Exp $ - -{$IFDEF FPC} -{$mode objfpc} -{$ENDIF} - -// necessary for dynamic linking -{$STACKFRAMES ON} -{$WARNINGS OFF} - -unit SynUsp10; - -interface - -uses - Windows; - -const - ///// Uniscribe build number - USPBUILD = 0400; - - - - ///// USP - Unicode Complex Script processor - // - // Copyright (c) Microsoft Corporation. All rights reserved. - - - - - ///// SCRIPT - // - // The SCRIPT enum is an opaque type used internally to identify - // which shaping engine functions are used to process a given run. - // - // - SCRIPT_UNDEFINED = 0; - // - //p SCRIPT_UNDEFINED: This is the only public script ordinal. May be - // forced into the eScript field of a SCRIPT_ANALYSIS to disable shaping. - // SCRIPT_UNDEFINED is supported by all fonts - ScriptShape will display - // whatever glyph is defined in the font CMAP table, or, if none, the - // missing glyph. - - - - ///// USP Status Codes - // - USP_E_SCRIPT_NOT_IN_FONT = DWord((SEVERITY_ERROR shl 31) or - (FACILITY_ITF shl 16)) or $200; // MAKE_HRESULT(SEVERITY_ERROR,FACILITY_ITF,0x200) // Script doesn't exist in font - - - - - - - ///// SCRIPT_CACHE - // - // Many script APIs take a combination of HDC and SCRIPT_CACHE parameter. - // - // A SCRIPT_CACHE is an opaque pointer to a Uniscribe font metric cache - // structure. - -type - SCRIPT_CACHE = Pointer; - {$EXTERNALSYM SCRIPT_CACHE} - TScriptCache = SCRIPT_CACHE; - PScriptCache = ^TScriptCache; - - -// The client must allocate and retain one SCRIPT_CACHE variable for each -// character style used. It must be initialised by the client to NULL. -// -// APIs are passed an HDC and the address of a SCRIPT_CACHE variable. -// Uniscribe will first attempt to access font data via the SCRIPT_CACHE -// and will only inspect the HDC if the required data is not already -// cached. -// -// The HDC may be passed as NULL. If data required by Uniscribe is -// already cached, the HDC won't be accessed and operation continues -// normally. -// -// If the HDC is passed as NULL, and Uniscribe needs to access it for -// any reason, Uniscribe will return E_PENDING. -// -// E_PENDING is returned quickly, allowing the client to avoid time -// consuming SelectObject calls. The following example applies to all -// APIs that take a SCRIPT_CACHE and an optional HDC. -// -//c hr = ScriptShape(NULL, &sc, ..); -//c if (hr == E_PENDING) { -//c ... select font into hdc ... -//c hr = ScriptShape(hdc, &sc, ...); -//c } - - - - -///// ScriptFreeCache -// -// The client may free a SCRIPT_CACHE at any time. Uniscribe maintains -// reference counts in it's font and shaper caches, and frees font data -// only when all sizes of the font are free, and shaper data only when -// all fonts it supports are freed. -// -// The client should free the SCRIPT_CACHE for a style when it discards -// that style. -// -// ScriptFreeCache always sets it's parameter to NULL to help avoid -// mis-referencing. - - -function ScriptFreeCache( - psc: PScriptCache //InOut Cache handle - ): HRESULT; stdcall; - - -type - ///// SCRIPT_CONTROL - // - // The SCRIPT_CONTROL structure provides itemization control flags to the - // ScriptItemize function. - // - // - - TScriptControlFlag = ( - scContextDigits, // Means use previous script instead of uDefaultLanguage - // The following flags provide legacy support for GetCharacterPlacement features - scInvertPreBoundDir, // Reading order of virtual item immediately prior to string - scInvertPostBoundDir, // Reading order of virtual item immediately following string - scLinkStringBefore, // Equivalent to presence of ZWJ before string - scLinkStringAfter, // Equivalent to presence of ZWJ after string - scNeutralOverride, // Causes all neutrals to be strong in the current embedding direction - scNumericOverride, // Causes all numerals to be strong in the current embedding direction - scLegacyBidiClass // Causes plus and minus to be reated as neutrals, slash as a common separator - ); - TScriptControlFlags = set of TScriptControlFlag; - - PScriptControl = ^TScriptControl; - tag_SCRIPT_CONTROL = packed record - uDefaultLanguage: Word; // For NADS, also default for context - fFlags: TScriptControlFlags; - fReserved: Byte; - end; -(* uDefaultLanguage: DWORD {:16}; // For NADS, also default for context - fContextDigits: DWORD {:1}; // Means use previous script instead of uDefaultLanguage - - // The following flags provide legacy support for GetCharacterPlacement features - fInvertPreBoundDir: DWORD {:1}; // Reading order of virtual item immediately prior to string - fInvertPostBoundDir: DWORD {:1}; // Reading order of virtual item immediately following string - fLinkStringBefore: DWORD {:1}; // Equivalent to presence of ZWJ before string - fLinkStringAfter: DWORD {:1}; // Equivalent to presence of ZWJ after string - fNeutralOverride: DWORD {:1}; // Causes all neutrals to be strong in the current embedding direction - fNumericOverride: DWORD {:1}; // Causes all numerals to be strong in the current embedding direction - fLegacyBidiClass: DWORD {:1}; // Causes plus and minus to be reated as neutrals, slash as a common separator - fReserved: DWORD {:8}; - end; *) - {$EXTERNALSYM tag_SCRIPT_CONTROL} - SCRIPT_CONTROL = tag_SCRIPT_CONTROL; - {$EXTERNALSYM SCRIPT_CONTROL} - TScriptControl = tag_SCRIPT_CONTROL; - -// -// -//p uDefaultLanguage: Language to use when Unicode values are ambiguous. -// Used by numeric processing to select digit shape when -// ssDigitSubstitute (see SCRIPT_STATE) is in force. -// -//p scContextDigits: Specifies that national digits are chosen according to -// the nearest previous strong text, rather than using -// uDefaultLanguage. -// -//p scInvertPreBoundDir: By default text at the start of the string is -// laid out as if it follows strong text of the same direction -// as the base embedding level. Set scInvertPreBoundDir to change -// the initial context to the opposite of the base embedding -// level. This flag is for GetCharacterPlacement legacy support. -// -//p scInvertPostBoundDir: By default text at the end of the string is -// laid out as if it preceeds strong text of the same direction -// as the base embedding level. Set scInvertPostBoundDir to change -// the final context to the opposite of the base embedding -// level. This flag is for GetCharacterPlacement legacy support. -// -//p scLinkStringBefore: Causes the first character of the string to be -// shaped as if were joined to a previous character. -// -//p scLinkStringAfter: Causes the last character of the string to be -// shaped as if were joined to a following character. -// -//p scNeutralOverride: Causes all neutral characters in the string to be -// treated as if they were strong characters of their enclosing -// embedding level. This effectively locks neutrals in place, -// reordering occuring only between neutrals. -// -//p scNumericOverride: Causes all numeric characters in the string to be -// treated as if they were strong characters of their enclosing -// embedding level. This effectively locks numerics in place, -// reordering occuring only between numerics. -// -//p fReserved: Reserved. Always initialise to 0. - - - - ///// SCRIPT_STATE - // - // The SCRIPT_STATE structure is used both to initialise the unicode - // algorithm state as an input parameter to ScriptItemize, and is also - // a component of each item analysis returned by ScriptItemize. - // - // - TScriptStateFlag = ( - uBidiLevel_reserved1, uBidiLevel_r2, uBidiLevel_r3, uBidiLevel_r4, uBidiLevel_r5, - ssOverrideDirection, // Set when in LRO/RLO embedding - ssInhibitSymSwap, // Set by U+206A (ISS), cleared by U+206B (ASS) - ssCharShape, // Set by U+206D (AAFS), cleared by U+206C (IAFS) - ssDigitSubstitute, // Set by U+206E (NADS), cleared by U+206F (NODS) - ssInhibitLigate, // Equiv !GCP_Ligate, no Unicode control chars yet - ssDisplayZWG, // Equiv GCP_DisplayZWG, no Unicode control characters yet - ssArabicNumContext, // For EN->AN Unicode rule - ssGcpClusters // For Generating Backward Compatible GCP Clusters (legacy Apps) - ); - TScriptStateFlags = set of TScriptStateFlag; - - PScriptState = ^TScriptState; - tag_SCRIPT_STATE = packed record - case Byte of - 0: (uBidiLevel: Byte) {:5}; // Unicode Bidi algorithm embedding level (0-16) - 1: (fFlags: TScriptStateFlags) - end; -(* uBidiLevel: Word {:5}; // Unicode Bidi algorithm embedding level (0-16) - fOverrideDirection: Word {:1}; // Set when in LRO/RLO embedding - fInhibitSymSwap: Word {:1}; // Set by U+206A (ISS), cleared by U+206B (ASS) - fCharShape: Word {:1}; // Set by U+206D (AAFS), cleared by U+206C (IAFS) - fDigitSubstitute: Word {:1}; // Set by U+206E (NADS), cleared by U+206F (NODS) - fInhibitLigate: Word {:1}; // Equiv !GCP_Ligate, no Unicode control chars yet - fDisplayZWG: Word {:1}; // Equiv GCP_DisplayZWG, no Unicode control characters yet - fArabicNumContext: Word {:1}; // For EN->AN Unicode rule - fcpClusters: Word {:1}; // For Generating Backward Compatible GCP Clusters (legacy Apps) - fReserved: Word {:1}; - fEngineReserved: Word {:2}; // For use by shaping engine - end; *) - {$EXTERNALSYM tag_SCRIPT_STATE} - SCRIPT_STATE = tag_SCRIPT_STATE; - {$EXTERNALSYM SCRIPT_STATE} - TScriptState = tag_SCRIPT_STATE; - -const - MASK_uBidiLevel = $1F; // Mask to apply to TScriptState.uBidiLevel -type - -// -// -//p uBidiLevel: The embedding level associated with all characters in this -// run according to the Unicode bidi algorithm. When passed to -// ScriptItemize, should be initialised to 0 for an LTR base -// embedding level, or 1 for RTL. -// -//p ssOverrideDirection: TRUE if this level is an override level (LRO/RLO). -// In an override level, characters are layed out purely -// left to right, or purely right to left. No reordering of digits -// or strong characters of opposing direction takes place. -// Note that this initial value is reset by LRE, RLE, LRO or -// RLO codes in the string. -// -//p ssInhibitSymSwap: TRUE if the shaping engine is to bypass mirroring of -// Unicode Mirrored glyphs such as brackets. Set by Unicode -// character ISS, cleared by ASS. -// -//p ssCharShape: TRUE if character codes in the Arabic Presentation Forms -// areas of Unicode should be shaped. (Not implemented). -// -//p ssDigitSubstitute: TRUE if character codes U+0030 through U+0039 -// (European digits) are to be substituted by national digits. -// Set by Unicode NADS, Cleared by NODS. -// -//p ssInhibitLigate: TRUE if ligatures are not to be used in the shaping -// of Arabic or Hebrew characters. -// -//p ssDisplayZWG: TRUE if control characters are to be shaped as -// representational glyphs. (Normally, control characters are -// shaped to the blank glyph and given a width of zero). -// -//p ssArabicNumContext: TRUE indicates prior strong characters were Arabic -// for the purposes of rule P0 on page 3-19 of 'The Unicode -// Standard, version 2.0'. Should normally be set TRUE before -// itemizing an RTL paragraph in an Arabic language, FALSE -// otherwise. -// -//p ssGcpClusters: For GetCharaterPlacement legacy support only. -// Initialise to TRUE to request ScriptShape to generate -// the LogClust array the same way as GetCharacterPlacement -// does in Arabic and Hebrew Windows95. Affects only Arabic -// and Hebrew items. -// -//p fReserved: Reserved. Always initialise to 0. -// -//p fEngineReserved: Reserved. Always initialise to 0. - - - - - - - ///// SCRIPT_ANALYSIS - // - // Each analysed item is described by a SCRIPT_ANALYSIS structure. - // It also includes a copy of the Unicode algorithm state (SCRIPT_STATE). - // - // - TScriptAnalysis_enum = ( - eScript_r1, eScript_r2, eScript_r3, eScript_r4, eScript_r5, // first 10 bits - eScript_r6, eScript_r7, eScript_r8, eScript_r9, eScript_r10, // are reserved - fRTL, // Rendering direction - fLayoutRTL, // Set for GCP classes ARABIC/HEBREW and LOCALNUMBER - fLinkBefore, // Implies there was a ZWJ before this item - fLinkAfter, // Implies there is a ZWJ following this item. - fLogicalOrder, // Set by client as input to ScriptShape/Place - fNoGlyphIndex // Generated by ScriptShape/Place - this item does not use glyph indices - ); - TScriptAnalysis_set = set of TScriptAnalysis_enum; - - PScriptAnalysis = ^TScriptAnalysis; - tag_SCRIPT_ANALYSIS = packed record - case Byte of - 0: (eScript: Word) {:10}; // Shaping engine - 1: (fFlags: TScriptAnalysis_set; - s: TScriptState) - end; -(* eScript: Word {:10}; // Shaping engine - fRTL: Word {:1}; // Rendering direction - fLayoutRTL: Word {:1}; // Set for GCP classes ARABIC/HEBREW and LOCALNUMBER - fLinkBefore: Word {:1}; // Implies there was a ZWJ before this item - fLinkAfter: Word {:1}; // Implies there is a ZWJ following this item. - fLogicalOrder: Word {:1}; // Set by client as input to ScriptShape/Place - fNoGlyphIndex: Word {:1}; // Generated by ScriptShape/Place - this item does not use glyph indices - s: TScriptState; - end; *) - {$EXTERNALSYM tag_SCRIPT_ANALYSIS} - SCRIPT_ANALYSIS = tag_SCRIPT_ANALYSIS; - {$EXTERNALSYM SCRIPT_ANALYSIS} - TScriptAnalysis = tag_SCRIPT_ANALYSIS; - -const - MASK_eScript = $3FF; // Mask to apply to TScriptAnalysis.eScript -type - -// -// -//p eScript: Opaque value identifying which engine Uniscribe will use to -// Shape, Place and TextOut this item. The value of eScript is -// undefined, and will change in future releases, but attributes -// of eScript may be obtained by calling ScriptGetProperties. -// -//p fRTL: Rendering direction. Normally identical to the parity of the -// Unicode embedding level, but may differ if overridden by -// GetCharacterPlacement legacy support. -// -//p fLayoutRTL: Logical direction - whether conceptually part of a -// left-to-right sequenece or a right-to-left sequence. Although -// this is usually the same as fRTL, for a number in a -// right-to-left run, fRTL is False (because digits are always -// displayed LTR), but fLayoutRTL is True (because the number is -// read as part of the right-to-left sequence). -// -//p fLinkBefore: If set, the shaping engine will shape the first character -// of this item as if it were joining with a previous character. -// Set by ScriptItemize, may be overriden before calling ScriptShape. -// -//p fLinkAfter: If set, the shaping engine will shape the last character -// of this item as if it were joining with a subsequient character. -// Set by ScriptItemize, may be overriden before calling ScriptShape. -// -//p fLogicalOrder: If set, the shaping engine will generate all glyph -// related arrays in logical order. By default glyph related -// arrays are in visual order, the first array entry corresponding -// to the leftmost glyph. -// Set to FALSE by ScriptItemize, may be overriden before calling -// ScriptShape. -// -//p fNoGlyphIndex: May be set TRUE on input to ScriptShape to disable use -// of glyphs for this item. Additionally, ScriptShape will set it -// TRUE for hdcs containing symbolic, unrecognised and device fonts. -// Disabling glyphing disables complex script shaping. When set, -// shaping and placing for this item is implemented directly by -// calls to GetTextExtentExPoint and ExtTextOut. -///// SCRIPT_ITEM -// -// The SCRIPT_ITEM structure includes a SCRIPT_ANALYSIS with the string -// ofset of the first character of the item. -// -// - - PScriptItem = ^TScriptItem; - tag_SCRIPT_ITEM = record - iCharPos: Integer; // Logical offset to first character in this item - a: TScriptAnalysis; - end; - {$EXTERNALSYM tag_SCRIPT_ITEM} - SCRIPT_ITEM = tag_SCRIPT_ITEM; - {$EXTERNALSYM SCRIPT_ITEM} - TScriptItem = SCRIPT_ITEM; - -// -// -//p iCharPos: Offset from beginning of itemised string to first character -// of this item, counted in Unicode codepoints (i.e. words). -// -//p a: Script analysis structure containing analysis specific to this -// item, to be passed to ScriptShape, ScriptPlace etc. - - - -///// ScriptItemize - break text into items -// -// Breaks a run of unicode into individually shapeable items. -// Items are delimited by -// -// o Change of shaping engine -// o Change of direction -// -// The client may create multiple runs from each item returned by -// ScriptItemize, but should not combine multiple items into a single run. -// -// Later the client will call ScriptShape for each run (when measuring or -// rendering), and must pass the SCRIPT_ANALYSIS that ScriptItemize -// returned. - - -function ScriptItemize( - const pwcInChars: PWideChar; // In Unicode string to be itemized - cInChars: Integer; // In Codepoint count to itemize - cMaxItems: Integer; // In Max length of itemization array - const psControl: PScriptControl; // In Analysis control (optional) - const psState: PScriptState; // In Initial bidi algorithm state (optional) - pItems: PScriptItem; // Out Array to receive itemization - pcItems: PInteger // Out Count of items processed (optional) - ): HRESULT; stdcall; -{$EXTERNALSYM ScriptItemize} - - - -///// -// -// -// Returns E_INVALIDARG if pwcInChars == NULL or cInChars == 0 -// or pItems == NULL or cMaxItems < 2. -// -// Returns E_OUTOFMEMORY if the output buffer length (cMaxItems) is -// insufficient. Note that in this case, as in all error cases, no -// items have been fully processed so no part of the output array -// contains defined values. -// -// If psControl and psState are NULL on entry, ScriptItemize -// breaks the unicode string purely by character code. If they are all -// non-null, it performs a full Unicode bidi analysis. -// -// ScriptItemize always adds a terminal item to the item analysis array -// (pItems) such that the length of an item at pItem is always available as: -// -//c pItem[1].iCharPos - pItem[0].iCharPos -// -// For this reason, it is invalid to call ScriptItemize with a buffer -// of less than two SCRIPT_ANALYSIS items. -// -// To perform a correct Unicode Bidi analysis, the SCRIPT_STATE should -// be initialised according to the paragraph reading order at paragraph -// start, and ScriptItemize should be passed the whole paragraph. -// -// fRTL and fNumeric together provide the same classification as -// the lpClass output from GetCharacterPlacement. -// -// European digits U+0030 through U+0039 may be rendered as national -// digits as follows: -// -//t ssDigitSubstitute | scContextDigits | Digit shapes displayed for Unicode U+0030 through U+0039 -//t ---------------- | -------------- | ------------------------------------ -//t False | Any | Western (European / American) digits -//t True | False | As specified in SCRIPT_CONTROL.uDefaultLanguage -//t True | True | As prior strong text, defaulting to SCRIPT_CONTROL.uDefaultLanguage -// -// -// For scContextDigits, any Western digits (U+0030 - U+0039) encountered -// before the first strongly directed character are substituted by the -// traditional digits of the SCRIPT_CONTROL.uDefaultLanguage when that -// language is written in the same direction as SCRIPT_STATE.uBidiLevel. -// -// Thus, in a right-to-left string, if SCRIPT_CONTROL.uDefaultLanguage is -// 1 (LANG_ARABIC), then leading Western digits will be substituted by -// traditional Arabic digits. -// -// However, also in a right-to-left string, if SCRIPT_CONTROL.uDefaultLanguage -// is 0x1e (LANG_THAI), then no substitution occurs on leading Western -// digits because the Thai language is written left-to-right. -// -// Following strongly directed characters, digits are substituted -// by the traditional digits associated with the closest prior strongly -// directed character. -// -// The left-to-right mark (LRM) and right-to-left mark (RLM) are strong -// characters whose language depends on the SCRIPT_CONTROL.uDefaultLangauge. -// -// If SCRIPT_CONTROL.uDefaultLangauge is a left-to-right langauge, then -// LRM causes subsequent Western digits to be substituted by the -// traditional digits associated with that language, while Western -// digits following RLM are not substituted. -// -// Conversly, if SCRIPT_CONTROL.uDefaultLangauge is a right-to-left -// langauge, then Western digits following LRM are not substituted, while -// Western digits following RLM are substituted by the traditional digits -// associated with that language. -// -// -// -// Effect of Unicode control characters on SCRIPT_STATE: -// -//t SCRIPT_STATE flag | Set by | Cleared by -//t ----------------- | ------ ---------- -//t ssDigitSubstitute | NADS | NODS -//t ssInhibitSymSwap | ISS | ASS -//t ssCharShape | AAFS | IAFS -// -// SCRIPT_STATE.ssArabicNumContext controls the Unicode EN->AN rule. -// It should normally be initialised to TRUE -// before itemizing an RTL paragraph in an Arabic language, FALSE -// otherwise. -///// ScriptLayout -// -// The ScriptLayout function converts an array of run embedding levels to -// a map of visual to logical position, and/or logical to visual position. -// -// pbLevel must contain the embedding levels for all runs on the line, -// ordered logically. -// -// On output, piVisualToLogical[0] is the logical index of the run to -// display at the far left. Subsequent entries should be displayed -// progressing from left to right. -// -// piLogicalToVisual[0] is the relative visual position where the first -// logical run should be displayed - the leftmost display position being zero. -// -// The caller may request either piLogicalToVisual or piVisualToLogical -// or both. -// -// Note: No other input is required since the embedding levels give all -// necessary information for layout. - - -function ScriptLayout( - cRuns: Integer; // In Number of runs to process - const pbLevel: PByte; // In Array of run embedding levels - piVisualToLogical: PInteger; // Out List of run indices in visual order - piLogicalToVisual: PInteger // Out List of visual run positions - ): HRESULT; stdcall; -{$EXTERNALSYM ScriptLayout} - - - - - -type - - ///// SCRIPT_JUSTIFY - // - // The script justification enumeration provides the client with the - // glyph characteristic information it needs to implement justification. - - PScriptJustify = ^TScriptJustify; - tag_SCRIPT_JUSTIFY = ( - SCRIPT_JUSTIFY_NONE {= 0}, // Justification can't be applied at this glyph - SCRIPT_JUSTIFY_ARABIC_BLANK {= 1}, // This glyph represents a blank in an Arabic run - SCRIPT_JUSTIFY_CHARACTER {= 2}, // Inter-character justification point follows this glyph - SCRIPT_JUSTIFY_RESERVED1 {= 3}, // Reserved #1 - SCRIPT_JUSTIFY_BLANK {= 4}, // This glyph represents a blank outside an Arabic run - SCRIPT_JUSTIFY_RESERVED2 {= 5}, // Reserved #2 - SCRIPT_JUSTIFY_RESERVED3 {= 6}, // Reserved #3 - SCRIPT_JUSTIFY_ARABIC_NORMAL {= 7}, // Normal Middle-Of-Word glyph that connects to the right (begin) - SCRIPT_JUSTIFY_ARABIC_KASHIDA {= 8}, // Kashida(U+640) in middle of word - SCRIPT_JUSTIFY_ARABIC_ALEF {= 9}, // Final form of Alef-like (U+627, U+625, U+623, U+632) - SCRIPT_JUSTIFY_ARABIC_HA {= 10}, // Final form of Ha (U+647) - SCRIPT_JUSTIFY_ARABIC_RA {= 11}, // Final form of Ra (U+631) - SCRIPT_JUSTIFY_ARABIC_BA {= 12}, // Middle-Of-Word form of Ba (U+628) - SCRIPT_JUSTIFY_ARABIC_BARA {= 13}, // Ligature of alike (U+628,U+631) - SCRIPT_JUSTIFY_ARABIC_SEEN {= 14}, // Highest priority: Initial shape of Seen(U+633) (end) - SCRIPT_JUSTIFY_RESERVED4 {= 15} // Reserved #4 - ); - SCRIPT_JUSTIFY = tag_SCRIPT_JUSTIFY; - {$EXTERNALSYM SCRIPT_JUSTIFY} - TScriptJustify = SCRIPT_JUSTIFY; - - - - ///// SCRIPT_VISATTR - // - // The visual (glyph) attribute buffer generated by ScriptShape - // identifies clusters and justification points: - - TScriptVisAttr_enum = ( - uJustification_r1, uJustification_r2, uJustification_r3, uJustification_r4, - fClusterStart, {:1} // First glyph of representation of cluster - fDiacritic, {:1} // Diacritic - fZeroWidth, {:1} // Blank, ZWJ, ZWNJ etc, with no width - fReserved {:1} // General reserved - ); - TScriptVisAttr_set = set of TScriptVisAttr_enum; - - PScriptVisAttr = ^TScriptVisAttr; - tag_SCRIPT_VISATTR = packed record - case Byte of - 0: (uJustification: Byte) {:4}; // Justification class - 1: (fFlags: TScriptVisAttr_set; - fShapeReserved: Byte) {:8}; // Reserved for use by shaping engines - end; -(* uJustification: Word {:4}; // Justification class - fClusterStart: Word {:1}; // First glyph of representation of cluster - fDiacritic: Word {:1}; // Diacritic - fZeroWidth: Word {:1}; // Blank, ZWJ, ZWNJ etc, with no width - fReserved: Word {:1}; // General reserved - fShapeReserved: Word {:8}; // Reserved for use by shaping engines - end; *) - SCRIPT_VISATTR = tag_SCRIPT_VISATTR; - {$EXTERNALSYM SCRIPT_VISATTR} - TScriptVisAttr = SCRIPT_VISATTR; - -const - MASK_uJustification = $F; // Mask to apply to TScriptVisAttr.uJustification - -// -// -//p uJustification: Justification class for this glyph. See SCRIPT_JUSTIFY. -// -//p fClusterStart: Set for the logically first glyph in every cluster, -// even for clusters containing just one glyph. -// -//p fDiacritic: Set for glyphs that combine with base characters. -// -//p fZeroWidth: Set by the shaping engine for some, but not all, zero -// width characters. - - -///// ScriptShape -// -// The ScriptShape function takes a Unicode run and generates glyphs and -// visual attributes. -// -// The number of glyphs generated varies according to the script and the -// font. Only for simple scripts and fonts does each Unicode code point -// generates a single glyph. -// -// There is no limit on the number of glyphs generated by a codepoint. -// For example, a sophisticated complex script font might choose to -// constuct characters from components, and so generate many times as -// many glyphs as characters. -// -// There are also special cases like invalid character representations, -// where extra glyphs are added to represent the invalid sequence. -// -// A reasonable guess might be to provide a glyph buffer 1.5 times the -// length of the character buffer, plus a 16 glyph fixed addition for -// rare cases like invalid sequenece representation. -// -// If ScriptShape returns E_OUTOFMEMORY it will be necessary to recall -// it, possibly more than once, until a large enough buffer is found. - - -function ScriptShape( - hdc: HDC; // In Optional (see under caching) - psc: PScriptCache; // InOut Cache handle - const pwcChars: PWideChar; // In Logical unicode run - cChars: Integer; // In Length of unicode run - cMaxGlyphs: Integer; // In Max glyphs to generate - psa: PScriptAnalysis; // InOut Result of ScriptItemize (may have fNoGlyphIndex set) - pwOutGlyphs: PWord; // Out Output glyph buffer - pwLogClust: PWord; // Out Logical clusters - psva: PScriptVisAttr; // Out Visual glyph attributes - pcGlyphs: PInteger // Out Count of glyphs generated - ): HRESULT; stdcall; -{$EXTERNALSYM ScriptShape} - - - - - - -///// -// -// Returns E_OUTOFMEMORY if the output buffer length (cMaxGlyphs) is -// insufficient. Note that in this case, as in all error cases, the -// content of all output parameters are undefined. -// -//p psa: Pass the SCRIPT_ANALYSIS field of the SCRIPT_ITEM entry for this -// item. (The SCRIPT_ITEM array is returned by ScriptItemize.) -// -// Clusters are sequenced uniformly within the run, as are glyphs within -// the cluster - the fRTL item flag (from ScriptItemize) identifies -// whether left to right, or right to left. -// -//p pwLogClust: has cChars elements - each entry in pwLogClust corresponds -// to a character in the input string (pwcChars). The value in each -// pwLogCLust entry is the offset of the first glyph in the cluster -// that contains this character. -// -// Example: In the following example, there are four clusters: -// 1st cluster: one character represented by one glyph -// 2nd cluster: one character represented by 3 glyphs -// 3rd cluster: three characters represented by one glyph -// 4th cluster: 2 characters represented by three glyphs -// -// Glyph array: (cg means cluster n glyph m) -//c 0 1 2 3 4 5 6 7 -//c ------------------------------------------------- -//c | c1g1 | c2g1 c2g2 c2g3 | c3g1 | c4g1 c4g2 c4g3 | -//c ------------------------------------------------- -// -// Character array: (cu means cluster n Unicode codepoint m) -//c 0 1 2 3 4 5 6 -//c -------------------------------------------- -//c | c1u1 | c2u1 | c3u1 c3u2 c3u3 | c4u1 c4u2 | -//c -------------------------------------------- -// -// LogClust: (one entry per character gives 1st glyph in cluster -//c -------------------------------------------- -//c | 0 | 1 | 4 4 4 | 5 5 | -//c -------------------------------------------- -// -// Note that for an RTL run (SCRIPT_ANALYSIS.a.fRTL == TRUE) and when -// fLogicalOrder == FALSE (the default), glyphs are generated in visual -// order - the reverse of the codepoint order, and the values in the -// LogClust array will be descending. -// -// -//p psva: has one visual attribute per glyph and so has maxGlyphs entries. -// -// -// ScriptShape may set the fNoGlyphIndex flag in psa if the font or -// OS cannot support glyph indices. -// -// If fLogicalOrder is requested in psa, glyphs will be always be -// generated in the same order as the original Unicode characters. -// -// If fLogicalOrder is not set, right to left items are generated in -// reverse order, so ScriptTextOut does not need to reverse them before -// calling ExtTextOut. -///// ScriptPlace -// -// The ScriptPlace function takes the output of a ScriptShape call and -// generates glyph advance width and 2D offset information. -// -// The composite ABC width for the whole item identifies how much the -// glyphs overhang to the left of the start position and to the right of -// the length implied by the sum of the advance widths. -// -// The total advance width of the line is exactly abcA + abcB + abcC. -// -// abcA and abcC are maintained internally by Uniscribe as proportions -// of the cell height represented in 8 bits and are thus roughly +/- 1%. -// The total width returned (as the sum of piAdvance, and as the sum of -// abcA+abcB+abcC) is accurate to the resolution of the TrueType shaping -// engine. -// -// All glyph related arrays are in visual order unless the fLogicalOrder -// flag is set in psa. - -type - PGOffset = ^TGOffset; - tagGOFFSET = record - du: Longint; - dv: Longint; - end; - GOFFSET = tagGOFFSET; - {$EXTERNALSYM GOFFSET} - TGOffset = tagGOFFSET; - - -function ScriptPlace( - hdc: HDC; // In Optional (see under caching) - psc: PScriptCache; // InOut Cache handle - const pwGlyphs: PWord; // In Glyph buffer from prior ScriptShape call - cGlyphs: Integer; // In Number of glyphs - const psva: PScriptVisAttr; // In Visual glyph attributes - psa: PScriptAnalysis; // InOut Result of ScriptItemize (may have fNoGlyphIndex set) - piAdvance: PInteger; // Out Advance wdiths - pGoffset: PGOffset; // Out x,y offset for combining glyph - pABC: PABC // Out Composite ABC for the whole run (Optional) - ): HRESULT; stdcall; -{$EXTERNALSYM ScriptPlace} - - - - - - -///// ScriptTextOut -// -// The ScriptTextOut function takes the output of both ScriptShape and -// ScriptPlace calls and calls the operating system ExtTextOut function -// appropriately. If the last parameter is not null, GDI's ExtTextOutW calls -// are routed to this function. -// -// All arrays are in visual order unless the fLogicalOrder flag is set in -// psa. - - -function ScriptTextOut( - const hdc: HDC; // In OS handle to device context (required) - psc: PScriptCache; // InOut Cache handle - x: Integer; // In x,y position for first glyph - y: Integer; // In - fuOptions: LongWord; // In ExtTextOut options - const lprc: PRect; // In optional clipping/opaquing rectangle - const psa: PScriptAnalysis; // In Result of ScriptItemize - const pwcReserved: PWideChar; // In Reserved (requires NULL) - iReserved: Integer; // In Reserved (requires 0) - const pwGlyphs: PWord; // In Glyph buffer from prior ScriptShape call - cGlyphs: Integer; // In Number of glyphs - const piAdvance: PInteger; // In Advance widths from ScriptPlace - const piJustify: PInteger; // In Justified advance widths (optional) - const pGoffset: PGOffset // In x,y offset for combining glyph - ): HRESULT; stdcall; - - - - - - -///// -// -// The caller should normally use SetTextAlign(hdc, TA_RIGHT) before -// calling ScriptTextOut with an RTL item inlogical order. -// -// The piJustify array provides requested cell widths for each glyph. -// When the piJustify width of a glyph differs from the unjustified -// width (in PiAdvance), space is added to or removed from the glyph -// cell at it's trailing edge. The glyph is always aligned with the -// leading edge of it's cell. (This rule applies even in visual order.) -// -// When a glyph cell is extended the extra space is uaually made up by -// the addition of white space, however for Arabic scripts, the extra -// space is made up by one or more kashida glyphs, unless the extra space -// is insufficient for the shortest kashida glyph in the font. (The -// width of the shortest kashida is available by calling -// ScriptGetFontProperties.) -// -// piJustify should only be passed if re-justification of the string is -// required. Normally pass NULL to this parameter. -// -// fuOptions may contain ETO_CLIPPED or ETO_OPAQUE (or neither or both). -// -// Do not use ScriptTextOut to write to a metafile unless you are sure -// that the metafile will eventually be played back without any font -// substitution. ScriptTextOut record glyph numbers in the metafile. -// Since glyph numbers vary considerably from one font to another -// such a metafile is unlikely to play back correctly when differant -// fonts are substituted. -// -// For example when a metafile is played back at a different scale -// CreateFont requests recorded in the metafile may resolve to bitmap -// instead of truetype fonts, or if the metafile is played back on -// a different machine requested fonts may not be installed.// -// -// To write complex scripts in a metafile in a font independant manner, -// use ExtTextOut to write the logical characters directly, so that -// glyph generation and placement does not occur until the text is -// played back. -///// ScriptJustify -// -// ScriptJustify provides a simple minded implementation of multilingual -// justification. -// -// Sophisticated text formatters may prefer to generate their own delta -// dx array by combining their own features with the information returned -// by ScriptShape in the SCRIPT_VISATTR array. -// -// ScriptJustify establishes how much adjustment to make at each glyph -// position on the line. It interprets the SCRIPT_VISATTR array generated -// by a call to ScriptShape, and gives top priority to kashida, then uses -// inter word spacing if there's no kashida points, then uses -// intercharacter spacing if there are no inter-word points. -// -// The justified advance widths generated in ScriptJustify should be -// passed to ScriptTextOut in the piJustify paramter. -// -// ScriptJustify creates a justify array containing updated advance -// widths for each glyph. Where a glyphs advance width is increased, it -// is expected that the extra width will be rendered to the right of the -// glyph, with as white space or, for Arabic text, as kashida. -///// -function ScriptJustify( - const psva: PScriptVisAttr; // In Collected visual attributes for entire line - const piAdvance: PInteger; // In Advance widths from ScriptPlace - cGlyphs: Integer; // In Size of all arrays - iDx: Integer; // In Desired width change, either increase or descrease - iMinKashida: Integer; // In Minimum length of continuous kashida glyph to generate - piJustify: PInteger // Out Updated advance widths to pass to ScriptTextOut - ): HRESULT; stdcall; - - - - -type - ///// SCRIPT_LOGATTR - // - // The SCRIPT_LOGATTR structure describes attributes of logical - // characters useful when editing and formatting text. - // - // Note that for wordbreaking and linebreaking, if the first character of - // the run passed in is not whitespace, the client needs to check whether - // the last character of the previous run is whitespace to determine if - // the first character of this run is the start of a word. - // - // - TScriptLogAttr_enum = ( - fSoftBreak, // Potential linebreak point - fWhiteSpace, // A unicode whitespace character, except NBSP, ZWNBSP - fCharStop, // Valid cursor position (for left/right arrow) - fWordStop, // Valid cursor position (for ctrl + left/right arrow) - fInvalid // Invalid character sequence - ); - - PScriptLogAttr = ^TScriptLogAttr; - tag_SCRIPT_LOGATTR = set of TScriptLogAttr_enum; -(* fSoftBreak: Byte {:1}; // Potential linebreak point - fWhiteSpace: Byte {:1}; // A unicode whitespace character, except NBSP, ZWNBSP - fCharStop: Byte {:1}; // Valid cursor position (for left/right arrow) - fWordStop: Byte {:1}; // Valid cursor position (for ctrl + left/right arrow) - fInvalid: Byte {:1}; // Invalid character sequence - fReserved: Byte {:3;} - end; *) - {$EXTERNALSYM tag_SCRIPT_LOGATTR} - SCRIPT_LOGATTR = tag_SCRIPT_LOGATTR; - {$EXTERNALSYM SCRIPT_LOGATTR} - TScriptLogAttr = SCRIPT_LOGATTR; - - -// -// -//p fSoftBreak: It would be valid to break the line in front of this -// character. This flag is set on the first character of -// South-East Asian words. Note that when linebreaking the -// client would usually also treat any nonblank following a blank -// as a softbreak position, by inspecting the fWhiteSPace flag -// below. -// -//p fWhiteSpace: This character is one of the many Unicode character -// that are classified as breakable whitespace. -// -//p fCharStop: Valid cursor position. Set on most characters, but not -// on codepoints inside Indian and South East Asian character -// clusters. May be used to implement left and right arrow -// operation in editors. -// -//p fWordStop: Valid position following word advance/retire commonly -// implemented at ctrl/left-arrow and ctrl/right-arrow. -// May be used to implement ctrl+left and ctrl+right arrow -// operation in editors. As with fSoftBreak clients should -// normally also inspect the fWhiteSpace flag and treat the -// first character after a run of whitespace as the start of a -// word. -// -//p fInvalid: Marks characters which form an invalid or undisplayable -// combination. Scripts which can set this flag have the flag -// fInvalidLogAttr set in their SCRIPT_PROPERTIES. - - - - - - -///// ScriptBreak -// -// The ScriptBreak function returns cursor movement and formatting break -// positions for an item as an array of SCRIPT_LOGATTRs. To support -// mixed formatting within a single word correctly, ScriptBreak should -// be passed whole items as returned by ScriptItemize. -// -// ScriptBreak does not require an hdc and does not execute glyph shaping. -// -// The fCharStop flag marks cluster boundaries for those scripts where -// it is conventional to restrict from moving inside clusters. The same -// boundaries could also be inferred by inspecting the pLogCLust array -// returned by ScriptShape, however ScriptBreak is considerably faster in -// implementation and does not require an hdc to be prepared. -// -// The fWordStop, fSoftBreak and fWhiteSpace flags are only available -// through ScriptBreak. -// -// Most shaping engines that identify invalid sequences do so by setting -// the fInvalid flag in ScriptBreak. The fInvalidLogAttr flag in -// ScriptProperties identifies which scripts do this. - - -function ScriptBreak( - const pwcChars: PWideChar; // In Logical unicode item - cChars: Integer; // In Length of unicode item - const psa: PScriptAnalysis; // In Result of earlier ScriptItemize call - psla: PScriptLogAttr // Out Logical character attributes - ): HRESULT; stdcall; -{$EXTERNALSYM ScriptBreak} - - - - - -///// ScriptCPtoX -// -// The ScriptCPtoX function returns the x offset from the left end -// (!fLogical) or leading edge (fLogical) of a run to either the leading -// or the trailing edge of a logical character cluster. -// -// iCP is the offset of any logical character in the cluster. -// -// For scripts where the caret may conventionally be placed into the -// middle of clusters (e.g. Arabic, Hebrew), the returned X may be -// an interpolated position for any codepoint in the line. -// -// For scripts where the caret is conventionally snapped to the boundaries -// of clusters, (e.g. Thai, Indian), the resulting X position will be -// snapped to the requested edge of the cluster containing CP. - - -function ScriptCPtoX( - iCP: Integer; // In Logical character position in run - fTrailing: BOOL; // In Which edge (default - leading) - cChars: Integer; // In Count of logical codepoints in run - cGlyphs: Integer; // In Count of glyphs in run - const pwLogClust: PWord; // In Logical clusters - const psva: PScriptVisAttr; // In Visual glyph attributes array - const piAdvance: PInteger; // In Advance widths - const psa: PScriptAnalysis; // In Script analysis from item attributes - piX: PInteger // Out Resulting X position - ): HRESULT; stdcall; - - - - - - -///// ScriptXtoCP -// -// The ScriptXtoCP function converts an x offset from the left end -// (!fLogical) or leading edge (fLogical) of a run to a logical -// character position and a flag that indicates whether the X position -// fell in the leading or the trailing half of the character. -// -// For scripts where the cursor may conventionally be placed into the -// middle of clusters (e.g. Arabic, Hebrew), the returned CP may be -// for any codepoint in the line, and fTrailing will be either zero -// or one. -// -// For scripts where the cursor is conventionally snapped to the -// boundaries of a cluster, the returned CP is always the position of -// the logically first codepoint in a cluster, and fTrailing is either -// zero, or the number of codepoints in the cluster. -// -// Thus the appropriate cursor position for a mouse hit is always the -// returned CP plus the value of fTrailing. -// -// If the X positition passed is not in the item at all, the resulting -// position will be the trailing edge of character -1 (for X positions -// before the item), or the leading edge of character 'cChars' (for -// X positions following the item). - - -function ScriptXtoCP( - iX: Integer; // In X offset from left of run - cChars: Integer; // In Count of logical codepoints in run - cGlyphs: Integer; // In Count of glyphs in run - const pwLogClust: PWord; // In Logical clusters - const psva: PScriptVisAttr; // In Visual glyph attributes - const piAdvance: Integer; // In Advance widths - const psa: PScriptAnalysis; // In Script analysis from item attributes - piCP: PInteger; // Out Resulting character position - piTrailing: PInteger // Out Leading or trailing half flag - ): HRESULT; stdcall; - - - - - - -///// Relationship between caret positions, justifications points and clusters -// -// -//t Job | Uniscribe support -//t -------------------------------- | -------------------------------------------------------- -//t Caret move by character cluster | LogClust or VISATTR.fClusterStart or LOGATTR.fCharStop -//t Line breaking between characters | LogClust or VISATTR.fClusterStart or LOGATTR.fCharStop -//t Caret move by word | LOGATTR.fWordStop -//t Line breaking between words | LOGATTR.fWordStop -//t Justification | VISATTR.uJustification -// -// -// -///// Character clusters -// -// Character clusters are glyph sequences that cannot be split between -// lines. -// -// Some languages (e.g. Thai, Indic) restrict caret placement to points -// betwen clusters. This applies both to keyboard initiated caret -// movement (e.g. cursor keys) and pointing and clicking with the mouse -// (hit testing). -// -// Uniscribe provides cluster information in both the visual and logical -// attributes. If you've called ScriptShape you'll find the cluster -// information represented both by sequences of the same value in the -// pwLogClust array, and by the fClusterStart flag in the psva -// SCRIPT_VISATTR array. -// -// ScriptBreak also returns the fCharStop flag in the SCRIPT_LOGATTR -// array to identify cluster positions. -// -// -// -///// Word break points -// -// Valid positions for moving the caret when moving in whole words are -// marked by the fWordStop flag returned by ScriptBreak. -// -// Valid positions for breaking lines between words are marked by the -// fSoftBreak flag returned by ScriptBreak. -// -// -// -///// Justification -// -// Justification space or kashida should be inserted where identified by -// the uJustificaion field of the SCRIPT_VISATTR. -// -// When performing inter-character justification, insert extra space -// only after glyphs marked with uJustify == SCRIPT_JUSTIFY_CHARACTER. -// -// -// -///// Script specific processing -// -// Uniscribe provides information about special processing for each -// script in the SCRIPT_PROPERTIES array. -// -// Use the following code during initialisation to get a pointer to -// the SCRIPT_PROPERTIES array: -// -//c const SCRIPT_PROPERTIES **g_ppScriptProperties; // Array of pointers to properties -//c int iMaxScript; -//c HRESULT hr; -// -//c hr = ScriptGetProperties(&g_ppScriptProperties, &g_iMaxScript); -// -// Then inspect the properties of the script of an item 'iItem' as follows: -// -//c hr = ScriptItemize( ... , pItems, ... ); -//c ... -//c if (g_ppScriptProperties[pItems[iItem].a.eScript]->fNeedsCaretInfo) { -//c // Use ScriptBreak to restrict the caret from entering clusters (for example). -//c } -// -// -// SCRIPT_PROPERTIES.fNeedsCaretInfo -// -// Caret placement should be restricted to cluster -// edges for scripts such as Thai and Indian. The fNeedsCaretInfo flag -// in SCRIPT_PROPERTIES identifies such languages. -// -// Note that ScriptXtoCP and ScriptCPtoX automatically apply caret -// placement restictions. -// -// -// SCRIPT_PROPERTIES.fNeedsWordBreaking -// -// For most scripts, word break placement may be -// identified by scanning for characters marked as fWhiteSpace in -// SCRIPT_LOGATTR, or for glyphs marked as uJustify == -// SCRIPT_JUSTIFY_BLANK or SCRIPT_JUSTIFY_ARABIC_BLANK in SCRIPT_VISATTR. -// -// For languages such as Thai, it is also necessary to call ScriptBreak, -// and include character positions marked as fWordStop in SCRIPT_LOGATTR. -// Such scripts are marked as fNeedsWordbreaking in SCRIPT_PROPERTIES. -// -// -// SCRIPT_PROPERTIES.fNeedsCharacterJustify -// -// Languages such as Thai also require inter-character spacing when -// justifying (where uJustify == SCRIPT_JUSTIFY_CHARACTER in the -// SCRIPT_VISATTR). Such languages are marked as fNeedsCharacterJustify -// in SCRIPT_PROPERTIES. -// -// -// SCRIPT_PROPERTIES.fAmbiguousCharSet -// -// Many Uniscribe scripts do not correspond directly to 8 bit character -// sets. For example Unicode characters in the range U+100 through U+024F -// represent extended latin shapes used for many languages, including -// those supported by EASTEUROPE_CHARSET, TURKISH_CHARSET and -// VIETNAMESE_CHARSET. However many of these characters are supported by -// more han one of thsese charsets. -// fAmbiguousCharset is set for any script token which could contain -// characters from a number of these charsets. In these cases the bCharSet -// field may contain ANSI_CHARSET or DEFAULT_CHARSET. The Uniscribe client -// will generally need to apply futher processing to determine which charset -// to use when requesting a font suitable for this run. For example it -// determine that the run consists of multiple languages and split it up -// to use a different font for each language. - - - - - - -///// Notes on ScriptXtoCP and ScriptCPtoX -// -// Both functions work only within runs and require the results of a -// previous ScriptShape call. -// -// The client must establish which run a given cursor offset or x -// position is within before passing it to ScriptCPtoX or ScriptXtoCP. -// -// Cluster information in the logical cluster array is used to share -// the width of a cluster of glyphs equally among the logical characters -// they represent. -// -// For example, the lam alif glyph is divided into four areas: the -// leading half of the lam, the trailing half of the lam, the leading -// half of the alif and the trailing half of the alif. -// -// ScriptXtoCP Understands the caret position conventions of each script. -// For Indian and Thai, caret positions are snapped to cluster boundaries, -// for Arabic and Hebrew, caret positions are interpolated within clusters. -// -// -///// Translating mouse hit 'x' offset to caret position -// -// Conventionally, caret position 'cp' may be selected by clicking either -// on the trailing half of character 'cp-1' or on the leading half of -// character 'cp'. This may easily be implemented as follows: -// -//c int iCharPos; -//c int iCaretPos -//c int fTrailing; -// -//c ScriptXtoCP(iMouseX, ..., &iCharPos, &fTrailing); -//c iCaretPos = iCharPos + fTrailing; -// -// For scripts that snap the caret to cluster boundaries, ScriptXtoCP -// returns ftrailing set to either 0, or the width of the cluster in -// codepoints. Thus the above code correctly returns only valid -// caret positions. -// -// -///// Displaying the caret in bidi strings -// -// In unidirectional text, the leading edge of a character is at the same -// place as the trailing edge of the previous character, so there is no -// ambiguity in placing the caret between characters. -// -// In bidirectional text, the caret position between runs of opposing -// direction may be ambiguous. -// -// For example in the left to right paragraph 'helloMAALAS', the last -// letter of 'hello' immediately preceeds the first letter of 'salaam'. -// The best position to display the caret depends on whether it is -// considered to follow the 'o' of 'hello', or to preceed the 's' of -// 'salaam'. -// -///// Commonly used caret positioning conventions -// -//t Situation | Visual caret placement -//t --------- | ------------------------------------------- -//t Typing | Trailing edge of last character typed -//t Pasting | Trailing edge of last character pasted -//t Caret advancing | Trailing edge of last character passed over -//t Caret retiring | Leading edge of last character passed over -//t Home | Leading edge of line -//t End | Trailing edge of line -// -// The caret may be positioned as follows: -// -//c if (advancing) { -//c ScriptCPtoX(iCharPos-1, TRUE, ..., &iCaretX); -//c } else { -//c ScriptCPtoX(iCharPos, FALSE, ..., &iCaretX); -//c } -// -// Or, more simply, given an fAdvancing BOOL restricted to TRUE or FALSE: -// -//c ScriptCPtoX(iCharPos-fAdvancing, fAdvancing, ..., &iCaretX); -// -// ScriptCPtoX handles out of range positions logically: it returns the -// leading edge of the run for iCharPos <0, and the trailing edge of the -// run for iCharPos >=length. -///// ScriptGetLogicalWidths -// -// Converts visual withs in piAdvance into logical widths, -// one per original character, in logical order. -// -// Ligature glyphs widths are divided evenly amongst the characters -// they represent. - - -function ScriptGetLogicalWidths( - const psa: PScriptAnalysis; // In Script analysis from item attributes - cChars: Integer; // In Count of logical codepoints in run - cGlyphs: Integer; // In Count of glyphs in run - const piGlyphWidth: PInteger; // In Advance widths - const pwLogClust: PWord; // In Logical clusters - const psva: PScriptVisAttr; // In Visual glyph attributes - piDx: PInteger // Out Logical widths - ): HRESULT; stdcall; - - - - - - -///// -// ScriptGetLogicalWidths is useful for recording widths in a -// font independant manner. By passing the recorded logical widths -// to ScriptApplyLogicalWidths, a block of text can be replayed in the -// same boundaries with acceptable loss of quality even when the original -// font is not available. -///// ScriptApplyLogicalWidth -// -// Accepts an array of advance widths in logical order, corresponding -// one to one with codepoints, and generates an array of glyph widths -// suitable for passing to the piJustify parameter of ScriptTextOut. -// -// ScriptApplyLogicalWidth may be used to reapply logical widths -// obtained with ScriptGetLogicalWidths. It may be useful in situations -// such as metafiling, where it is necessary to record and reapply -// advance width information in a font independant manner. - - - -function ScriptApplyLogicalWidth( - const piDx: PInteger; // In Logical dx array to apply - cChars: Integer; // In Count of logical codepoints in run - cGlyphs: Integer; // In Glyph count - const pwLogClust: PWORD; // In Logical clusters - const psva: PScriptVisAttr; // In Visual attributes from ScriptShape/Place - const piAdvance: PInteger; // In Glyph advance widths from ScriptPlace - const psa: PScriptAnalysis; // In Script analysis from item attributes - pABC: PABC; // InOut Updated item ABC width (optional) - piJustify: PInteger // Out Resulting glyph advance widths for ScriptTextOut - ): HRESULT; stdcall; - - - - - - -///// -//p piDx: Pointer to an array of dx widths in logical order, one per codepoint. -// -//p cChars: Count of the logical codepoints in the run. -// -//p cGlyphs: Glyph count. -// -//p pwLogClust: Pointer to an array of logical clusters from ScriptShape -// -//p psva: Pointer to an array of visual attributes from ScriptShape and -// updated by ScriptPlace. -// -//p piAdvance: Pointer to an array of glyph advance widths from ScriptPlace. -// -//p psa: Pointer to a SCRIPT_ANALYSIS structure from ScriptItemize and -// updated by ScriptShape and SriptPlace.. -// -//p pABC: Pointer to the run overall ABC width (optional). If present, -// when the function is called, it should contain the run ABC width -// returned by ScriptPlace; when the function returns, the ABC width -// has been updated to match the new widths. -// -//p piJustify:Pointer to an array of the resulting glyph advance widths. -// This is suitable for passing to the piJustify parameter of ScriptTextOut. -///// ScriptGetCMap -// -// ScriptGetCMap may be used to determine which characters in a run -// are supported by the selected font. -// -// It returns glyph indices of Unicode characters according to Truetype -// Cmap table, or standard Cmap implemented for old style fonts. The -// glyph indices are returned in the same order as the input string. -// -// The caller may scan the returned glyph buffer looking for the default -// glyph to determine which characters are not available. (The default -// glyph index for the selected font should be determined by calling -// ScriptGetFontProperties). -// -// The return value indicates the presence of any missing glyphs. - -const - SGCM_RTL = $00000001; // Return mirrored glyph for mirrorable Unicode codepoints - - -function ScriptGetCMap( - hdc: HDC; // In Optional (see notes on caching) - psc: PScriptCache; // InOut Address of Cache handle - const pwcInChars: PWideChar; // In Unicode codepoint(s) to look up - cChars: Integer; // In Number of characters - dwFlags: DWORD; // In Flags such as SGCM_RTL - pwOutGlyphs: PWord // Out Array of glyphs, one per input character - ): HRESULT; stdcall; - - - - - -///// -// returns S_OK - All unicode codepoints were present in the font -// S_FALSE - Some of the Unicode codepoints were mapped to the default glyph -// E_HANDLE - font or system does not support glyph indices -///// ScriptGetGlyphABCWidth -// -// Returns ABC width of a given glyph. -// May be useful for drawing glyph charts. Should not be used for -// run of the mill complex script text formatting. - - -function ScriptGetGlyphABCWidth( - hdc: HDC; // In Optional (see notes on caching) - psc: PScriptCache; // InOut Address of Cache handle - wGlyph: Word; // In Glyph - pABC: PABC // Out ABC width - ): HRESULT; stdcall; - - - - - -type - ///// - // returns S_OK - Glyph width returned - // E_HANDLE - font or system does not support glyph indices - ///// SCRIPT_PROPERTIES - // - - TScriptProperties_enum = ( - fNumeric, {:1} - fComplex, {:1} // Script requires special shaping or layout - fNeedsWordBreaking, {:1} // Requires ScriptBreak for word breaking information - fNeedsCaretInfo, {:1} // Requires caret restriction to cluster boundaries - bCharSet, {:8} // Charset to use when creating font - fControl, {:1} // Contains only control characters - fPrivateUseArea, {:1} // This item is from the Unicode range U+E000 through U+F8FF - fNeedsCharacterJustify,{:1} // Requires inter-character justification - fInvalidGlyph, {:1} // Invalid combinations generate glyph wgInvalid in the glyph buffer - fInvalidLogAttr, {:1} // Invalid combinations are marked by fInvalid in the logical attributes - fCDM, {:1} // Contains Combining Diacritical Marks - fAmbiguousCharSet, {:1} // Script does not correspond 1//:1 with a charset - fClusterSizeVaries, {:1} // Measured cluster width depends on adjacent clusters - fRejectInvalid {:1} // Invalid combinations should be rejected - ); - TScriptProperties_set = set of TScriptProperties_enum; - - PScriptProperties = ^TScriptProperties; - SCRIPT_PROPERTIES = packed record - langid: Word {:16}; // Primary and sublanguage associated with script - fFlags: TScriptProperties_set; - end; -(* langid: DWORD {:16}; // Primary and sublanguage associated with script - fNumeric: DWORD {:1}; - fComplex: DWORD {:1}; // Script requires special shaping or layout - fNeedsWordBreaking: DWORD {:1}; // Requires ScriptBreak for word breaking information - fNeedsCaretInfo: DWORD {:1}; // Requires caret restriction to cluster boundaries - bCharSet: DWORD {:8}; // Charset to use when creating font - fControl: DWORD {:1}; // Contains only control characters - fPrivateUseArea: DWORD {:1}; // This item is from the Unicode range U+E000 through U+F8FF - fNeedsCharacterJustify: DWORD {:1}; // Requires inter-character justification - fInvalidGlyph: DWORD {:1}; // Invalid combinations generate glyph wgInvalid in the glyph buffer - fInvalidLogAttr: DWORD {:1}; // Invalid combinations are marked by fInvalid in the logical attributes - fCDM: DWORD {:1}; // Contains Combining Diacritical Marks - fAmbiguousCharSet: DWORD {:1}; // Script does not correspond 1//:1 with a charset - fClusterSizeVaries: DWORD {:1}; // Measured cluster width depends on adjacent clusters - fRejectInvalid: DWORD {:1}; // Invalid combinations should be rejected - end; *) - {$EXTERNALSYM SCRIPT_PROPERTIES} - TScriptProperties = SCRIPT_PROPERTIES; - -// -//p langid: Language associated with this script. When a script is used for many languages, -// langid id represents a default language. For example, Western script is represented -// by LANG_ENGLISH although it is also used for French, German, Spanish etc. -// -//p fNumeric: Script contains numerics and characters used in conjunction with numerics -// by the rules of the Unicode bidirectional algorithm. For example -// dollar sign and period are classified as numeric when adjacent to or in between -// digits. -// -//p fComplex: Indicates a script that requires complex script handling. If fComplex is false -// the script contains no combining characters and requires no contextual shaping or reordering. -// -//p fNeedsWordBreaking: A script, such as Thai, which requires algorithmic wordbreaking. -// Use ScriptBreak to obtain a wordbreak points using the standard system wordbreaker. -// -//p fNeedsCaretInfo: A script, such as Thai and Indian, where the caret may not be placed -// inside a cluster. To determine valid caret positions inspect the fCharStop flag in the -// logical attributes returned by ScriptBreak, or compare adjacent values in the pwLogClust -// array returned by ScriptShape. -// -//p bCharSet: Nominal charset associated with script. May be used in a logfont when creating -// a font suitable for displaying this script. Note that for new scripts where there -// is no charset defined, bCharSet may be innapropriate and DEFAULT_CHARSET should -// be used instead - see the description of fAmbiguousCharSet below. -// -//p fControl: contains control characters. -// -//p fPrivateUseArea: The Unicode range U+E000 through U+F8FF. -// -//p fNeedsCharacterJustify: A script, such as Thai, where justification is conventionally -// achieved by increasing the space between all letters, not just between words. -// -//p fInvalidGlyph: A script for which ScriptShape generates an invalid glyph -// to represent invalid sequences. The glyph index of the invalid glyph for -// a particular font may be obtained by calling ScriptGetFontProperties. -// -//p fInvalidLogAttr: A script for which ScriptBreak sets the fInvalid flag -// in the logical attributes to mark invalid sequences. -// -//p fCDM: Implies that an item analysed by ScriptItemize included combining -// diacritical marks (U+0300 through U+36F). -// -//p fAmbiguousCharSet: No single legacy charset supports this script. -// For example the extended Latin Extended-A Unicode range includes -// characters from the EASTUROPE_CHARSET, the TURKISH_CHARSET and the -// BALTIC_CHARSET. It also contains characters that are not available -// in any legacy charset. Use DEFAULT_CHARSET when creating fonts to -// display parts of this run. -// -//p fClusterSizeVaries: A script, such as Arabic, where contextual shaping -// may cause a string to increase in size when removing characters. -// -//p fRejectInvalid: A script, such as Thai, where invalid sequences conventionally -// cause an editor such as notepad to beep, and ignore keypresses. - - -///// ScriptGetProperties -// -// ScriptGetProperties returns the address of a table that maps a -// script in a SCRIPT_ANALYSIS uScript field to properties including -// the primary language associated with that script, whether it's -// numeric and whether it's complex. - - -function ScriptGetProperties( - out ppSp: PScriptProperties; // Out Receives pointer to table of pointers to properties indexed by script - out piNumScripts: Integer // Out Receives number of scripts (valid values are 0 through NumScripts-1) - ): HRESULT; stdcall; - - - - - -type - ///// SCRIPT_FONTPROPERTIES - // - PScriptFontProperties = ^TScriptFontProperties; - SCRIPT_FONTPROPERTIES = record - cBytes: Integer; // Structure length - wgBlank: Word; // Blank glyph - wgDefault: Word; // Glyph used for Unicode values not present in the font - wgInvalid: Word; // Glyph used for invalid character combinations (especially in Thai) - wgKashida: Word; // Shortest continuous kashida glyph in the font, -1 if doesn't exist - iKashidaWidth: Integer;// Widths of shortest continuous kashida glyph in the font - end; - {$EXTERNALSYM SCRIPT_FONTPROPERTIES} - TScriptFontProperties = SCRIPT_FONTPROPERTIES; - - -///// ScriptGetFontProperties -// -// Returns information from the font cache - - -function ScriptGetFontProperties( - hdc: HDC; // In Optional (see notes on caching) - psc: PScriptCache; // InOut Address of Cache handle - sfp: PScriptFontProperties // Out Receives properties for this font - ): HRESULT; stdcall; - - - - - - -///// ScriptCacheGetHeight -// -// - - -function ScriptCacheGetHeight( - hdc: HDC; // In Optional (see notes on caching) - psc: PScriptCache; // InOut Address of Cache handle - tmHeight: PLongint // Out Receives font height in pixels - ): HRESULT; stdcall; - - - - -const - ///// ScriptStringAnalyse - // - // - SSA_PASSWORD = $00000001; // Input string contains a single character to be duplicated iLength times - SSA_TAB = $00000002; // Expand tabs - SSA_CLIP = $00000004; // Clip string at iReqWidth - SSA_FIT = $00000008; // Justify string to iReqWidth - SSA_DZWG = $00000010; // Provide representation glyphs for control characters - SSA_FALLBACK = $00000020; // Use fallback fonts - SSA_BREAK = $00000040; // Return break flags (character and word stops) - SSA_GLYPHS = $00000080; // Generate glyphs, positions and attributes - SSA_RTL = $00000100; // Base embedding level 1 - SSA_GCP = $00000200; // Return missing glyphs and LogCLust with GetCharacterPlacement conventions - SSA_HOTKEY = $00000400; // Replace '&' with underline on subsequent codepoint - SSA_METAFILE = $00000800; // Write items with ExtTextOutW Unicode calls, not glyphs - SSA_LINK = $00001000; // Apply FE font linking/association to non-complex text - SSA_HIDEHOTKEY = $00002000; // Remove first '&' from displayed string - SSA_HOTKEYONLY = $00002400; // Display underline only. - - SSA_FULLMEASURE = $04000000; // Internal - calculate full width and out the number of chars can fit in iReqWidth. - SSA_LPKANSIFALLBACK = $08000000; // Internal - enable FallBack for all LPK Ansi calls Except BiDi hDC calls - SSA_PIDX = $10000000; // Internal - SSA_LAYOUTRTL = $20000000; // Internal - Used when DC is mirrored - SSA_DONTGLYPH = $40000000; // Internal - Used only by GDI during metafiling - Use ExtTextOutA for positioning - SSA_NOKASHIDA = $80000000; // Internal - Used by GCP to justify the non Arabic glyphs only. -// -// -//p SSA_HOTKEY: Note that SSA_HOTKEY and SSA_HIDEHOTKEY remove the -// hotkey '&' character from further processing, so functions -// such as ScriptString_pLogAttr return arrays based on a string -// which excludes the '&'. - - - -type - ///// SCRIPT_TABDEF - // - // Defines tabstop positions for ScriptStringAnalyse (ignored unless SSA_TAB passed) - // - PScriptTabDef = ^TScriptTabDef; - tag_SCRIPT_TABDEF = record - cTabStops: Integer; // Number of entries in pTabStops array - iScale: Integer; // Scale factor for pTabStops (see below) - pTabStops: PInteger; // Pointer to array of one or more tab stops - iTabOrigin: Integer; // Initial offset for tab stops (logical units) - end; - {$EXTERNALSYM tag_SCRIPT_TABDEF} - SCRIPT_TABDEF = tag_SCRIPT_TABDEF; - {$EXTERNALSYM SCRIPT_TABDEF} - TScriptTabDef = tag_SCRIPT_TABDEF; - -// -// -//p cTabStops: Number of entries in the pTabStops array. If zero, tabstops -// are every 8 average character widths. If one, all tabstops are -// the length of the first entry in pTabStops. If more than one, -// the first cTabStops are as specified in the pTabStops array, -// subsequent tabstops are every 8 average characters from the last -// tabstop in the array. -// -//p iScale: Scale factor for iTabOrigin and pTabStops entries. Values are -// converted to device coordinates by multiplying by iScale then -// dividing by 4. If values are already in device units, set iScale to -// 4. If values are in dialog units, set iScale to the average char -// width of the dialog font. If values are multiples of the average -// character width for the selected font, set iScale to 0. -// -//p pTabStops: Array of cTabStops entries. Each entry specifies a -// tabstop position. Positive values give nearedge alignment, -// negative values give faredge alignment. -// -//p iTabOrigin: Tabs are considered to start iTabOrigin before the -// beginning of the string. Helps with multiple tabbed -// outputs on the same line. - - - - - - -///// ScriptStringAnalyse -// -// cString - Input string must contain at least one character -// -// hdc - required if SSA_GLYPH requested. Optional for SSA_BREAK. -// If present the current font in the hdc is inspected and if a symbolic -// font the character string is treated as a single neutral SCRIPT_UNDEFINED item. -// -// Note that the uBidiLevel field in the initial SCRIPT_STATE value -// is ignored - the uBidiLevel used is derived from the SSA_RTL -// flag in combination with the layout of the hdc. - - - SCRIPT_STRING_ANALYSIS = Pointer; - {$EXTERNALSYM SCRIPT_STRING_ANALYSIS} - TScriptStringAnalysis = SCRIPT_STRING_ANALYSIS; - PScriptStringAnalysis = ^TScriptStringAnalysis; - - -function ScriptStringAnalyse( - hdc: HDC; //In Device context (required) - const pString: Pointer; //In String in 8 or 16 bit characters - cString: Integer; //In Length in characters (Must be at least 1) - cGlyphs: Integer; //In Required glyph buffer size (default cString*1.5 + 16) - iCharset: Integer; //In Charset if an ANSI string, -1 for a Unicode string - dwFlags: DWORD; //In Analysis required - iReqWidth: Integer; //In Required width for fit and/or clip - psControl: PScriptControl; //In Analysis control (optional) - psState: PScriptState; //In Analysis initial state (optional) - const piDx: PInteger; //In Requested logical dx array - pTabdef: PScriptTabDef; //In Tab positions (optional) - const pbInClass: PByte; //In Legacy GetCharacterPlacement character classifications (deprecated) - - pssa: PScriptStringAnalysis //Out Analysis of string - ): HRESULT; stdcall; - - - - - - -///// ScriptStringFree - free a string analysis -// -// - - -function ScriptStringFree( - pssa: PScriptStringAnalysis //InOut Address of pointer to analysis - ): HRESULT; stdcall; - - - - - - -///// ScriptStringSize -// -// returns a pointer to the size (width and height) of an analysed string -// -// Note that the SIZE pointer remains valid only until the -// SCRIPT_STRING_ANALYSIS is passed to ScriptStringFree. - - -function ScriptString_pSize( - ssa: TScriptStringAnalysis - ): {const} PSize; stdcall; - - - - - - -///// ScriptString_pcOutChars -// -// returns pointer to length of string after clipping (requires SSA_CLIP set) -// -// Note that the int pointer remains valid only until the -// SCRIPT_STRING_ANALYSIS is passed to ScriptStringFree. - - -function ScriptString_pcOutChars( - ssa: TScriptStringAnalysis - ): {const} PInteger; stdcall; - - - - - - -///// ScriptString_pLogAttr -// -// returns pointer to logical attributes buffer in a SCRIPT_STRING_ANALYSIS -// -// Note that the buffer pointer remains valid only until the -// SCRIPT_STRING_ANALYSIS is passed to ScriptStringFree. -// -// The logical attribute array contains *ScriptString_pcOutChars(ssa) -// entries. - - -function ScriptString_pLogAttr( - ssa: TScriptStringAnalysis - ): {const} PScriptLogAttr; stdcall; - - - - - - -///// ScriptStringGetOrder -// -// Creates an array mapping original character position to glyph position. -// -// Treats clusters as they were in legacy systems - Unless a cluster -// contains more glyphs than codepoints, each glyph is referenced at -// least once from the puOrder array. -// -// Requires SSA_GLYPHS requested in original ScriptStringAnalyse call. -// -// The puOrder parameter should address a buffer containing room for -// at least *ScriptString_pcOutChars(ssa) ints. - - -function ScriptStringGetOrder( - ssa: TScriptStringAnalysis; - puOrder: PLongWord - ): HRESULT; stdcall; - - - - - - -///// ScriptStringCPtoX -// -// Return x coordinate for leading or trailing edge of character icp. - - -function ScriptStringCPtoX( - ssa: TScriptStringAnalysis; //In String analysis - icp: Integer; //In Caret character position - fTrailing: BOOL; //In Which edge of icp - out pX: Integer //Out Corresponding x offset - ): HRESULT; stdcall; - - - - - -///// ScriptStringXtoCP -// -// - - -function ScriptStringXtoCP( - ssa: TScriptStringAnalysis; // In - iX: Integer; // In - piCh: PInteger; // Out - piTrailing: PInteger // Out - ): HRESULT; stdcall; - - - - - -///// ScriptStringGetLogicalWidths -// -// Converts visual withs in psa->piAdvance into logical widths, -// one per original character, in logical order. -// -// Requires SSA_GLYPHS requested in original ScriptStringAnalyse call. -// -// The piDx parameter should address a buffer containing room for -// at least *ScriptString_pcOutChars(ssa) ints. - - -function ScriptStringGetLogicalWidths( - ssa: TScriptStringAnalysis; - out piDx: Integer): HRESULT; stdcall; - - - - - - -///// ScriptStringValidate -// -// Scans the string analysis for invalid glyphs. -// -// Only glyphs generated by scripts that can generate invalid glyphs -// are scanned. -// -// returns S_OK - no invalid glyphs are present -// S_FALSE - one or more invalid glyphs are present - - -function ScriptStringValidate( - ssa: TScriptStringAnalysis): HRESULT; stdcall; - - - - - - -///// ScriptStringOut -// -// Displays the string generated by a prior ScriptStringAnalyze call, -// then optionally adds highlighting corresponding to a logical selection. -// -// Requires SSA_GLYPHS requested in original ScriptStringAnalyse call. - - -function ScriptStringOut( - ssa: TScriptStringAnalysis; //In Analysis with glyphs - iX: Integer; //In - iY: Integer; //In - uOptions: LongWord; //In ExtTextOut options - const prc: PRect; //In Clipping rectangle (iff ETO_CLIPPED) - iMinSel: Integer; //In Logical selection. Set iMinSel>=iMaxSel for no selection - iMaxSel: Integer; //In - fDisabled: BOOL //In If disabled, only the background is highlighted. - ): HRESULT; stdcall; - - - - - -const - ///// - // uOptions may nclude only ETO_CLIPPED or ETO_OPAQUE. - ///// ScriptIsComplex - // - // Determines whether a Unicode string requires complex script processing - // - // The dwFlags parameter may include the following requests - // - SIC_COMPLEX = 1; // Treat complex script letters as complex - SIC_ASCIIDIGIT = 2; // Treat digits U+0030 through U+0039 as complex - SIC_NEUTRAL = 4; // Treat neutrals as complex - -// -// SIC_COMPLEX: Should normally set. Causes complex script letters to -// be treated as complex. -// -// SIC_ASCIIDIGIT: Set this flag if the string would be displayed with -// digit substitution enabled. If you are following the users NLS -// settings using the ScriptRecordDigitSubstitution API, you can pass -// scriptDigitSubstitute.DigitSubstitute != SCRIPT_DIGITSUBSTITUTE_NONE. -// -// SIC_NEUTRAL: Set this flag if you may be displaying the string with -// right-to-left reading order. When this flag is set, neutral characters -// are considered as complex. -// -// -// Returns S_OK if string requires complex script processing, -// S_FALSE if string contains only characters laid out side by -// side from left to right. - - -function ScriptIsComplex( - const pwcInChars: PWideChar; //In String to be tested - cInChars: Integer; //In Length in characters - dwFlags: DWORD //In Flags (see above) - ): HRESULT; stdcall; - - - - - -type - ///// ScriptRecordDigitSubstitution - // - // Reads NLS native digit and digit substitution settings and records - // them in the SCRIPT_DIGITSUBSTITUTE structure. - // - // - PScriptDigitSubstitute = ^TScriptDigitSubstitute; - tag_SCRIPT_DIGITSUBSTITUTE = packed record - NationalDigitLanguage: Word {:16}; // Language for native substitution - TraditionalDigitLanguage: Word {:16}; // Language for traditional substitution - DigitSubstitute: Byte {:8}; // Substitution type - bReserved: Byte; - wReserved: Word; - dwReserved: DWORD; // Reserved - end; -(* NationalDigitLanguage: DWORD {:16}; // Language for native substitution - TraditionalDigitLanguage: DWORD {:16}; // Language for traditional substitution - DigitSubstitute: DWORD {:8}; // Substitution type - dwReserved: DWORD; // Reserved - end; *) - {$EXTERNALSYM tag_SCRIPT_DIGITSUBSTITUTE} - SCRIPT_DIGITSUBSTITUTE = tag_SCRIPT_DIGITSUBSTITUTE; - {$EXTERNALSYM SCRIPT_DIGITSUBSTITUTE} - TScriptDigitSubstitute = tag_SCRIPT_DIGITSUBSTITUTE; - -// -// -//p NationalDigitLanguage: Standard digits for the selected locale as -// defined by the countries standard setting authority. -// -//p TraditionalDigitLangauge: Digits originally used with the locales -// script. -// -//p DigitSubstitute: Selects between None, Context, National and -// Traditional. See ScriptApplyDigitSubstitution below for -// constant definitions. -// -// Although most complex scripts have their own associated digits, many -// countries using those scripts use western (so called -// 'Arabic') digits as their standard. NationalDigitLanguage reflects the -// digits used as standard, and is set from -// the NLS data for the locale. -// On Windows 2000 the national digit langauge can be -// adjusted to any digit script with the control panel/regional -// options/numbers/Standard digits listbox. -// -// The TraditionalDigitLanguage for a locale is derived directly from the -// script used by that locale. - - -function ScriptRecordDigitSubstitution( - Locale: LCID; // In LOCALE_USER_DEFAULT or desired locale - out psds: TScriptDigitSubstitute // Out Digit substitution settings - ): HRESULT; stdcall; - - - - - -///// -//p Locale: NLS locale to be queried. Should usually be set to -// LOCALE_USER_DEFAULT. Alternatively may be passed as a locale -// combined with LOCALE_NOUSEROVERRIDE to obtain default settings -// for a given locale. Note that context digit substitution is -// supported only in ARABIC and FARSI locales. In other locales, -// context digit is mapped to no substitution. -// -//p psds: Pointer to SCRIPT_DIGITSUBSTITUTE. This structure may be passed -// later to ScriptApplyDigitSubstitution. -// -//p returns: E_INVALIDARG if Locale is invalid or not installed. E_POINTER -// if psds is NULL. Otherwise S_OK. -// -// For performance reasons, you should not call -// ScriptRecordDigitSubstitution frequently. In particular it would be a -// considerable overhead to call it every time you call ScriptItemize -// or ScriptStringAnalyse. -// -// Instead, you may choose to save the SCRIPT_DIGITSUBSTITUTE -// structure, and update it only when you receive a -// WM_SETTINGCHANGE message or when a RegNotifyChangeKeyValue -// call in a dedicated thread indicates a change in the registry -// under HKCU\Control Panel\\International. -// -// The normal way to call this function is simply -// -//c SCRIPT_DIGITSUBSTITUTE sds; -//c ScriptRecordDigitSubstitution(LOCALE_USER_DEFAULT, &sds); -// -// Then every time you itemize, you'd use the results like this: -// -//c SCRIPT_CONTROL sc = {0}; -//c SCRIPT_STATE ss = {0}; -// -//c ScriptApplyDigitSubstitution(&sds, &sc, &ss); -// -// -///// ScriptApplyDigitSubstitution -// -// Aplies the digit substitution settings recorded in a -// SCRIPT_DIGIT_SUBSTITUTE structure to the SCRIPT_CONTROL and -// SCRIPT_STATE structures. -// -// The DigitSubstitute field of the SCRIPT_DIGITSUBSTITUTE structure -// is normally set by ScriptRecordDigitSubstitution, however it may -// be replaced by any one of the following values: -// -// -const - SCRIPT_DIGITSUBSTITUTE_CONTEXT = 0; // Substitute to match preceeding letters - SCRIPT_DIGITSUBSTITUTE_NONE = 1; // No substitution - SCRIPT_DIGITSUBSTITUTE_NATIONAL = 2; // Substitute with official national digits - SCRIPT_DIGITSUBSTITUTE_TRADITIONAL = 3; // Substitute with traditional digits of the locale -// -// -//p SCRIPT_DIGITSUBSTITUTE_CONTEXT: Digits U+0030 - U+0039 will be -// substituted according to the language of prior letters. Before -// any letters, digits will be substituted according to the -// TraditionalDigitLangauge field of the SCRIPT_DIGIT_SUBSTITUTE -// structure. This field is normally set to the primary language of -// the Locale passed to ScriptRecordDigitSubstitution. -// -//p SCRIPT_DIGITSUBSTITUTE_NONE: Digits will not be substituted. Unicode -// values U+0030 to U+0039 will be displayed with Arabic (i.e. -// Western) numerals. -// -//p SCRIPT_DIGITSUBSTITUTE_NATIONAL: Digits U+0030 - U+0039 will be -// substituted according to the NationalDigitLangauge field of -// the SCRIPT_DIGIT_SUBSTITUTE structure. This field is normally -// set to the national digits returned for the NLS LCTYPE -// LOCALE_SNATIVEDIGITS by ScriptRecordDigitSubstitution. -// -//p SCRIPT_DIGITSUBSTITUTE_TRADITIONAL: Digits U+0030 - U+0039 will be -// substituted according to the TraditionalDigitLangauge field of -// the SCRIPT_DIGIT_SUBSTITUTE structure. This field is normally -// set to the primary language of the Locale passed to -// ScriptRecordDigitSubstitution. - - -function ScriptApplyDigitSubstitution( - const psds: PScriptDigitSubstitute; // In Digit substitution settings - psc: PScriptControl; // Out Script control structure - pss: PScriptState // Out Script state structure - ): HRESULT; stdcall; - - - - - - -///// -//p psds: Pointer to SCRIPT_DIGITSUBSTITUTE structure recorded earlier. -// If NULL, ScriptApplyDigitSubstitution calls -// ScriptRecordDigitSubstitution with LOCALE_USER_DEFAULT. -// -//p psc: SCRIPT_CONTROL structure. The scContextDigits and uDefaultLanguage -// fields will be updated. -// -//p pss: SCRIPT_CONTROL structure. The ssDigitSubstitute field will be -// updated. -// -//p returns: E_INVALIDARG if the DigitSubstitute field of the -// SCRIPT_DIGITSUBSTITUTE structure is unrecognised, else S_OK; - -var - Usp10IsInstalled: Boolean; - -implementation - -uses - SysUtils; - -const - Usp10DLL = 'usp10.dll'; - -var - Usp10DllModule: HMODULE = 0; - -function GetUsp10DllModule: HMODULE; -begin - if Usp10DllModule = 0 then - begin - Usp10DllModule := SafeLoadLibrary(Usp10DLL); - if Usp10DllModule <= HINSTANCE_ERROR then - Usp10DllModule := 0; - end; - Result := Usp10DllModule; -end; - -procedure GetProcedureAddress(var P: Pointer; const ModuleName, ProcName: string); -begin - if not Assigned(P) then - begin - P := Pointer(GetProcAddress(Usp10DllModule, PAnsiChar(AnsiString(ProcName)))); - if not Assigned(P) or (Usp10DllModule = 0) then - RaiseLastOSError; - end; -end; - -var - _ScriptFreeCache: Pointer = nil; - -function ScriptFreeCache; -begin - if _ScriptFreeCache = nil then - GetProcedureAddress(_ScriptFreeCache, Usp10DLL, 'ScriptFreeCache'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptFreeCache] - end; -end; - -var - _ScriptItemize: Pointer = nil; - -function ScriptItemize; -begin - if _ScriptItemize = nil then - GetProcedureAddress(_ScriptItemize, Usp10DLL, 'ScriptItemize'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptItemize] - end; -end; - -var - _ScriptLayout: Pointer = nil; - -function ScriptLayout; -begin - if _ScriptLayout = nil then - GetProcedureAddress(_ScriptLayout, Usp10DLL, 'ScriptLayout'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptLayout] - end; -end; - -var - _ScriptShape: Pointer = nil; - -function ScriptShape; -begin - if _ScriptShape = nil then - GetProcedureAddress(_ScriptShape, Usp10DLL, 'ScriptShape'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptShape] - end; -end; - -var - _ScriptPlace: Pointer = nil; - -function ScriptPlace; -begin - if _ScriptPlace = nil then - GetProcedureAddress(_ScriptPlace, Usp10DLL, 'ScriptPlace'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptPlace] - end; -end; - -var - _ScriptTextOut: Pointer = nil; - -function ScriptTextOut; -begin - if _ScriptTextOut = nil then - GetProcedureAddress(_ScriptTextOut, Usp10DLL, 'ScriptTextOut'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptTextOut] - end; -end; - -var - _ScriptJustify: Pointer = nil; - -function ScriptJustify; -begin - if _ScriptJustify = nil then - GetProcedureAddress(_ScriptJustify, Usp10DLL, 'ScriptJustify'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptJustify] - end; -end; - -var - _ScriptBreak: Pointer = nil; - -function ScriptBreak; -begin - if _ScriptBreak = nil then - GetProcedureAddress(_ScriptBreak, Usp10DLL, 'ScriptBreak'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptBreak] - end; -end; - -var - _ScriptCPtoX: Pointer = nil; - -function ScriptCPtoX; -begin - if _ScriptCPtoX = nil then - GetProcedureAddress(_ScriptCPtoX, Usp10DLL, 'ScriptCPtoX'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptCPtoX] - end; -end; - -var - _ScriptXtoCP: Pointer = nil; - -function ScriptXtoCP; -begin - if _ScriptXtoCP = nil then - GetProcedureAddress(_ScriptXtoCP, Usp10DLL, 'ScriptXtoCP'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptXtoCP] - end; -end; - -var - _ScriptGetLogicalWidths: Pointer = nil; - -function ScriptGetLogicalWidths; -begin - if _ScriptGetLogicalWidths = nil then - GetProcedureAddress(_ScriptGetLogicalWidths, Usp10DLL, 'ScriptGetLogicalWidths'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptGetLogicalWidths] - end; -end; - -var - _ScriptApplyLogicalWidth: Pointer = nil; - -function ScriptApplyLogicalWidth; -begin - if _ScriptApplyLogicalWidth = nil then - GetProcedureAddress(_ScriptApplyLogicalWidth, Usp10DLL, 'ScriptApplyLogicalWidth'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptApplyLogicalWidth] - end; -end; - -var - _ScriptGetCMap: Pointer = nil; - -function ScriptGetCMap; -begin - if _ScriptGetCMap = nil then - GetProcedureAddress(_ScriptGetCMap, Usp10DLL, 'ScriptGetCMap'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptGetCMap] - end; -end; - -var - _ScriptGetGlyphABCWidth: Pointer = nil; - -function ScriptGetGlyphABCWidth; -begin - if _ScriptGetGlyphABCWidth = nil then - GetProcedureAddress(_ScriptGetGlyphABCWidth, Usp10DLL, 'ScriptGetGlyphABCWidth'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptGetGlyphABCWidth] - end; -end; - -var - _ScriptGetProperties: Pointer = nil; - -function ScriptGetProperties; -begin - if _ScriptGetProperties = nil then - GetProcedureAddress(_ScriptGetProperties, Usp10DLL, 'ScriptGetProperties'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptGetProperties] - end; -end; - -var - _ScriptGetFontProperties: Pointer = nil; - -function ScriptGetFontProperties; -begin - if _ScriptGetFontProperties = nil then - GetProcedureAddress(_ScriptGetFontProperties, Usp10DLL, 'ScriptGetFontProperties'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptGetFontProperties] - end; -end; - -var - _ScriptCacheGetHeight: Pointer = nil; - -function ScriptCacheGetHeight; -begin - if _ScriptCacheGetHeight = nil then - GetProcedureAddress(_ScriptCacheGetHeight, Usp10DLL, 'ScriptCacheGetHeight'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptCacheGetHeight] - end; -end; - -var - _ScriptStringAnalyse: Pointer = nil; - -function ScriptStringAnalyse; -begin - if _ScriptStringAnalyse = nil then - GetProcedureAddress(_ScriptStringAnalyse, Usp10DLL, 'ScriptStringAnalyse'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptStringAnalyse] - end; -end; - -var - _ScriptStringFree: Pointer = nil; - -function ScriptStringFree; -begin - if _ScriptStringFree = nil then - GetProcedureAddress(_ScriptStringFree, Usp10DLL, 'ScriptStringFree'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptStringFree] - end; -end; - -var - _ScriptString_pSize: Pointer = nil; - -function ScriptString_pSize; -begin - if _ScriptString_pSize = nil then - GetProcedureAddress(_ScriptString_pSize, Usp10DLL, 'ScriptString_pSize'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptString_pSize] - end; -end; - -var - _ScriptString_pcOutChars: Pointer = nil; - -function ScriptString_pcOutChars; -begin - if _ScriptString_pcOutChars = nil then - GetProcedureAddress(_ScriptString_pcOutChars, Usp10DLL, 'ScriptString_pcOutChars'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptString_pcOutChars] - end; -end; - -var - _ScriptString_pLogAttr: Pointer = nil; - -function ScriptString_pLogAttr; -begin - if _ScriptString_pLogAttr = nil then - GetProcedureAddress(_ScriptString_pLogAttr, Usp10DLL, 'ScriptString_pLogAttr'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptString_pLogAttr] - end; -end; - -var - _ScriptStringGetOrder: Pointer = nil; - -function ScriptStringGetOrder; -begin - if _ScriptStringGetOrder = nil then - GetProcedureAddress(_ScriptStringGetOrder, Usp10DLL, 'ScriptStringGetOrder'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptStringGetOrder] - end; -end; - -var - _ScriptStringCPtoX: Pointer = nil; - -function ScriptStringCPtoX; -begin - if _ScriptStringCPtoX = nil then - GetProcedureAddress(_ScriptStringCPtoX, Usp10DLL, 'ScriptStringCPtoX'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptStringCPtoX] - end; -end; - -var - _ScriptStringXtoCP: Pointer = nil; - -function ScriptStringXtoCP; -begin - if _ScriptStringXtoCP = nil then - GetProcedureAddress(_ScriptStringXtoCP, Usp10DLL, 'ScriptStringXtoCP'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptStringXtoCP] - end; -end; - -var - _ScriptStringGetLogicalWidths: Pointer = nil; - -function ScriptStringGetLogicalWidths; -begin - if _ScriptStringGetLogicalWidths = nil then - GetProcedureAddress(_ScriptStringGetLogicalWidths, Usp10DLL, 'ScriptStringGetLogicalWidths'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptStringGetLogicalWidths] - end; -end; - -var - _ScriptStringValidate: Pointer = nil; - -function ScriptStringValidate; -begin - if _ScriptStringValidate = nil then - GetProcedureAddress(_ScriptStringValidate, Usp10DLL, 'ScriptStringValidate'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptStringValidate] - end; -end; - -var - _ScriptStringOut: Pointer = nil; - -function ScriptStringOut; -begin - if _ScriptStringOut = nil then - GetProcedureAddress(_ScriptStringOut, Usp10DLL, 'ScriptStringOut'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptStringOut] - end; -end; - -var - _ScriptIsComplex: Pointer = nil; - -function ScriptIsComplex; -begin - if _ScriptIsComplex = nil then - GetProcedureAddress(_ScriptIsComplex, Usp10DLL, 'ScriptIsComplex'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptIsComplex] - end; -end; - -var - _ScriptRecordDigitSubstitution: Pointer = nil; - -function ScriptRecordDigitSubstitution; -begin - if _ScriptRecordDigitSubstitution = nil then - GetProcedureAddress(_ScriptRecordDigitSubstitution, Usp10DLL, 'ScriptRecordDigitSubstitution'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptRecordDigitSubstitution] - end; -end; - -var - _ScriptApplyDigitSubstitution: Pointer = nil; - -function ScriptApplyDigitSubstitution; -begin - if _ScriptApplyDigitSubstitution = nil then - GetProcedureAddress(_ScriptApplyDigitSubstitution, Usp10DLL, 'ScriptApplyDigitSubstitution'); - asm - MOV ESP, EBP - POP EBP - JMP [_ScriptApplyDigitSubstitution] - end; -end; - -initialization - Usp10DllModule := GetUsp10DllModule; - Usp10IsInstalled := Usp10DllModule <> 0; - -finalization - if Usp10DllModule <> 0 then FreeLibrary(Usp10DllModule); - -end. diff --git a/Ext/SynEdit/Source/dlgConfirmReplace.dfm b/Ext/SynEdit/Source/dlgConfirmReplace.dfm index 072b571..662fbe9 100644 --- a/Ext/SynEdit/Source/dlgConfirmReplace.dfm +++ b/Ext/SynEdit/Source/dlgConfirmReplace.dfm @@ -8,14 +8,14 @@ object ConfirmReplaceDialog: TConfirmReplaceDialog Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText - Font.Height = -11 - Font.Name = 'MS Sans Serif' + Font.Height = -12 + Font.Name = 'Segoe UI' Font.Style = [] OldCreateOrder = False OnCreate = FormCreate OnDestroy = FormDestroy PixelsPerInch = 96 - TextHeight = 13 + TextHeight = 15 object lblConfirmation: TLabel Left = 60 Top = 12 diff --git a/Ext/SynEdit/Source/dlgReplaceText.dfm b/Ext/SynEdit/Source/dlgReplaceText.dfm index ccb5e34..477b9b3 100644 --- a/Ext/SynEdit/Source/dlgReplaceText.dfm +++ b/Ext/SynEdit/Source/dlgReplaceText.dfm @@ -1,8 +1,8 @@ inherited TextReplaceDialog: TTextReplaceDialog Caption = 'Replace text' - ClientHeight = 184 + ClientHeight = 206 OldCreateOrder = True - ExplicitHeight = 213 + ExplicitHeight = 235 PixelsPerInch = 96 TextHeight = 13 object ReplaceWidthLabel: TLabel [0] @@ -14,37 +14,30 @@ inherited TextReplaceDialog: TTextReplaceDialog AutoSize = False Caption = '&Replace with:' end - inherited SearchForLabel: TLabel - Left = 38 - Width = 52 - ExplicitLeft = 38 - ExplicitWidth = 52 + inherited cbSearchText: TComboBox + TabOrder = 5 end inherited FSearchOptions: TGroupBox Top = 70 - TabOrder = 2 ExplicitTop = 70 end inherited FSearchDirection: TRadioGroup Top = 70 - TabOrder = 3 ExplicitTop = 70 end inherited btnOK: TButton - Top = 155 - TabOrder = 4 - ExplicitTop = 155 - end - inherited btnCancel: TButton - Top = 155 - TabOrder = 5 - ExplicitTop = 155 + Top = 174 + ExplicitTop = 174 end - object cbReplaceText: TComboBox + object cbReplaceText: TComboBox [6] Left = 96 Top = 37 Width = 228 Height = 21 - TabOrder = 1 + TabOrder = 0 + end + inherited btnCancel: TButton + Top = 174 + ExplicitTop = 174 end end diff --git a/Ext/SynEdit/Source/dlgSearchText.dfm b/Ext/SynEdit/Source/dlgSearchText.dfm index e45fd76..783ada3 100644 --- a/Ext/SynEdit/Source/dlgSearchText.dfm +++ b/Ext/SynEdit/Source/dlgSearchText.dfm @@ -1,17 +1,18 @@ object TextSearchDialog: TTextSearchDialog - Left = 161 - Top = 217 + Left = 132 + Top = 168 BorderStyle = bsDialog Caption = 'Search Text' - ClientHeight = 154 + ClientHeight = 180 ClientWidth = 332 Color = clBtnFace - Font.Charset = DEFAULT_CHARSET + Font.Charset = ANSI_CHARSET Font.Color = clWindowText Font.Height = -11 - Font.Name = 'MS Sans Serif' + Font.Name = 'Segoe UI' Font.Style = [] OldCreateOrder = False + Position = poOwnerFormCenter OnCloseQuery = FormCloseQuery PixelsPerInch = 96 TextHeight = 13 @@ -24,7 +25,7 @@ object TextSearchDialog: TTextSearchDialog AutoSize = False Caption = '&Search for:' end - object FSearchText: TComboBox + object cbSearchText: TComboBox Left = 96 Top = 8 Width = 228 @@ -35,10 +36,10 @@ object TextSearchDialog: TTextSearchDialog Left = 8 Top = 40 Width = 154 - Height = 109 + Height = 127 Caption = 'Options' TabOrder = 1 - object FSearchCaseSensitive: TCheckBox + object cbSearchCaseSensitive: TCheckBox Left = 8 Top = 17 Width = 140 @@ -46,7 +47,7 @@ object TextSearchDialog: TTextSearchDialog Caption = 'C&ase sensitivity' TabOrder = 0 end - object FSearchWholeWords: TCheckBox + object cbSearchWholeWords: TCheckBox Left = 8 Top = 39 Width = 140 @@ -54,7 +55,7 @@ object TextSearchDialog: TTextSearchDialog Caption = '&Whole words only' TabOrder = 1 end - object FSearchFromCursor: TCheckBox + object cbSearchFromCursor: TCheckBox Left = 8 Top = 61 Width = 140 @@ -62,7 +63,7 @@ object TextSearchDialog: TTextSearchDialog Caption = 'Search from &caret' TabOrder = 2 end - object FSearchSelectedOnly: TCheckBox + object cbSearchSelectedOnly: TCheckBox Left = 8 Top = 83 Width = 140 @@ -70,6 +71,14 @@ object TextSearchDialog: TTextSearchDialog Caption = '&Selected text only' TabOrder = 3 end + object cbRegularExpression: TCheckBox + Left = 8 + Top = 104 + Width = 140 + Height = 17 + Caption = '&Regular expression' + TabOrder = 4 + end end object FSearchDirection: TRadioGroup Left = 170 @@ -85,7 +94,7 @@ object TextSearchDialog: TTextSearchDialog end object btnOK: TButton Left = 170 - Top = 125 + Top = 149 Width = 75 Height = 23 Caption = 'OK' @@ -95,7 +104,7 @@ object TextSearchDialog: TTextSearchDialog end object btnCancel: TButton Left = 249 - Top = 125 + Top = 149 Width = 75 Height = 23 Cancel = True diff --git a/Ext/SynEdit/Source/dlgSearchText.pas b/Ext/SynEdit/Source/dlgSearchText.pas index c194338..d877cda 100644 --- a/Ext/SynEdit/Source/dlgSearchText.pas +++ b/Ext/SynEdit/Source/dlgSearchText.pas @@ -26,15 +26,14 @@ If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. -$Id: dlgSearchText.pas,v 1.2 2002/11/05 17:04:02 giuseppem Exp $ +$Id: dlgSearchText.pas,v 1.3 2002/08/01 05:44:05 etrusco Exp $ You may retrieve the latest version of this file at the SynEdit home page, located at http://SynEdit.SourceForge.net -Contributors: Carlo Barazzetta - Known Issues: -------------------------------------------------------------------------------} + unit dlgSearchText; {$I SynEdit.inc} @@ -42,21 +41,22 @@ interface uses - SysUtils, Classes, Controls, Forms, + Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls; type TTextSearchDialog = class(TForm) SearchForLabel: TLabel; - FSearchText: TComboBox; + cbSearchText: TComboBox; FSearchDirection: TRadioGroup; FSearchOptions: TGroupBox; - FSearchCaseSensitive: TCheckBox; - FSearchWholeWords: TCheckBox; - FSearchFromCursor: TCheckBox; - FSearchSelectedOnly: TCheckBox; + cbSearchCaseSensitive: TCheckBox; + cbSearchWholeWords: TCheckBox; + cbSearchFromCursor: TCheckBox; + cbSearchSelectedOnly: TCheckBox; btnOK: TButton; btnCancel: TButton; + cbRegularExpression: TCheckBox; procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean); private function GetSearchBackwards: boolean; @@ -73,6 +73,8 @@ TTextSearchDialog = class(TForm) procedure SetSearchText(Value: string); procedure SetSearchTextHistory(Value: string); procedure SetSearchWholeWords(Value: boolean); + procedure SetSearchRegularExpression(const Value: boolean); + function GetSearchRegularExpression: boolean; public property SearchBackwards: boolean read GetSearchBackwards write SetSearchBackwards; @@ -87,12 +89,27 @@ TTextSearchDialog = class(TForm) write SetSearchTextHistory; property SearchWholeWords: boolean read GetSearchWholeWords write SetSearchWholeWords; + property SearchRegularExpression: boolean read GetSearchRegularExpression + write SetSearchRegularExpression; end; implementation {$R *.DFM} +(* +var + gbSearchBackwards: boolean; + gbSearchCaseSensitive: boolean; + gbSearchFromCaret: boolean; + gbSearchSelectionOnly: boolean; + gbSearchTextAtCaret: boolean; + gbSearchWholeWords: boolean; + gbSearchRegex: boolean; + + gsSearchText: string; + gsReplaceText: string; +*) { TTextSearchDialog } function TTextSearchDialog.GetSearchBackwards: boolean; @@ -102,42 +119,46 @@ function TTextSearchDialog.GetSearchBackwards: boolean; function TTextSearchDialog.GetSearchCaseSensitive: boolean; begin - Result := FSearchCaseSensitive.Checked; + Result := cbSearchCaseSensitive.Checked; end; function TTextSearchDialog.GetSearchFromCursor: boolean; begin - Result := FSearchFromCursor.Checked; + Result := cbSearchFromCursor.Checked; end; function TTextSearchDialog.GetSearchInSelection: boolean; begin - Result := FSearchSelectedOnly.Checked; + Result := cbSearchSelectedOnly.Checked; +end; + +function TTextSearchDialog.GetSearchRegularExpression: boolean; +begin + Result := cbRegularExpression.Checked; end; function TTextSearchDialog.GetSearchText: string; begin - Result := FSearchText.Text; + Result := cbSearchText.Text; end; function TTextSearchDialog.GetSearchTextHistory: string; var - i: Integer; + i: integer; begin Result := ''; - for i := 0 to FSearchText.Items.Count - 1 do - begin + for i := 0 to cbSearchText.Items.Count - 1 do begin if i >= 10 then break; if i > 0 then Result := Result + #13#10; - Result := Result + FSearchText.Items[i]; + Result := Result + cbSearchText.Items[i]; end; end; function TTextSearchDialog.GetSearchWholeWords: boolean; begin - Result := FSearchWholeWords.Checked; + Result := cbSearchWholeWords.Checked; end; procedure TTextSearchDialog.SetSearchBackwards(Value: boolean); @@ -147,32 +168,38 @@ procedure TTextSearchDialog.SetSearchBackwards(Value: boolean); procedure TTextSearchDialog.SetSearchCaseSensitive(Value: boolean); begin - FSearchCaseSensitive.Checked := Value; + cbSearchCaseSensitive.Checked := Value; end; procedure TTextSearchDialog.SetSearchFromCursor(Value: boolean); begin - FSearchFromCursor.Checked := Value; + cbSearchFromCursor.Checked := Value; end; procedure TTextSearchDialog.SetSearchInSelection(Value: boolean); begin - FSearchSelectedOnly.Checked := Value; + cbSearchSelectedOnly.Checked := Value; end; procedure TTextSearchDialog.SetSearchText(Value: string); begin - FSearchText.Text := Value; + cbSearchText.Text := Value; end; procedure TTextSearchDialog.SetSearchTextHistory(Value: string); begin - FSearchText.Items.Text := Value; + cbSearchText.Items.Text := Value; end; procedure TTextSearchDialog.SetSearchWholeWords(Value: boolean); begin - FSearchWholeWords.Checked := Value; + cbSearchWholeWords.Checked := Value; +end; + +procedure TTextSearchDialog.SetSearchRegularExpression( + const Value: boolean); +begin + cbRegularExpression.Checked := Value; end; { event handlers } @@ -181,24 +208,22 @@ procedure TTextSearchDialog.FormCloseQuery(Sender: TObject; var CanClose: Boolean); var s: string; - i: Integer; -begin - if ModalResult = mrOK then - begin - s := FSearchText.Text; - if s <> '' then - begin - i := FSearchText.Items.IndexOf(s); - if i > -1 then - begin - FSearchText.Items.Delete(i); - FSearchText.Items.Insert(0, s); - FSearchText.Text := s; - end - else - FSearchText.Items.Insert(0, s); + i: integer; +begin + if ModalResult = mrOK then begin + s := cbSearchText.Text; + if s <> '' then begin + i := cbSearchText.Items.IndexOf(s); + if i > -1 then begin + cbSearchText.Items.Delete(i); + cbSearchText.Items.Insert(0, s); + cbSearchText.Text := s; + end else + cbSearchText.Items.Insert(0, s); end; end; end; end. + + \ No newline at end of file diff --git a/Ext/SynEdit/Source/kTextDrawer.pas b/Ext/SynEdit/Source/kTextDrawer.pas deleted file mode 100644 index aaa36d5..0000000 --- a/Ext/SynEdit/Source/kTextDrawer.pas +++ /dev/null @@ -1,722 +0,0 @@ -{------------------------------------------------------------------------------- -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: SynEdit.pas, released 2000-04-07. -The Original Code is based on mwCustomEdit.pas by Martin Waldenburg, part of -the mwEdit component suite. -Portions created by Martin Waldenburg are Copyright (C) 1998 Martin Waldenburg. -All Rights Reserved. - -Contributors to the SynEdit and mwEdit projects are listed in the -Contributors.txt file. - -Alternatively, the contents of this file may be used under the terms of the -GNU General Public License Version 2 or later (the "GPL"), in which case -the provisions of the GPL are applicable instead of those above. -If you wish to allow use of your version of this file only under the terms -of the GPL and not to allow others to use your version of this file -under the MPL, indicate your decision by deleting the provisions above and -replace them with the notice and other provisions required by the GPL. -If you do not delete the provisions above, a recipient may use your version -of this file under either the MPL or the GPL. - -$Id: kTextDrawer.pas,v 1.10.2.3 2008/09/14 16:25:03 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: --------------------------------------------------------------------------------} -unit kTextDrawer; - -{$I SynEdit.inc} - -interface - -uses - Types, - Qt, - QGraphics, - QForms, - QControls, - Classes, - QStdCtrls; - -const - ETO_OPAQUE = 1; - ETO_CLIPPED = 2; - - CYHSCROLL = 16; - CXVSCROLL = 16; - MaxShortInt = High(ShortInt); - -// system metics - SM_CXDRAG = 1; - SM_CYDRAG = 2; - -type - UINT = DWORD; - - // this is to get around some weirdness with the Kylix font code - // where the style given by the font object isn't correct - TFontHolder = class - style: TFontStyles; - font: TFont; - - constructor Create(aFont: TFont; aStyle: TFontStyles); - end; - - TheTextDrawer = class(TObject) - private - // Font information - fBaseFont: TFont; - - // current font and properties - fCurrentStyle: TFontStyles; - fCurrentFont: TFont; - fCurrentColor: TColor; - - // current font attributes - FBkColor: TColor; - fCharWidth: integer; - fCharHeight: integer; - fakeBold: boolean; // true if the font can't be bold - - // Begin/EndDrawing calling count - FDrawingCount: Integer; - fCanvas: TCanvas; - - fFontList: TList; - function GetFont(Index: integer): TFont; - function GetFontCount: integer; - function GetFontStyle(Index: integer): TFontStyles; - function FindFont(aStyle: TFontStyles; aColor: TColor): TFont; - - property Fonts[Index: integer]: TFont read getFont; - property FontCount: integer read getFontCount; - property FontStyle[Index: integer]: TFontStyles read GetFontStyle; - protected - procedure UpdateCurrentFont; - procedure UpdateFontMetrics; - procedure ClearFontList; - public - constructor Create(CalcExtentBaseStyle: TFontStyles; ABaseFont: TFont); virtual; - destructor Destroy; override; - function GetCharWidth: Integer; virtual; - function GetCharHeight: Integer; virtual; - procedure BeginDrawing(ACanvas : TCanvas); overload; virtual; - - procedure EndDrawing; virtual; - procedure TextOut(X, Y: Integer; Text: PWideChar; Length: Integer); virtual; - procedure ExtTextOut(X, Y: Integer; fuOptions: UINT; const ARect: TRect; - Text: PWideChar; Length: Integer); virtual; - procedure SetBaseFont(Value: TFont); virtual; - procedure SetBaseStyle(const Value: TFontStyles); virtual; - procedure SetStyle(Value: TFontStyles); virtual; - procedure SetForeColor(Value: TColor); virtual; - procedure SetBackColor(Value: TColor); virtual; - procedure SetCharExtra(Value: Integer); virtual; - property CharWidth: Integer read GetCharWidth; - property CharHeight: Integer read GetCharHeight; - property BaseFont: TFont write SetBaseFont; - property BaseStyle: TFontStyles write SetBaseStyle; - property ForeColor: TColor write SetForeColor; - property BackColor: TColor write SetBackColor; - property Style: TFontStyles write SetStyle; - end; - - TCaret = class(TComponent) - private - FActive: Boolean; - FRect: TRect; - FInternalShowCount: Integer; - FOwnerCanvas: TControlCanvas; - FShowCount: Integer; - procedure ForceInternalInvisible; - procedure ForceInternalVisible; - function GetTopLeft: TPoint; - procedure Paint; - procedure SetTopLeft(const Value: TPoint); - procedure InternalHide; - procedure InternalShow; - function Visible: Boolean; - public - constructor Create(AOwner: TWidgetControl; Width, Height: Integer); reintroduce; - destructor Destroy; override; - procedure Hide; - procedure Show; - procedure Toggle; - property Active: Boolean read FActive; - property OwnerCanvas: TControlCanvas read FOwnerCanvas; - property TopLeft: TPoint read GetTopLeft write SetTopLeft; - end; - - TSynEditScrollBar = class(TScrollBar) - public - constructor Create(AOwner: TComponent); override; - end; - -procedure InternalFillRect(Canvas: TCanvas; rect: TRect); -function GetSystemMetrics(Metric: Integer): Integer; - -procedure CreateCaret(Control: TWidgetControl; dummy, Width, Height: Integer); -procedure SetCaretPos(X, Y: Integer); -procedure ShowCaret(Control: TWidgetControl); -procedure HideCaret(Control: TWidgetControl); -procedure DestroyCaret; -procedure ScrollWindow(Control: TWidgetControl; DeltaX, DeltaY: Integer; Rect: PRect); - -implementation - -uses -{$IFDEF SYN_KYLIX} - libc, -{$ENDIF} - QExtCtrls; - -type - TCaretManager = class - private - fBlinkTimer: TTimer; - fCurrentCaret: TCaret; - procedure HandleTimer(Sender : TObject); - procedure SetCurrentCaret(const Value: TCaret); - public - constructor Create; - destructor Destroy; override; - procedure ResetTimer; - property CurrentCaret: TCaret read fCurrentCaret write SetCurrentCaret; - end; - -var - CaretManager: TCaretManager; - -function FindCaret(Control: TWidgetControl): TCaret; -var - i: Integer; -begin - Result := nil; - - for i := 0 to Control.ComponentCount - 1 do - if Control.Components[i] is TCaret then - begin - Result := TCaret(Control.Components[i]); - break; - end; -end; - -procedure CreateCaret(Control: TWidgetControl; dummy, Width, Height: Integer); -var - Caret: TCaret; -begin - Caret := FindCaret(Control); - if Assigned(Caret) then - Caret.Free; - Caret := TCaret.Create(Control, Width, Height); - - CaretManager.CurrentCaret := Caret; -end; - -procedure DestroyCaret; -begin - if CaretManager.CurrentCaret <> nil then - begin - CaretManager.CurrentCaret.Free; - CaretManager.CurrentCaret := nil; - end; -end; - -procedure ScrollWindow(Control: TWidgetControl; DeltaX, DeltaY: Integer; Rect: PRect); -var - Caret: TCaret; - NewTopLeft: TPoint; - CaretWasActive: Boolean; -begin - Caret := FindCaret(Control); - CaretWasActive := False; - if Assigned(Caret) then - begin - CaretWasActive := Caret.Active; - if CaretWasActive then Caret.Hide; - NewTopLeft := Point(Caret.TopLeft.X + DeltaX, Caret.TopLeft.Y + DeltaY); - if NewTopLeft.X < Rect.Left then - NewTopLeft.X := -Caret.FRect.Left - 1; - if NewTopLeft.Y < Rect.Top then - NewTopLeft.Y := -Caret.FRect.Bottom - 1; - Caret.TopLeft := NewTopLeft; - end; - QWidget_Scroll(Control.Handle, DeltaX, DeltaY, Rect); - if Assigned(Caret) and CaretWasActive then Caret.Show; -end; - -procedure SetCaretPos(X, Y: Integer); -var - Caret: TCaret; -begin - Caret := CaretManager.CurrentCaret; - if Assigned(Caret) then - Caret.TopLeft := Point(X, Y); -end; - -procedure ShowCaret(Control: TWidgetControl); -var - Caret: TCaret; -begin - Caret := FindCaret(Control); - if Assigned(Caret) then - Caret.Show; -end; - -procedure HideCaret(Control: TWidgetControl); -var - Caret: TCaret; -begin - Caret := FindCaret(Control); - if Assigned(Caret) then - Caret.Hide; -end; - -procedure InternalFillRect(canvas: TCanvas; rect: TRect); -begin - canvas.FillRect(rect); -end; - -function GetSystemMetrics(metric: integer): integer; -begin - case metric of - SM_CXDRAG: result := 2; - SM_CYDRAG: result := 2; - else - result := -1; - end; -end; - -{ TheTextDrawer } - -procedure TheTextDrawer.BeginDrawing(ACanvas: TCanvas); -begin - if fDrawingCount = 0 then - begin - UpdateCurrentFont; - fCanvas := ACanvas; - fCanvas.Font := fCurrentFont; - - fCanvas.Brush.Color := FBkColor; - end; - - inc(FDrawingCount); -end; - -procedure TheTextDrawer.ClearFontList; -var - i: integer; -begin - for i := 0 to FontCount - 1 do - begin - Fonts[i].Free; - TFontHolder(fFontList[i]).Free; - end; - - fFontList.Clear; -end; - -constructor TheTextDrawer.Create(CalcExtentBaseStyle: TFontStyles; ABaseFont: TFont); -begin - fBaseFont := TFont.Create; - fFontList := TList.Create; - - BaseFont := ABaseFont; - BaseStyle := CalcExtentBaseStyle; -end; - -destructor TheTextDrawer.Destroy; -begin - fBaseFont.Free; - ClearFontList; - fFontList.Free; - - inherited Destroy; -end; - -procedure TheTextDrawer.EndDrawing; -begin - if FDrawingCount > 0 then - dec(FDrawingCount); - - if FDrawingCount = 0 then - fCanvas := nil; -end; - -procedure TheTextDrawer.ExtTextOut(X, Y: Integer; fuOptions: UINT; - const ARect: TRect; Text: PWideChar; Length: Integer); -begin - if fCanvas <> nil then - begin -// fCanvas.Brush.Color := random($ffffff); - fCanvas.Brush.Style := bsSolid; - fCanvas.FillRect(ARect); - - if Text <> nil then - begin - if Length = -1 then - fCanvas.TextRect(ARect, X, Y, Text) - else - fCanvas.TextRect(ARect, X, Y, copy(Text, 1, Length)); - - if fakeBold then - if Length = -1 then - fCanvas.TextRect(ARect, X + 1, Y, Text) - else - fCanvas.TextRect(ARect, X + 1, Y, copy(Text, 1, Length)); - end; - end; -end; - -function TheTextDrawer.FindFont(aStyle: TFontStyles; aColor: TColor): TFont; -var - i: integer; -begin - Result := nil; - - for i := 0 to FontCount - 1 do - if (FontStyle[i] = aStyle) and (Fonts[i].Color = aColor) then - begin - Result := Fonts[i]; - break; - end; - - if Result = nil then - begin - Result := TFont.Create; - Result.Assign(fBaseFont); - Result.Style := aStyle; - Result.Color := aColor; - fFontList.Add(TFontHolder.Create(Result, aStyle)); - end; -end; - -function TheTextDrawer.GetCharHeight: Integer; -begin - Result := fCharHeight; -end; - -function TheTextDrawer.GetCharWidth: Integer; -begin - Result := fCharWidth; -end; - -function TheTextDrawer.GetFont(Index: integer): TFont; -begin - Result := TFontHolder(fFontList[Index]).font; -end; - -function TheTextDrawer.GetFontCount: integer; -begin - Result := fFontList.Count; -end; - -function TheTextDrawer.GetFontStyle(Index: integer): TFontStyles; -begin - Result := TFontHolder(fFontList[Index]).style; -end; - -procedure TheTextDrawer.SetBackColor(Value: TColor); -begin - if FBkColor <> Value then - begin - FBkColor := Value; - - if fCanvas <> nil then - fCanvas.Brush.Color := Value; - end; -end; - -procedure TheTextDrawer.SetBaseFont(Value: TFont); -begin - if Value <> nil then - begin - fBaseFont.Assign(Value); - UpdateFontMetrics; - UpdateCurrentFont; - end; -end; - -procedure TheTextDrawer.SetBaseStyle(const Value: TFontStyles); -begin - fBaseFont.Style := Value; - UpdateFontMetrics; -end; - -procedure TheTextDrawer.SetCharExtra(Value: Integer); -begin - // do nothing -end; - -procedure TheTextDrawer.SetForeColor(Value: TColor); -begin - fCurrentColor := Value; - UpdateCurrentFont; -end; - -procedure TheTextDrawer.SetStyle(Value: TFontStyles); -begin - fCurrentStyle := Value; - UpdateCurrentFont; -end; - -procedure TheTextDrawer.TextOut(X, Y: Integer; Text: PWideChar; - Length: Integer); -begin - if fCanvas <> nil then - begin - fCanvas.Brush.Style := bsSolid; - - if Text <> nil then - begin - if Length = -1 then - fCanvas.TextOut(X, Y, Text) - else - fCanvas.TextOut(X, Y, copy(Text, 1, Length)); - - - if fakeBold then - if Length = -1 then - fCanvas.TextOut(X + 1, Y, Text) - else - fCanvas.TextOut(X + 1, Y, copy(Text, 1, Length)); - end; - end; -end; - -procedure TheTextDrawer.UpdateCurrentFont; -begin - fCurrentFont := FindFont(fCurrentStyle, fCurrentColor); - QFont_setFixedPitch(fCurrentFont.Handle, True); - - if fCanvas <> nil then - fCanvas.Font.Assign(fCurrentFont); - - // Make sure that we can draw bold text even if the current font - // doesn't want to do it - fakeBold := (fsBold in fCurrentStyle) and not (fsBold in fCurrentFont.Style); -end; - -procedure TheTextDrawer.UpdateFontMetrics; -var - fm: QFontMetricsH; - ch: WideChar; - w: Integer; - fi: QFontInfoH; - family: UnicodeString; -begin - fi := QFontInfo_create(fBaseFont.Handle); - try - // make sure that the font object is refering to the same - // font that Qt is actually using, otherwise the width functions - // don't seem to work properly :( - if not QFontInfo_exactMatch(fi) then - begin - fBaseFont.Size := QFontInfo_pointSize(fi); - QFontInfo_family(fi, @family); - fBaseFont.Name := family; - end; - finally - QFontInfo_destroy(fi); - end; - - fm := QFontMetrics_create(fBaseFont.Handle); - try - ch := 'W'; - - w := QFontMetrics_width(fm, @ch); - fCharWidth := w; - fCharHeight := QFontMetrics_height(fm); - finally - QFontMetrics_destroy(fm); - end; - - ClearFontList; -end; - -{ TCaret } - -constructor TCaret.Create(AOwner: TWidgetControl; Width, Height: Integer); -begin - inherited Create(AOwner); - FRect.Right := Width; - FRect.Bottom := Height; - FOwnerCanvas := TControlCanvas.Create; - TControlCanvas(FOwnerCanvas).Control := AOwner; -end; - -destructor TCaret.Destroy; -begin - if CaretManager.CurrentCaret = Self then - CaretManager.CurrentCaret := nil; - FActive := False; - ForceInternalInvisible; - inherited Destroy; - FOwnerCanvas.Free; -end; - -procedure TCaret.ForceInternalInvisible; -begin - while FInternalShowCount >= 1 do InternalHide; -end; - -procedure TCaret.ForceInternalVisible; -begin - while FInternalShowCount <= 0 do InternalShow; -end; - -function TCaret.GetTopLeft: TPoint; -begin - Result := FRect.TopLeft; -end; - -procedure TCaret.Hide; -begin - dec(FShowCount); - if FShowCount = 0 then - begin - FActive := False; - ForceInternalInvisible; - end; -end; - -procedure TCaret.InternalHide; -begin - dec(FInternalShowCount); - if FInternalShowCount = 0 then - Paint; -end; - -procedure TCaret.InternalShow; -begin - inc(FInternalShowCount); - if FInternalShowCount = 1 then - Paint; -end; - -procedure TCaret.Paint; -var - OldCopyMode: TCopyMode; -begin - if Assigned(Owner)then - with OwnerCanvas do - begin - OldCopyMode := CopyMode; - CopyMode := cmDstInvert; - CopyRect(FRect, OwnerCanvas, FRect); - CopyMode := OldCopyMode; - end; -end; - -procedure TCaret.SetTopLeft(const Value: TPoint); -begin - if (FRect.Left = Value.X) and (FRect.Top = Value.Y) then exit; - - if FActive then InternalHide; - FRect.Right := FRect.Right + (Value.X - FRect.Left); - FRect.Left := Value.X; - FRect.Bottom := FRect.Bottom + (Value.Y - FRect.Top); - FRect.Top := Value.Y; - if FActive then - begin - ForceInternalVisible; - CaretManager.ResetTimer; - end; -end; - -procedure TCaret.Show; -begin - if FShowCount < 1 then - begin - inc(FShowCount); - if FShowCount = 1 then - begin - FActive := True; - ForceInternalVisible; - CaretManager.ResetTimer; - end; - end; -end; - -procedure TCaret.Toggle; -begin - if Active then - if Visible then InternalHide else InternalShow; -end; - -function TCaret.Visible: Boolean; -begin - Result := FInternalShowCount > 0; -end; - -{ TFontHolder } - -constructor TFontHolder.Create(aFont: TFont; aStyle: TFontStyles); -begin - Font := aFont; - Style:= aStyle; -end; - -{ TCaretManager } - -constructor TCaretManager.Create; -begin - fBlinkTimer := TTimer.Create(nil); - fBlinkTimer.Enabled := False; - fBlinkTimer.Interval := QApplication_cursorFlashTime div 2; - fBlinkTimer.OnTimer := HandleTimer; -end; - -destructor TCaretManager.Destroy; -begin - fBlinkTimer.Free; - inherited Destroy; -end; - -procedure TCaretManager.HandleTimer(Sender: TObject); -begin - if Assigned(CurrentCaret) then - CurrentCaret.Toggle; -end; - -procedure TCaretManager.ResetTimer; -begin - fBlinkTimer.Enabled := False; - fBlinkTimer.Enabled := True; -end; - -procedure TCaretManager.SetCurrentCaret(const Value: TCaret); -begin - if fCurrentCaret <> Value then - begin - fCurrentCaret := Value; - fBlinkTimer.Enabled := (CurrentCaret <> nil) and CurrentCaret.Active; - end; -end; - -{ TSynEditScrollBar } - -constructor TSynEditScrollBar.Create(AOwner: TComponent); -begin - inherited Create(AOwner); - ControlStyle := ControlStyle + [csNoFocus]; - TabStop := False; - Visible := False; -end; - -initialization - CaretManager := TCaretManager.Create; -finalization - CaretManager.Free; -end. diff --git a/README.htm b/README.htm index 845d642..9d6fc4f 100644 --- a/README.htm +++ b/README.htm @@ -30,7 +30,7 @@ }

Markdown Editor and Shell Extensions License

-

Latest Version 2.3.3 - 26 Jan 2025

+

Latest Version 2.4.0 - 23 Feb 2025

A collection of tools for markdown files, to edit and view content:

  • A Markdown Text Editor to manually edit a markdown file, with instant preview of the output in a HTML Viewer.

    @@ -81,6 +81,13 @@

    Manual Build and Installation (only for Delphi developers)

  • Release Notes

    +

    23 Feb 2025: ver. 2.4.0

    +
      +
    • Added “Wordwrap option” for the editor (active by default)
    • +
    • Added “Layout Views”
    • +
    • Fixed Menu over Editor Toolbar and Captions when collapsed
    • +
    • Updated the latest Image32 library
    • +

    26 Jan 2025: ver. 2.3.3

    • Fixed loading remote svg files
    • @@ -247,7 +254,7 @@

      Third parties libraries:

      HtmlToPdf - https://github.com/MuzioValerio/HtmlToPdf

      Copyright © Muzio Valerio.

      Image32 Library - http://www.angusj.com/delphi/image32/Docs/_Body.htm

      -

      Copyright ©2019-2023 Angus Johnson.

      +

      Copyright ©2019-2025 Angus Johnson.

      dzlib - https://sourceforge.net/projects/dzlib/

      Copyright (c) Thomas Mueller

      HTMLViewer - https://github.com/BerndGabriel/HtmlViewer

      diff --git a/README.md b/README.md index 01be3be..57ce6b8 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # Markdown Editor and Shell Extensions [![License](https://img.shields.io/badge/License-Apache%202.0-yellowgreen.svg)](https://opensource.org/licenses/Apache-2.0) -**Latest Version 2.3.3 - 26 Jan 2025** +**Latest Version 2.4.0 - 23 Feb 2025** **A collection of tools for markdown files, to edit and view content:** @@ -60,13 +60,19 @@ or the command: Build.bat (defining location of your Delphi environment) To manually install the SVGShellExtensions.dll follow these steps: 1. Close all the windows explorer instances which have the preview handler active or the preview handler was used (remember the dll remains in memory until the windows explorer was closed). - + 2. If you have already used the installer uninstall the components from system. - + 3. To install manually the dll run the `Unregister_Register.cmd` (run-as-administrator): notice that you must change the path into cmd file. ## Release Notes ## +23 Feb 2025: ver. 2.4.0 +- Added "Wordwrap option" for the editor (active by default) +- Added "Layout Views" +- Fixed Menu over Editor Toolbar and Captions when collapsed +- Updated the latest Image32 library + 26 Jan 2025: ver. 2.3.3 - Fixed loading remote svg files - Fixed "autocreate" missing file @@ -232,7 +238,7 @@ Copyright © Muzio Valerio. **Image32 Library** - http://www.angusj.com/delphi/image32/Docs/_Body.htm -Copyright ©2019-2023 Angus Johnson. +Copyright ©2019-2025 Angus Johnson. **dzlib** - https://sourceforge.net/projects/dzlib/ diff --git a/Setup/License_ENG.rtf b/Setup/License_ENG.rtf index eb736264c27ee73e76e7883275afe47bf6eb55f5..2e28ac17a617ef89c8cdcdb756ec6f275b41e36c 100644 GIT binary patch delta 97 zcmcbmcusMHB_pHhW-G>IPBDeF{G#mC6osTpg@DT7I&dGwj+F8Ywd8sLxC3?kWd3we9rA5i9Y57Izsd{;-CHiHV tspVzK`cNhM3bnP>F=;s|Ma4NK)fpuv1y=enIbyU=zQ`f9*@3%{6#y2EGFkut diff --git a/Setup/Licenza_ITA.rtf b/Setup/Licenza_ITA.rtf index 4e0d9383402c44832d97d899c800521b3f1da67a..c14125117d9e22594cd4e1e626668451af6c75fb 100644 GIT binary patch delta 97 zcmaE__*ij+IU}R#W(&qDPBDeF{G#mC6osTpg@DT7fO z`em7^k*CHe}rwbe0cIVnZOIVIH@B_#!'#10''#10 + end + item + IconName = 'layout_both' + SVGText = + ''#13#10' '#13#10' '#13#10' '#13#10' '#13#10' <' + + 'rect x="26" y="21" width="13" height="16" fill="#82AE82"/>'#13#10' ' + + ''#13#10''#13#10 + end + item + IconName = 'layout_left' + SVGText = + ''#13#10' '#13#10' '#13#10' '#13#10' '#13#10' <' + + 'rect x="37" y="21" width="2" height="16" fill="#82AE82"/>'#13#10' <' + + '/g>'#13#10''#13#10 + end + item + IconName = 'layout_right' + SVGText = + ''#13#10' '#13#10' '#13#10' '#13#10' '#13#10' '#13#10' <' + + '/g>'#13#10''#13#10 end> Left = 248 Top = 152 diff --git a/Source/MDShellEx.Resources.pas b/Source/MDShellEx.Resources.pas index be4826a..48ee657 100644 --- a/Source/MDShellEx.Resources.pas +++ b/Source/MDShellEx.Resources.pas @@ -310,6 +310,7 @@ function TdmResources.getStreamData(const AFileName : String; LFileName: TFileName; LFileContent: string; Begin + //downloading Image from WEB Result := nil; FStream.Clear; LIdHTTP := nil; @@ -346,7 +347,10 @@ function TdmResources.getStreamData(const AFileName : String; begin // Need To check For Failed Retrieval... FStream.Position:= 0; - LFileStream := TStringStream.Create('', TEncoding.UTF8); + if SameText(ExtractFileExt(LFileName),'svg') then + LFileStream := TStringStream.Create('', TEncoding.UTF8) + else + LFileStream := TStringStream.Create('', TEncoding.Ansi); LFileStream.LoadFromStream(FStream); LFileContent := LFileStream.DataString; // Save string to local File diff --git a/Source/MDShellEx.Settings.pas b/Source/MDShellEx.Settings.pas index db534ea..b833722 100644 --- a/Source/MDShellEx.Settings.pas +++ b/Source/MDShellEx.Settings.pas @@ -46,6 +46,8 @@ interface const MaxfontSize = 30; MinfontSize = 8; + default_lightactivelinecolor = 15066597; + default_darkactivelinecolor = 0; resourcestring Background_Grayscale_Caption = 'Backlight %d%%'; @@ -53,6 +55,7 @@ interface type TThemeSelection = (tsAsWindows, tsDarkTheme, tsLightTheme); TThemeType = (ttLight, ttDark); + TLayoutMode = (lmBoth, lmMarkDown, lmHTML); //Class to register Theme attributes (like dark or light) TThemeAttribute = class @@ -91,6 +94,8 @@ TSettings = class FButtonDrawRounded: Boolean; FToolbarDrawRounded: Boolean; FMenuDrawRounded: Boolean; + FLayoutMode: TLayoutMode; + FViewerPercentSize: word; function GetUseDarkStyle: Boolean; function GetThemeSectionName: string; function GetButtonTextColor: TColor; @@ -100,10 +105,10 @@ TSettings = class procedure SetButtonDrawRounded(const Value: Boolean); procedure SetToolbarDrawRounded(const Value: Boolean); procedure SetMenuDrawRounded(const Value: Boolean); + procedure SetViewerPercentSize(const AValue: word); protected FIniFile: TIniFile; public - LightBackground: Integer; PDFPageSettings: TPDFPageSettings; constructor CreateSettings(const ASettingFileName: string; const ASynEditHighilighter: TSynCustomHighlighter; @@ -139,6 +144,8 @@ TSettings = class property ButtonDrawRounded: Boolean read FButtonDrawRounded write SetButtonDrawRounded; property ToolbarDrawRounded: Boolean read FToolbarDrawRounded write SetToolbarDrawRounded; property MenuDrawRounded: Boolean read FMenuDrawRounded write SetMenuDrawRounded; + property LayoutMode: TLayoutMode read FLayoutMode write FLayoutMode; + property ViewerPercentSize: word read FViewerPercentSize write SetViewerPercentSize; end; TPreviewSettings = class(TSettings) @@ -150,6 +157,8 @@ TEditorSettings = class(TSettings) private FDownloadFromWEB: Boolean; FAutoRefreshWhenEditing: Boolean; + FLightActiveLineColor: TColor; + FDarkActiveLineColor: TColor; procedure SetDownloadFromWEB(const Value: Boolean); procedure WriteSynEditorOptions( const ASynEditorOptions: TSynEditorOptionsContainer); @@ -171,6 +180,8 @@ TEditorSettings = class(TSettings) procedure UpdateOpenedFiles(AFileList: TStrings; const ACurrentFileName: string); property DownloadFromWEB: Boolean read FDownloadFromWEB write SetDownloadFromWEB; property AutoRefreshWhenEditing: Boolean read FAutoRefreshWhenEditing write SetAutoRefreshWhenEditing; + property LightActiveLineColor: TColor read FLightActiveLineColor write FLightActiveLineColor; + property DarkActiveLineColor: TColor read FDarkActiveLineColor write FDarkActiveLineColor; end; implementation @@ -202,9 +213,6 @@ implementation EDITOPTION_LINESPACING = 'EditorOptions_LineSpacing'; EDITOPTION_BOOKMARK = 'EditorOptions_Bookmark'; EDITOPTION_OPTIONS = 'EditorOptions_Options'; - default_lightbackground = 200; - default_darkbackground = 55; - var ThemeAttributes: TList; @@ -342,6 +350,8 @@ procedure TSettings.ReadSettings(const ASynEditHighilighter: TSynCustomHighlight FActivePageIndex := FIniFile.ReadInteger('Global', 'ActivePageIndex', 0); FStyleName := FIniFile.ReadString('Global', 'StyleName', DefaultStyleName); FThemeSelection := TThemeSelection(FIniFile.ReadInteger('Global', 'ThemeSelection', 0)); + FLayoutMode := TLayoutMode(FIniFile.ReadInteger('Global', 'LayoutMode', 0)); + ViewerPercentSize := FIniFile.ReadInteger('Global', 'ViewerPercentSize', 50); FProcessorDialect := TMarkdownProcessorDialect(FIniFile.ReadInteger('Global', 'ProcessorDialect', 1)); FToolbarDrawRounded := FIniFile.ReadBool('Global', 'ToolbarDrawRounded', false); FButtonDrawRounded := FIniFile.ReadBool('Global', 'ButtonDrawRounded', false); @@ -354,11 +364,6 @@ procedure TSettings.ReadSettings(const ASynEditHighilighter: TSynCustomHighlight else FUseDarkStyle := FThemeSelection = tsDarkTheme; - if FUseDarkStyle then - LightBackground := FIniFile.ReadInteger('Global', 'LightBackground', default_darkbackground) - else - LightBackground := FIniFile.ReadInteger('Global', 'LightBackground', default_lightbackground); - //Load Highlighter in specific section by Theme if Assigned(ASynEditHighilighter) then begin @@ -422,15 +427,14 @@ procedure TSettings.WriteSettings(const ASynEditHighilighter: TSynCustomHighligh FIniFile.WriteInteger('Global', 'ActivePageIndex', FActivePageIndex); FIniFile.WriteInteger('Global', 'ThemeSelection', Ord(FThemeSelection)); + FIniFile.WriteInteger('Global', 'LayoutMode', Ord(FLayoutMode)); + FIniFile.WriteInteger('Global', 'ViewerPercentSize', FViewerPercentSize); + FIniFile.WriteInteger('Global', 'ProcessorDialect', Ord(FProcessorDialect)); FIniFile.WriteBool('Global', 'ToolbarDrawRounded', ToolbarDrawRounded); FIniFile.WriteBool('Global', 'ButtonDrawRounded', ButtonDrawRounded); FIniFile.WriteBool('Global', 'MenuDrawRounded', MenuDrawRounded); - if (FUseDarkStyle and (LightBackground <> default_darkbackground)) or - (not FUseDarkStyle and (LightBackground <> default_lightbackground)) then - FIniFile.WriteInteger('Global', 'LightBackground', LightBackground); - if ASynEditHighilighter <> nil then begin //Save Highlighter in specific section by Theme @@ -468,6 +472,18 @@ procedure TSettings.SetButtonDrawRounded(const Value: Boolean); FButtonDrawRounded := Value; end; +procedure TSettings.SetViewerPercentSize(const AValue: word); +begin + //FViewerPercentSize is the % of size of HTML Viewer + //Value can be 5% to 95% + if AValue > 95 then + FViewerPercentSize := 95 + else if AValue < 5 then + FViewerPercentSize := 5 + else + FViewerPercentSize := AValue; +end; + { TPreviewSettings } constructor TPreviewSettings.CreateSettings( @@ -493,13 +509,16 @@ procedure TEditorSettings.SetDownloadFromWEB(const Value: Boolean); constructor TEditorSettings.CreateSettings(const ASynEditHighilighter: TSynCustomHighlighter; const ASynEditorOptions: TSynEditorOptionsContainer); +var + LSettingsFileName: TFileName; begin HistoryFileList := TStringList.Create; OpenedFileList := TStringList.Create; - inherited CreateSettings( - IncludeTrailingPathDelimiter( - GetSpecialFolder(CSIDL_APPDATA)) +'MDShellExtensions\EditorSettings.ini', - ASynEditHighilighter, ASynEditorOptions); + LSettingsFileName := ChangeFileExt(GetModuleName(HInstance), '.ini'); + if not FileExists(LSettingsFileName) then + LSettingsFileName := IncludeTrailingPathDelimiter( + GetSpecialFolder(CSIDL_APPDATA)) +'MDShellExtensions\EditorSettings.ini'; + inherited CreateSettings(LSettingsFileName, ASynEditHighilighter, ASynEditorOptions); ReadSynEditorOptions(ASynEditorOptions); end; @@ -521,6 +540,15 @@ procedure TEditorSettings.ReadSettings( LPos: Integer; begin inherited; + + //ActiveLine Color + DarkActiveLineColor := FIniFile.ReadInteger('Global', 'DarkActiveLineColor', default_darkactivelinecolor); + LightActiveLineColor := FIniFile.ReadInteger('Global', 'LightActiveLineColor', default_lightactivelinecolor); + if FUseDarkStyle then + ASynEditorOptions.ActiveLineColor := DarkActiveLineColor + else + ASynEditorOptions.ActiveLineColor := LightActiveLineColor; + if ASynEditHighilighter = nil then begin DownloadFromWEB := Boolean(FIniFile.ReadInteger('Global', 'DownloadFromWEB', 0)); @@ -564,13 +592,22 @@ procedure TEditorSettings.ReadSettings( procedure TeditorSettings.ReadSynEditorOptions( const ASynEditorOptions: TSynEditorOptionsContainer); - procedure UpdateEditorOptions(const AName: string; const AValue: TSynEditorOption; + procedure UpdateEditorOptions(const AName: string; + const AValue: TSynEditorOption; const ADefault: Boolean = True); begin if FIniFile.ReadBool(EDITOPTION_OPTIONS, AName, ADefault) then ASynEditorOptions.Options := ASynEditorOptions.Options + [AValue]; end; + procedure UpdateEditorScrollOptions(const AName: string; + const AValue: TSynEditorScrollOption; + const ADefault: Boolean = True); + begin + if FIniFile.ReadBool(EDITOPTION_OPTIONS, AName, ADefault) then + ASynEditorOptions.ScrollOptions := ASynEditorOptions.ScrollOptions + [AValue]; + end; + begin if not Assigned(ASynEditorOptions) then Exit; @@ -595,15 +632,13 @@ procedure TeditorSettings.ReadSynEditorOptions( //Options ASynEditorOptions.Options := []; UpdateEditorOptions('AutoIndent', eoAutoIndent); - UpdateEditorOptions('AutoSizeMaxScrollWidth', eoAutoSizeMaxScrollWidth); UpdateEditorOptions('DragDropEditing', eoDragDropEditing); UpdateEditorOptions('SmartTabs', eoSmartTabs); - UpdateEditorOptions('AltSetsColumnMode', eoAltSetsColumnMode); - UpdateEditorOptions('HalfPageScroll', eoHalfPageScroll); - UpdateEditorOptions('ScrollByOneLess', eoScrollByOneLess); - UpdateEditorOptions('ScrollPastEof', eoScrollPastEof); - UpdateEditorOptions('ScrollPastEol', eoScrollPastEol); - UpdateEditorOptions('ShowScrollHint', eoShowScrollHint); + UpdateEditorScrollOptions('HalfPageScroll', eoHalfPageScroll); + UpdateEditorScrollOptions('ScrollByOneLess', eoScrollByOneLess); + UpdateEditorScrollOptions('ScrollPastEof', eoScrollPastEof); + UpdateEditorScrollOptions('ScrollPastEol', eoScrollPastEol); + UpdateEditorScrollOptions('ShowScrollHint', eoShowScrollHint); UpdateEditorOptions('TabsToSpaces', eoTabsToSpaces); UpdateEditorOptions('TrimTrailingSpaces', eoTrimTrailingSpaces); UpdateEditorOptions('KeepCaretX', eoKeepCaretX); @@ -613,10 +648,11 @@ procedure TeditorSettings.ReadSynEditorOptions( UpdateEditorOptions('EnhanceEndKey', eoEnhanceEndKey); UpdateEditorOptions('GroupUndo', eoGroupUndo); UpdateEditorOptions('TabIndent', eoTabIndent); - UpdateEditorOptions('DisableScrollArrows', eoDisableScrollArrows); - UpdateEditorOptions('HideShowScrollbars', eoHideShowScrollbars); - UpdateEditorOptions('ShowSpecialChars', eoShowSpecialChars, False); + UpdateEditorScrollOptions('DisableScrollArrows', eoDisableScrollArrows); + UpdateEditorScrollOptions('HideShowScrollbars', eoHideShowScrollbars); ASynEditorOptions.WantTabs := FIniFile.ReadBool(EDITOPTION_OPTIONS, 'WantTabs', False); + ASynEditorOptions.WordWrap := FIniFile.ReadBool(EDITOPTION_OPTIONS, 'WordWrap', True); + (* //Caret cInsertCaret.ItemIndex := ord(ASynEditorOptions.InsertCaret); @@ -652,6 +688,16 @@ procedure TEditorSettings.WriteSettings( I: Integer; begin inherited; + if (DarkActiveLineColor <> default_darkactivelinecolor) then + FIniFile.WriteInteger('Global', 'DarkActiveLineColor', DarkActiveLineColor) + else + FIniFile.DeleteKey('Global', 'DarkActiveLineColor'); + + if (LightActiveLineColor <> default_lightactivelinecolor) then + FIniFile.WriteInteger('Global', 'LightActiveLineColor', LightActiveLineColor) + else + FIniFile.DeleteKey('Global', 'LightActiveLineColor'); + FIniFile.WriteInteger('Global', 'DownloadFromWEB', Ord(FDownloadFromWEB)); FIniFile.WriteInteger('Global', 'AutoRefreshWhenEditing', Ord(FAutoRefreshWhenEditing)); @@ -668,17 +714,24 @@ procedure TEditorSettings.WriteSettings( OpenedFileList.strings[i]); end; FIniFile.WriteString('Global', 'CurrentFileName', CurrentFileName); - WriteSynEditorOptions(ASynEditorOptions); end; procedure TEditorSettings.WriteSynEditorOptions( const ASynEditorOptions: TSynEditorOptionsContainer); - procedure WriteEditorOptions(const AName: string; const AValue: TSynEditorOption); + procedure WriteEditorOptions(const AName: string; + const AValue: TSynEditorOption); begin FIniFile.WriteBool(EDITOPTION_OPTIONS, AName, AValue in ASynEditorOptions.Options); end; + + procedure WriteEditorScrollOptions(const AName: string; + const AValue: TSynEditorScrollOption); + begin + FIniFile.WriteBool(EDITOPTION_OPTIONS, AName, AValue in ASynEditorOptions.ScrollOptions); + end; + begin if not Assigned(ASynEditorOptions) then Exit; @@ -700,15 +753,13 @@ procedure TEditorSettings.WriteSynEditorOptions( FIniFile.WriteBool(EDITOPTION_BOOKMARK,'EnableKeys', ASynEditorOptions.BookMarkOptions.EnableKeys); FIniFile.WriteBool(EDITOPTION_BOOKMARK,'GlyphsVisible', ASynEditorOptions.BookMarkOptions.GlyphsVisible); WriteEditorOptions('AutoIndent', eoAutoIndent); - WriteEditorOptions('AutoSizeMaxScrollWidth', eoAutoSizeMaxScrollWidth); WriteEditorOptions('DragDropEditing', eoDragDropEditing); WriteEditorOptions('SmartTabs', eoSmartTabs); - WriteEditorOptions('AltSetsColumnMode', eoAltSetsColumnMode); - WriteEditorOptions('HalfPageScroll', eoHalfPageScroll); - WriteEditorOptions('ScrollByOneLess', eoScrollByOneLess); - WriteEditorOptions('ScrollPastEof', eoScrollPastEof); - WriteEditorOptions('ScrollPastEol', eoScrollPastEol); - WriteEditorOptions('ShowScrollHint', eoShowScrollHint); + WriteEditorScrollOptions('HalfPageScroll', eoHalfPageScroll); + WriteEditorScrollOptions('ScrollByOneLess', eoScrollByOneLess); + WriteEditorScrollOptions('ScrollPastEof', eoScrollPastEof); + WriteEditorScrollOptions('ScrollPastEol', eoScrollPastEol); + WriteEditorScrollOptions('ShowScrollHint', eoShowScrollHint); WriteEditorOptions('TabsToSpaces', eoTabsToSpaces); WriteEditorOptions('TrimTrailingSpaces', eoTrimTrailingSpaces); WriteEditorOptions('KeepCaretX', eoKeepCaretX); @@ -718,10 +769,10 @@ procedure TEditorSettings.WriteSynEditorOptions( WriteEditorOptions('EnhanceEndKey', eoEnhanceEndKey); WriteEditorOptions('GroupUndo', eoGroupUndo); WriteEditorOptions('TabIndent', eoTabIndent); - WriteEditorOptions('DisableScrollArrows', eoDisableScrollArrows); - WriteEditorOptions('HideShowScrollbars', eoHideShowScrollbars); - WriteEditorOptions('ShowSpecialChars', eoShowSpecialChars); + WriteEditorScrollOptions('DisableScrollArrows', eoDisableScrollArrows); + WriteEditorScrollOptions('HideShowScrollbars', eoHideShowScrollbars); FIniFile.WriteBool(EDITOPTION_OPTIONS, 'WantTabs', ASynEditorOptions.WantTabs); + FIniFile.WriteBool(EDITOPTION_OPTIONS, 'WordWrap', ASynEditorOptions.WordWrap); end; { TThemeAttribute } diff --git a/Source/MDShellEx.SettingsForm.dfm b/Source/MDShellEx.SettingsForm.dfm index 0783c10..e5483de 100644 --- a/Source/MDShellEx.SettingsForm.dfm +++ b/Source/MDShellEx.SettingsForm.dfm @@ -422,7 +422,7 @@ object SVGSettingsForm: TSVGSettingsForm Left = 9 Top = 6 Width = 174 - Height = 25 + Height = 29 Anchors = [akLeft, akTop, akRight] Caption = 'Reset to default colors' TabOrder = 0 @@ -527,31 +527,67 @@ object SVGSettingsForm: TSVGSettingsForm Left = 0 Top = 65 Width = 453 - Height = 336 + Height = 289 Align = alClient Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText Font.Height = -13 Font.Name = 'Courier New' Font.Style = [] + Font.Quality = fqClearTypeNatural TabOrder = 1 OnClick = SynEditClick OnKeyUp = SynEditKeyUp CodeFolding.GutterShapeSize = 11 - CodeFolding.CollapsedLineColor = clGrayText - CodeFolding.FolderBarLinesColor = clGrayText CodeFolding.IndentGuidesColor = clGray CodeFolding.IndentGuides = True - CodeFolding.ShowCollapsedLine = False - CodeFolding.ShowHintMark = True UseCodeFolding = False Gutter.Font.Charset = DEFAULT_CHARSET Gutter.Font.Color = clWindowText Gutter.Font.Height = -11 - Gutter.Font.Name = 'Terminal' + Gutter.Font.Name = 'Consolas' Gutter.Font.Style = [] + Gutter.Font.Quality = fqClearTypeNatural + Gutter.Width = 0 + Gutter.Bands = <> + ScrollbarAnnotations = <> FontSmoothing = fsmNone end + object ActiveLineColorGroupBox: TGroupBox + Left = 0 + Top = 354 + Width = 453 + Height = 47 + Align = alBottom + Caption = 'Active Line Color of Editor' + TabOrder = 2 + object DarkActiveLineColorColorBox: TColorBox + Left = 2 + Top = 17 + Width = 174 + Height = 22 + Hint = 'Active Line Color for Dark Theme' + Align = alLeft + NoneColorColor = clDefault + Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors] + DropDownCount = 20 + TabOrder = 0 + OnSelect = ColorBoxSelect + end + object LightActiveLineColorColorBox: TColorBox + Left = 176 + Top = 17 + Width = 174 + Height = 22 + Hint = 'Active Line Color for Light Theme' + Align = alLeft + NoneColorColor = clDefault + Style = [cbStandardColors, cbExtendedColors, cbSystemColors, cbIncludeNone, cbCustomColor, cbPrettyNames, cbCustomColors] + DropDownCount = 20 + TabOrder = 1 + OnSelect = ColorBoxSelect + end + end end end object tsPDFLayout: TTabSheet diff --git a/Source/MDShellEx.SettingsForm.pas b/Source/MDShellEx.SettingsForm.pas index 0503882..539851f 100644 --- a/Source/MDShellEx.SettingsForm.pas +++ b/Source/MDShellEx.SettingsForm.pas @@ -117,6 +117,9 @@ TSVGSettingsForm = class(TForm) MenuRoundedCheckBox: TCheckBox; EditingOptionsGroupBox: TGroupBox; AutoRefreshCheckBox: TCheckBox; + ActiveLineColorGroupBox: TGroupBox; + DarkActiveLineColorColorBox: TColorBox; + LightActiveLineColorColorBox: TColorBox; procedure BoxElementsClick(Sender: TObject); procedure cbForegroundClick(Sender: TObject); procedure cbBackgroundClick(Sender: TObject); @@ -335,6 +338,8 @@ procedure TSVGSettingsForm.ResetButtonClick(Sender: TObject); {$ENDIF} SynEdit.Highlighter.Assign(dmResources.GetSynHighlighter( SelectedStyleIsDark, LBackGroundColor)); + DarkActiveLineColorColorBox.Selected := default_darkactivelinecolor; + LightActiveLineColorColorBox.Selected := default_lightactivelinecolor; end; procedure TSVGSettingsForm.RefreshMap; @@ -598,6 +603,8 @@ procedure TSVGSettingsForm.AssignSettings(ASettings: TSettings); MarginRightEdit.ValueFloat := ASettings.PDFPageSettings.MarginRight; MarginTopEdit.ValueFloat := ASettings.PDFPageSettings.MarginTop; MarginBottomEdit.ValueFloat := ASettings.PDFPageSettings.MarginBottom; + DarkActiveLineColorColorBox.Selected := TEditorSettings(ASettings).DarkActiveLineColor; + LightActiveLineColorColorBox.Selected := TEditorSettings(ASettings).LightActiveLineColor; PopulateAvailThemes; end; @@ -641,6 +648,8 @@ procedure TSVGSettingsForm.UpdateSettings(ASettings: TSettings); begin TEditorSettings(ASettings).DownloadFromWEB := DownloadFromWEBCheckBox.Checked; TEditorSettings(ASettings).AutoRefreshWhenEditing := AutoRefreshCheckBox.Checked; + TEditorSettings(ASettings).DarkActiveLineColor := DarkActiveLineColorColorBox.Selected; + TEditorSettings(ASettings).LightActiveLineColor := LightActiveLineColorColorBox.Selected; end; TEditorSettings(ASettings).ToolbarDrawRounded := ToolbarRoundedCheckBox.Checked; @@ -730,6 +739,8 @@ procedure TSVGSettingsForm.PopulateAvailThemes; SelectThemeRadioGroup.OnClick := SelectThemeRadioGroupClick; SelectThemeRadioGroupClick(SelectThemeRadioGroup); end; + DarkActiveLineColorColorBox.Visible := not IsLight; + LightActiveLineColorColorBox.Visible := IsLight; end; procedure TSVGSettingsForm.ExitFromSettings(Sender: TObject); diff --git a/Source/MDShellExtensions.dproj b/Source/MDShellExtensions.dproj index 4ce6ccd..5f41f27 100644 --- a/Source/MDShellExtensions.dproj +++ b/Source/MDShellExtensions.dproj @@ -53,19 +53,13 @@ true true - - true - Cfg_2 - true - true - MDShellExtensions System;Xml;Data;Datasnap;Web;Soap;System.Win;Winapi;Vcl;Vcl.Imaging;Vcl.Touch;Vcl.Samples;Vcl.Shell;$(DCC_Namespace) ..\Icons\logo.ico $(BDS)\bin\default_app.manifest 1033 - CompanyName=Ethea S.r.l.;FileDescription=MarkDown Shell Extensions 64bit;FileVersion=2.3.2.0;InternalName=;LegalCopyright=Copyright © 2021-2025 Ethea S.r.l.;LegalTrademarks=;OriginalFilename=;ProductName=MarkDown Shell Extensions 64bit;ProductVersion=2.3;Comments= + CompanyName=Ethea S.r.l.;FileDescription=MarkDown Shell Extensions 64bit;FileVersion=2.4.0.0;InternalName=;LegalCopyright=Copyright © 2021-2025 Ethea S.r.l.;LegalTrademarks=;OriginalFilename=;ProductName=MarkDown Shell Extensions 64bit;ProductVersion=2.4;Comments= Glow|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Glow.vsf;Sky|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Sky.vsf;Windows10|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10.vsf;"Windows10 Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10Dark.vsf";"Windows10 SlateGray|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10SlateGray.vsf";"Windows11 Impressive Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Impressive_Dark.vsf";"Windows11 Impressive Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Impressive_Light.vsf";"Windows11 Modern Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Modern_Dark.vsf";"Windows11 Modern Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Modern_Light.vsf";"Windows11 Polar Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Polar_Dark.vsf";"Windows11 Polar Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Polar_Light.vsf";"Flat UI Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\FlatUILight.vsf";"Windows10 BlackPearl|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10BlackPearl.vsf";"Windows10 Blue Whale|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10BlueWhale.vsf";"Windows10 Blue Whale LE|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10BlueWhaleLE.vsf";"Windows10 Clear Day|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10ClearDay.vsf";"Windows10 Malibu|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10Malibu.vsf" rtl;vcl;vclx;vclactnband;xmlrtl;VclSmp;vclimg;svnui;svn;bdertl;TeeUI;TeeDB;Tee;vcldb;dbrtl;vcldbx;vcltouch;dsnap;dsnapcon;vclib;ibxpress;adortl;IndyCore;IndySystem;IndyProtocols;inet;intrawebdb_110_150;Intraweb_110_150;vclie;websnap;webdsnap;inetdb;inetdbbde;inetdbxpress;soaprtl;vclribbon;dbexpress;DbxCommonDriver;DataSnapIndy10ServerTransport;DataSnapProviderClient;DbxClientDriver;DataSnapClient;dbxcds;DataSnapServer;AzureCloud;DBXInterBaseDriver;DBXMySQLDriver;DBXFirebirdDriver;DBXSybaseASEDriver;DBXSybaseASADriver;DBXOracleDriver;DBXMSSQLDriver;DBXInformixDriver;DBXDb2Driver;Hydra_Core_D15;SynEdit_RXE;mbColorLibDXE;JclDeveloperTools;Jcl;JclVcl;JclContainers;JvCore;JvSystem;JvStdCtrls;JvAppFrm;JvBands;JvDB;JvDlgs;JvBDE;JvControls;JvCmp;JvCrypt;JvCustom;JvDocking;JvDotNetCtrls;JvGlobus;JvHMI;JvJans;JvManagedThreads;JvMM;JvNet;JvPageComps;JvPascalInterpreter;JvPluginSystem;JvPrintPreview;JvRuntimeDesign;JvTimeFramework;JvWizards;JvXPCtrls;WinSkinDXE;bsfd2011;IceTabSet;$(DCC_UsePackage) ..\Dcu\$(Platform)\$(Config) @@ -75,8 +69,7 @@ ..\Bin64 true 2 - 3 - 2 + 4 D:\ETHEA\MarkdownShellExtensions\Debug\Preview Handlers\OpenDialog\OpenDialogTest.exe @@ -115,10 +108,6 @@ 3 true - - 3 - CompanyName=Ethea S.r.l.;FileDescription=MarkDown Shell Extensions 64bit;FileVersion=2.3.3.0;InternalName=;LegalCopyright=Copyright © 2021-2025 Ethea S.r.l.;LegalTrademarks=;OriginalFilename=;ProductName=MarkDown Shell Extensions 64bit;ProductVersion=2.3;Comments= - MainSource @@ -210,26 +199,6 @@ c:\temp - wPDF V3 - (C) WPCubed GmbH - Microsoft Office XP Sample Automation Server Wrapper Components - File D:\ETHEA\FGX Native\Libs\290\Win32\Release\FGXNative.Designer.290.bpl not found - FGX Native - Designtime Registration - Embarcadero C++Builder Internet Explorer Components Package - Embarcadero C++Builder Office 2000 Servers Package - Embarcadero C++Builder Office XP Servers Package - Microsoft Office 2000 Sample Automation Server Wrapper Components - QuickReport 5.06 Components - Shell Control Property and Component Editors - Woll2Woll FirstClass 4K Sydney - Woll2Woll InfoPower Studio 4K - kbmMemTable Standard Edition - High performance memory table - RAD Studio 12 for Win32 - Designtime - www.Components4Developers.com - Pragnaan ReportBuilder Export Devices - EMS Advanced Import Component Suite - EMS Advanced Export Component Suite - TMS Component Pack design time support - GExperts Outlookbar design time package - FGX Native Extension - Zint Barcode - BDE Adapters for ExpressDataController by Developer Express Inc. diff --git a/Source/MDShellExtensions.res b/Source/MDShellExtensions.res index d91b399cbdc5fb8bb3c9a533227ffd1686b0dc4c..e74db3aa21596a61a6bc221ec5bcee69ef3ee486 100644 GIT binary patch delta 197 zcmWl~xekIr6hP5=&p`!u+*e$oGZy?4Ev>Z$#LC3hW(q&R%8#@0a+8x=-d|GUk^9!D zsj{DIB3^3F=JI^YPtu#y!l|Ho4Hh2iXrKun0a|FIgD!gLV}KAtj4;LoQ_L{O0!ys0 U#s(3#*kO+YjyNIyI!!YD0|Uf5^#A|> delta 197 zcmWl~DH6g!5J1uH9zqCf*muGnhnYiRv1kM-6jfNv2o8Yaa2P(~)hljKEpR_2PE16c zxc52N$jd?e..\Icons\logo.ico $(BDS)\bin\default_app.manifest 1033 - CompanyName=Ethea S.r.l.;FileDescription=MarkDown Shell Extensions 32bit;FileVersion=2.3.3.0;InternalName=;LegalCopyright=Copyright © 2021-2025 Ethea S.r.l.;LegalTrademarks=;OriginalFilename=;ProductName=MarkDown Shell Extensions 32bit;ProductVersion=2.3;Comments= + CompanyName=Ethea S.r.l.;FileDescription=MarkDown Shell Extensions 32bit;FileVersion=2.4.0.0;InternalName=;LegalCopyright=Copyright © 2021-2025 Ethea S.r.l.;LegalTrademarks=;OriginalFilename=;ProductName=MarkDown Shell Extensions 32bit;ProductVersion=2.4;Comments= Glow|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Glow.vsf;Sky|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Sky.vsf;Windows10|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10.vsf;"Windows10 Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10Dark.vsf";"Windows10 SlateGray|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10SlateGray.vsf";"Windows11 Impressive Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Impressive_Dark.vsf";"Windows11 Impressive Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Impressive_Light.vsf";"Windows11 Modern Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Modern_Dark.vsf";"Windows11 Modern Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Modern_Light.vsf";"Windows11 Polar Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Polar_Dark.vsf";"Windows11 Polar Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Polar_Light.vsf";"Flat UI Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\FlatUILight.vsf";"Windows10 BlackPearl|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10BlackPearl.vsf";"Windows10 Blue Whale|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10BlueWhale.vsf";"Windows10 Clear Day|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10ClearDay.vsf";"Windows10 Malibu|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10Malibu.vsf" rtl;vcl;vclx;vclactnband;xmlrtl;VclSmp;vclimg;svnui;svn;bdertl;TeeUI;TeeDB;Tee;vcldb;dbrtl;vcldbx;vcltouch;dsnap;dsnapcon;vclib;ibxpress;adortl;IndyCore;IndySystem;IndyProtocols;inet;intrawebdb_110_150;Intraweb_110_150;vclie;websnap;webdsnap;inetdb;inetdbbde;inetdbxpress;soaprtl;vclribbon;dbexpress;DbxCommonDriver;DataSnapIndy10ServerTransport;DataSnapProviderClient;DbxClientDriver;DataSnapClient;dbxcds;DataSnapServer;AzureCloud;DBXInterBaseDriver;DBXMySQLDriver;DBXFirebirdDriver;DBXSybaseASEDriver;DBXSybaseASADriver;DBXOracleDriver;DBXMSSQLDriver;DBXInformixDriver;DBXDb2Driver;Hydra_Core_D15;SynEdit_RXE;mbColorLibDXE;JclDeveloperTools;Jcl;JclVcl;JclContainers;JvCore;JvSystem;JvStdCtrls;JvAppFrm;JvBands;JvDB;JvDlgs;JvBDE;JvControls;JvCmp;JvCrypt;JvCustom;JvDocking;JvDotNetCtrls;JvGlobus;JvHMI;JvJans;JvManagedThreads;JvMM;JvNet;JvPageComps;JvPascalInterpreter;JvPluginSystem;JvPrintPreview;JvRuntimeDesign;JvTimeFramework;JvWizards;JvXPCtrls;WinSkinDXE;bsfd2011;IceTabSet;$(DCC_UsePackage) ..\Dcu\$(Platform)\$(Config) @@ -69,8 +69,7 @@ ..\Bin32 true 2 - 3 - 3 + 4 D:\ETHEA\MarkdownShellExtensions\Debug\Preview Handlers\PreviewHandler Host\Bin32\PreviewHost.exe @@ -203,26 +202,6 @@ c:\temp - wPDF V3 - (C) WPCubed GmbH - Microsoft Office XP Sample Automation Server Wrapper Components - File D:\ETHEA\FGX Native\Libs\290\Win32\Release\FGXNative.Designer.290.bpl not found - FGX Native - Designtime Registration - Embarcadero C++Builder Internet Explorer Components Package - Embarcadero C++Builder Office 2000 Servers Package - Embarcadero C++Builder Office XP Servers Package - Microsoft Office 2000 Sample Automation Server Wrapper Components - QuickReport 5.06 Components - Shell Control Property and Component Editors - Woll2Woll FirstClass 4K Sydney - Woll2Woll InfoPower Studio 4K - kbmMemTable Standard Edition - High performance memory table - RAD Studio 12 for Win32 - Designtime - www.Components4Developers.com - Pragnaan ReportBuilder Export Devices - EMS Advanced Import Component Suite - EMS Advanced Export Component Suite - TMS Component Pack design time support - GExperts Outlookbar design time package - FGX Native Extension - Zint Barcode - BDE Adapters for ExpressDataController by Developer Express Inc. diff --git a/Source/MDShellExtensions32.res b/Source/MDShellExtensions32.res index 1acd53658f9ff037e38423515eea7d87629147bc..0ebb20d8626042cc25db01ab9f08f3e74b748074 100644 GIT binary patch delta 189 zcmWl~ISztA7(n6qhe1Wf4HOr^J$8hGTW}d$YYSTwVrMgj2e9%8UWGf@_;|^eS3e(8 z<9_yx(yGb4FDG#em8raX$xn)_)icVuUd!2oPe586wQF Xz!EFONRVQU4Yt@}kHg36(gTJc@y%B~?pmR^ zL{^N5Sh26`Q9~yuaphCL>TcfT-YEWC1PD<>9SuZiqJ=g(=%R-h3Hlgdh!Mt^V2T;$ VSYU}2*4SW+9a8L(y}dbn&OgzXIn@9F diff --git a/Source/MDTextEditor.ViewerMainForm.dfm b/Source/MDTextEditor.ViewerMainForm.dfm index 186dd84..40011e6 100644 --- a/Source/MDTextEditor.ViewerMainForm.dfm +++ b/Source/MDTextEditor.ViewerMainForm.dfm @@ -218,6 +218,7 @@ object frmMain: TfrmMain OnClosing = SVClosing OnOpened = SVOpened OnOpening = SVOpening + OnResize = SVResize object catMenuItems: TStyledCategoryButtons Left = 0 Top = 0 @@ -229,7 +230,7 @@ object frmMain: TfrmMain ButtonFlow = cbfVertical ButtonHeight = 36 ButtonWidth = 36 - ButtonOptions = [boFullSize, boShowCaptions, boBoldCaptions, boCaptionOnlyBorder] + ButtonOptions = [boFullSize, boBoldCaptions, boCaptionOnlyBorder] Categories = < item Caption = 'File' @@ -335,20 +336,19 @@ object frmMain: TfrmMain TabOrder = 1 object lblTitle: TLabel AlignWithMargins = True - Left = 40 + Left = 41 Top = 3 Width = 116 - Height = 32 + Height = 15 Align = alLeft Caption = 'MarkDown Text Editor' Layout = tlCenter - ExplicitHeight = 15 end object SettingsToolBar: TStyledToolbar AlignWithMargins = True - Left = 800 + Left = 696 Top = 3 - Width = 200 + Width = 304 Height = 32 Align = alRight ButtonHeight = 32 @@ -356,38 +356,64 @@ object frmMain: TfrmMain Images = VirtualImageList Indent = 3 TabOrder = 0 - object ColorSettingsToolButton: TStyledToolButton + object btLayoutBoth: TStyledToolButton Left = 0 Top = 0 + Action = acLayoutBoth + Grouped = True + Style = tbsCheck + end + object btLayoutMarkDown: TStyledToolButton + Left = 32 + Top = 0 + Action = acLayoutMarkDown + Grouped = True + Style = tbsCheck + end + object btLayoutViewer: TStyledToolButton + Left = 64 + Top = 0 + Action = acLayoutViewer + Grouped = True + Style = tbsCheck + end + object SepLayoutButtons: TStyledToolButton + Left = 96 + Top = 0 + Style = tbsSeparator + end + object ColorSettingsToolButton: TStyledToolButton + Left = 102 + Top = 0 Action = actnSettings end object EditOptionsToolButton: TStyledToolButton - Left = 32 + Left = 134 Top = 0 Action = actnEditOptions end object PageSetupToolButton: TStyledToolButton - Left = 64 + Left = 166 Top = 0 Action = actnPageSetup end object PrinterSetupToolButton: TStyledToolButton - Left = 96 + Left = 198 Top = 0 Action = actnPrinterSetup end object SepToolButton: TStyledToolButton - Left = 128 + Left = 230 Top = 0 Style = tbsSeparator end object AboutToolButton: TStyledToolButton - Left = 134 + Left = 236 Top = 0 Action = acAbout end object QuitToolButton: TStyledToolButton - Left = 166 + Left = 268 Top = 0 Action = acQuit ImageName = 'Exit' @@ -397,7 +423,7 @@ object frmMain: TfrmMain AlignWithMargins = True Left = 3 Top = 3 - Width = 31 + Width = 32 Height = 32 Align = alLeft ButtonHeight = 32 @@ -714,6 +740,40 @@ object frmMain: TfrmMain OnExecute = acRefreshExecute OnUpdate = acHTMLViewerUpdate end + object acLayoutBoth: TAction + Category = 'Layout' + AutoCheck = True + Caption = 'Editor and Viewer' + Checked = True + GroupIndex = 1 + Hint = 'Show MarkDown Editor and HTML Viewer' + ImageIndex = 59 + ImageName = 'layout_both' + OnExecute = acLayoutExecute + OnUpdate = acLayoutUpdate + end + object acLayoutMarkDown: TAction + Category = 'Layout' + AutoCheck = True + Caption = 'Only Editor' + GroupIndex = 1 + Hint = 'Show only MarkDown Editor' + ImageIndex = 60 + ImageName = 'layout_left' + OnExecute = acLayoutExecute + OnUpdate = acLayoutUpdate + end + object acLayoutViewer: TAction + Category = 'Layout' + AutoCheck = True + Caption = 'Only Viewer' + GroupIndex = 1 + Hint = 'Show only HTML Viewer' + ImageIndex = 61 + ImageName = 'layout_right' + OnExecute = acLayoutExecute + OnUpdate = acLayoutUpdate + end end object SaveDialog: TSaveDialog Filter = 'MarkDown files (.md)|*.md' @@ -1107,6 +1167,21 @@ object frmMain: TfrmMain CollectionIndex = 79 CollectionName = 'refresh' Name = 'refresh' + end + item + CollectionIndex = 84 + CollectionName = 'layout_both' + Name = 'layout_both' + end + item + CollectionIndex = 85 + CollectionName = 'layout_left' + Name = 'layout_left' + end + item + CollectionIndex = 86 + CollectionName = 'layout_right' + Name = 'layout_right' end> ImageCollection = dmResources.SVGIconImageCollection Width = 24 diff --git a/Source/MDTextEditor.ViewerMainForm.pas b/Source/MDTextEditor.ViewerMainForm.pas index a81e432..652fdf2 100644 --- a/Source/MDTextEditor.ViewerMainForm.pas +++ b/Source/MDTextEditor.ViewerMainForm.pas @@ -72,6 +72,9 @@ interface const SET_FILE_NAME = 'HiglightSettings'; + SV_COLLAPSED_WIDTH = 38; + SV_COLLAPSED_WIDTH_WITH_SCROLLBARS = 50; + resourcestring PAGE_HEADER_FIRST_LINE_LEFT = '$TITLE$'; @@ -104,6 +107,7 @@ TEditingFile = class FHTMLViewer: THTMLViewer; FEditorSettings: TEditorSettings; FChildForm: TMDIChildForm; + FViewerUpdated: Boolean; procedure ReadFromFile; procedure SaveToFile; function GetFileName: string; @@ -261,6 +265,13 @@ TfrmMain = class(TForm, IDragDrop) btHorizontalRule: TStyledToolButton; btSeparator4: TStyledToolButton; btHelp: TStyledToolButton; + btLayoutBoth: TStyledToolButton; + acLayoutBoth: TAction; + acLayoutMarkDown: TAction; + acLayoutViewer: TAction; + btLayoutMarkDown: TStyledToolButton; + btLayoutViewer: TStyledToolButton; + SepLayoutButtons: TStyledToolButton; procedure WMGetMinMaxInfo(var Message: TWMGetMinMaxInfo); message WM_GETMINMAXINFO; procedure acOpenFileExecute(Sender: TObject); procedure acSaveExecute(Sender: TObject); @@ -361,6 +372,9 @@ TfrmMain = class(TForm, IDragDrop) procedure acRefreshExecute(Sender: TObject); procedure AppDeactivate(Sender: TObject); procedure AppActivate(Sender: TObject); + procedure SVResize(Sender: TObject); + procedure acLayoutUpdate(Sender: TObject); + procedure acLayoutExecute(Sender: TObject); private FormTabsBar: TSpecialFormTabsBar; FEditingInProgress: Boolean; @@ -392,10 +406,11 @@ TfrmMain = class(TForm, IDragDrop) function GetMarkdownHelpFileName: TFileName; procedure CloseSplitViewMenu; procedure UpdateHighlighters; + procedure UpdateApplicationLayout(const ALayoutMode: TLayoutMode); procedure UpdateFromSettings(AEditor: TSynEdit); function DialogPosRect: TRect; procedure AdjustCompactWidth; - procedure AdjustViewerWidth(const ACenter: Boolean = False); + procedure AdjustViewerWidth; function OpenFile(const FileName: string; const ARaiseError: Boolean = True): Boolean; function AddEditingFile(const EditingFile: TEditingFile): Integer; @@ -514,13 +529,14 @@ procedure TEditingFile.ShowMarkDownAsHTML(const ASettings: TEditorSettings; HtmlViewer.DefFontName := ASettings.HTMLFontName; LStream := TStringStream.Create(FMarkDownFile.HTML, TEncoding.UTF8); try - HtmlViewer.LoadFromStream(LStream); + //HtmlViewer.LoadFromStream(LStream); si "perde" i caratteri speciali unicode codepoint + HtmlViewer.Text := LStream.DataString; HtmlViewer.VScrollBarPosition := LOldPos; dmResources.StopLoadingImages(False); - HtmlViewer.Visible := True; finally LStream.Free; end; + FViewerUpdated := True; end; procedure TEditingFile.ReadFromFile; @@ -811,8 +827,11 @@ procedure TfrmMain.FormMouseWheelUp(Sender: TObject; Shift: TShiftState; procedure TfrmMain.FormResize(Sender: TObject); begin - AdjustCompactWidth; - AdjustViewerWidth; + if not (csDestroying in ComponentState) then + begin + AdjustCompactWidth; + AdjustViewerWidth; + end; end; function TfrmMain.GetMarkdownHelpFileName: TFileName; @@ -894,6 +913,9 @@ procedure TfrmMain.SplitterMoved(Sender: TObject); LChildForm := TSplitter(Sender).Owner as TMDIChildForm; LEditingFile := TEditingFile(LChildForm.EditingFile); LEditingFile.ShowMarkDownAsHTML(FEditorSettings, True); + var LContainerWidth := ClientWidth - catMenuItems.Width; + FEditorSettings.ViewerPercentSize := Round( + CurrentEditFile.HTMLViewer.Width * 100 / LContainerWidth); end; procedure TfrmMain.SVClosed(Sender: TObject); @@ -922,6 +944,12 @@ procedure TfrmMain.SVOpening(Sender: TObject); catMenuItems.ButtonOptions := catMenuItems.ButtonOptions + [boShowCaptions]; end; +procedure TfrmMain.SVResize(Sender: TObject); +begin + StyledToolbar.Margins.Left := + Round(SV.Width - (SV_COLLAPSED_WIDTH * ScaleFactor) + (3 * ScaleFactor)); +end; + procedure TfrmMain.DestroyWindowHandle; begin FreeAndNil(FDropTarget); @@ -1044,7 +1072,6 @@ procedure TfrmMain.LoadOpenedFiles; LFileName: string; LIndex: Integer; LCurrentFileName: string; - EditingFile: TEditingFile; begin LIndex := -1; for I := 0 to FEditorSettings.OpenedFileList.Count-1 do @@ -1056,7 +1083,7 @@ procedure TfrmMain.LoadOpenedFiles; end; if LIndex <> -1 then begin - EditingFile := TEditingFile(EditFileList.Items[LIndex]); + EditFileList.Items[LIndex]; UpdateMDViewer(True); end; end; @@ -1185,8 +1212,7 @@ procedure TfrmMain.acToolbarUpdate(Sender: TObject); begin LAction := Sender as TAction; LAction.Enabled := (CurrentEditFile <> nil) and (CurrentEditFile.SynEditor <> nil) and - (CurrentEditFile.SynEditor.Focused) and - not (CurrentEditFile.SynEditor.SelectionMode = TSynSelectionMode.smColumn); + (CurrentEditFile.SynEditor.Focused); end; procedure TfrmMain.acReplaceUpdate(Sender: TObject); @@ -1344,6 +1370,21 @@ procedure TfrmMain.acHeader3Execute(Sender: TObject); InsertMDCommand('### '); end; +procedure TfrmMain.acLayoutExecute(Sender: TObject); +begin + if Sender = acLayoutBoth then + UpdateApplicationLayout(lmBoth) + else if Sender = acLayoutMarkDown then + UpdateApplicationLayout(lmMarkDown) + else if Sender = acLayoutViewer then + UpdateApplicationLayout(lmHTML); +end; + +procedure TfrmMain.acLayoutUpdate(Sender: TObject); +begin + (Sender as TAction).Enabled := CurrentEditFile <> nil; +end; + procedure TfrmMain.acLinkExecute(Sender: TObject); begin InputUrl('[', itLink); @@ -1453,6 +1494,45 @@ procedure TfrmMain.acHelpUpdate(Sender: TObject); acHelp.Visible := FileExists(LHelpFileName); end; +procedure TfrmMain.UpdateApplicationLayout(const ALayoutMode: TLayoutMode); +begin + FEditorSettings.LayoutMode := ALayoutMode; + if CurrentEditFile <> nil then + begin + case ALayoutMode of + lmBoth: + begin + CurrentEditFile.HTMLViewer.Align := alRight; + AdjustViewerWidth; + CurrentEditFile.HTMLViewer.Visible := True; + CurrentEditFile.Splitter.Visible := True; + CurrentEditFile.Splitter.Left := CurrentEditFile.HTMLViewer.left -1; + CurrentEditFile.SynEditor.Visible := True; + btLayoutBoth.Down := True; + end; + lmMarkDown: + begin + CurrentEditFile.HTMLViewer.Visible := False; + CurrentEditFile.Splitter.Visible := False; + CurrentEditFile.SynEditor.Visible := True; + btLayoutMarkDown.Down := True; + end; + lmHTML: + begin + CurrentEditFile.SynEditor.Visible := False; + CurrentEditFile.Splitter.Visible := False; + CurrentEditFile.HTMLViewer.Align := alClient; + CurrentEditFile.HTMLViewer.Visible := True; + CurrentEditFile.Splitter.Visible := False; + btLayoutViewer.Down := True; + end; + end; + if CurrentEditFile.HTMLViewer.Visible and not + CurrentEditFile.FViewerUpdated then + UpdateMDViewer(True); + end; +end; + procedure TfrmMain.UpdateChildFormImage(AChildForm: TMDIChildForm; AModified: Boolean; const AImageName: string); var @@ -1474,7 +1554,8 @@ procedure TfrmMain.SynEditChange(Sender: TObject); LoadTimer.Enabled := False; dmResources.StopLoadingImages(True); //UpdateMDViewer(False); - LoadTimer.Enabled := True; + if not FProcessingFiles then + LoadTimer.Enabled := True; end; end; @@ -1506,7 +1587,6 @@ function TfrmMain.AddEditingFile(const EditingFile: TEditingFile): Integer; LFEViewer := THtmlViewer.Create(LChildForm); LFEViewer.ScrollBars := ssNone; - LFEViewer.Align := alRight; LFEViewer.Width := LChildForm.Width div 2; LFEViewer.Parent := LChildForm; LFEViewer.PopupMenu := PopHTMLViewer; @@ -1539,17 +1619,16 @@ function TfrmMain.AddEditingFile(const EditingFile: TEditingFile): Integer; //Assign user preferences to the editor FEditorOptions.AssignTo(LEditor); - LEditor.MaxScrollWidth := 3000; EditingFile.SynEditor := LEditor; UpdateFromSettings(LEditor); UpdateHighlighter(LEditor); - LEditor.Visible := True; - //Make the ChildForm the current page //and call "change" method passing EditingChild ChildFormActivate(LChildForm); - AdjustViewerWidth(True); + + //Show Editor or Viewer or both + UpdateApplicationLayout(FEditorSettings.LayoutMode); Except LChildForm.Free; LEditor.Free; @@ -1565,17 +1644,24 @@ procedure TfrmMain.UpdateMDViewer(const AReloadImages: Boolean); if (CurrentEditor <> nil) and (CurrentEditFile <> nil) then begin LoadTimer.Enabled := False; - Screen.Cursor := crHourGlass; - try - UpdateChildFormImage(CurrentChildForm, CurrentEditor.Modified, - CurrentEditFile.ImageName); + if (CurrentEditFile.HTMLViewer.Visible) then + begin + Screen.Cursor := crHourGlass; + try + UpdateChildFormImage(CurrentChildForm, CurrentEditor.Modified, + CurrentEditFile.ImageName); - StatusBar.Panels[STATUSBAR_MESSAGE].Text := CurrentEditFile.FileName; + StatusBar.Panels[STATUSBAR_MESSAGE].Text := CurrentEditFile.FileName; - //Show HTML content of MarkDown - CurrentEditFile.ShowMarkDownAsHTML(FEditorSettings, AReloadImages); - finally - Screen.Cursor := crDefault; + //Show HTML content of MarkDown + CurrentEditFile.ShowMarkDownAsHTML(FEditorSettings, AReloadImages); + finally + Screen.Cursor := crDefault; + end; + end + else + begin + CurrentEditFile.FViewerUpdated := False; end; end; end; @@ -1601,7 +1687,6 @@ procedure TfrmMain.ChildFormActivate(Sender: TObject); CurrentEditFile.SynEditor.SetFocus; end; UpdateMDViewer(False); - AdjustViewerWidth; end; procedure TfrmMain.acSaveUpdate(Sender: TObject); @@ -1840,7 +1925,7 @@ procedure TfrmMain.SetMDFontSize(const Value: Integer); begin if (CurrentEditor <> nil) and (Value >= MinfontSize) and (Value <= MaxfontSize) then begin - CurrentEditor.Font.Height := Round(Value * Self.ScaleFactor); + CurrentEditor.Font.Height := -Round(Value * Self.ScaleFactor); FEditorSettings.MDFontSize := Value; end; FMDFontSize := Value; @@ -2000,6 +2085,7 @@ procedure TfrmMain.UpdateFromSettings(AEditor: TSynEdit); InitEditorOptions; UpdateEditorsOptions; UpdateHighlighter(AEditor); + UpdateApplicationLayout(FEditorSettings.LayoutMode); end; procedure TfrmMain.UpdateHighlighter(ASynEditor: TSynEdit); @@ -2211,7 +2297,7 @@ procedure TfrmMain.ActionListUpdate(Action: TBasicAction; OpenDialog.InitialDir := InitialDir; SaveDialog.InitialDir := InitialDir; end; - LoadTimer.Enabled := True; + //LoadTimer.Enabled := True; end; procedure TfrmMain.actMenuExecute(Sender: TObject); @@ -2269,25 +2355,13 @@ procedure TfrmMain.AddOpenedFile(const AFileName: string); FEditorSettings.HistoryFileList.Insert(0, AFileName); end; -procedure TfrmMain.AdjustViewerWidth(const ACenter: Boolean = False); +procedure TfrmMain.AdjustViewerWidth; begin if (CurrentEditFile <> nil) and (CurrentEditFile.HTMLViewer <> nil) then begin - if ACenter then - begin - CurrentEditFile.HTMLViewer.Width := - (Self.Width - catMenuItems.Width) div 2; - end - else - begin - var LViewerWidth := CurrentEditFile.HTMLViewer.Width; - var LMinWidth := Self.Width div 6; - var LMaxWidth := Self.Width - LMinWidth; - if LViewerWidth < LMinWidth then - CurrentEditFile.HTMLViewer.Width := LMinWidth - else if LViewerWidth > LMaxWidth then - CurrentEditFile.HTMLViewer.Width := LMaxWidth; - end; + var LContainerWidth := ClientWidth - catMenuItems.Width; + CurrentEditFile.HTMLViewer.Width := + Round(LContainerWidth * FEditorSettings.ViewerPercentSize / 100); end; end; @@ -2295,9 +2369,9 @@ procedure TfrmMain.AdjustCompactWidth; begin //Change size of compact view because Scrollbars appears if (Height / ScaleFactor) > 900 then - SV.CompactWidth := Round(44 * ScaleFactor) + SV.CompactWidth := Round(SV_COLLAPSED_WIDTH * ScaleFactor) else - SV.CompactWidth := Round(66 * ScaleFactor); + SV.CompactWidth := Round(SV_COLLAPSED_WIDTH_WITH_SCROLLBARS * ScaleFactor); if (CurrentEditFile <> nil) and (CurrentEditFile.HTMLViewer <> nil) and (CurrentEditFile.HTMLViewer.Width > CurrentEditFile.ChildForm.Width) then CurrentEditFile.HTMLViewer.Width := width div 3; end; diff --git a/Source/MDTextEditor.dpr b/Source/MDTextEditor.dpr index c911762..48a641b 100644 --- a/Source/MDTextEditor.dpr +++ b/Source/MDTextEditor.dpr @@ -61,7 +61,7 @@ begin Application.Initialize; Application.MainFormOnTaskBar := True; Application.ActionUpdateDelay := 50; - Application.Title := Title_MDViewer+'- © 2021-2024 Ethea S.r.l.'; + Application.Title := Title_MDViewer+'- © 2021-2025 Ethea S.r.l.'; //Uses System Style for border / shadow of Forms TStyleManager.FormBorderStyle := TStyleManager.TFormBorderStyle.fbsSystemStyle; with TSplashForm.Create(nil) do diff --git a/Source/MDTextEditor.dproj b/Source/MDTextEditor.dproj index 879e3c7..f1ae14f 100644 --- a/Source/MDTextEditor.dproj +++ b/Source/MDTextEditor.dproj @@ -8,7 +8,7 @@ Debug VCL True - Win32 + Win64 3 Application MDTextEditor @@ -61,7 +61,7 @@ ..\Icons\logo.ico $(BDS)\bin\default_app.manifest 1033 - CompanyName=Ethea S.r.l.;FileDescription=Markdown files Editor;FileVersion=2.3.2.0;InternalName=;LegalCopyright=Copyright © 2021-2025 - Ethea S.r.l.;LegalTrademarks=;OriginalFilename=;ProductName=Markdown files Editor;ProductVersion=2.3;Comments= + CompanyName=Ethea S.r.l.;FileDescription=Markdown files Editor;FileVersion=2.4.0.0;InternalName=;LegalCopyright=Copyright © 2021-2025 - Ethea S.r.l.;LegalTrademarks=;OriginalFilename=;ProductName=Markdown files Editor;ProductVersion=2.4;Comments= Glow|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Glow.vsf;Sky|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Sky.vsf;Windows10|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10.vsf;"Windows10 Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10Dark.vsf";"Windows10 SlateGray|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10SlateGray.vsf";"Windows11 Impressive Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Impressive_Dark.vsf";"Windows11 Impressive Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Impressive_Light.vsf";"Windows11 Modern Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Modern_Dark.vsf";"Windows11 Modern Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Modern_Light.vsf";"Windows11 Polar Dark|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Polar_Dark.vsf";"Windows11 Polar Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows11_Polar_Light.vsf";"Flat UI Light|VCLSTYLE|$(BDSCOMMONDIR)\Styles\FlatUILight.vsf";"Windows10 BlackPearl|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10BlackPearl.vsf";"Windows10 Blue Whale|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10BlueWhale.vsf";"Windows10 Clear Day|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10ClearDay.vsf";"Windows10 Malibu|VCLSTYLE|$(BDSCOMMONDIR)\Styles\Windows10Malibu.vsf" 0 false @@ -71,8 +71,7 @@ ..\..\exe\InstantXMLEditor.exe 2 SKIA;$(DCC_Define) - 3 - 2 + 4 System.Win;Data.Win;Datasnap.Win;Web.Win;Soap.Win;Bde;$(DCC_Namespace) @@ -108,18 +107,15 @@ ..\..\ext\LibXML2\src;..\..\ext\SynEdit\Source;..\..\ext\CBLib\src;$(DCC_IncludePath) true false + true + true Debug - 3 2 - true - true - 3 - CompanyName=Ethea S.r.l.;FileDescription=Markdown files Editor;FileVersion=2.3.3.0;InternalName=;LegalCopyright=Copyright © 2021-2025 - Ethea S.r.l.;LegalTrademarks=;OriginalFilename=;ProductName=Markdown files Editor;ProductVersion=2.3;Comments= + CompanyName=Ethea S.r.l.;FileDescription=Markdown files Editor;FileVersion=2.4.0.0;InternalName=;LegalCopyright=Copyright © 2021-2025 - Ethea S.r.l.;LegalTrademarks=;OriginalFilename=;ProductName=Markdown files Editor;ProductVersion=2.3;Comments= - 3 2 true true @@ -133,28 +129,7 @@ MDTextEditor.dpr - - wPDF V3 - (C) WPCubed GmbH - Microsoft Office XP Sample Automation Server Wrapper Components - File D:\ETHEA\FGX Native\Libs\290\Win32\Release\FGXNative.Designer.290.bpl not found - FGX Native - Designtime Registration - Embarcadero C++Builder Internet Explorer Components Package - Embarcadero C++Builder Office 2000 Servers Package - Embarcadero C++Builder Office XP Servers Package - Microsoft Office 2000 Sample Automation Server Wrapper Components - QuickReport 5.06 Components - Shell Control Property and Component Editors - Woll2Woll FirstClass 4K Sydney - Woll2Woll InfoPower Studio 4K - kbmMemTable Standard Edition - High performance memory table - RAD Studio 12 for Win32 - Designtime - www.Components4Developers.com - Pragnaan ReportBuilder Export Devices - EMS Advanced Import Component Suite - EMS Advanced Export Component Suite - TMS Component Pack design time support - GExperts Outlookbar design time package - FGX Native Extension - Zint Barcode - BDE Adapters for ExpressDataController by Developer Express Inc. - + diff --git a/Source/MDTextEditor.res b/Source/MDTextEditor.res index 1bd1d0c94907ca7d83b5f4d3d2281a63428e2eec..0fedd31d100fd6e3e75328769528b56b6ce78bc4 100644 GIT binary patch delta 189 zcmWl~ISztA7(n6q$3a0wS=>g`% ziV=Z*pJVk)Ddh0DYpvzQnX5C3{}vv6G|)r~0YbFVK^HyrF~ATJVvI1x1XIi~#{vnK TSYeG68)V3_#qQ(G{(JlZ(rh#P diff --git a/Source/SynEditOptionsDialog.dfm b/Source/SynEditOptionsDialog.dfm index 5d1e74a..f62bebf 100644 --- a/Source/SynEditOptionsDialog.dfm +++ b/Source/SynEditOptionsDialog.dfm @@ -3,66 +3,51 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog Top = 154 BorderStyle = bsDialog Caption = 'Editor Options' - ClientHeight = 393 - ClientWidth = 369 + ClientHeight = 415 + ClientWidth = 388 Color = clBtnFace Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText - Font.Height = -11 + Font.Height = -12 Font.Name = 'Segoe UI' Font.Style = [] - OldCreateOrder = True - Position = poScreenCenter + Position = poMainFormCenter OnCreate = FormCreate OnShow = FormShow - PixelsPerInch = 96 - TextHeight = 13 - object PageControl: TPageControl - Left = 0 - Top = 0 - Width = 369 - Height = 359 + DesignSize = ( + 388 + 415) + TextHeight = 15 + object PageControl1: TPageControl + Left = 6 + Top = 8 + Width = 380 + Height = 363 ActivePage = Display - Align = alClient + Anchors = [akLeft, akTop, akRight, akBottom] TabOrder = 0 object Display: TTabSheet + BorderWidth = 6 Caption = 'Display' - object gbRightEdge: TGroupBox - Left = 8 - Top = 136 - Width = 159 - Height = 88 - Caption = 'Right Edge' - TabOrder = 1 - object lblEdgeColumn: TLabel - Left = 4 - Top = 26 - Width = 76 - Height = 13 - Alignment = taRightJustify - AutoSize = False - Caption = 'Edge Column:' - end - object eRightEdge: TEdit - Left = 84 - Top = 23 - Width = 62 - Height = 21 - TabOrder = 0 - Text = '0' - end - end object gbGutter: TGroupBox - Left = 8 - Top = 8 - Width = 343 + Left = 0 + Top = 0 + Width = 360 Height = 121 + Align = alTop Caption = 'Gutter' TabOrder = 0 + object Label1: TLabel + Left = 176 + Top = 96 + Width = 66 + Height = 15 + Caption = 'Gutter color:' + end object ckGutterAutosize: TCheckBox Left = 9 Top = 37 - Width = 134 + Width = 120 Height = 17 Caption = 'Autosize' TabOrder = 1 @@ -70,7 +55,7 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog object ckGutterShowLineNumbers: TCheckBox Left = 9 Top = 56 - Width = 134 + Width = 120 Height = 17 Caption = 'Show line numbers' TabOrder = 2 @@ -78,7 +63,7 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog object ckGutterShowLeaderZeros: TCheckBox Left = 9 Top = 94 - Width = 134 + Width = 120 Height = 17 Caption = 'Show leading zeros' TabOrder = 4 @@ -86,7 +71,7 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog object ckGutterStartAtZero: TCheckBox Left = 9 Top = 75 - Width = 134 + Width = 120 Height = 17 Caption = 'Start at zero' TabOrder = 3 @@ -94,132 +79,309 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog object ckGutterVisible: TCheckBox Left = 9 Top = 18 - Width = 134 + Width = 120 Height = 17 Caption = 'Visible' Checked = True State = cbChecked TabOrder = 0 end - end - object gbBookmarks: TGroupBox - Left = 8 - Top = 232 - Width = 159 - Height = 79 - Caption = 'Bookmarks' - TabOrder = 3 - object ckBookmarkKeys: TCheckBox - Left = 9 - Top = 24 - Width = 130 - Height = 17 - Caption = 'Bookmark keys' - TabOrder = 0 - end - object ckBookmarkVisible: TCheckBox - Left = 9 - Top = 48 - Width = 130 + object cbGutterFont: TCheckBox + Left = 176 + Top = 18 + Width = 120 Height = 17 - Caption = 'Bookmarks visible' - TabOrder = 1 + Caption = 'Use Gutter Font' + TabOrder = 5 + OnClick = cbGutterFontClick end - end - object gbEditorFont: TGroupBox - Left = 180 - Top = 230 - Width = 172 - Height = 79 - Caption = 'Editor Font' - TabOrder = 4 - object btnFont: TButton - Left = 72 - Top = 49 - Width = 84 + object btnGutterFont: TStyledButton + Left = 292 + Top = 14 + Width = 40 Height = 25 Caption = 'Font' - TabOrder = 1 - OnClick = btnFontClick + TabOrder = 6 + OnClick = btnGutterFontClick end - object pnlEditorFont: TPanel - Left = 8 - Top = 19 - Width = 143 - Height = 30 - BevelOuter = bvNone - TabOrder = 0 - object lblFont: TLabel + object pGutterBack: TPanel + Left = 261 + Top = 92 + Width = 52 + Height = 21 + BorderWidth = 1 + TabOrder = 8 + object pGutterColor: TPanel Left = 2 - Top = 1 - Width = 91 - Height = 15 - Caption = 'Consolas 10pt' + Top = 2 + Width = 38 + Height = 17 + Align = alClient + BevelOuter = bvLowered + Color = clGray + TabOrder = 0 + OnClick = pGutterColorClick + end + object btnGutterColor: TPanel + Left = 40 + Top = 2 + Width = 10 + Height = 17 + Align = alRight + BevelOuter = bvNone + TabOrder = 1 + OnMouseDown = btnGutterColorMouseDown + object Image2: TImage + Left = 3 + Top = 6 + Width = 5 + Height = 5 + Picture.Data = { + 07544269746D61708A000000424D8A0000000000000076000000280000000500 + 0000050000000100040000000000140000000000000000000000100000001000 + 0000000000000000800000800000008080008000000080008000808000008080 + 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF + FF00DDDDD000DD0DD000D000D00000000000DDDDD000} + Transparent = True + OnMouseDown = btnGutterColorMouseDown + end + end + end + object pnlGutterFontDisplay: TPanel + Left = 176 + Top = 40 + Width = 156 + Height = 33 + BevelOuter = bvNone + TabOrder = 7 + object lblGutterFont: TLabel + Left = 0 + Top = 0 + Width = 156 + Height = 33 + Align = alClient + Alignment = taCenter + AutoSize = False + Caption = 'Courier New 8pt' Font.Charset = DEFAULT_CHARSET Font.Color = clWindowText - Font.Height = -13 - Font.Name = 'Consolas' + Font.Height = -11 + Font.Name = 'Courier New' Font.Style = [] ParentFont = False end end end - object gbLineSpacing: TGroupBox - Left = 180 - Top = 136 - Width = 172 + object Panel2: TPanel + Left = 0 + Top = 121 + Width = 360 + Height = 96 + Align = alTop + BevelOuter = bvNone + TabOrder = 1 + object gbRightEdge: TGroupBox + Left = 0 + Top = 4 + Width = 172 + Height = 88 + Caption = 'Right Edge' + TabOrder = 0 + object Label3: TLabel + Left = 9 + Top = 56 + Width = 59 + Height = 15 + Caption = 'Edge color:' + end + object Label10: TLabel + Left = 9 + Top = 26 + Width = 75 + Height = 15 + Caption = 'Edge Column:' + end + object pRightEdgeBack: TPanel + Left = 97 + Top = 54 + Width = 52 + Height = 21 + BorderWidth = 1 + TabOrder = 1 + object pRightEdgeColor: TPanel + Left = 2 + Top = 2 + Width = 38 + Height = 17 + Align = alClient + BevelOuter = bvLowered + Color = clGray + TabOrder = 0 + OnClick = pRightEdgeColorClick + end + object btnRightEdge: TPanel + Left = 40 + Top = 2 + Width = 10 + Height = 17 + Align = alRight + BevelOuter = bvNone + TabOrder = 1 + OnMouseDown = btnRightEdgeMouseDown + object Image1: TImage + Left = 3 + Top = 6 + Width = 5 + Height = 5 + Picture.Data = { + 07544269746D61708A000000424D8A0000000000000076000000280000000500 + 0000050000000100040000000000140000000000000000000000100000001000 + 0000000000000000800000800000008080008000000080008000808000008080 + 8000C0C0C0000000FF0000FF000000FFFF00FF000000FF00FF00FFFF0000FFFF + FF00DDDDD000DD0DD000D000D00000000000DDDDD000} + Transparent = True + OnMouseDown = btnRightEdgeMouseDown + end + end + end + object eRightEdge: TEdit + Left = 98 + Top = 23 + Width = 51 + Height = 23 + TabOrder = 0 + Text = '0' + end + end + object gbLineSpacing: TGroupBox + Left = 186 + Top = 5 + Width = 174 + Height = 88 + Caption = 'Line spacing / Tab spacing' + TabOrder = 1 + object Label8: TLabel + Left = 9 + Top = 27 + Width = 58 + Height = 15 + Caption = 'Extra Lines:' + end + object Label9: TLabel + Left = 9 + Top = 56 + Width = 57 + Height = 15 + Caption = 'Tab Width:' + end + object eLineSpacing: TEdit + Left = 80 + Top = 23 + Width = 52 + Height = 23 + TabOrder = 0 + Text = '0' + end + object eTabWidth: TEdit + Left = 80 + Top = 53 + Width = 52 + Height = 23 + TabOrder = 1 + Text = '8' + end + end + end + object Panel4: TPanel + Left = 0 + Top = 217 + Width = 360 Height = 88 - Caption = 'Line spacing / Tab spacing' + Align = alTop + BevelOuter = bvNone TabOrder = 2 - object lblExtraLines: TLabel - Left = 14 - Top = 27 - Width = 76 - Height = 13 - Alignment = taRightJustify - AutoSize = False - Caption = 'Extra Lines:' - end - object lblTabWidth: TLabel - Left = 14 - Top = 56 - Width = 76 - Height = 13 - Alignment = taRightJustify - AutoSize = False - Caption = 'Tab Width:' - end - object eLineSpacing: TEdit - Left = 94 - Top = 23 - Width = 62 - Height = 21 + object gbBookmarks: TGroupBox + Left = 0 + Top = 4 + Width = 170 + Height = 79 + Caption = 'Bookmarks' TabOrder = 0 - Text = '0' + object ckBookmarkKeys: TCheckBox + Left = 9 + Top = 25 + Width = 101 + Height = 17 + Caption = 'Bookmark keys' + TabOrder = 0 + end + object ckBookmarkVisible: TCheckBox + Left = 9 + Top = 51 + Width = 121 + Height = 17 + Caption = 'Bookmarks visible' + TabOrder = 1 + end end - object eTabWidth: TEdit - Left = 94 - Top = 53 - Width = 62 - Height = 21 + object gbEditorFont: TGroupBox + Left = 186 + Top = 5 + Width = 174 + Height = 79 + Caption = 'Editor Font' TabOrder = 1 - Text = '8' + object btnFont: TStyledButton + Left = 67 + Top = 47 + Width = 84 + Height = 25 + Caption = 'Font' + TabOrder = 0 + OnClick = btnFontClick + end + object Panel3: TPanel + Left = 8 + Top = 19 + Width = 143 + Height = 30 + BevelOuter = bvNone + TabOrder = 1 + object labFont: TLabel + Left = 0 + Top = 0 + Width = 143 + Height = 30 + Align = alClient + Alignment = taCenter + AutoSize = False + Caption = 'Courier New 10pt' + Font.Charset = DEFAULT_CHARSET + Font.Color = clWindowText + Font.Height = -13 + Font.Name = 'Courier New' + Font.Style = [] + ParentFont = False + end + end end end end object Options: TTabSheet + BorderWidth = 6 Caption = 'Options' object gbOptions: TGroupBox - Left = 8 + Left = 0 Top = 0 - Width = 346 - Height = 247 + Width = 360 + Height = 250 + Align = alClient Caption = 'Options' TabOrder = 0 object ckAutoIndent: TCheckBox Left = 9 Top = 15 - Width = 160 + Width = 170 Height = 17 Hint = 'Will indent the caret on new lines with the same amount of leadi' + @@ -229,318 +391,339 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog end object ckDragAndDropEditing: TCheckBox Left = 9 - Top = 53 - Width = 160 + Top = 34 + Width = 170 Height = 17 Hint = 'Allows you to select a block of text and drag it within the docu' + 'ment to another location' Caption = 'Drag and drop editing' - TabOrder = 2 - end - object ckAutoSizeMaxWidth: TCheckBox - Left = 9 - Top = 34 - Width = 160 - Height = 17 - Hint = 'Allows the editor accept OLE file drops' - Caption = 'Auto size scroll width' TabOrder = 1 end object ckHalfPageScroll: TCheckBox - Left = 176 + Left = 182 Top = 15 - Width = 160 + Width = 170 Height = 17 Hint = 'When scrolling with page-up and page-down commands, only scroll ' + 'a half page at a time' Caption = 'Half page scroll' - TabOrder = 12 + TabOrder = 11 end object ckEnhanceEndKey: TCheckBox Left = 9 - Top = 186 - Width = 160 + Top = 167 + Width = 170 Height = 17 Hint = 'Makes it so the caret is never visible' Caption = 'Enhance End Key' - TabOrder = 9 + TabOrder = 8 end object ckScrollByOneLess: TCheckBox - Left = 176 + Left = 182 Top = 34 - Width = 160 + Width = 170 Height = 17 Hint = 'Forces scrolling to be one less' Caption = 'Scroll by one less' - TabOrder = 13 + TabOrder = 12 end object ckScrollPastEOF: TCheckBox - Left = 176 + Left = 182 Top = 53 - Width = 160 + Width = 170 Height = 17 Hint = 'Allows the cursor to go past the end of file marker' Caption = 'Scroll past end of file' - TabOrder = 14 + TabOrder = 13 end object ckScrollPastEOL: TCheckBox - Left = 176 + Left = 182 Top = 72 - Width = 160 + Width = 170 Height = 17 Hint = 'Allows the cursor to go past the last character into the white s' + 'pace at the end of a line' Caption = 'Scroll past end of line' - TabOrder = 15 + TabOrder = 14 end object ckShowScrollHint: TCheckBox - Left = 176 + Left = 182 Top = 91 - Width = 160 + Width = 170 Height = 17 Hint = 'Shows a hint of the visible line numbers when scrolling vertical' + 'ly' Caption = 'Show scroll hint' - TabOrder = 16 + TabOrder = 15 end object ckSmartTabs: TCheckBox Left = 9 - Top = 129 - Width = 160 + Top = 110 + Width = 170 Height = 17 Hint = 'When tabbing, the cursor will go to the next non-white space cha' + 'racter of the previous line' Caption = 'Smart tabs' - TabOrder = 6 + TabOrder = 5 end object ckTabsToSpaces: TCheckBox - Left = 176 - Top = 148 - Width = 160 + Left = 182 + Top = 129 + Width = 170 Height = 17 Hint = 'Converts a tab character to the number of spaces in Tab Width' Caption = 'Tabs to spaces' - TabOrder = 19 + TabOrder = 17 end object ckTrimTrailingSpaces: TCheckBox - Left = 176 - Top = 167 - Width = 160 + Left = 182 + Top = 148 + Width = 170 Height = 17 Hint = 'Spaces at the end of lines will be trimmed and not saved' Caption = 'Trim trailing spaces' - TabOrder = 20 + TabOrder = 18 end object ckWantTabs: TCheckBox Left = 9 - Top = 110 - Width = 160 + Top = 91 + Width = 170 Height = 17 Hint = 'Let the editor accept tab characters instead of going to the nex' + 't control' Caption = 'Want tabs' - TabOrder = 5 + TabOrder = 4 end - object ckAltSetsColumnMode: TCheckBox + object ckBracketsHiglight: TCheckBox Left = 9 - Top = 72 - Width = 160 + Top = 53 + Width = 170 Height = 17 - Hint = - 'Holding down the Alt Key will put the selection mode into column' + - 'ar format' - Caption = 'Alt sets column mode' - TabOrder = 3 + Hint = 'When the cursor moves to a bracket highlight the matching one' + Caption = 'Higlight matching brackets' + TabOrder = 2 end object ckKeepCaretX: TCheckBox Left = 9 - Top = 91 - Width = 160 + Top = 72 + Width = 170 Height = 17 Hint = 'When moving through lines the X position will always stay the sa' + 'me' Caption = 'Maintain caret column' - TabOrder = 4 + TabOrder = 3 end object ckScrollHintFollows: TCheckBox - Left = 176 + Left = 182 Top = 110 - Width = 160 + Width = 170 Height = 17 Hint = 'The scroll hint follows the mouse when scrolling vertically' Caption = 'Scroll hint follows mouse' - TabOrder = 17 + TabOrder = 16 end object ckGroupUndo: TCheckBox - Left = 176 - Top = 186 - Width = 160 + Left = 182 + Top = 167 + Width = 170 Height = 17 Hint = 'When undoing/redoing actions, handle all continous changes of th' + 'e same kind in one call instead undoing/redoing each command sep' + 'arately' Caption = 'Group undo' - TabOrder = 21 + TabOrder = 19 end object ckSmartTabDelete: TCheckBox Left = 9 - Top = 148 - Width = 160 + Top = 129 + Width = 170 Height = 17 Hint = 'similar to Smart Tabs, but when you delete characters' Caption = 'Smart tab delete' - TabOrder = 7 + TabOrder = 6 end object ckRightMouseMoves: TCheckBox - Left = 176 - Top = 205 - Width = 160 + Left = 182 + Top = 186 + Width = 170 Height = 17 Hint = 'When clicking with the right mouse for a popup menu, move the cu' + 'rsor to that location' Caption = 'Right mouse moves cursor' - TabOrder = 22 + TabOrder = 20 end object ckEnhanceHomeKey: TCheckBox Left = 9 - Top = 167 - Width = 160 + Top = 148 + Width = 170 Height = 17 Hint = 'enhances home key positioning, similar to visual studio' Caption = 'Enhance Home Key' - TabOrder = 8 + TabOrder = 7 end object ckHideShowScrollbars: TCheckBox Left = 9 - Top = 205 - Width = 160 + Top = 186 + Width = 170 Height = 17 Hint = 'if enabled, then the scrollbars will only show when necessary. ' + 'If you have ScrollPastEOL, then it the horizontal bar will alway' + 's be there (it uses MaxLength instead)' Caption = 'Hide scrollbars as necessary' - TabOrder = 10 + TabOrder = 9 end object ckDisableScrollArrows: TCheckBox Left = 9 - Top = 224 - Width = 160 + Top = 205 + Width = 170 Height = 17 Hint = 'Disables the scroll bar arrow buttons when you can'#39't scroll in t' + 'hat direction any more' Caption = 'Disable scroll arrows' - TabOrder = 11 + TabOrder = 10 end object ckShowSpecialChars: TCheckBox - Left = 176 - Top = 224 - Width = 160 + Left = 182 + Top = 205 + Width = 170 Height = 17 Hint = 'Shows linebreaks, spaces and tabs using special symbols' Caption = 'Show special chars' - TabOrder = 23 + TabOrder = 21 end - object ckTabIndent: TCheckBox - Left = 176 - Top = 129 - Width = 160 + object ckCompleteBrackets: TCheckBox + Left = 9 + Top = 224 + Width = 170 Height = 17 - Hint = 'Use tab for indention' - Caption = 'Tab indent' - TabOrder = 18 + Hint = 'Auto complete brackets' + Caption = 'Complete brackets' + TabOrder = 22 + end + object ckCompleteQuotes: TCheckBox + Left = 182 + Top = 224 + Width = 170 + Height = 17 + Hint = 'Auto complete quotes' + Caption = 'Complete quotes' + TabOrder = 23 + end + end + object gbCaret: TGroupBox + Left = 0 + Top = 250 + Width = 360 + Height = 71 + Align = alBottom + Caption = 'Caret' + TabOrder = 1 + DesignSize = ( + 360 + 71) + object Label2: TLabel + Left = 16 + Top = 18 + Width = 61 + Height = 15 + Caption = 'Insert caret:' + end + object Label4: TLabel + Left = 16 + Top = 45 + Width = 83 + Height = 15 + Caption = 'Overwrite caret:' + end + object cInsertCaret: TComboBox + Left = 120 + Top = 14 + Width = 219 + Height = 23 + Style = csDropDownList + Anchors = [akLeft, akTop, akRight] + TabOrder = 0 + Items.Strings = ( + 'Vertical Line' + 'Horizontal Line' + 'Half Block' + 'Block') + end + object cOverwriteCaret: TComboBox + Left = 120 + Top = 41 + Width = 219 + Height = 23 + Style = csDropDownList + Anchors = [akLeft, akTop, akRight] + TabOrder = 1 + Items.Strings = ( + 'Vertical Line' + 'Horizontal Line' + 'Half Block' + 'Block') end end end object Keystrokes: TTabSheet + BorderWidth = 6 Caption = 'Keystrokes' - object btnAddKey: TButton - Left = 96 - Top = 152 - Width = 75 - Height = 25 - Caption = '&Add' - TabOrder = 2 - OnClick = btnAddKeyClick - end - object btnRemKey: TButton - Left = 176 - Top = 152 - Width = 75 - Height = 25 - Caption = '&Remove' - TabOrder = 3 - OnClick = btnRemKeyClick - end object gbKeyStrokes: TGroupBox - Left = 8 - Top = 192 - Width = 346 - Height = 119 + Left = 0 + Top = 203 + Width = 360 + Height = 118 + Align = alBottom Caption = 'Keystroke Options' - TabOrder = 4 - object lblCommand: TLabel + TabOrder = 1 + object Label5: TLabel Left = 16 Top = 28 - Width = 90 - Height = 13 - Alignment = taRightJustify - AutoSize = False + Width = 60 + Height = 15 Caption = 'Command:' end - object lblKeystroke2: TLabel + object Label6: TLabel Left = 16 Top = 91 - Width = 90 - Height = 13 - Alignment = taRightJustify - AutoSize = False + Width = 54 + Height = 15 Caption = 'Keystroke:' end - object lblKeystroke: TLabel + object Label7: TLabel Left = 16 Top = 59 - Width = 90 - Height = 13 - Alignment = taRightJustify - AutoSize = False + Width = 54 + Height = 15 Caption = 'Keystroke:' end object cKeyCommand: TComboBox Left = 120 Top = 23 Width = 186 - Height = 21 + Height = 23 + Style = csDropDownList TabOrder = 0 - OnExit = cKeyCommandExit - OnKeyPress = cKeyCommandKeyPress OnKeyUp = cKeyCommandKeyUp end end - object btnUpdateKey: TButton - Left = 16 - Top = 152 - Width = 75 - Height = 25 - Caption = '&Update' - TabOrder = 1 - OnClick = btnUpdateKeyClick - end object pnlCommands: TPanel - Left = 8 - Top = 13 - Width = 346 - Height = 132 + Left = 0 + Top = 0 + Width = 360 + Height = 159 + Align = alClient BevelInner = bvRaised BevelOuter = bvLowered Caption = 'pnlCommands' @@ -548,18 +731,18 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog object KeyList: TListView Left = 2 Top = 2 - Width = 342 - Height = 128 + Width = 356 + Height = 155 Align = alClient BorderStyle = bsNone Columns = < item Caption = 'Command' - Width = 160 + Width = 167 end item Caption = 'Keystroke' - Width = 160 + Width = 142 end> ColumnClick = False HideSelection = False @@ -570,151 +753,207 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog OnChanging = KeyListChanging end end + object Panel1: TPanel + Left = 0 + Top = 159 + Width = 360 + Height = 44 + Align = alBottom + BevelOuter = bvNone + TabOrder = 2 + object btnRemKey: TStyledButton + Left = 162 + Top = 5 + Width = 75 + Height = 25 + Caption = '&Remove' + TabOrder = 0 + OnClick = btnRemKeyClick + end + object btnAddKey: TStyledButton + Left = 81 + Top = 5 + Width = 75 + Height = 25 + Caption = '&Add' + TabOrder = 1 + OnClick = btnAddKeyClick + end + object btnUpdateKey: TStyledButton + Left = 0 + Top = 5 + Width = 75 + Height = 25 + Caption = '&Update' + TabOrder = 2 + OnClick = btnUpdateKeyClick + end + end end end - object BottomPanel: TPanel - Left = 0 - Top = 359 - Width = 369 - Height = 34 - Align = alBottom + object btnOk: TStyledButton + Left = 226 + Top = 380 + Width = 75 + Height = 25 + Anchors = [akRight, akBottom] + Caption = '&OK' + Default = True + ModalResult = 1 TabOrder = 1 - object btnOk: TButton - Left = 203 - Top = 4 - Width = 75 - Height = 25 - Caption = '&OK' - Default = True - ModalResult = 1 - TabOrder = 0 - OnClick = btnOkClick - end - object btnCancel: TButton - Left = 283 - Top = 4 - Width = 75 - Height = 25 - Cancel = True - Caption = '&Cancel' - ModalResult = 2 - TabOrder = 1 - end + OnClick = btnOkClick + end + object btnCancel: TStyledButton + Left = 306 + Top = 380 + Width = 75 + Height = 25 + Anchors = [akRight, akBottom] + Cancel = True + Caption = '&Cancel' + ModalResult = 2 + TabOrder = 2 end object ColorDialog: TColorDialog Left = 24 - Top = 346 + Top = 369 end object ColorPopup: TPopupMenu - Left = 64 - Top = 346 - object mnuNone: TMenuItem + Left = 56 + Top = 369 + object None1: TMenuItem Tag = -1 Caption = 'None' + OnClick = PopupMenuClick end - object mnuScrollBar: TMenuItem + object Scrollbar1: TMenuItem Caption = 'Scrollbar' + OnClick = PopupMenuClick end - object mnuBackground: TMenuItem + object Background1: TMenuItem Tag = 1 Caption = 'Background' + OnClick = PopupMenuClick end - object mnuActiveCaption: TMenuItem + object ActiveCaption1: TMenuItem Tag = 2 Caption = 'Active Caption' + OnClick = PopupMenuClick end - object mnuInactiveCaption: TMenuItem + object InactiveCaption1: TMenuItem Tag = 3 Caption = 'Inactive Caption' + OnClick = PopupMenuClick end - object mnuMenu: TMenuItem + object Menu1: TMenuItem Tag = 4 Caption = 'Menu' + OnClick = PopupMenuClick end - object mnuWindow: TMenuItem + object Window1: TMenuItem Tag = 5 Caption = 'Window' + OnClick = PopupMenuClick end - object mnuWindowFrame: TMenuItem + object WindowFrame1: TMenuItem Tag = 6 Caption = 'Window Frame' + OnClick = PopupMenuClick end - object Menu2: TMenuItem + object MEnu2: TMenuItem Tag = 7 Caption = 'Menu Text' + OnClick = PopupMenuClick end - object mnuWindowText: TMenuItem + object WindowText1: TMenuItem Tag = 8 Caption = 'Window Text' + OnClick = PopupMenuClick end - object mnuCaptionText: TMenuItem + object CaptionText1: TMenuItem Tag = 9 Caption = 'Caption Text' + OnClick = PopupMenuClick end - object mnuActiveBorder: TMenuItem + object ActiveBorder1: TMenuItem Tag = 10 Caption = 'Active Border' + OnClick = PopupMenuClick end - object mnuInactiveBorder: TMenuItem + object InactiveBorder1: TMenuItem Tag = 11 Caption = 'Inactive Border' + OnClick = PopupMenuClick end - object mnuApplicationWorkspace: TMenuItem + object ApplicationWorkspace1: TMenuItem Tag = 12 Caption = 'Application Workspace' + OnClick = PopupMenuClick end - object mnuHighlight: TMenuItem + object Highlight1: TMenuItem Tag = 13 Caption = 'Highlight' + OnClick = PopupMenuClick end - object mnuHighlightText: TMenuItem + object HighlightText1: TMenuItem Tag = 14 Caption = 'Highlight Text' + OnClick = PopupMenuClick end - object mnuButtonFace: TMenuItem + object ButtonFace1: TMenuItem Tag = 15 Caption = 'Button Face' + OnClick = PopupMenuClick end - object mnuButtonShadow: TMenuItem + object ButtonShadow1: TMenuItem Tag = 16 Caption = 'Button Shadow' + OnClick = PopupMenuClick end - object mnuGrayText: TMenuItem + object GrayText1: TMenuItem Tag = 17 Caption = 'Gray Text' + OnClick = PopupMenuClick end - object mnuButtonText: TMenuItem + object ButtonText1: TMenuItem Tag = 18 Caption = 'Button Text' + OnClick = PopupMenuClick end - object mnuInactiveCaptionText: TMenuItem + object InactiveCaptionText1: TMenuItem Tag = 19 Caption = 'Inactive Caption Text' + OnClick = PopupMenuClick end - object mnuHighlight2: TMenuItem + object Highlight2: TMenuItem Tag = 20 Caption = 'Highlight' + OnClick = PopupMenuClick end - object mnu3dDarkShadow: TMenuItem + object N3dDarkShadow1: TMenuItem Tag = 21 Caption = '3D Dark Shadow' + OnClick = PopupMenuClick end - object mnu3DLight: TMenuItem + object N3DLight1: TMenuItem Tag = 22 Caption = '3D Light' + OnClick = PopupMenuClick end - object mnuInfoTipText: TMenuItem + object InfoTipText1: TMenuItem Tag = 23 Caption = 'Info Tip Text' + OnClick = PopupMenuClick end - object mnuInfoTipBackground: TMenuItem + object InfoTipBackground1: TMenuItem Tag = 24 Caption = 'Info Tip Background' + OnClick = PopupMenuClick end end - object ImageList: TImageList - Left = 104 - Top = 346 + object ImageList1: TImageList + Left = 88 + Top = 369 end object FontDialog: TFontDialog Font.Charset = DEFAULT_CHARSET @@ -723,7 +962,7 @@ object fmEditorOptionsDialog: TfmEditorOptionsDialog Font.Name = 'MS Sans Serif' Font.Style = [] Options = [fdEffects, fdFixedPitchOnly] - Left = 136 - Top = 346 + Left = 120 + Top = 369 end end diff --git a/Source/SynEditOptionsDialog.pas b/Source/SynEditOptionsDialog.pas index a121b31..86b06ef 100644 --- a/Source/SynEditOptionsDialog.pas +++ b/Source/SynEditOptionsDialog.pas @@ -26,26 +26,15 @@ replace them with the notice and other provisions required by the GPL. If you do not delete the provisions above, a recipient may use your version of this file under either the MPL or the GPL. - -$Id: SynEditOptionsDialog.pas,v 1.21.2.5 2005/07/20 13:37:18 maelh Exp $ - -You may retrieve the latest version of this file at the SynEdit home page, -located at http://SynEdit.SourceForge.net - -Known Issues: - -------------------------------------------------------------------------------} -{$IFNDEF QSYNEDITOPTIONSDIALOG} unit SynEditOptionsDialog; -{$ENDIF} -{$I SynEdit.Inc} +{$I SynEdit.inc} interface uses - Types, Windows, Messages, Graphics, @@ -58,22 +47,19 @@ interface Registry, ExtCtrls, Buttons, + ImgList, Menus, SynEdit, SynEditHighlighter, SynEditMiscClasses, SynEditKeyCmds, Classes, - SysUtils - , System.ImageList - , Vcl.ImgList; + SysUtils, + System.ImageList, + Vcl.ButtonStylesAttributes, + Vcl.StyledButton; type -{$IFNDEF SYN_DELPHI_4_UP} - TLVSelectItemEvent = procedure(Sender: TObject; Item: TListItem; - Selected: Boolean) of object; -{$ENDIF} - TColorPopup = (cpGutter, cpRightEdge); TSynEditorOptionsUserCommand = procedure(AUserCommand: Integer; @@ -92,100 +78,124 @@ interface TSynEditorOptionsContainer = class; TfmEditorOptionsDialog = class(TForm) - btnAddKey: TButton; - btnFont: TButton; - btnRemKey: TButton; - btnUpdateKey: TButton; - ckAltSetsColumnMode: TCheckBox; - ckAutoIndent: TCheckBox; - ckAutoSizeMaxWidth: TCheckBox; - ckBookmarkKeys: TCheckBox; - ckBookmarkVisible: TCheckBox; - ckDisableScrollArrows: TCheckBox; - ckDragAndDropEditing: TCheckBox; - ckEnhanceEndKey: TCheckBox; - ckEnhanceHomeKey: TCheckBox; - cKeyCommand: TComboBox; - ckGroupUndo: TCheckBox; + PageControl1: TPageControl; + btnOk: TStyledButton; + btnCancel: TStyledButton; + Display: TTabSheet; + ColorDialog: TColorDialog; + ColorPopup: TPopupMenu; + None1: TMenuItem; + Scrollbar1: TMenuItem; + ActiveCaption1: TMenuItem; + Background1: TMenuItem; + InactiveCaption1: TMenuItem; + Menu1: TMenuItem; + Window1: TMenuItem; + WindowFrame1: TMenuItem; + MEnu2: TMenuItem; + WindowText1: TMenuItem; + CaptionText1: TMenuItem; + ActiveBorder1: TMenuItem; + InactiveBorder1: TMenuItem; + ApplicationWorkspace1: TMenuItem; + Highlight1: TMenuItem; + HighlightText1: TMenuItem; + ButtonFace1: TMenuItem; + ButtonShadow1: TMenuItem; + GrayText1: TMenuItem; + ButtonText1: TMenuItem; + InactiveCaptionText1: TMenuItem; + Highlight2: TMenuItem; + N3dDarkShadow1: TMenuItem; + N3DLight1: TMenuItem; + InfoTipText1: TMenuItem; + InfoTipBackground1: TMenuItem; + ImageList1: TImageList; + Options: TTabSheet; + Keystrokes: TTabSheet; + gbGutter: TGroupBox; + Label1: TLabel; ckGutterAutosize: TCheckBox; - ckGutterShowLeaderZeros: TCheckBox; ckGutterShowLineNumbers: TCheckBox; + ckGutterShowLeaderZeros: TCheckBox; ckGutterStartAtZero: TCheckBox; ckGutterVisible: TCheckBox; + gbOptions: TGroupBox; + ckAutoIndent: TCheckBox; + ckDragAndDropEditing: TCheckBox; ckHalfPageScroll: TCheckBox; - ckHideShowScrollbars: TCheckBox; - ckKeepCaretX: TCheckBox; - ckRightMouseMoves: TCheckBox; + ckEnhanceEndKey: TCheckBox; ckScrollByOneLess: TCheckBox; - ckScrollHintFollows: TCheckBox; ckScrollPastEOF: TCheckBox; ckScrollPastEOL: TCheckBox; ckShowScrollHint: TCheckBox; - ckShowSpecialChars: TCheckBox; - ckSmartTabDelete: TCheckBox; ckSmartTabs: TCheckBox; - ckTabIndent: TCheckBox; ckTabsToSpaces: TCheckBox; ckTrimTrailingSpaces: TCheckBox; ckWantTabs: TCheckBox; - ColorDialog: TColorDialog; - ColorPopup: TPopupMenu; - Display: TTabSheet; - eLineSpacing: TEdit; + gbCaret: TGroupBox; + cInsertCaret: TComboBox; + Label2: TLabel; + Label4: TLabel; + cOverwriteCaret: TComboBox; + FontDialog: TFontDialog; + gbKeyStrokes: TGroupBox; + Label5: TLabel; + Label6: TLabel; + Label7: TLabel; + cKeyCommand: TComboBox; + ckBracketsHiglight: TCheckBox; + ckKeepCaretX: TCheckBox; + cbGutterFont: TCheckBox; + btnGutterFont: TStyledButton; + pGutterBack: TPanel; + pGutterColor: TPanel; + btnGutterColor: TPanel; + Image2: TImage; + ckScrollHintFollows: TCheckBox; + ckGroupUndo: TCheckBox; + ckSmartTabDelete: TCheckBox; + ckRightMouseMoves: TCheckBox; + pnlGutterFontDisplay: TPanel; + lblGutterFont: TLabel; + ckEnhanceHomeKey: TCheckBox; + pnlCommands: TPanel; + KeyList: TListView; + ckHideShowScrollbars: TCheckBox; + ckDisableScrollArrows: TCheckBox; + ckShowSpecialChars: TCheckBox; + Panel1: TPanel; + btnRemKey: TStyledButton; + btnAddKey: TStyledButton; + btnUpdateKey: TStyledButton; + Panel2: TPanel; + gbRightEdge: TGroupBox; + Label3: TLabel; + Label10: TLabel; + pRightEdgeBack: TPanel; + pRightEdgeColor: TPanel; + btnRightEdge: TPanel; + Image1: TImage; eRightEdge: TEdit; + gbLineSpacing: TGroupBox; + Label8: TLabel; + Label9: TLabel; + eLineSpacing: TEdit; eTabWidth: TEdit; - FontDialog: TFontDialog; + Panel4: TPanel; gbBookmarks: TGroupBox; + ckBookmarkKeys: TCheckBox; + ckBookmarkVisible: TCheckBox; gbEditorFont: TGroupBox; - gbGutter: TGroupBox; - gbKeyStrokes: TGroupBox; - gbLineSpacing: TGroupBox; - gbOptions: TGroupBox; - gbRightEdge: TGroupBox; - ImageList: TImageList; - KeyList: TListView; - Keystrokes: TTabSheet; - lblCommand: TLabel; - lblEdgeColumn: TLabel; - lblExtraLines: TLabel; - lblFont: TLabel; - lblKeystroke: TLabel; - lblKeystroke2: TLabel; - lblTabWidth: TLabel; - Menu2: TMenuItem; - mnu3dDarkShadow: TMenuItem; - mnu3DLight: TMenuItem; - mnuActiveBorder: TMenuItem; - mnuActiveCaption: TMenuItem; - mnuApplicationWorkspace: TMenuItem; - mnuBackground: TMenuItem; - mnuButtonFace: TMenuItem; - mnuButtonShadow: TMenuItem; - mnuButtonText: TMenuItem; - mnuCaptionText: TMenuItem; - mnuGrayText: TMenuItem; - mnuHighlight: TMenuItem; - mnuHighlight2: TMenuItem; - mnuHighlightText: TMenuItem; - mnuInactiveBorder: TMenuItem; - mnuInactiveCaption: TMenuItem; - mnuInactiveCaptionText: TMenuItem; - mnuInfoTipBackground: TMenuItem; - mnuInfoTipText: TMenuItem; - mnuMenu: TMenuItem; - mnuNone: TMenuItem; - mnuScrollBar: TMenuItem; - mnuWindow: TMenuItem; - mnuWindowFrame: TMenuItem; - mnuWindowText: TMenuItem; - Options: TTabSheet; - PageControl: TPageControl; - pnlCommands: TPanel; - pnlEditorFont: TPanel; - BottomPanel: TPanel; - btnOk: TButton; - btnCancel: TButton; + btnFont: TStyledButton; + Panel3: TPanel; + labFont: TLabel; + ckCompleteBrackets: TCheckBox; + ckCompleteQuotes: TCheckBox; + procedure PopupMenuClick(Sender: TObject); procedure FormCreate(Sender: TObject); + procedure pGutterColorClick(Sender: TObject); + procedure pRightEdgeColorClick(Sender: TObject); procedure btnFontClick(Sender: TObject); procedure KeyListSelectItem(Sender: TObject; Item: TListItem; Selected: Boolean); @@ -196,27 +206,27 @@ TfmEditorOptionsDialog = class(TForm) procedure KeyListEditing(Sender: TObject; Item: TListItem; var AllowEdit: Boolean); procedure btnOkClick(Sender: TObject); - procedure cKeyCommandExit(Sender: TObject); - procedure cKeyCommandKeyPress(Sender: TObject; var Key: Char); + procedure btnGutterFontClick(Sender: TObject); + procedure cbGutterFontClick(Sender: TObject); + procedure btnRightEdgeMouseDown(Sender: TObject; Button: TMouseButton; + Shift: TShiftState; X, Y: Integer); + procedure btnGutterColorMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure cKeyCommandKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); procedure KeyListChanging(Sender: TObject; Item: TListItem; Change: TItemChange; var AllowChange: Boolean); private FSynEdit: TSynEditorOptionsContainer; + FPoppedFrom: TColorPopup; FUserCommand: TSynEditorOptionsUserCommand; FAllUserCommands: TSynEditorOptionsAllUserCommands; - FOldSelected: TListItem; - FInChanging: Boolean; + OldSelected: TListItem; + InChanging: Boolean; FExtended: Boolean; - {$IFNDEF SYN_COMPILER_4_UP} - FOldWndProc: TWndMethod; - procedure OverridingWndProc(var Message: TMessage); - {$ENDIF} - - function GetColor(Item : TMenuItem) : TColor; + function GetColor(Item: TMenuItem): TColor; procedure GetData; procedure PutData; procedure EditStrCallback(const S: string); @@ -224,11 +234,8 @@ TfmEditorOptionsDialog = class(TForm) public eKeyShort2: TSynHotKey; eKeyShort1: TSynHotKey; - {$IFNDEF SYN_DELPHI_4_UP} - FOnSelectItem: TLVSelectItemEvent; - {$ENDIF} - function Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; + function Execute(EditOptions: TSynEditorOptionsContainer): Boolean; property GetUserCommandNames: TSynEditorOptionsUserCommand read FUserCommand write FUserCommand; property GetAllUserCommands: TSynEditorOptionsAllUserCommands @@ -251,7 +258,7 @@ TSynEditOptionsDialog = class(TComponent) public constructor Create(AOwner: TComponent); override; destructor Destroy; override; - function Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; + function Execute(EditOptions: TSynEditorOptionsContainer): Boolean; property Form: TfmEditorOptionsDialog read FForm; published property GetUserCommand: TSynEditorOptionsUserCommand @@ -268,12 +275,14 @@ TSynEditorOptionsContainer = class(TComponent) private FHideSelection: Boolean; FWantTabs: Boolean; + FWordWrap: Boolean; FMaxUndo: Integer; FExtraLineSpacing: Integer; FTabWidth: Integer; - FMaxScrollWidth: Integer; FRightEdge: Integer; FSelectedColor: TSynSelectedColor; + FIndentGuides: TSynIndentGuides; + FDisplayFlowControl: TSynDisplayFlowControl; FRightEdgeColor: TColor; FFont: TFont; FBookmarks: TSynBookMarkOpt; @@ -281,36 +290,53 @@ TSynEditorOptionsContainer = class(TComponent) FInsertCaret: TSynEditCaretType; FKeystrokes: TSynEditKeyStrokes; FOptions: TSynEditorOptions; + FScrollOptions: TSynEditorScrollOptions; FSynGutter: TSynGutter; FColor: TColor; + FActiveLineColor: TColor; + FVisibleSpecialChars: TSynVisibleSpecialChars; procedure SetBookMarks(const Value: TSynBookMarkOpt); procedure SetFont(const Value: TFont); procedure SetKeystrokes(const Value: TSynEditKeyStrokes); - procedure SetOptions(const Value: TSynEditorOptions); procedure SetSynGutter(const Value: TSynGutter); public constructor Create(AOwner: TComponent); override; destructor Destroy; override; - procedure Assign(Source : TPersistent); override; - procedure AssignTo(Dest : TPersistent); override; + procedure Assign(Source: TPersistent); override; + procedure AssignTo(Dest: TPersistent); override; published - property Options : TSynEditorOptions read FOptions write SetOptions; - property BookMarkOptions : TSynBookMarkOpt read FBookmarks write SetBookMarks; - property Color : TColor read FColor write FColor; - property Font : TFont read FFont write SetFont; - property ExtraLineSpacing : Integer read FExtraLineSpacing write FExtraLineSpacing; - property Gutter : TSynGutter read FSynGutter write SetSynGutter; - property RightEdge : Integer read FRightEdge write FRightEdge; - property RightEdgeColor : TColor read FRightEdgeColor write FRightEdgeColor; - property WantTabs : Boolean read FWantTabs write FWantTabs; - property InsertCaret : TSynEditCaretType read FInsertCaret write FInsertCaret; - property OverwriteCaret : TSynEditCaretType read FOverwriteCaret write FOverwriteCaret; - property HideSelection : Boolean read FHideSelection write FHideSelection; - property MaxScrollWidth : Integer read FMaxScrollWidth write FMaxScrollWidth; - property MaxUndo : Integer read FMaxUndo write FMaxUndo; - property SelectedColor : TSynSelectedColor read FSelectedColor write FSelectedColor; - property TabWidth : Integer read FTabWidth write FTabWidth; - property Keystrokes : TSynEditKeyStrokes read FKeystrokes write SetKeystrokes; + property Options: TSynEditorOptions read FOptions write FOptions + default SYNEDIT_DEFAULT_OPTIONS; + property ScrollOptions: TSynEditorScrollOptions read FScrollOptions + write FScrollOptions default SYNEDIT_DEFAULT_SCROLLOPTIONS; + property BookMarkOptions: TSynBookMarkOpt read FBookmarks write SetBookMarks; + property Color: TColor read FColor write FColor default clWindow; + property Font: TFont read FFont write SetFont; + property ExtraLineSpacing: Integer read FExtraLineSpacing + write FExtraLineSpacing default 2; + property Gutter: TSynGutter read FSynGutter write SetSynGutter; + property RightEdge: Integer read FRightEdge write FRightEdge + default 80; + property RightEdgeColor: TColor read FRightEdgeColor write FRightEdgeColor + default clSilver; + property WantTabs: Boolean read FWantTabs write FWantTabs default True; + property WordWrap: Boolean read FWordWrap write FWordWrap default False; + property InsertCaret: TSynEditCaretType read FInsertCaret + write FInsertCaret default ctVerticalLine; + property OverwriteCaret: TSynEditCaretType read FOverwriteCaret + write FOverwriteCaret default ctBlock; + property HideSelection: Boolean read FHideSelection write FHideSelection + default False; + property MaxUndo: Integer read FMaxUndo write FMaxUndo default 0; + property SelectedColor: TSynSelectedColor read FSelectedColor; + property IndentGuides: TSynIndentGuides read FIndentGuides; + property DisplayFlowControl: TSynDisplayFlowControl read FDisplayFlowControl; + property TabWidth: Integer read FTabWidth write FTabWidth default 8; + property Keystrokes: TSynEditKeyStrokes read FKeystrokes write SetKeystrokes; + property ActiveLineColor: TColor read FActiveLineColor + write FActiveLineColor default clNone; + property VisibleSpecialChars: TSynVisibleSpecialChars + read FVisibleSpecialChars write FVisibleSpecialChars default []; end; implementation @@ -318,25 +344,27 @@ implementation {$R *.dfm} uses - SynEditKeyConst; + Types, + SynEditKeyConst, + SynEditMiscProcs; { TSynEditOptionsDialog } constructor TSynEditOptionsDialog.create(AOwner: TComponent); begin inherited; - FForm := TfmEditorOptionsDialog.Create(Self); + FForm:= TfmEditorOptionsDialog.Create(Self); end; -destructor TSynEditOptionsDialog.destroy; +destructor TSynEditOptionsDialog.Destroy; begin FForm.Free; inherited; end; -function TSynEditOptionsDialog.Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; +function TSynEditOptionsDialog.Execute(EditOptions: TSynEditorOptionsContainer): Boolean; begin - Result := FForm.Execute(EditOptions); + Result:= FForm.Execute(EditOptions); end; function TSynEditOptionsDialog.GetUserCommands: TSynEditorOptionsAllUserCommands; @@ -374,91 +402,148 @@ procedure TSynEditOptionsDialog.SetExtended(const Value: Boolean); { TSynEditorOptionsContainer } procedure TSynEditorOptionsContainer.Assign(Source: TPersistent); +var + PPI: Integer; begin - if Assigned(Source) and (Source is TCustomSynEdit) then + if Source is TCustomSynEdit then begin Self.Font.Assign(TCustomSynEdit(Source).Font); Self.BookmarkOptions.Assign(TCustomSynEdit(Source).BookmarkOptions); Self.Gutter.Assign(TCustomSynEdit(Source).Gutter); Self.Keystrokes.Assign(TCustomSynEdit(Source).Keystrokes); Self.SelectedColor.Assign(TCustomSynEdit(Source).SelectedColor); + Self.IndentGuides.Assign(TCustomSynEdit(Source).IndentGuides); + Self.DisplayFlowControl.Assign(TCustomSynEdit(Source).DisplayFlowControl); Self.Color := TCustomSynEdit(Source).Color; Self.Options := TCustomSynEdit(Source).Options; + Self.ScrollOptions := TCustomSynEdit(Source).ScrollOptions; Self.ExtraLineSpacing := TCustomSynEdit(Source).ExtraLineSpacing; Self.HideSelection := TCustomSynEdit(Source).HideSelection; Self.InsertCaret := TCustomSynEdit(Source).InsertCaret; Self.OverwriteCaret := TCustomSynEdit(Source).OverwriteCaret; - Self.MaxScrollWidth := TCustomSynEdit(Source).MaxScrollWidth; Self.MaxUndo := TCustomSynEdit(Source).MaxUndo; Self.RightEdge := TCustomSynEdit(Source).RightEdge; Self.RightEdgeColor := TCustomSynEdit(Source).RightEdgeColor; Self.TabWidth := TCustomSynEdit(Source).TabWidth; Self.WantTabs := TCustomSynEdit(Source).WantTabs; + Self.WordWrap := TCustomSynEdit(Source).WordWrap; + Self.ActiveLineColor := TCustomSynEdit(Source).ActiveLineColor; + Self.VisibleSpecialChars := TCustomSynEdit(Source).VisibleSpecialChars; + // store unscaled + PPI := TCustomSynEdit(Source).CurrentPPI; + Self.BookMarkOptions.ChangeScale(96, PPI); + Self.ExtraLineSpacing := MulDiv(Self.ExtraLineSpacing, 96, PPI); + end else if Source is TSynEditorOptionsContainer then + begin + Self.Font.Assign(TSynEditorOptionsContainer(Source).Font); + Self.BookmarkOptions.Assign(TSynEditorOptionsContainer(Source).BookmarkOptions); + Self.Gutter.Assign(TSynEditorOptionsContainer(Source).Gutter); + Self.Keystrokes.Assign(TSynEditorOptionsContainer(Source).Keystrokes); + Self.SelectedColor.Assign(TSynEditorOptionsContainer(Source).SelectedColor); + Self.IndentGuides.Assign(TSynEditorOptionsContainer(Source).IndentGuides); + Self.DisplayFlowControl.Assign(TSynEditorOptionsContainer(Source).DisplayFlowControl); + Self.Color := TSynEditorOptionsContainer(Source).Color; + Self.Options := TSynEditorOptionsContainer(Source).Options; + Self.ScrollOptions := TSynEditorOptionsContainer(Source).ScrollOptions; + Self.ExtraLineSpacing := TSynEditorOptionsContainer(Source).ExtraLineSpacing; + Self.HideSelection := TSynEditorOptionsContainer(Source).HideSelection; + Self.InsertCaret := TSynEditorOptionsContainer(Source).InsertCaret; + Self.OverwriteCaret := TSynEditorOptionsContainer(Source).OverwriteCaret; + Self.MaxUndo := TSynEditorOptionsContainer(Source).MaxUndo; + Self.RightEdge := TSynEditorOptionsContainer(Source).RightEdge; + Self.RightEdgeColor := TSynEditorOptionsContainer(Source).RightEdgeColor; + Self.TabWidth := TSynEditorOptionsContainer(Source).TabWidth; + Self.WantTabs := TSynEditorOptionsContainer(Source).WantTabs; + Self.WordWrap := TSynEditorOptionsContainer(Source).WordWrap; + Self.ActiveLineColor := TSynEditorOptionsContainer(Source).ActiveLineColor; + Self.VisibleSpecialChars := TSynEditorOptionsContainer(Source).VisibleSpecialChars; end else inherited; end; procedure TSynEditorOptionsContainer.AssignTo(Dest: TPersistent); +var + PPI: Integer; begin - if Assigned(Dest) and (Dest is TCustomSynEdit) then + if Dest is TCustomSynEdit then begin - TCustomSynEdit(Dest).Font.Assign(Self.Font); - TCustomSynEdit(Dest).BookmarkOptions.Assign(Self.BookmarkOptions); - TCustomSynEdit(Dest).Gutter.Assign(Self.Gutter); - TCustomSynEdit(Dest).Keystrokes.Assign(Self.Keystrokes); - TCustomSynEdit(Dest).SelectedColor.Assign(Self.SelectedColor); - - TCustomSynEdit(Dest).Color := Self.Color; - TCustomSynEdit(Dest).Options := Self.Options; - TCustomSynEdit(Dest).ExtraLineSpacing := Self.ExtraLineSpacing; - TCustomSynEdit(Dest).HideSelection := Self.HideSelection; - TCustomSynEdit(Dest).InsertCaret := Self.InsertCaret; - TCustomSynEdit(Dest).OverwriteCaret := Self.OverwriteCaret; - TCustomSynEdit(Dest).MaxScrollWidth := Self.MaxScrollWidth; - TCustomSynEdit(Dest).MaxUndo := Self.MaxUndo; - TCustomSynEdit(Dest).RightEdge := Self.RightEdge; - TCustomSynEdit(Dest).RightEdgeColor := Self.RightEdgeColor; - TCustomSynEdit(Dest).TabWidth := Self.TabWidth; - TCustomSynEdit(Dest).WantTabs := Self.WantTabs; + TCustomSynEdit(Dest).BeginUpdate; + try + TCustomSynEdit(Dest).Font := Self.Font; + TCustomSynEdit(Dest).BookmarkOptions.Assign(Self.BookmarkOptions); + TCustomSynEdit(Dest).Gutter.Assign(Self.Gutter); + TCustomSynEdit(Dest).Keystrokes.Assign(Self.Keystrokes); + TCustomSynEdit(Dest).SelectedColor.Assign(Self.SelectedColor); + TCustomSynEdit(Dest).IndentGuides.Assign(Self.IndentGuides); + TCustomSynEdit(Dest).DisplayFlowControl.Assign(Self.DisplayFlowControl); + TCustomSynEdit(Dest).Color := Self.Color; + TCustomSynEdit(Dest).Options := Self.Options; + TCustomSynEdit(Dest).ScrollOptions := Self.ScrollOptions; + TCustomSynEdit(Dest).ExtraLineSpacing := Self.ExtraLineSpacing; + TCustomSynEdit(Dest).HideSelection := Self.HideSelection; + TCustomSynEdit(Dest).InsertCaret := Self.InsertCaret; + TCustomSynEdit(Dest).OverwriteCaret := Self.OverwriteCaret; + TCustomSynEdit(Dest).MaxUndo := Self.MaxUndo; + TCustomSynEdit(Dest).RightEdge := Self.RightEdge; + TCustomSynEdit(Dest).RightEdgeColor := Self.RightEdgeColor; + TCustomSynEdit(Dest).TabWidth := Self.TabWidth; + TCustomSynEdit(Dest).WantTabs := Self.WantTabs; + TCustomSynEdit(Dest).WordWrap := Self.WordWrap; + TCustomSynEdit(Dest).ActiveLineColor := Self.ActiveLineColor; + TCustomSynEdit(Dest).VisibleSpecialChars := Self.VisibleSpecialChars; + // scale for editor PPI + PPI := TCustomSynEdit(Dest).CurrentPPI; + TCustomSynEdit(Dest).BookMarkOptions.ChangeScale(PPI, 96); + TCustomSynEdit(Dest).ExtraLineSpacing := + MulDiv(TCustomSynEdit(Dest).ExtraLineSpacing, PPI, 96); + finally + TCustomSynEdit(Dest).EndUpdate; + end; end else inherited; end; -constructor TSynEditorOptionsContainer.create(AOwner: TComponent); + +constructor TSynEditorOptionsContainer.Create(AOwner: TComponent); begin inherited; FBookmarks := TSynBookMarkOpt.Create(Self); FKeystrokes := TSynEditKeyStrokes.Create(Self); FSynGutter := TSynGutter.Create; + FSynGutter.AssignableBands := False; FSelectedColor := TSynSelectedColor.Create; - FSelectedColor.Foreground := clHighlightText; - FSelectedColor.Background := clHighlight; + FIndentGuides := TSynIndentGuides.Create; + FDisplayFlowControl := TSynDisplayFlowControl.Create; FFont := TFont.Create; - FFont.Name := 'Courier New'; - FFont.Size := 8; - Color := clWindow; - Keystrokes.ResetDefaults; - Options := [eoAutoIndent,eoDragDropEditing,eoDropFiles,eoScrollPastEol, - eoShowScrollHint,eoSmartTabs,eoAltSetsColumnMode, eoTabsToSpaces,eoTrimTrailingSpaces, eoKeepCaretX]; - ExtraLineSpacing := 0; - HideSelection := False; - InsertCaret := ctVerticalLine; - OverwriteCaret := ctBlock; - MaxScrollWidth := 1024; - MaxUndo := 1024; - RightEdge := 80; - RightEdgeColor := clSilver; - TabWidth := 8; - WantTabs := True; -end; - -destructor TSynEditorOptionsContainer.destroy; + FFont.Name := DefaultFontName; + FFont.Size := 10; + {$if CompilerVersion >= 36} + FFont.IsScreenFont := True; + {$endif} + FColor:= clWindow; + FKeystrokes.ResetDefaults; + FOptions := SYNEDIT_DEFAULT_OPTIONS; + FScrollOptions := SYNEDIT_DEFAULT_SCROLLOPTIONS; + FExtraLineSpacing := 2; + FHideSelection := False; + FInsertCaret := ctVerticalLine; + FOverwriteCaret := ctBlock; + FMaxUndo := 0; + FRightEdge := 80; + FRightEdgeColor := clSilver; + FTabWidth := 8; + FWantTabs := True; +end; + +destructor TSynEditorOptionsContainer.Destroy; begin FBookMarks.Free; FKeyStrokes.Free; FSynGutter.Free; FSelectedColor.Free; + FIndentGuides.Free; + FDisplayFlowControl.Free; FFont.Free; inherited; end; @@ -480,12 +565,6 @@ procedure TSynEditorOptionsContainer.SetKeystrokes( FKeystrokes.Assign(Value); end; -procedure TSynEditorOptionsContainer.SetOptions( - const Value: TSynEditorOptions); -begin - FOptions := Value; -end; - procedure TSynEditorOptionsContainer.SetSynGutter(const Value: TSynGutter); begin FSynGutter.Assign(Value); @@ -493,80 +572,89 @@ procedure TSynEditorOptionsContainer.SetSynGutter(const Value: TSynGutter); { TfmEditorOptionsDialog } -function TfmEditorOptionsDialog.Execute(EditOptions : TSynEditorOptionsContainer) : Boolean; +function TfmEditorOptionsDialog.Execute(EditOptions: TSynEditorOptionsContainer): Boolean; begin if (EditOptions = nil) then begin - Result := False; + Result:= False; Exit; end; //Assign the Containers - FSynEdit := EditOptions; + FSynEdit:= EditOptions; //Get Data GetData; //Show the form - Result := Showmodal = mrOk; + Result:= Showmodal = mrOk; //PutData if Result then PutData; end; procedure TfmEditorOptionsDialog.GetData; -var I : Integer; - Item : TListItem; +var I: Integer; + Item: TListItem; begin //Gutter - ckGutterVisible.Checked := FSynEdit.Gutter.Visible; - ckGutterAutosize.Checked := FSynEdit.Gutter.AutoSize; - ckGutterShowLineNumbers.Checked := FSynEdit.Gutter.ShowLineNumbers; - ckGutterShowLeaderZeros.Checked := FSynEdit.Gutter.LeadingZeros; - ckGutterStartAtZero.Checked := FSynEdit.Gutter.ZeroStart; + ckGutterVisible.Checked:= FSynEdit.Gutter.Visible; + ckGutterAutosize.Checked:= FSynEdit.Gutter.AutoSize; + ckGutterShowLineNumbers.Checked:= FSynEdit.Gutter.ShowLineNumbers; + ckGutterShowLeaderZeros.Checked:= FSynEdit.Gutter.LeadingZeros; + ckGutterStartAtZero.Checked:= FSynEdit.Gutter.ZeroStart; + cbGutterFont.Checked := FSynEdit.Gutter.UseFontStyle; + pGutterColor.Color:= FSynEdit.Gutter.Color; + lblGutterFont.Font.Assign(FSynEdit.Gutter.Font); + lblGutterFont.Caption:= lblGutterFont.Font.Name + ' ' + IntToStr(lblGutterFont.Font.Size) + 'pt'; //Right Edge - eRightEdge.Text := IntToStr(FSynEdit.RightEdge); + eRightEdge.Text:= IntToStr(FSynEdit.RightEdge); + pRightEdgeColor.Color:= FSynEdit.RightEdgeColor; //Line Spacing - eLineSpacing.Text := IntToStr(FSynEdit.ExtraLineSpacing); - eTabWidth.Text := IntToStr(FSynEdit.TabWidth); + eLineSpacing.Text:= IntToStr(FSynEdit.ExtraLineSpacing); + eTabWidth.Text:= IntToStr(FSynEdit.TabWidth); //Bookmarks - ckBookmarkKeys.Checked := FSynEdit.BookMarkOptions.EnableKeys; - ckBookmarkVisible.Checked := FSynEdit.BookMarkOptions.GlyphsVisible; + ckBookmarkKeys.Checked:= FSynEdit.BookMarkOptions.EnableKeys; + ckBookmarkVisible.Checked:= FSynEdit.BookMarkOptions.GlyphsVisible; //Font - lblFont.Font.Assign(FSynEdit.Font); - lblFont.Caption := lblFont.Font.Name + ' ' + IntToStr(lblFont.Font.Size) + 'pt'; + labFont.Font.Assign(FSynEdit.Font); + labFont.Caption:= labFont.Font.Name + ' ' + IntToStr(labFont.Font.Size) + 'pt'; //Options - ckAutoIndent.Checked := eoAutoIndent in FSynEdit.Options; - ckAutoSizeMaxWidth.Checked := eoAutoSizeMaxScrollWidth in FSynEdit.Options; - ckDragAndDropEditing.Checked := eoDragDropEditing in FSynEdit.Options; - ckWantTabs.Checked := FSynEdit.WantTabs; - ckSmartTabs.Checked := eoSmartTabs in FSynEdit.Options; - ckAltSetsColumnMode.Checked := eoAltSetsColumnMode in FSynEdit.Options; - ckHalfPageScroll.Checked := eoHalfPageScroll in FSynEdit.Options; - ckScrollByOneLess.Checked := eoScrollByOneLess in FSynEdit.Options; - ckScrollPastEOF.Checked := eoScrollPastEof in FSynEdit.Options; - ckScrollPastEOL.Checked := eoScrollPastEol in FSynEdit.Options; - ckShowScrollHint.Checked := eoShowScrollHint in FSynEdit.Options; - ckTabsToSpaces.Checked := eoTabsToSpaces in FSynEdit.Options; - ckTrimTrailingSpaces.Checked := eoTrimTrailingSpaces in FSynEdit.Options; - ckKeepCaretX.Checked := eoKeepCaretX in FSynEdit.Options; + ckAutoIndent.Checked:= eoAutoIndent in FSynEdit.Options; + ckDragAndDropEditing.Checked:= eoDragDropEditing in FSynEdit.Options; + ckWantTabs.Checked:= FSynEdit.WantTabs; + ckSmartTabs.Checked:= eoSmartTabs in FSynEdit.Options; + ckBracketsHiglight.Checked:= eoBracketsHighlight in FSynEdit.Options; + ckHalfPageScroll.Checked:= eoHalfPageScroll in FSynEdit.ScrollOptions; + ckScrollByOneLess.Checked:= eoScrollByOneLess in FSynEdit.ScrollOptions; + ckScrollPastEOF.Checked:= eoScrollPastEof in FSynEdit.ScrollOptions; + ckScrollPastEOL.Checked:= eoScrollPastEol in FSynEdit.ScrollOptions; + ckShowScrollHint.Checked:= eoShowScrollHint in FSynEdit.ScrollOptions; + ckTabsToSpaces.Checked:= eoTabsToSpaces in FSynEdit.Options; + ckTrimTrailingSpaces.Checked:= eoTrimTrailingSpaces in FSynEdit.Options; + ckKeepCaretX.Checked:= eoKeepCaretX in FSynEdit.Options; ckSmartTabDelete.Checked := eoSmartTabDelete in FSynEdit.Options; ckRightMouseMoves.Checked := eoRightMouseMovesCursor in FSynEdit.Options; ckEnhanceHomeKey.Checked := eoEnhanceHomeKey in FSynEdit.Options; ckEnhanceEndKey.Checked := eoEnhanceEndKey in FSynEdit.Options; ckGroupUndo.Checked := eoGroupUndo in FSynEdit.Options; - ckTabIndent.Checked := eoTabIndent in FSynEdit.Options; - ckDisableScrollArrows.Checked := eoDisableScrollArrows in FSynEdit.Options; - ckHideShowScrollbars.Checked := eoHideShowScrollbars in FSynEdit.Options; - ckShowSpecialChars.Checked := eoShowSpecialChars in FSynEdit.Options; + ckDisableScrollArrows.Checked := eoDisableScrollArrows in FSynEdit.ScrollOptions; + ckHideShowScrollbars.Checked := eoHideShowScrollbars in FSynEdit.ScrollOptions; + ckShowSpecialChars.Checked := FSynEdit.VisibleSpecialChars <> []; + ckCompleteBrackets.checked := eoCompleteBrackets in FSynEdit.Options; + ckCompleteQuotes.checked := eoCompleteQuotes in FSynEdit.Options; + //Caret + cInsertCaret.ItemIndex:= ord(FSynEdit.InsertCaret); + cOverwriteCaret.ItemIndex:= ord(FSynEdit.OverwriteCaret); + KeyList.Items.BeginUpdate; try KeyList.Items.Clear; - for I := 0 to FSynEdit.Keystrokes.Count-1 do + for I:= 0 to FSynEdit.Keystrokes.Count-1 do begin - Item := KeyList.Items.Add; + Item:= KeyList.Items.Add; FillInKeystrokeInfo(FSynEdit.Keystrokes.Items[I], Item); - Item.Data := FSynEdit.Keystrokes.Items[I]; + Item.Data:= FSynEdit.Keystrokes.Items[I]; end; - if (KeyList.Items.Count > 0) then KeyList.Items[0].Selected := True; + if (KeyList.Items.Count > 0) then KeyList.Items[0].Selected:= True; finally KeyList.Items.EndUpdate; end; @@ -574,47 +662,53 @@ procedure TfmEditorOptionsDialog.GetData; procedure TfmEditorOptionsDialog.PutData; var - vOptions: TSynEditorOptions; + EdOptions: TSynEditorOptions; + EdScrollOptions: TSynEditorScrollOptions; + + procedure SetFlag(Option: TSynEditorOption; Value: Boolean); + begin + if Value then + Include(EdOptions, Option) + else + Exclude(EdOptions, Option); + end; - procedure SetFlag(aOption: TSynEditorOption; aValue: Boolean); + procedure SetScrollFlag(Option: TSynEditorScrollOption; Value: Boolean); begin - if aValue then - Include(vOptions, aOption) + if Value then + Include(EdScrollOptions, Option) else - Exclude(vOptions, aOption); + Exclude(EdScrollOptions, Option); end; begin //Gutter - FSynEdit.Gutter.Visible := ckGutterVisible.Checked; + FSynEdit.Gutter.Visible:= ckGutterVisible.Checked; FSynEdit.Gutter.AutoSize := ckGutterAutosize.Checked; - FSynEdit.Gutter.ShowLineNumbers := ckGutterShowLineNumbers.Checked; - FSynEdit.Gutter.LeadingZeros := ckGutterShowLeaderZeros.Checked; - FSynEdit.Gutter.ZeroStart := ckGutterStartAtZero.Checked; + FSynEdit.Gutter.ShowLineNumbers:= ckGutterShowLineNumbers.Checked; + FSynEdit.Gutter.LeadingZeros:= ckGutterShowLeaderZeros.Checked; + FSynEdit.Gutter.ZeroStart:= ckGutterStartAtZero.Checked; + FSynEdit.Gutter.Color:= pGutterColor.Color; + FSynEdit.Gutter.UseFontStyle := cbGutterFont.Checked; + FSynEdit.Gutter.Font.Assign(lblGutterFont.Font); //Right Edge - FSynEdit.RightEdge := StrToIntDef(eRightEdge.Text, 80); + FSynEdit.RightEdge:= StrToIntDef(eRightEdge.Text, 80); + FSynEdit.RightEdgeColor:= pRightEdgeColor.Color; //Line Spacing - FSynEdit.ExtraLineSpacing := StrToIntDef(eLineSpacing.Text, 0); - FSynEdit.TabWidth := StrToIntDef(eTabWidth.Text, 8); + FSynEdit.ExtraLineSpacing:= StrToIntDef(eLineSpacing.Text, 0); + FSynEdit.TabWidth:= StrToIntDef(eTabWidth.Text, 8); //Bookmarks - FSynEdit.BookMarkOptions.EnableKeys := ckBookmarkKeys.Checked; - FSynEdit.BookMarkOptions.GlyphsVisible := ckBookmarkVisible.Checked; + FSynEdit.BookMarkOptions.EnableKeys:= ckBookmarkKeys.Checked; + FSynEdit.BookMarkOptions.GlyphsVisible:= ckBookmarkVisible.Checked; //Font - FSynEdit.Font.Assign(lblFont.Font); + FSynEdit.Font.Assign(labFont.Font); //Options - FSynEdit.WantTabs := ckWantTabs.Checked; - vOptions := FSynEdit.Options; //Keep old values for unsupported options + FSynEdit.WantTabs:= ckWantTabs.Checked; + EdOptions := FSynEdit.Options; //Keep old values for unsupported options SetFlag(eoAutoIndent, ckAutoIndent.Checked); - SetFlag(eoAutoSizeMaxScrollWidth, ckAutoSizeMaxWidth.Checked); SetFlag(eoDragDropEditing, ckDragAndDropEditing.Checked); SetFlag(eoSmartTabs, ckSmartTabs.Checked); - SetFlag(eoAltSetsColumnMode, ckAltSetsColumnMode.Checked); - SetFlag(eoHalfPageScroll, ckHalfPageScroll.Checked); - SetFlag(eoScrollByOneLess, ckScrollByOneLess.Checked); - SetFlag(eoScrollPastEof, ckScrollPastEOF.Checked); - SetFlag(eoScrollPastEol, ckScrollPastEOL.Checked); - SetFlag(eoShowScrollHint, ckShowScrollHint.Checked); - SetFlag(eoTabIndent, ckTabIndent.Checked); + SetFlag(eoBracketsHighlight, ckBracketsHiglight.Checked); SetFlag(eoTabsToSpaces, ckTabsToSpaces.Checked); SetFlag(eoTrimTrailingSpaces, ckTrimTrailingSpaces.Checked); SetFlag(eoKeepCaretX, ckKeepCaretX.Checked); @@ -623,79 +717,96 @@ procedure TfmEditorOptionsDialog.PutData; SetFlag(eoEnhanceHomeKey, ckEnhanceHomeKey.Checked); SetFlag(eoEnhanceEndKey, ckEnhanceEndKey.Checked); SetFlag(eoGroupUndo, ckGroupUndo.Checked); - SetFlag(eoDisableScrollArrows, ckDisableScrollArrows.Checked); - SetFlag(eoHideShowScrollbars, ckHideShowScrollbars.Checked); - SetFlag(eoShowSpecialChars, ckShowSpecialChars.Checked); - FSynEdit.Options := vOptions; + SetFlag(eoCompleteBrackets, ckCompleteBrackets.checked); + SetFlag(eoCompleteQuotes, ckCompleteQuotes.checked); + FSynEdit.Options := EdOptions; + SetScrollFlag(eoHalfPageScroll, ckHalfPageScroll.Checked); + SetScrollFlag(eoScrollByOneLess, ckScrollByOneLess.Checked); + SetScrollFlag(eoScrollPastEof, ckScrollPastEOF.Checked); + SetScrollFlag(eoScrollPastEol, ckScrollPastEOL.Checked); + SetScrollFlag(eoShowScrollHint, ckShowScrollHint.Checked); + SetScrollFlag(eoDisableScrollArrows, ckDisableScrollArrows.Checked); + SetScrollFlag(eoHideShowScrollbars, ckHideShowScrollbars.Checked); + FSynEdit.ScrollOptions := EdScrollOptions; + if ckShowSpecialChars.Checked then + FSynEdit.VisibleSpecialChars := [scWhitespace, scControlChars, scEOL] + else + FSynEdit.VisibleSpecialChars := []; + //Caret + FSynEdit.InsertCaret:= TSynEditCaretType(cInsertCaret.ItemIndex); + FSynEdit.OverwriteCaret:= TSynEditCaretType(cOverwriteCaret.ItemIndex); end; function TfmEditorOptionsDialog.GetColor(Item: TMenuItem): TColor; begin if (Item.Tag = -1) or (Item.Tag > 24) then - Result := clNone + Result:= clNone else - Result := TColor(Byte(Item.Tag) or $80000000); + Result:= TColor(Byte(Item.Tag) or $80000000); +end; + +procedure TfmEditorOptionsDialog.PopupMenuClick(Sender: TObject); +var C: TColor; +begin + C:= GetColor(TMenuItem(Sender)); + //Set the color based on where it was "popped from" + if (FPoppedFrom = cpGutter) then + pGutterColor.Color:= C + else if (FPoppedFrom = cpRightEdge) then + pRightEdgeColor.Color:= C; end; procedure TfmEditorOptionsDialog.FormCreate(Sender: TObject); -var I : Integer; - C : TColor; - B : TBitmap; +var I: Integer; + C: TColor; + B: TBitmap; begin - {$IFDEF SYN_COMPILER_4_UP} KeyList.OnSelectItem := KeyListSelectItem; - {$ELSE} - FOldWndProc := KeyList.WindowProc; - KeyList.WindowProc := OverridingWndProc; - FOnSelectItem := KeyListSelectItem; - {$ENDIF} - FInChanging := False; - B := TBitmap.Create; + InChanging := False; + B:= TBitmap.Create; try - B.Width := 16; - B.Height := 16; + B.Width:= 16; + B.Height:= 16; //Loop through and create colored images - for I := 0 to ColorPopup.Items.Count-1 do + for I:= 0 to ColorPopup.Items.Count-1 do begin if ColorPopup.Items[I].Tag = -1 then Continue; - C := GetColor(ColorPopup.Items[I]); - B.Canvas.Brush.Color := C; - B.Canvas.Brush.Style := bsSolid; - B.Canvas.Pen.Style := psSolid; - B.Canvas.Pen.Color := clBlack; + C:= GetColor(ColorPopup.Items[I]); + B.Canvas.Brush.Color:= C; + B.Canvas.Brush.Style:= bsSolid; + B.Canvas.Pen.Style:= psSolid; + B.Canvas.Pen.Color:= clBlack; B.Canvas.Rectangle(0,0,16,16); - ImageList.Add(B, nil); -{$IFDEF SYN_COMPILER_4_UP} - ColorPopup.Items[I].ImageIndex := ColorPopup.Items[I].Tag; -{$ENDIF} + ImageList1.Add(B, nil); + ColorPopup.Items[I].ImageIndex:= ColorPopup.Items[I].Tag; end; finally B.Free; end; - eKeyShort1 := TSynHotKey.Create(Self); + eKeyShort1:= TSynHotKey.Create(Self); with eKeyShort1 do begin Parent := gbKeystrokes; - Left := 120; - Top := 55; - Width := 185; - Height := 21; + Left := Muldiv(120, FCurrentPPI, Screen.DefaultPixelsPerInch); + Top := Muldiv(55, FCurrentPPI, Screen.DefaultPixelsPerInch); + Width := Muldiv(185, FCurrentPPI, Screen.DefaultPixelsPerInch); + Height := Muldiv(21, FCurrentPPI, Screen.DefaultPixelsPerInch); HotKey := 0; InvalidKeys := []; Modifiers := []; TabOrder := 1; end; - eKeyShort2 := TSynHotKey.Create(Self); + eKeyShort2:= TSynHotKey.Create(Self); with eKeyShort2 do begin Parent := gbKeystrokes; - Left := 120; - Top := 87; - Width := 185; - Height := 21; + Left := Muldiv(120, FCurrentPPI, Screen.DefaultPixelsPerInch); + Top := Muldiv(87, FCurrentPPI, Screen.DefaultPixelsPerInch); + Width := Muldiv(185, FCurrentPPI, Screen.DefaultPixelsPerInch); + Height := Muldiv(21, FCurrentPPI, Screen.DefaultPixelsPerInch); HotKey := 0; InvalidKeys := []; Modifiers := []; @@ -703,15 +814,42 @@ procedure TfmEditorOptionsDialog.FormCreate(Sender: TObject); end; end; +procedure TfmEditorOptionsDialog.pGutterColorClick(Sender: TObject); +begin + ColorDialog.Color:= pGutterColor.Color; + if (ColorDialog.Execute) then + begin + pGutterColor.Color:= ColorDialog.Color; + end; +end; + +procedure TfmEditorOptionsDialog.pRightEdgeColorClick(Sender: TObject); +begin + ColorDialog.Color:= pRightEdgeColor.Color; + if (ColorDialog.Execute) then + begin + pRightEdgeColor.Color:= ColorDialog.Color; + end; +end; + procedure TfmEditorOptionsDialog.btnFontClick(Sender: TObject); begin - FontDialog.Font.Assign(lblFont.Font); + labFont.Font.PixelsPerInch := FCurrentPPI; + FontDialog.Font.Assign(labFont.Font); + {$IF CompilerVersion >= 36} + // See https://quality.embarcadero.com/browse/RSP-43261 + FontDialog.Font.IsScreenFont := True; + FontDialog.Font.ScaleForDPI(Screen.PixelsPerInch); + {$IFEND CompilerVersion >= 36} if FontDialog.Execute then begin - lblFont.Font.Assign(FontDialog.Font); - lblFont.Caption := lblFont.Font.Name; - lblFont.Caption := lblFont.Font.Name + ' ' + IntToStr(lblFont.Font.Size) + 'pt'; + labFont.Font.Assign(FontDialog.Font); + labFont.Caption:= labFont.Font.Name; + labFont.Caption:= labFont.Font.Name + ' ' + IntToStr(labFont.Font.Size) + 'pt'; end; + {$IF CompilerVersion < 36} + labFont.Font.PixelsPerInch := Screen.PixelsPerInch; + {$ENDIF} end; procedure TfmEditorOptionsDialog.KeyListSelectItem(Sender: TObject; @@ -722,16 +860,12 @@ procedure TfmEditorOptionsDialog.KeyListSelectItem(Sender: TObject; cKeyCommand.ItemIndex := cKeyCommand.Items.IndexOf(KeyList.Selected.Caption); eKeyShort1.HotKey := TSynEditKeyStroke(KeyList.Selected.Data).ShortCut; eKeyShort2.HotKey := TSynEditKeyStroke(KeyList.Selected.Data).ShortCut2; - FOldSelected := Item; + OldSelected := Item; end; procedure TfmEditorOptionsDialog.btnUpdateKeyClick(Sender: TObject); -var Cmd : Integer; -{ KeyLoc : Integer; - TmpCommand : string; - OldShortcut : TShortcut; - OldShortcut2 : TShortcut; -} +var + Cmd: Integer; begin if (KeyList.Selected = nil) and (Sender <> btnAddKey) then begin @@ -744,23 +878,24 @@ procedure TfmEditorOptionsDialog.btnUpdateKeyClick(Sender: TObject); Cmd := Integer(cKeyCommand.Items.Objects[cKeyCommand.ItemIndex]); - TSynEditKeyStroke(FOldSelected.Data).Command := Cmd; + TSynEditKeyStroke(OldSelected.Data).Command:= Cmd; if eKeyShort1.HotKey <> 0 then - TSynEditKeyStroke(FOldSelected.Data).ShortCut := eKeyShort1.HotKey; + TSynEditKeyStroke(OldSelected.Data).ShortCut := eKeyShort1.HotKey; if eKeyShort2.HotKey <> 0 then - TSynEditKeyStroke(FOldSelected.Data).ShortCut2 := eKeyShort2.HotKey; + TSynEditKeyStroke(OldSelected.Data).ShortCut2:= eKeyShort2.HotKey; - FillInKeystrokeInfo(TSynEditKeyStroke(FOldSelected.Data), KeyList.Selected); + FillInKeystrokeInfo(TSynEditKeyStroke(OldSelected.Data), KeyList.Selected); end; procedure TfmEditorOptionsDialog.btnAddKeyClick(Sender: TObject); -var Item : TListItem; +var Item: TListItem; begin - Item := KeyList.Items.Add; - Item.Data := FSynEdit.Keystrokes.Add; - Item.Selected := True; + if cKeyCommand.ItemIndex < 0 then Exit; + Item:= KeyList.Items.Add; + Item.Data:= FSynEdit.Keystrokes.Add; + Item.Selected:= True; btnUpdateKeyClick(btnAddKey); end; @@ -780,8 +915,9 @@ procedure TfmEditorOptionsDialog.EditStrCallback(const S: string); end; procedure TfmEditorOptionsDialog.FormShow(Sender: TObject); -var Commands: TStringList; - i : Integer; +var + Commands: TStringList; + I: Integer; begin //We need to do this now because it will not have been assigned when //create occurs @@ -797,33 +933,79 @@ procedure TfmEditorOptionsDialog.FormShow(Sender: TObject); Commands := TStringList.Create; try FAllUserCommands(Commands); - for i := 0 to Commands.Count - 1 do - if Commands.Objects[i] <> nil then - cKeyCommand.Items.AddObject(Commands[i], Commands.Objects[i]); + for I := 0 to Commands.Count - 1 do + if Commands.Objects[I] <> nil then + cKeyCommand.Items.AddObject(Commands[I], Commands.Objects[I]); finally Commands.Free; end; end; - PageControl.ActivePage := PageControl.Pages[0]; + PageControl1.ActivePage := PageControl1.Pages[0]; end; procedure TfmEditorOptionsDialog.KeyListEditing(Sender: TObject; Item: TListItem; var AllowEdit: Boolean); begin - AllowEdit := False; + AllowEdit:= False; end; procedure TfmEditorOptionsDialog.btnOkClick(Sender: TObject); begin btnUpdateKey.Click; - ModalResult := mrOk; + ModalResult:= mrOk; +end; + +procedure TfmEditorOptionsDialog.btnGutterFontClick(Sender: TObject); +begin + lblGutterFont.Font.PixelsPerInch := FCurrentPPI; + FontDialog.Font.Assign(lblGutterFont.Font); + {$IF CompilerVersion >= 36} + FontDialog.Font.IsScreenFont := True; + FontDialog.Font.ScaleForDPI(Screen.PixelsPerInch); + {$IFEND CompilerVersion >= 36} + if FontDialog.Execute then + begin + lblGutterFont.Font.Assign(FontDialog.Font); + lblGutterFont.Caption:= lblGutterFont.Font.Name + ' ' + IntToStr(lblGutterFont.Font.Size) + 'pt'; + end; + {$IF CompilerVersion < 36} + lblGutterFont.Font.PixelsPerInch := Screen.PixelsPerInch; + {$ENDIF} +end; + +procedure TfmEditorOptionsDialog.cbGutterFontClick(Sender: TObject); +begin + lblGutterFont.Enabled := cbGutterFont.Checked; + btnGutterFont.Enabled := cbGutterFont.Checked; +end; + +procedure TfmEditorOptionsDialog.btnRightEdgeMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +var P: TPoint; +begin + FPoppedFrom:= cpRightEdge; + P:= pRightEdgeColor.ClientToScreen(Point(-1, pRightEdgeColor.Height-1)); + btnRightEdge.BevelOuter := bvLowered; + ColorPopup.Popup(P.X, P.Y); + btnRightEdge.BevelOuter := bvNone; +end; + +procedure TfmEditorOptionsDialog.btnGutterColorMouseDown(Sender: TObject; + Button: TMouseButton; Shift: TShiftState; X, Y: Integer); +var P: TPoint; +begin + FPoppedFrom:= cpGutter; + P:= pGutterColor.ClientToScreen(Point(-1, pGutterColor.Height-1)); + btnGutterColor.BevelOuter := bvLowered; + ColorPopup.Popup(P.X, P.Y); + btnGutterColor.BevelOuter := bvNone; end; procedure TfmEditorOptionsDialog.FillInKeystrokeInfo( AKey: TSynEditKeystroke; AItem: TListItem); -var TmpString: String; +var TmpString: string; begin with AKey do begin @@ -838,7 +1020,7 @@ procedure TfmEditorOptionsDialog.FillInKeystrokeInfo( else TmpString := EditorCommandToCodeString(Command); end; - AItem.Caption := TmpString; + AItem.Caption:= TmpString; AItem.SubItems.Clear; TmpString := ''; @@ -849,46 +1031,7 @@ procedure TfmEditorOptionsDialog.FillInKeystrokeInfo( TmpString := TmpString + ' ' + ShortCutToText(ShortCut2); AItem.SubItems.Add(TmpString); - end; - -end; - -procedure TfmEditorOptionsDialog.cKeyCommandExit(Sender: TObject); -VAR TmpIndex : Integer; -begin - TmpIndex := cKeyCommand.Items.IndexOf(cKeyCommand.Text); - if TmpIndex = -1 then - begin - if FExtended then - cKeyCommand.ItemIndex := cKeyCommand.Items.IndexOf(ConvertCodeStringToExtended('ecNone')) - else cKeyCommand.ItemIndex := cKeyCommand.Items.IndexOf('ecNone'); - end else cKeyCommand.ItemIndex := TmpIndex; //need to force it incase they just typed something in - -end; - -procedure TfmEditorOptionsDialog.cKeyCommandKeyPress(Sender: TObject; - var Key: Char); -var WorkStr : string; - i : Integer; -begin -//This would be better if componentized, but oh well... - WorkStr := Uppercase(Copy(cKeyCommand.Text, 1, cKeyCommand.SelStart) + Key); - i := 0; - while i < cKeyCommand.Items.Count do - begin - if pos(WorkStr, Uppercase(cKeyCommand.Items[i])) = 1 then - begin - cKeyCommand.Text := cKeyCommand.Items[i]; - cKeyCommand.SelStart := length(WorkStr); - cKeyCommand.SelLength := Length(cKeyCommand.Text) - cKeyCommand.SelStart; - Key := #0; - Break; - end - else - Inc(i); - end; - end; procedure TfmEditorOptionsDialog.cKeyCommandKeyUp(Sender: TObject; @@ -901,11 +1044,11 @@ procedure TfmEditorOptionsDialog.KeyListChanging(Sender: TObject; Item: TListItem; Change: TItemChange; var AllowChange: Boolean); begin //make sure that it's saved. - if FInChanging then Exit; - FInChanging := True; + if InChanging then Exit; + InChanging := True; if Visible then begin - if (Item = FOldSelected) and + if (Item = OldSelected) and ((Item.Caption <> cKeyCommand.Text) or (TSynEditKeystroke(Item.Data).ShortCut <> eKeyShort1.HotKey) or (TSynEditKeystroke(Item.Data).ShortCut2 <> eKeyShort2.HotKey)) then @@ -913,33 +1056,7 @@ procedure TfmEditorOptionsDialog.KeyListChanging(Sender: TObject; btnUpdateKeyClick(btnUpdateKey); end; end; - FInChanging := False; + InChanging := False; end; -{$IFNDEF SYN_COMPILER_4_UP} -procedure TfmEditorOptionsDialog.OverridingWndProc(var Message: TMessage); -var - Item: TListItem; -begin - FOldWndProc(Message); - - if Message.Msg = CN_NOTIFY then - with TWMNotify(Message) do - if NMHdr.code = LVN_ITEMCHANGED then - with PNMListView(NMHdr)^ do - begin - Item := KeyList.Items[iItem]; - if Assigned(FOnSelectItem) and (uChanged = LVIF_STATE) then - begin - if (uOldState and LVIS_SELECTED <> 0) and - (uNewState and LVIS_SELECTED = 0) then - FOnSelectItem(Self, Item, False) - else if (uOldState and LVIS_SELECTED = 0) and - (uNewState and LVIS_SELECTED <> 0) then - FOnSelectItem(Self, Item, True); - end; - end; -end; -{$ENDIF} - end. diff --git a/Source/dlgInputUrl.pas b/Source/dlgInputUrl.pas index 05bfff8..cc2cda8 100644 --- a/Source/dlgInputUrl.pas +++ b/Source/dlgInputUrl.pas @@ -243,9 +243,7 @@ function TInputUrlDialog.DefaultDialogPath: string; function TInputUrlDialog.IsUrl(const AText: string): Boolean; begin - Result := AnsiStartsText('http://', AText) or - AnsiStartsText('https://', AText) or - AnsiStartsText('www.', AText); + Result := PathIsURL(PChar(AText)); end; procedure TInputUrlDialog.acPasteExecute(Sender: TObject); diff --git a/Source/dlgReplaceText.dfm b/Source/dlgReplaceText.dfm index 477b9b3..0d14a19 100644 --- a/Source/dlgReplaceText.dfm +++ b/Source/dlgReplaceText.dfm @@ -1,9 +1,8 @@ inherited TextReplaceDialog: TTextReplaceDialog Caption = 'Replace text' ClientHeight = 206 - OldCreateOrder = True - ExplicitHeight = 235 - PixelsPerInch = 96 + StyleElements = [seFont, seClient, seBorder] + ExplicitHeight = 245 TextHeight = 13 object ReplaceWidthLabel: TLabel [0] Left = 8 @@ -14,19 +13,25 @@ inherited TextReplaceDialog: TTextReplaceDialog AutoSize = False Caption = '&Replace with:' end + inherited SearchForLabel: TLabel + StyleElements = [seFont, seClient, seBorder] + end inherited cbSearchText: TComboBox - TabOrder = 5 + StyleElements = [seFont, seClient, seBorder] end inherited FSearchOptions: TGroupBox Top = 70 + TabOrder = 2 ExplicitTop = 70 end inherited FSearchDirection: TRadioGroup Top = 70 + TabOrder = 3 ExplicitTop = 70 end inherited btnOK: TButton Top = 174 + TabOrder = 4 ExplicitTop = 174 end object cbReplaceText: TComboBox [6] @@ -34,10 +39,11 @@ inherited TextReplaceDialog: TTextReplaceDialog Top = 37 Width = 228 Height = 21 - TabOrder = 0 + TabOrder = 1 end inherited btnCancel: TButton Top = 174 + TabOrder = 5 ExplicitTop = 174 end end