├── .gitignore ├── .gitmodules ├── Config ├── fmx.jar.10.4.2.json ├── fmx.jar.11.3.json ├── fmx.jar.11.3.readme.md └── fmx.jar.12.0.json ├── Docs ├── AndroidTools.md ├── Cleaner.md ├── CodexOptions.md ├── EditorContextMenu.md ├── ProjectManagerContextMenu.md ├── ProjectTools.md ├── Readme.md └── SourcePatch.md ├── LICENSE ├── README.md ├── Screenshots ├── ADBConnect.png ├── ADBConnectRefreshTarget.png ├── AddAndroidPackage.png ├── AddSDKFrameworks.png ├── AssetPacks.png ├── AutoFillMacOSProvisioning.png ├── BuildAssetPacks.png ├── BuildJar.png ├── CodexMenu.png ├── CodexOptionsIDE.png ├── CodexOptionsMosco.png ├── CodexOptionsSourcePatch.png ├── CodexProjectToolbar.png ├── CodexToolbar.png ├── ConnectionProfileManager.png ├── EditorContextMenu.png ├── EditorErrorInsight.png ├── FilesCleaner.png ├── IDETitleShowingConfig.png ├── InsertProjectPaths.png ├── Java2OP.png ├── ManageAssetPack.png ├── MoscoMessages.png ├── PackageDownload.png ├── PackageFolderStructure.png ├── PathSets.png ├── ProjectManagerContextMenu.png ├── SelectProfileMenu.png ├── SelectSDKMenu.png ├── SourcePatchContextMenu.png └── ViewSelector.png └── Source ├── Android ├── Codex.Android.ADBConnectView.dfm ├── Codex.Android.ADBConnectView.pas ├── Codex.Android.AssetPackDetailsView.dfm ├── Codex.Android.AssetPackDetailsView.pas ├── Codex.Android.AssetPackTypes.pas ├── Codex.Android.AssetPacksView.dfm ├── Codex.Android.AssetPacksView.pas ├── Codex.Android.BuildAssetPacksProcess.pas ├── Codex.Android.BuildJarView.dfm ├── Codex.Android.BuildJarView.pas ├── Codex.Android.BuildRJarProcess.pas ├── Codex.Android.CreateJarProcess.pas ├── Codex.Android.GenerateAppProcess.pas ├── Codex.Android.GradleDepsProcess.pas ├── Codex.Android.Java2OPProcess.pas ├── Codex.Android.Java2OPView.dfm ├── Codex.Android.Java2OPView.pas ├── Codex.Android.KeyStoreInfoView.dfm ├── Codex.Android.KeyStoreInfoView.pas ├── Codex.Android.PackageDownloadView.dfm ├── Codex.Android.PackageDownloadView.pas ├── Codex.Android.PackagesView.dfm ├── Codex.Android.PackagesView.pas ├── Codex.Android.ProjectManagerMenu.pas ├── Codex.Android.ResourcesModule.dfm ├── Codex.Android.ResourcesModule.pas ├── Codex.Android.SDKToolsProcess.pas ├── Codex.Android.SDKToolsView.dfm ├── Codex.Android.SDKToolsView.pas ├── Codex.Android.Types.pas └── Codex.Android.Wizard.pas ├── Cleaner ├── Codex.Cleaner.CleanView.dfm ├── Codex.Cleaner.CleanView.pas └── Codex.Cleaner.Wizard.pas ├── Codex.LibSuffix.inc ├── Codex.dpr ├── Codex.dproj ├── Codex.zip ├── Core ├── Codex.AST.pas ├── Codex.AboutView.dfm ├── Codex.AboutView.pas ├── Codex.ActionList.Helper.pas ├── Codex.BaseView.pas ├── Codex.Config.NEON.pas ├── Codex.Config.PreVersion2.pas ├── Codex.Config.pas ├── Codex.Consts.Text.pas ├── Codex.Consts.pas ├── Codex.Core.pas ├── Codex.CustomPathsView.dfm ├── Codex.CustomPathsView.pas ├── Codex.CustomResourcesModule.pas ├── Codex.ErrorInsight.pas ├── Codex.External.DelphiWorlds.pas ├── Codex.External.HGMGetIt.pas ├── Codex.IDEOptionsView.dfm ├── Codex.IDEOptionsView.pas ├── Codex.IPAddressView.dfm ├── Codex.IPAddressView.pas ├── Codex.Interfaces.pas ├── Codex.ModuleNotifier.pas ├── Codex.OTA.Helpers.pas ├── Codex.OutputView.dfm ├── Codex.OutputView.pas ├── Codex.PListMerger.pas ├── Codex.ProgressView.dfm ├── Codex.ProgressView.pas ├── Codex.ProjectFiles.pas ├── Codex.ProjectFilesView.dfm ├── Codex.ProjectFilesView.pas ├── Codex.ProjectNotifier.pas ├── Codex.ResourcesModule.dfm ├── Codex.ResourcesModule.pas ├── Codex.SDKRegistry.pas ├── Codex.Types.pas └── Codex.Wizard.pas ├── Helpers ├── DW.Environment.RADStudio.pas ├── DW.Vcl.ExtendedLabel.pas ├── DW.Vcl.ExtendedListBox.pas └── DW.Vcl.Splitter.Themed.pas ├── Icon.bmp ├── Icon.ico ├── Icon.rc ├── Lang.rc ├── Modules ├── Codex.Modules.DuplicateModuleView.dfm ├── Codex.Modules.DuplicateModuleView.pas ├── Codex.Modules.Types.pas └── Codex.Modules.Wizard.pas ├── Mosco ├── Codex.Mosco.AddSDKFrameworkView.dfm ├── Codex.Mosco.AddSDKFrameworkView.pas ├── Codex.Mosco.Consts.pas ├── Codex.Mosco.Helpers.pas ├── Codex.Mosco.ImportXcodeFilesView.dfm ├── Codex.Mosco.ImportXcodeFilesView.pas ├── Codex.Mosco.OptionsView.dfm ├── Codex.Mosco.OptionsView.pas ├── Codex.Mosco.ProjectManagerMenu.pas └── Codex.Mosco.Wizard.pas ├── Options ├── Codex.Options.pas ├── Codex.OptionsView.dfm └── Codex.OptionsView.pas ├── Project ├── Codex.Project.AddFoldersView.dfm ├── Codex.Project.AddFoldersView.pas ├── Codex.Project.CommonPathsView.dfm ├── Codex.Project.CommonPathsView.pas ├── Codex.Project.DeployExtensionsView.dfm ├── Codex.Project.DeployExtensionsView.pas ├── Codex.Project.DeployFolderView.dfm ├── Codex.Project.DeployFolderView.pas ├── Codex.Project.EffectivePathsView.dfm ├── Codex.Project.EffectivePathsView.pas ├── Codex.Project.ProjectManagerMenu.pas ├── Codex.Project.ProjectPathsView.dfm ├── Codex.Project.ProjectPathsView.pas ├── Codex.Project.ProjectToolsView.dfm ├── Codex.Project.ProjectToolsView.pas ├── Codex.Project.ResourcesModule.dfm ├── Codex.Project.ResourcesModule.pas └── Codex.Project.Wizard.pas ├── SourcePatch ├── Codex.SourcePatch.FunctionsModule.dfm ├── Codex.SourcePatch.FunctionsModule.pas ├── Codex.SourcePatch.OptionsView.dfm ├── Codex.SourcePatch.OptionsView.pas ├── Codex.SourcePatch.PatchProcess.pas ├── Codex.SourcePatch.ResourcesModule.dfm ├── Codex.SourcePatch.ResourcesModule.pas └── Codex.SourcePatch.Wizard.pas ├── VersionInfo.rc ├── Visualizers ├── Codex.Visualizer.MultiLineString.pas ├── Codex.Visualizer.MultiLineStringFrame.dfm └── Codex.Visualizer.MultiLineStringFrame.pas ├── Wizards ├── Codex.EditorContext.Wizard.pas ├── Codex.EditorContextD11.Wizard.pas ├── Codex.FileMenu.Wizard.pas ├── Codex.IDEActions.Wizard.pas ├── Codex.IDETweaks.Wizard.pas └── Codex.PostDeployment.Wizard.pas └── lang.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Uncomment these types if you want even more clean repository. But be careful. 2 | # It can make harm to an existing project source. Read explanations below. 3 | # 4 | # Resource files are binaries containing manifest, project icon and version info. 5 | # They can not be viewed as text or compared by diff-tools. Consider replacing them with .rc files. 6 | #*.res 7 | # 8 | # Type library file (binary). In old Delphi versions it should be stored. 9 | # Since Delphi 2009 it is produced from .ridl file and can safely be ignored. 10 | #*.tlb 11 | # 12 | # Diagram Portfolio file. Used by the diagram editor up to Delphi 7. 13 | # Uncomment this if you are not using diagrams or use newer Delphi version. 14 | #*.ddp 15 | # 16 | # Visual LiveBindings file. Added in Delphi XE2. 17 | # Uncomment this if you are not using LiveBindings Designer. 18 | #*.vlb 19 | # 20 | # Deployment Manager configuration file for your project. Added in Delphi XE2. 21 | # Uncomment this if it is not mobile development and you do not use remote debug feature. 22 | #*.deployproj 23 | # 24 | # C++ object files produced when C/C++ Output file generation is configured. 25 | # Uncomment this if you are not using external objects (zlib library for example). 26 | #*.obj 27 | # 28 | 29 | # Delphi compiler-generated binaries (safe to delete) 30 | *.exe 31 | *.dll 32 | *.bpl 33 | *.bpi 34 | *.dcp 35 | *.so 36 | *.apk 37 | *.drc 38 | *.map 39 | *.dres 40 | *.rsm 41 | *.tds 42 | *.dcu 43 | *.lib 44 | *.a 45 | *.o 46 | *.ocx 47 | 48 | # Delphi autogenerated files (duplicated info) 49 | *.cfg 50 | *.hpp 51 | *Resource.rc 52 | 53 | # Delphi local files (user-specific info) 54 | *.local 55 | *.identcache 56 | *.projdata 57 | *.tvsconfig 58 | *.dsk 59 | 60 | # Delphi history and backups 61 | __history/ 62 | __recovery/ 63 | *.~* 64 | 65 | # Castalia statistics file (since XE7 Castalia is distributed with Delphi) 66 | *.stat 67 | 68 | LaunchScreen.TemplateiOS 69 | .DS_Store 70 | *.deployproj 71 | *.res 72 | *.template.java 73 | *.class 74 | *.h 75 | Info.plist 76 | AndroidManifest.template.xml 77 | Entitlement.TemplateOSX.xml 78 | Entitlement.TemplateiOS.xml 79 | info.plist.TemplateOSX.xml 80 | info.plist.TemplateIOS.xml 81 | **/Android/Debug 82 | **/Android/Release 83 | **/Android64/Debug 84 | **/Android64/Release 85 | **/iOSDevice64/Debug/ 86 | **/iOSDevice64/Release/ 87 | **/OSX64/Debug/ 88 | **/OSX64/Release/ 89 | **/Win32/Debug/ 90 | **/Win32/Release/ 91 | **/Win64/Debug/ 92 | **/Win64/Release/ 93 | 94 | Bin 95 | Unused 96 | Internal 97 | Thumbs.db 98 | Setup 99 | Research 100 | Source/External 101 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "Deps/TOTAL"] 2 | path = Deps/TOTAL 3 | url = https://github.com/DelphiWorlds/TOTAL.git 4 | [submodule "Deps/Kastri"] 5 | path = Deps/Kastri 6 | url = https://github.com/DelphiWorlds/Kastri.git 7 | [submodule "Deps/Babel"] 8 | path = Deps/Babel 9 | url = https://github.com/DelphiWorlds/Babel.git 10 | [submodule "Deps/Mosco"] 11 | path = Deps/Mosco 12 | url = https://github.com/DelphiWorlds/Mosco.git 13 | [submodule "Deps/delphi-neon"] 14 | path = Deps/delphi-neon 15 | url = https://github.com/paolo-rossi/delphi-neon.git 16 | [submodule "Deps/DelphiAST"] 17 | path = Deps/DelphiAST 18 | url = https://github.com/RomanYankovsky/DelphiAST.git 19 | -------------------------------------------------------------------------------- /Config/fmx.jar.10.4.2.json: -------------------------------------------------------------------------------- 1 | { 2 | "includedJars":[ 3 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\android-support-v4.jar", 4 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\cloud-messaging.jar", 5 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-ads-base.17.2.0.jar", 6 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-ads-identifier.16.0.0.jar", 7 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-ads-lite.17.2.0.jar", 8 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-ads.17.2.0.jar", 9 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-analytics-impl.16.0.8.jar", 10 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-analytics.16.0.8.jar", 11 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-base.16.0.1.jar", 12 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-basement.16.2.0.jar", 13 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-gass.17.2.0.jar", 14 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-identity.16.0.0.jar", 15 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-maps.16.1.0.jar", 16 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-measurement-base.16.4.0.jar", 17 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-measurement-sdk-api.16.4.0.jar", 18 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-stats.16.0.1.jar", 19 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-tagmanager-v4-impl.16.0.8.jar", 20 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-tasks.16.0.1.jar", 21 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-android-gms.play-services-wallet.16.0.1.jar", 22 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-firebase.firebase-analytics.16.4.0.jar", 23 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-firebase.firebase-common.16.1.0.jar", 24 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-firebase.firebase-iid-interop.16.0.1.jar", 25 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-firebase.firebase-iid.17.1.1.jar", 26 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-firebase.firebase-measurement-connector.17.0.1.jar", 27 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\com-google-firebase.firebase-messaging.17.5.0.jar", 28 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\google-play-billing.jar", 29 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\lib\\android\\debug\\google-play-licensing.jar" 30 | ], 31 | "javaFiles":[ 32 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\source\\rtl\\androiddex\\java\\fmx\\src\\com\\*.java", 33 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\source\\rtl\\androiddex\\java\\fmx\\src\\android\\bluetooth\\*.java", 34 | "C:\\Program Files (x86)\\Embarcadero\\Studio\\21.0\\source\\rtl\\androiddex\\java\\fmx\\src\\android\\telephony\\*.java" 35 | ], 36 | "outputFile":"", 37 | "sourceVersion":"1.7", 38 | "targetVersion":"1.7" 39 | } -------------------------------------------------------------------------------- /Config/fmx.jar.11.3.json: -------------------------------------------------------------------------------- 1 | { 2 | "includedJars":[ 3 | "$(BDS)\\lib\\android\\debug\\activity-1.1.0.jar", 4 | "$(BDS)\\lib\\android\\debug\\annotation-1.2.0.jar", 5 | "$(BDS)\\lib\\android\\debug\\appcompat-1.2.0.jar", 6 | "$(BDS)\\lib\\android\\debug\\appcompat-resources-1.2.0.jar", 7 | "$(BDS)\\lib\\android\\debug\\asynclayoutinflater-1.0.0.jar", 8 | "$(BDS)\\lib\\android\\debug\\billing-4.0.0.jar", 9 | "$(BDS)\\lib\\android\\debug\\biometric-1.1.0.jar", 10 | "$(BDS)\\lib\\android\\debug\\browser-1.0.0.jar", 11 | "$(BDS)\\lib\\android\\debug\\cloud-messaging.jar", 12 | "$(BDS)\\lib\\android\\debug\\collection-1.1.0.jar", 13 | "$(BDS)\\lib\\android\\debug\\coordinatorlayout-1.0.0.jar", 14 | "$(BDS)\\lib\\android\\debug\\core-1.5.0-rc02.jar", 15 | "$(BDS)\\lib\\android\\debug\\core-common-2.1.0.jar", 16 | "$(BDS)\\lib\\android\\debug\\core-runtime-2.1.0.jar", 17 | "$(BDS)\\lib\\android\\debug\\cursoradapter-1.0.0.jar", 18 | "$(BDS)\\lib\\android\\debug\\customview-1.0.0.jar", 19 | "$(BDS)\\lib\\android\\debug\\documentfile-1.0.0.jar", 20 | "$(BDS)\\lib\\android\\debug\\drawerlayout-1.0.0.jar", 21 | "$(BDS)\\lib\\android\\debug\\firebase-annotations-16.0.0.jar", 22 | "$(BDS)\\lib\\android\\debug\\firebase-common-20.0.0.jar", 23 | "$(BDS)\\lib\\android\\debug\\firebase-components-17.0.0.jar", 24 | "$(BDS)\\lib\\android\\debug\\firebase-datatransport-18.0.0.jar", 25 | "$(BDS)\\lib\\android\\debug\\firebase-encoders-17.0.0.jar", 26 | "$(BDS)\\lib\\android\\debug\\firebase-encoders-json-18.0.0.jar", 27 | "$(BDS)\\lib\\android\\debug\\firebase-iid-interop-17.1.0.jar", 28 | "$(BDS)\\lib\\android\\debug\\firebase-installations-17.0.0.jar", 29 | "$(BDS)\\lib\\android\\debug\\firebase-installations-interop-17.0.0.jar", 30 | "$(BDS)\\lib\\android\\debug\\firebase-measurement-connector-19.0.0.jar", 31 | "$(BDS)\\lib\\android\\debug\\firebase-messaging-22.0.0.jar", 32 | "$(BDS)\\lib\\android\\debug\\fragment-1.2.5.jar", 33 | "$(BDS)\\lib\\android\\debug\\google-play-licensing.jar", 34 | "$(BDS)\\lib\\android\\debug\\interpolator-1.0.0.jar", 35 | "$(BDS)\\lib\\android\\debug\\javax.inject-1.jar", 36 | "$(BDS)\\lib\\android\\debug\\legacy-support-core-ui-1.0.0.jar", 37 | "$(BDS)\\lib\\android\\debug\\legacy-support-core-utils-1.0.0.jar", 38 | "$(BDS)\\lib\\android\\debug\\lifecycle-common-2.2.0.jar", 39 | "$(BDS)\\lib\\android\\debug\\lifecycle-livedata-2.0.0.jar", 40 | "$(BDS)\\lib\\android\\debug\\lifecycle-livedata-core-2.2.0.jar", 41 | "$(BDS)\\lib\\android\\debug\\lifecycle-runtime-2.2.0.jar", 42 | "$(BDS)\\lib\\android\\debug\\lifecycle-service-2.0.0.jar", 43 | "$(BDS)\\lib\\android\\debug\\lifecycle-viewmodel-2.2.0.jar", 44 | "$(BDS)\\lib\\android\\debug\\lifecycle-viewmodel-savedstate-2.2.0.jar", 45 | "$(BDS)\\lib\\android\\debug\\listenablefuture-1.0.jar", 46 | "$(BDS)\\lib\\android\\debug\\loader-1.0.0.jar", 47 | "$(BDS)\\lib\\android\\debug\\localbroadcastmanager-1.0.0.jar", 48 | "$(BDS)\\lib\\android\\debug\\play-services-ads-20.1.0.jar", 49 | "$(BDS)\\lib\\android\\debug\\play-services-ads-base-20.1.0.jar", 50 | "$(BDS)\\lib\\android\\debug\\play-services-ads-identifier-17.0.0.jar", 51 | "$(BDS)\\lib\\android\\debug\\play-services-ads-lite-20.1.0.jar", 52 | "$(BDS)\\lib\\android\\debug\\play-services-base-17.5.0.jar", 53 | "$(BDS)\\lib\\android\\debug\\play-services-basement-17.6.0.jar", 54 | "$(BDS)\\lib\\android\\debug\\play-services-cloud-messaging-16.0.0.jar", 55 | "$(BDS)\\lib\\android\\debug\\play-services-drive-17.0.0.jar", 56 | "$(BDS)\\lib\\android\\debug\\play-services-games-21.0.0.jar", 57 | "$(BDS)\\lib\\android\\debug\\play-services-location-18.0.0.jar", 58 | "$(BDS)\\lib\\android\\debug\\play-services-maps-17.0.1.jar", 59 | "$(BDS)\\lib\\android\\debug\\play-services-measurement-base-18.0.0.jar", 60 | "$(BDS)\\lib\\android\\debug\\play-services-measurement-sdk-api-18.0.0.jar", 61 | "$(BDS)\\lib\\android\\debug\\play-services-places-placereport-17.0.0.jar", 62 | "$(BDS)\\lib\\android\\debug\\play-services-stats-17.0.0.jar", 63 | "$(BDS)\\lib\\android\\debug\\play-services-tasks-17.2.0.jar", 64 | "$(BDS)\\lib\\android\\debug\\print-1.0.0.jar", 65 | "$(BDS)\\lib\\android\\debug\\room-common-2.1.0.jar", 66 | "$(BDS)\\lib\\android\\debug\\room-runtime-2.1.0.jar", 67 | "$(BDS)\\lib\\android\\debug\\savedstate-1.0.0.jar", 68 | "$(BDS)\\lib\\android\\debug\\slidingpanelayout-1.0.0.jar", 69 | "$(BDS)\\lib\\android\\debug\\sqlite-2.0.1.jar", 70 | "$(BDS)\\lib\\android\\debug\\sqlite-framework-2.0.1.jar", 71 | "$(BDS)\\lib\\android\\debug\\swiperefreshlayout-1.0.0.jar", 72 | "$(BDS)\\lib\\android\\debug\\transport-api-3.0.0.jar", 73 | "$(BDS)\\lib\\android\\debug\\transport-backend-cct-3.0.0.jar", 74 | "$(BDS)\\lib\\android\\debug\\transport-runtime-3.0.0.jar", 75 | "$(BDS)\\lib\\android\\debug\\user-messaging-platform-1.0.0.jar", 76 | "$(BDS)\\lib\\android\\debug\\vectordrawable-1.1.0.jar", 77 | "$(BDS)\\lib\\android\\debug\\vectordrawable-animated-1.1.0.jar", 78 | "$(BDS)\\lib\\android\\debug\\versionedparcelable-1.1.1.jar", 79 | "$(BDS)\\lib\\android\\debug\\viewpager-1.0.0.jar", 80 | "$(BDS)\\lib\\android\\debug\\work-runtime-2.1.0.jar" 81 | ], 82 | "javaFiles":[ 83 | "$(BDS)\\source\\rtl\\androiddex\\java\\fmx\\src\\com\\*.java" 84 | ], 85 | "outputFile":"", 86 | "sourceVersion":"1.10", 87 | "targetVersion":"1.10" 88 | } -------------------------------------------------------------------------------- /Config/fmx.jar.11.3.readme.md: -------------------------------------------------------------------------------- 1 | # Important notes about rebuilding fmx.jar for Delphi 11.3 2 | 3 | ## Missing java files 4 | 5 | There are 3 java source files missing from the 11.3 distribution: 6 | 7 | ``` 8 | source\rtl\androiddex\java\fmx\src\com\embarcadero\rtl\NativeDispatchException.java 9 | source\rtl\androiddex\java\fmx\src\com\embarcadero\rtl\NativeDispatchHelper.java 10 | source\rtl\androiddex\java\fmx\src\com\embarcadero\rtl\notifications\PendingIntentCompat.java 11 | ``` 12 | 13 | You will need to obtain these files from EMBT in order to rebuild `fmx.jar`. Alternatively, the first two files are included with Delphi 11.2, and the last file (or even all three) could be obtained by using a jar decompiler such as [JD-GUI](https://java-decompiler.github.io/). 14 | 15 | ## Rebuild 16 | 17 | Once the above files have been added, `fmx.jar` can be rebuilt with Codex, using the Build Jar tool, after loading the `fmx.jar.11.3.json` config file and specifying an output file. 18 | 19 | -------------------------------------------------------------------------------- /Docs/Cleaner.md: -------------------------------------------------------------------------------- 1 | # Cleaner 2 | 3 | Removes auto-generated files from folders, thus saving disk space and allowing you to zip folders without too much "baggage" 4 | 5 | FilesCleaner 6 | -------------------------------------------------------------------------------- /Docs/CodexOptions.md: -------------------------------------------------------------------------------- 1 | # Codex Options 2 | 3 | Codex options can be accessed via the IDE menu, in: Tools | Codex > Options 4 | 5 | ## Delphi IDE enhancements 6 | 7 | These enhancements can be enabled/disabled in the Options, unless specified otherwise: 8 | 9 | Codex Options IDE 10 | 11 | ### Load last opened project 12 | 13 | When Delphi starts, the last project/group that was loaded should load. 14 | 15 | ### Show Project Manager when opening a project or group 16 | 17 | As per the title, the Project Manager is shown (if not already) when a project or group is opened 18 | 19 | ### Display warning for App Store build type when using Run With Debugging 20 | 21 | Sometimes you may build for App Store, then forget what it was set to when you next attempt to debug. This feature warns you before compiling starts, because the debugger will not start when the project is set to this build type. 22 | 23 | ### Show Platform > Config > Build type caption in title bar 24 | 25 | When the tree in the Project Manager is collapsed, or it is simply out of view, this feature allows you to see at a glance what the current selection is. The caption appears in the title bar, like this: 26 | 27 | IDE Title showing config 28 | 29 | ### Hide View Selector 30 | 31 | The View Selector is the combination of two combo boxes in the top right of the edit window when an FMX form is showing. If you never use the selector, this option can reclaim some space in the edit window. 32 | 33 | ### Enable Read Only editor popop menu item 34 | 35 | In Delphi 10.4, a change was made to the IDE to disable the read-only menu option in the editor popup, when the source file is marked as read-only. This prevents the developer from "trying out" changes directly in the IDE without having to unset the read-only flag on the physical file. This option re-enables the item. 36 | 37 | ### Suppress project build events warning 38 | 39 | This option prevents the IDE from warning about build events being present in a project when it is loaded 40 | 41 | ### Show Error Insight messages in the editor 42 | 43 | Codex can display hints/warnings/errors right in the IDE, if the Structure window has been shown for the active unit: 44 | 45 | Editor Error Insight 46 | 47 | ### Kill the project process if it is running 48 | 49 | If a process with the same path/name is already running, Codex will kill the task. If run without debugging is used, then later if using run with debugging, the process from earlier may still be running 50 | 51 | ## Mosco 52 | 53 | These are the options for Codex integration with [Mosco](https://github.com/DelphiWorlds/Mosco) (a macOS app that can aid macOS/iOS developers): 54 | 55 | Codex Options Mosco 56 | 57 | Any messages generated by the Mosco integration will appear in the **Mosco tab of the Messages window in the Delphi IDE**. 58 | 59 | ### Mosco Server 60 | 61 | Set the value for Host to the hostname or IP address of where Mosco is running, and the Port value for the Port. In Mosco itself, you can check which IP addresses and Port it is listening on, in its Messages window: 62 | 63 | Mosco Messages 64 | 65 | ### Errors 66 | 67 | These checkboxes determine whether relevant error messages are shown. 68 | 69 | ### Apple certificate expiry warning 70 | 71 | Codex can use Mosco to check whether the Mac that Mosco is running on, whether it has any certificates that are about to expire. 72 | 73 | ### Auto check valid provisioning profile exists 74 | 75 | When a project has an active target of iOS or macOS, Codex checks whether or not a valid provisioning profile exists. 76 | 77 | ### Auto fill macOS certificate info 78 | 79 | When a project has an active target of macOS, it can auto-fill the certificate info with the relevant data, if it is not already filled in: 80 | 81 | Autofill MacOS Provisioning 82 | 83 | ## Source Patch 84 | 85 | These options apply to the [Editor Context menu](EditorContextMenu.md): 86 | 87 | Codex Options Source Patch 88 | 89 | ### Always prompt for folder to copy source to 90 | 91 | When checked, Codex will always prompt for the folder to copy Delphi source files to. This is used in combination with the Default folder to copy source to edit. 92 | 93 | ### Open source files once copied 94 | 95 | Checking this option results in the copied Delphi source file being opened in the editor if it is not already opened 96 | 97 | ### Folder to copy source to is relative to active project 98 | 99 | Used in combination with the Default folder to copy source to edit. This will result in the source being copied to a folder that is relative to the path for the source of the active project 100 | 101 | ### Default folder to copy source to 102 | 103 | This indicates which folder to copy the Delphi source file to. When Always prompt.. is checked, the save dialog will start in this folder 104 | 105 | ### Default location for patch files 106 | 107 | When using the `Create patch file` or `Apply patch file` items in the Editor Context menu, this is the folder that Codex will default to when using these commands -------------------------------------------------------------------------------- /Docs/EditorContextMenu.md: -------------------------------------------------------------------------------- 1 | # Editor Context Menu 2 | 3 | Codex adds a number of menu items to the Editor Context menu in the IDE: 4 | 5 | Editor Context Menu 6 | 7 | ## Add To Project 8 | 9 | This allows you to add the opened source file to the project if it has not already been added. 10 | 11 | ## Copy source file 12 | 13 | If the file is located in the Delphi source folders (it is otherwise disabled), this file is copied to the folder nominated in the Codex Options (`Default folder to copy source to`), or will prompt for the folder if the default folder does not exist, or the `Always prompt for folder to copy source to` option is checked 14 | 15 | ## Copy file to project folder 16 | 17 | If the file is located in the Delphi source folders (it is otherwise disabled), the file is copied to the root folder of the currently active project 18 | 19 | ## Create patch file 20 | 21 | Creates a diff between the file and a matching source file. If a matching source file cannot be found, it will prompt for the location. Once a match is found, it will prompt for a patch file name (defaulting to the format described above), using the default folder selected in the Codex Options (`Default location for patch files`) if available 22 | 23 | ## Apply patch 24 | 25 | Prompts for a patch file using the default folder selected in the Codex Options (`Default location for patch files`) if available, and applies it to the file in the editor 26 | 27 | **Note: The last 2 items require [Git](https://git-scm.com/) to be installed on the machine before the items will enable** 28 | 29 | -------------------------------------------------------------------------------- /Docs/ProjectManagerContextMenu.md: -------------------------------------------------------------------------------- 1 | # Project Manager Context Menu 2 | 3 | Codex adds several items to the context menu of Project Manager, which appears when you right-click the root node of your project in Project Manager: 4 | 5 | Project Manager Context Menu 6 | 7 | ## Add Android Package 8 | 9 | Adds a Android packages that were downloaded using the [Package Download](AndroidTools.md#package-download) function in the Android Tools menu. This item will enable if the active project has an Android target platform included. Note that **you must deploy the application at least once** to be able to use this function. 10 | 11 | Once the Android Packages form shows, click `Add..` and select the folder that is the root of a package that was downloaded using Package Download, e.g.: 12 | 13 | Add Android Package 14 | 15 | Then click `Execute` to add the package(s) to your project. The output window will show the progress of the required tasks, and any error messages it encounters. The process: 16 | 17 | * Merges Android resources of your project with the resources of the package(s) being added 18 | * Extracts manifest entries from the package(s) that are required to be added to the manifest of your project, and creates "merge" manifests that are named the same as the root of the package folder, with `-Manifest.merge.xml` appended, e.g.: `crashlytics-ndk-17.4.1-Manifest.merge.xml`. See [below regarding merging](#merging-manifest-files) of this file. 19 | * Creates Java sources for any required R classes, and compiles these classes into a library named the same as your project, with `.R.jar` appended, and adds this jar file to your project 20 | 21 | ### Merging manifest files 22 | 23 | In order for "merge" files to be merged into the manifest for your project, either: 24 | 25 | Use the `manifestmerge` tool from [Kastri](https://github.com/DelphiWorlds/Kastri/tree/master/Tools) in a build event in your projects Project Options, e.g.: 26 | 27 | ``` 28 | $(Kastri)\Tools\manifestmerge . $(Platform)\$(Config)\AndroidManifest.xml 29 | ``` 30 | (This will merge any files ending in `Manifest.merge.xml` in the project folder with the resulting `AndroidManifest.xml` i.e. it will *not* alter `AndroidManifest.template.xml`) 31 | 32 | OR 33 | 34 | Examine the "merge" file and manually edit `AndroidManifest.template.xml` in your project 35 | 36 | ## Build Asset Packs 37 | 38 | Documentation to be added later. 39 | 40 | ## Mosco Options 41 | 42 | Shows the options for Mosco integration, as per the [Codex Options](CodexOptions.md#mosco) menu item. 43 | 44 | ## Add SDK Frameworks 45 | 46 | Communicates with the Mosco macOS app to determine which frameworks are available for the relevant SDK, and presents a dialog: 47 | 48 | Add SDK Frameworks 49 | 50 | Select the SDK on the Mac you wish to add frameworks from, then select the frameworks you wish to add the matching SDK used by Delphi, and the Delphi SDK Manager will be shown with the frameworks added. Click `Update Local File Cache`, then click `Save` to complete the frameworks addition. 51 | 52 | ## Select Profile 53 | 54 | When you have more than one profile configured in the Connection Profile Manager in the Delphi IDE options: 55 | 56 | Connection Profile Manager 57 | 58 | The Select Profile item will have an entry for each profile, allowing you to easily select a different profile: 59 | 60 | Select Profile Menu 61 | 62 | ## Select SDK 63 | 64 | When you have more than one SDK imported for iOS or macOS, this item will have an entry for each SDK, allowing you to easily select a different SDK: 65 | 66 | Select SDK Menu 67 | 68 | In this example, there are 2 macOS SDKs imported, and MacOSX 11.3 is selected as the active SDK. 69 | 70 | ## Show Deployed App 71 | 72 | For iOS and macOS apps that have been deployed, this function will show the location of the app in Finder on your Mac. For Windows apps, the location will be shown in Explorer. -------------------------------------------------------------------------------- /Docs/ProjectTools.md: -------------------------------------------------------------------------------- 1 | # Project Tools 2 | 3 | ## Find Unit 4 | 5 | Searches the current effective paths for units matching the name in the edit. Useful for tracking down duplicate units in the path. 6 | 7 | ## Show Effective Paths 8 | 9 | Shows the paths that the compiler will use for the platform and configuration for the active project. 10 | 11 | ## Show Tools 12 | 13 | Shows the Codex Project Tools window. This is a view of the window when docked in the IDE. 14 | 15 | Codex Toolbar 16 | 17 | If the Codex Project Tools window is undocked, the Show Tools menu item will bring it to the front 18 | 19 | The items in the toolbar apply to the active project, and from left to right are: 20 | 21 | * Compile 22 | * Build 23 | * Clean 24 | * Total Clean - deletes all output folders for all platforms for the active project. **Use this item with caution** 25 | * Project Options - shows the Project Options window 26 | * Insert paths into Project Options - [see below](#insert-paths-into-project-options-item) 27 | * View project source - opens the project source in the editor (same as View Source in the Project Manager context menu) 28 | * Show Deployment Manager - shows the Deployment Manager window 29 | * Deploy - performs the same function as Project | Deploy from the IDE menu 30 | 31 | ### Insert paths into Project Options item 32 | 33 | A convenient way of adding search paths into your project. Clicking this item brings up this window, e.g.: 34 | 35 | Insert Project Paths 36 | 37 | The Current Effective Paths list shows which paths will apply to the project for the current platform and configuration. These include search paths from the IDE options, and the current search paths for the project. 38 | 39 | When Codex is first installed, the Paths To Insert listbox will be empty. Type a path into the edit box below it, and click `Add` to add an item to the list. Check the checkbox next to an item to include it as a path to be inserted into the search path in the Project Options. 40 | 41 | **NOTE:** This function adds search paths to the **base** configuration for the project, i.e. for **all** platforms / **all** configurations. Later versions of Codex may have the option to select different platforms / configurations. 42 | 43 | -------------------------------------------------------------------------------- /Docs/SourcePatch.md: -------------------------------------------------------------------------------- 1 | # Source Patch 2 | 3 | These menu items perform functions related to creating/applying patches for Delphi source. A repo called [Delphi Patches](https://github.com/DelphiWorlds/DelphiPatches) has been started for patch files intended for use with this function. 4 | 5 | ## Copy source files 6 | 7 | Presents an open file dialog that starts at the Delphi source folder. Select one or more files and they will be copied to the folder nominated in the Codex Options (`Default folder to copy source to`), or it will prompt for which folder to copy to if the folder does not exist, or the `Always prompt for folder to copy source to` option is checked. Once source files are copied, they will be opened in the code editor if the `Open source files once copied` option is checked. 8 | 9 | ## Create patch file 10 | 11 | Presents an open file dialog to select which source file copy is to be diffed with existing source. The default folder for source copies can be set in the Codex Options. 12 | 13 | If the original source file cannot be found, it will prompt for selecting the file. 14 | 15 | Lastly, it will prompt for a filename to save the patch file as. The default name for the patch file will be in the format: `[originalname].[version].patch` where `[originalname]` is the original source file name (minus the `.pas` extension), and `[version]` is the version of Delphi being used. 16 | 17 | The default folder for where patch files will be prompted for can also be set in the Codex Options (`Default location for patch files`) 18 | 19 | ## Apply patch 20 | 21 | Presents an open file dialog to select which patch file to apply to a copy of the source. It will then either prompt for the copy of the source, or automatically apply it to an existing source file if it can be found in the default source file copies folder specified in the Codex Options (`Default folder to copy source to`) 22 | 23 | **Note: The last 2 items require [Git](https://git-scm.com/) to be installed on the machine before the items will enable** 24 | 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2020-2023 Dave Nottage 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Screenshots/ADBConnect.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/ADBConnect.png -------------------------------------------------------------------------------- /Screenshots/ADBConnectRefreshTarget.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/ADBConnectRefreshTarget.png -------------------------------------------------------------------------------- /Screenshots/AddAndroidPackage.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/AddAndroidPackage.png -------------------------------------------------------------------------------- /Screenshots/AddSDKFrameworks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/AddSDKFrameworks.png -------------------------------------------------------------------------------- /Screenshots/AssetPacks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/AssetPacks.png -------------------------------------------------------------------------------- /Screenshots/AutoFillMacOSProvisioning.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/AutoFillMacOSProvisioning.png -------------------------------------------------------------------------------- /Screenshots/BuildAssetPacks.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/BuildAssetPacks.png -------------------------------------------------------------------------------- /Screenshots/BuildJar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/BuildJar.png -------------------------------------------------------------------------------- /Screenshots/CodexMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/CodexMenu.png -------------------------------------------------------------------------------- /Screenshots/CodexOptionsIDE.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/CodexOptionsIDE.png -------------------------------------------------------------------------------- /Screenshots/CodexOptionsMosco.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/CodexOptionsMosco.png -------------------------------------------------------------------------------- /Screenshots/CodexOptionsSourcePatch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/CodexOptionsSourcePatch.png -------------------------------------------------------------------------------- /Screenshots/CodexProjectToolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/CodexProjectToolbar.png -------------------------------------------------------------------------------- /Screenshots/CodexToolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/CodexToolbar.png -------------------------------------------------------------------------------- /Screenshots/ConnectionProfileManager.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/ConnectionProfileManager.png -------------------------------------------------------------------------------- /Screenshots/EditorContextMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/EditorContextMenu.png -------------------------------------------------------------------------------- /Screenshots/EditorErrorInsight.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/EditorErrorInsight.png -------------------------------------------------------------------------------- /Screenshots/FilesCleaner.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/FilesCleaner.png -------------------------------------------------------------------------------- /Screenshots/IDETitleShowingConfig.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/IDETitleShowingConfig.png -------------------------------------------------------------------------------- /Screenshots/InsertProjectPaths.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/InsertProjectPaths.png -------------------------------------------------------------------------------- /Screenshots/Java2OP.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/Java2OP.png -------------------------------------------------------------------------------- /Screenshots/ManageAssetPack.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/ManageAssetPack.png -------------------------------------------------------------------------------- /Screenshots/MoscoMessages.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/MoscoMessages.png -------------------------------------------------------------------------------- /Screenshots/PackageDownload.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/PackageDownload.png -------------------------------------------------------------------------------- /Screenshots/PackageFolderStructure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/PackageFolderStructure.png -------------------------------------------------------------------------------- /Screenshots/PathSets.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/PathSets.png -------------------------------------------------------------------------------- /Screenshots/ProjectManagerContextMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/ProjectManagerContextMenu.png -------------------------------------------------------------------------------- /Screenshots/SelectProfileMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/SelectProfileMenu.png -------------------------------------------------------------------------------- /Screenshots/SelectSDKMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/SelectSDKMenu.png -------------------------------------------------------------------------------- /Screenshots/SourcePatchContextMenu.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/SourcePatchContextMenu.png -------------------------------------------------------------------------------- /Screenshots/ViewSelector.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Screenshots/ViewSelector.png -------------------------------------------------------------------------------- /Source/Android/Codex.Android.AssetPackDetailsView.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Android.AssetPackDetailsView; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 18 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, System.Actions, Vcl.ActnList, 19 | Codex.BaseView, Codex.Android.AssetPackTypes; 20 | 21 | type 22 | TAssetPackDetailsView = class(TForm) 23 | AssetPackDetailsPanel: TPanel; 24 | PackFolderLabel: TLabel; 25 | AssetPackTypeLabel: TLabel; 26 | PackKindComboBox: TComboBox; 27 | PackNameLabel: TLabel; 28 | PackNameEdit: TEdit; 29 | CommandButtonsPanel: TPanel; 30 | CancelButton: TButton; 31 | OKButton: TButton; 32 | PackPackageNameLabel: TLabel; 33 | PackageEdit: TEdit; 34 | FolderComboBox: TComboBox; 35 | ActionList: TActionList; 36 | OKAction: TAction; 37 | procedure OKActionExecute(Sender: TObject); 38 | procedure OKActionUpdate(Sender: TObject); 39 | public 40 | function EditPack(const AAssetPack: TAssetPack): Boolean; 41 | procedure UpdatePack(const AAssetPack: TAssetPack); 42 | end; 43 | 44 | var 45 | AssetPackDetailsView: TAssetPackDetailsView; 46 | 47 | implementation 48 | 49 | {$R *.dfm} 50 | 51 | { TAssetPackDetailsView } 52 | 53 | function TAssetPackDetailsView.EditPack(const AAssetPack: TAssetPack): Boolean; 54 | begin 55 | PackageEdit.Text := AAssetPack.Package; 56 | PackNameEdit.Text := AAssetPack.PackName; 57 | PackKindComboBox.ItemIndex := Ord(AAssetPack.PackKind) - 1; 58 | FolderComboBox.Text := AAssetPack.Folder; 59 | Result := ShowModal = mrOK; 60 | end; 61 | 62 | procedure TAssetPackDetailsView.UpdatePack(const AAssetPack: TAssetPack); 63 | begin 64 | AAssetPack.Package := PackageEdit.Text; 65 | AAssetPack.PackName := PackNameEdit.Text; 66 | AAssetPack.PackKind := TAssetPackKind(PackKindComboBox.ItemIndex + 1); 67 | AAssetPack.Folder := FolderComboBox.Text; 68 | end; 69 | 70 | procedure TAssetPackDetailsView.OKActionExecute(Sender: TObject); 71 | begin 72 | ModalResult := mrOK; 73 | end; 74 | 75 | procedure TAssetPackDetailsView.OKActionUpdate(Sender: TObject); 76 | begin 77 | OKAction.Enabled := not string(PackageEdit.Text).Trim.IsEmpty and not string(PackNameEdit.Text).Trim.IsEmpty and 78 | not string(PackKindComboBox.Text).Trim.IsEmpty and (PackKindComboBox.ItemIndex > -1); 79 | end; 80 | 81 | end. 82 | 83 | -------------------------------------------------------------------------------- /Source/Android/Codex.Android.GradleDepsProcess.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Android.GradleDepsProcess; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | System.Classes, 18 | DW.RunProcess.Win; 19 | 20 | type 21 | TGradleDepsStage = (None, Initialize, GetDependencies); 22 | 23 | TGradleDepsProcess = class(TRunProcess) 24 | private 25 | FBuildPath: string; 26 | FCurrentDir: string; 27 | FGradlePath: string; 28 | FIsError: Boolean; 29 | FNeedsWorkingFiles: Boolean; 30 | FStage: TGradleDepsStage; 31 | FOnCompleted: TNotifyEvent; 32 | function CheckRequirements: Boolean; 33 | procedure Cleanup; 34 | procedure DoCompleted; 35 | procedure OutputExecuting; 36 | protected 37 | procedure DoTerminated(const AExitCode: Cardinal); override; 38 | function GradleInit: Boolean; 39 | procedure GetDependencies; 40 | public 41 | function Run: Boolean; override; 42 | property BuildPath: string read FBuildPath write FBuildPath; 43 | property GradlePath: string read FGradlePath write FGradlePath; 44 | property NeedsWorkingFiles: Boolean read FNeedsWorkingFiles write FNeedsWorkingFiles; 45 | property OnProcessOutput; 46 | property OnCompleted: TNotifyEvent read FOnCompleted write FOnCompleted; 47 | end; 48 | 49 | implementation 50 | 51 | uses 52 | System.IOUtils, System.SysUtils, 53 | DW.IOUtils.Helpers, 54 | Codex.Core, Codex.Consts.Text; 55 | 56 | { TGradleDepsProcess } 57 | 58 | function TGradleDepsProcess.CheckRequirements: Boolean; 59 | begin 60 | Result := not FBuildPath.Trim.IsEmpty and TDirectory.Exists(FBuildPath) and 61 | not FGradlePath.Trim.IsEmpty and TFile.Exists(FGradlePath); 62 | end; 63 | 64 | procedure TGradleDepsProcess.Cleanup; 65 | begin 66 | if not FNeedsWorkingFiles then 67 | TDirectoryHelper.Delete(FBuildPath); 68 | TDirectory.SetCurrentDirectory(FCurrentDir); 69 | end; 70 | 71 | procedure TGradleDepsProcess.DoCompleted; 72 | begin 73 | if Assigned(FOnCompleted) then 74 | FOnCompleted(Self); 75 | end; 76 | 77 | procedure TGradleDepsProcess.OutputExecuting; 78 | begin 79 | DoOutput(Format(Babel.Tx(sExecutingCommand), [CommandLine])); 80 | end; 81 | 82 | procedure TGradleDepsProcess.DoTerminated(const AExitCode: Cardinal); 83 | begin 84 | FIsError := FIsError or (AExitCode <> 0); 85 | case FStage of 86 | TGradleDepsStage.Initialize: 87 | begin 88 | if FIsError then 89 | begin 90 | DoOutput(Format(Babel.Tx(sInitializationFailed), [AExitCode])); 91 | Cleanup; 92 | end 93 | else 94 | GetDependencies; 95 | end; 96 | TGradleDepsStage.GetDependencies: 97 | begin 98 | if not FIsError then 99 | begin 100 | // DoOutput(Format('Successfully downloaded packages to: ', [])); 101 | DoCompleted; 102 | Cleanup; 103 | end 104 | else 105 | begin 106 | DoOutput(Format(Babel.Tx(sGetDependenciesFailed), [AExitCode])); 107 | Cleanup; 108 | end; 109 | inherited; 110 | end; 111 | end; 112 | end; 113 | 114 | procedure TGradleDepsProcess.GetDependencies; 115 | begin 116 | FStage := TGradleDepsStage.GetDependencies; 117 | CommandLine := Format('"%s" -q getDeps', [FGradlePath]); 118 | OutputExecuting; 119 | InternalRun; 120 | end; 121 | 122 | function TGradleDepsProcess.GradleInit: Boolean; 123 | begin 124 | FCurrentDir := TDirectory.GetCurrentDirectory; 125 | TDirectory.SetCurrentDirectory(FBuildPath); 126 | FStage := TGradleDepsStage.Initialize; 127 | CommandLine := Format('"%s"', [FGradlePath]); 128 | OutputExecuting; 129 | Result := InternalRun; 130 | end; 131 | 132 | function TGradleDepsProcess.Run: Boolean; 133 | begin 134 | Result := False; 135 | FIsError := False; 136 | FStage := TGradleDepsStage.None; 137 | if CheckRequirements then 138 | Result := GradleInit; 139 | end; 140 | 141 | end. 142 | -------------------------------------------------------------------------------- /Source/Android/Codex.Android.ProjectManagerMenu.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Android.ProjectManagerMenu; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | System.Classes, ToolsAPI, DW.OTA.ProjectManagerMenu; 18 | 19 | type 20 | TAndroidProjectManagerMenuNotifier = class(TProjectManagerMenuNotifier) 21 | private 22 | procedure AddAndroidPackage; 23 | procedure BuildAssetPacks; 24 | procedure ShowAddAndroidPackage; 25 | public 26 | procedure DoAddMenu(const AProject: IOTAProject; const AIdentList: TStrings; const AProjectManagerMenuList: IInterfaceList; 27 | AIsMultiSelect: Boolean); override; 28 | end; 29 | 30 | implementation 31 | 32 | uses 33 | System.SysUtils, System.IOUtils, 34 | CommonOptionStrs, 35 | Vcl.Forms, 36 | DW.OTA.Helpers, DW.OTA.Consts, DW.Vcl.DialogService, 37 | Codex.Android.PackagesView, Codex.Core, Codex.Consts.Text; 38 | 39 | const 40 | cPMMPAndroidToolsSection = pmmpVersionControlSection + 501000; 41 | 42 | type 43 | TBuildAssetPacksProjectManagerMenu = class(TProjectManagerMenu) 44 | public 45 | constructor Create(const APosition: Integer; const AExecuteProc: TProc); 46 | function GetEnabled: Boolean; override; 47 | end; 48 | 49 | TAddAndroidPackageProjectManagerMenu = class(TProjectManagerMenu) 50 | public 51 | constructor Create(const APosition: Integer; const AExecuteProc: TProc); 52 | function GetEnabled: Boolean; override; 53 | end; 54 | 55 | { TBuildAssetPacksProjectManagerMenu } 56 | 57 | constructor TBuildAssetPacksProjectManagerMenu.Create(const APosition: Integer; const AExecuteProc: TProc); 58 | begin 59 | inherited Create(Babel.Tx(sBuildAssetPacksCaption), 'BuildAssetPacks', APosition, AExecuteProc); 60 | end; 61 | 62 | function TBuildAssetPacksProjectManagerMenu.GetEnabled: Boolean; 63 | var 64 | LProject: IOTAProject; 65 | begin 66 | LProject := TOTAHelper.GetCurrentSelectedProject; 67 | Result := (LProject <> nil) and (TOTAHelper.GetProjectCurrentPlatform(LProject) in cAndroidProjectPlatforms); 68 | end; 69 | 70 | { TAddAndroidPackageProjectManagerMenu } 71 | 72 | constructor TAddAndroidPackageProjectManagerMenu.Create(const APosition: Integer; const AExecuteProc: TProc); 73 | begin 74 | inherited Create(Babel.Tx(sAddAndroidPackageCaption), 'CodexAddAndroidPackage', APosition, AExecuteProc); 75 | end; 76 | 77 | function TAddAndroidPackageProjectManagerMenu.GetEnabled: Boolean; 78 | var 79 | LProject: IOTAProject; 80 | begin 81 | LProject := TOTAHelper.GetCurrentSelectedProject; 82 | Result := (LProject <> nil) and LProject.CurrentPlatform.StartsWith('Android'); 83 | end; 84 | 85 | { TAndroidProjectManagerMenuNotifier } 86 | 87 | procedure TAndroidProjectManagerMenuNotifier.DoAddMenu(const AProject: IOTAProject; const AIdentList: TStrings; 88 | const AProjectManagerMenuList: IInterfaceList; AIsMultiSelect: Boolean); 89 | begin 90 | AProjectManagerMenuList.Add(TAddAndroidPackageProjectManagerMenu.Create(cPMMPAndroidToolsSection + 100, AddAndroidPackage)); 91 | AProjectManagerMenuList.Add(TBuildAssetPacksProjectManagerMenu.Create(cPMMPAndroidToolsSection + 105, BuildAssetPacks)); 92 | end; 93 | 94 | procedure TAndroidProjectManagerMenuNotifier.AddAndroidPackage; 95 | var 96 | LProject: IOTAProject; 97 | LProjectName, LDeployedPath: string; 98 | begin 99 | LProject := TOTAHelper.GetCurrentSelectedProject; 100 | if LProject <> nil then 101 | begin 102 | LProjectName := TOTAHelper.GetProjectActiveBuildConfigurationValue(LProject, sSanitizedProjectName); 103 | LDeployedPath := TPath.Combine(TOTAHelper.GetProjectOutputDir(LProject), LProjectName); 104 | if TDirectory.Exists(TPath.Combine(LDeployedPath, 'res')) then 105 | ShowAddAndroidPackage 106 | else 107 | TDialog.Warning(Babel.Tx(sPerformDeployment)); 108 | end; 109 | end; 110 | 111 | procedure TAndroidProjectManagerMenuNotifier.ShowAddAndroidPackage; 112 | var 113 | LDialog: TForm; 114 | begin 115 | LDialog := TPackagesView.Create(nil); 116 | try 117 | LDialog.ShowModal; 118 | finally 119 | LDialog.Free; 120 | end; 121 | end; 122 | 123 | procedure TAndroidProjectManagerMenuNotifier.BuildAssetPacks; 124 | begin 125 | // TODO 126 | end; 127 | 128 | end. 129 | 130 | -------------------------------------------------------------------------------- /Source/Android/Codex.Android.ResourcesModule.dfm: -------------------------------------------------------------------------------- 1 | object AndroidResources: TAndroidResources 2 | Height = 132 3 | Width = 494 4 | object ActionList: TActionList 5 | Images = VirtualImageList 6 | Left = 260 7 | Top = 20 8 | object ADBConnectAction: TAction 9 | Hint = 'ADB connect an Android device via IP' 10 | ImageIndex = 0 11 | ImageName = 'Item1' 12 | end 13 | end 14 | object VirtualImageList: TVirtualImageList 15 | Images = < 16 | item 17 | CollectionIndex = 0 18 | CollectionName = 'Item1' 19 | Name = 'Item1' 20 | end> 21 | ImageCollection = ImageCollection 22 | Left = 44 23 | Top = 20 24 | end 25 | object ImageCollection: TImageCollection 26 | Images = < 27 | item 28 | Name = 'Item1' 29 | SourceImages = < 30 | item 31 | Image.Data = { 32 | 89504E470D0A1A0A0000000D49484452000000100000001008060000001FF3FF 33 | 61000001674944415478DA63FCFFFF3F033AD8FFB8A6435DC06FFD83CF079C40 34 | 7C055EC7BD37DF6F0A74946BAE4457CB886EC0FFFF7F99D7DC8A5877FBC3663F 35 | 64717541FF75416ACB43191998FEE135E0C4F3BEB27D8FAA3AE3B50E5A2DBC66 36 | 7F0C2406645B02D9C79DE5BA8ACD25F3FAF01A30F59CE6DD8FBFEF2B31600182 37 | 1C4A7733F5AFA96018F0F5F76BB14BAF1726E98BC4CF3DFF664EFAFF7FFF98B0 38 | 19C0C8C4F4CF403469F645A05A0391C4395C6CA2AFC1061C7BD65975E0717DAB 39 | 836C63358866C003EC651A6A0E3E696801A9B5922A6F031B70F8494BC3E1A72D 40 | F5B6D2358D201A9F01303520DA56A6A6619018000B0347D9964A60226AC76700 41 | 2C9C406A2DA54A3AC0067CFFFD4EE8CADB65B1BA22D18BFACE4ABEC36740A1D1 42 | 3361985A0E16C1F718E9A0ED24C77F7C065499FF60C44807C8E0E893F69A834F 43 | 1B9BC151265D5F0BA291F9D632952D780D407605CC36743EED0D5878D5F10833 44 | 23F3DF18AD3DF6D8F8C80000DC4BFDE1B44AA6BE0000000049454E44AE426082} 45 | end> 46 | end> 47 | Left = 156 48 | Top = 20 49 | end 50 | object APKFolderOpenDialog: TFileOpenDialog 51 | FavoriteLinks = <> 52 | FileTypes = <> 53 | Options = [fdoPickFolders, fdoPathMustExist] 54 | Title = 'Select folder to extract APKs to' 55 | Left = 360 56 | Top = 20 57 | end 58 | end 59 | -------------------------------------------------------------------------------- /Source/Android/Codex.Android.ResourcesModule.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Android.ResourcesModule; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | System.SysUtils, System.Classes, System.ImageList, Vcl.ImgList, Vcl.Controls, System.Actions, Vcl.ActnList, Vcl.BaseImageCollection, 18 | Vcl.ImageCollection, Vcl.VirtualImageList, Vcl.Dialogs, 19 | Codex.CustomResourcesModule; 20 | 21 | type 22 | TAndroidResources = class(TDataModule) 23 | ActionList: TActionList; 24 | ADBConnectAction: TAction; 25 | VirtualImageList: TVirtualImageList; 26 | ImageCollection: TImageCollection; 27 | APKFolderOpenDialog: TFileOpenDialog; 28 | end; 29 | 30 | var 31 | AndroidResources: TAndroidResources; 32 | 33 | implementation 34 | 35 | {%CLASSGROUP 'Vcl.Controls.TControl'} 36 | 37 | {$R *.dfm} 38 | 39 | end. 40 | -------------------------------------------------------------------------------- /Source/Android/Codex.Android.SDKToolsView.dfm: -------------------------------------------------------------------------------- 1 | object SDKToolsView: TSDKToolsView 2 | Left = 0 3 | Top = 0 4 | Caption = 'SDK Tools' 5 | ClientHeight = 498 6 | ClientWidth = 480 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -12 11 | Font.Name = 'Segoe UI' 12 | Font.Style = [] 13 | Position = poOwnerFormCenter 14 | OnResize = FormResize 15 | TextHeight = 15 16 | object APILevelsLabel: TLabel 17 | AlignWithMargins = True 18 | Left = 4 19 | Top = 4 20 | Width = 472 21 | Height = 15 22 | Margins.Left = 4 23 | Margins.Top = 4 24 | Margins.Right = 4 25 | Margins.Bottom = 0 26 | Align = alTop 27 | Caption = 'Available API Levels: (greyed items are already installed)' 28 | ExplicitLeft = 8 29 | ExplicitTop = 8 30 | ExplicitWidth = 293 31 | end 32 | object CommandButtonsPanel: TPanel 33 | Left = 0 34 | Top = 464 35 | Width = 480 36 | Height = 34 37 | Align = alBottom 38 | BevelOuter = bvNone 39 | Padding.Left = 4 40 | Padding.Top = 4 41 | Padding.Right = 4 42 | Padding.Bottom = 4 43 | TabOrder = 0 44 | object CloseButton: TButton 45 | AlignWithMargins = True 46 | Left = 382 47 | Top = 4 48 | Width = 94 49 | Height = 26 50 | Margins.Left = 0 51 | Margins.Top = 0 52 | Margins.Right = 0 53 | Margins.Bottom = 0 54 | Align = alRight 55 | Cancel = True 56 | Caption = 'Close' 57 | DoubleBuffered = True 58 | ParentDoubleBuffered = False 59 | TabOrder = 0 60 | OnClick = CloseButtonClick 61 | end 62 | object InstallButton: TButton 63 | AlignWithMargins = True 64 | Left = 4 65 | Top = 4 66 | Width = 94 67 | Height = 26 68 | Margins.Left = 0 69 | Margins.Top = 0 70 | Margins.Right = 0 71 | Margins.Bottom = 0 72 | Action = InstallAction 73 | Align = alLeft 74 | DoubleBuffered = True 75 | ParentDoubleBuffered = False 76 | TabOrder = 1 77 | ExplicitLeft = 8 78 | ExplicitTop = 8 79 | end 80 | end 81 | object APILevelsCheckListBox: TCheckListBox 82 | AlignWithMargins = True 83 | Left = 4 84 | Top = 23 85 | Width = 472 86 | Height = 409 87 | Margins.Left = 4 88 | Margins.Top = 4 89 | Margins.Right = 4 90 | Margins.Bottom = 0 91 | Align = alClient 92 | ItemHeight = 17 93 | Sorted = True 94 | TabOrder = 1 95 | ExplicitWidth = 464 96 | ExplicitHeight = 363 97 | end 98 | object ProgressBar: TProgressBar 99 | AlignWithMargins = True 100 | Left = 3 101 | Top = 435 102 | Width = 474 103 | Height = 26 104 | Align = alBottom 105 | TabOrder = 2 106 | ExplicitTop = 389 107 | ExplicitWidth = 466 108 | end 109 | object ActionList: TActionList 110 | Left = 228 111 | Top = 256 112 | object InstallAction: TAction 113 | Caption = 'Install' 114 | OnExecute = InstallActionExecute 115 | OnUpdate = InstallActionUpdate 116 | end 117 | object AddAVDAction: TAction 118 | Caption = 'Add..' 119 | end 120 | object DeleteAVDAction: TAction 121 | Caption = 'Delete' 122 | end 123 | object StartAVDAction: TAction 124 | Caption = 'Start..' 125 | end 126 | end 127 | end 128 | -------------------------------------------------------------------------------- /Source/Android/Codex.Android.Types.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Android.Types; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | type 17 | TJarProjectConfig = record 18 | IncludedJars: TArray; 19 | JavaFiles: TArray; 20 | OutputFile: string; 21 | SourceVersion: string; 22 | TargetVersion: string; 23 | function Load(const AFileName: string): Boolean; 24 | procedure Save(const AFileName: string); 25 | end; 26 | 27 | implementation 28 | 29 | uses 30 | System.IOUtils, System.Rtti, 31 | DW.JSON, 32 | Neon.Core.Types, Neon.Core.Persistence, Neon.Core.Persistence.JSON; 33 | 34 | type 35 | TJarProjectConfigHelper = record helper for TJarProjectConfig 36 | function DoLoad(const AFileName: string): Boolean; 37 | procedure DoSave(const AFileName: string); 38 | end; 39 | 40 | { TJarProjectConfig } 41 | 42 | function TJarProjectConfig.Load(const AFileName: string): Boolean; 43 | begin 44 | Result := DoLoad(AFileName); 45 | end; 46 | 47 | procedure TJarProjectConfig.Save(const AFileName: string); 48 | begin 49 | DoSave(AFileName); 50 | end; 51 | 52 | { TJarProjectConfigHelper } 53 | 54 | function TJarProjectConfigHelper.DoLoad(const AFileName: string): Boolean; 55 | var 56 | LConfig: INeonConfiguration; 57 | begin 58 | Result := False; 59 | if TFile.Exists(AFileName) then 60 | begin 61 | // Original code used Delphi classes for JSON persistence, which writes as Camel Case 62 | LConfig := TNeonConfiguration.Default.SetMemberCase(TNeonCase.CamelCase); 63 | Self := TNeon.JSONToValue(TFile.ReadAllText(AFileName), LConfig); 64 | Result := True; 65 | end; 66 | end; 67 | 68 | procedure TJarProjectConfigHelper.DoSave(const AFileName: string); 69 | var 70 | LConfig: INeonConfiguration; 71 | begin 72 | // Original code used Delphi classes for JSON persistence, which writes as Camel Case 73 | LConfig := TNeonConfiguration.Default.SetMemberCase(TNeonCase.CamelCase); 74 | TFile.WriteAllText(AFileName, TJsonHelper.Tidy(TNeon.ValueToJSONString(TValue.From(Self), LConfig))); 75 | end; 76 | 77 | end. 78 | -------------------------------------------------------------------------------- /Source/Cleaner/Codex.Cleaner.CleanView.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Cleaner.CleanView; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, 18 | Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls, Vcl.CheckLst, System.Actions, Vcl.ActnList, 19 | DW.Vcl.Splitter.Themed, 20 | Codex.BaseView; 21 | 22 | type 23 | TCleanView = class(TForm) 24 | CleanPathPanel: TPanel; 25 | AppImagesPathPanel: TPanel; 26 | SelectCleanPathSpeedButton: TSpeedButton; 27 | CleanPathEdit: TEdit; 28 | CleanPathIncludeSubdirsCheckBox: TCheckBox; 29 | FileOpenDialog: TFileOpenDialog; 30 | FileTypesCheckListBox: TCheckListBox; 31 | AppImagesButtonsPanel: TPanel; 32 | ActionList: TActionList; 33 | CleanAction: TAction; 34 | CleanButton: TButton; 35 | CancelButton: TButton; 36 | PathLabel: TLabel; 37 | FoldersCheckListBox: TCheckListBox; 38 | ListBoxesSplitter: TSplitter; 39 | FoldersPanel: TPanel; 40 | FileTypesCheckBox: TCheckBox; 41 | FoldersCheckBox: TCheckBox; 42 | procedure SelectCleanPathSpeedButtonClick(Sender: TObject); 43 | procedure CleanActionUpdate(Sender: TObject); 44 | procedure CleanActionExecute(Sender: TObject); 45 | procedure FileTypesCheckBoxClick(Sender: TObject); 46 | procedure FoldersCheckBoxClick(Sender: TObject); 47 | private 48 | function GetCleanExtensions: TArray; 49 | function GetCleanFolders: TArray; 50 | public 51 | constructor Create(AOwner: TComponent); override; 52 | property CleanExtensions: TArray read GetCleanExtensions; 53 | property CleanFolders: TArray read GetCleanFolders; 54 | end; 55 | 56 | var 57 | CleanView: TCleanView; 58 | 59 | implementation 60 | 61 | {$R *.dfm} 62 | 63 | uses 64 | System.IOUtils, 65 | DW.IOUtils.Helpers, DW.OTA.Helpers, 66 | DW.Vcl.ListBoxHelper, 67 | Codex.Core, Codex.Consts.Text; 68 | 69 | const 70 | cCheckedState: array[Boolean] of TCheckBoxState = (TCheckBoxState.cbUnchecked, TCheckBoxState.cbChecked); 71 | 72 | { TfrmClean } 73 | 74 | constructor TCleanView.Create(AOwner: TComponent); 75 | begin 76 | inherited; 77 | TOTAHelper.ApplyTheme(Self); 78 | end; 79 | 80 | procedure TCleanView.FileTypesCheckBoxClick(Sender: TObject); 81 | begin 82 | FileTypesCheckListBox.CheckAll(cCheckedState[FileTypesCheckBox.Checked]); 83 | end; 84 | 85 | procedure TCleanView.FoldersCheckBoxClick(Sender: TObject); 86 | begin 87 | FoldersCheckListBox.CheckAll(cCheckedState[FoldersCheckBox.Checked]); 88 | end; 89 | 90 | procedure TCleanView.CleanActionExecute(Sender: TObject); 91 | begin 92 | if MessageDlg(Babel.Tx(sConfirmClean), TMsgDlgType.mtConfirmation, [TMsgDlgBtn.mbYes, TMsgDlgBtn.mbNo], 0) = mrYes then 93 | ModalResult := mrOk; 94 | end; 95 | 96 | procedure TCleanView.CleanActionUpdate(Sender: TObject); 97 | begin 98 | CleanAction.Enabled := TDirectoryHelper.Exists(CleanPathEdit.Text) and 99 | ((FileTypesCheckListBox.CheckedCount > 0) or (FoldersCheckListBox.CheckedCount > 0)); 100 | end; 101 | 102 | function TCleanView.GetCleanExtensions: TArray; 103 | var 104 | I: Integer; 105 | begin 106 | for I := 0 to FileTypesCheckListBox.Count - 1 do 107 | begin 108 | if FileTypesCheckListBox.Checked[I] then 109 | Result := Result + [FileTypesCheckListBox.Items[I]]; 110 | end; 111 | end; 112 | 113 | function TCleanView.GetCleanFolders: TArray; 114 | var 115 | I: Integer; 116 | begin 117 | for I := 0 to FoldersCheckListBox.Count - 1 do 118 | begin 119 | if FoldersCheckListBox.Checked[I] then 120 | Result := Result + [FoldersCheckListBox.Items[I]]; 121 | end; 122 | end; 123 | 124 | procedure TCleanView.SelectCleanPathSpeedButtonClick(Sender: TObject); 125 | begin 126 | if FileOpenDialog.Execute then 127 | CleanPathEdit.Text := FileOpenDialog.FileName; 128 | end; 129 | 130 | end. 131 | -------------------------------------------------------------------------------- /Source/Cleaner/Codex.Cleaner.Wizard.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Cleaner.Wizard; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | implementation 17 | 18 | uses 19 | System.UITypes, System.Classes, System.IOUtils, System.Types, 20 | Vcl.Menus, Vcl.ActnList, Vcl.Forms, 21 | DW.OTA.Wizard, DW.OTA.Helpers, DW.Classes.Helpers, DW.IOUtils.Helpers, DW.Menus.Helpers, DW.Types.Helpers, 22 | Codex.ProgressView, 23 | Codex.Consts, Codex.Cleaner.CleanView, Codex.Core, Codex.Consts.Text; 24 | 25 | const 26 | cCleanerMenuItemName = 'CodexCleanerMenuItem'; 27 | 28 | type 29 | TCleanerWizard = class(TWizard) 30 | private 31 | FCleanExtensions: TArray; 32 | FCleanFolders: TArray; 33 | FCleanPath: string; 34 | FIncludeSubfolders: Boolean; 35 | procedure AddMenuItem; 36 | procedure Clean; 37 | procedure CleanerActionHandler(Sender: TObject); 38 | procedure DeleteFile(const AFileName: string); 39 | procedure DoProgress(const APercent: Integer; const AMessage: string = ''); 40 | public 41 | constructor Create; override; 42 | end; 43 | 44 | { TCleanerWizard } 45 | 46 | constructor TCleanerWizard.Create; 47 | begin 48 | inherited; 49 | AddMenuItem; 50 | end; 51 | 52 | procedure TCleanerWizard.AddMenuItem; 53 | var 54 | LCodexMenuItem, LMenuItem: TMenuItem; 55 | begin 56 | if TOTAHelper.FindToolsSubMenu(cCodexMenuItemName, LCodexMenuItem) then 57 | begin 58 | LMenuItem := TMenuItem.CreateWithAction(LCodexMenuItem, Babel.Tx(sCleanerCaption), CleanerActionHandler); 59 | LCodexMenuItem.Insert(LCodexMenuItem.Count, LMenuItem); 60 | end; 61 | end; 62 | 63 | procedure TCleanerWizard.Clean; 64 | const 65 | cSearchOptions: array[Boolean] of TSearchOption = (TSearchOption.soTopDirectoryOnly, TSearchOption.soAllDirectories); 66 | var 67 | LItems, LPatterns: TArray; 68 | I: Integer; 69 | begin 70 | if FCleanFolders.Count > 0 then 71 | begin 72 | DoProgress(0, Babel.Tx(sScanningFolders)); 73 | LItems := TDirectoryHelper.GetDirectories(FCleanPath, FCleanFolders, TSearchOption.soAllDirectories); 74 | for I := 0 to LItems.Count - 1 do 75 | begin 76 | TDirectoryHelper.Delete(LItems[I]); 77 | DoProgress(Round(100 * (I / (LItems.Count - 1))), LItems[I]); 78 | end; 79 | end; 80 | if FCleanExtensions.Count > 0 then 81 | begin 82 | SetLength(LPatterns, Length(FCleanExtensions)); 83 | for I := 0 to Length(FCleanExtensions) - 1 do 84 | LPatterns[I] := '*.' + FCleanExtensions[I]; 85 | DoProgress(0, Babel.Tx(sScanningFiles)); 86 | LItems := TDirectoryHelper.GetFiles(FCleanPath, LPatterns, cSearchOptions[FIncludeSubfolders]); 87 | for I := 0 to LItems.Count - 1 do 88 | begin 89 | DeleteFile(LItems[I]); 90 | DoProgress(Round(100 * (I / (LItems.Count - 1))), LItems[I]); 91 | end; 92 | end; 93 | DoProgress(-1); 94 | end; 95 | 96 | procedure TCleanerWizard.DeleteFile(const AFileName: string); 97 | begin 98 | try 99 | TFile.Delete(AFileName); 100 | except 101 | // Just ignore 102 | end 103 | end; 104 | 105 | procedure TCleanerWizard.DoProgress(const APercent: Integer; const AMessage: string = ''); 106 | begin 107 | TDo.SyncMain( 108 | procedure 109 | begin 110 | ProgressView.ShowProgress(Babel.Tx(sCleaning), AMessage, APercent); 111 | end 112 | ); 113 | end; 114 | 115 | procedure TCleanerWizard.CleanerActionHandler(Sender: TObject); 116 | var 117 | LForm: TCleanView; 118 | begin 119 | LForm := TCleanView.Create(nil); 120 | try 121 | if LForm.ShowModal = mrOK then 122 | begin 123 | FCleanPath := LForm.CleanPathEdit.Text; 124 | FIncludeSubfolders := LForm.CleanPathIncludeSubdirsCheckBox.Checked; 125 | FCleanExtensions := LForm.CleanExtensions; 126 | FCleanFolders := LForm.CleanFolders; 127 | TDo.RunQueue(Clean); 128 | end; 129 | finally 130 | LForm.Free; 131 | end; 132 | end; 133 | 134 | initialization 135 | TOTAWizard.RegisterWizard(TCleanerWizard); 136 | 137 | end. 138 | -------------------------------------------------------------------------------- /Source/Codex.LibSuffix.inc: -------------------------------------------------------------------------------- 1 | {$IF CompilerVersion = 35} 2 | {$LIBSUFFIX '280'} 3 | {$ENDIF} 4 | {$IF CompilerVersion = 36} 5 | {$LIBSUFFIX '290'} 6 | {$ENDIF} 7 | 8 | -------------------------------------------------------------------------------- /Source/Codex.zip: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Source/Codex.zip -------------------------------------------------------------------------------- /Source/Core/Codex.AST.pas: -------------------------------------------------------------------------------- 1 | unit Codex.AST; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | System.Classes, 18 | ToolsAPI, 19 | DelphiAST, DelphiAST.Classes; 20 | 21 | type 22 | TCodexAST = class(TPasSyntaxTreeBuilder) 23 | private 24 | function RunNoMessages(const ASource: TStream): TSyntaxNode; 25 | public 26 | class function RunSourceEditor(const AEditor: IOTASourceEditor): TSyntaxNode; 27 | end; 28 | 29 | implementation 30 | 31 | uses 32 | DelphiAST.Consts; 33 | 34 | { TCodexAST } 35 | 36 | class function TCodexAST.RunSourceEditor(const AEditor: IOTASourceEditor): TSyntaxNode; 37 | const 38 | cBufferSize = 1024; 39 | var 40 | LBuilder: TCodexAST; 41 | LReader: IOTAEditReader; 42 | LBuffer: AnsiString; 43 | LPosition, LCharsRead: Integer; 44 | LWriter: TStringStream; 45 | begin 46 | LReader := AEditor.CreateReader; 47 | LWriter := TStringStream.Create; 48 | try 49 | LPosition := 0; 50 | repeat 51 | SetLength(LBuffer, cBufferSize); 52 | LCharsRead := LReader.GetText(LPosition, PAnsiChar(LBuffer), cBufferSize); 53 | SetLength(LBuffer, LCharsRead); 54 | LWriter.WriteString(string(LBuffer)); 55 | Inc(LPosition, LCharsRead); 56 | until LCharsRead < cBufferSize; 57 | LBuilder := TCodexAST.Create; 58 | try 59 | LBuilder.InitDefinesDefinedByCompiler; 60 | Result := LBuilder.RunNoMessages(LWriter); 61 | finally 62 | LBuilder.Free; 63 | end; 64 | finally 65 | LWriter.Free; 66 | end; 67 | end; 68 | 69 | function TCodexAST.RunNoMessages(const ASource: TStream): TSyntaxNode; 70 | begin 71 | Result := TSyntaxNode.Create(ntUnit); 72 | FStack.Clear; 73 | FStack.Push(Result); 74 | try 75 | inherited Run('', ASource); 76 | finally 77 | FStack.Pop; 78 | end; 79 | end; 80 | 81 | end. 82 | -------------------------------------------------------------------------------- /Source/Core/Codex.AboutView.pas: -------------------------------------------------------------------------------- 1 | unit Codex.AboutView; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 18 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Imaging.pngimage, 19 | DW.Vcl.ExtendedLabel, 20 | Codex.BaseView; 21 | 22 | type 23 | TAboutView = class(TForm) 24 | BottomBevel: TBevel; 25 | LogoPanel: TPanel; 26 | ButtonsPanel: TPanel; 27 | OKButton: TButton; 28 | LicenseButton: TButton; 29 | InfoPanel: TPanel; 30 | VersionLabel: TLabel; 31 | CodexLabel: TLabel; 32 | UpperBevel: TBevel; 33 | VersionEdit: TEdit; 34 | CopyrightLabel: TLabel; 35 | WebLabel: TLabel; 36 | SlackLabel: TLabel; 37 | VersionPanel: TPanel; 38 | IssuesLabel: TLabel; 39 | CreditsLabel: TLabel; 40 | CreditsMemo: TMemo; 41 | LogoImage: TImage; 42 | WebSitePanel: TPanel; 43 | WebSitePanelLabel: TLabel; 44 | IssuesPanel: TPanel; 45 | IssuesPanelLabel: TLabel; 46 | SupportPanel: TPanel; 47 | SupportPanelLabel: TLabel; 48 | procedure WebLabelClick(Sender: TObject); 49 | procedure SlackLabelClick(Sender: TObject); 50 | procedure IssuesLabelClick(Sender: TObject); 51 | private 52 | procedure OpenURL(const AURL: string); 53 | public 54 | constructor Create(AOwner: TComponent); override; 55 | end; 56 | 57 | var 58 | AboutView: TAboutView; 59 | 60 | implementation 61 | 62 | {$R *.dfm} 63 | 64 | uses 65 | BrandingAPI, 66 | DW.OSDevice.Win, DW.OTA.Wizard, DW.OTA.Helpers, 67 | Winapi.ShellAPI; 68 | 69 | const 70 | cCodexURL = 'https://www.delphiworlds.com/codex'; 71 | cCodexIssuesURL = 'https://github.com/DelphiWorlds/Codex/issues'; 72 | cSlackURL = 'https://slack.delphiworlds.com'; 73 | 74 | { TAboutView } 75 | 76 | constructor TAboutView.Create(AOwner: TComponent); 77 | begin 78 | inherited; 79 | CodexLabel.Font.Color := StrToInt('$401FE0'); 80 | WebLabel.Font.Color := ThemeProperties.LinkColor; 81 | SlackLabel.Font.Color := ThemeProperties.LinkColor; 82 | IssuesLabel.Font.Color := ThemeProperties.LinkColor; 83 | VersionEdit.Text := TOTAWizard.GetWizardVersion; 84 | CopyrightLabel.Caption := CopyrightLabel.Caption + Format(' (%s)', [TPlatformOSDevice.GetCurrentLocaleInfo.LanguageCode]); 85 | end; 86 | 87 | procedure TAboutView.OpenURL(const AURL: string); 88 | begin 89 | ShellExecute(0, 'open', PChar(AURL), nil, nil, SW_SHOWNORMAL); 90 | end; 91 | 92 | procedure TAboutView.IssuesLabelClick(Sender: TObject); 93 | begin 94 | OpenURL(cCodexIssuesURL); 95 | end; 96 | 97 | procedure TAboutView.SlackLabelClick(Sender: TObject); 98 | begin 99 | OpenURL(cSlackURL); 100 | end; 101 | 102 | procedure TAboutView.WebLabelClick(Sender: TObject); 103 | begin 104 | OpenURL(cCodexURL); 105 | end; 106 | 107 | end. 108 | -------------------------------------------------------------------------------- /Source/Core/Codex.ActionList.Helper.pas: -------------------------------------------------------------------------------- 1 | unit Codex.ActionList.Helper; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Vcl.ActnList; 18 | 19 | type 20 | TActionListHelper = class helper for TActionList 21 | public 22 | procedure AssignActions(const ASource: TActionList); 23 | end; 24 | 25 | implementation 26 | 27 | uses 28 | System.Actions; 29 | 30 | { TActionListHelper } 31 | 32 | procedure TActionListHelper.AssignActions(const ASource: TActionList); 33 | var 34 | I: Integer; 35 | begin 36 | for I := 0 to ASource.ActionCount - 1 do 37 | AddAction(ASource.Actions[I]); 38 | for I := ASource.ActionCount - 1 downto 0 do 39 | ASource.RemoveAction(ASource.Actions[I]); 40 | end; 41 | 42 | end. 43 | -------------------------------------------------------------------------------- /Source/Core/Codex.BaseView.pas: -------------------------------------------------------------------------------- 1 | unit Codex.BaseView; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | System.Classes, 18 | Vcl.TitleBarCtrls, Vcl.Forms, 19 | Codex.Interfaces; 20 | 21 | type 22 | TForm = class(Vcl.Forms.TForm, ICodexView) 23 | private 24 | FIsShown: Boolean; 25 | FNeedsProps: Boolean; 26 | procedure ReadProps; 27 | procedure WriteProps; 28 | protected 29 | function CustomTitleBarHeight: Integer; 30 | procedure DoHide; override; 31 | procedure DoShow; override; 32 | property IsShown: Boolean read FIsShown; 33 | property NeedsProps: Boolean read FNeedsProps write FNeedsProps; 34 | public 35 | constructor Create(AOwner: TComponent); override; 36 | end; 37 | 38 | implementation 39 | 40 | uses 41 | Vcl.Controls, 42 | {$IF Defined(EXPERT)} 43 | ToolsAPI, 44 | {$IF CompilerVersion > 35} 45 | ToolsAPI.UI, 46 | {$ENDIF} 47 | BrandingAPI, IDETheme.Utils, 48 | DW.OTA.Helpers, 49 | {$ENDIF} 50 | Codex.Config, Codex.Core; 51 | 52 | type 53 | TOpenControl = class(TControl); 54 | 55 | { TForm } 56 | 57 | constructor TForm.Create(AOwner: TComponent); 58 | begin 59 | inherited; 60 | FNeedsProps := True; 61 | {$IF Defined(EXPERT)} 62 | TOTAHelper.ApplyTheme(Self); 63 | {$IF CompilerVersion > 35} 64 | TIDETitleBarService.AddTitleBar(Self, nil); 65 | {$ELSE} 66 | SetupIDEDialogTitleBar(Self, nil); 67 | {$ENDIF} 68 | {$ENDIF} 69 | Babel.Translate(Self); 70 | end; 71 | 72 | function TForm.CustomTitleBarHeight: Integer; 73 | begin 74 | Result := 0; 75 | if CustomTitleBar.Enabled and (CustomTitleBar.Control <> nil) then 76 | Result := CustomTitleBar.Control.Height; 77 | end; 78 | 79 | procedure TForm.DoHide; 80 | begin 81 | WriteProps; 82 | inherited; 83 | end; 84 | 85 | procedure TForm.DoShow; 86 | begin 87 | inherited; 88 | ReadProps; 89 | FIsShown := True; 90 | end; 91 | 92 | procedure TForm.ReadProps; 93 | var 94 | LProps: TFormProps; 95 | begin 96 | if FNeedsProps and not FIsShown and Config.GetFormProps(Name, LProps) then 97 | begin 98 | Left := LProps.Left; 99 | Top := LProps.Top; 100 | Width := LProps.Width; 101 | Height := LProps.Height; 102 | end; 103 | end; 104 | 105 | procedure TForm.WriteProps; 106 | begin 107 | if FNeedsProps then 108 | Config.SetFormProps(Name, Left, Top, Width, Height); 109 | end; 110 | 111 | end. 112 | -------------------------------------------------------------------------------- /Source/Core/Codex.Config.NEON.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Config.NEON; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Codex.Config; 18 | 19 | type 20 | TCodexConfigHelper = record helper for TCodexConfig 21 | function GetConfigFileName: string; 22 | procedure DoLoad; 23 | procedure DoSave; 24 | end; 25 | 26 | implementation 27 | 28 | uses 29 | System.IOUtils, System.Rtti, System.SysUtils, 30 | Neon.Core.Persistence.JSON, 31 | DW.IOUtils.Helpers, DW.JSON; 32 | 33 | { TCodexConfigHelper } 34 | 35 | function TCodexConfigHelper.GetConfigFileName: string; 36 | begin 37 | Result := TPathHelper.GetAppDocumentsFile('config.json'); 38 | end; 39 | 40 | procedure TCodexConfigHelper.DoLoad; 41 | begin 42 | if TFile.Exists(GetConfigFileName) then 43 | Self := TNeon.JSONToValue(TFile.ReadAllText(GetConfigFileName)); 44 | end; 45 | 46 | procedure TCodexConfigHelper.DoSave; 47 | begin 48 | TFile.WriteAllText(GetConfigFileName, TJsonHelper.Tidy(TNeon.ValueToJSONString(TValue.From(Self)))); 49 | end; 50 | 51 | end. 52 | -------------------------------------------------------------------------------- /Source/Core/Codex.Consts.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Consts; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | {$IF Defined(EXPERT)} 18 | ToolsAPI, 19 | {$ENDIF} 20 | Codex.Types; 21 | 22 | const 23 | CRLF = #13#10; 24 | 25 | cCodexMenuItemName = 'CodexMenuItem'; 26 | cCodexReopenFilesItemName = 'CodexReopenFilesMenuItem'; 27 | cCodexProjectFilesItemName = 'CodexProjectFilesMenuItem'; 28 | cCodexOpenRecentProjectItemName = 'CodexOpenRecentProjectMenuItem'; 29 | 30 | cCodexToolbarName = 'CodexToolbar'; 31 | cCodexToolbarCaption = 'Codex'; 32 | cEnvVarBDS = 'BDS'; 33 | cEnvVarBDSBin = 'BDSBin'; 34 | cEnvVarBDSLib = 'BDSLib'; 35 | cEnvVarProductVersion = 'ProductVersion'; 36 | cBDSMacro = '$(BDS)'; 37 | 38 | cFormsIDEOptionsDialogClassName = 'TDefaultEnvironmentDialog'; 39 | cFormsIDEOptionsDialogPropertySheetName = 'PropertySheetControl1'; 40 | cFormsIDEOptionsDialogPropertiesPanelName = 'Panel2'; 41 | cFormsProjectOptionsDialogClassName = 'TDelphiProjectOptionsDialog'; 42 | cFormsVariableEntryDialogClassName = 'TVariableEntry'; 43 | cFormsProjectManagerFormName = 'ProjectManagerForm'; 44 | cFormsProjectOptionsDialogButtonsPanelName = 'Panel1'; 45 | cFormsProjectOptionsDialogPropertiesPanelName = 'Panel2'; 46 | cFormsProjectOptionsDialogResizePanelName = 'Panel3'; 47 | cFormsProjectOptionsDialogPropertySheetName = 'PropertySheetControl1'; 48 | cFormsEditWindowEditorFormDesigner = 'EditorFormDesigner'; 49 | cFormsEditWindowViewSelector = 'ViewSelector'; 50 | cFormsEditWindowCodeNavToolbar = 'TEditorNavigationToolbar'; 51 | 52 | cComponentViewProjectManagerCommand = 'ViewPrjMgrCommand'; 53 | 54 | {$IF Defined(EXPERT)} 55 | cPMMPCodexSection = pmmpVersionControlSection + 500000; // i.e. 7500000 56 | cPMMPCodexMainSection = pmmpVersionControlSection + 900000; // i.e. 7900000 - don't go past this with "subwizards" 57 | cPMMPSuppAddSection = pmmpAddSection + 900000; // Makes sure that items in this section appear after the other "Add" items 58 | {$ENDIF} 59 | 60 | cManifestFileName = 'AndroidManifest.xml'; 61 | cManifestTemplateFileName = 'AndroidManifest.template.xml'; 62 | 63 | cRegistryCodexSubKey = '\DelphiWorlds\Codex'; 64 | 65 | cIDEOptionsSectionEnvironment = 'Environment Options'; 66 | cIDEOptionsSectionDeployment = 'Deployment'; 67 | 68 | cRecordToolBarComponentName = 'RecordToolBar'; 69 | cViewBarComponentName = 'ViewBar'; 70 | 71 | cKnownOutputFileExts: array[0..10] of string = ( 72 | '.dcu', '.o', '.so', '.res', '.dSYM', '.entitlements', '.ext', '.plist', '.ipa', '.xml', '.jar' 73 | ); 74 | cKnownEditorFileExts: array[0..14] of string = ( 75 | '.pas', '.html', '.md', '.c', '.h', '.xml', '.sql', '.idl', '.vb', '.js', '.css', '.ini', '.php', '.cs', '.txt' 76 | ); 77 | 78 | cMsgColorHint = '#A05528'; 79 | cMsgColorWarning = '#5AB3E5'; 80 | cMsgColorError = '#3852DF'; 81 | cMsgColorSuccess = '#33B46D'; 82 | 83 | cMsgColors: array[TTextColor] of string = (cMsgColorHint, cMsgColorWarning, cMsgColorError, cMsgColorSuccess); 84 | 85 | implementation 86 | 87 | end. 88 | -------------------------------------------------------------------------------- /Source/Core/Codex.Core.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Core; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Babel.Types, 18 | Codex.Types, Codex.Interfaces; 19 | 20 | var 21 | ActiveProjectProperties: TProjectProperties; 22 | CodexProvider: ICodexProvider; 23 | CodexResources: IResourcesModule; 24 | ModuleNotifier: IModuleNotifier; 25 | MoscoProvider: IMoscoProvider; 26 | ProjectResources: IResourcesModule; 27 | ProjectToolsProvider: IProjectToolsProvider; 28 | Babel: TBabel; 29 | 30 | implementation 31 | 32 | uses 33 | System.IOUtils, 34 | DW.OSLog, 35 | DW.IOUtils.Helpers, 36 | Babel.Persistence; 37 | 38 | procedure LoadBabel; 39 | var 40 | LFakeCodeFileName: string; 41 | begin 42 | Babel.LoadFromResource; 43 | LFakeCodeFileName := TPathHelper.GetAppDocumentsFile('fakecode.txt'); 44 | if TFile.Exists(LFakeCodeFileName) then 45 | begin 46 | Babel.DefaultCode := TFile.ReadAllText(LFakeCodeFileName); 47 | TOSLog.d('Using fake code: ' + Babel.DefaultCode); 48 | end; 49 | end; 50 | 51 | initialization 52 | LoadBabel; 53 | 54 | end. 55 | -------------------------------------------------------------------------------- /Source/Core/Codex.CustomResourcesModule.pas: -------------------------------------------------------------------------------- 1 | unit Codex.CustomResourcesModule; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | System.Classes, 18 | Vcl.ActnList, Vcl.ImgList, 19 | Codex.Interfaces; 20 | 21 | type 22 | TDataModule = class(System.Classes.TDataModule, IResourcesModule) 23 | protected 24 | function GetToolbarName: string; virtual; 25 | public 26 | { IResourcesModule } 27 | procedure AddToolbarActions; 28 | function GetActionList(const AName: string): TActionList; 29 | function GetImageList: TCustomImageList; 30 | procedure LinkAction(const ALinkedAction: TAction); overload; 31 | procedure LinkAction(const AName: string; const AOnExecute: TNotifyEvent; const AOnUpdate: TNotifyEvent = nil); overload; 32 | procedure PerformAction(const AAction: TAction); 33 | public 34 | constructor Create(AOwner: TComponent); override; 35 | end; 36 | 37 | implementation 38 | 39 | uses 40 | System.SysUtils, 41 | ToolsAPI, 42 | DW.OSLog, 43 | DW.OTA.Helpers, 44 | Codex.Consts; 45 | 46 | { TDataModule } 47 | 48 | constructor TDataModule.Create(AOwner: TComponent); 49 | var 50 | LServices: INTAServices; 51 | LImageList: TCustomImageList; 52 | I: Integer; 53 | LAction: TAction; 54 | begin 55 | inherited; 56 | LImageList := GetImageList; 57 | if LImageList <> nil then 58 | begin 59 | LServices := BorlandIDEServices as INTAServices; 60 | LServices.AddImages(LImageList); 61 | for I := 0 to ComponentCount - 1 do 62 | begin 63 | if Components[I] is TAction then 64 | begin 65 | LAction := TAction(Components[I]); 66 | if LAction.Category.IsEmpty then 67 | LServices.AddActionMenu('', LAction, nil); 68 | end; 69 | end; 70 | end; 71 | end; 72 | 73 | procedure TDataModule.PerformAction(const AAction: TAction); 74 | var 75 | LAction: TAction; 76 | begin 77 | LAction := TAction(FindComponent(AAction.Name)); 78 | if LAction <> nil then 79 | LAction.Execute; 80 | end; 81 | 82 | procedure TDataModule.AddToolbarActions; 83 | var 84 | LServices: INTAServices; 85 | I: Integer; 86 | LAction: TCustomAction; 87 | begin 88 | LServices := BorlandIDEServices as INTAServices; 89 | for I := 0 to ComponentCount - 1 do 90 | begin 91 | if Components[I] is TCustomAction then 92 | begin 93 | LAction := TCustomAction(Components[I]); 94 | if LAction.Category.IsEmpty then 95 | begin 96 | LAction.Visible := LAction.Visible and Assigned(LAction.OnExecute); 97 | if LAction.Visible then 98 | TOTAHelper.AddToolbarButton(GetToolbarName, string(LAction.Name).Replace('Action', 'Button'), LAction) 99 | end; 100 | end; 101 | end; 102 | end; 103 | 104 | function TDataModule.GetActionList(const AName: string): TActionList; 105 | begin 106 | Result := TActionList(FindComponent(AName)); 107 | if Result = nil then 108 | TOSLog.d('Could not find actionlist: %s', [AName]); 109 | end; 110 | 111 | function TDataModule.GetImageList: TCustomImageList; 112 | begin 113 | Result := TCustomImageList(FindComponent('VirtualImageList')); 114 | end; 115 | 116 | function TDataModule.GetToolbarName: string; 117 | begin 118 | Result := cCodexToolbarName; 119 | end; 120 | 121 | procedure TDataModule.LinkAction(const AName: string; const AOnExecute: TNotifyEvent; const AOnUpdate: TNotifyEvent = nil); 122 | var 123 | LAction: TAction; 124 | begin 125 | LAction := TAction(FindComponent(AName)); 126 | if LAction <> nil then 127 | begin 128 | LAction.OnExecute := AOnExecute; 129 | if Assigned(AOnUpdate) then 130 | LAction.OnUpdate := AOnUpdate; 131 | end 132 | else 133 | TOSLog.d('Could not find action: %s', [AName]); 134 | end; 135 | 136 | procedure TDataModule.LinkAction(const ALinkedAction: TAction); 137 | var 138 | LAction: TAction; 139 | begin 140 | LAction := TAction(FindComponent(ALinkedAction.Name)); 141 | if LAction <> nil then 142 | begin 143 | LAction.OnExecute := ALinkedAction.OnExecute; 144 | LAction.OnUpdate := ALinkedAction.OnUpdate; 145 | end; 146 | end; 147 | 148 | end. 149 | -------------------------------------------------------------------------------- /Source/Core/Codex.External.DelphiWorlds.pas: -------------------------------------------------------------------------------- 1 | unit Codex.External.DelphiWorlds; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | ToolsAPI, 18 | Codex.Types; 19 | 20 | type 21 | IDelphiWorlds = interface(IInterface) 22 | ['{1E5025D7-B015-4AC6-97D8-49A92C619154}'] 23 | procedure ProjectModified(const AProject: IOTAProject); 24 | procedure ShowSpecialOptions; 25 | procedure SysJarsMismatch; 26 | procedure UseSymbolUnits(const ASourceSymbols: TSourceSymbols); 27 | end; 28 | 29 | var 30 | DelphiWorlds: IDelphiWorlds; 31 | 32 | implementation 33 | 34 | // This define is used by Delphi Worlds only - there is no other reason to enable it 35 | {.$DEFINE DelphiWorlds} 36 | 37 | {$IF Defined(DelphiWorlds)} 38 | uses 39 | Codex.Internal.Wizard; 40 | {$ENDIF} 41 | 42 | end. 43 | -------------------------------------------------------------------------------- /Source/Core/Codex.External.HGMGetIt.pas: -------------------------------------------------------------------------------- 1 | unit Codex.External.HGMGetIt; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | implementation 17 | 18 | {.$DEFINE HGMGetIt} 19 | 20 | {$IF Defined(HGMGetIt)} 21 | uses 22 | Codex.HGMGetIt.Wizard; 23 | {$ENDIF} 24 | 25 | end. 26 | -------------------------------------------------------------------------------- /Source/Core/Codex.IDEOptionsView.pas: -------------------------------------------------------------------------------- 1 | unit Codex.IDEOptionsView; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 18 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, 19 | Codex.BaseView, 20 | Codex.Options; 21 | 22 | type 23 | TIDEOptionsView = class(TForm, IConfigOptionsSection) 24 | RootPanel: TPanel; 25 | ShowProjectManagerCheckBox: TCheckBox; 26 | RunRunInterceptCheckBox: TCheckBox; 27 | ShowPlatformConfigPathCheckBox: TCheckBox; 28 | StartupLoadLastProjectCheckbox: TCheckBox; 29 | HideViewSelectorCheckBox: TCheckBox; 30 | ChangesNeedRestartLabel: TLabel; 31 | EnableReadOnlyEditorMenuItemCheckBox: TCheckBox; 32 | SuppressBuildEventsWarningCheckBox: TCheckBox; 33 | ShowErrorInsightMessagesCheckBox: TCheckBox; 34 | KillProjectProcessCheckBox: TCheckBox; 35 | SysJarsWarningCheckBox: TCheckBox; 36 | public 37 | { IConfigOptionsSection } 38 | function GetRootControl: TControl; 39 | function SectionID: string; 40 | function SectionTitle: string; 41 | procedure Save; 42 | procedure ShowSection; 43 | end; 44 | 45 | var 46 | IDEOptionsView: TIDEOptionsView; 47 | 48 | implementation 49 | 50 | {$R *.dfm} 51 | 52 | uses 53 | Codex.Config; 54 | 55 | { TIDEOptionsView } 56 | 57 | function TIDEOptionsView.GetRootControl: TControl; 58 | begin 59 | Result := RootPanel; 60 | end; 61 | 62 | procedure TIDEOptionsView.Save; 63 | begin 64 | Config.IDE.DisplayWarningOnRunForAppStoreBuild := RunRunInterceptCheckBox.Checked; 65 | Config.IDE.DisplayWarningWhenSysJarsNotFound := SysJarsWarningCheckBox.Checked; 66 | Config.IDE.EnableEditorContextReadOnlyMenuItem := EnableReadOnlyEditorMenuItemCheckBox.Checked; 67 | Config.IDE.HideFormDesignerViewSelector := HideViewSelectorCheckBox.Checked; 68 | Config.IDE.KillProjectProcess := KillProjectProcessCheckBox.Checked; 69 | Config.IDE.LoadProjectLastOpened := StartupLoadLastProjectCheckbox.Checked; 70 | Config.IDE.ShowErrorInsightMessages := ShowErrorInsightMessagesCheckBox.Checked; 71 | Config.IDE.ShowPlatformConfigCaption := ShowPlatformConfigPathCheckBox.Checked; 72 | Config.IDE.ShowProjectManagerOnProjectOpen := ShowProjectManagerCheckBox.Checked; 73 | Config.IDE.SuppressBuildEventsWarning := SuppressBuildEventsWarningCheckBox.Checked; 74 | end; 75 | 76 | function TIDEOptionsView.SectionID: string; 77 | begin 78 | Result := 'IDE'; 79 | end; 80 | 81 | function TIDEOptionsView.SectionTitle: string; 82 | begin 83 | Result := 'IDE'; 84 | end; 85 | 86 | procedure TIDEOptionsView.ShowSection; 87 | begin 88 | RunRunInterceptCheckBox.Checked := Config.IDE.DisplayWarningOnRunForAppStoreBuild; 89 | SysJarsWarningCheckBox.Checked := Config.IDE.DisplayWarningWhenSysJarsNotFound; 90 | EnableReadOnlyEditorMenuItemCheckBox.Checked := Config.IDE.EnableEditorContextReadOnlyMenuItem; 91 | HideViewSelectorCheckBox.Checked := Config.IDE.HideFormDesignerViewSelector; 92 | KillProjectProcessCheckBox.Checked := Config.IDE.KillProjectProcess; 93 | StartupLoadLastProjectCheckbox.Checked := Config.IDE.LoadProjectLastOpened; 94 | ShowErrorInsightMessagesCheckBox.Checked := Config.IDE.ShowErrorInsightMessages; 95 | ShowPlatformConfigPathCheckBox.Checked := Config.IDE.ShowPlatformConfigCaption; 96 | ShowProjectManagerCheckBox.Checked := Config.IDE.ShowProjectManagerOnProjectOpen; 97 | SuppressBuildEventsWarningCheckBox.Checked := Config.IDE.SuppressBuildEventsWarning; 98 | end; 99 | 100 | initialization 101 | TConfigOptionsHelper.RegisterOptions(TIDEOptionsView); 102 | 103 | end. 104 | -------------------------------------------------------------------------------- /Source/Core/Codex.IPAddressView.pas: -------------------------------------------------------------------------------- 1 | unit Codex.IPAddressView; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, 18 | Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls; 19 | 20 | type 21 | TIPAddressView = class(TFrame) 22 | ColonLabel: TLabel; 23 | IPEditPanel: TPanel; 24 | Byte2PeriodLabel: TLabel; 25 | Byte1PeriodLabel: TLabel; 26 | Byte3PeriodLabel: TLabel; 27 | IPByte2Edit: TEdit; 28 | IPByte1Edit: TEdit; 29 | IPByte3Edit: TEdit; 30 | IPByte4Edit: TEdit; 31 | IPPortEdit: TEdit; 32 | procedure IPByteEditChange(Sender: TObject); 33 | procedure IPByteEditKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 34 | procedure IPByteEditKeyPress(Sender: TObject; var Key: Char); 35 | private 36 | FIsValid: Boolean; 37 | FOnChanged: TNotifyEvent; 38 | FOnExecute: TNotifyEvent; 39 | procedure CheckIPAddress; 40 | procedure DoChanged; 41 | procedure DoExecute; 42 | function GetIPAddress: string; 43 | function GetPort: string; 44 | procedure SetIPAddress(const AIP: string); 45 | procedure SetPort(const Value: string); 46 | public 47 | property IP: string read GetIPAddress write SetIPAddress; 48 | property Port: string read GetPort write SetPort; 49 | property IsValid: Boolean read FIsValid; 50 | property OnChanged: TNotifyEvent read FOnChanged write FOnChanged; 51 | property OnExecute: TNotifyEvent read FOnExecute write FOnExecute; 52 | end; 53 | 54 | implementation 55 | 56 | {$R *.dfm} 57 | 58 | uses 59 | System.Character; 60 | 61 | procedure TIPAddressView.IPByteEditKeyUp(Sender: TObject; var Key: Word; Shift: TShiftState); 62 | begin 63 | if (Chr(Key).IsDigit and (Length(TEdit(Sender).Text) = 3)) then 64 | SelectNext(TWinControl(Sender), True, True) 65 | else if Key = VK_RETURN then 66 | DoExecute; 67 | end; 68 | 69 | procedure TIPAddressView.IPByteEditKeyPress(Sender: TObject; var Key: Char); 70 | begin 71 | if (Key = '.') and (Length(TEdit(Sender).Text) > 0) then 72 | SelectNext(TWinControl(Sender), True, True); 73 | if not (CharInSet(Key, [#9, #13, #8]) or Key.IsDigit) then 74 | Key := #0; 75 | end; 76 | 77 | procedure TIPAddressView.IPByteEditChange(Sender: TObject); 78 | begin 79 | CheckIPAddress; 80 | end; 81 | 82 | procedure TIPAddressView.DoChanged; 83 | begin 84 | if Assigned(FOnChanged) then 85 | FOnChanged(Self); 86 | end; 87 | 88 | procedure TIPAddressView.DoExecute; 89 | begin 90 | if Assigned(FOnExecute) then 91 | FOnExecute(Self); 92 | end; 93 | 94 | function TIPAddressView.GetIPAddress: string; 95 | begin 96 | Result := IPByte1Edit.Text + '.' + IPByte2Edit.Text + '.' + IPByte3Edit.Text + '.' + IPByte4Edit.Text; 97 | end; 98 | 99 | function TIPAddressView.GetPort: string; 100 | begin 101 | Result := IPPortEdit.Text; 102 | end; 103 | 104 | procedure TIPAddressView.SetIPAddress(const AIP: string); 105 | var 106 | LParts: TArray; 107 | begin 108 | IPByte1Edit.Text := ''; 109 | IPByte2Edit.Text := ''; 110 | IPByte3Edit.Text := ''; 111 | IPByte4Edit.Text := ''; 112 | LParts := AIP.Split(['.'], 4); 113 | if Length(LParts) = 4 then 114 | begin 115 | IPByte1Edit.Text := LParts[0]; 116 | IPByte2Edit.Text := LParts[1]; 117 | IPByte3Edit.Text := LParts[2]; 118 | IPByte4Edit.Text := LParts[3]; 119 | end; 120 | end; 121 | 122 | procedure TIPAddressView.SetPort(const Value: string); 123 | begin 124 | IPPortEdit.Text := Value; 125 | end; 126 | 127 | procedure TIPAddressView.CheckIPAddress; 128 | var 129 | LParts: TArray; 130 | I, LValue: Integer; 131 | begin 132 | FIsValid := False; 133 | LParts := GetIPAddress.Split(['.'], 4); 134 | if Length(LParts) = 4 then 135 | begin 136 | FIsValid := True; 137 | for I := 0 to 3 do 138 | begin 139 | if not TryStrToInt(LParts[I], LValue) or (LValue > 255) then 140 | begin 141 | FIsValid := False; 142 | Break; 143 | end; 144 | end; 145 | end; 146 | FIsValid := FIsValid and (StrToIntDef(IPPortEdit.Text, 0) > 0); 147 | DoChanged; 148 | end; 149 | 150 | end. 151 | -------------------------------------------------------------------------------- /Source/Core/Codex.Interfaces.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Interfaces; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | System.Classes, System.SysUtils, 18 | Vcl.ActnList, Vcl.ImgList, Vcl.Menus, 19 | ToolsAPI, 20 | Codex.Types; 21 | 22 | type 23 | ICodexView = interface(IInterface) 24 | ['{9DDADBDB-ED6D-43B5-973A-D0137AA41678}'] 25 | end; 26 | 27 | IResourcesModule = interface(IInterface) 28 | ['{837A0A0C-3509-45C2-8860-F61D9BD036F1}'] 29 | procedure AddToolbarActions; 30 | function GetActionList(const AName: string): TActionList; 31 | function GetImageList: TCustomImageList; 32 | procedure LinkAction(const ALinkedAction: TAction); overload; 33 | procedure LinkAction(const AName: string; const AOnExecute: TNotifyEvent; const AOnUpdate: TNotifyEvent = nil); overload; 34 | procedure PerformAction(const AAction: TAction); 35 | end; 36 | 37 | IMoscoProvider = interface(IInterface) 38 | ['{B039D52A-8B08-4EB4-ACB9-75DC4A63E5F1}'] 39 | procedure AddSDKFramework; 40 | procedure DeployIOSApp; 41 | procedure GetAppExtensionFiles(const AFileNames: TArray); 42 | function GetAppExtensionNames: TArray; 43 | procedure ProfileChanged; 44 | procedure ShowDeployedApp; 45 | procedure ShowOptions; 46 | end; 47 | 48 | ICodexProvider = interface(IInterface) 49 | ['{C6C7CBEB-8166-44B6-B8ED-1307200DA4BB}'] 50 | function GetDelphiVersionInfo: TDelphiVersionInfo; 51 | function GetEditorActionList: TActionList; 52 | procedure NotifyContextMenu(const AMenuItem: TMenuItem); 53 | procedure ProjectModified(const AProject: IOTAProject); 54 | end; 55 | 56 | IProjectToolsProvider = interface(IInterface) 57 | ['{3A39F49A-5614-45B2-8959-204593C7B5D4}'] 58 | procedure AddFolders; 59 | procedure BuildProject; 60 | function CanDeployProject: Boolean; 61 | procedure CleanProject; 62 | procedure CompileProject; 63 | procedure DeployAppExtensions(const AFolders: TArray); 64 | procedure DeployProject; 65 | procedure DeployProjectFolder; 66 | function HasActiveProject: Boolean; 67 | procedure InsertProjectPaths; 68 | procedure ShowDeployAppExtensions; 69 | procedure ShowProjectDeployment; 70 | procedure ShowProjectOptions; 71 | procedure TotalCleanProject; 72 | procedure ViewProjectSource; 73 | end; 74 | 75 | IModuleListener = interface(IInterface) 76 | ['{A2605533-E0C4-4ACF-B771-C56F7981AC70}'] 77 | procedure ProjectSaved(const AFileName: string); 78 | procedure SourceSaved(const AFileName: string); 79 | end; 80 | 81 | IModuleNotifier = interface(IInterface) 82 | ['{73294A4F-CE7A-4401-92E2-171D8162207E}'] 83 | procedure AddListener(const AListener: IModuleListener); 84 | end; 85 | 86 | implementation 87 | 88 | end. 89 | -------------------------------------------------------------------------------- /Source/Core/Codex.OutputView.dfm: -------------------------------------------------------------------------------- 1 | object OutputView: TOutputView 2 | Left = 0 3 | Top = 0 4 | Margins.Left = 5 5 | Margins.Top = 5 6 | Margins.Right = 5 7 | Margins.Bottom = 5 8 | Caption = 'Output' 9 | ClientHeight = 767 10 | ClientWidth = 1458 11 | Color = clBtnFace 12 | Font.Charset = DEFAULT_CHARSET 13 | Font.Color = clWindowText 14 | Font.Height = -17 15 | Font.Name = 'Tahoma' 16 | Font.Style = [] 17 | Position = poOwnerFormCenter 18 | PixelsPerInch = 144 19 | TextHeight = 21 20 | object Memo: TMemo 21 | AlignWithMargins = True 22 | Left = 5 23 | Top = 5 24 | Width = 1448 25 | Height = 757 26 | Margins.Left = 5 27 | Margins.Top = 5 28 | Margins.Right = 5 29 | Margins.Bottom = 5 30 | Align = alClient 31 | Font.Charset = DEFAULT_CHARSET 32 | Font.Color = clWindowText 33 | Font.Height = -20 34 | Font.Name = 'Consolas' 35 | Font.Style = [] 36 | ParentFont = False 37 | ScrollBars = ssVertical 38 | TabOrder = 0 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /Source/Core/Codex.OutputView.pas: -------------------------------------------------------------------------------- 1 | unit Codex.OutputView; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 18 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, 19 | Codex.BaseView; 20 | 21 | type 22 | TOutputView = class(TForm) 23 | Memo: TMemo; 24 | public 25 | procedure Clear; 26 | end; 27 | 28 | var 29 | OutputView: TOutputView; 30 | 31 | implementation 32 | 33 | {$R *.dfm} 34 | 35 | { TOutputView } 36 | 37 | procedure TOutputView.Clear; 38 | begin 39 | Memo.Clear; 40 | end; 41 | 42 | end. 43 | -------------------------------------------------------------------------------- /Source/Core/Codex.ProgressView.dfm: -------------------------------------------------------------------------------- 1 | object ProgressView: TProgressView 2 | Left = 0 3 | Top = 0 4 | Margins.Left = 5 5 | Margins.Top = 5 6 | Margins.Right = 5 7 | Margins.Bottom = 5 8 | BorderIcons = [] 9 | BorderStyle = bsToolWindow 10 | ClientHeight = 173 11 | ClientWidth = 533 12 | Color = clBtnFace 13 | Font.Charset = DEFAULT_CHARSET 14 | Font.Color = clWindowText 15 | Font.Height = -17 16 | Font.Name = 'Tahoma' 17 | Font.Style = [] 18 | FormStyle = fsStayOnTop 19 | Position = poOwnerFormCenter 20 | OnResize = FormResize 21 | PixelsPerInch = 144 22 | TextHeight = 21 23 | object StatusLabel: TLabel 24 | AlignWithMargins = True 25 | Left = 3 26 | Top = 3 27 | Width = 527 28 | Height = 89 29 | Margins.Bottom = 0 30 | Align = alClient 31 | Alignment = taCenter 32 | AutoSize = False 33 | Font.Charset = DEFAULT_CHARSET 34 | Font.Color = clWindowText 35 | Font.Height = -20 36 | Font.Name = 'Tahoma' 37 | Font.Style = [] 38 | ParentFont = False 39 | WordWrap = True 40 | end 41 | object BottomPanel: TPanel 42 | Left = 0 43 | Top = 126 44 | Width = 533 45 | Height = 47 46 | Margins.Left = 5 47 | Margins.Top = 5 48 | Margins.Right = 5 49 | Margins.Bottom = 5 50 | Align = alBottom 51 | BevelOuter = bvNone 52 | TabOrder = 0 53 | object CancelButton: TButton 54 | AlignWithMargins = True 55 | Left = 5 56 | Top = 5 57 | Width = 112 58 | Height = 37 59 | Margins.Left = 5 60 | Margins.Top = 5 61 | Margins.Right = 5 62 | Margins.Bottom = 5 63 | Align = alLeft 64 | Cancel = True 65 | Caption = 'Cancel' 66 | DoubleBuffered = True 67 | ModalResult = 2 68 | ParentDoubleBuffered = False 69 | TabOrder = 0 70 | OnClick = CancelButtonClick 71 | end 72 | end 73 | object ProgressBar: TProgressBar 74 | AlignWithMargins = True 75 | Left = 3 76 | Top = 98 77 | Width = 527 78 | Height = 25 79 | Margins.Top = 6 80 | Align = alBottom 81 | TabOrder = 1 82 | end 83 | end 84 | -------------------------------------------------------------------------------- /Source/Core/Codex.ProjectFiles.pas: -------------------------------------------------------------------------------- 1 | unit Codex.ProjectFiles; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | System.JSON; 18 | 19 | type 20 | TProjectFiles = record 21 | private 22 | procedure Load; 23 | procedure ReadProjectFileNames(const AValues: TJSONArray); 24 | function GetProjectFileNamesJSON: TJSONArray; 25 | public 26 | FileName: string; 27 | ProjectFileNames: TArray; 28 | constructor Create(const AFileName: string); 29 | procedure AddFile(const AFileName: string); 30 | procedure RemoveFile(const AIndex: Integer); 31 | procedure Save; 32 | end; 33 | 34 | implementation 35 | 36 | uses 37 | System.IOUtils, 38 | DW.JSON; 39 | 40 | { TProjectFiles } 41 | 42 | constructor TProjectFiles.Create(const AFileName: string); 43 | begin 44 | FileName := AFileName; 45 | if TFile.Exists(FileName) then 46 | Load; 47 | end; 48 | 49 | function TProjectFiles.GetProjectFileNamesJSON: TJSONArray; 50 | var 51 | LProjectFileName: string; 52 | begin 53 | Result := TJSONArray.Create; 54 | for LProjectFileName in ProjectFileNames do 55 | Result.Add(LProjectFileName); 56 | end; 57 | 58 | procedure TProjectFiles.Load; 59 | var 60 | LJSON: TJSONValue; 61 | begin 62 | LJSON := TJSONObject.ParseJSONValue(TFile.ReadAllText(FileName)); 63 | if LJSON <> nil then 64 | try 65 | if LJSON is TJSONArray then 66 | ReadProjectFileNames(TJSONArray(LJSON)); 67 | finally 68 | LJSON.Free; 69 | end; 70 | end; 71 | 72 | procedure TProjectFiles.ReadProjectFileNames(const AValues: TJSONArray); 73 | var 74 | LProjectFileName: TJSONValue; 75 | begin 76 | for LProjectFileName in AValues do 77 | ProjectFileNames := ProjectFileNames + [LProjectFileName.Value]; 78 | end; 79 | 80 | procedure TProjectFiles.AddFile(const AFileName: string); 81 | begin 82 | ProjectFileNames := ProjectFileNames + [AFileName]; 83 | Save; 84 | end; 85 | 86 | procedure TProjectFiles.RemoveFile(const AIndex: Integer); 87 | begin 88 | if (AIndex >= Low(ProjectFileNames)) and (AIndex <= High(ProjectFileNames)) then 89 | begin 90 | Delete(ProjectFileNames, AIndex, 1); 91 | Save; 92 | end; 93 | end; 94 | 95 | procedure TProjectFiles.Save; 96 | var 97 | LJSON: TJSONValue; 98 | begin 99 | LJSON := GetProjectFileNamesJSON; 100 | try 101 | TFile.WriteAllText(FileName, TJSONHelper.Tidy(LJSON.ToJSON)); 102 | finally 103 | LJSON.Free; 104 | end; 105 | end; 106 | 107 | end. 108 | -------------------------------------------------------------------------------- /Source/Core/Codex.ProjectFilesView.dfm: -------------------------------------------------------------------------------- 1 | object ProjectFilesView: TProjectFilesView 2 | Left = 0 3 | Top = 0 4 | ClientHeight = 315 5 | ClientWidth = 624 6 | Color = clBtnFace 7 | Font.Charset = DEFAULT_CHARSET 8 | Font.Color = clWindowText 9 | Font.Height = -12 10 | Font.Name = 'Segoe UI' 11 | Font.Style = [] 12 | Position = poOwnerFormCenter 13 | TextHeight = 15 14 | object ProjectFilesPanel: TPanel 15 | AlignWithMargins = True 16 | Left = 4 17 | Top = 4 18 | Width = 616 19 | Height = 311 20 | Margins.Left = 4 21 | Margins.Top = 4 22 | Margins.Right = 4 23 | Margins.Bottom = 0 24 | Align = alClient 25 | BevelOuter = bvNone 26 | TabOrder = 0 27 | ExplicitWidth = 612 28 | ExplicitHeight = 310 29 | object FilesLabel: TLabel 30 | AlignWithMargins = True 31 | Left = 3 32 | Top = 3 33 | Width = 610 34 | Height = 15 35 | Align = alTop 36 | Caption = 'Project Files:' 37 | ExplicitWidth = 66 38 | end 39 | object FilesButtonsPanel: TPanel 40 | Left = 0 41 | Top = 273 42 | Width = 616 43 | Height = 38 44 | Align = alBottom 45 | BevelOuter = bvNone 46 | TabOrder = 1 47 | ExplicitTop = 272 48 | ExplicitWidth = 612 49 | object RemoveFileButton: TButton 50 | AlignWithMargins = True 51 | Left = 101 52 | Top = 3 53 | Width = 92 54 | Height = 32 55 | Action = RemoveFilesAction 56 | Align = alLeft 57 | TabOrder = 1 58 | end 59 | object AddFileButton: TButton 60 | AlignWithMargins = True 61 | Left = 3 62 | Top = 3 63 | Width = 92 64 | Height = 32 65 | Action = AddFilesAction 66 | Align = alLeft 67 | TabOrder = 0 68 | end 69 | object CloseButton: TButton 70 | AlignWithMargins = True 71 | Left = 521 72 | Top = 3 73 | Width = 92 74 | Height = 32 75 | Align = alRight 76 | Caption = '&Close' 77 | DoubleBuffered = True 78 | ModalResult = 8 79 | ParentDoubleBuffered = False 80 | TabOrder = 2 81 | ExplicitLeft = 517 82 | end 83 | end 84 | object FilesListBox: TListBox 85 | AlignWithMargins = True 86 | Left = 3 87 | Top = 24 88 | Width = 610 89 | Height = 246 90 | Align = alClient 91 | ItemHeight = 15 92 | MultiSelect = True 93 | TabOrder = 0 94 | ExplicitWidth = 606 95 | ExplicitHeight = 245 96 | end 97 | end 98 | object ActionList: TActionList 99 | Left = 59 100 | Top = 39 101 | object AddFilesAction: TAction 102 | Caption = 'Add..' 103 | Hint = 'Add files to the list' 104 | OnExecute = AddFilesActionExecute 105 | end 106 | object RemoveFilesAction: TAction 107 | Caption = 'Remove' 108 | Hint = 'Remove the selected files' 109 | OnExecute = RemoveFilesActionExecute 110 | OnUpdate = RemoveFilesActionUpdate 111 | end 112 | end 113 | object FilesOpenDialog: TFileOpenDialog 114 | FavoriteLinks = <> 115 | FileTypes = <> 116 | Options = [fdoAllowMultiSelect] 117 | Title = 'Select files to add to project file list' 118 | Left = 152 119 | Top = 40 120 | end 121 | end 122 | -------------------------------------------------------------------------------- /Source/Core/Codex.ProjectFilesView.pas: -------------------------------------------------------------------------------- 1 | unit Codex.ProjectFilesView; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 18 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, System.Actions, Vcl.ActnList, Vcl.StdCtrls, Vcl.ExtCtrls, 19 | Codex.BaseView, 20 | Codex.ProjectFiles; 21 | 22 | type 23 | TProjectFilesView = class(TForm) 24 | ActionList: TActionList; 25 | AddFilesAction: TAction; 26 | RemoveFilesAction: TAction; 27 | ProjectFilesPanel: TPanel; 28 | FilesLabel: TLabel; 29 | FilesButtonsPanel: TPanel; 30 | RemoveFileButton: TButton; 31 | AddFileButton: TButton; 32 | FilesListBox: TListBox; 33 | FilesOpenDialog: TFileOpenDialog; 34 | CloseButton: TButton; 35 | procedure AddFilesActionExecute(Sender: TObject); 36 | procedure RemoveFilesActionExecute(Sender: TObject); 37 | procedure RemoveFilesActionUpdate(Sender: TObject); 38 | private 39 | FProjectFiles: TProjectFiles; 40 | FProjectFilesFileName: string; 41 | FProjectName: string; 42 | procedure SetProjectFilesFileName(const Value: string); 43 | procedure SetProjectName(const Value: string); 44 | procedure UpdateProjectFiles; 45 | public 46 | constructor Create(AOwner: TComponent); override; 47 | property ProjectFilesFileName: string read FProjectFilesFileName write SetProjectFilesFileName; 48 | property ProjectName: string read FProjectName write SetProjectName; 49 | end; 50 | 51 | var 52 | ProjectFilesView: TProjectFilesView; 53 | 54 | implementation 55 | 56 | {$R *.dfm} 57 | 58 | uses 59 | System.IOUtils, 60 | DW.Vcl.ListBoxHelper, DW.OTA.Helpers, 61 | Codex.Core, Codex.Consts.Text; 62 | 63 | { TProjectFilesView } 64 | 65 | constructor TProjectFilesView.Create(AOwner: TComponent); 66 | begin 67 | inherited; 68 | TOTAHelper.ApplyTheme(Self); 69 | end; 70 | 71 | procedure TProjectFilesView.SetProjectFilesFileName(const Value: string); 72 | var 73 | LFileName: string; 74 | begin 75 | if Value <> FProjectFilesFileName then 76 | begin 77 | FProjectFilesFileName := Value; 78 | FProjectFiles := TProjectFiles.Create(FProjectFilesFileName); 79 | FilesListBox.Items.Clear; 80 | for LFileName in FProjectFiles.ProjectFileNames do 81 | FilesListBox.Items.Add(LFileName); 82 | end; 83 | end; 84 | 85 | procedure TProjectFilesView.SetProjectName(const Value: string); 86 | begin 87 | FProjectName := Value; 88 | Caption := Format(Babel.Tx(sProjectFilesForProject), [FProjectName]); 89 | end; 90 | 91 | procedure TProjectFilesView.UpdateProjectFiles; 92 | begin 93 | FProjectFiles.ProjectFileNames := FilesListBox.Items.ToStringArray; 94 | FProjectFiles.Save; 95 | end; 96 | 97 | procedure TProjectFilesView.AddFilesActionExecute(Sender: TObject); 98 | var 99 | I: Integer; 100 | LIsChanged: Boolean; 101 | begin 102 | if FilesOpenDialog.Execute then 103 | begin 104 | LIsChanged := False; 105 | for I := 0 to FilesOpenDialog.Files.Count - 1 do 106 | begin 107 | if FilesListBox.Items.IndexOf(FilesOpenDialog.Files[I]) = -1 then 108 | begin 109 | FilesListBox.Items.Add(FilesOpenDialog.Files[I]); 110 | LIsChanged := True; 111 | end; 112 | end; 113 | if LIsChanged then 114 | UpdateProjectFiles; 115 | end; 116 | end; 117 | 118 | procedure TProjectFilesView.RemoveFilesActionExecute(Sender: TObject); 119 | begin 120 | FilesListBox.DeletedSelected; 121 | UpdateProjectFiles; 122 | end; 123 | 124 | procedure TProjectFilesView.RemoveFilesActionUpdate(Sender: TObject); 125 | begin 126 | RemoveFilesAction.Enabled := FilesListBox.HasSelections; 127 | end; 128 | 129 | end. 130 | -------------------------------------------------------------------------------- /Source/Core/Codex.ProjectNotifier.pas: -------------------------------------------------------------------------------- 1 | unit Codex.ProjectNotifier; 2 | 3 | interface 4 | 5 | uses 6 | ToolsAPI, 7 | DW.OTA.Notifiers; 8 | 9 | type 10 | TCodexProjectNotifier = class(TInterfacedObject, IOTANotifier, IOTAModuleNotifier) 11 | private 12 | FFileName: string; 13 | function ModuleServices: IOTAModuleServices; 14 | public 15 | { IOTANotifier } 16 | procedure AfterSave; 17 | procedure BeforeSave; 18 | procedure Destroyed; 19 | procedure Modified; 20 | { IOTAModuleNotifier } 21 | function CheckOverwrite: Boolean; 22 | procedure ModuleRenamed(const NewName: string); 23 | public 24 | constructor Create(const AFileName: string); 25 | end; 26 | 27 | implementation 28 | 29 | uses 30 | System.SysUtils, 31 | Codex.Core; 32 | 33 | { TCodexProjectNotifier } 34 | 35 | constructor TCodexProjectNotifier.Create(const AFileName: string); 36 | begin 37 | inherited Create; 38 | FFileName := AFileName; 39 | end; 40 | 41 | function TCodexProjectNotifier.ModuleServices: IOTAModuleServices; 42 | begin 43 | Result := BorlandIDEServices as IOTAModuleServices; 44 | end; 45 | 46 | procedure TCodexProjectNotifier.AfterSave; 47 | begin 48 | // 49 | end; 50 | 51 | procedure TCodexProjectNotifier.BeforeSave; 52 | begin 53 | // 54 | end; 55 | 56 | procedure TCodexProjectNotifier.Destroyed; 57 | begin 58 | // 59 | end; 60 | 61 | procedure TCodexProjectNotifier.Modified; 62 | var 63 | LModule: IOTAModule; 64 | LProject: IOTAProject; 65 | begin 66 | LModule := ModuleServices.FindModule(FFileName); 67 | if Supports(LModule, IOTAProject, LProject) then 68 | CodexProvider.ProjectModified(LProject); 69 | end; 70 | 71 | function TCodexProjectNotifier.CheckOverwrite: Boolean; 72 | begin 73 | Result := True; 74 | end; 75 | 76 | procedure TCodexProjectNotifier.ModuleRenamed(const NewName: string); 77 | begin 78 | // 79 | end; 80 | 81 | end. 82 | -------------------------------------------------------------------------------- /Source/Core/Codex.ResourcesModule.pas: -------------------------------------------------------------------------------- 1 | unit Codex.ResourcesModule; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | System.SysUtils, System.Classes, System.ImageList, Vcl.ImgList, Vcl.Controls, System.Actions, Vcl.ActnList, Vcl.BaseImageCollection, 18 | Vcl.ImageCollection, Vcl.VirtualImageList, 19 | Codex.CustomResourcesModule; 20 | 21 | type 22 | TCodexResourcesModule = class(TDataModule) 23 | ActionList: TActionList; 24 | GotoInterfaceUsesAction: TAction; 25 | GotoImplementationUsesAction: TAction; 26 | VirtualImageList: TVirtualImageList; 27 | ImageCollection: TImageCollection; 28 | EnvVarsAction: TAction; 29 | SDKManagerAction: TAction; 30 | KillLSPAction: TAction; 31 | PathSetsAction: TAction; 32 | AskAIAction: TAction; 33 | EditorActionList: TActionList; 34 | CodexEditorAction: TAction; 35 | AddToProjectAction: TAction; 36 | procedure CodexEditorActionExecute(Sender: TObject); 37 | public 38 | constructor Create(AOwner: TComponent); override; 39 | end; 40 | 41 | implementation 42 | 43 | {%CLASSGROUP 'Vcl.Controls.TControl'} 44 | 45 | {$R *.dfm} 46 | 47 | uses 48 | ToolsAPI, 49 | DW.OTA.Helpers, 50 | DW.OSLog, 51 | Codex.Core, Codex.Consts.Text; 52 | 53 | { TCodexResourcesModule } 54 | 55 | constructor TCodexResourcesModule.Create(AOwner: TComponent); 56 | begin 57 | inherited; 58 | CodexResources := Self; 59 | AddToProjectAction.Caption := Babel.Tx(sAddToProjectMenuCaption); 60 | end; 61 | 62 | procedure TCodexResourcesModule.CodexEditorActionExecute(Sender: TObject); 63 | begin 64 | // This handler needs to be here in order for the menu item to be enabled 65 | end; 66 | 67 | end. 68 | -------------------------------------------------------------------------------- /Source/Helpers/DW.Vcl.ExtendedLabel.pas: -------------------------------------------------------------------------------- 1 | unit DW.Vcl.ExtendedLabel; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Messages, 7 | Vcl.Controls, Vcl.StdCtrls; 8 | 9 | type 10 | TLabel = class(Vcl.StdCtrls.TLabel) 11 | private 12 | function IsLink: Boolean; 13 | procedure CMMouseEnter(var Message: TMessage); message CM_MOUSEENTER; 14 | procedure CMMouseLeave(var Message: TMessage); message CM_MOUSELEAVE; 15 | end; 16 | 17 | implementation 18 | 19 | uses 20 | BrandingAPI, 21 | Vcl.Graphics; 22 | 23 | { TLabel } 24 | 25 | procedure TLabel.CMMouseEnter(var Message: TMessage); 26 | begin 27 | inherited; 28 | if IsLink then 29 | Font.Style := Font.Style + [TFontStyle.fsUnderline]; 30 | end; 31 | 32 | procedure TLabel.CMMouseLeave(var Message: TMessage); 33 | begin 34 | inherited; 35 | if IsLink then 36 | Font.Style := Font.Style - [TFontStyle.fsUnderline]; 37 | end; 38 | 39 | function TLabel.IsLink: Boolean; 40 | begin 41 | Result := Font.Color = ThemeProperties.LinkColor; 42 | end; 43 | 44 | end. 45 | -------------------------------------------------------------------------------- /Source/Helpers/DW.Vcl.ExtendedListBox.pas: -------------------------------------------------------------------------------- 1 | unit DW.Vcl.ExtendedListBox; 2 | 3 | interface 4 | 5 | uses 6 | System.Classes, 7 | Vcl.StdCtrls; 8 | 9 | type 10 | TListBox = class(Vcl.StdCtrls.TListBox) 11 | private 12 | procedure CopySelectedToClipboard; 13 | protected 14 | procedure KeyDown(var Key: Word; Shift: TShiftState); override; 15 | public 16 | procedure CopyToClipboard(const AAll: Boolean = True); 17 | function HasSelections: Boolean; 18 | function SelectedCount: Integer; 19 | function SelectedItem: string; 20 | function SelectItem(const AItem: string): Integer; 21 | function SelectLastItem: Boolean; 22 | end; 23 | 24 | implementation 25 | 26 | uses 27 | Vcl.Clipbrd; 28 | 29 | { TListBox } 30 | 31 | procedure TListBox.CopySelectedToClipboard; 32 | var 33 | I: Integer; 34 | LItems: TStrings; 35 | begin 36 | LItems := TStringList.Create; 37 | try 38 | for I := 0 to Count - 1 do 39 | begin 40 | if Selected[I] then 41 | LItems.Add(Items[I]); 42 | end; 43 | Clipboard.AsText := LItems.Text; 44 | finally 45 | LItems.Free; 46 | end; 47 | end; 48 | 49 | procedure TListBox.CopyToClipboard(const AAll: Boolean = True); 50 | begin 51 | if AAll then 52 | Clipboard.AsText := Items.Text 53 | else 54 | CopySelectedToClipboard; 55 | end; 56 | 57 | function TListBox.HasSelections: Boolean; 58 | begin 59 | Result := SelectedCount > 0; 60 | end; 61 | 62 | procedure TListBox.KeyDown(var Key: Word; Shift: TShiftState); 63 | begin 64 | inherited; 65 | if (ssCtrl in Shift) and (Key = Ord('C')) then 66 | CopyToClipboard(not (ssShift in Shift)); 67 | end; 68 | 69 | function TListBox.SelectedCount: Integer; 70 | var 71 | I: Integer; 72 | begin 73 | Result := 0; 74 | for I := 0 to Count - 1 do 75 | begin 76 | if Selected[I] then 77 | Inc(Result); 78 | end; 79 | end; 80 | 81 | function TListBox.SelectedItem: string; 82 | begin 83 | Result := ''; 84 | if ItemIndex > -1 then 85 | Result := Items[ItemIndex]; 86 | end; 87 | 88 | function TListBox.SelectItem(const AItem: string): Integer; 89 | begin 90 | Result := Items.IndexOf(AItem); 91 | if Result > -1 then 92 | ItemIndex := Result; 93 | end; 94 | 95 | function TListBox.SelectLastItem: Boolean; 96 | begin 97 | if ItemIndex = -1 then 98 | ItemIndex := Count - 1; 99 | Result := ItemIndex > -1; 100 | end; 101 | 102 | 103 | end. 104 | -------------------------------------------------------------------------------- /Source/Helpers/DW.Vcl.Splitter.Themed.pas: -------------------------------------------------------------------------------- 1 | unit DW.Vcl.Splitter.Themed; 2 | 3 | interface 4 | 5 | uses 6 | Vcl.ExtCtrls; 7 | 8 | type 9 | TSplitter = class(Vcl.ExtCtrls.TSplitter) 10 | protected 11 | procedure Paint; override; 12 | end; 13 | 14 | implementation 15 | 16 | uses 17 | BrandingAPI, IDETheme.Utils; 18 | 19 | { TSplitter } 20 | 21 | procedure TSplitter.Paint; 22 | begin 23 | if ThemeProperties <> nil then 24 | TIDEThemeDrawers.DrawSplitter(Self, ThemeProperties.MainWindowBorderColor, ThemeProperties.MainWindowBorderColor) 25 | else 26 | inherited; 27 | end; 28 | 29 | end. -------------------------------------------------------------------------------- /Source/Icon.bmp: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Source/Icon.bmp -------------------------------------------------------------------------------- /Source/Icon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DelphiWorlds/Codex/f56fd59f5fa377af7fe8f0a7b6b34c7416b7168a/Source/Icon.ico -------------------------------------------------------------------------------- /Source/Icon.rc: -------------------------------------------------------------------------------- 1 | SplashScreenBitmap BITMAP "Icon.bmp" 2 | -------------------------------------------------------------------------------- /Source/Lang.rc: -------------------------------------------------------------------------------- 1 | babel RCDATA "lang.json" 2 | -------------------------------------------------------------------------------- /Source/Modules/Codex.Modules.Wizard.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Modules.Wizard; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | implementation 17 | 18 | uses 19 | System.Classes, System.SysUtils, 20 | ToolsAPI, 21 | Vcl.Controls, Vcl.Menus, Vcl.Dialogs, 22 | DW.OTA.Wizard, DW.OTA.ProjectManagerMenu, DW.OTA.Helpers, DW.Menus.Helpers, 23 | Codex.Consts, Codex.Modules.Types, Codex.Modules.DuplicateModuleView, Codex.Core, Codex.Consts.Text; 24 | 25 | type 26 | TModulesWizard = class(TWizard) 27 | private 28 | FProcessor: TFormTemplateProcessor; 29 | procedure DuplicateModuleActionHandler(Sender: TObject); 30 | procedure InsertMenu; 31 | protected 32 | procedure IDEStarted; override; 33 | public 34 | constructor Create; override; 35 | destructor Destroy; override; 36 | end; 37 | 38 | { TModulesWizard } 39 | 40 | constructor TModulesWizard.Create; 41 | begin 42 | inherited; 43 | FProcessor := TFormTemplateProcessor.Create; 44 | end; 45 | 46 | destructor TModulesWizard.Destroy; 47 | begin 48 | FProcessor.Free; 49 | inherited; 50 | end; 51 | 52 | procedure TModulesWizard.IDEStarted; 53 | begin 54 | inherited; 55 | InsertMenu; 56 | end; 57 | 58 | procedure TModulesWizard.InsertMenu; 59 | var 60 | LComponent: TComponent; 61 | LCustomizeMenu, LParent, LMenuItem: TMenuItem; 62 | begin 63 | if TOTAHelper.FindComponentGlobal('mnuCustomize', LComponent) then 64 | begin 65 | LCustomizeMenu := TMenuItem(LComponent); 66 | LParent := LCustomizeMenu.Parent; 67 | LMenuItem := TMenuItem.CreateWithAction(LParent, Babel.Tx(sDuplicateModuleCaption), DuplicateModuleActionHandler); 68 | LParent.Insert(LCustomizeMenu.MenuIndex, LMenuItem); 69 | LMenuItem := TMenuItem.Create(LParent); 70 | LMenuItem.Caption := '-'; 71 | LParent.Insert(LCustomizeMenu.MenuIndex, LMenuItem); 72 | end; 73 | end; 74 | 75 | // DuplicateModule allows the user to select an existing module (i.e. form, frame or datamodule) and duplicate the code/UI with a different name 76 | // The new module can optionally be added to the current project 77 | procedure TModulesWizard.DuplicateModuleActionHandler(Sender: TObject); 78 | var 79 | LForm: TDuplicateModuleView; 80 | LProject: IOTAProject; 81 | LFileName: string; 82 | begin 83 | LForm := TDuplicateModuleView.Create(nil); 84 | try 85 | if LForm.ShowModal = mrOK then 86 | begin 87 | if FProcessor.Execute(LForm.ModuleInfo.SourceID, LForm.ModuleInfo.TargetID, LForm.ModuleInfo.NewName) then 88 | begin 89 | LProject := TOTAHelper.GetActiveProject; 90 | LFileName := LForm.ModuleInfo.TargetID + '.pas'; 91 | if LForm.ModuleInfo.WantAddToProject and (LProject <> nil) then 92 | LProject.AddFile(LFileName, True) 93 | else 94 | TOTAHelper.OpenFile(LFileName); 95 | end; 96 | end; 97 | finally 98 | LForm.Free; 99 | end; 100 | end; 101 | 102 | initialization 103 | TOTAWizard.RegisterWizard(TModulesWizard); 104 | 105 | end. 106 | -------------------------------------------------------------------------------- /Source/Mosco/Codex.Mosco.AddSDKFrameworkView.dfm: -------------------------------------------------------------------------------- 1 | object AddSDKFrameworkView: TAddSDKFrameworkView 2 | Left = 0 3 | Top = 0 4 | Caption = 'Add SDK Frameworks' 5 | ClientHeight = 712 6 | ClientWidth = 354 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | Position = poOwnerFormCenter 14 | TextHeight = 13 15 | object SDKsLabel: TLabel 16 | AlignWithMargins = True 17 | Left = 3 18 | Top = 3 19 | Width = 348 20 | Height = 13 21 | Align = alTop 22 | Caption = 'SDKs on the Mac:' 23 | ExplicitWidth = 84 24 | end 25 | object FrameworksLabel: TLabel 26 | AlignWithMargins = True 27 | Left = 3 28 | Top = 153 29 | Width = 348 30 | Height = 13 31 | Margins.Top = 0 32 | Align = alTop 33 | Caption = 'Frameworks:' 34 | ExplicitWidth = 62 35 | end 36 | object BottomPanel: TPanel 37 | Left = 0 38 | Top = 678 39 | Width = 354 40 | Height = 34 41 | Align = alBottom 42 | BevelOuter = bvNone 43 | Padding.Left = 4 44 | Padding.Top = 4 45 | Padding.Right = 4 46 | Padding.Bottom = 4 47 | TabOrder = 0 48 | object CloseButton: TButton 49 | AlignWithMargins = True 50 | Left = 266 51 | Top = 4 52 | Width = 84 53 | Height = 26 54 | Margins.Left = 8 55 | Margins.Top = 0 56 | Margins.Right = 0 57 | Margins.Bottom = 0 58 | Align = alRight 59 | Caption = 'Close' 60 | ModalResult = 8 61 | TabOrder = 0 62 | end 63 | object AddFrameworksButton: TButton 64 | Left = 174 65 | Top = 4 66 | Width = 84 67 | Height = 26 68 | Margins.Left = 0 69 | Margins.Top = 0 70 | Margins.Right = 0 71 | Margins.Bottom = 0 72 | Action = AddFrameworksAction 73 | Align = alRight 74 | TabOrder = 1 75 | end 76 | end 77 | object SDKsListBox: TListBox 78 | Tag = -1 79 | AlignWithMargins = True 80 | Left = 3 81 | Top = 19 82 | Width = 348 83 | Height = 78 84 | Margins.Top = 0 85 | Margins.Bottom = 5 86 | Align = alTop 87 | ItemHeight = 13 88 | TabOrder = 1 89 | OnClick = SDKsListBoxClick 90 | end 91 | object FrameworksListBox: TCheckListBox 92 | AlignWithMargins = True 93 | Left = 3 94 | Top = 169 95 | Width = 348 96 | Height = 504 97 | Margins.Top = 0 98 | Margins.Bottom = 5 99 | Align = alClient 100 | ItemHeight = 13 101 | TabOrder = 2 102 | end 103 | object MatchingSDKPanel: TPanel 104 | Left = 0 105 | Top = 102 106 | Width = 354 107 | Height = 51 108 | Align = alTop 109 | BevelOuter = bvNone 110 | TabOrder = 3 111 | object MatchingSDKLabel: TLabel 112 | AlignWithMargins = True 113 | Left = 3 114 | Top = 0 115 | Width = 348 116 | Height = 13 117 | Margins.Top = 0 118 | Align = alTop 119 | Caption = 'Matching imported SDK:' 120 | ExplicitWidth = 114 121 | end 122 | object MatchingSDKEdit: TEdit 123 | AlignWithMargins = True 124 | Left = 3 125 | Top = 19 126 | Width = 348 127 | Height = 21 128 | Align = alTop 129 | ReadOnly = True 130 | TabOrder = 0 131 | end 132 | end 133 | object ActionList: TActionList 134 | Left = 280 135 | Top = 168 136 | object AddFrameworksAction: TAction 137 | Caption = 'Add..' 138 | OnExecute = AddFrameworksActionExecute 139 | OnUpdate = AddFrameworksActionUpdate 140 | end 141 | end 142 | end 143 | -------------------------------------------------------------------------------- /Source/Mosco/Codex.Mosco.Consts.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Mosco.Consts; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | const 17 | cMoscoShowDeployedAppMenuItemName = 'ShowDeployedAppMenuItem'; 18 | 19 | cRegistryPathPlatformSDKs = '\PlatformSDKs'; 20 | cRegistryPathRemoteProfiles = '\RemoteProfiles'; 21 | cRegistryValuePathFrameworks = '$(SDKROOT)/System/Library/Frameworks'; 22 | cRegistryValueKeySDKDisplayName = 'SDKDisplayName'; 23 | cRegistryValueKeyIncludeSubDir = 'IncludeSubDir'; 24 | cRegistryValueKeyMask = 'Mask'; 25 | cRegistryValueKeyPath = 'Path'; 26 | cRegistryValueKeyType = 'Type'; 27 | cRegistryValueTypeFramework = 2; 28 | 29 | cRegistryValueIncludeSubDirValues: array[Boolean] of string = ('0', '1'); 30 | 31 | cMoscoOptionsSectionID = 'Mosco'; 32 | cMoscoOptionsSectionTitle = 'Mosco'; // Do not localize 33 | 34 | implementation 35 | 36 | end. 37 | -------------------------------------------------------------------------------- /Source/Mosco/Codex.Mosco.ImportXcodeFilesView.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Mosco.ImportXcodeFilesView; 2 | 3 | interface 4 | 5 | uses 6 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 7 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Buttons, 8 | {$IF Defined(EXPERT)} 9 | Codex.BaseView; 10 | {$ENDIF} 11 | 12 | type 13 | TImportXcodeFilesView = class(TForm) 14 | BottomPanel: TPanel; 15 | CloseButton: TButton; 16 | AddFrameworksButton: TButton; 17 | TargetPathPanel: TPanel; 18 | SelectTargetPathButton: TSpeedButton; 19 | TargetPathLabel: TLabel; 20 | TargetPathEdit: TEdit; 21 | SDKLabel: TLabel; 22 | XcodePathLabel: TLabel; 23 | XcodePathComboBox: TComboBox; 24 | XcodeSubfolderLabel: TLabel; 25 | XcodeSubfolderEdit: TEdit; 26 | SDKComboBox: TComboBox; 27 | FileTypesLabel: TLabel; 28 | FileTypesEdit: TEdit; 29 | private 30 | { Private declarations } 31 | public 32 | { Public declarations } 33 | end; 34 | 35 | var 36 | ImportXcodeFilesView: TImportXcodeFilesView; 37 | 38 | implementation 39 | 40 | {$R *.dfm} 41 | 42 | end. 43 | -------------------------------------------------------------------------------- /Source/Options/Codex.Options.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Options; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Vcl.Controls, Vcl.Forms; 18 | 19 | type 20 | IConfigOptionsSection = interface(IInterface) 21 | ['{6BC3FBEB-5150-419A-900C-B5E2D59C5E0D}'] 22 | function GetRootControl: TControl; 23 | function SectionID: string; 24 | function SectionTitle: string; 25 | procedure Save; 26 | procedure ShowSection; 27 | end; 28 | 29 | IConfigOptionsHost = interface(IInterface) 30 | ['{C9FB3E6C-ADE3-478D-9CFC-C334CF90F23A}'] 31 | procedure ShowOptions(const ASectionID: string); 32 | end; 33 | 34 | TConfigOptionsHelper = record 35 | private 36 | class var FHost: IConfigOptionsHost; 37 | public 38 | class var Options: TArray; 39 | class procedure RegisterHost(const AHost: IConfigOptionsHost); static; 40 | class procedure RegisterOptions(const AOptionsClass: TFormClass); static; 41 | class procedure ShowOptions(const ASectionID: string); static; 42 | end; 43 | 44 | implementation 45 | 46 | uses 47 | System.SysUtils; 48 | 49 | { TConfigOptionsHelper } 50 | 51 | class procedure TConfigOptionsHelper.RegisterHost(const AHost: IConfigOptionsHost); 52 | begin 53 | FHost := AHost; 54 | end; 55 | 56 | class procedure TConfigOptionsHelper.RegisterOptions(const AOptionsClass: TFormClass); 57 | begin 58 | Options := Options + [AOptionsClass]; 59 | end; 60 | 61 | class procedure TConfigOptionsHelper.ShowOptions(const ASectionID: string); 62 | begin 63 | if FHost <> nil then 64 | FHost.ShowOptions(ASectionID); 65 | end; 66 | 67 | end. 68 | -------------------------------------------------------------------------------- /Source/Options/Codex.OptionsView.dfm: -------------------------------------------------------------------------------- 1 | object OptionsView: TOptionsView 2 | Left = 0 3 | Top = 0 4 | Caption = 'Codex Options' 5 | ClientHeight = 604 6 | ClientWidth = 802 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | Position = poOwnerFormCenter 14 | TextHeight = 13 15 | object SectionSplitter: TSplitter 16 | Left = 212 17 | Top = 0 18 | Width = 4 19 | Height = 570 20 | ExplicitHeight = 553 21 | end 22 | object CommandButtonsPanel: TPanel 23 | Left = 0 24 | Top = 570 25 | Width = 802 26 | Height = 34 27 | Align = alBottom 28 | BevelOuter = bvNone 29 | TabOrder = 0 30 | object CancelButton: TButton 31 | AlignWithMargins = True 32 | Left = 724 33 | Top = 3 34 | Width = 75 35 | Height = 28 36 | Align = alRight 37 | Cancel = True 38 | Caption = 'Cancel' 39 | DoubleBuffered = True 40 | ModalResult = 2 41 | ParentDoubleBuffered = False 42 | TabOrder = 0 43 | end 44 | object OKButton: TButton 45 | AlignWithMargins = True 46 | Left = 643 47 | Top = 3 48 | Width = 75 49 | Height = 28 50 | Align = alRight 51 | Caption = 'OK' 52 | Default = True 53 | DoubleBuffered = True 54 | ParentDoubleBuffered = False 55 | TabOrder = 1 56 | OnClick = OKButtonClick 57 | end 58 | end 59 | object SectionsTreeView: TTreeView 60 | AlignWithMargins = True 61 | Left = 3 62 | Top = 3 63 | Width = 206 64 | Height = 564 65 | Align = alLeft 66 | HideSelection = False 67 | Indent = 19 68 | MultiSelectStyle = [] 69 | ReadOnly = True 70 | RowSelect = True 71 | ShowButtons = False 72 | ShowLines = False 73 | TabOrder = 1 74 | OnChange = SectionsTreeViewChange 75 | end 76 | object SectionPanel: TPanel 77 | AlignWithMargins = True 78 | Left = 219 79 | Top = 3 80 | Width = 580 81 | Height = 564 82 | Align = alClient 83 | BevelOuter = bvNone 84 | TabOrder = 2 85 | end 86 | end 87 | -------------------------------------------------------------------------------- /Source/Options/Codex.OptionsView.pas: -------------------------------------------------------------------------------- 1 | unit Codex.OptionsView; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 18 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls, Vcl.ComCtrls, 19 | DW.Vcl.Splitter.Themed, 20 | Codex.BaseView; 21 | 22 | type 23 | TOptionsView = class(TForm) 24 | CommandButtonsPanel: TPanel; 25 | CancelButton: TButton; 26 | OKButton: TButton; 27 | SectionsTreeView: TTreeView; 28 | SectionPanel: TPanel; 29 | SectionSplitter: TSplitter; 30 | procedure SectionsTreeViewChange(Sender: TObject; Node: TTreeNode); 31 | procedure OKButtonClick(Sender: TObject); 32 | private 33 | FSectionID: string; 34 | procedure CreateOptions; 35 | protected 36 | procedure DoShow; override; 37 | public 38 | constructor Create(AOwner: TComponent); override; 39 | function ShowOptions(const ASectionID: string): Boolean; 40 | end; 41 | 42 | var 43 | OptionsView: TOptionsView; 44 | 45 | implementation 46 | 47 | {$R *.dfm} 48 | 49 | uses 50 | DW.OTA.Helpers, 51 | Codex.Options, Codex.Config; 52 | 53 | { TOptionsView } 54 | 55 | constructor TOptionsView.Create(AOwner: TComponent); 56 | begin 57 | inherited; 58 | CreateOptions; 59 | end; 60 | 61 | procedure TOptionsView.CreateOptions; 62 | var 63 | LClass: TFormClass; 64 | LForm: Vcl.Forms.TForm; 65 | LSection: IConfigOptionsSection; 66 | begin 67 | for LClass in TConfigOptionsHelper.Options do 68 | begin 69 | LForm := LClass.Create(Self); 70 | if Supports(LForm, IConfigOptionsSection, LSection) then 71 | begin 72 | LSection.ShowSection; 73 | SectionsTreeView.Items.AddChild(nil, LSection.SectionTitle).Data := LSection; 74 | end; 75 | end; 76 | end; 77 | 78 | procedure TOptionsView.DoShow; 79 | var 80 | LSection: IConfigOptionsSection; 81 | I: Integer; 82 | begin 83 | inherited; 84 | for I := 0 to SectionsTreeView.Items.Count - 1 do 85 | begin 86 | LSection := IConfigOptionsSection(SectionsTreeView.Items[I].Data); 87 | if LSection.SectionID.Equals(FSectionID) then 88 | SectionsTreeView.Selected := SectionsTreeView.Items[I]; 89 | end; 90 | if SectionsTreeView.Selected = nil then 91 | SectionsTreeView.Selected := SectionsTreeView.TopItem; 92 | end; 93 | 94 | procedure TOptionsView.OKButtonClick(Sender: TObject); 95 | var 96 | I: Integer; 97 | begin 98 | for I := 0 to SectionsTreeView.Items.Count - 1 do 99 | IConfigOptionsSection(SectionsTreeView.Items[I].Data).Save; 100 | Config.Save; 101 | ModalResult := mrOk; // This is here in case I change my mind later about not being able to save 102 | end; 103 | 104 | procedure TOptionsView.SectionsTreeViewChange(Sender: TObject; Node: TTreeNode); 105 | var 106 | LSection: IConfigOptionsSection; 107 | LRoot: TControl; 108 | begin 109 | LSection := IConfigOptionsSection(Node.Data); 110 | LRoot := LSection.GetRootControl; 111 | if LRoot.Parent <> SectionPanel then 112 | begin 113 | LRoot.Parent := SectionPanel; 114 | LSection.ShowSection; 115 | end; 116 | LRoot.Visible := True; 117 | LRoot.BringToFront; 118 | end; 119 | 120 | function TOptionsView.ShowOptions(const ASectionID: string): Boolean; 121 | begin 122 | if not ASectionID.IsEmpty then 123 | FSectionID := ASectionID; 124 | Result := ShowModal = mrOK; 125 | end; 126 | 127 | end. 128 | -------------------------------------------------------------------------------- /Source/Project/Codex.Project.CommonPathsView.dfm: -------------------------------------------------------------------------------- 1 | object CommonPathsView: TCommonPathsView 2 | Left = 0 3 | Top = 0 4 | Caption = 'Common Paths' 5 | ClientHeight = 451 6 | ClientWidth = 572 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | Position = poOwnerFormCenter 14 | TextHeight = 13 15 | object CommandButtonsPanel: TPanel 16 | Left = 0 17 | Top = 417 18 | Width = 572 19 | Height = 34 20 | Align = alBottom 21 | BevelOuter = bvNone 22 | TabOrder = 0 23 | object MessageLabel: TLabel 24 | AlignWithMargins = True 25 | Left = 6 26 | Top = 3 27 | Width = 367 28 | Height = 28 29 | Margins.Left = 6 30 | Align = alClient 31 | Caption = 'Copied to clipboard' 32 | Layout = tlCenter 33 | ExplicitWidth = 92 34 | ExplicitHeight = 13 35 | end 36 | object CopyButton: TButton 37 | AlignWithMargins = True 38 | Left = 379 39 | Top = 3 40 | Width = 92 41 | Height = 28 42 | Align = alRight 43 | Caption = 'Copy' 44 | TabOrder = 0 45 | OnClick = CopyActionExecute 46 | end 47 | object CloseButton: TButton 48 | AlignWithMargins = True 49 | Left = 477 50 | Top = 3 51 | Width = 92 52 | Height = 28 53 | Align = alRight 54 | Caption = 'Close' 55 | DoubleBuffered = True 56 | ModalResult = 8 57 | ParentDoubleBuffered = False 58 | TabOrder = 1 59 | end 60 | end 61 | object RecentProjectsPanel: TPanel 62 | AlignWithMargins = True 63 | Left = 4 64 | Top = 4 65 | Width = 564 66 | Height = 153 67 | Margins.Left = 4 68 | Margins.Top = 4 69 | Margins.Right = 4 70 | Margins.Bottom = 0 71 | Align = alTop 72 | BevelOuter = bvNone 73 | TabOrder = 1 74 | object ProjectsLabel: TLabel 75 | AlignWithMargins = True 76 | Left = 3 77 | Top = 3 78 | Width = 558 79 | Height = 13 80 | Align = alTop 81 | Caption = 'Projects:' 82 | ExplicitWidth = 43 83 | end 84 | object FileButtonsPanel: TPanel 85 | Left = 0 86 | Top = 121 87 | Width = 564 88 | Height = 32 89 | Align = alBottom 90 | BevelOuter = bvNone 91 | TabOrder = 1 92 | object RemoveFileButton: TButton 93 | AlignWithMargins = True 94 | Left = 469 95 | Top = 3 96 | Width = 92 97 | Height = 26 98 | Action = RemoveProjectAction 99 | Align = alRight 100 | TabOrder = 1 101 | end 102 | object AddFileButton: TButton 103 | AlignWithMargins = True 104 | Left = 371 105 | Top = 3 106 | Width = 92 107 | Height = 26 108 | Action = AddProjectAction 109 | Align = alRight 110 | TabOrder = 0 111 | end 112 | end 113 | object ProjectsListBox: TListBox 114 | AlignWithMargins = True 115 | Left = 3 116 | Top = 22 117 | Width = 558 118 | Height = 96 119 | Align = alClient 120 | ItemHeight = 13 121 | MultiSelect = True 122 | TabOrder = 0 123 | OnClick = ProjectsListBoxClick 124 | end 125 | end 126 | object ProjectPathsPanel: TPanel 127 | AlignWithMargins = True 128 | Left = 3 129 | Top = 193 130 | Width = 566 131 | Height = 221 132 | Align = alClient 133 | BevelOuter = bvNone 134 | TabOrder = 2 135 | object ProjectPathsLabel: TLabel 136 | AlignWithMargins = True 137 | Left = 3 138 | Top = 3 139 | Width = 560 140 | Height = 13 141 | Align = alTop 142 | Caption = 'Project Paths:' 143 | ExplicitWidth = 68 144 | end 145 | object ProjectPathsListBox: TListBox 146 | AlignWithMargins = True 147 | Left = 3 148 | Top = 22 149 | Width = 560 150 | Height = 196 151 | Align = alClient 152 | ItemHeight = 13 153 | TabOrder = 0 154 | end 155 | end 156 | object ConfigPanel: TPanel 157 | AlignWithMargins = True 158 | Left = 3 159 | Top = 160 160 | Width = 566 161 | Height = 27 162 | Align = alTop 163 | BevelOuter = bvNone 164 | TabOrder = 3 165 | end 166 | object ActionList: TActionList 167 | Left = 160 168 | Top = 245 169 | object AddProjectAction: TAction 170 | Caption = 'Add..' 171 | OnExecute = AddProjectActionExecute 172 | end 173 | object RemoveProjectAction: TAction 174 | Caption = 'Remove' 175 | OnExecute = RemoveProjectActionExecute 176 | OnUpdate = RemoveProjectActionUpdate 177 | end 178 | object CopyAction: TAction 179 | Caption = 'Copy' 180 | OnExecute = CopyActionExecute 181 | OnUpdate = CopyActionUpdate 182 | end 183 | end 184 | object ProjectOpenDialog: TFileOpenDialog 185 | FavoriteLinks = <> 186 | FileTypes = < 187 | item 188 | DisplayName = 'Delphi Project Files (*.dproj)' 189 | FileMask = '*.dproj' 190 | end> 191 | Options = [] 192 | Title = 'Select Delphi Project' 193 | Left = 286 194 | Top = 245 195 | end 196 | object MessageTimer: TTimer 197 | Enabled = False 198 | Interval = 2000 199 | OnTimer = MessageTimerTimer 200 | Left = 428 201 | Top = 247 202 | end 203 | end 204 | -------------------------------------------------------------------------------- /Source/Project/Codex.Project.DeployExtensionsView.dfm: -------------------------------------------------------------------------------- 1 | object DeployExtensionsView: TDeployExtensionsView 2 | Left = 0 3 | Top = 0 4 | Margins.Left = 4 5 | Margins.Top = 4 6 | Margins.Right = 4 7 | Margins.Bottom = 4 8 | Caption = 'Deploy Extensions' 9 | ClientHeight = 355 10 | ClientWidth = 722 11 | Color = clBtnFace 12 | Font.Charset = DEFAULT_CHARSET 13 | Font.Color = clWindowText 14 | Font.Height = -12 15 | Font.Name = 'Segoe UI' 16 | Font.Style = [] 17 | Position = poOwnerFormCenter 18 | OnResize = FormResize 19 | TextHeight = 15 20 | object CommandButtonsPanel: TPanel 21 | Left = 0 22 | Top = 319 23 | Width = 722 24 | Height = 36 25 | Align = alBottom 26 | BevelOuter = bvNone 27 | TabOrder = 0 28 | object CancelButton: TButton 29 | AlignWithMargins = True 30 | Left = 645 31 | Top = 3 32 | Width = 74 33 | Height = 30 34 | Align = alRight 35 | Cancel = True 36 | Caption = 'Cancel' 37 | Default = True 38 | DoubleBuffered = True 39 | ModalResult = 2 40 | ParentDoubleBuffered = False 41 | TabOrder = 0 42 | end 43 | object OKButton: TButton 44 | AlignWithMargins = True 45 | Left = 565 46 | Top = 3 47 | Width = 74 48 | Height = 30 49 | Action = OKAction 50 | Align = alRight 51 | DoubleBuffered = True 52 | ParentDoubleBuffered = False 53 | TabOrder = 1 54 | end 55 | end 56 | object ExtensionsListView: TListView 57 | AlignWithMargins = True 58 | Left = 2 59 | Top = 5 60 | Width = 718 61 | Height = 307 62 | Margins.Left = 2 63 | Margins.Top = 5 64 | Margins.Right = 2 65 | Margins.Bottom = 7 66 | Align = alClient 67 | Columns = < 68 | item 69 | Caption = 'Project' 70 | Width = 229 71 | end 72 | item 73 | Caption = 'App Extension' 74 | Width = 350 75 | end 76 | item 77 | Caption = 'Date/Time' 78 | Width = 120 79 | end> 80 | MultiSelect = True 81 | ReadOnly = True 82 | RowSelect = True 83 | TabOrder = 1 84 | ViewStyle = vsReport 85 | end 86 | object ActionList: TActionList 87 | Left = 332 88 | Top = 59 89 | object OKAction: TAction 90 | Caption = 'OK' 91 | OnExecute = OKActionExecute 92 | OnUpdate = OKActionUpdate 93 | end 94 | end 95 | end 96 | -------------------------------------------------------------------------------- /Source/Project/Codex.Project.DeployFolderView.dfm: -------------------------------------------------------------------------------- 1 | object DeployFolderView: TDeployFolderView 2 | Left = 0 3 | Top = 0 4 | Caption = 'Deploy Folder' 5 | ClientHeight = 400 6 | ClientWidth = 542 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -12 11 | Font.Name = 'Segoe UI' 12 | Font.Style = [] 13 | Position = poOwnerFormCenter 14 | TextHeight = 15 15 | object SourcePathPanel: TPanel 16 | AlignWithMargins = True 17 | Left = 4 18 | Top = 0 19 | Width = 534 20 | Height = 50 21 | Margins.Left = 4 22 | Margins.Top = 0 23 | Margins.Right = 4 24 | Margins.Bottom = 4 25 | Align = alTop 26 | BevelOuter = bvNone 27 | Padding.Bottom = 1 28 | TabOrder = 0 29 | object SelectSourcePathSpeedButton: TSpeedButton 30 | AlignWithMargins = True 31 | Left = 507 32 | Top = 24 33 | Width = 23 34 | Height = 22 35 | Margins.Left = 0 36 | Margins.Right = 4 37 | Align = alRight 38 | Caption = '...' 39 | OnClick = SelectSourcePathSpeedButtonClick 40 | ExplicitLeft = 658 41 | ExplicitTop = 19 42 | ExplicitHeight = 25 43 | end 44 | object SourcePathLabel: TLabel 45 | AlignWithMargins = True 46 | Left = 3 47 | Top = 3 48 | Width = 528 49 | Height = 15 50 | Align = alTop 51 | Caption = 'Source Folder:' 52 | ExplicitWidth = 75 53 | end 54 | object SourcePathEdit: TEdit 55 | AlignWithMargins = True 56 | Left = 4 57 | Top = 25 58 | Width = 503 59 | Height = 20 60 | Margins.Left = 4 61 | Margins.Top = 4 62 | Margins.Right = 0 63 | Margins.Bottom = 4 64 | Align = alClient 65 | ParentShowHint = False 66 | ShowHint = True 67 | TabOrder = 0 68 | OnChange = SourcePathEditChange 69 | ExplicitHeight = 23 70 | end 71 | end 72 | object RemotePathPanel: TPanel 73 | AlignWithMargins = True 74 | Left = 4 75 | Top = 54 76 | Width = 534 77 | Height = 50 78 | Margins.Left = 4 79 | Margins.Top = 0 80 | Margins.Right = 4 81 | Margins.Bottom = 0 82 | Align = alTop 83 | BevelOuter = bvNone 84 | Padding.Bottom = 1 85 | TabOrder = 1 86 | object RemotePathLabel: TLabel 87 | AlignWithMargins = True 88 | Left = 3 89 | Top = 3 90 | Width = 528 91 | Height = 15 92 | Align = alTop 93 | Caption = 'Remote Path:' 94 | ExplicitWidth = 71 95 | end 96 | object RemotePathEdit: TEdit 97 | AlignWithMargins = True 98 | Left = 4 99 | Top = 25 100 | Width = 530 101 | Height = 20 102 | Margins.Left = 4 103 | Margins.Top = 4 104 | Margins.Right = 0 105 | Margins.Bottom = 4 106 | Align = alClient 107 | ParentShowHint = False 108 | ShowHint = True 109 | TabOrder = 0 110 | ExplicitHeight = 23 111 | end 112 | end 113 | object ButtonsPanel: TPanel 114 | Left = 0 115 | Top = 369 116 | Width = 542 117 | Height = 31 118 | Align = alBottom 119 | BevelOuter = bvNone 120 | TabOrder = 2 121 | object CancelButton: TButton 122 | AlignWithMargins = True 123 | Left = 463 124 | Top = 3 125 | Width = 75 126 | Height = 25 127 | Margins.Right = 4 128 | Align = alRight 129 | Cancel = True 130 | Caption = 'Cancel' 131 | DoubleBuffered = True 132 | ModalResult = 2 133 | ParentDoubleBuffered = False 134 | TabOrder = 0 135 | end 136 | object OKButton: TButton 137 | AlignWithMargins = True 138 | Left = 381 139 | Top = 3 140 | Width = 75 141 | Height = 25 142 | Margins.Right = 4 143 | Action = OKAction 144 | Align = alRight 145 | DoubleBuffered = True 146 | ParentDoubleBuffered = False 147 | TabOrder = 1 148 | end 149 | end 150 | object PlatformsPanel: TPanel 151 | AlignWithMargins = True 152 | Left = 3 153 | Top = 107 154 | Width = 536 155 | Height = 259 156 | Align = alClient 157 | BevelOuter = bvNone 158 | TabOrder = 3 159 | object PlatformsLabel: TLabel 160 | AlignWithMargins = True 161 | Left = 3 162 | Top = 3 163 | Width = 530 164 | Height = 15 165 | Align = alTop 166 | Caption = 'Platforms:' 167 | ExplicitWidth = 54 168 | end 169 | object PlatformsTreeView: TTreeView 170 | AlignWithMargins = True 171 | Left = 3 172 | Top = 21 173 | Width = 530 174 | Height = 235 175 | Margins.Top = 0 176 | Align = alClient 177 | Indent = 19 178 | TabOrder = 0 179 | end 180 | end 181 | object ActionList: TActionList 182 | Left = 131 183 | Top = 159 184 | object OKAction: TAction 185 | Caption = 'OK' 186 | OnExecute = OKActionExecute 187 | OnUpdate = OKActionUpdate 188 | end 189 | end 190 | object SourceFolderOpenDialog: TFileOpenDialog 191 | FavoriteLinks = <> 192 | FileTypes = <> 193 | Options = [fdoPickFolders, fdoPathMustExist] 194 | Title = 'Select Asset Pack root folder' 195 | Left = 130 196 | Top = 228 197 | end 198 | end 199 | -------------------------------------------------------------------------------- /Source/Project/Codex.Project.EffectivePathsView.dfm: -------------------------------------------------------------------------------- 1 | object EffectivePathsView: TEffectivePathsView 2 | Left = 0 3 | Top = 0 4 | Caption = 'Effective Paths' 5 | ClientHeight = 408 6 | ClientWidth = 612 7 | Color = clBtnFace 8 | Constraints.MinHeight = 132 9 | Constraints.MinWidth = 624 10 | Font.Charset = DEFAULT_CHARSET 11 | Font.Color = clWindowText 12 | Font.Height = -11 13 | Font.Name = 'Tahoma' 14 | Font.Style = [] 15 | Position = poOwnerFormCenter 16 | TextHeight = 13 17 | object CommandButtonsPanel: TPanel 18 | Left = 0 19 | Top = 376 20 | Width = 612 21 | Height = 32 22 | Align = alBottom 23 | BevelOuter = bvNone 24 | TabOrder = 1 25 | object CopyListLabel: TLabel 26 | AlignWithMargins = True 27 | Left = 3 28 | Top = 3 29 | Width = 426 30 | Height = 26 31 | Align = alLeft 32 | Caption = 33 | 'List is multi-selectable. Use Ctrl-C to copy all to clipboard, o' + 34 | 'r Shift-Ctrl-C to copy selected' 35 | Layout = tlCenter 36 | ExplicitHeight = 13 37 | end 38 | object FindUnitButton: TBitBtn 39 | AlignWithMargins = True 40 | Left = 453 41 | Top = 3 42 | Width = 75 43 | Height = 26 44 | Action = FindUnitAction 45 | Align = alRight 46 | Caption = 'Find' 47 | NumGlyphs = 2 48 | TabOrder = 1 49 | end 50 | object CloseButton: TButton 51 | AlignWithMargins = True 52 | Left = 534 53 | Top = 3 54 | Width = 75 55 | Height = 26 56 | Align = alRight 57 | Caption = '&Close' 58 | DoubleBuffered = True 59 | ModalResult = 8 60 | ParentDoubleBuffered = False 61 | TabOrder = 0 62 | end 63 | end 64 | object PageControl: TPageControl 65 | Left = 0 66 | Top = 0 67 | Width = 612 68 | Height = 376 69 | ActivePage = EffectivePathsTab 70 | Align = alClient 71 | TabOrder = 0 72 | object EffectivePathsTab: TTabSheet 73 | Caption = 'Effective Paths' 74 | TabVisible = False 75 | object InvalidPathsLabel: TLabel 76 | AlignWithMargins = True 77 | Left = 3 78 | Top = 350 79 | Width = 598 80 | Height = 13 81 | Margins.Top = 0 82 | Align = alBottom 83 | Caption = 'Invalid paths are colored orange' 84 | ExplicitWidth = 156 85 | end 86 | object EffectivePathsListBox: TListBox 87 | AlignWithMargins = True 88 | Left = 4 89 | Top = 4 90 | Width = 596 91 | Height = 342 92 | Margins.Left = 4 93 | Margins.Top = 4 94 | Margins.Right = 4 95 | Margins.Bottom = 4 96 | Style = lbOwnerDrawFixed 97 | Align = alClient 98 | ItemHeight = 13 99 | MultiSelect = True 100 | TabOrder = 0 101 | OnDrawItem = EffectivePathsListBoxDrawItem 102 | end 103 | end 104 | object FindUnitTab: TTabSheet 105 | Caption = 'Find Unit' 106 | ImageIndex = 1 107 | TabVisible = False 108 | object UnitNameLabel: TLabel 109 | AlignWithMargins = True 110 | Left = 3 111 | Top = 3 112 | Width = 53 113 | Height = 13 114 | Align = alTop 115 | Caption = 'Unit Name:' 116 | end 117 | object FindResultsLabel: TLabel 118 | AlignWithMargins = True 119 | Left = 3 120 | Top = 46 121 | Width = 39 122 | Height = 13 123 | Align = alTop 124 | Caption = 'Results:' 125 | end 126 | object UnitNameEdit: TEdit 127 | AlignWithMargins = True 128 | Left = 3 129 | Top = 19 130 | Width = 596 131 | Height = 21 132 | Margins.Top = 0 133 | Align = alTop 134 | TabOrder = 0 135 | end 136 | object FindResultsListBox: TListBox 137 | AlignWithMargins = True 138 | Left = 3 139 | Top = 65 140 | Width = 596 141 | Height = 301 142 | Margins.Bottom = 0 143 | Style = lbOwnerDrawFixed 144 | Align = alClient 145 | ItemHeight = 13 146 | MultiSelect = True 147 | TabOrder = 1 148 | OnDrawItem = FindResultsListBoxDrawItem 149 | end 150 | end 151 | end 152 | object ActionList: TActionList 153 | Left = 196 154 | Top = 170 155 | object FindUnitAction: TAction 156 | Caption = 'Find' 157 | OnExecute = FindUnitActionExecute 158 | OnUpdate = FindUnitActionUpdate 159 | end 160 | end 161 | end 162 | -------------------------------------------------------------------------------- /Source/Project/Codex.Project.ProjectManagerMenu.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Project.ProjectManagerMenu; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | System.Classes, 18 | ToolsAPI, 19 | DW.OTA.ProjectManagerMenu, DW.OTA.Consts; 20 | 21 | type 22 | TProjectProjectManagerMenuNotifier = class(TProjectManagerMenuNotifier) 23 | private 24 | procedure AddFolders; 25 | procedure DeployAppExtensions; 26 | procedure DeployFolder; 27 | procedure TotalClean; 28 | public 29 | procedure DoAddMenu(const AProject: IOTAProject; const AIdentList: TStrings; const AProjectManagerMenuList: IInterfaceList; 30 | AIsMultiSelect: Boolean); override; 31 | procedure DoAddGroupMenu(const AProject: IOTAProject; const AIdentList: TStrings; const AProjectManagerMenuList: IInterfaceList; 32 | AIsMultiSelect: Boolean); override; 33 | end; 34 | 35 | implementation 36 | 37 | uses 38 | System.SysUtils, 39 | DW.OTA.Helpers, 40 | Codex.Consts, Codex.Core, Codex.Consts.Text; 41 | 42 | type 43 | TAddFoldersProjectManagerMenu = class(TProjectManagerMenu) 44 | public 45 | constructor Create(const APosition: Integer; const AExecuteProc: TProc); 46 | function GetEnabled: Boolean; override; 47 | end; 48 | 49 | TDeployExtensionProjectManagerMenu = class(TProjectManagerMenu) 50 | public 51 | constructor Create(const APosition: Integer; const AExecuteProc: TProc); 52 | function GetEnabled: Boolean; override; 53 | end; 54 | 55 | TDeployFolderProjectManagerMenu = class(TProjectManagerMenu) 56 | public 57 | constructor Create(const APosition: Integer; const AExecuteProc: TProc); 58 | function GetEnabled: Boolean; override; 59 | end; 60 | 61 | { TAddFoldersProjectManagerMenu } 62 | 63 | constructor TAddFoldersProjectManagerMenu.Create(const APosition: Integer; const AExecuteProc: TProc); 64 | begin 65 | inherited Create(Babel.Tx(sAddFoldersCaption), 'CodexAddFolders', APosition, AExecuteProc); 66 | end; 67 | 68 | function TAddFoldersProjectManagerMenu.GetEnabled: Boolean; 69 | begin 70 | Result := TOTAHelper.GetCurrentSelectedProject <> nil; 71 | end; 72 | 73 | { TDeployExtensionProjectManagerMenu } 74 | 75 | constructor TDeployExtensionProjectManagerMenu.Create(const APosition: Integer; const AExecuteProc: TProc); 76 | begin 77 | inherited Create(Babel.Tx(sDeployExtensionsCaption), 'CodexDeployExtension', APosition, AExecuteProc); 78 | end; 79 | 80 | function TDeployExtensionProjectManagerMenu.GetEnabled: Boolean; 81 | var 82 | LProject: IOTAProject; 83 | begin 84 | LProject := TOTAHelper.GetCurrentSelectedProject; 85 | Result := (LProject <> nil) and (TOTAHelper.GetProjectCurrentPlatform(LProject) in cAppleProjectPlatforms); 86 | end; 87 | 88 | { TDeployFolderProjectManagerMenu } 89 | 90 | constructor TDeployFolderProjectManagerMenu.Create(const APosition: Integer; const AExecuteProc: TProc); 91 | begin 92 | inherited Create(Babel.Tx(sDeployFolderCaption), 'CodexDeployFolder', APosition, AExecuteProc); 93 | end; 94 | 95 | function TDeployFolderProjectManagerMenu.GetEnabled: Boolean; 96 | begin 97 | Result := TOTAHelper.GetCurrentSelectedProject <> nil; 98 | end; 99 | 100 | { TProjectProjectManagerMenuNotifier } 101 | 102 | procedure TProjectProjectManagerMenuNotifier.DoAddGroupMenu(const AProject: IOTAProject; const AIdentList: TStrings; 103 | const AProjectManagerMenuList: IInterfaceList; AIsMultiSelect: Boolean); 104 | begin 105 | // 106 | end; 107 | 108 | procedure TProjectProjectManagerMenuNotifier.DoAddMenu(const AProject: IOTAProject; const AIdentList: TStrings; 109 | const AProjectManagerMenuList: IInterfaceList; AIsMultiSelect: Boolean); 110 | begin 111 | AProjectManagerMenuList.Add(TProjectManagerMenu.Create(Babel.Tx(sTotalCleanCaption), 'TotalClean', pmmpClean + 1, TotalClean)); 112 | AProjectManagerMenuList.Add(TProjectManagerMenuSeparator.Create(cPMMPCodexMainSection)); 113 | AProjectManagerMenuList.Add(TAddFoldersProjectManagerMenu.Create(cPMMPCodexMainSection + 40, AddFolders)); 114 | AProjectManagerMenuList.Add(TDeployExtensionProjectManagerMenu.Create(cPMMPCodexMainSection + 50, DeployAppExtensions)); 115 | AProjectManagerMenuList.Add(TDeployFolderProjectManagerMenu.Create(cPMMPCodexMainSection + 60, DeployFolder)); 116 | end; 117 | 118 | procedure TProjectProjectManagerMenuNotifier.AddFolders; 119 | begin 120 | ProjectToolsProvider.AddFolders; 121 | end; 122 | 123 | procedure TProjectProjectManagerMenuNotifier.DeployAppExtensions; 124 | begin 125 | ProjectToolsProvider.ShowDeployAppExtensions; 126 | end; 127 | 128 | procedure TProjectProjectManagerMenuNotifier.DeployFolder; 129 | begin 130 | ProjectToolsProvider.DeployProjectFolder; 131 | end; 132 | 133 | procedure TProjectProjectManagerMenuNotifier.TotalClean; 134 | begin 135 | ProjectToolsProvider.TotalCleanProject; 136 | end; 137 | 138 | end. 139 | -------------------------------------------------------------------------------- /Source/Project/Codex.Project.ProjectPathsView.dfm: -------------------------------------------------------------------------------- 1 | object ProjectPathsView: TProjectPathsView 2 | Left = 0 3 | Top = 0 4 | Caption = 'Insert Project Paths' 5 | ClientHeight = 350 6 | ClientWidth = 821 7 | Color = clBtnFace 8 | Font.Charset = DEFAULT_CHARSET 9 | Font.Color = clWindowText 10 | Font.Height = -11 11 | Font.Name = 'Tahoma' 12 | Font.Style = [] 13 | Position = poOwnerFormCenter 14 | TextHeight = 13 15 | object MainSplitter: TSplitter 16 | Left = 420 17 | Top = 0 18 | Width = 4 19 | Height = 319 20 | ExplicitLeft = 473 21 | ExplicitTop = -20 22 | end 23 | object ButtonsPanel: TPanel 24 | Left = 0 25 | Top = 319 26 | Width = 821 27 | Height = 31 28 | Align = alBottom 29 | BevelOuter = bvNone 30 | TabOrder = 0 31 | object CancelButton: TButton 32 | AlignWithMargins = True 33 | Left = 742 34 | Top = 3 35 | Width = 75 36 | Height = 25 37 | Margins.Right = 4 38 | Align = alRight 39 | Cancel = True 40 | Caption = 'Cancel' 41 | DoubleBuffered = True 42 | ModalResult = 2 43 | ParentDoubleBuffered = False 44 | TabOrder = 0 45 | end 46 | object OKButton: TButton 47 | AlignWithMargins = True 48 | Left = 660 49 | Top = 3 50 | Width = 75 51 | Height = 25 52 | Margins.Right = 4 53 | Action = OKAction 54 | Align = alRight 55 | DoubleBuffered = True 56 | ParentDoubleBuffered = False 57 | TabOrder = 1 58 | end 59 | end 60 | object EffectivePathsPanel: TPanel 61 | AlignWithMargins = True 62 | Left = 427 63 | Top = 3 64 | Width = 391 65 | Height = 313 66 | Align = alClient 67 | BevelOuter = bvNone 68 | TabOrder = 1 69 | object EffectivePathsLabel: TLabel 70 | AlignWithMargins = True 71 | Left = 3 72 | Top = 3 73 | Width = 385 74 | Height = 13 75 | Align = alTop 76 | Caption = 'Current Effective Paths:' 77 | ExplicitWidth = 117 78 | end 79 | object EffectivePathsListBox: TListBox 80 | AlignWithMargins = True 81 | Left = 3 82 | Top = 22 83 | Width = 385 84 | Height = 288 85 | Align = alClient 86 | ItemHeight = 13 87 | TabOrder = 0 88 | end 89 | end 90 | inline CustomPaths: TCustomPathsView 91 | Left = 0 92 | Top = 0 93 | Width = 420 94 | Height = 319 95 | Align = alLeft 96 | TabOrder = 2 97 | ExplicitWidth = 420 98 | ExplicitHeight = 319 99 | inherited PathsPanel: TPanel 100 | Width = 414 101 | Height = 313 102 | ExplicitWidth = 414 103 | ExplicitHeight = 313 104 | inherited PathsLabel: TLabel 105 | Width = 408 106 | Height = 13 107 | ExplicitWidth = 78 108 | ExplicitHeight = 13 109 | end 110 | inherited PathPanel: TPanel 111 | Top = 251 112 | Width = 414 113 | ExplicitTop = 251 114 | ExplicitWidth = 414 115 | inherited SelectPathButton: TSpeedButton 116 | Left = 392 117 | ExplicitLeft = 434 118 | end 119 | inherited PathEdit: TEdit 120 | Width = 385 121 | Height = 22 122 | ExplicitWidth = 385 123 | ExplicitHeight = 21 124 | end 125 | end 126 | inherited PathsCheckListBox: TCheckListBox 127 | Top = 22 128 | Width = 384 129 | Height = 226 130 | ItemHeight = 13 131 | ExplicitTop = 22 132 | ExplicitWidth = 384 133 | ExplicitHeight = 226 134 | end 135 | inherited PathsButtonsPanel: TPanel 136 | Top = 281 137 | Width = 414 138 | ExplicitTop = 281 139 | ExplicitWidth = 414 140 | end 141 | inherited UpDownButtonsPanel: TPanel 142 | Left = 390 143 | Top = 19 144 | Height = 232 145 | ExplicitLeft = 390 146 | ExplicitTop = 19 147 | ExplicitHeight = 232 148 | inherited MovePathDownSpeedButton: TSpeedButton 149 | Top = 204 150 | ExplicitTop = 203 151 | end 152 | end 153 | end 154 | end 155 | object ActionList: TActionList 156 | OnUpdate = ActionListUpdate 157 | Left = 59 158 | Top = 39 159 | object AddPathAction: TAction 160 | Caption = 'Add' 161 | Hint = 'Add a path to the list' 162 | end 163 | object RemovePathAction: TAction 164 | Caption = 'Remove' 165 | Hint = 'Remove the selected jar files from the configuration' 166 | end 167 | object SelectPathAction: TAction 168 | Caption = '...' 169 | end 170 | object ReplacePathAction: TAction 171 | Caption = 'Replace' 172 | end 173 | object MovePathUpAction: TAction 174 | end 175 | object MovePathDownAction: TAction 176 | end 177 | object OKAction: TAction 178 | Caption = 'OK' 179 | OnExecute = OKActionExecute 180 | end 181 | object ToggleCheckedPathsAction: TAction 182 | Caption = 'Toggle' 183 | end 184 | end 185 | object PathOpenDialog: TFileOpenDialog 186 | FavoriteLinks = <> 187 | FileTypes = <> 188 | Options = [fdoPickFolders, fdoPathMustExist] 189 | Title = 'Select a folder to use as a path' 190 | Left = 152 191 | Top = 40 192 | end 193 | end 194 | -------------------------------------------------------------------------------- /Source/Project/Codex.Project.ProjectPathsView.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Project.ProjectPathsView; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, System.Types, Vcl.Graphics, 18 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls, Vcl.CheckLst, System.Actions, Vcl.ActnList, 19 | DW.Vcl.Splitter.Themed, 20 | Codex.BaseView, Codex.CustomPathsView; 21 | 22 | type 23 | TProjectPathsView = class(TForm) 24 | ButtonsPanel: TPanel; 25 | ActionList: TActionList; 26 | AddPathAction: TAction; 27 | RemovePathAction: TAction; 28 | SelectPathAction: TAction; 29 | ReplacePathAction: TAction; 30 | PathOpenDialog: TFileOpenDialog; 31 | MovePathUpAction: TAction; 32 | MovePathDownAction: TAction; 33 | OKAction: TAction; 34 | ToggleCheckedPathsAction: TAction; 35 | EffectivePathsPanel: TPanel; 36 | EffectivePathsListBox: TListBox; 37 | MainSplitter: TSplitter; 38 | CancelButton: TButton; 39 | OKButton: TButton; 40 | EffectivePathsLabel: TLabel; 41 | CustomPaths: TCustomPathsView; 42 | procedure ActionListUpdate(Action: TBasicAction; var Handled: Boolean); 43 | procedure OKActionExecute(Sender: TObject); 44 | procedure CustomPathsMovePathUpSpeedButtonClick(Sender: TObject); 45 | private 46 | function GetExistingPaths: TStrings; 47 | function GetSelectedPaths: TStringDynArray; 48 | procedure SetExistingPaths(const Value: TStrings); 49 | public 50 | constructor Create(AOwner: TComponent); override; 51 | property ExistingPaths: TStrings read GetExistingPaths write SetExistingPaths; 52 | property SelectedPaths: TStringDynArray read GetSelectedPaths; 53 | end; 54 | 55 | var 56 | ProjectPathsView: TProjectPathsView; 57 | 58 | implementation 59 | 60 | {$R *.dfm} 61 | 62 | uses 63 | BrandingAPI, IDETheme.Utils, 64 | DW.Vcl.ListBoxHelper, 65 | Codex.Core, Codex.Consts.Text; 66 | 67 | { TfrmProjectPaths } 68 | 69 | constructor TProjectPathsView.Create(AOwner: TComponent); 70 | begin 71 | inherited; 72 | CustomPaths.PathsLabel.Caption := Babel.Tx(sPathsToInsert); 73 | end; 74 | 75 | procedure TProjectPathsView.CustomPathsMovePathUpSpeedButtonClick(Sender: TObject); 76 | begin 77 | CustomPaths.MovePathUpActionExecute(Sender); 78 | end; 79 | 80 | function TProjectPathsView.GetExistingPaths: TStrings; 81 | begin 82 | Result := CustomPaths.ExistingPaths; 83 | end; 84 | 85 | function TProjectPathsView.GetSelectedPaths: TStringDynArray; 86 | begin 87 | Result := CustomPaths.SelectedPaths; 88 | end; 89 | 90 | procedure TProjectPathsView.ActionListUpdate(Action: TBasicAction; var Handled: Boolean); 91 | begin 92 | OKAction.Enabled := CustomPaths.PathsCheckListBox.HasChecked; 93 | Handled := True; 94 | end; 95 | 96 | procedure TProjectPathsView.OKActionExecute(Sender: TObject); 97 | begin 98 | ModalResult := mrOk; 99 | end; 100 | 101 | procedure TProjectPathsView.SetExistingPaths(const Value: TStrings); 102 | begin 103 | CustomPaths.ExistingPaths := Value; 104 | end; 105 | 106 | end. 107 | -------------------------------------------------------------------------------- /Source/Project/Codex.Project.ResourcesModule.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Project.ResourcesModule; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | System.SysUtils, System.Classes, System.ImageList, Vcl.ImgList, Vcl.Controls, System.Actions, Vcl.ActnList, Vcl.BaseImageCollection, 18 | Vcl.ImageCollection, Vcl.VirtualImageList, Vcl.Dialogs, 19 | Codex.CustomResourcesModule; 20 | 21 | type 22 | TProjectResourcesModule = class(TDataModule) 23 | ActionList: TActionList; 24 | CompileAction: TAction; 25 | BuildAction: TAction; 26 | CleanAction: TAction; 27 | TotalCleanAction: TAction; 28 | ShowOptionsAction: TAction; 29 | Win32Action: TAction; 30 | Android32Action: TAction; 31 | MacOSAction: TAction; 32 | iOSAction: TAction; 33 | ViewSourceAction: TAction; 34 | ShowDeployAction: TAction; 35 | InsertPathsAction: TAction; 36 | DeployAction: TAction; 37 | VirtualImageList: TVirtualImageList; 38 | ImageCollection: TImageCollection; 39 | CommonPathsAction: TAction; 40 | procedure CommonProjectActionUpdate(Sender: TObject); 41 | procedure CompileActionExecute(Sender: TObject); 42 | procedure BuildActionExecute(Sender: TObject); 43 | procedure CleanActionExecute(Sender: TObject); 44 | procedure TotalCleanActionExecute(Sender: TObject); 45 | procedure DeployActionExecute(Sender: TObject); 46 | procedure ShowOptionsActionExecute(Sender: TObject); 47 | procedure ViewSourceActionExecute(Sender: TObject); 48 | procedure ShowDeployActionExecute(Sender: TObject); 49 | procedure InsertPathsActionExecute(Sender: TObject); 50 | procedure DeployActionUpdate(Sender: TObject); 51 | public 52 | constructor Create(AOwner: TComponent); override; 53 | end; 54 | 55 | var 56 | ProjectResourcesModule: TProjectResourcesModule; 57 | 58 | implementation 59 | 60 | {%CLASSGROUP 'Vcl.Controls.TControl'} 61 | 62 | {$R *.dfm} 63 | 64 | uses 65 | DW.OSLog, 66 | Codex.Core; 67 | 68 | constructor TProjectResourcesModule.Create(AOwner: TComponent); 69 | begin 70 | inherited; 71 | ProjectResources := Self; 72 | end; 73 | 74 | procedure TProjectResourcesModule.CompileActionExecute(Sender: TObject); 75 | begin 76 | if ProjectToolsProvider <> nil then 77 | ProjectToolsProvider.CompileProject; 78 | end; 79 | 80 | procedure TProjectResourcesModule.DeployActionExecute(Sender: TObject); 81 | begin 82 | if ProjectToolsProvider <> nil then 83 | ProjectToolsProvider.DeployProject; 84 | end; 85 | 86 | procedure TProjectResourcesModule.DeployActionUpdate(Sender: TObject); 87 | begin 88 | TAction(Sender).Enabled := (ProjectToolsProvider <> nil) and ProjectToolsProvider.CanDeployProject; 89 | end; 90 | 91 | procedure TProjectResourcesModule.InsertPathsActionExecute(Sender: TObject); 92 | begin 93 | if ProjectToolsProvider <> nil then 94 | ProjectToolsProvider.InsertProjectPaths; 95 | end; 96 | 97 | procedure TProjectResourcesModule.ShowDeployActionExecute(Sender: TObject); 98 | begin 99 | if ProjectToolsProvider <> nil then 100 | ProjectToolsProvider.ShowProjectDeployment; 101 | end; 102 | 103 | procedure TProjectResourcesModule.ShowOptionsActionExecute(Sender: TObject); 104 | begin 105 | if ProjectToolsProvider <> nil then 106 | ProjectToolsProvider.ShowProjectOptions; 107 | end; 108 | 109 | procedure TProjectResourcesModule.TotalCleanActionExecute(Sender: TObject); 110 | begin 111 | if ProjectToolsProvider <> nil then 112 | ProjectToolsProvider.TotalCleanProject; 113 | end; 114 | 115 | procedure TProjectResourcesModule.ViewSourceActionExecute(Sender: TObject); 116 | begin 117 | if ProjectToolsProvider <> nil then 118 | ProjectToolsProvider.ViewProjectSource; 119 | end; 120 | 121 | procedure TProjectResourcesModule.BuildActionExecute(Sender: TObject); 122 | begin 123 | if ProjectToolsProvider <> nil then 124 | ProjectToolsProvider.BuildProject; 125 | end; 126 | 127 | procedure TProjectResourcesModule.CleanActionExecute(Sender: TObject); 128 | begin 129 | if ProjectToolsProvider <> nil then 130 | ProjectToolsProvider.CleanProject; 131 | end; 132 | 133 | procedure TProjectResourcesModule.CommonProjectActionUpdate(Sender: TObject); 134 | begin 135 | TAction(Sender).Enabled := (ProjectToolsProvider <> nil) and ProjectToolsProvider.HasActiveProject; 136 | end; 137 | 138 | end. 139 | -------------------------------------------------------------------------------- /Source/SourcePatch/Codex.SourcePatch.FunctionsModule.dfm: -------------------------------------------------------------------------------- 1 | object SourcePatchFunctionsModule: TSourcePatchFunctionsModule 2 | Height = 420 3 | Width = 394 4 | object SourceOpenDialog: TFileOpenDialog 5 | FavoriteLinks = <> 6 | FileTypes = < 7 | item 8 | DisplayName = 'Delphi source files (*.pas)' 9 | FileMask = '*.pas' 10 | end> 11 | Options = [fdoStrictFileTypes, fdoAllowMultiSelect] 12 | Title = 'Select Delphi source files' 13 | Left = 152 14 | Top = 40 15 | end 16 | object SourceCopyFolderOpenDialog: TFileOpenDialog 17 | FavoriteLinks = <> 18 | FileTypes = <> 19 | Options = [fdoPickFolders, fdoPathMustExist] 20 | Title = 'Select folder where source files will be copied to' 21 | Left = 154 22 | Top = 104 23 | end 24 | object PatchOpenDialog: TFileOpenDialog 25 | FavoriteLinks = <> 26 | FileTypes = <> 27 | Options = [fdoFileMustExist] 28 | Left = 156 29 | Top = 176 30 | end 31 | object PatchSaveDialog: TFileSaveDialog 32 | FavoriteLinks = <> 33 | FileTypes = < 34 | item 35 | DisplayName = 'Patch files (*.patch)' 36 | FileMask = '*.patch' 37 | end> 38 | Options = [] 39 | Title = 'Save patch file as' 40 | Left = 156 41 | Top = 248 42 | end 43 | end 44 | -------------------------------------------------------------------------------- /Source/SourcePatch/Codex.SourcePatch.OptionsView.pas: -------------------------------------------------------------------------------- 1 | unit Codex.SourcePatch.OptionsView; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, 18 | Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.ExtCtrls, Vcl.StdCtrls, Vcl.Buttons, 19 | Codex.Options; 20 | 21 | type 22 | TSourcePatchOptionsView = class(TForm, IConfigOptionsSection) 23 | RootPanel: TPanel; 24 | SourceCopyPathPanel: TPanel; 25 | SelectSourceCopyPathButton: TSpeedButton; 26 | SourceCopyPathLabel: TLabel; 27 | SourceCopyPathEdit: TEdit; 28 | SourceCopyProjectRelativeCheckBox: TCheckBox; 29 | PatchFilesLocationPanel: TPanel; 30 | SelectPatchFilesLocationButton: TSpeedButton; 31 | PatchFilesLocationLabel: TLabel; 32 | PatchFilesFolderEdit: TEdit; 33 | SourceCopyAlwaysPromptCheckBox: TCheckBox; 34 | ShouldOpenSourceFilesCheckBox: TCheckBox; 35 | SourceCopyFolderOpenDialog: TFileOpenDialog; 36 | PatchFilesFolderOpenDialog: TFileOpenDialog; 37 | procedure SourceCopyProjectRelativeCheckBoxClick(Sender: TObject); 38 | procedure SelectSourceCopyPathButtonClick(Sender: TObject); 39 | procedure SelectPatchFilesLocationButtonClick(Sender: TObject); 40 | private 41 | procedure UpdateControls; 42 | public 43 | { IConfigOptionsSection } 44 | function GetRootControl: TControl; 45 | function SectionID: string; 46 | function SectionTitle: string; 47 | procedure Save; 48 | procedure ShowSection; 49 | public 50 | constructor Create(AOwner: TComponent); override; 51 | end; 52 | 53 | var 54 | SourcePatchOptionsView: TSourcePatchOptionsView; 55 | 56 | implementation 57 | 58 | {$R *.dfm} 59 | 60 | uses 61 | System.IOUtils, 62 | Codex.Config, Codex.Core, Codex.Consts.Text; 63 | 64 | { TSourcePatchOptionsView } 65 | 66 | constructor TSourcePatchOptionsView.Create(AOwner: TComponent); 67 | begin 68 | inherited; 69 | // 70 | end; 71 | 72 | function TSourcePatchOptionsView.GetRootControl: TControl; 73 | begin 74 | Result := RootPanel; 75 | end; 76 | 77 | procedure TSourcePatchOptionsView.Save; 78 | begin 79 | Config.SourcePatch.AlwaysPromptSourceCopyPath := SourceCopyAlwaysPromptCheckBox.Checked; 80 | Config.SourcePatch.SourceCopyPath := SourceCopyPathEdit.Text; 81 | Config.SourcePatch.IsSourceCopyProjectRelative := SourceCopyProjectRelativeCheckBox.Checked; 82 | Config.SourcePatch.PatchFilesPath := PatchFilesFolderEdit.Text; 83 | Config.SourcePatch.ShouldOpenSourceFiles := ShouldOpenSourceFilesCheckBox.Checked; 84 | end; 85 | 86 | function TSourcePatchOptionsView.SectionID: string; 87 | begin 88 | Result := 'SourcePatch'; 89 | end; 90 | 91 | procedure TSourcePatchOptionsView.ShowSection; 92 | begin 93 | SourceCopyAlwaysPromptCheckBox.Checked := Config.SourcePatch.AlwaysPromptSourceCopyPath; 94 | SourceCopyPathEdit.Text := Config.SourcePatch.SourceCopyPath; 95 | SourceCopyProjectRelativeCheckBox.Checked := Config.SourcePatch.IsSourceCopyProjectRelative; 96 | PatchFilesFolderEdit.Text := Config.SourcePatch.PatchFilesPath; 97 | ShouldOpenSourceFilesCheckBox.Checked := Config.SourcePatch.ShouldOpenSourceFiles; 98 | UpdateControls; 99 | end; 100 | 101 | function TSourcePatchOptionsView.SectionTitle: string; 102 | begin 103 | Result := Babel.Tx(sSourcePatchTitle); 104 | end; 105 | 106 | procedure TSourcePatchOptionsView.SelectPatchFilesLocationButtonClick(Sender: TObject); 107 | begin 108 | if not string(PatchFilesFolderEdit.Text).Trim.IsEmpty and TDirectory.Exists(PatchFilesFolderEdit.Text) then 109 | PatchFilesFolderOpenDialog.DefaultFolder := PatchFilesFolderEdit.Text; 110 | if PatchFilesFolderOpenDialog.Execute then 111 | PatchFilesFolderEdit.Text := PatchFilesFolderOpenDialog.FileName; 112 | end; 113 | 114 | procedure TSourcePatchOptionsView.SelectSourceCopyPathButtonClick(Sender: TObject); 115 | begin 116 | if not string(SourceCopyPathEdit.Text).Trim.IsEmpty and TDirectory.Exists(SourceCopyPathEdit.Text) then 117 | SourceCopyFolderOpenDialog.DefaultFolder := SourceCopyPathEdit.Text; 118 | if SourceCopyFolderOpenDialog.Execute then 119 | SourceCopyPathEdit.Text := SourceCopyFolderOpenDialog.FileName; 120 | end; 121 | 122 | procedure TSourcePatchOptionsView.SourceCopyProjectRelativeCheckBoxClick(Sender: TObject); 123 | begin 124 | UpdateControls; 125 | if Visible and SourceCopyProjectRelativeCheckBox.Checked then 126 | SourceCopyPathEdit.Text := ''; 127 | end; 128 | 129 | procedure TSourcePatchOptionsView.UpdateControls; 130 | begin 131 | SelectSourceCopyPathButton.Enabled := not SourceCopyProjectRelativeCheckBox.Checked; 132 | if SourceCopyProjectRelativeCheckBox.Checked then 133 | SourceCopyPathLabel.Caption := Babel.Tx(sSourceCopyRelativeCaption) 134 | else 135 | SourceCopyPathLabel.Caption := Babel.Tx(sSourceCopyDefaultFolderCaption); 136 | end; 137 | 138 | initialization 139 | TConfigOptionsHelper.RegisterOptions(TSourcePatchOptionsView); 140 | 141 | end. 142 | -------------------------------------------------------------------------------- /Source/SourcePatch/Codex.SourcePatch.PatchProcess.pas: -------------------------------------------------------------------------------- 1 | unit Codex.SourcePatch.PatchProcess; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | DW.RunProcess.Win; 18 | 19 | type 20 | TPatchProcess = class(TRunProcess) 21 | private 22 | FOutputPath: string; 23 | FPatchEXEPath: string; 24 | FSourceCopy: string; 25 | FSourceFilePath: string; 26 | FSourcePatchPath: string; 27 | FSourceWasCopied: Boolean; 28 | protected 29 | procedure DoOutput(const AOutput: string); override; 30 | procedure DoTerminated(const AExitCode: Cardinal); override; 31 | public 32 | function Run: Boolean; override; 33 | property OutputPath: string read FOutputPath write FOutputPath; 34 | property PatchEXEPath: string read FPatchEXEPath write FPatchEXEPath; 35 | property SourceFilePath: string read FSourceFilePath write FSourceFilePath; 36 | property SourcePatchPath: string read FSourcePatchPath write FSourcePatchPath; 37 | end; 38 | 39 | implementation 40 | 41 | uses 42 | DW.OSLog, 43 | System.SysUtils, System.IOUtils; 44 | 45 | const 46 | // e.g. C:\Utils\Patch C:\Copied\FMX.VirtualKeyboard.Android.pas FMX.VirtualKeyboard.Android.10.2.2.patch 47 | cPatchCommand = '%s %s %s'; 48 | 49 | { TPatchProcess } 50 | 51 | procedure TPatchProcess.DoOutput(const AOutput: string); 52 | begin 53 | inherited; 54 | TOSLog.d('TPatchProcess Output: %s', [AOutput]); 55 | end; 56 | 57 | procedure TPatchProcess.DoTerminated(const AExitCode: Cardinal); 58 | begin 59 | inherited; 60 | if (AExitCode <> 0) and FSourceWasCopied then 61 | TFile.Delete(FSourceCopy); 62 | end; 63 | 64 | function TPatchProcess.Run: Boolean; 65 | begin 66 | FSourceWasCopied := False; 67 | FSourceCopy := TPath.Combine(FOutputPath, TPath.GetFileName(FSourceFilePath)); 68 | if not TFile.Exists(FSourceCopy) then 69 | begin 70 | TFile.Copy(FSourceFilePath, FSourceCopy); 71 | FSourceWasCopied := True; 72 | end; 73 | Process.CommandLine := Format(cPatchCommand, [FPatchEXEPath, FSourceCopy, FSourcePatchPath]); 74 | TOSLog.d('Command line is: %s', [Process.CommandLine]); 75 | Result := InternalRun; 76 | end; 77 | 78 | end. 79 | -------------------------------------------------------------------------------- /Source/SourcePatch/Codex.SourcePatch.ResourcesModule.dfm: -------------------------------------------------------------------------------- 1 | object SourcePatchResourcesModule: TSourcePatchResourcesModule 2 | Height = 248 3 | Width = 595 4 | object ActionList: TActionList 5 | Left = 136 6 | Top = 76 7 | object SourcePatchSep1Action: TAction 8 | Category = 'Codex.SourcePatch' 9 | Caption = '-' 10 | OnExecute = SourcePatchSep1ActionExecute 11 | end 12 | object CopySourceFromEditorAction: TAction 13 | Category = 'Codex.SourcePatch' 14 | end 15 | object CopySourceFromEditorToProjectAction: TAction 16 | Category = 'Codex.SourcePatch' 17 | end 18 | object CreatePatchFromEditorAction: TAction 19 | Category = 'Codex.SourcePatch' 20 | end 21 | object PatchSourceFromEditorAction: TAction 22 | Category = 'Codex.SourcePatch' 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /Source/SourcePatch/Codex.SourcePatch.ResourcesModule.pas: -------------------------------------------------------------------------------- 1 | unit Codex.SourcePatch.ResourcesModule; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | System.SysUtils, System.Classes, System.Actions, Vcl.ActnList, 18 | Codex.CustomResourcesModule; 19 | 20 | type 21 | TSourcePatchResourcesModule = class(TDataModule) 22 | ActionList: TActionList; 23 | CopySourceFromEditorAction: TAction; 24 | CopySourceFromEditorToProjectAction: TAction; 25 | CreatePatchFromEditorAction: TAction; 26 | PatchSourceFromEditorAction: TAction; 27 | SourcePatchSep1Action: TAction; 28 | procedure SourcePatchSep1ActionExecute(Sender: TObject); 29 | public 30 | constructor Create(AOwner: TComponent); override; 31 | end; 32 | 33 | var 34 | SourcePatchResourcesModule: TSourcePatchResourcesModule; 35 | 36 | implementation 37 | 38 | {%CLASSGROUP 'Vcl.Controls.TControl'} 39 | 40 | {$R *.dfm} 41 | 42 | uses 43 | Codex.Core, Codex.Consts.Text; 44 | 45 | { TSourcePatchResourcesModule } 46 | 47 | constructor TSourcePatchResourcesModule.Create(AOwner: TComponent); 48 | begin 49 | inherited; 50 | CopySourceFromEditorAction.Caption := Babel.Tx(sCopySourceMenuCaption); 51 | CopySourceFromEditorToProjectAction.Caption := Babel.Tx(sCopySourceToProjectMenuCaption); 52 | CreatePatchFromEditorAction.Caption := Babel.Tx(sCreatePatchMenuCaption); 53 | PatchSourceFromEditorAction.Caption := Babel.Tx(sPatchSourceToProjectMenuCaption); 54 | SourcePatchSep1Action.Visible := CodexProvider.GetEditorActionList.ActionCount > 0; 55 | end; 56 | 57 | procedure TSourcePatchResourcesModule.SourcePatchSep1ActionExecute(Sender: TObject); 58 | begin 59 | // 60 | end; 61 | 62 | end. 63 | -------------------------------------------------------------------------------- /Source/VersionInfo.rc: -------------------------------------------------------------------------------- 1 | // FILEFLAGS 0x2L = Beta (Pre-release) 0x0L = Normal 2 | 3 | 1 VERSIONINFO 4 | FILEVERSION 2,4,1,0 5 | PRODUCTVERSION 2,4,1,0 6 | FILEFLAGSMASK 0x3fL 7 | FILEFLAGS 0x0L 8 | FILEOS 0x4 9 | FILETYPE 0x1 10 | { 11 | BLOCK "StringFileInfo" 12 | { 13 | BLOCK "041304E4" 14 | { 15 | VALUE "CompanyName", "Delphi Worlds" 16 | VALUE "FileDescription", "Codex" 17 | VALUE "FileVersion", "2.4.1" 18 | VALUE "InternalName", "Codex" 19 | VALUE "OriginalFilename", "Codex" 20 | VALUE "ProductName", "Codex" 21 | VALUE "ProductVersion", "2.4.1" 22 | } 23 | } 24 | 25 | BLOCK "VarFileInfo" 26 | { 27 | VALUE "Translation", 0x0409, 1252 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Source/Visualizers/Codex.Visualizer.MultiLineStringFrame.dfm: -------------------------------------------------------------------------------- 1 | object MultiLineStringFrame: TMultiLineStringFrame 2 | Left = 0 3 | Top = 0 4 | Width = 776 5 | Height = 310 6 | Margins.Left = 5 7 | Margins.Top = 5 8 | Margins.Right = 5 9 | Margins.Bottom = 5 10 | TabOrder = 0 11 | PixelsPerInch = 144 12 | object TextMemo: TMemo 13 | Left = 0 14 | Top = 0 15 | Width = 776 16 | Height = 310 17 | Margins.Left = 5 18 | Margins.Top = 5 19 | Margins.Right = 5 20 | Margins.Bottom = 5 21 | Align = alClient 22 | TabOrder = 0 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /Source/Visualizers/Codex.Visualizer.MultiLineStringFrame.pas: -------------------------------------------------------------------------------- 1 | unit Codex.Visualizer.MultiLineStringFrame; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2024 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, 18 | Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, 19 | ToolsAPI; 20 | 21 | type 22 | TMultiLineStringFrame = class(TFrame, IOTADebuggerVisualizerExternalViewerUpdater) 23 | TextMemo: TMemo; 24 | private 25 | FClosedProc: TOTAVisualizerClosedProcedure; 26 | protected 27 | procedure SetParent(AParent: TWinControl); override; 28 | public 29 | { IOTADebuggerVisualizerExternalViewerUpdater } 30 | procedure CloseVisualizer; 31 | procedure MarkUnavailable(Reason: TOTAVisualizerUnavailableReason); 32 | procedure RefreshVisualizer(const Expression, TypeName, EvalResult: string); 33 | procedure SetClosedCallback(ClosedProc: TOTAVisualizerClosedProcedure); 34 | end; 35 | 36 | implementation 37 | 38 | {$R *.dfm} 39 | 40 | { TMultiLineStringFrame } 41 | 42 | procedure TMultiLineStringFrame.CloseVisualizer; 43 | begin 44 | if Owner is TForm then 45 | TForm(Owner).Close; 46 | end; 47 | 48 | procedure TMultiLineStringFrame.MarkUnavailable(Reason: TOTAVisualizerUnavailableReason); 49 | begin 50 | case Reason of 51 | ovurProcessRunning: 52 | TextMemo.Text := 'Process running'; 53 | ovurOutOfScope: 54 | TextMemo.Text := 'Out of scope'; 55 | end; 56 | end; 57 | 58 | procedure TMultiLineStringFrame.RefreshVisualizer(const Expression, TypeName, EvalResult: string); 59 | var 60 | I: Integer; 61 | LText: TArray; 62 | begin 63 | LText := EvalResult.Split(['#$D#$A']); 64 | for I := 0 to Length(LText) - 1 do 65 | LText[I] := AnsiDequotedStr(LText[I], ''''); 66 | TextMemo.Lines.BeginUpdate; 67 | try 68 | TextMemo.Lines.Clear; 69 | TextMemo.Lines.AddStrings(LText); 70 | finally 71 | TextMemo.Lines.EndUpdate; 72 | end; 73 | end; 74 | 75 | procedure TMultiLineStringFrame.SetClosedCallback(ClosedProc: TOTAVisualizerClosedProcedure); 76 | begin 77 | FClosedProc := ClosedProc; 78 | end; 79 | 80 | procedure TMultiLineStringFrame.SetParent(AParent: TWinControl); 81 | begin 82 | if AParent = nil then 83 | begin 84 | if Assigned(FClosedProc) then 85 | FClosedProc; 86 | end; 87 | inherited; 88 | end; 89 | 90 | end. 91 | -------------------------------------------------------------------------------- /Source/Wizards/Codex.EditorContext.Wizard.pas: -------------------------------------------------------------------------------- 1 | unit Codex.EditorContext.Wizard; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | implementation 17 | 18 | uses 19 | System.Classes, System.SysUtils, System.IOUtils, 20 | ToolsAPI, 21 | Vcl.Menus, Vcl.ActnPopup, Vcl.ActnList, 22 | DW.OTA.Wizard, DW.OTA.Helpers, DW.Menus.Helpers, 23 | Codex.Core; 24 | 25 | type 26 | TEditorContextWizard = class(TWizard) 27 | private 28 | procedure CheckEditorActionList; 29 | protected 30 | procedure AddToProjectHandler(Sender: TObject); 31 | procedure AddToProjectUpdateHandler(Sender: TObject); 32 | procedure IDEStarted; override; 33 | public 34 | constructor Create; override; 35 | end; 36 | 37 | { TEditorContextWizard } 38 | 39 | constructor TEditorContextWizard.Create; 40 | begin 41 | inherited; 42 | CodexResources.LinkAction('AddToProjectAction', AddToProjectHandler, AddToProjectUpdateHandler); 43 | end; 44 | 45 | procedure TEditorContextWizard.AddToProjectHandler(Sender: TObject); 46 | var 47 | LProject: IOTAProject; 48 | begin 49 | LProject := TOTAHelper.GetActiveProject; 50 | if LProject <> nil then 51 | LProject.AddFile(TOTAHelper.GetActiveSourceEditorFileName, True); 52 | end; 53 | 54 | procedure TEditorContextWizard.AddToProjectUpdateHandler(Sender: TObject); 55 | begin 56 | TAction(Sender).Enabled := TPath.GetExtension(TOTAHelper.GetActiveSourceEditorFileName).ToLower.Equals('.pas') and 57 | (TOTAHelper.GetActiveProject <> nil); // TODO: And not already part of the project! 58 | end; 59 | 60 | procedure TEditorContextWizard.IDEStarted; 61 | begin 62 | inherited; 63 | CheckEditorActionList; 64 | end; 65 | 66 | procedure TEditorContextWizard.CheckEditorActionList; 67 | {$IF CompilerVersion > 35} 68 | var 69 | LActionList: TActionList; 70 | begin 71 | LActionList := CodexProvider.GetEditorActionList; 72 | if LActionList <> nil then 73 | (BorlandIDEServices as IOTAEditorServices).GetEditorLocalMenu.RegisterActionList(LActionList, 'Codex', cEdMenuCatBase); 74 | end; 75 | {$ELSE} 76 | begin 77 | // Do nothing in earlier versions 78 | end; 79 | {$ENDIF} 80 | 81 | initialization 82 | {$IF CompilerVersion >= 36} 83 | TOTAWizard.RegisterWizard(TEditorContextWizard); 84 | {$ENDIF} 85 | 86 | end. 87 | -------------------------------------------------------------------------------- /Source/Wizards/Codex.EditorContextD11.Wizard.pas: -------------------------------------------------------------------------------- 1 | unit Codex.EditorContextD11.Wizard; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | implementation 17 | 18 | uses 19 | System.Classes, System.SysUtils, System.IOUtils, 20 | ToolsAPI, 21 | Vcl.Menus, Vcl.ActnPopup, Vcl.ActnList, 22 | DW.OTA.Wizard, DW.OTA.Helpers, DW.Menus.Helpers, 23 | Codex.Core, Codex.Consts.Text; 24 | 25 | type 26 | TEditorContextWizard = class(TWizard) 27 | private 28 | FEditorMenuItem: TMenuItem; 29 | FEditorPopupEvent: TMethod; 30 | procedure AddToProjectHandler(Sender: TObject); 31 | procedure AddToProjectUpdateHandler(Sender: TObject); 32 | procedure EditorMenuPopupHandler(Sender: TObject); 33 | procedure HookEditorPopup; 34 | function FindEditorPopup(out APopup: TPopupActionBar): Boolean; 35 | protected 36 | procedure IDEStarted; override; 37 | end; 38 | 39 | { TEditorContextWizard } 40 | 41 | procedure TEditorContextWizard.AddToProjectHandler(Sender: TObject); 42 | var 43 | LProject: IOTAProject; 44 | begin 45 | LProject := TOTAHelper.GetActiveProject; 46 | if LProject <> nil then 47 | LProject.AddFile(TOTAHelper.GetActiveSourceEditorFileName, True); 48 | end; 49 | 50 | procedure TEditorContextWizard.AddToProjectUpdateHandler(Sender: TObject); 51 | begin 52 | TAction(Sender).Enabled := TPath.GetExtension(TOTAHelper.GetActiveSourceEditorFileName).ToLower.Equals('.pas') and 53 | (TOTAHelper.GetActiveProject <> nil); // TODO: And not already part of the project! 54 | end; 55 | 56 | procedure TEditorContextWizard.IDEStarted; 57 | begin 58 | inherited; 59 | HookEditorPopup; 60 | end; 61 | 62 | function TEditorContextWizard.FindEditorPopup(out APopup: TPopupActionBar): Boolean; 63 | var 64 | LComponent: TComponent; 65 | begin 66 | Result := False; 67 | if TOTAHelper.FindComponentGlobal('EditorLocalMenu', LComponent) and (LComponent is TPopupActionBar) then 68 | begin 69 | APopup := TPopupActionBar(LComponent); 70 | Result := True; 71 | end; 72 | end; 73 | 74 | procedure TEditorContextWizard.HookEditorPopup; 75 | var 76 | LPopup: TPopupActionBar; 77 | begin 78 | if FindEditorPopup(LPopup) then 79 | begin 80 | if Assigned(LPopup.OnPopup) then 81 | begin 82 | FEditorPopupEvent := TMethod(LPopup.OnPopup); 83 | LPopup.OnPopup := EditorMenuPopupHandler; 84 | end 85 | else 86 | LPopup.OnPopup := EditorMenuPopupHandler; 87 | end; 88 | end; 89 | 90 | procedure TEditorContextWizard.EditorMenuPopupHandler(Sender: TObject); 91 | var 92 | LPopup: TPopupActionBar; 93 | LIndex: Integer; 94 | LEvent: TNotifyEvent; 95 | LMenuItem: TMenuItem; 96 | begin 97 | FEditorMenuItem.Free; 98 | FEditorMenuItem := nil; 99 | if Assigned(FEditorPopupEvent.Data) then 100 | begin 101 | LEvent := TNotifyEvent(FEditorPopupEvent); 102 | LEvent(Sender); 103 | end; 104 | if FindEditorPopup(LPopup) then 105 | begin 106 | LIndex := TOTAHelper.FindMenuSeparatorIndex(LPopup.Items, 'EditAddToDoItemCommand'); 107 | if LIndex > -1 then 108 | begin 109 | TMenuItem.CreateSeparator(LPopup.Items, LIndex); 110 | FEditorMenuItem := TMenuItem.Create(LPopup); // .Items 111 | FEditorMenuItem.Caption := 'Codex'; 112 | LPopup.Items.Insert(LIndex + 1, FEditorMenuItem); 113 | // Now add the submenu items, using FCodexEditorMenuItem as owner and FCodexEditorMenuItem.Add 114 | LMenuItem := TMenuItem.CreateWithAction(FEditorMenuItem, Babel.Tx(sAddToProjectMenuCaption), AddToProjectHandler); 115 | LMenuItem.Action.OnUpdate := AddToProjectUpdateHandler; 116 | FEditorMenuItem.Insert(FEditorMenuItem.Count, LMenuItem); 117 | TMenuItem.CreateSeparator(FEditorMenuItem); 118 | CodexProvider.NotifyContextMenu(FEditorMenuItem); 119 | end; 120 | end; 121 | end; 122 | 123 | initialization 124 | {$IF CompilerVersion < 36} 125 | TOTAWizard.RegisterWizard(TEditorContextWizard); 126 | {$ENDIF} 127 | 128 | end. 129 | -------------------------------------------------------------------------------- /Source/Wizards/Codex.IDEActions.Wizard.pas: -------------------------------------------------------------------------------- 1 | unit Codex.IDEActions.Wizard; 2 | 3 | {*******************************************************} 4 | { } 5 | { Codex } 6 | { } 7 | { Add-in for Delphi from Delphi Worlds } 8 | { } 9 | { Copyright 2020-2023 Dave Nottage under MIT license } 10 | { which is located in the root folder of this library } 11 | { } 12 | {*******************************************************} 13 | 14 | interface 15 | 16 | uses 17 | System.Classes, System.SysUtils, 18 | Winapi.Windows, 19 | ToolsAPI, 20 | Vcl.Menus, 21 | DelphiAST.Classes, DelphiAST.Consts, 22 | DW.OTA.Wizard, DW.OTA.Helpers, DW.Menus.Helpers, DW.Vcl.DialogService, 23 | DW.RunProcess.Win, 24 | Codex.Core, Codex.Consts, Codex.AST; 25 | 26 | implementation 27 | 28 | type 29 | TIDEActionsWizard = class(TWizard) 30 | private 31 | FProcess: TRunProcess; 32 | procedure EnvVarsActionExecuteHandler(Sender: TObject); 33 | procedure GotoImplementationUsesActionExecuteHandler(Sender: TObject); 34 | procedure GotoInterfaceUsesActionExecuteHandler(Sender: TObject); 35 | procedure GotoUses(const ASection: TSyntaxNodeType); 36 | procedure KillLSPActionExecuteHandler(Sender: TObject); 37 | procedure SDKManagerActionExecuteHandler(Sender: TObject); 38 | public 39 | constructor Create; override; 40 | destructor Destroy; override; 41 | end; 42 | 43 | { TIDEActionsWizard } 44 | 45 | constructor TIDEActionsWizard.Create; 46 | begin 47 | inherited; 48 | FProcess := TRunProcess.Create; 49 | CodexResources.LinkAction('GotoInterfaceUsesAction', GotoInterfaceUsesActionExecuteHandler); 50 | CodexResources.LinkAction('GotoImplementationUsesAction', GotoImplementationUsesActionExecuteHandler); 51 | CodexResources.LinkAction('EnvVarsAction', EnvVarsActionExecuteHandler); 52 | CodexResources.LinkAction('SDKManagerAction', SDKManagerActionExecuteHandler); 53 | CodexResources.LinkAction('KillLSPAction', KillLSPActionExecuteHandler); 54 | end; 55 | 56 | destructor TIDEActionsWizard.Destroy; 57 | begin 58 | FProcess.Free; 59 | inherited; 60 | end; 61 | 62 | procedure TIDEActionsWizard.EnvVarsActionExecuteHandler(Sender: TObject); 63 | begin 64 | TOTAHelper.GetEnvironmentOptions.EditOptions(cIDEOptionsSectionEnvironment + '.Environment Variables'); 65 | end; 66 | 67 | procedure TIDEActionsWizard.GotoImplementationUsesActionExecuteHandler(Sender: TObject); 68 | begin 69 | GotoUses(TSyntaxNodeType.ntImplementation); 70 | end; 71 | 72 | procedure TIDEActionsWizard.GotoInterfaceUsesActionExecuteHandler(Sender: TObject); 73 | begin 74 | GotoUses(TSyntaxNodeType.ntInterface); 75 | end; 76 | 77 | procedure TIDEActionsWizard.GotoUses(const ASection: TSyntaxNodeType); 78 | var 79 | LNode, LChildNode: TSyntaxNode; 80 | LEditor: IOTASourceEditor; 81 | LEditView: IOTAEditView; 82 | begin 83 | LEditor := TOTAHelper.GetActiveSourceEditor; 84 | if (LEditor <> nil) and LEditor.FileName.EndsWith('.pas', True) and TOTAHelper.FindTopEditView(LEditor, LEditView) then 85 | begin 86 | LNode := TCodexAST.RunSourceEditor(LEditor); 87 | try 88 | LChildNode := LNode.FindNode(ASection); 89 | if LChildNode <> nil then 90 | begin 91 | LChildNode := LChildNode.FindNode(TSyntaxNodeType.ntUses); 92 | if LChildNode <> nil then 93 | begin 94 | LEditView.Position.Move(LChildNode.Line, LChildNode.Col); 95 | LEditView.MoveViewToCursor; 96 | LEditView.Paint; 97 | end; 98 | end; 99 | finally 100 | LNode.Free; 101 | end; 102 | end; 103 | end; 104 | 105 | procedure TIDEActionsWizard.KillLSPActionExecuteHandler(Sender: TObject); 106 | var 107 | LMenuItem: TMenuItem; 108 | begin 109 | if not (TOTAHelper.FindToolsMenu(LMenuItem) and TOTAHelper.FindMenuByCaption(LMenuItem, '%LSP%', LMenuItem)) then 110 | begin 111 | FProcess.CommandLine := 'taskkill /f /IM delphilsp.exe'; 112 | FProcess.RunAndWait(2000); 113 | end 114 | else 115 | LMenuItem.Click; 116 | end; 117 | 118 | procedure TIDEActionsWizard.SDKManagerActionExecuteHandler(Sender: TObject); 119 | begin 120 | TOTAHelper.GetEnvironmentOptions.EditOptions(cIDEOptionsSectionDeployment + '.SDK Manager'); 121 | end; 122 | 123 | initialization 124 | TOTAWizard.RegisterWizard(TIDEActionsWizard); 125 | 126 | end. 127 | --------------------------------------------------------------------------------