diff --git a/Build/4DPop-Macros.dmg b/Build/4DPop-Macros.dmg deleted file mode 100644 index 746e7f3..0000000 Binary files a/Build/4DPop-Macros.dmg and /dev/null differ diff --git a/Build/4DPop-Macros.zip b/Build/4DPop-Macros.zip index 1f16073..04c2bd5 100644 Binary files a/Build/4DPop-Macros.zip and b/Build/4DPop-Macros.zip differ diff --git a/Build/Components/4DPop Macros.4dbase/4DPop Macros.4DZ b/Build/Components/4DPop Macros.4dbase/4DPop Macros.4DZ deleted file mode 100755 index 94ea1d5..0000000 Binary files a/Build/Components/4DPop Macros.4dbase/4DPop Macros.4DZ and /dev/null differ diff --git a/Build/Components/4DPop Macros.4dbase/Contents/4DPop Macros.4DZ b/Build/Components/4DPop Macros.4dbase/Contents/4DPop Macros.4DZ new file mode 100644 index 0000000..4aab767 Binary files /dev/null and b/Build/Components/4DPop Macros.4dbase/Contents/4DPop Macros.4DZ differ diff --git a/Build/Components/4DPop Macros.4dbase/4DPop Macros.htm b/Build/Components/4DPop Macros.4dbase/Contents/4DPop Macros.htm similarity index 100% rename from Build/Components/4DPop Macros.4dbase/4DPop Macros.htm rename to Build/Components/4DPop Macros.4dbase/Contents/4DPop Macros.htm diff --git a/Build/Components/4DPop Macros.4dbase/Documentation/declaration.png b/Build/Components/4DPop Macros.4dbase/Contents/Documentation/declaration.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Documentation/declaration.png rename to Build/Components/4DPop Macros.4dbase/Contents/Documentation/declaration.png diff --git a/Build/Components/4DPop Macros.4dbase/Documentation/disablingWarning.png b/Build/Components/4DPop Macros.4dbase/Contents/Documentation/disablingWarning.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Documentation/disablingWarning.png rename to Build/Components/4DPop Macros.4dbase/Contents/Documentation/disablingWarning.png diff --git a/Build/Components/4DPop Macros.4dbase/Documentation/duplicate.gif b/Build/Components/4DPop Macros.4dbase/Contents/Documentation/duplicate.gif similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Documentation/duplicate.gif rename to Build/Components/4DPop Macros.4dbase/Contents/Documentation/duplicate.gif diff --git a/Build/Components/4DPop Macros.4dbase/Documentation/filter.png b/Build/Components/4DPop Macros.4dbase/Contents/Documentation/filter.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Documentation/filter.png rename to Build/Components/4DPop Macros.4dbase/Contents/Documentation/filter.png diff --git a/Build/Components/4DPop Macros.4dbase/Documentation/prefBeautifier.png b/Build/Components/4DPop Macros.4dbase/Contents/Documentation/prefBeautifier.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Documentation/prefBeautifier.png rename to Build/Components/4DPop Macros.4dbase/Contents/Documentation/prefBeautifier.png diff --git a/Build/Components/4DPop Macros.4dbase/Documentation/prefDeclaration.png b/Build/Components/4DPop Macros.4dbase/Contents/Documentation/prefDeclaration.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Documentation/prefDeclaration.png rename to Build/Components/4DPop Macros.4dbase/Contents/Documentation/prefDeclaration.png diff --git a/Build/Components/4DPop Macros.4dbase/Documentation/specialPaste.png b/Build/Components/4DPop Macros.4dbase/Contents/Documentation/specialPaste.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Documentation/specialPaste.png rename to Build/Components/4DPop Macros.4dbase/Contents/Documentation/specialPaste.png diff --git a/Build/Components/4DPop Macros.4dbase/Documentation/tooltip.png b/Build/Components/4DPop Macros.4dbase/Contents/Documentation/tooltip.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Documentation/tooltip.png rename to Build/Components/4DPop Macros.4dbase/Contents/Documentation/tooltip.png diff --git a/Build/Components/4DPop Macros.4dbase/Info.plist b/Build/Components/4DPop Macros.4dbase/Contents/Info.plist old mode 100755 new mode 100644 similarity index 83% rename from Build/Components/4DPop Macros.4dbase/Info.plist rename to Build/Components/4DPop Macros.4dbase/Contents/Info.plist index 5354f29..178312c --- a/Build/Components/4DPop Macros.4dbase/Info.plist +++ b/Build/Components/4DPop Macros.4dbase/Contents/Info.plist @@ -6,15 +6,15 @@ CFBundleName 4DPop Macros CFBundleVersion - 289 + 293 NSHumanReadableCopyright ©vdl 2009-2024 CFBundleGetInfoString - 20R7 + 20R8 CFBundleLongVersionString - 20R7 (288) + 20R8 (292) CFBundleShortVersionString - 20R7 + 20R8 CFBundleDisplayName 4DPop Macros diff --git a/Build/Components/4DPop Macros.4dbase/Contents/Libraries/lib4d-arm64.dylib b/Build/Components/4DPop Macros.4dbase/Contents/Libraries/lib4d-arm64.dylib new file mode 100644 index 0000000..9a9f154 Binary files /dev/null and b/Build/Components/4DPop Macros.4dbase/Contents/Libraries/lib4d-arm64.dylib differ diff --git a/Build/Components/4DPop Macros.4dbase/Macros v2/4DPop_Macros.xml b/Build/Components/4DPop Macros.4dbase/Contents/Macros v2/4DPop_Macros.xml old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Macros v2/4DPop_Macros.xml rename to Build/Components/4DPop Macros.4dbase/Contents/Macros v2/4DPop_Macros.xml diff --git a/Build/Components/4DPop Macros.4dbase/Resources/4DPop.json b/Build/Components/4DPop Macros.4dbase/Contents/Resources/4DPop.json similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/4DPop.json rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/4DPop.json diff --git a/Build/Components/4DPop Macros.4dbase/Resources/4DPop.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/4DPop.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/4DPop.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/4DPop.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/4DPop_Macros.xml b/Build/Components/4DPop Macros.4dbase/Contents/Resources/4DPop_Macros.xml old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/4DPop_Macros.xml rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/4DPop_Macros.xml diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/Action.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/Action.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/Action.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/Action.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/AddFile.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/AddFile.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/AddFile.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/AddFile.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/AddTransunit.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/AddTransunit.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/AddTransunit.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/AddTransunit.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/Close.4pct b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/Close.4pct old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/Close.4pct rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/Close.4pct diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/Delete.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/Delete.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/Delete.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/Delete.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/FootColor.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/FootColor.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/FootColor.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/FootColor.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/FooterBack.tiff b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/FooterBack.tiff old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/FooterBack.tiff rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/FooterBack.tiff diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/FooterButtonBack.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/FooterButtonBack.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/FooterButtonBack.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/FooterButtonBack.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/Preferences.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/Preferences.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/Preferences.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/Preferences.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/Scomber Scombrus.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/Scomber Scombrus.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/Scomber Scombrus.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/Scomber Scombrus.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/Spinner.gif b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/Spinner.gif old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/Spinner.gif rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/Spinner.gif diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/SpinnerMac.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/SpinnerMac.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/SpinnerMac.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/SpinnerMac.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/SplitterVerticalHandle.tiff b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/SplitterVerticalHandle.tiff old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/SplitterVerticalHandle.tiff rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/SplitterVerticalHandle.tiff diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/ToolbarBackground.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/ToolbarBackground.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/ToolbarBackground.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/ToolbarBackground.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_00.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_00.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_00.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_00.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_00_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_00_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_00_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_00_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_01.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_01.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_01.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_01.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_01_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_01_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_01_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_01_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_02.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_02.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_02.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_02.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_02_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_02_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_02_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_02_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_03 _dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_03 _dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_03 _dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_03 _dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_03.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_03.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_03.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_03.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_04.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_04.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_04.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_04.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_04_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_04_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_04_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_04_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_05.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_05.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_05.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_05.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_05_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_05_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_05_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_05_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_06.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_06.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_06.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_06.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_06_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_06_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_06_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_06_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_08.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_08.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_08.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_08.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_08_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_08_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_08_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_08_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_09.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_09.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_09.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_09.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_09_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_09_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_09_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_09_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_11.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_11.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_11.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_11.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_11_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_11_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_11_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_11_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_12.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_12.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_12.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_12.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_12_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_12_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_12_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_12_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_23.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_23.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_23.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_23.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_23_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_23_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_23_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_23_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_25.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_25.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_25.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_25.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_25_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_25_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_25_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_25_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_30.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_30.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_30.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_30.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_30_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_30_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_30_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_30_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_35.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_35.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_35.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_35.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_35_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_35_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_35_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_35_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_38.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_38.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_38.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_38.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_38_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_38_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_38_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_38_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_42.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_42.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_42.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_42.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_42_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_42_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/fieldIcons/field_42_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/fieldIcons/field_42_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/filter.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/filter.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/filter.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/filter.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/filter_dark.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/filter_dark.png similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/filter_dark.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/filter_dark.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/genericFile.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/genericFile.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/genericFile.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/genericFile.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/genericFolder.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/genericFolder.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/genericFolder.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/genericFolder.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/genericHardDrive.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/genericHardDrive.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/genericHardDrive.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/genericHardDrive.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_0.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_0.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_0.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_0.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_1.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_1.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_1.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_1.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_10.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_10.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_10.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_10.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_11.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_11.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_11.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_11.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_12.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_12.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_12.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_12.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_13.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_13.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_13.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_13.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_14.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_14.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_14.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_14.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_15.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_15.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_15.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_15.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_2.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_2.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_2.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_2.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_3.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_3.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_3.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_3.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_4.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_4.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_4.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_4.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_5.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_5.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_5.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_5.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_6.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_6.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_6.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_6.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_7.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_7.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_7.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_7.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_8.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_8.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_8.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_8.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_9.png b/Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_9.png old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/Images/types/field_9.png rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/Images/types/field_9.png diff --git a/Build/Components/4DPop Macros.4dbase/Resources/InfoPlist.strings b/Build/Components/4DPop Macros.4dbase/Contents/Resources/InfoPlist.strings old mode 100755 new mode 100644 similarity index 75% rename from Build/Components/4DPop Macros.4dbase/Resources/InfoPlist.strings rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/InfoPlist.strings index 2dc5f67..8fd1d73 Binary files a/Build/Components/4DPop Macros.4dbase/Resources/InfoPlist.strings and b/Build/Components/4DPop Macros.4dbase/Contents/Resources/InfoPlist.strings differ diff --git a/Build/Components/4DPop Macros.4dbase/Resources/constants.xlf b/Build/Components/4DPop Macros.4dbase/Contents/Resources/constants.xlf old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/constants.xlf rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/constants.xlf diff --git a/Build/Components/4DPop Macros.4dbase/Resources/controlFlow.json b/Build/Components/4DPop Macros.4dbase/Contents/Resources/controlFlow.json old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/controlFlow.json rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/controlFlow.json diff --git a/Build/Components/4DPop Macros.4dbase/Resources/declarations.settings b/Build/Components/4DPop Macros.4dbase/Contents/Resources/declarations.settings old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/declarations.settings rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/declarations.settings diff --git a/Build/Components/4DPop Macros.4dbase/Resources/default.settings b/Build/Components/4DPop Macros.4dbase/Contents/Resources/default.settings old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/default.settings rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/default.settings diff --git a/Build/Components/4DPop Macros.4dbase/Resources/en.lproj/4DPop Macros.xlf b/Build/Components/4DPop Macros.4dbase/Contents/Resources/en.lproj/4DPop Macros.xlf old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/en.lproj/4DPop Macros.xlf rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/en.lproj/4DPop Macros.xlf diff --git a/Build/Components/4DPop Macros.4dbase/Resources/en.lproj/Common.xlf b/Build/Components/4DPop Macros.4dbase/Contents/Resources/en.lproj/Common.xlf old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/en.lproj/Common.xlf rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/en.lproj/Common.xlf diff --git a/Build/Components/4DPop Macros.4dbase/Resources/fr.lproj/4DPop Macros.xlf b/Build/Components/4DPop Macros.4dbase/Contents/Resources/fr.lproj/4DPop Macros.xlf old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/fr.lproj/4DPop Macros.xlf rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/fr.lproj/4DPop Macros.xlf diff --git a/Build/Components/4DPop Macros.4dbase/Resources/fr.lproj/4DPop_Macros.xml b/Build/Components/4DPop Macros.4dbase/Contents/Resources/fr.lproj/4DPop_Macros.xml old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/fr.lproj/4DPop_Macros.xml rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/fr.lproj/4DPop_Macros.xml diff --git a/Build/Components/4DPop Macros.4dbase/Resources/fr.lproj/Common.xlf b/Build/Components/4DPop Macros.4dbase/Contents/Resources/fr.lproj/Common.xlf old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/fr.lproj/Common.xlf rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/fr.lproj/Common.xlf diff --git a/Build/Components/4DPop Macros.4dbase/Resources/macros.dtd b/Build/Components/4DPop Macros.4dbase/Contents/Resources/macros.dtd old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/macros.dtd rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/macros.dtd diff --git a/Build/Components/4DPop Macros.4dbase/Resources/preferences.template b/Build/Components/4DPop Macros.4dbase/Contents/Resources/preferences.template old mode 100755 new mode 100644 similarity index 100% rename from Build/Components/4DPop Macros.4dbase/Resources/preferences.template rename to Build/Components/4DPop Macros.4dbase/Contents/Resources/preferences.template diff --git a/Build/Components/4DPop Macros.4dbase/Libraries/lib4d-arm64.dylib b/Build/Components/4DPop Macros.4dbase/Libraries/lib4d-arm64.dylib deleted file mode 100644 index 273deff..0000000 Binary files a/Build/Components/4DPop Macros.4dbase/Libraries/lib4d-arm64.dylib and /dev/null differ diff --git a/Info.plist b/Info.plist index 5354f29..178312c 100755 --- a/Info.plist +++ b/Info.plist @@ -6,15 +6,15 @@ CFBundleName 4DPop Macros CFBundleVersion - 289 + 293 NSHumanReadableCopyright ©vdl 2009-2024 CFBundleGetInfoString - 20R7 + 20R8 CFBundleLongVersionString - 20R7 (288) + 20R8 (292) CFBundleShortVersionString - 20R7 + 20R8 CFBundleDisplayName 4DPop Macros diff --git a/Project/4DPop Macros.4DProject b/Project/4DPop Macros.4DProject index 2dd66e2..53239f9 100755 --- a/Project/4DPop Macros.4DProject +++ b/Project/4DPop Macros.4DProject @@ -1,4 +1,4 @@ { "$comment": "The project file let you override the location for most folders", - "$4DPopAppMakerToolVersion": "20R7" + "$4DPopAppMakerToolVersion": "20R8" } \ No newline at end of file diff --git a/Project/Sources/Classes/beautifier.4dm b/Project/Sources/Classes/beautifier.4dm index f49ac2e..9e7bca8 100644 --- a/Project/Sources/Classes/beautifier.4dm +++ b/Project/Sources/Classes/beautifier.4dm @@ -1,10 +1,19 @@ -Class extends macro - -property _controls; _patterns; settings : Object -property separators; controlFlow : Collection +property options : Object +property separators; controlFlow; closures : Collection property numberOfSeparators : Integer property specialComments : Text +property previousLine : Text:="" +property nextLine : Text:="" +property multiLines : Boolean:=False:C215 +property loopAndBranching : Collection:=[] +property caseOfLevel : Integer:=-1 + +property _controls; _patterns : Object +property _splittableCommands : Collection + +Class extends macro + Class constructor() var $t : Text @@ -13,23 +22,56 @@ Class constructor() Super:C1705() - // Preferences - $file:=Folder:C1567(fk user preferences folder:K87:10).file("4DPop/4DPop Macros.settings") - $file:=$file.original ? $file.original : $file - - If ($file.exists) + // MARK: Options + Try - This:C1470.settings:=JSON Parse:C1218($file.getText()).beautifier + $file:=Folder:C1567(fk user preferences folder:K87:10).file("4DPop/4DPop Macros.settings") + $file:=$file.original ? $file.original : $file - End if + If ($file.exists) + + This:C1470.options:=JSON Parse:C1218($file.getText()).beautifier + + End if + + Catch + + This:C1470.options:={} + + End try - // Format comments - This:C1470.settings.formatComments:=This:C1470.settings.formatComments#Null:C1517 ? This:C1470.settings.formatComments : True:C214 + // Default values + For each ($t; [\ + "replaceDeprecatedCommand"; \ + "removeConsecutiveBlankLines"; \ + "removeEmptyLinesAtTheBeginOfMethod"; \ + "removeEmptyLinesAtTheEndOfMethod"; \ + "lineBreakBeforeBranchingStructures"; \ + "lineBreakBeforeLoopingStructures"; \ + "lineBreakBeforeAndAfterSequentialStructuresIncluded"; \ + "separationLineForCaseOf"; \ + "aLineOfCommentsMustBePrecededByALineBreak"; \ + "groupingClosureInstructions"; \ + "addTheIncrementForTheLoops"; \ + "splitTestss"; \ + "replaceComparisonsToAnEmptyStringByLengthTest"; \ + "replaceIfElseEndIfByChoose"; \ + "splitKeyValueLines"; \ + "formatComments"; \ + "useVar"; \ + "compoundAssignmentOperators"; \ + "splitLiterals"\ + ]) + + This:C1470.options[$t]:=This:C1470.options[$t]#Null:C1517 ? This:C1470.options[$t] : True:C214 + + End for each - // Separators - This:C1470.separators:=This:C1470.settings.separators || Split string:C1554("━━━,┅┅┅,╍╍╍,╌╌╌,__,––,⩫⩫,……,--,··,~~,..;::"; ",") + // MARK: Separators + This:C1470.separators:=This:C1470.options.separators || Split string:C1554("____,┅┅,╌╌╌,╍╍╍,..,–––,⩫⩫,……,--,··,~~,..;::"; ",") This:C1470.numberOfSeparators:=This:C1470.separators.length-1 + // MARK: Control flow $c:=JSON Parse:C1218(File:C1566("/RESOURCES/controlFlow.json").getText())[Command name:C538(41)="ALERT" ? "intl" : "fr"] This:C1470._controls:={\ @@ -37,7 +79,7 @@ Class constructor() else: $c[1]; \ endIf: $c[2]; \ caseOf: $c[3]; \ - caseOfItem: ":\\s*\\("; \ + caseOfItem: "(?mi-s)^\\s*:\\s*\\("; \ endCase: $c[4]; \ while: $c[5]; \ endWhile: $c[6]; \ @@ -51,7 +93,19 @@ Class constructor() endForEach: $c[14]\ } - $t:="(?0) - $doLineAfter:=False:C215 - - End if - End if + This:C1470.rgx.target:=$line Case of - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (Length:C16($line)=0) // Empty line + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.isCommentBlock) - $isEmptyLine:=True:C214 + This:C1470._ouput.push($raw) - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (Position:C15(kCommentMark; $line)=1) // Comment - - If (Not:C34($isComment)) // Multiline + If (Position:C15("*/"; $line)>0) // End of multiline comment - $doLineBefore:=($i>0 ? Bool:C1537($options.aLineOfCommentsMustBePrecededByALineBreak) : False:C215)\ - & ($line#(kCommentMark+"}"))\ - & ($line#(kCommentMark+"]"))\ - & ($line#(kCommentMark+")"))\ - & ($line#(kCommentMark+"%")) + This:C1470.isCommentBlock:=False:C215 End if - $doLineComment:=This:C1470.rgx.setPattern(This:C1470._patterns.commentLine).match() - - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (This:C1470.rgx.setPattern(This:C1470._patterns.If).match()) - - $doLineBefore:=Bool:C1537($options.lineBreakBeforeBranchingStructures) & Not:C34($isComment) + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.isEmpty($line)) - If (Bool:C1537($options.splitTestLines)) - - $line:=This:C1470._splitTestLine($line) +/* +An empty line is ignored if: +- The option to prevent several empty lines in a row is activated, and the previous line is empty. +- The close instruction grouping option is enabled, and the following line is one of them. +*/ + If (This:C1470.options.removeConsecutiveBlankLines && This:C1470.isEmpty(This:C1470.previousLine))\ + || (This:C1470.options.groupingClosureInstructions && ((This:C1470.isClosure(This:C1470.nextLine) || This:C1470.isEmpty(This:C1470.nextLine)))) - End if - - If (Replace string:C233($line; " "; "")=(This:C1470._controls.if+"("+Command name:C538(215)+")@")) + This:C1470.lineIndex+=1 - APPEND TO ARRAY:C911($tLon_branchAndLoop; -1) - $doLineAfter:=False:C215 - $skipLineAfter:=True:C214 + continue Else - APPEND TO ARRAY:C911($tLon_branchAndLoop; 1) - $doLineAfter:=Bool:C1537($options.lineBreakBeforeAndAfterSequentialStructuresIncluded) - $skipLineAfter:=False:C215 + This:C1470._ouput.push("") End if - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (This:C1470.rgx.setPattern(This:C1470._patterns.Else).match()) + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (Position:C15("/*"; $raw)=1) - If ($tLon_branchAndLoop{$tLon_branchAndLoop}=4) - - $doAddLine:=True:C214 - $doLineBefore:=Not:C34($isComment) - - Else + This:C1470.isCommentBlock:=(Position:C15("*/"; $raw)=0) // Start of multiline comment + + If (This:C1470.options.aLineOfCommentsMustBePrecededByALineBreak\ + && (This:C1470.lineIndex>0)\ + && This:C1470.isNotEmpty(This:C1470.previousLine)\ + && This:C1470.isNotComment(This:C1470.previousLine)\ + && This:C1470.isNotReservedComment($line)) - $doAddLine:=False:C215 - $doLineBefore:=True:C214 + This:C1470._ouput.push("") End if - $doLineAfter:=True:C214 - $skipLineAfter:=False:C215 - - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (This:C1470.rgx.setPattern(This:C1470._patterns.EndIf).match()) - - $doLineBefore:=(Not:C34($skipLineAfter) | Not:C34($isClosure))\ - & ($tLon_branchAndLoop{$tLon_branchAndLoop}#-1) - - $doLineAfter:=Not:C34($skipLineAfter) - $skipLineAfter:=True:C214 - - If (Abs:C99($tLon_branchAndLoop{$tLon_branchAndLoop})=1) + This:C1470._ouput.push($raw) + + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.isComment($line)) + +/* +A comment line is preceded by an empty line if: +- the option is enabled. +- this is not the first line. +- the preceding line is not already an empty line or a comment. +- it is not a closing comment for the compiler type //%X+. +*/ + If (This:C1470.options.aLineOfCommentsMustBePrecededByALineBreak\ + && (This:C1470.lineIndex>0)\ + && This:C1470.isNotEmpty(This:C1470.previousLine)\ + && This:C1470.isNotComment(This:C1470.previousLine)\ + && This:C1470.isNotClosingReservedComment($line)\ + && This:C1470.isNotSeparatorLineComment($line)\ + && This:C1470.isNotReservedComment($line)) - DELETE FROM ARRAY:C228($tLon_branchAndLoop; $tLon_branchAndLoop; 1) + This:C1470._ouput.push("") End if - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (This:C1470.rgx.setPattern(This:C1470._patterns.Use).match()) - - If (Bool:C1537($options.splitTestLines)) + If (This:C1470.options.formatComments && This:C1470.isNotReservedComment($line)) - $line:=This:C1470._splitTestLine($line) + $line:=This:C1470.formatComment($line) End if - $doLineBefore:=Bool:C1537($options.lineBreakBeforeBranchingStructures) & Not:C34($isComment) - $doLineAfter:=True:C214 - $skipLineAfter:=False:C215 + This:C1470._ouput.push($line) - APPEND TO ARRAY:C911($tLon_branchAndLoop; 13) + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.rgx.setPattern(This:C1470._patterns.If).match()) - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (This:C1470.rgx.setPattern(This:C1470._patterns.EndUse).match()) + This:C1470.openLoopAndBranching(1) - $doLineBefore:=Not:C34($skipLineAfter) | Not:C34($isClosure) - $doLineAfter:=Not:C34($skipLineAfter) - $skipLineAfter:=True:C214 + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.rgx.setPattern(This:C1470._patterns.Else).match()) - If ($tLon_branchAndLoop{$tLon_branchAndLoop}=13) + If (This:C1470.loopAndBranching.length>=1)\ + && (Abs:C99(This:C1470.loopAndBranching[This:C1470.loopAndBranching.length-1])=4) // Case of … Else - DELETE FROM ARRAY:C228($tLon_branchAndLoop; $tLon_branchAndLoop; 1) + This:C1470.beforeBranching(True:C214) + This:C1470._ouput.push(This:C1470.options.formatComments ? This:C1470.formatComment($line) : $line) - End if - - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (This:C1470.rgx.setPattern(This:C1470._patterns.ForEach).match()) - - If (Bool:C1537($options.splitTestLines)) + Else - $line:=This:C1470._splitTestLine($line) + This:C1470.openLoopAndBranching() End if - $doLineBefore:=Bool:C1537($options.lineBreakBeforeBranchingStructures) & Not:C34($isComment) - $doLineAfter:=True:C214 - $skipLineAfter:=False:C215 + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.rgx.setPattern(This:C1470._patterns.EndIf).match()) - APPEND TO ARRAY:C911($tLon_branchAndLoop; 14) + This:C1470.closeLoopAndBranching(1) - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (This:C1470.rgx.setPattern(This:C1470._patterns.EndForEach).match()) + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.rgx.setPattern(This:C1470._patterns.Use).match()) - $doLineBefore:=Not:C34($skipLineAfter) | Not:C34($isClosure) - $doLineAfter:=Not:C34($skipLineAfter) - $skipLineAfter:=True:C214 + This:C1470.openLoopAndBranching(13) - If ($tLon_branchAndLoop{$tLon_branchAndLoop}=14) - - DELETE FROM ARRAY:C228($tLon_branchAndLoop; $tLon_branchAndLoop; 1) - - End if + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.rgx.setPattern(This:C1470._patterns.EndUse).match()) - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (This:C1470.rgx.setPattern(This:C1470._patterns.CaseOf).match()) + This:C1470.closeLoopAndBranching(13) - $level+=1 + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.rgx.setPattern(This:C1470._patterns.ForEach).match()) - $doLineBefore:=Not:C34($isComment) - $doLineAfter:=True:C214 - $skipLineAfter:=False:C215 + This:C1470.openLoopAndBranching(14) - APPEND TO ARRAY:C911($tLon_branchAndLoop; 4) + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.rgx.setPattern(This:C1470._patterns.EndForEach).match()) - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (This:C1470.rgx.setPattern(This:C1470._controls.caseOfItem).match()) + This:C1470.closeLoopAndBranching(14) - If (Bool:C1537($options.splitTestLines)) + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.rgx.setPattern(This:C1470._patterns.CaseOf).match()) + + This:C1470.openLoopAndBranching(4) + + If (This:C1470.isNotEmpty(This:C1470.nextLine)) - $line:=This:C1470._splitTestLine($line) + This:C1470._ouput.push("") End if - $doAddLine:=Bool:C1537($options.separationLineForCaseOf) - $doLineBefore:=Not:C34($isComment) - $doLineAfter:=True:C214 - $skipLineAfter:=False:C215 + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.rgx.setPattern(This:C1470._controls.caseOfItem).match()) - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (This:C1470.rgx.setPattern(This:C1470._patterns.EndCase).match()) + This:C1470.beforeBranching(True:C214) - $doAddLine:=Bool:C1537($options.separationLineForCaseOf) - $doLineBefore:=(Not:C34($isComment) | Not:C34($isClosure)) & Not:C34($doLineComment) - $doLineAfter:=Not:C34($skipLineAfter) - $skipLineAfter:=True:C214 + $line:=This:C1470.options.splitTestss ? This:C1470.splitTests($line) : $line + $line:=This:C1470.options.formatComments ? This:C1470.formatComment($line) : $line + This:C1470._ouput.push($line) - If ($tLon_branchAndLoop{$tLon_branchAndLoop}=4) + If (This:C1470.isNotMultiline($line)\ + && This:C1470.isNotEmpty(This:C1470.nextLine)) - DELETE FROM ARRAY:C228($tLon_branchAndLoop; $tLon_branchAndLoop; 1) + This:C1470._ouput.push("") End if - $tLon_branchAndLoop{0}:=-5 - - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (This:C1470.rgx.setPattern(This:C1470._patterns.While).match()) + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.rgx.setPattern(This:C1470._patterns.EndCase).match()) - If (Bool:C1537($options.splitTestLines)) - - $line:=This:C1470._splitTestLine($line) - - End if + This:C1470.closeLoopAndBranching(4; True:C214) - $doLineBefore:=True:C214 - $doLineAfter:=True:C214 - $skipLineAfter:=False:C215 + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.rgx.setPattern(This:C1470._patterns.While).match()) - APPEND TO ARRAY:C911($tLon_branchAndLoop; 6) + This:C1470.openLoopAndBranching(6) - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.EndWhile).match()) - $doLineBefore:=Not:C34($skipLineAfter) | Not:C34($isClosure) - $doLineAfter:=Not:C34($skipLineAfter) - $skipLineAfter:=True:C214 - - If ($tLon_branchAndLoop{$tLon_branchAndLoop}=6) - - DELETE FROM ARRAY:C228($tLon_branchAndLoop; $tLon_branchAndLoop; 1) - - End if + This:C1470.closeLoopAndBranching(6) - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.For).match()) - $doLineBefore:=Not:C34($isComment) - $doLineAfter:=True:C214 - $skipLineAfter:=False:C215 - - If (Bool:C1537($options.addTheIncrementForTheLoops)) + If (This:C1470.options.addTheIncrementForTheLoops)\ + && (This:C1470.rgx.setPattern("(?mi-s)\\(([^;]*;[^;]*;[^;]*)(;.*?)?\\)").match())\ + && (This:C1470.rgx.matches[2].length=0) - $pattern:="\\(([^;]*;[^;]*;[^;]*)(;.*?)?\\)$" - ARRAY TEXT:C222($tTxt_result; 0x0000) + This:C1470.line:=Replace string:C233($line; This:C1470.rgx.matches[1].data; This:C1470.rgx.matches[1].data+";1") - If (Rgx_MatchText($pattern; $line; ->$tTxt_result)=0) - - If (Length:C16($tTxt_result{2})=0) - - $line:=Replace string:C233($line; $tTxt_result{1}; $tTxt_result{1}+";1") - - End if - End if End if - APPEND TO ARRAY:C911($tLon_branchAndLoop; 8) + This:C1470.openLoopAndBranching(8) - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.EndFor).match()) - $doLineBefore:=Not:C34($skipLineAfter) | Not:C34($isClosure) - $doLineAfter:=Not:C34($skipLineAfter) - $skipLineAfter:=True:C214 - - If ($tLon_branchAndLoop{$tLon_branchAndLoop}=8) - - DELETE FROM ARRAY:C228($tLon_branchAndLoop; $tLon_branchAndLoop; 1) - - End if + This:C1470.closeLoopAndBranching(8) - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.Repeat).match()) - $doLineBefore:=True:C214 - $doLineAfter:=True:C214 - $skipLineAfter:=False:C215 - - APPEND TO ARRAY:C911($tLon_branchAndLoop; 10) + This:C1470.openLoopAndBranching(10) - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.Until).match()) - If (Bool:C1537($options.splitTestLines)) + This:C1470.closeLoopAndBranching(10) + + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + : (This:C1470.rgx.setPattern(This:C1470._patterns.keywords).match()) + + If ((This:C1470.lineIndex>0)\ + && This:C1470.isNotEmpty(This:C1470.previousLine)\ + && This:C1470.isNotComment(This:C1470.previousLine)) - $line:=This:C1470._splitTestLine($line) + This:C1470._ouput.push("") End if - $doLineBefore:=Not:C34($skipLineAfter) | Not:C34($isClosure) - $doLineAfter:=Not:C34($skipLineAfter) - $skipLineAfter:=True:C214 + This:C1470.line:=This:C1470.options.formatComments ? This:C1470.formatComment(This:C1470.line) : This:C1470.line + This:C1470._ouput.push(This:C1470.line) - If ($tLon_branchAndLoop{$tLon_branchAndLoop}=10) + If ((This:C1470.lineIndex>0)\ + && This:C1470.isNotEmpty(This:C1470.nextLine)) - DELETE FROM ARRAY:C228($tLon_branchAndLoop; $tLon_branchAndLoop; 1) + This:C1470._ouput.push("") End if - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (This:C1470.rgx.setPattern(This:C1470._patterns.keywords).match()) - - $doLineBefore:=True:C214 - $doLineAfter:=True:C214 - $skipLineAfter:=False:C215 - - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.BeginSQL).match()) - $doLineBefore:=True:C214 - $doLineAfter:=True:C214 - $skipLineAfter:=False:C215 + This:C1470.openLoopAndBranching() - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ : (This:C1470.rgx.setPattern(This:C1470._patterns.EndSQL).match()) - $doLineBefore:=True:C214 - $doLineAfter:=True:C214 - $skipLineAfter:=False:C215 + This:C1470.closeLoopAndBranching() - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ Else - $isEmptyLine:=False:C215 - $doLineBefore:=$isClosure + $line:=This:C1470.options.formatComments ? This:C1470.formatComment($line) : $line + $line:=This:C1470.options.splitKeyValueLines ? This:C1470.splitKeyValueLine($line) : $line + $line:=This:C1470.options.splitLiterals ? This:C1470.splitObject($line) : $line + $line:=This:C1470.options.splitLiterals ? This:C1470.splitCollection($line) : $line + + This:C1470._ouput.push($line) - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + // ┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ End case - // Mark:Add a space before the comment and capitalize the first letter - If ($options.formatComments)\ - && (Position:C15(kCommentMark; $line)#0)\ - && /* not compiler directive */(Position:C15(kCommentMark+"%"; $line)=0)\ - && /* not URI */Not:C34(This:C1470.rgx.setPattern("(?mi-s)\"[^:]*://").match())\ - && /* not separator line */Not:C34(This:C1470.rgx.setPattern(This:C1470._patterns.commentLine).match()) + This:C1470.lineIndex+=1 + + End for each + + This:C1470.paste(This:C1470.after()) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function before($code : Text) : Text + + var $pattern; $t : Text + + // Mark:Use var instead of (_o_)C_xxx + If (This:C1470.options.useVar) + + $pattern:="(?-msi)(? + + return $code + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function after() : Text + + var $t : Text + var $indx : Integer + + // MARK: Remove consecutive blank lines + If (This:C1470.options.removeConsecutiveBlankLines) - $isClosure:=$isEnd - $isComment:=(Position:C15(kCommentMark; $line)>0) && (Position:C15(kCommentMark; $line)<=2) + var $c : Collection:=[] - If (Not:C34($severalLines)) + For each ($t; This:C1470._ouput) - If ($doAddLine) + If (Length:C16($t)=0) + + $indx+=1 - If (Not:C34($doLineComment)) + If ($indx>1) - $level:=$level>This:C1470.numberOfSeparators\ - ? This:C1470.numberOfSeparators\ - : $level<1 ? 1 : $level + continue + + Else - $line:=kCommentMark\ - +(This:C1470.separators[$level]*(20-($level\2)))\ - +"\r"\ - +$line + $c.push($t) End if - $level-=Num:C11($tLon_branchAndLoop{0}=-5) + Else + + $indx:=0 + $c.push($t) + + End if + End for each + + This:C1470._ouput:=$c + + End if + + // MARK: Delete empty lines at the beginning of the method + If (This:C1470.options.removeEmptyLinesAtTheBeginOfMethod)\ + && (This:C1470._ouput.length>0) + + While (This:C1470._ouput[0]="") + + This:C1470._ouput:=This:C1470._ouput.remove(0; 1) + + End while + End if + + // MARK: Remove empty lines at the end of the method + If (This:C1470.options.removeEmptyLinesAtTheEndOfMethod)\ + && (This:C1470._ouput.length>0) + + $indx:=This:C1470._ouput.length-1 + + If (This:C1470._ouput[$indx]="") + + This:C1470._ouput:=This:C1470._ouput.remove($indx; 1) + + End if + End if + + return This:C1470._ouput.join("\r") + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function formatComment($line : Text) : Text + + var $start : Integer:=Position:C15(kCommentMark; $line) + + If ($start=0) + + return $line + + End if + + // Marker comments in uppercase + $line:=Replace string:C233($line; "mark:"; "MARK:") + $line:=Replace string:C233($line; "todo:"; "TODO:") + $line:=Replace string:C233($line; "fixme:"; "FIXME:") + + var $code : Text:=Substring:C12($line; 1; $start-1) + var $comment : Text:=Delete string:C232($line; 1; $start-1+Length:C16(kCommentMark)) + var $c : Collection:=Split string:C1554($comment; " "; sk ignore empty strings:K86:1+sk trim spaces:K86:2) + + If ($c.length=0) + + return kCommentMark + + End if + + ARRAY LONGINT:C221($pos; 0x0000) + ARRAY LONGINT:C221($len; 0x0000) + + Case of + + // ______________________________________________________ + : (Match regex:C1019("(?mi-s)\"[^:]*:"+kCommentMark+""; $comment; 1)) // Don't modify url like "https://…" + + If ($comment[[1]]#" ") + + $comment:=" "+$comment + + End if + + $comment[[2]]:=Uppercase:C13($comment[[2]]) + + return $code+kCommentMark+$comment + + // ______________________________________________________ + : (Match regex:C1019("(?mi-s)^\\s*((?:mark|todo|fixme):-*)(.*)$"; $comment; 1; $pos; $len; *)) + + var $marker : Text:=Substring:C12($comment; $pos{1}; $len{1}) + + If ($marker[[1]]#" ") + + $marker:=" "+Uppercase:C13($marker) + + End if + + $comment:=Substring:C12($comment; $pos{2}; $len{2}) + + If (Length:C16($comment)=0) + + return kCommentMark+$marker + + End if + + If ($comment[[1]]#" ") + + $comment:=" "+$comment + + End if + + $comment[[2]]:=Uppercase:C13($comment[[2]]) + + return kCommentMark+$marker+$comment + + // ______________________________________________________ + Else + + var $t : Text:=$c[0] + $t[[1]]:=Uppercase:C13($t[[1]]) + $c[0]:=$t + + $c.insert(0; kCommentMark) + + If (Length:C16($code)>0) - $doLineComment:=False:C215 - $doAddLine:=False:C215 + $c.insert(0; $code) End if - If ($doLineBefore | $doReturn) + return $c.join(" ") + + // ______________________________________________________ + End case + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isClosure($line : Text) : Boolean + + var $t : Text + + If (This:C1470.isEmpty($line)) + + return + + End if + + For each ($t; This:C1470.closures) + + If (Position:C15($t; $line)=1) + + return True:C214 + + End if + End for each + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isNotClosure($line : Text) : Boolean + + return Not:C34(This:C1470.isClosure($line)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function openLoopAndBranching($id : Integer) + + This:C1470.beforeBranching() + + This:C1470.line:=This:C1470.options.splitTestss ? This:C1470.splitTests(This:C1470.line) : This:C1470.line + This:C1470.line:=This:C1470.options.formatComments ? This:C1470.formatComment(This:C1470.line) : This:C1470.line + + This:C1470._ouput.push(This:C1470.line) + + This:C1470.afterBranching() + + If ($id>0) + + This:C1470.loopAndBranching.push($id) + + If ($id=4) // Case of + + This:C1470.caseOfLevel+=1 + This:C1470.caseOfLevel:=This:C1470.caseOfLevel>This:C1470.numberOfSeparators ? -1 : This:C1470.caseOfLevel + + End if + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function closeLoopAndBranching($id : Integer; $caseOf : Boolean) + + This:C1470.beforeClosing($caseOf) + + This:C1470.line:=This:C1470.options.formatComments ? This:C1470.formatComment(This:C1470.line) : This:C1470.line + This:C1470._ouput.push(This:C1470.line) + +/*A line break after is mandatory: +- The grouping closing instruction is disabled +or +- The next line is not empty +- The next line is not a closure +*/ + If (Not:C34(This:C1470.options.groupingClosureInstructions))\ + || (This:C1470.isNotClosure(This:C1470.nextLine)\ + && (This:C1470.lineIndex>0)\ + && This:C1470.isNotEmpty(This:C1470.nextLine)\ + && This:C1470.isNotReservedComment(This:C1470.nextLine)) + + This:C1470._ouput.push("") + + End if + + If ($id>0) + + If (This:C1470.loopAndBranching.length<1) + + return + + End if + + If (Abs:C99(This:C1470.loopAndBranching[This:C1470.loopAndBranching.length-1])=$id) + + This:C1470.loopAndBranching.pop() + + If ($id=4) // Case of - $line:=($isEmptyLine | ($i=0) ? "" : "\r")+$line - $isEmptyLine:=False:C215 - $doLineBefore:=False:C215 - $doReturn:=False:C215 + This:C1470.caseOfLevel-=1 + This:C1470.caseOfLevel:=This:C1470.caseOfLevel<0 ? 0 : This:C1470.caseOfLevel End if End if + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function beforeBranching($caseOf : Boolean) + + If (This:C1470.lineIndex=0) + + // - $severalLines:=($line="@\\") + End if + + If ($caseOf) - If (Not:C34($severalLines))\ - && Not:C34($isComment)\ - && Bool:C1537($options.splitKeyValueLines) + If (This:C1470.options.separationLineForCaseOf)\ + && (This:C1470.isNotSeparatorLineComment(This:C1470.previousLine)) - For each ($o; This:C1470._splittableCommands) + If (This:C1470.isNotEmpty(This:C1470.previousLine))\ + || (This:C1470.isComment(This:C1470.previousLine)) - If (This:C1470.rgx.setTarget($line).setPattern(Replace string:C233(This:C1470._patterns.splittableCommands; "{command}"; $o.name)).match()) - - $line:=This:C1470._splitIntoKeyAndValue($line; $o) - - End if - End for each + This:C1470._ouput.push("") + + End if + If (This:C1470.caseOfLevel>=0) + + This:C1470._ouput.push(kCommentMark+(This:C1470.separators[This:C1470.caseOfLevel]*(20))) + + End if End if - $code+=$line+"\r" - $i+=1 + return - End for each + End if - // Mark:Remove consecutive blank lines - If (Bool:C1537($options.removeConsecutiveBlankLines)) +/* +A line break is mandatory before an opening instruction: + - The option is enabled. + - The previous line is not empty + - The previous line is not a comment +*/ + If (Not:C34(This:C1470.options.lineBreakBeforeBranchingStructures)) - $code:=This:C1470.rgx.setTarget($code).setPattern("[\\r\\n]{2,}").substitute("\r\r") + return End if - // Mark:Remove empty lines at the end of the method - If (Bool:C1537($options.removeEmptyLinesAtTheEndOfMethod)) + If (This:C1470.isNotEmpty(This:C1470.previousLine)\ + && This:C1470.isNotComment(This:C1470.previousLine)) - $code:=This:C1470.rgx.setTarget($code).setPattern("(\\r*)$").substitute("") + This:C1470._ouput.push("") End if - This:C1470._paste($code) + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function afterBranching() - // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** -Function _formatComment($line : Text) : Text + If (This:C1470.isNotEmpty(This:C1470.nextLine)\ + && This:C1470.isNotMultiline(This:C1470.line)) + + This:C1470._ouput.push("") + + End if - var $code; $t : Text - var $start : Integer - var $c : Collection + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function beforeClosing($caseOf : Boolean) + + If (This:C1470.lineIndex=0) + + return // Not for the first line + + End if + + If ($caseOf) + + If (This:C1470.options.separationLineForCaseOf)\ + && (This:C1470.isNotSeparatorLineComment(This:C1470.previousLine)) + + If (This:C1470.isNotEmpty(This:C1470.previousLine))\ + || (This:C1470.isComment(This:C1470.previousLine)) + + This:C1470._ouput.push("") + + End if + + If (This:C1470.caseOfLevel>=0) + + This:C1470._ouput.push(kCommentMark+(This:C1470.separators[This:C1470.caseOfLevel]*(20))) + + End if + End if + + return + + End if + +/* +A line break is mandatory before a closing instruction: + - The option is enabled. + - The previous line is not empty + - The previous line is not a separator line comment like /mark:-xxx + - The current line is not a closure, nor is the next line +or + - The grouping closing instruction is disabled +or + - The grouping closing instruction is enabled + - The previous line is not a closure instruction - $start:=Position:C15(kCommentMark; $line) - $code:=Substring:C12($line; 1; $start-1) - $line:=Delete string:C232($line; 1; $start-1+2) +*/ - $c:=Split string:C1554($line; " "; sk ignore empty strings:K86:1+sk trim spaces:K86:2) + If (This:C1470.options.lineBreakBeforeBranchingStructures\ + && This:C1470.isNotEmpty(This:C1470.previousLine)\ + && This:C1470.isNotSeparatorLineComment(This:C1470.previousLine)\ + && This:C1470.isNotClosure(This:C1470.previousLine)) + + This:C1470._ouput.push("") + + return + + End if - If ($c.length>0) + If (Not:C34(This:C1470.options.groupingClosureInstructions)\ + && This:C1470.isNotEmpty(This:C1470.previousLine)\ + && This:C1470.isNotSeparatorLineComment(This:C1470.previousLine)) + + This:C1470._ouput.push("") - $t:=$c[0] - $t[[1]]:=Uppercase:C13($t[[1]]) - $c[0]:=$t + return End if - $c.insert(0; kCommentMark) - $c.insert(0; $code) + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function splitTests($line : Text) : Text - return $c.join(" ") + return This:C1470.rgx.setTarget($line).setPattern("(?mi-s)(\\)\\s*(&{1,2}|\\|{1,2})\\s*\\()").substitute(")\\\r\\\r\\2(") - // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** -Function _splitTestLine($line : Text) : Text + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function splitObject($line : Text) : Text - return This:C1470.rgx.setTarget($line).setPattern("(?mi-s)(\\)\\s*(&{1,2}|\\|{1,2})\\s*\\()").substitute(")\\\r\\2(") + return This:C1470._splitLiterals($line; "{}") - // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** -Function _splitIntoKeyAndValue($code : Text; $cmd : Object) : Text + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function splitCollection($line : Text) : Text + + return This:C1470._splitLiterals($line; "[]") - var $prefix; $splitted; $t : Text - var $closingParenthesisPosition; $firstSemicolonPosition; $nextSemicolonPosition; $openingParenthesisPosition; $pos : Integer + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function _splitLiterals($line : Text; $dlmt : Text) : Text + + var $comment : Text - While ($code[[1]]="\r") + var $pattern : Text + $pattern:="(?mi-s)^.*?:=\\{1}[^}]*?\\{2}\\s*(?:/[/*].*)?$" + $pattern:=Replace string:C233($pattern; "{1}"; $dlmt[[1]]) + $pattern:=Replace string:C233($pattern; "{2}"; $dlmt[[2]]) + + If (Not:C34(Match regex:C1019($pattern; $line; 1; *))) - $prefix+="\r" - $code:=Delete string:C232($code; 1; 1) + return $line - End while + End if - Case of + var $c : Collection:=Split string:C1554($line; ":=") + + If ($c.length#2) + + return $line + + End if + + var $var : Text:=$c[0] + + $c:=Split string:C1554($c[1]; kCommentMark) + + If ($c.length=2) + + $comment:=$c[1] + + End if + + $c[0]:=Delete string:C232($c[0]; 1; 1) + $c[0]:=Delete string:C232($c[0]; Length:C16($c[0]); 1) + $c:=Split string:C1554($c[0]; ";"; sk trim spaces:K86:2) + + If ($c.length<=2) + + return $line + + End if + + var $t : Text:=$c.pop() + var $out : Collection:=$c.map(Formula:C1597($1.value+";\\")) + $out.push($t) + + return $var+":="+$dlmt[[1]]+"\\\r"+$out.join("\r")+$dlmt[[2]]+(Length:C16($comment)>0 ? kCommentMark+$comment : "") + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function splitKeyValueLine($line : Text) : Text + + var $cmd : Object + + For each ($cmd; This:C1470._splittableCommands) + + If (Position:C15($cmd.name; $line)=0) - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : ($cmd.id=1471) // New Object + continue - $pos:=Position:C15($cmd.name; $code) - $splitted:=$prefix+Substring:C12($code; 1; $pos+Length:C16($cmd.name)) - $code:=Delete string:C232($code; 1; Length:C16($splitted)-Length:C16($prefix)) - $splitted+="\\\r" + End if + + $line:=This:C1470._splitIntoKeyAndValue($line; $cmd) + + End for each + + return $line + + // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +Function _splitIntoKeyAndValue($code : Text; $cmd : Object) : Text + + var $i; $start : Integer + var $c : Collection + + Case of - $pos:=Position:C15(";"; $code) - $openingParenthesisPosition:=Position:C15("("; $code) // Open parenthesis + // MARK:-SVG SET ATTRIBUTE + : ($cmd.id=1055) - If ($openingParenthesisPosition>0)\ - && ($openingParenthesisPosition<$pos) + If (Not:C34(This:C1470.rgx.setPattern($cmd.pattern).match(True:C214))) - $closingParenthesisPosition:=Position:C15(")"; $code; $openingParenthesisPosition+1) - $pos:=Position:C15(";"; $code; $closingParenthesisPosition+1) + return $code End if - // Go to the second semicolon - $pos:=Position:C15(";"; $code; $pos+1) + $c:=Split string:C1554(This:C1470.rgx.matches[1].data; ";"; sk trim spaces:K86:2) - If ($pos>0) + If ($c[0]="*") // *;name;id + + If ($c.length<6)\ + || ((($c.length-1)%2)#0) + + return $code + + End if + + $code:=$cmd.name+"("+$c[0]+";"+$c[1]+";"+$c[2]+";\\\r" + $start:=3 + + Else // Var;id + + If ($c.length<=5)\ + || (($c.length%2)#0) + + return $code + + End if - $splitted+=Substring:C12($code; 1; $pos)+"\\\r" - $code:=Substring:C12($code; $pos+1) + $code:=$cmd.name+"("+$c[0]+";"+$c[1]+";\\\r" + $start:=2 End if - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : ($cmd.id=1055) // SVG SET ATTRIBUTE - - $splitted:=$prefix+$cmd.name+"(" - $code:=Delete string:C232($code; 1; Length:C16($splitted)-Length:C16($prefix)) + // MARK:-OB SET + : ($cmd.id=1220) - If ($code[[1]]="*") + If (Not:C34(This:C1470.rgx.setPattern($cmd.pattern).match(True:C214))) - $splitted+="*;" - $code:=Substring:C12($code; 3) + return $code End if - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : ($cmd.id=1220) // OB SET + $c:=Split string:C1554(This:C1470.rgx.matches[2].data; ";"; sk trim spaces:K86:2) - $pos:=Position:C15(";"; $code) - - If ($pos>0) + If ($c.length<5)\ + || (($c.length%2)#0) - $splitted:=$prefix+Substring:C12($code; 1; $pos)+"\\\r" - $code:=Substring:C12($code; $pos+1) + return $code End if - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : ($cmd.id=865) // DOM Create XML element - - $pos:=Position:C15($cmd.name; $code) - $splitted:=$prefix+Substring:C12($code; 1; $pos+Length:C16($cmd.name)) - $code:=Delete string:C232($code; 1; Length:C16($splitted)-Length:C16($prefix)) + $code:=$cmd.name+"("+This:C1470.rgx.matches[1].data+";\\\r" + $start:=0 - $pos:=Position:C15(";"; $code) - $openingParenthesisPosition:=Position:C15("("; $code) // Open parenthesis + // MARK:-DOM Create XML element + : ($cmd.id=865) - If ($openingParenthesisPosition>0)\ - && ($openingParenthesisPosition<$pos) + If (Not:C34(This:C1470.rgx.setPattern($cmd.pattern).match(True:C214))) - $closingParenthesisPosition:=Position:C15(")"; $code; $openingParenthesisPosition+1) - $pos:=Position:C15(";"; $code; $closingParenthesisPosition+1) + return $code End if - // Go to the second semicolon - $pos:=Position:C15(";"; $code; $pos+1) + $c:=Split string:C1554(This:C1470.rgx.matches[2].data; ";"; sk trim spaces:K86:2) - If ($pos>0) + If ($c.length<5)\ + || (($c.length%2)#0) - $splitted+=Substring:C12($code; 1; $pos)+"\\\r" - $code:=Substring:C12($code; $pos+1) + return $code End if - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : ($cmd.id=866) // DOM SET XML ATTRIBUTE + $code:=This:C1470.rgx.matches[1].data+$cmd.name+"("+$c[0]+";"+$c[1]+";\\\r" + $start:=2 - $splitted:=$cmd.name+"(" + // MARK:-DOM SET XML ATTRIBUTE + : ($cmd.id=866) - $code:=Delete string:C232($code; 1; Length:C16($splitted)) - - $pos:=Position:C15(";"; $code) - $openingParenthesisPosition:=Position:C15("("; $code) // Open parenthesis - - If ($openingParenthesisPosition>0)\ - && ($openingParenthesisPosition<$pos) + If (Not:C34(This:C1470.rgx.setPattern($cmd.pattern).match(True:C214))) - $closingParenthesisPosition:=Position:C15(")"; $code; $openingParenthesisPosition+1) - $pos:=Position:C15(";"; $code; $closingParenthesisPosition+1) + return $code End if - If ($pos>0) + $c:=Split string:C1554(This:C1470.rgx.matches[1].data; ";"; sk trim spaces:K86:2) + + If ($c.length<4)\ + || ((($c.length-1)%2)#0) - $splitted:=$prefix+$splitted+Substring:C12($code; 1; $pos)+"\\\r" - $code:=Substring:C12($code; $pos+1) + return $code End if - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : ($cmd.id=1093) // ST SET ATTRIBUTES  + $code:=$cmd.name+"("+$c[0]+";\\\r" + $start:=1 - $splitted:=$prefix+$cmd.name+"(" - $code:=Delete string:C232($code; 1; Length:C16($splitted)-Length:C16($prefix)) + // MARK:-ST SET ATTRIBUTES  + : ($cmd.id=1093) - If ($code[[1]]="*") + If (Not:C34(This:C1470.rgx.setPattern($cmd.pattern).match(True:C214))) - $splitted+="*;" - $code:=Substring:C12($code; 3) + return $code End if - // Object - $pos:=Position:C15(";"; $code) + $c:=Split string:C1554(This:C1470.rgx.matches[1].data; ";"; sk trim spaces:K86:2) - $t:=Substring:C12($code; 1; $pos) - $splitted+=$t - $code:=Delete string:C232($code; 1; Length:C16($t)) - - // StartSel - $pos:=Position:C15(";"; $code) - - $t:=Substring:C12($code; 1; $pos) - $splitted+=$t - $code:=Delete string:C232($code; 1; Length:C16($t)) - - // EndSel - $pos:=Position:C15(";"; $code) - - $t:=Substring:C12($code; 1; $pos) - $splitted+=$t+"\\\r" - $code:=Delete string:C232($code; 1; Length:C16($t)) + If ($c[0]="*") // *;name;id + + If ($c.length<6)\ + || (($c.length%2)#0) + + return $code + + End if + + $code:=$cmd.name+"(*;"+$c[1]+";"+$c[2]+";"+$c[3]+";\\\r" + $start:=4 + + Else // Var;id + + If ($c.length<=5)\ + || ((($c.length-1)%2)#0) + + return $code + + End if + + $code:=$cmd.name+"("+$c[0]+";"+$c[1]+";"+$c[2]+";\\\r" + $start:=3 + + End if - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + // MARK:- Else // Oops + return $code - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + // MARK:- End case - // Go to the first semicolon - $firstSemicolonPosition:=This:C1470._nextSemicolon($code) - - If ($firstSemicolonPosition>0) + For ($i; $start; $c.length-1; 2) - $splitted+=Substring:C12($code; 1; $firstSemicolonPosition)+"\\\r" - $code:=Substring:C12($code; $firstSemicolonPosition+1) + $code+=$c[$i]+";"+$c[$i+1] - Repeat + If (($i+1)<($c.length-1)) - // Go to the second semicolon - $nextSemicolonPosition:=This:C1470._nextSemicolon($code) + $code+=";\\\r" - If ($nextSemicolonPosition>0) - - $splitted+=Substring:C12($code; 1; $nextSemicolonPosition)+"\\\r" - $code:=Substring:C12($code; $nextSemicolonPosition+1) - - Else - - $splitted+=$code - - End if - Until ($firstSemicolonPosition=0)\ - | ($nextSemicolonPosition=0) - - Else - - $splitted+=$code - - End if - - return $splitted - - // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** -Function _nextSemicolon($code : Text)->$position : Integer - - var $closingParenthesisPosition; $firstOne; $openParenthesisPosition : Integer - - // First semicolon - $firstOne:=Position:C15(";"; $code) - - // Second semicolon - $position:=Position:C15(";"; $code; $firstOne+1) + End if + End for - // Open parenthesis - $openParenthesisPosition:=Position:C15("("; $code) + $code+=")" - If ($position>0)\ - & ($openParenthesisPosition>0)\ - & ($position>$openParenthesisPosition) + If (This:C1470.rgx.matches.length>=$cmd.commentIndex) - Repeat - - // Closing parenthesis - $closingParenthesisPosition:=Position:C15(")"; $code; $openParenthesisPosition+1) - - // Next semicolon - $position:=Position:C15(";"; $code; $closingParenthesisPosition+1) - - // Next opening parenthesis - $openParenthesisPosition:=Position:C15("("; $code; $closingParenthesisPosition+1) - - Until ($openParenthesisPosition>$position)\ - | ($openParenthesisPosition=0) + $code+=This:C1470.rgx.matches[$cmd.commentIndex-1].data - End if \ No newline at end of file + End if + + return $code \ No newline at end of file diff --git a/Project/Sources/Classes/button.4dm b/Project/Sources/Classes/button.4dm index f32ab22..0003532 100755 --- a/Project/Sources/Classes/button.4dm +++ b/Project/Sources/Classes/button.4dm @@ -1,39 +1,280 @@ -/* - -Some specificity for button widgets - -*/ - -/*═══════════════════*/ Class extends widget -/*═══════════════════*/ -Class constructor( ... ) +Class constructor($name : Text) + + Super:C1705($name) + + This:C1470[""]:={} + + This:C1470[""].styleNames:=[\ + /*00*/"None"; \ + /*01*/"Background offset"; \ + /*02*/"Push button"; \ + /*03*/"Toolbar button"; \ + /*04*/"Custom"; \ + /*05*/"Circle"; \ + /*06*/"Small system square"; \ + /*07*/"Office XP"; \ + /*08*/"Bevel"; \ + /*09*/"Rounded bevel"; \ + /*10*/"Collapse/Expand"; \ + /*11*/"Help"; \ + /*12*/"OS X Textured"; \ + /*13*/"OS X Gradient"\ + ] + + //MARK:-[Text & Picture] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get linkedPopupMenu() : Boolean + + var $c : Collection + $c:=Split string:C1554(OBJECT Get format:C894(*; This:C1470.name); ";") + return Bool:C1537(($c.length>10) && $c[11]) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set linkedPopupMenu($linked : Boolean) + + This:C1470._setPopupMenu($linked ? "linked" : "none") + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setLinkedPopupMenu() : cs:C1710.button + + return This:C1470._setPopupMenu("linked") - Super:C1705($1) + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setSeparatePopupMenu() : cs:C1710.button - If (This:C1470.events.length=0) + return This:C1470._setPopupMenu("separate") + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setNoPopupMenu() : cs:C1710.button + + return This:C1470._setPopupMenu("none") + + // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** + /// Association of a pop-up menu with a 3D button +Function _setPopupMenu($value : Variant) : cs:C1710.button + +/** +If no parameter is passed the pop menu is removed, if any. +Otherwise, the possible values are : + - 0 or "none": No pop-up menu + - 1 or "linked": With linked pop-up menu + - 2 or "separate": With separate pop-up menu +**/ + + If (This:C1470.type=Object type 3D button:K79:17) + + If (Count parameters:C259>=1) + + If (Value type:C1509($value)=Is text:K8:3) + + Case of + + //______________________________________________________ + : ($value="none") + + This:C1470.setFormat(";;;;;;;;;;0") + This:C1470.removeEvent(On Alternative Click:K2:36) + + //______________________________________________________ + : ($value="linked") + + This:C1470.setFormat(";;;;;;;;;;1") + This:C1470.removeEvent(On Alternative Click:K2:36) + + //______________________________________________________ + : ($value="separate") + + This:C1470.setFormat(";;;;;;;;;;2") + This:C1470.addEvent(On Alternative Click:K2:36) + + //______________________________________________________ + End case + + Else + + This:C1470.setFormat(";;;;;;;;;;"+String:C10(Num:C11($value))) + This:C1470[Choose:C955(Num:C11($value)=2; "addEvent"; "removeEvent")](On Alternative Click:K2:36) + + End if + + Else + + This:C1470.setFormat(";;;;;;;;;;0") + This:C1470.removeEvent(On Alternative Click:K2:36) + + End if + + Else - This:C1470.events:=New collection:C1472(On Clicked:K2:4) + // #ERROR End if -/*════════════════════════════════════════════ -Tryes to underline the first capital letter or, -if not found the first letter, corresponding to -the associated key shortcut -══════════════════════════*/ -Function highlightShortcut()->$this : cs:C1710.button + return This:C1470 + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set picture($proxy : Text) + + This:C1470.setPicture($proxy) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + /// Picture linked to a button +Function setPicture($proxy : Text) : cs:C1710.button + + If (Count parameters:C259=0) + + // Remove picture + Super:C1706.setPicture() + + Else + + Super:C1706.setPicture(This:C1470._proxy($proxy)) + + End if + + return This:C1470 + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set backgroundPicture($proxy : Text) + + This:C1470.setBackgroundPicture($proxy) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Background picture linked to a button (Custom style) +Function setBackgroundPicture($proxy : Text) : cs:C1710.button + + If (Count parameters:C259=0) + + // Remove background picture + This:C1470.setFormat(";;#") + + Else + + This:C1470.setFormat(";;"+This:C1470._proxy($proxy)) + + End if + + return This:C1470 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get numStates() : Integer + + var $c : Collection + $c:=Split string:C1554(OBJECT Get format:C894(*; This:C1470.name); ";") + return $c.length>=13 ? Num:C11($c[12]) : 4 + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set numStates($states : Integer) + + This:C1470.setNumStates($states) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Number of states present in picture used as icon for the 3D button, and which + // will be used by 4D to represent the standard button states (from 0 to 6) +Function setNumStates($states : Integer) : cs:C1710.button + + If (Count parameters:C259>=1) + + This:C1470.setFormat(";;;;;;;;;;;;"+String:C10($states)) + + Else + + // Default is 4 + This:C1470.setFormat(";;;;;;;;;;;;4") + + End if + + return This:C1470 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get style() : Integer + + var $c : Collection + $c:=Split string:C1554(OBJECT Get format:C894(*; This:C1470.name); ";") + return $c.length>=7 ? Num:C11($c[6]) : 0/*default*/ + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set style($style : Integer) + + This:C1470.setStyle($style) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get styleName() : Text + + return This:C1470[""].styleNames[This:C1470.style] + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Button style +Function setStyle($style : Integer) : cs:C1710.button + +/** +style = 0: None (default) +style = 1: Background offset +style = 2: Push button +style = 3: Toolbar button +style = 4: Custom +style = 5: Circle +style = 6: Small system square +style = 7: Office XP +style = 8: Bevel +style = 9: Rounded bevel +style = 10: Collapse/Expand +style = 11: Help +style = 12: OS X Textured +style = 13: OS X Gradient +**/ + + This:C1470.setFormat(";;;;;;"+String:C10($style)) + + return This:C1470 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== + /// Returns the number of pixels delimiting the inside left and right margins of the button + /// (areas that the icon and the text must not encroach upon). +Function get horizontalMargin() : Integer + + If (This:C1470.is3DButton("horizontalMargin is only managed for 3D buttons")) + + return Num:C11(Split string:C1554(OBJECT Get format:C894(*; This:C1470.name); ";")[7]) + + End if + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> + /// Sets the number of pixels delimiting the inside left and right margins of the button + /// (areas that the icon and the text must not encroach upon). +Function set horizontalMargin($pixels : Integer) : cs:C1710.button + + If (This:C1470.is3DButton("horizontalMargin is only managed for 3D buttons")) + + Super:C1706.setFormat(";;;;;;;"+String:C10($pixels)) + + End if + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + /// Returns True if the current button is a 3D button +Function is3DButton($message : Text) : Boolean + + return [Object type 3D button:K79:17; Object type 3D checkbox:K79:27; Object type 3D radio button:K79:24].includes(This:C1470.type) + + // MARK:-[Miscellaneous] + // === === === === === === === === === === === === === === === === === === === === === === === === === === + /// Tryes to underline the first capital letter or, + /// if not found the first letter, corresponding to the associated key shortcut +Function highlightShortcut() : cs:C1710.button var $key; $t : Text var $index; $lModifier : Integer + $t:=This:C1470.title + OBJECT GET SHORTCUT:C1186(*; This:C1470.name; $key; $lModifier) If (Length:C16($key)>0) - $t:=This:C1470.getTitle() - $index:=Position:C15(Uppercase:C13($key); $t; *) If ($index=0) @@ -44,28 +285,16 @@ Function highlightShortcut()->$this : cs:C1710.button If ($index>0) - This:C1470.setTitle(Substring:C12($t; 1; $index)+Char:C90(0x0332)+Substring:C12($t; $index+1)) - - End if - End if - - $this:=This:C1470 - -/*════════════════════════════════════════════ -A hack to force a button to be boolean type - -⚠️ Obsolete in project mode because you can -choose the type for the checkboxes -══════════════════════════*/ -Function asBoolean() - var $0 : Object - - If (This:C1470.type=Object type checkbox:K79:26) - If (This:C1470.assignable) - - EXECUTE FORMULA:C63("C_BOOLEAN:C305((OBJECT Get pointer:C1124(Object named:K67:5;This.name))->)") + This:C1470.title:=Substring:C12($t; 1; $index)+Char:C90(0x0332)+Substring:C12($t; $index+1) End if + + Else + + // Remove if any + This:C1470.title:=Replace string:C233($t; Char:C90(0x0332); "") + End if - $0:=This:C1470 \ No newline at end of file + return This:C1470 + \ No newline at end of file diff --git a/Project/Sources/Classes/coord.4dm b/Project/Sources/Classes/coord.4dm new file mode 100644 index 0000000..3049d08 --- /dev/null +++ b/Project/Sources/Classes/coord.4dm @@ -0,0 +1,109 @@ +property name : Text +property left; top; right; bottom : Integer + +Class constructor($left; $top : Integer; $right : Integer; $bottom : Integer) + + This:C1470.name:="" + + Case of + + //______________________________________________________ + : (Value type:C1509($left)=Is object:K8:27) + + var $o : Object + $o:=Try($left.getCoordinates()) + + If ($o#Null:C1517) // Widget + + This:C1470.name:=String:C10($left.name) + + Else + + $o:=$left + + End if + + $left:=Num:C11($o.left) + $top:=Num:C11($o.top) + $right:=Num:C11($o.right) + $bottom:=Num:C11($o.bottom) + + //______________________________________________________ + : (Value type:C1509($left)=Is text:K8:3) // Object name + + This:C1470.name:=$left + OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) + + //______________________________________________________ + End case + + This:C1470.left:=$left + This:C1470.top:=$top + This:C1470.right:=$right + This:C1470.bottom:=$bottom + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get windowCoordinates() : Object + + var $bottom; $left; $right; $top : Integer + + $left:=This:C1470.left + $top:=This:C1470.top + $right:=This:C1470.right + $bottom:=This:C1470.bottom + + CONVERT COORDINATES:C1365($left; $top; XY Current form:K27:5; XY Current window:K27:6) + CONVERT COORDINATES:C1365($right; $bottom; XY Current form:K27:5; XY Current window:K27:6) + + return {\ + left: $left; \ + top: $top; \ + right: $right; \ + bottom: $bottom\ + } + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get screenCoordinates() : Object + + var $bottom; $left; $right; $top : Integer + + $left:=This:C1470.left + $top:=This:C1470.top + $right:=This:C1470.right + $bottom:=This:C1470.bottom + + CONVERT COORDINATES:C1365($left; $top; XY Current form:K27:5; XY Screen:K27:7) + CONVERT COORDINATES:C1365($right; $bottom; XY Current form:K27:5; XY Screen:K27:7) + + return {\ + left: $left; \ + top: $top; \ + right: $right; \ + bottom: $bottom\ + } + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get width() : Integer + + return Try(This:C1470.right-This:C1470.left) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get height() : Integer + + return Try(This:C1470.bottom-This:C1470.top) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get dimensions() : Object + + return {\ + width: This:C1470.width; \ + height: This:C1470.height\ + } + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function apply($name : Text) + + $name:=$name || This:C1470.name + ASSERT:C1129(Length:C16($name)>0; "Missing target name!") + + OBJECT SET COORDINATES:C1248(*; $name; This:C1470.left; This:C1470.top; This:C1470.right; This:C1470.bottom) \ No newline at end of file diff --git a/Project/Sources/Classes/declaration.4dm b/Project/Sources/Classes/declaration.4dm index 757a11e..a5cb3f1 100755 --- a/Project/Sources/Classes/declaration.4dm +++ b/Project/Sources/Classes/declaration.4dm @@ -1,14 +1,10 @@ -Class extends macro - -property lines : Collection:=[] property locales : Collection:=[] property parameters : Collection:=[] property classes : Collection:=[] property types : Collection:=[] +property variables : Collection -//ACI0104313 -//property $notforArray : Collection -//property $inCommentBlock: Boolean +property gramSyntax : Object property settings : Object @@ -16,33 +12,39 @@ property localeNumber : Integer:=0 property parameterNumber : Integer:=0 property _patterns : Object +property _notforArray : Collection:=["collection"; "variant"] + +Class extends macro Class constructor Super:C1705() - // Preferences - var $fileSettings : 4D:C1709.File - $fileSettings:=Folder:C1567(fk user preferences folder:K87:10).file("4DPop/4DPop Macros.settings") - $fileSettings:=$fileSettings.original || $fileSettings - - If ($fileSettings.exists) + // MARK: Settings + Try - This:C1470.settings:=JSON Parse:C1218($fileSettings.getText()).declaration + var $file : 4D:C1709.File:=Folder:C1567(fk user preferences folder:K87:10).file("4DPop/4DPop Macros.settings") + $file:=$file.original || $file - Else + If ($file.exists) + + This:C1470.settings:=JSON Parse:C1218($file.getText()).declaration + + Else + + _o_DECLARATION("Get_Syntax_Preferences") + + End if - _o_DECLARATION("Get_Syntax_Preferences") + Catch - End if - - This:C1470.$notforArray:=["collection"; "variant"] + This:C1470.settings:={} + + End try - // Flags - This:C1470.$inCommentBlock:=False:C215 + This:C1470._notforArray:=["collection"; "variant"] - var $t : Text - $t:="(?mi-s)(?0) // End of multiline comment + + This:C1470.isCommentBlock:=False:C215 + + End if //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (Position:C15("#DECLARE"; $line.code)=1) // #DECLARE + : (This:C1470.isDECLARE($line.code)) $line.type:="#DECLARE" $line.skip:=True:C214 This:C1470.parseParameters($line) //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (Match regex:C1019("(?mi-s)(singleton)*\\s*(shared)*\\s*Class\\sconstructor"; $line.code; 1; $pos; $len)) // Constructor + : (This:C1470.isConstructor($line.code)) $line.type:="Class constructor" $line.skip:=True:C214 This:C1470.parseParameters($line) //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (Match regex:C1019("(?m-si)^(?!"+kCommentMark+")"+\ - "(?:.*\\s)?Function\\s.*$"; $line.code; 1)) // Function + : (This:C1470.isFunction($line.code)) $line.type:="Function" $line.skip:=True:C214 This:C1470.parseParameters($line) //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (Match regex:C1019("(?mi-s)^("+kCommentMark+")"+\ - "|(/\\*)"+\ - "|(?:.*(\\*/))"; $line.code; 1; $pos; $len)) // COMMENTS + : (This:C1470.isComment($line.code)) $line.type:="comment" - Case of - - //╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍ - : ($pos{2}>0) // Begin comment block - - This:C1470.$inCommentBlock:=Not:C34(Match regex:C1019("(?mi-s)^/\\*.*\\*/"; $line.code; 1)) - - //╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍ - : ($pos{3}>0) // End comment block - - This:C1470.$inCommentBlock:=False:C215 - - //╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍ - End case - - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ - : (This:C1470.$inCommentBlock) // In comment block - - $line.type:="comment" + If (Position:C15("/*"; $line.code)=1) + + This:C1470.isCommentBlock:=(Position:C15("*/"; $line.code)=0) // Start of multiline comment + + End if //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ Else - // Remove textual values - Rgx_SubstituteText("(?m-si)(\"[^\"]*\")"; ""; ->$text) - - // Remove Comments - Rgx_SubstituteText("(?m-si)("+kCommentMark+".*$)"; ""; ->$text) - - // Searches parameters $0-N & ${N} into the line + // Remove textual values & comments + $text:=This:C1470.rgx.setTarget($text).setPattern("(?m-si)(\"[^\"]*\")").substitute() + $text:=This:C1470.rgx.setTarget($text).setPattern("(?m-si)(/(?:/|\\\\*).*?)$").substitute() + // Mark:Searches parameters $0-N & ${N} into the line /*------------------------------------------------------ declaration macro must omit the parameters of a formula ---> https: // Github.com/vdelachaux/4DPop-Macros/issues/6 +--> https://Github.com/vdelachaux/4DPop-Macros/issues/6 --------------------------------------------------------*/ - $t:=$text - $l:=Position:C15(Parse formula:C1576("Formula:C1597")+"("; $text; 1; *) + var $t : Text:=$text + var $l : Integer:=Position:C15(Parse formula:C1576("Formula:C1597")+"("; $text; 1; *) + var $var : Object + var $c : Collection If ($l>0) @@ -280,19 +270,18 @@ declaration macro must omit the parameters of a formula End if - $rgx:=Rgx_match({\ - pattern: "(?mi-s)(\\$\\{?\\d+\\}?)+(?!\\w)"; \ - target: $text; \ - all: True:C214}) + var $rgx : cs:C1710.regex:=This:C1470.rgx.setTarget($text).setPattern("(?mi-s)(\\$\\{?\\d+\\}?)+(?!\\w)") $text:=$t /*--------------------------------------------------------*/ - If ($rgx.success) // PARAMETER(S) + If ($rgx.match(True:C214)) - For each ($t; $rgx.match.extract("data").distinct()) + // mark:-PARAMETER(S) + For each ($t; $rgx.matches.extract("data").distinct()) - $parameter:=This:C1470.parameters.query("value=:1"; $t).pop() + var $parameter : Object + $parameter:=This:C1470.parameters.query("value=:1"; $t).first() If ($parameter=Null:C1517) @@ -342,8 +331,9 @@ declaration macro must omit the parameters of a formula End if - Else // Try to be clairvoyant + Else + // Let's take a guess $parameter.type:=This:C1470.clairvoyant($t; $line.code) End if @@ -356,20 +346,17 @@ declaration macro must omit the parameters of a formula Case of - //╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍╍ - : (Match regex:C1019("(?mi-s)^var\\s|^C_"; $text; 1)) // DECLARATION LINE + // mark:-DECLARATION LINE + : (Match regex:C1019("(?mi-s)^var\\s|^C_"; $text; 1)) $line.type:="declaration" $line.skip:=True:C214 - $rgx:=Rgx_match({\ - pattern: "(?m-si)(?\\s*)?([^/]*))?\\s*("+kCommentMark+"[^$]*)?$" + $rgx.setPattern("(?m-si)^(?!"+kCommentMark+")(.*)"+$line.type+"\\s([^(]*)(?:\\s*\\(([^)]*)\\))?(?:\\s*(?:->\\s*)?([^/]*))?\\s*("+kCommentMark+"[^$]*)?$") //______________________________________________________ : ($line.type="#DECLARE") - $pattern:="(?m-si)^(?!"+kCommentMark+")()"+$line.type+"()(?:\\s*\\(([^)]*)\\))?(?:\\s*(?:->\\s*)?([^/]*))?\\s*("+kCommentMark+"[^$]*)?$" + $rgx.setPattern("(?m-si)^(?!"+kCommentMark+")()"+$line.type+"()(?:\\s*\\(([^)]*)\\))?(?:\\s*(?:->\\s*)?([^/]*))?\\s*("+kCommentMark+"[^$]*)?$") //______________________________________________________ End case - $rgx:=Rgx_match({\ - pattern: $pattern; \ - target: $line.code; \ - all: True:C214}) - - If ($rgx.success) + If ($rgx.match(True:C214)) //$1: keywords (ie. exposed) - If ($rgx.match[1].length>0) + If ($rgx.matches[1].length>0) - $line.prefix:=$rgx.match[1].data + $line.prefix:=$rgx.matches[1].data End if //$2: function name (ie. {get/set} myFunction) - If ($rgx.match[2].length>0) + If ($rgx.matches[2].length>0) - $line.function:=$rgx.match[2].data + $line.function:=$rgx.matches[2].data End if //$3: parameters - If ($rgx.match[3].length>0) + If ($rgx.matches[3].length>0) - For each ($t; Split string:C1554($rgx.match[3].data; ";")) + For each ($t; Split string:C1554($rgx.matches[3].data; ";")) $index:=$index+1 $c:=Split string:C1554($t; ":"; sk trim spaces:K86:2) @@ -761,16 +743,16 @@ Function parseParameters($line : Object) End if //$4: return - If ($rgx.match[4].length>0) + If ($rgx.matches[4].length>0) - $c:=Split string:C1554($rgx.match[4].data; ":"; sk trim spaces:K86:2) + $c:=Split string:C1554($rgx.matches[4].data; ":"; sk trim spaces:K86:2) $parameter:={\ parameter: True:C214; \ return: True:C214; \ value: Split string:C1554($c[0]; " "; sk ignore empty strings:K86:1).join(""); \ code: $line.code; \ - type: $c.length=1 ? Is variant:K8:33 : This:C1470.getTypeFromDeclaration($rgx.match[4].data); \ + type: $c.length=1 ? Is variant:K8:33 : This:C1470.getTypeFromDeclaration($rgx.matches[4].data); \ count: 0; \ order: 0} @@ -792,9 +774,9 @@ Function parseParameters($line : Object) End if //$5: comments - If (Length:C16($rgx.match[5].data)>0) + If (Length:C16($rgx.matches[5].data)>0) - $line.comment:=$rgx.match[5].data + $line.comment:=$rgx.matches[5].data End if End if @@ -925,7 +907,7 @@ Function setType($type : Integer; $target : Object) Else - // A "If" statement should never omit "Else" + // A "If" statement should never omit "Else" $o:=Form:C1466.current End if @@ -944,9 +926,9 @@ Function apply() var $options : Object $options:=This:C1470.settings.options - // MARK:PARAMETERS + // MARK:-PARAMETERS $c:=This:C1470.variables.query("parameter=true") - $o:=This:C1470.lines.query("type = :1 OR type = :2"; "Function"; "Class constructor").pop() + $o:=This:C1470._ouput.query("type = :1 OR type = :2"; "Function"; "Class constructor").pop() If ($c.length>0)\ | ($o#Null:C1517) @@ -1002,14 +984,14 @@ Function apply() End if End if - $method+=String:C10(This:C1470.lines.query("type = :1 OR type = :2"; "Function"; "Class constructor").pop().comment) + $method+=String:C10(This:C1470._ouput.query("type = :1 OR type = :2"; "Function"; "Class constructor").pop().comment) $method+="\r" End if Else - If (This:C1470.lines.query("type = :1"; "#DECLARE").pop()=Null:C1517) + If (This:C1470._ouput.query("type = :1"; "#DECLARE").pop()=Null:C1517) // #DECLARE does not accept $1 ... $N as a parameter name, so we use the var keyword for parameters. For each ($o; $c) @@ -1091,7 +1073,7 @@ Function apply() End if End if - $method+=String:C10(This:C1470.lines.query("type = :1"; "#DECLARE").pop().comment) + $method+=String:C10(This:C1470._ouput.query("type = :1"; "#DECLARE").pop().comment) End if @@ -1109,7 +1091,7 @@ Function apply() $method:=This:C1470.addNewLine($method) - // MARK:LOCAL VARIABLES WITH SIMPLE TYPE + // MARK:-LOCAL VARIABLES WITH SIMPLE TYPE $c:=This:C1470.variables.query("parameter=null & array=null & count>0 & class=null & assigned=null") If ($c.length>0) @@ -1188,7 +1170,7 @@ Function apply() End for each End if - // MARK:LOCAL VARIABLES LINKED TO A CLASSE + // MARK:-LOCAL VARIABLES LINKED TO A CLASSE $c:=This:C1470.variables.query("parameter=null & array=null & count>0 & class!=null & assigned=null") If ($c.length>0) @@ -1203,7 +1185,7 @@ Function apply() $method:=This:C1470.addNewLine($method) - // MARK:ARRAYS + // MARK:-ARRAYS $c:=This:C1470.variables.query("array=true & count>0 & static=false") If ($c.length>0) @@ -1246,27 +1228,28 @@ Function apply() Else // Look for the first empty or declaration line - For each ($o; This:C1470.lines) While ($l#MAXLONG:K35:2) + For each ($o; This:C1470._ouput) // While ($l#MAXLONG) $t:=String:C10($o.type) $length:=Length:C16($method) Case of - //___________________ + // ___________________ : ($t="comment") $buffer:=$buffer+$o.code+"\r" $l:=Length:C16($buffer) $o.skip:=True:C214 - //___________________ + // ___________________ : ($t="empty") $method:=$buffer+Substring:C12($method; 1; $length-1)+"\r"+kCaret - $l:=MAXLONG:K35:2 - //___________________ + break + + // ___________________ Else If ($l<=0) @@ -1280,9 +1263,9 @@ Function apply() End if - $l:=MAXLONG:K35:2 + break - //___________________ + // ___________________ End case End for each @@ -1291,7 +1274,7 @@ Function apply() End if // Restore the code - For each ($o; This:C1470.lines) + For each ($o; This:C1470._ouput) $t:=String:C10($o.type) @@ -1330,8 +1313,8 @@ Function apply() If (Bool:C1537($options.trimEmptyLines)) - $codeError:=Rgx_SubstituteText("\\r{2,}"; "\r\r"; ->$method) - $codeError:=Rgx_SubstituteText("(\\r*)$"; ""; ->$method) + $method:=This:C1470.rgx.setTarget($method).setPattern("\\r{2,}").substitute("\r\r") + $method:=This:C1470.rgx.setTarget($method).setPattern("(\\r*)$").substitute("") End if @@ -1362,26 +1345,39 @@ Function addNewLine($text : Text)->$result : Text Function clairvoyant($text : Text; $line : Text) : Integer var $pattern; $t; $type : Text - var $indx; $varType : Integer + var $indx : Integer ARRAY LONGINT:C221($len; 0) ARRAY LONGINT:C221($pos; 0) + // MARK:- Literal syntax Case of - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + //________________________________________________________________________________ : (Match regex:C1019("(?mi-s).*:=\\{"; $line; 1; *)) // Object literal return Is object:K8:27 - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + //________________________________________________________________________________ : (Match regex:C1019("(?mi-s).*:=\\["; $line; 1; *)) // Collection literal return Is collection:K8:32 - //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ + //________________________________________________________________________________ End case + // MARK:- Not localized command + Case of + + //________________________________________________________________________________ + : (Match regex:C1019("(?mi-s).*:=Form"; $line; 1)) + + return Is object:K8:27 + + //________________________________________________________________________________ + End case + + // mark:- $t:=Replace string:C233(Replace string:C233($text; "{"; "\\{"); "}"; "\\}") Case of @@ -1460,7 +1456,7 @@ Function clairvoyant($text : Text; $line : Text) : Integer //┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅┅ Else // Use gram.syntax - For each ($type; This:C1470.gramSyntax) While ($varType=0) + For each ($type; This:C1470.gramSyntax) $indx:=Position:C15("_"; $type) @@ -1532,43 +1528,45 @@ Function loadGramSyntax() first: "(?m-is)#\\s*\\(\\%"\ } - For each ($t; Split string:C1554($file.getText(); "\r"; sk trim spaces:K86:2)) + For each ($t; Split string:C1554($file.getText(); "\n"; sk trim spaces:K86:2)) $i+=1 $return:=-1 $first:=-1 + If (Match regex:C1019("(?m-si)^\\t@"; $t; 1)) + + continue // The command entry is unused + + End if + + var $pattern : Text:="(?m-si)^\\t{type}\\s<==\\s" + Case of //______________________________________________________ - : (Match regex:C1019("(?m-si)^\\t@"; $t; 1)) - - // The command entry is unused - - //______________________________________________________ - : (Match regex:C1019("(?m-si)^\\to\\s<==\\s"; $t; 1))\ - & ($i#3)\ - & ($i#4) + : (Match regex:C1019(Replace string:C233($pattern; "{type}"; "o"); $t; 1))\ + && ($i#3) && ($i#4) $return:=Is object:K8:27 //______________________________________________________ - : (Match regex:C1019("(?m-si)^\\tj\\s<==\\s"; $t; 1)) + : (Match regex:C1019(Replace string:C233($pattern; "{type}"; "j"); $t; 1)) $return:=Is collection:K8:32 //______________________________________________________ - : (Match regex:C1019("(?m-si)^\\tB\\s<==\\s"; $t; 1)) + : (Match regex:C1019(Replace string:C233($pattern; "{type}"; "B"); $t; 1)) $return:=Is boolean:K8:9 //______________________________________________________ - : (Match regex:C1019("(?m-si)^\\tL\\s<==\\s"; $t; 1)) + : (Match regex:C1019(Replace string:C233($pattern; "{type}"; "L"); $t; 1)) $return:=Is longint:K8:6 //______________________________________________________ - : (Match regex:C1019("(?m-si)^\\tS\\s<==\\s"; $t; 1)) + : (Match regex:C1019(Replace string:C233($pattern; "{type}"; "S"); $t; 1)) $return:=Is text:K8:3 @@ -1578,22 +1576,22 @@ Function loadGramSyntax() $return:=Is text:K8:3 //______________________________________________________ - : (Match regex:C1019("(?m-si)^\\tR\\s<==\\s"; $t; 1)) + : (Match regex:C1019(Replace string:C233($pattern; "{type}"; "R"); $t; 1)) $return:=Is real:K8:4 //______________________________________________________ - : (Match regex:C1019("(?m-si)^\\tU\\s<==\\s"; $t; 1)) + : (Match regex:C1019(Replace string:C233($pattern; "{type}"; "U"); $t; 1)) $return:=Is pointer:K8:14 //______________________________________________________ - : (Match regex:C1019("(?m-si)^\\tD\\s<==\\s"; $t; 1)) + : (Match regex:C1019(Replace string:C233($pattern; "{type}"; "D"); $t; 1)) $return:=Is date:K8:7 //______________________________________________________ - : (Match regex:C1019("(?m-si)^\\tT\\s<==\\s"; $t; 1)) + : (Match regex:C1019(Replace string:C233($pattern; "{type}"; "T"); $t; 1)) $return:=Is time:K8:8 @@ -1614,50 +1612,52 @@ Function loadGramSyntax() End if End if + $pattern:="(?m-si)^[^:]+\\s:\\s\\d+\\s:\\s(?:[^;/]*)?" + Case of //______________________________________________________ - : (Match regex:C1019("(?m-si)^[^:]+\\s:\\s\\d+\\s:\\s(?:[^;/]*)?o"; $t; 1)) + : (Match regex:C1019($pattern+"o"; $t; 1)) $first:=Is object:K8:27 //______________________________________________________ - : (Match regex:C1019("(?m-si)^[^:]+\\s:\\s\\d+\\s:\\s(?:[^;/]*)?j"; $t; 1)) + : (Match regex:C1019($pattern+"j"; $t; 1)) $first:=Is collection:K8:32 //______________________________________________________ - : (Match regex:C1019("(?m-si)^[^:]+\\s:\\s\\d+\\s:\\s(?:[^;/]*)?a"; $t; 1)) + : (Match regex:C1019($pattern+"a"; $t; 1)) $first:=Is text:K8:3 //______________________________________________________ - : (Match regex:C1019("(?m-si)^[^:]+\\s:\\s\\d+\\s:\\s(?:[^;/]*)?L"; $t; 1)) + : (Match regex:C1019($pattern+"L"; $t; 1)) $first:=Is longint:K8:6 //______________________________________________________ - : (Match regex:C1019("(?m-si)^[^:]+\\s:\\s\\d+\\s:\\s(?:[^;/]*)?R"; $t; 1)) + : (Match regex:C1019($pattern+"R"; $t; 1)) $first:=Is real:K8:4 //______________________________________________________ - : (Match regex:C1019("(?m-si)^[^:]+\\s:\\s\\d+\\s:\\s(?:[^;/]*)?D"; $t; 1)) + : (Match regex:C1019($pattern+"D"; $t; 1)) $first:=Is date:K8:7 //______________________________________________________ - : (Match regex:C1019("(?m-si)^[^:]+\\s:\\s\\d+\\s:\\s(?:[^;/]*)?T"; $t; 1)) + : (Match regex:C1019($pattern+"T"; $t; 1)) $first:=Is time:K8:8 //______________________________________________________ - : (Match regex:C1019("(?m-si)^[^:]+\\s:\\s\\d+\\s:\\s(?:[^;/]*)?B"; $t; 1)) + : (Match regex:C1019($pattern+"B"; $t; 1)) $first:=Is boolean:K8:9 //______________________________________________________ - : (Match regex:C1019("(?m-si)^[^:]+\\s:\\s\\d+\\s:\\s(?:[^;/]*)?b"; $t; 1)) + : (Match regex:C1019($pattern+"b"; $t; 1)) $first:=Is BLOB:K8:12 diff --git a/Project/Sources/Classes/dim.4dm b/Project/Sources/Classes/dim.4dm new file mode 100644 index 0000000..fd750e5 --- /dev/null +++ b/Project/Sources/Classes/dim.4dm @@ -0,0 +1,7 @@ +property height : Integer:=0 +property width : Integer:=0 + +Class constructor + + // + \ No newline at end of file diff --git a/Project/Sources/Classes/evt.4dm b/Project/Sources/Classes/evt.4dm new file mode 100644 index 0000000..31e62a8 --- /dev/null +++ b/Project/Sources/Classes/evt.4dm @@ -0,0 +1,439 @@ +// MARK:Common properties +property objectName : Text +property code : Integer +property description : Text + +// MARK:Internal +property _descriptions : Collection + +// MARK:List boxes additional properties +property area; areaName; columnName; footerName; headerName : Text +property column; row : Integer +property isRowSelected : Boolean +property horizontalScroll; verticalScroll : Integer +property newPosition; oldPosition : Integer + +property newSize; oldSize : Integer + +Class constructor($e : Object) + + $e:=$e || FORM Event:C1606 + + If ($e#Null:C1517) + + var $key : Text + + For each ($key; $e) + + This:C1470[$key]:=$e[$key] + + End for each + End if + + This:C1470._descriptions:=[\ + ""; \ + "on Load"; \ + "on Mouse Up"; \ + "on Validate"; \ + "on Click"; \ + "on Header"; \ + "on Printing Break"; \ + "on Printing Footer"; \ + "on Display Detail"; \ + "on VP Ready"; \ + "on Outside Call"; \ + "on Activate"; \ + "on Deactivate"; \ + "on Double Click"; \ + "on Losing Focus"; \ + "on Getting Focus"; \ + "on Drop"; \ + "on Before Keystroke"; \ + "on Menu Select"; \ + "on Plugin Area"; \ + "on Data Change"; \ + "on Drag Over"; \ + "on Close Box"; \ + "on Printing Detail"; \ + "on Unload"; \ + "on Open Detail"; \ + "on Close Detail"; \ + "on Timer"; \ + "on After Keystroke"; \ + "on Resize"; \ + "on After Sort"; \ + "on Selection Change"; \ + "on Column Move"; \ + "on Column Resize"; \ + "on Row Move"; \ + "on Mouse Enter"; \ + "on Mouse Leave"; \ + "on Mouse Move"; \ + "on Alternate Click"; \ + "on Long Click"; \ + "on Load Record"; \ + "on Before DataEntry"; \ + "on Header Click"; \ + "on Expand"; \ + "on Collapse"; \ + "on After Edit"; \ + "on Begin Drag Over"; \ + "on Begin URL Loading"; \ + "on URL Resource Loading"; \ + "on End URL Loading"; \ + "on URL Loading Error"; \ + "on URL Filtering"; \ + "on Open External Link"; \ + "on Window Opening Denied"; \ + "on Bound Variable Change"; \ + ""; \ + "on Page Change"; \ + "on Footer Click"; \ + "on Delete Action"; \ + "on Scroll"; \ + "on Row Resize"; \ + "on VP Range Changed"\ + ] + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get _eventName() : Text + + return Try(This:C1470._descriptions[This:C1470.code]) + + // MARK:-Form + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get form() : Boolean + + return This:C1470.objectName=Null:C1517 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get load() : Boolean + + return This:C1470.code=On Load:K2:1 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get unload() : Boolean + + return This:C1470.code=On Unload:K2:2 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get activate() : Boolean + + return This:C1470.code=On Activate:K2:9 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get deactivate() : Boolean + + return This:C1470.code=On Deactivate:K2:10 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get resize() : Boolean + + return This:C1470.code=On Resize:K2:27 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get close() : Boolean + + return This:C1470.code=On Close Box:K2:21 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get validate() : Boolean + + return This:C1470.code=On Validate:K2:3 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get menuSelected() : Boolean + + return This:C1470.code=On Menu Selected:K2:14 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get outsideCall() : Boolean + + return This:C1470.code=On Outside Call:K2:11 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get pageChange() : Boolean + + return This:C1470.code=On Page Change:K2:54 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get timer() : Boolean + + return This:C1470.code=On Timer:K2:25 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get header() : Boolean + + return This:C1470.code=On Header:K2:17 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get plugin() : Boolean + + return This:C1470.code=On Plug in Area:K2:16 + + // MARK:-Printing + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get printingBreak() : Boolean + + return This:C1470.code=On Printing Break:K2:19 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get printingDetail() : Boolean + + return This:C1470.code=On Printing Detail:K2:18 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get printingFooter() : Boolean + + return This:C1470.code=On Printing Footer:K2:20 + + // MARK:-Widgets + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get click() : Boolean + + return This:C1470.code=On Clicked:K2:4 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get doubleClick() : Boolean + + return This:C1470.code=On Double Clicked:K2:5 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get longClick() : Boolean + + return This:C1470.code=On Long Click:K2:37 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get alternateClick() : Boolean + + return This:C1470.code=On Alternative Click:K2:36 + + // MARK:- + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get gettingFocus() : Boolean + + return This:C1470.code=On Getting Focus:K2:7 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get losingFocus() : Boolean + + return This:C1470.code=On Losing Focus:K2:8 + + // MARK:- + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get beforeKeystroke() : Boolean + + return This:C1470.code=On Before Keystroke:K2:6 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get afterKeystroke() : Boolean + + return This:C1470.code=On After Keystroke:K2:26 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get beforeDataEntry() : Boolean + + return This:C1470.code=On Before Data Entry:K2:39 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get afterEdit() : Boolean + + return This:C1470.code=On After Edit:K2:43 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get dataChange() : Boolean + + return This:C1470.code=On Data Change:K2:15 + + // MARK:- + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get beginDragOver() : Boolean + + return This:C1470.code=On Begin Drag Over:K2:44 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get dragOver() : Boolean + + return This:C1470.code=On Drag Over:K2:13 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get drop() : Boolean + + return This:C1470.code=On Drop:K2:12 + + // MARK:- + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get mouseEnter() : Boolean + + return This:C1470.code=On Mouse Enter:K2:33 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get mouseMove() : Boolean + + return This:C1470.code=On Mouse Move:K2:35 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get mouseLeave() : Boolean + + return This:C1470.code=On Mouse Leave:K2:34 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get mouseUp() : Boolean + + return This:C1470.code=On Mouse Up:K2:58 + + // MARK:- + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get boundVariableChange() : Boolean + + return This:C1470.code=On Bound Variable Change:K2:52 + + // MARK:-Lists + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get selectionChange() : Boolean + + return This:C1470.code=On Selection Change:K2:29 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get scroll() : Boolean + + return This:C1470.code=On Scroll:K2:57 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get expand() : Boolean + + return This:C1470.code=On Expand:K2:41 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get collapse() : Boolean + + return This:C1470.code=On Collapse:K2:42 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get delete() : Boolean + + return This:C1470.code=On Delete Action:K2:56 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get displayDetail() : Boolean + + return This:C1470.code=On Display Detail:K2:22 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get openDetail() : Boolean + + return This:C1470.code=On Open Detail:K2:23 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get loadRecord() : Boolean + + return This:C1470.code=On Load Record:K2:38 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get closeDetail() : Boolean + + return This:C1470.code=On Close Detail:K2:24 + + // MARK:-Listboxes + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get columnMoved() : Boolean + + return This:C1470.code=On Column Moved:K2:30 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get rowMoved() : Boolean + + return This:C1470.code=On Row Moved:K2:32 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get columnResize() : Boolean + + return This:C1470.code=On Column Resize:K2:31 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get rowResize() : Boolean + + return This:C1470.code=On Row Resize:K2:60 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get headerClick() : Boolean + + return This:C1470.code=On Header Click:K2:40 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get footerClick() : Boolean + + return This:C1470.code=On Footer Click:K2:55 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get sort() : Boolean + + return This:C1470.code=On After Sort:K2:28 + + // MARK:-Host Database + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get beforeHostDatabaseStartup() : Boolean + + return This:C1470.code=On before host database startup:K74:3 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get afterHostDatabaseStartup() : Boolean + + return This:C1470.code=On after host database startup:K74:4 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get beforeHostDatabaseExit() : Boolean + + return This:C1470.code=On before host database exit:K74:5 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get afterHostDatabaseExit() : Boolean + + return This:C1470.code=On after host database exit:K74:6 + + // MARK:-Web Area + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get beginUrlLoading() : Boolean + + return This:C1470.code=On Begin URL Loading:K2:45 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get endUrlLoading() : Boolean + + return This:C1470.code=On End URL Loading:K2:47 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get urlLoadingError() : Boolean + + return This:C1470.code=On URL Loading Error:K2:48 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get urlFiltering() : Boolean + + return This:C1470.code=On URL Filtering:K2:49 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get urlResourceLoading() : Boolean + + return This:C1470.code=On URL Resource Loading:K2:46 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get openExternalLink() : Boolean + + return This:C1470.code=On Open External Link:K2:50 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get windowOpeningDenied() : Boolean + + return This:C1470.code=On Window Opening Denied:K2:51 + + // MARK:-View Pro + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get vpReady() : Boolean + + return This:C1470.code=On VP Ready:K2:59 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get vpRange() : Boolean + + return This:C1470.code=On VP Range Changed:K2:61 \ No newline at end of file diff --git a/Project/Sources/Classes/group.4dm b/Project/Sources/Classes/group.4dm index f4aa0a6..f83854c 100755 --- a/Project/Sources/Classes/group.4dm +++ b/Project/Sources/Classes/group.4dm @@ -1,91 +1,185 @@ -/*———————————————————————————————————————————————————————————————————————————————— +/* A group is a collection of static or active objects You can define it by passing N objects as parameters --> cs.group.new(object1, object2, …, objectN) -or a collection of objects ---> cs.group.new(object collection) +or a collection of objects (could be a group) +--> cs.group.new(object collection) or a comma separated list of object names --> cs.group.new("name1,name2,…,nameN") in this case, all named objects are initialized with widget class -——————————————————————————*/ -Class constructor($members; ... : Object) +*/ + +property members : Collection +property type : Integer + +property _data +property __CLASS__ : Object + +Class constructor($members : Variant; ... ) - //C_VARIANT($1) - //C_OBJECT(${2}) + var $i : Integer + var $t : Text - C_LONGINT:C283($i) - C_TEXT:C284($t) + This:C1470.__CLASS__:=OB Class:C1730(This:C1470) - If (Asserted:C1132(Count parameters:C259>0; "Missing parameter")) - - Case of - - //___________________________ - : (Value type:C1509($1)=Is collection:K8:32) - - This:C1470.members:=$1 - - //___________________________ - : (Value type:C1509($1)=Is object:K8:27) // 1 to n objects + This:C1470.type:=Object type group:K79:22 + + Case of + + //___________________________ + : (Count parameters:C259=0) + + This:C1470.members:=[] + + //___________________________ + : (Value type:C1509($members)=Is collection:K8:32) + + This:C1470.members:=$members + + //___________________________ + : (Value type:C1509($members)=Is object:K8:27) // 1 to N objects (could be groups) + + This:C1470.members:=[] + + For ($i; 1; Count parameters:C259; 1) - This:C1470.members:=New collection:C1472 + This:C1470.add(${$i}) - For ($i; 1; Count parameters:C259; 1) - - This:C1470.members.push(${$i}) - - End for + End for + + //___________________________ + : (Value type:C1509($members)=Is text:K8:3) // Comma separated list of object names + + This:C1470.members:=[] + + This:C1470.add($members) + + //___________________________ + Else + + This:C1470.members:=[] + + //___________________________ + End case + +/* +The user data can be anything you want to attach to the group. +The .data property is used to get or set this data. +*/ + This:C1470._data:=Null:C1517 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== + /// Returns the user data attached to the group +Function get data() : Variant + + return This:C1470._data + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== + /// Defines the user data attached to the group +Function set data($data) + + This:C1470._data:=$data + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +/** +Add one or more members to a group + +.add([widget collection]) + +or + +.add([group]) + +or + +.add([widget) + +or + +.add("Comma separated list of object names") + +*/ +Function add($member) : cs:C1710.group + + var $t : Text + var $type : Integer + + $type:=Value type:C1509($member) + + Case of + + //___________________________ + : ($type=Is collection:K8:32) + + This:C1470.members:=This:C1470.members.combine($member) + + //___________________________ + : ($type=Is object:K8:27) + + If (OB Instance of:C1731($member; cs:C1710.group)) - //___________________________ - : (Value type:C1509($1)=Is text:K8:3) // Comma separated list of object names + This:C1470.members:=This:C1470.members.combine($member.members) - This:C1470.members:=New collection:C1472 + Else - For each ($t; Split string:C1554($1; ",")) - - This:C1470.members.push(cs:C1710.widget.new($t)) // Widget by default - - End for each + This:C1470.members.push($member) - //___________________________ - Else + End if + + //___________________________ + : ($type=Is text:K8:3) // Comma separated list of object names + + For each ($t; Split string:C1554($member; ",")) - ASSERT:C1129(False:C215; "Bad parameter type") + This:C1470.members.push(cs:C1710.widget.new($t)) // Widget by default - //___________________________ - End case - End if + End for each + + //___________________________ + Else + + ASSERT:C1129(False:C215; "Bad parameter type") + + //___________________________ + End case -/*════════════════════════════════════════════ + // Avoid Null members + This:C1470.members:=This:C1470.members.filter(Formula:C1597($1.value#Null:C1517)) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +/** Returns True if the passed object or object name is part of the group -.include(obj) --> bool +.belongsTo(obj) --> bool or -.include("name") --> bool +.belongsTo("name") --> bool + +*/ +Function belongsTo($widget) : Boolean -════════════════════════════════════════════*/ -Function include + var $type : Integer - C_BOOLEAN:C305($0) - C_VARIANT:C1683($1) + $type:=Value type:C1509($widget) Case of //______________________________________________________ - : (Value type:C1509($1)=Is object:K8:27) + : ($type=Is object:K8:27) - $0:=(This:C1470.members.indexOf($1)#-1) + return This:C1470.members.includes($widget) //______________________________________________________ - : (Value type:C1509($1)=Is text:K8:3) + : ($type=Is text:K8:3) - $0:=(This:C1470.members.query("name=:1"; $1).pop()#Null:C1517) + return This:C1470.members.query("name=:1"; $widget).pop()#Null:C1517 //______________________________________________________ Else @@ -95,11 +189,95 @@ Function include //______________________________________________________ End case -/*════════════════════════════════════════════ + // === === === === === === === === === === === === === === === === === === === === === === === === === === +/** +Returns the coordinates of the rectangle surrounding the group, +with optional horizontal and vertical space. +*/ +Function enclosingRect($gap : Integer) : Object + + var $left; $top; $right; $bottom : Integer + var $member : cs:C1710.static + var $coordinates : Object + + If (This:C1470.members.length=0) + + return {left: 0; top: 0; right: 0; bottom: $bottom} + + End if + + For each ($member; This:C1470.members) + + OBJECT GET COORDINATES:C663(*; $member.name; $left; $top; $right; $bottom) + + If ($coordinates=Null:C1517) + + $coordinates:={\ + left: $left; \ + top: $top; \ + right: $right; \ + bottom: $bottom} + + Else + + $coordinates.left:=$left<$coordinates.left ? $left : $coordinates.left + $coordinates.top:=$top<$coordinates.top ? $top : $coordinates.top + $coordinates.right:=$right>$coordinates.right ? $right : $coordinates.right + $coordinates.bottom:=$bottom>$coordinates.bottom ? $bottom : $coordinates.bottom + + End if + End for each + + If ($coordinates#Null:C1517) + + $coordinates.left-=$gap + $coordinates.top-=$gap + $coordinates.right+=$gap + $coordinates.bottom+=$gap + + End if + + return $coordinates + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function moveVertically($offset : Integer) + + var $o : cs:C1710.static + + For each ($o; This:C1470.members) + + $o.moveVertically($offset) + + End for each + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function hiddenFromView() + + var $o : cs:C1710.static + + For each ($o; This:C1470.members) + + $o.hiddenFromView() + + End for each + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function moveHorizontally($offset : Integer) + + var $member : cs:C1710.static + + For each ($member; This:C1470.members) + + $member.moveHorizontally($offset) + + End for each + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +/** Performs a horizontal distribution, from left to right, of the elements according to their best size -.distributeHorizontally({obj}) +.distributeLeftToRight({obj}) The optional object type parameter allow to specify: - The starting point x in pixels in the form (start) @@ -107,145 +285,439 @@ The optional object type parameter allow to specify: - The minimum width to respect in pixels (minWidth) - The maximum width to respect in pixels (maxWidth) -════════════════════════════════════════════*/ -Function distributeHorizontally +*/ +Function distributeLeftToRight($params : Object) : cs:C1710.group - C_OBJECT:C1216($1; $o; $e) + var $e : Object + var $key : Text + var $o : cs:C1710.static - $e:=New object:C1471(\ - "start"; 0; \ - "spacing"; 0; \ - "minWidth"; 0; \ - "maxWidth"; 0) + $e:={\ + start: 0; \ + spacing: 0; \ + minWidth: 0; \ + maxWidth: 0} If (Count parameters:C259>=1) - If ($1.start#Null:C1517) + For each ($key; $params) - $e.start:=Num:C11($1.start) - - End if - - If ($1.spacing#Null:C1517) - - $e.spacing:=Num:C11($1.spacing) - - End if + If ($params[$key]#Null:C1517) + + $e[$key]:=Num:C11($params[$key]) + + End if + End for each End if + $e.alignment:=Align left:K42:2 + For each ($o; This:C1470.members) - If (Count parameters:C259>=1) - - $o.bestSize($1) - - Else - - $o.bestSize() - - End if + $o.bestSize($e) If ($e.start#0) - $o.moveHorizontally($e.start-$o.coordinates.left) + $o.moveHorizontally($e.start-$o._coordinates.left) End if // Calculate the cumulative shift + $e.start:=$o._coordinates.right + If ($e.spacing=0) Case of //_______________________________ - : ($o.type=Object type push button:K79:16) + : ($o.type=Object type push button:K79:16)\ + || ($o.type=Object type 3D button:K79:17) + + $e.start+=(Is macOS:C1572 ? 20 : 20) + + //_______________________________ + : ($o.type=Object type line:K79:33) - $e.start:=$o.coordinates.right+Choose:C955(Is macOS:C1572; 20; 20) + $e.start+=(Is macOS:C1572 ? 40 : 20) //_______________________________ - : (False:C215) + End case + + Else + + Case of + + //_______________________________ + : ($o.type=Object type line:K79:33) + + $e.start+=(Is macOS:C1572 ? 10 : 10) //_______________________________ Else - $e.start:=$o.coordinates.right + $e.start+=$e.spacing + + //_______________________________ + End case + End if + End for each + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +/** +Performs a horizontal distribution, from right to left, +of the elements according to their best size + +.distributeRigthToLeft({obj}) + +The optional object type parameter allow to specify: +- The starting point x in pixels in the form (start) +- The spacing in pixels to respect between the elements (spacing) +- The minimum width to respect in pixels (minWidth) +- The maximum width to respect in pixels (maxWidth) + +*/ +Function distributeRigthToLeft($params : Object) : cs:C1710.group + + var $e : Object + var $key : Text + var $o : cs:C1710.static + + $e:={\ + start: 0; \ + spacing: 0; \ + minWidth: 0; \ + maxWidth: 0} + + If (Count parameters:C259>=1) + + For each ($key; $params) + + If ($params[$key]#Null:C1517) + + $e[$key]:=$params[$key] + + End if + End for each + + End if + + $e.alignment:=Align right:K42:4 + + For each ($o; This:C1470.members) + + $o.bestSize($e) + + If ($e.start#0) + + $o.moveHorizontally($e.start-$o._coordinates.right) + + End if + + // Calculate the cumulative shift + $e.start:=$o._coordinates.left + + If ($e.spacing=0) + + Case of + + //_______________________________ + : ($o.type=Object type push button:K79:16)\ + || ($o.type=Object type 3D button:K79:17) + + $e.start-=(Is macOS:C1572 ? 20 : 20) //_______________________________ End case Else - $e.start:=$o.coordinates.right+$e.spacing + $e.start-=$e.spacing End if End for each -/*════════════════════════════════════════════ -.show() -.show(bool) -════════════════════════════════════════════*/ -Function show + return This:C1470 - C_BOOLEAN:C305($1) - C_OBJECT:C1216($o) + // === === === === === === === === === === === === === === === === === === === === === === === === === === +/** +This function reverses the horizontal order of the members +useful, for example, for reversing the OK and Cancel buttons depending on the platform +*/ +Function switch() : cs:C1710.group - If (Count parameters:C259>=1) + var $left; $right; $spacing : Integer + var $c : Collection + var $o : cs:C1710.static + + $c:=This:C1470.members.orderBy("left") + + For each ($o; $c) - For each ($o; This:C1470.members) + If ($left=0) - $o.show($1) + $left:=$o.left + $right:=$o.right - End for each + continue + + End if - Else + $spacing:=$o.left-$right + + break + + End for each + + For each ($o; $c.reverse()) - For each ($o; This:C1470.members) + $o.left:=$left + $left+=$o.width+$spacing + + End for each + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + /// Center all members on the first +Function center($horizontally : Boolean; $vertically : Boolean) + + var $middle : Integer + var $member : Object + var $members : Collection + var $coordinates : cs:C1710.coord + var $dimensions : cs:C1710.dim + + // The reference is the first member of the group + // So we remove it and get its median position. + $members:=This:C1470.members.copy() + $member:=$members.shift() + $middle:=$member.coordinates.left+($member.dimensions.width\2) + + If ($horizontally) + + For each ($member; $members) + + $coordinates:=$member.coordinates + $dimensions:=$member.dimensions + + $coordinates.left:=$middle-($dimensions.width\2) + $coordinates.right:=$coordinates.left+$dimensions.width - $o.show() + $member.setCoordinates($coordinates) End for each End if -/*════════════════════════════════════════════*/ -Function hide + If ($vertically) + + // TODO: Vertical if I need it ;-) + + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +/** +Performs a centered alignment of the elements according to their best size + +.centerVertically({obj}) - C_OBJECT:C1216($o) +The optional widget name parameter allow to specify the reference +If ommited, the distribution is relative to the form +*/ +Function centerVertically($reference : Text) : cs:C1710.group + + var $bottom; $height; $left; $middle; $right; $top; $width : Integer + var $o : cs:C1710.static + + If (Count parameters:C259>=1) + + OBJECT GET COORDINATES:C663(*; $reference; $left; $top; $right; $bottom) + $middle:=($right-$left)\2 + + Else + + OBJECT GET SUBFORM CONTAINER SIZE:C1148($width; $height) + $middle:=$width\2 + + End if For each ($o; This:C1470.members) - $o.hide() + OBJECT GET COORDINATES:C663(*; $o.name; $left; $top; $right; $bottom) + $width:=$right-$left + $left:=$middle-($width\2) + $right:=$left+$width + OBJECT SET COORDINATES:C1248(*; $o.name; $left; $top; $right; $bottom) End for each -/*════════════════════════════════════════════ -.enable() -.enable(bool) -════════════════════════════════════════════*/ -Function enable + return This:C1470 - C_BOOLEAN:C305($1) - C_OBJECT:C1216($o) + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function alignLeft($reference) : cs:C1710.group + + var $left : Integer + var $o : cs:C1710.static If (Count parameters:C259>=1) - For each ($o; This:C1470.members) - - $o.enable($1) - - End for each + Case of + + //______________________________________________________ + : (Value type:C1509($reference)=Is object:K8:27) + + // We assume it is from the static class (or extend) + // #TO_DO: test the class + $left:=$reference.updateCoordinates().coordinates.left + + //______________________________________________________ + : (Value type:C1509($reference)=Is integer:K8:5)\ + | (Value type:C1509($reference)=Is real:K8:4) + + $left:=$reference + + //______________________________________________________ + : (Value type:C1509($reference)=Is text:K8:3) + + $left:=cs:C1710.static.new($reference).coordinates.left + + //______________________________________________________ + Else + + // #ERROR + + //______________________________________________________ + End case Else - For each ($o; This:C1470.members) + // Default reference is the first member of the group + $left:=This:C1470.members[0].updateCoordinates().coordinates.left + + End if + + For each ($o; This:C1470.members) + + $o.moveHorizontally($left-$o.coordinates.left) + + End for each + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function alignRight($reference) : cs:C1710.group + + var $right : Integer + var $o : cs:C1710.static + + If (Count parameters:C259>=1) + + Case of + + //______________________________________________________ + : (Value type:C1509($reference)=Is object:K8:27) + + // We assume it is from the static class (or extend) + // #TO_DO: test the class + $right:=$reference.updateCoordinates().coordinates.right + + //______________________________________________________ + : (Value type:C1509($reference)=Is integer:K8:5)\ + | (Value type:C1509($reference)=Is real:K8:4) + + $right:=$reference + + //______________________________________________________ + : (Value type:C1509($reference)=Is text:K8:3) + + $right:=cs:C1710.static.new($reference).coordinates.right + + //______________________________________________________ + Else + + // #ERROR + + //______________________________________________________ + End case + + Else + + // Default reference is the first member of the group + $right:=This:C1470.members[0].updateCoordinates().coordinates.right + + End if + + For each ($o; This:C1470.members) + + $o.moveHorizontally($right-$o.coordinates.right) + + End for each + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function show($visible : Boolean) : cs:C1710.group + + var $o : cs:C1710.static + + $visible:=Count parameters:C259=0 ? True:C214 : $visible + + For each ($o; This:C1470.members) + + $o.show($visible) + + End for each + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function hide() : cs:C1710.group + + var $o : cs:C1710.static + + For each ($o; This:C1470.members) + + $o.hide() + + End for each + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function enable($enabled : Boolean) : cs:C1710.group + + var $o : cs:C1710.static + + $enabled:=Count parameters:C259=0 ? True:C214 : $enabled + + For each ($o; This:C1470.members) + + If ($o.type=Object type subform:K79:40) - $o.enable() + If ($enabled) + + $o.enable() + + Else + + $o.disable() + + End if - End for each - End if + Else + + $o.enable($enabled) + + End if + End for each -/*════════════════════════════════════════════*/ -Function disable + return This:C1470 - C_OBJECT:C1216($o) + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function disable() : cs:C1710.group + + var $o : cs:C1710.static For each ($o; This:C1470.members) @@ -253,4 +725,17 @@ Function disable End for each -/*════════════════════════════════════════════*/ \ No newline at end of file + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setFontStyle($style : Integer) : cs:C1710.group + + var $o : cs:C1710.static + + For each ($o; This:C1470.members) + + $o.setFontStyle() + + End for each + + return This:C1470 \ No newline at end of file diff --git a/Project/Sources/Classes/input.4dm b/Project/Sources/Classes/input.4dm index db5bb8a..60dcd62 100755 --- a/Project/Sources/Classes/input.4dm +++ b/Project/Sources/Classes/input.4dm @@ -1,111 +1,320 @@ - -/*═══════════════════*/ Class extends widget -/*═══════════════════*/ -Class constructor +property _backup +property _font : Text + +Class constructor($name : Text) - C_TEXT:C284($1;$2) + Super:C1705($name) - If (Count parameters:C259>=2) + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get asPassword() : Boolean + + return OBJECT Get font:C1069(*; This:C1470.name)="%password" + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set asPassword($password : Boolean) + + $password:=($password=Null:C1517) ? True:C214 : $password + + If ($password) + + // Retain the original font + This:C1470._font:=This:C1470._font || This:C1470.font + This:C1470.font:="%password" + + Else + + // Restoring the original font + This:C1470.font:=This:C1470._font - Super:C1705($1;$2) + End if + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get filter() : Text + + return OBJECT Get filter:C1073(*; This:C1470.name) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set filter($filter) + + var $separator : Text + + If (Value type:C1509($filter)=Is longint:K8:6)\ + | (Value type:C1509($filter)=Is real:K8:4) // Predefined formats + + Case of + + //……………………………………………………………………… + : ($filter=Is integer:K8:5)\ + | ($filter=Is longint:K8:6)\ + | ($filter=Is integer 64 bits:K8:25) + + OBJECT SET FILTER:C235(*; This:C1470.name; "&\"0-9;-;+\"") + + //……………………………………………………………………… + : ($filter=Is real:K8:4) + + GET SYSTEM FORMAT:C994(Decimal separator:K60:1; $separator) + OBJECT SET FILTER:C235(*; This:C1470.name; "&\"0-9;"+$separator+";.;-;+\"") + + //……………………………………………………………………… + : ($filter=Is time:K8:8) + + GET SYSTEM FORMAT:C994(Time separator:K60:11; $separator) + OBJECT SET FILTER:C235(*; This:C1470.name; "&\"0-9;"+$separator+";:\"") + + //……………………………………………………………………… + : ($filter=Is date:K8:7) + + GET SYSTEM FORMAT:C994(Date separator:K60:10; $separator) + OBJECT SET FILTER:C235(*; This:C1470.name; "&\"0-9;"+$separator+";/\"") + + //……………………………………………………………………… + Else + + OBJECT SET FILTER:C235(*; This:C1470.name; "") // Text as default + + //……………………………………………………………………… + End case Else - Super:C1705($1) + OBJECT SET FILTER:C235(*; This:C1470.name; String:C10($filter)) End if -/*════════════════════════════════════════════ -.setFilter(int) -> This -.setFilter(text) -> This -════════════════════════════════════════════*/ -Function setFilter + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get placeholder() : Text + + return OBJECT Get placeholder:C1296(*; This:C1470.name) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set placeholder($placeholder : Text) + + This:C1470.setPlaceholder($placeholder) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Keep current value +Function backup($value) : cs:C1710.input + + This:C1470._backup:=$value || This:C1470.getValue() + + return This:C1470 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get modified() : Boolean + + return This:C1470._backup#This:C1470.getValue() + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function highlight($startSel : Integer; $endSel : Integer) : cs:C1710.input + + Case of + + //______________________________________________________ + : (Count parameters:C259=0) // Select all + + HIGHLIGHT TEXT:C210(*; This:C1470.name; 1; MAXLONG:K35:2) + + //______________________________________________________ + : (Count parameters:C259=1) + + If ($startSel=-1) + + This:C1470.highlightLastToEnd() + + Else // From $startSel to end + + HIGHLIGHT TEXT:C210(*; This:C1470.name; $startSel; MAXLONG:K35:2) + + End if + + //______________________________________________________ + Else // From $startSel to $endSel + + HIGHLIGHT TEXT:C210(*; This:C1470.name; $startSel; $endSel) + + //______________________________________________________ + End case + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // From the last character entered to the end +Function highlightLastToEnd() : cs:C1710.input + + HIGHLIGHT TEXT:C210(*; This:C1470.name; This:C1470.highlightingStart()+1; MAXLONG:K35:2) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function highlighted() : Object + + var $t : Text + var $end; $start : Integer + var $o : Object - C_VARIANT:C1683($1) - C_TEXT:C284($2;$t) + GET HIGHLIGHT:C209(*; This:C1470.name; $start; $end) - If (Value type:C1509($1)=Is real:K8:4) + $o:={\ + start: $start; \ + end: $end; \ + length: $end-$start; \ + withSelection: $end#$start; \ + noSelection: $end=$start; \ + selection: ""} + + $t:=This:C1470.getValue() + + If (Length:C16($t)>0) - // Predefined formats + $o.selection:=Substring:C12($t; $start; $o.length) + + End if + + return $o + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function highlightingStart() : Integer + + var $end; $start : Integer + GET HIGHLIGHT:C209(*; This:C1470.name; $start; $end) + + return $start + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function highlightingEnd() : Integer + + var $end; $start : Integer + GET HIGHLIGHT:C209(*; This:C1470.name; $start; $end) + + return $end + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setFilter($filter; $separator : Text) : cs:C1710.input + + If (Value type:C1509($filter)=Is longint:K8:6)\ + | (Value type:C1509($filter)=Is real:K8:4) // Predefined formats Case of - //……………………………………………………………………… - : ($1=Is integer:K8:5)\ - | ($1=Is longint:K8:6)\ - | ($1=Is integer 64 bits:K8:25) + //……………………………………………………………………… + : ($filter=Is integer:K8:5)\ + | ($filter=Is longint:K8:6)\ + | ($filter=Is integer 64 bits:K8:25) - OBJECT SET FILTER:C235(*;This:C1470.name;"&\"0-9;-;+\"") + OBJECT SET FILTER:C235(*; This:C1470.name; "&\"0-9;-;+\"") - //……………………………………………………………………… - : ($1=Is real:K8:4) + //……………………………………………………………………… + : ($filter=Is real:K8:4) - If (Count parameters:C259>=2) // Separator - - $t:=$2 - - Else + If (Count parameters:C259<2) - GET SYSTEM FORMAT:C994(Decimal separator:K60:1;$t) + GET SYSTEM FORMAT:C994(Decimal separator:K60:1; $separator) End if - OBJECT SET FILTER:C235(*;This:C1470.name;"&\"0-9;"+$t+";.;-;+\"") + OBJECT SET FILTER:C235(*; This:C1470.name; "&\"0-9;"+$separator+";.;-;+\"") - //……………………………………………………………………… - : ($1=Is time:K8:8) + //……………………………………………………………………… + : ($filter=Is time:K8:8) - If (Count parameters:C259>=2) // Separator - - $t:=$2 - - Else + If (Count parameters:C259<2) - GET SYSTEM FORMAT:C994(Time separator:K60:11;$t) + GET SYSTEM FORMAT:C994(Time separator:K60:11; $separator) End if - OBJECT SET FILTER:C235(*;This:C1470.name;"&\"0-9;"+$t+";:\"") + OBJECT SET FILTER:C235(*; This:C1470.name; "&\"0-9;"+$separator+";:\"") - //……………………………………………………………………… - : ($1=Is date:K8:7) + //……………………………………………………………………… + : ($filter=Is date:K8:7) - If (Count parameters:C259>=2) // Separator + If (Count parameters:C259<2) - $t:=$2 - - Else - - GET SYSTEM FORMAT:C994(Date separator:K60:10;$t) + GET SYSTEM FORMAT:C994(Date separator:K60:10; $separator) End if - OBJECT SET FILTER:C235(*;This:C1470.name;"&\"0-9;"+$t+";/\"") + OBJECT SET FILTER:C235(*; This:C1470.name; "&\"0-9;"+$separator+";/\"") - //……………………………………………………………………… + //……………………………………………………………………… Else - OBJECT SET FILTER:C235(*;This:C1470.name;"") // Text as default + OBJECT SET FILTER:C235(*; This:C1470.name; "") // Text as default - //……………………………………………………………………… + //……………………………………………………………………… End case + return This:C1470 + + End if + + OBJECT SET FILTER:C235(*; This:C1470.name; String:C10($filter)) + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getFilter() : Text + + return OBJECT Get filter:C1073(*; This:C1470.name) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setPlaceholder($placeholder : Text) : cs:C1710.input + + OBJECT SET PLACEHOLDER:C1295(*; This:C1470.name; This:C1470._getLocalizeString($placeholder)) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // ⚠️ Override widget function +Function setEnterable($enterable : Boolean; $focusable : Boolean) : cs:C1710.input + + $enterable:=Count parameters:C259>=1 ? $enterable : True:C214 + + If (Count parameters:C259>=2) + + If ($enterable) + + OBJECT SET ENTERABLE:C238(*; This:C1470.name; obk enterable:K42:45) + + Else + + ARRAY TEXT:C222($textArray; 0x0000) + FORM GET ENTRY ORDER:C1469($textArray; *) + $focusable:=Find in array:C230($textArray; This:C1470.name)#-1 + + If ($focusable) + + // Non-enterable, and its content can be selected + OBJECT SET ENTERABLE:C238(*; This:C1470.name; obk not enterable:K42:44) + + Else + + // Non-enterable, and its content cannot be selected. + OBJECT SET ENTERABLE:C238(*; This:C1470.name; obk not enterable not focusable:K42:46) + + End if + End if + Else - OBJECT SET FILTER:C235(*;This:C1470.name;String:C10($1)) + OBJECT SET ENTERABLE:C238(*; This:C1470.name; $enterable) End if - C_OBJECT:C1216($0) - $0:=This:C1470 + return This:C1470 -/*════════════════════════════════════════════ -.getFilter() -> text -════════════════════════════════════════════*/ -Function getFilter + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Replace the point by the decimal parameter in a text box + // This function must be called during management of the "On Before Keystroke" event. +Function swapDecimalSeparator() - C_TEXT:C284($0) + var $separator : Text - $0:=OBJECT Get filter:C1073(*;This:C1470.name) \ No newline at end of file + If (Keystroke:C390=".") + + GET SYSTEM FORMAT:C994(Decimal separator:K60:1; $separator) + FILTER KEYSTROKE:C389($separator) + + End if \ No newline at end of file diff --git a/Project/Sources/Classes/listbox.4dm b/Project/Sources/Classes/listbox.4dm index d806265..3917d60 100755 --- a/Project/Sources/Classes/listbox.4dm +++ b/Project/Sources/Classes/listbox.4dm @@ -1,13 +1,1329 @@ Class extends scrollable -Class constructor($name) +property source : Collection +property type : Integer + +property item : Object +property itemPosition : Integer +property items : Collection + +property kind : Integer +property properties : Object +property definition : Collection +property columns : Object + +property previous : Object +property cellBox : Object + +// === === === === === === === === === === === === === === === === === === === === === === === === === === +Class constructor($name : Text) Super:C1705($name) ASSERT:C1129(This:C1470.type=Object type listbox:K79:8) - If (This:C1470.events.length=0) + This:C1470.source:=Null:C1517 // collection/entity selection + This:C1470.data:=Null:C1517 + + // Predefined container for collection or selection listboxes + This:C1470.item:=Null:C1517 + This:C1470.itemPosition:=0 + This:C1470.items:=Null:C1517 + + This:C1470.updateDefinition() + + // Backup design properties + This:C1470.saveProperties() + + //mark:-[READ ONLY] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== + // Gives the number of columns +Function get columnsNumber() : Integer + + return LISTBOX Get number of columns:C831(*; This:C1470.name) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== + // Gives the number of rows +Function get rowsNumber() : Integer + + return LISTBOX Get number of rows:C915(*; This:C1470.name) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== + // return true when there is data +Function get isReady : Boolean + + return (This:C1470.source#Null:C1517) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get dataLength : Integer + + return This:C1470.data=Null:C1517 ? 0 : This:C1470.data.length + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get isSelected : Boolean + + return This:C1470.item#Null:C1517 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get index : Integer + + return This:C1470.itemPosition-1 + + //mark:-[READ & WRITE] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get movableLines() : Boolean + + return Bool:C1537(LISTBOX Get property:C917(*; This:C1470.name; lk movable rows:K53:76)) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set movableLines($on : Boolean) + + LISTBOX SET PROPERTY:C1440(*; This:C1470.name; lk movable rows:K53:76; $on ? lk yes:K53:69 : lk no:K53:68) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get selectable() : Boolean + + return Bool:C1537(LISTBOX Get property:C917(*; This:C1470.name; lk selection mode:K53:35)) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set selectable($on : Boolean) + + If ($on) + + // Try to restore design selection mode + LISTBOX SET PROPERTY:C1440(*; This:C1470.name; lk selection mode:K53:35; Num:C11(This:C1470.properties.selectionMode)=0 ? lk yes:K53:69 : This:C1470.properties.selectionMode) + + Else + + LISTBOX SET PROPERTY:C1440(*; This:C1470.name; lk selection mode:K53:35; lk no:K53:68) + + End if + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get singleSelection() : Boolean + + return LISTBOX Get property:C917(*; This:C1470.name; lk selection mode:K53:35)=lk single:K53:58 + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set singleSelection($on : Boolean) + + LISTBOX SET PROPERTY:C1440(*; This:C1470.name; lk selection mode:K53:35; $on ? lk single:K53:58 : lk multiple:K53:59) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get multipleSelection() : Boolean + + return LISTBOX Get property:C917(*; This:C1470.name; lk selection mode:K53:35)=lk multiple:K53:59 + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set multipleSelection($on : Boolean) + + LISTBOX SET PROPERTY:C1440(*; This:C1470.name; lk selection mode:K53:35; $on ? lk multiple:K53:59 : lk single:K53:58) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get sortable() : Boolean + + return Bool:C1537(LISTBOX Get property:C917(*; This:C1470.name; lk sortable:K53:45)) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set sortable($on : Boolean) + + LISTBOX SET PROPERTY:C1440(*; This:C1470.name; lk sortable:K53:45; $on ? lk yes:K53:69 : lk no:K53:68) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function sort($column : Integer; $descendant : Boolean) + + If ($descendant) + + LISTBOX SORT COLUMNS:C916(*; This:C1470.name; $column; <) + + Else + + LISTBOX SORT COLUMNS:C916(*; This:C1470.name; $column; >) + + End if + + OBJECT SET VALUE:C1742(This:C1470.definition[$column-1].header; $descendant ? 2 : 1) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get selectionHighlight() : Boolean + + return Bool:C1537(LISTBOX Get property:C917(*; This:C1470.name; lk hide selection highlight:K53:41)) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set selectionHighlight($on : Boolean) : cs:C1710.listbox + + LISTBOX SET PROPERTY:C1440(*; This:C1470.name; lk hide selection highlight:K53:41; $on ? lk yes:K53:69 : lk no:K53:68) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get dataSourceType() : Text + + var $name : Text + var $table : Integer + var $ptr : Pointer + + LISTBOX GET TABLE SOURCE:C1014(*; This:C1470.name; $table; $name) + + If ($table>0) + + return Length:C16($name)=0 ? "Current Selection" : "Named Selection" + + Else + + $ptr:=OBJECT Get pointer:C1124(Object named:K67:5; This:C1470.name) + + Case of + + //––––––––––––––––––––––––––––––––– + : ($ptr=Null:C1517) + + // + + //––––––––––––––––––––––––––––––––– + : (Type:C295($ptr->)=Is collection:K8:32) + + return "Collection" + + //––––––––––––––––––––––––––––––––– + : (Type:C295($ptr->)=Boolean array:K8:21) + + return "Array" + + //––––––––––––––––––––––––––––––––– + : (Type:C295($ptr->)=Is longint:K8:6)\ + | (Type:C295($ptr->)=Is real:K8:4) + + return "Entity Selection" + + //––––––––––––––––––––––––––––––––– + End case + End if + + + // MARK:-[SOURCE & DATA] + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Set the source data and determine it's kind +Function setSource($source) : cs:C1710.listbox + + This:C1470._clearDatasources() + + var $type : Integer:=Value type:C1509($source) + + If ($type=Is collection:K8:32) + + This:C1470.source:=$source + This:C1470.kind:=$type + This:C1470.setData() + + return This:C1470 + + End if + + If ($type=Is object:K8:27) && (OB Instance of:C1731($source; 4D:C1709.EntitySelection)) // entity selection + + This:C1470.source:=$source + This:C1470.kind:=$type + This:C1470.setData() + + return This:C1470 + + End if + + This:C1470.source:=Null:C1517 + This:C1470.data:=Null:C1517 + This:C1470.kind:=0 + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setData : cs:C1710.listbox + + This:C1470.data:=This:C1470.source + + return This:C1470 + + // MARK:- + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isCollection($caller : Text) : Boolean + + var $success : Boolean + $success:=This:C1470.dataSourceType="Collection" + + If (Count parameters:C259>=1) + + return Asserted:C1132($success; "The function "+$caller+"() is only available for an Collection listbox") + + Else + + return $success + + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isEntitySelection($caller : Text) : Boolean + + var $success : Boolean + $success:=This:C1470.dataSourceType="Entity Selection" + + If (Count parameters:C259>=1) + + return Asserted:C1132($success; "The function "+$caller+"() is only available for an Entity Selection listbox") + + Else + + return $success + + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isArray($caller : Text) : Boolean + + var $success : Boolean + $success:=This:C1470.dataSourceType="array" + + If (Count parameters:C259>=1) + + return Asserted:C1132($success; "The function "+$caller+"() is only available for an Array listbox") + + Else + + return $success + + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isHierarchical($caller : Text) : Boolean + + var $hierarchical : Boolean + + LISTBOX GET HIERARCHY:C1099(*; This:C1470.name; $hierarchical) + + If (Count parameters:C259>=1) + + return Asserted:C1132($hierarchical; "The function "+$caller+"() is only available for a Hierarchical listbox") + + Else - This:C1470.events:=New collection:C1472(On Selection Change:K2:29) + return $hierarchical - End if \ No newline at end of file + End if + + // MARK:- [HIERARCHICAL LISTBOXES] + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function selectBreak($row : Integer; $column : Integer) : cs:C1710.listbox + + If (This:C1470.isHierarchical(Current method name:C684)) + + LISTBOX SELECT ROW:C912(*; This:C1470.name; $row-1; lk replace selection:K53:1) + LISTBOX SELECT BREAK:C1117(*; This:C1470.name; $row; $column=0 ? 1 : $column) // Default is the first column + + //fixme:the selection is not correctly updated + var $ptr : Pointer + $ptr:=OBJECT Get pointer:C1124(Object named:K67:5; This:C1470.name) + + If ($row=1) + + $ptr->{$row-1}:=True:C214 + + Else + //$ptr->{$row}:=True + + End if + End if + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function collapse($row : Integer; $selector : Integer; $recursive : Boolean) : cs:C1710.listbox + + If (This:C1470.isHierarchical(Current method name:C684)) + + $selector:=Count parameters:C259<2 ? lk all:K53:16 : $selector + LISTBOX COLLAPSE:C1101(*; This:C1470.name; $recursive; $selector; $row; 1) + + End if + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function collapseAll() : cs:C1710.listbox + + If (This:C1470.isHierarchical(Current method name:C684)) + + LISTBOX COLLAPSE:C1101(*; This:C1470.name; True:C214; lk all:K53:16) + + End if + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function expand($row : Integer; $selector : Integer; $recursive : Boolean) : cs:C1710.listbox + + If (This:C1470.isHierarchical(Current method name:C684)) + + $selector:=Count parameters:C259<2 ? lk all:K53:16 : $selector + LISTBOX EXPAND:C1100(*; This:C1470.name; $recursive; $selector; $row; 1) + + End if + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function expandAll() : cs:C1710.listbox + + If (This:C1470.isHierarchical(Current method name:C684)) + + LISTBOX EXPAND:C1100(*; This:C1470.name; True:C214; lk all:K53:16) + + End if + + return This:C1470 + + // MARK:- + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Giving a column, a header or a footer name, returns the corresponding column pointer + // ⚠️ Could return a nil pointer if the colunmn isn't found or if column data source is an expression +Function columnPtr($name : Text) : Pointer + + var $indx : Integer + + ARRAY BOOLEAN:C223($isVisible; 0) + ARRAY POINTER:C280($columnsPtr; 0) + ARRAY POINTER:C280($footersPtr; 0) + ARRAY POINTER:C280($headersPtr; 0) + ARRAY POINTER:C280($stylesPtr; 0) + ARRAY TEXT:C222($columns; 0) + ARRAY TEXT:C222($footers; 0) + ARRAY TEXT:C222($headers; 0) + + LISTBOX GET ARRAYS:C832(*; This:C1470.name; \ + $columns; $headers; \ + $columnsPtr; $headersPtr; \ + $isVisible; \ + $stylesPtr; \ + $footers; $footersPtr) + + $indx:=Find in array:C230($columns; $name) + + If ($indx>0) + + return $columnsPtr{$indx} + + Else + + $indx:=Find in array:C230($headers; $name) + + If ($indx>0) + + return $columnsPtr{$indx} + + Else + + $indx:=Find in array:C230($footers; $name) + + If ($indx>0) + + return $columnsPtr{$indx} + + End if + End if + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Giving a column, a header or a footer name, returns the corresponding column number +Function columnNumber($name : Text) : Integer + + var $indx : Integer + + ARRAY BOOLEAN:C223($isVisible; 0) + ARRAY POINTER:C280($columnsPtr; 0) + ARRAY POINTER:C280($footersPtr; 0) + ARRAY POINTER:C280($headersPtr; 0) + ARRAY POINTER:C280($stylesPtr; 0) + ARRAY TEXT:C222($columns; 0) + ARRAY TEXT:C222($footers; 0) + ARRAY TEXT:C222($headers; 0) + + LISTBOX GET ARRAYS:C832(*; This:C1470.name; \ + $columns; $headers; \ + $columnsPtr; $headersPtr; \ + $isVisible; \ + $stylesPtr; \ + $footers; $footersPtr) + + $indx:=Find in array:C230($columns; $name) + + If ($indx=-1) + + $indx:=Find in array:C230($headers; $name) + + If ($indx=-1) + + $indx:=Find in array:C230($footers; $name) + + End if + End if + + return $indx + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getColumnName($columnNumber : Integer) : Text + + If (This:C1470.definition=Null:C1517) + + This:C1470.updateDefinition() + + End if + + return String:C10(This:C1470.definition[$columnNumber-1].name) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getHeaderName($columnNumber : Integer) : Text + + If (This:C1470.definition=Null:C1517) + + This:C1470.updateDefinition() + + End if + + return String:C10(This:C1470.definition[$columnNumber-1].header) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getFooterName($columnNumber : Integer) : Text + + If (This:C1470.definition=Null:C1517) + + This:C1470.updateDefinition() + + End if + + return String:C10(This:C1470.definition[$columnNumber-1].footer) + + // MARK:- [⚠️ ARRAY TYPE LIST BOXES] + // === === === === === === === === === === === === === === === === === === === === === === === === === === + /// Defines the foreground color of a row or a cell +Function setRowForegroundColor($row : Integer; $color; $target) + + If (This:C1470.isArray(Current method name:C684)) + + $target:=Count parameters:C259>=3\ + ? Value type:C1509($target)=Is text:K8:3 ? $target : This:C1470.getColumnName(Num:C11($target))\ + : This:C1470.name + + LISTBOX SET ROW COLOR:C1270(*; $target; $row; $color) + + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + /// Restores the foreground color defined in the form +Function resetForegroundColor($target) + + var $row : Integer + + If (This:C1470.isArray(Current method name:C684)) + + $target:=Count parameters:C259>=1\ + ? Value type:C1509($target)=Is text:K8:3 ? $target : This:C1470.getColumnName(Num:C11($target))\ + : This:C1470.name + + For ($row; 1; This:C1470.rowsNumber; 1) + + LISTBOX SET ROW COLOR:C1270(*; $target; $row; lk inherited:K53:26) + + End for + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setRowFontStyle($row : Integer; $tyle : Integer) + + If (This:C1470.isArray(Current method name:C684)) + + // Default is plain + $tyle:=Count parameters:C259>=2 ? $tyle : Plain:K14:1 + LISTBOX SET ROW FONT STYLE:C1268(*; This:C1470.name; $row; $tyle) + + End if + + // MARK:- + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Current cell indexes {column,row} +Function cellPosition($e : cs:C1710.evt) : Object + + var $button; $column; $row; $x; $y : Integer + + $e:=$e || cs:C1710.evt.new() + + If ($e.code=On Clicked:K2:4)\ + | ($e.code=On Double Clicked:K2:5)\ + | ($e.code=On Selection Change:K2:29)\ + | ($e.code=On Expand:K2:41)\ + | ($e.code=On Delete Action:K2:56) + + // ⚠️ Column is always 0 + LISTBOX GET CELL POSITION:C971(*; This:C1470.name; $column; $row) + + Else + + MOUSE POSITION:C468($x; $y; $button) + LISTBOX GET CELL POSITION:C971(*; This:C1470.name; $x; $y; $column; $row) + + End if + + // If the event is passed in parameter, update it + If (Count parameters:C259>=1) + + $e.row:=$row + $e.column:=$column + + return + + End if + + return {\ + column: $column; \ + row: $row\ + } + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // ⚠️ +Function getCoordinates() : Object + + This:C1470.getScrollPosition() + This:C1470.getScrollbars() + This:C1470.updateDefinition() + This:C1470.updateCell() + + return Super:C1706.getCoordinates() + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Returns a row coordinates +Function rowCoordinates($row : Integer) : Object + + var $l; $bottom; $left; $right; $top; $width : Integer + var $horizontal; $vertical : Boolean + + This:C1470.getCoordinates() + + LISTBOX GET CELL COORDINATES:C1330(*; This:C1470.name; 1; $row; $left; $top; $l; $l) + LISTBOX GET CELL COORDINATES:C1330(*; This:C1470.name; This:C1470.columnsNumber; $row; $l; $l; $right; $bottom) + + // Adjust according to the visible part + $left:=($left(This:C1470.coordinates.right-$width)) ? This:C1470.coordinates.right-$width : $right + + $bottom:=($bottom>This:C1470.coordinates.bottom) ? This:C1470.coordinates.bottom : $bottom + + return {\ + left: $left; \ + top: $top; \ + right: $right; \ + bottom: $bottom\ + } + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function cellCoordinates($column : Integer; $row : Integer) : Object + + var $bottom; $left; $right; $top : Integer + var $e : cs:C1710.evt + + If (Count parameters:C259=0) + + $e:=FORM Event:C1606 + + If ($e.column#Null:C1517) + + $column:=$e.column + $row:=$e.row + + End if + End if + + // Mark: TURNAROUND + If ($row<=0) + + LISTBOX GET CELL POSITION:C971(*; This:C1470.name; $column; $row) + + End if + + LISTBOX GET CELL COORDINATES:C1330(*; This:C1470.name; $column; $row; $left; $top; $right; $bottom) + + This:C1470.cellBox:=This:C1470.cellBox || {} + + This:C1470.cellBox.left:=$left + This:C1470.cellBox.top:=$top + This:C1470.cellBox.right:=$right + This:C1470.cellBox.bottom:=$bottom + + return This:C1470.cellBox + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Gives the number of selected rows +Function selected() : Integer + + return Count in array:C907((This:C1470.pointer)->; True:C214) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + /// Define the properties of the list box according to the system +Function setSystemFormat() + + If (Is Windows:C1573) + + LISTBOX SET GRID:C841(*; This:C1470.name; False:C215; True:C214) + OBJECT SET RGB COLORS:C628(*; This:C1470.name; Foreground color:K23:1) + OBJECT SET HORIZONTAL ALIGNMENT:C706(*; This:C1470.name; Align left:K42:2) + + Else + + LISTBOX SET GRID:C841(*; This:C1470.name; False:C215; False:C215) + //OBJECT SET RGB COLORS(*; This.name; Foreground color; Background color; 0x00E6F0FF) + OBJECT SET RGB COLORS:C628(*; This:C1470.name; Foreground color:K23:1) //; Background color; 0x00F5F5F5) + + End if + + // MARK: - [SELECTION] + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Select row(s) +Function select($row : Integer) : cs:C1710.listbox + + If (Count parameters:C259=0) + + // Select all rows + LISTBOX SELECT ROW:C912(*; This:C1470.name; 0; lk replace selection:K53:1) + + Else + + // #TO_DO: use a collection for multiple selection + LISTBOX SELECT ROW:C912(*; This:C1470.name; $row; lk replace selection:K53:1) + + End if + + // Update selection + If (This:C1470.isCollection() || This:C1470.isEntitySelection()) + + var $c : Collection + $c:=This:C1470.getValue() + + If ($c.length>=$row) + + This:C1470.item:=$c[$row-1] + This:C1470.itemPosition:=$row-1 + This:C1470.items:=[This:C1470.item] + + Else + + This:C1470.item:=Null:C1517 + This:C1470.itemPosition:=0 + This:C1470.items:=[] + + End if + + Else + + (OBJECT Get pointer:C1124(Object named:K67:5; This:C1470.name))->{$row}:=True:C214 + + End if + + OBJECT SET SCROLL POSITION:C906(*; This:C1470.name; $row) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Unselect row(s) +Function unselect($row : Integer) : cs:C1710.listbox + + If (Count parameters:C259=0) + + // Unselect all rows + LISTBOX SELECT ROW:C912(*; This:C1470.name; 0; lk remove from selection:K53:3) + + If (This:C1470.isCollection() || This:C1470.isEntitySelection()) + + This:C1470.item:=Null:C1517 + This:C1470.itemPosition:=0 + This:C1470.items:=Null:C1517 + + End if + + Else + + // #TO_DO: use a collection for multiple selection + LISTBOX SELECT ROW:C912(*; This:C1470.name; $row; lk remove from selection:K53:3) + + End if + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Select the first row +Function selectFirstRow() : cs:C1710.listbox + + If (LISTBOX Get number of rows:C915(*; This:C1470.name)>0) + + This:C1470.select(1) + + Else + + This:C1470.unselect() + + End if + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Select the last row +Function selectLastRow() : cs:C1710.listbox + + This:C1470.select(This:C1470.rowsNumber) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Select the last touched row (last mouse click, last selection made via the keyboard or last drop) +Function autoSelect() + + This:C1470.select(This:C1470.cellPosition().row) + This:C1470.touch() + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Selects the given row if possible, else the most appropiate one + // Useful to maintain a selection after a deletion +Function doSafeSelect($row : Integer) : cs:C1710.listbox + + LISTBOX SELECT ROW:C912(*; This:C1470.name; 0; lk remove from selection:K53:3) + + Case of + + //______________________________ + : ($row<=This:C1470.rowsNumber) + + return This:C1470.select($row) + + //______________________________ + : (This:C1470.rowsNumber>0) + + return This:C1470.select(This:C1470.rowsNumber) + + //______________________________ + Else + + return This:C1470.unselect() + + //______________________________ + End case + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function selectAll() : cs:C1710.listbox + + return This:C1470.select() + + // MARK: - + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function edit($target; $item : Integer) + + If (Value type:C1509($target)=Is object:K8:27) // ⚠️ Should be an event object + + ASSERT:C1129($target.columnName#Null:C1517) + + If ($target.row#Null:C1517) + + EDIT ITEM:C870(*; String:C10($target.columnName); Num:C11($target.row)) + + Else + + If (Count parameters:C259=1) // Current item + + EDIT ITEM:C870(*; String:C10($target.columnName)) + + Else + + EDIT ITEM:C870(*; String:C10($target.columnName); $item) + + End if + + End if + + Else + + Case of + + //______________________________________________________ + : (Count parameters:C259=0) // First editable column of the current row + + ARRAY BOOLEAN:C223($isVisible; 0) + ARRAY POINTER:C280($columnsPtr; 0) + ARRAY POINTER:C280($footersPtr; 0) + ARRAY POINTER:C280($headersPtr; 0) + ARRAY POINTER:C280($stylesPtr; 0) + ARRAY TEXT:C222($columns; 0) + + LISTBOX GET ARRAYS:C832(*; This:C1470.name; \ + $columns; $headers; \ + $columnsPtr; $headersPtr; \ + $isVisible; \ + $stylesPtr) + + var $i : Integer + For ($i; 1; Size of array:C274($columns); 1) + + If (OBJECT Get enterable:C1067(*; $columns{$i})) & (OBJECT Get visible:C1075(*; $columns{$i})) + + EDIT ITEM:C870(*; $columns{$i}) + break + + End if + End for + + //______________________________________________________ + : (Count parameters:C259=1) // Current item + + EDIT ITEM:C870(*; String:C10($target)) + + //______________________________________________________ + Else + + EDIT ITEM:C870(*; String:C10($target); $item) + + //______________________________________________________ + End case + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Reveal the row +Function reveal($row : Integer) : cs:C1710.listbox + + LISTBOX SELECT ROW:C912(*; This:C1470.name; $row; lk replace selection:K53:1) + OBJECT SET SCROLL POSITION:C906(*; This:C1470.name; $row) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Update the listbox columns/rows definition +Function updateDefinition() : cs:C1710.listbox + + var $key : Text + var $i : Integer + var $o : Object + + ARRAY TEXT:C222($columns; 0) + ARRAY TEXT:C222($footers; 0) + ARRAY TEXT:C222($headers; 0) + ARRAY BOOLEAN:C223($isVisible; 0) + ARRAY POINTER:C280($columnsPtr; 0) + ARRAY POINTER:C280($footersPtr; 0) + ARRAY POINTER:C280($headersPtr; 0) + ARRAY POINTER:C280($stylesPtr; 0) + + LISTBOX GET ARRAYS:C832(*; This:C1470.name; \ + $columns; $headers; \ + $columnsPtr; $headersPtr; \ + $isVisible; \ + $stylesPtr; \ + $footers; $footersPtr) + + This:C1470.definition:=[] + + ARRAY TO COLLECTION:C1563(This:C1470.definition; \ + $columns; "name"; \ + $headers; "header"; \ + $footers; "footer") + + This:C1470.columns:={} + + $o:=This:C1470._columnProperties() + + For ($i; 1; Size of array:C274($columns); 1) + + This:C1470.columns[$columns{$i}]:={\ + number: $i; \ + visible: $isVisible{$i}; \ + enterable: OBJECT Get enterable:C1067(*; $columns{$i}); \ + height: LISTBOX Get row height:C1408(*; This:C1470.name; $i); \ + pointer: $columnsPtr{$i}\ + } + + For each ($key; $o) + + This:C1470.columns[$columns{$i}][$key]:=LISTBOX Get property:C917(*; $columns{$i}; $o[$key].k) + + End for each + End for + + This:C1470.getScrollbars() + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Update the current cell indexes and coordinates +Function updateCell() : cs:C1710.listbox + + This:C1470.cellCoordinates() + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Displays a cs.menu at the bottom left of the current cell +Function popup($menu : cs:C1710.menu; $default : Text) : cs:C1710.menu + + var $bottom; $left : Integer + var $coordinates : Object + + $coordinates:=This:C1470.cellCoordinates() + + $left:=$coordinates.left + $bottom:=$coordinates.bottom + + CONVERT COORDINATES:C1365($left; $bottom; XY Current form:K27:5; XY Current window:K27:6) + + If (Count parameters:C259=1) + + $menu.popup(""; $left; $bottom) + + Else + + $menu.popup($default; $left; $bottom) + + End if + + return $menu + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function showColumn($column; $visible : Boolean) : cs:C1710.listbox + + var $o : Object + + $visible:=Count parameters:C259>=2 ? $visible : True:C214 + + This:C1470.updateDefinition() + + If (Value type:C1509($column)=Is real:K8:4) | (Value type:C1509($column)=Is longint:K8:6) + + If (Asserted:C1132($column<=This:C1470.definition.length; "Index out of range")) + + OBJECT SET VISIBLE:C603(*; This:C1470.definition[$column].name; $visible) + + End if + + Else + + $o:=This:C1470.definition.query("name = "; String:C10($column)).pop() + + If (Asserted:C1132($o#Null:C1517; "Unknown column name")) + + OBJECT SET VISIBLE:C603(*; $o.name; $visible) + + End if + End if + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function hideColumn($column) : cs:C1710.listbox + + return This:C1470.showColumn($column; False:C215) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function clear() : cs:C1710.listbox + + var $o : Object + + This:C1470.updateDefinition() + + For each ($o; This:C1470.definition) + + CLEAR VARIABLE:C89(OBJECT Get pointer:C1124(Object named:K67:5; $o.name)->) + + End for each + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function deleteRows($row : Integer) : cs:C1710.listbox + + If (Count parameters:C259=0) + + // Delete all rows + LISTBOX DELETE ROWS:C914(*; This:C1470.name; 1; This:C1470.rowsNumber) + + Else + + // #TO_DO: use a collection for multiple deletion + LISTBOX DELETE ROWS:C914(*; This:C1470.name; $row; 1) + + End if + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Returns all properties of a column or the listbox +Function getProperties($column : Text) : Object + + var $key; $target : Text + var $o; $properties : Object + + If (Count parameters:C259>=1) + + $target:=$column + $o:=This:C1470._columnProperties() + + Else + + $target:=This:C1470.name + $o:=This:C1470._listboxProperties() + + End if + + $properties:={} + + For each ($key; $o) + + $properties[$key]:=LISTBOX Get property:C917(*; $target; $o[$key].k) + + End for each + + return $properties + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getProperty($property : Integer; $column : Text) : Variant + + If (Count parameters:C259=0) + + return LISTBOX Get property:C917(*; This:C1470.name; $property) + + Else + + return LISTBOX Get property:C917(*; $column; $property) + + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function withSelectionHighlight($enabled : Boolean) : cs:C1710.listbox + + return This:C1470.setProperty(lk hide selection highlight:K53:41; $enabled ? lk yes:K53:69 : lk no:K53:68) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function withoutSelectionHighlight() : cs:C1710.listbox + + return This:C1470.withSelectionHighlight(False:C215) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setMovableLines($enabled : Boolean) : cs:C1710.listbox + + $enabled:=Count parameters:C259>=1 ? $enabled : True:C214 + + This:C1470.setProperty(lk movable rows:K53:76; $enabled ? lk yes:K53:69 : lk no:K53:68) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setNotMovableLines() : cs:C1710.listbox + + return This:C1470.setMovableLines(False:C215) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setSelectable($enabled : Boolean; $mode : Integer) : cs:C1710.listbox + + If (Count parameters:C259=0) + + // Restore design mode definition + return This:C1470.setProperty(lk selection mode:K53:35; This:C1470.properties.selectionMode) + + Else + + $enabled:=Count parameters:C259>=1 ? $enabled : True:C214 + return $enabled ? This:C1470.setProperty(lk selection mode:K53:35; $mode) : This:C1470.setProperty(lk selection mode:K53:35; lk none:K53:57) + + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setNotSelectable() : cs:C1710.listbox + + return This:C1470.setSelectable(False:C215) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setSingleSelectable() : cs:C1710.listbox + + return This:C1470.setProperty(lk selection mode:K53:35; lk single:K53:58) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setMultipleSelectable() : cs:C1710.listbox + + return This:C1470.setProperty(lk selection mode:K53:35; lk multiple:K53:59) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setSortable($enabled : Boolean) : cs:C1710.listbox + + $enabled:=Count parameters:C259>=1 ? $enabled : True:C214 + return This:C1470.setProperty(lk sortable:K53:45; $enabled ? lk yes:K53:69 : lk no:K53:68) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setNotSortable() : cs:C1710.listbox + + return This:C1470.setSortable(False:C215) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setProperty($property : Integer; $value) : cs:C1710.listbox + + LISTBOX SET PROPERTY:C1440(*; This:C1470.name; $property; $value) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setRowsHeight($height : Integer; $unit : Integer) : cs:C1710.listbox + + LISTBOX SET ROWS HEIGHT:C835(*; This:C1470.name; $height; $unit) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function saveProperties() + + var $key : Text + var $unit : Integer + var $o; $properties : Object + + $properties:={} + + $o:=This:C1470._listboxProperties() + + For each ($key; $o) + + $properties[$key]:=LISTBOX Get property:C917(*; This:C1470.name; $o[$key].k) + + End for each + + $properties.headerHeight:=LISTBOX Get headers height:C1144(*; This:C1470.name) + $properties.footerHeight:=LISTBOX Get footers height:C1146(*; This:C1470.name) + + If (Bool:C1537($properties.autoRowHeight)) + + $properties.rowMaxHeight:=LISTBOX Get auto row height:C1502(*; This:C1470.name; lk row max height:K53:74) + $properties.rowMinHeight:=LISTBOX Get auto row height:C1502(*; This:C1470.name; lk row min height:K53:73) + + Else + + $properties.rowsHeight:=LISTBOX Get rows height:C836(*; This:C1470.name) + + End if + + var $horizontal; $vertical : Integer + OBJECT GET SCROLLBAR:C1076(*; This:C1470.name; $horizontal; $vertical) + $properties.horScrollbar:=$horizontal + $properties.verScrollbar:=$vertical + + $o:=This:C1470.colors + $properties.foreground:=$o.foreground + $properties.background:=$o.background + $properties.altBackground:=$o.altBackground + + This:C1470.properties:=$properties + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function restoreProperties() + + var $key : Text + var $o; $properties : Object + + $properties:=This:C1470.properties + $o:=This:C1470._listboxProperties() + + For each ($key; $o) + + LISTBOX SET PROPERTY:C1440(*; This:C1470.name; $o[$key].k; $properties[$key]) + + End for each + + LISTBOX SET FOOTERS HEIGHT:C1145(*; This:C1470.name; $properties.footerHeight) + LISTBOX SET HEADERS HEIGHT:C1143(*; This:C1470.name; $properties.headerHeight) + + If (Bool:C1537($properties.autoRowHeight)) + + LISTBOX SET AUTO ROW HEIGHT:C1501(*; This:C1470.name; lk row max height:K53:74; $properties.rowMaxHeight; lk pixels:K53:22) + LISTBOX SET AUTO ROW HEIGHT:C1501(*; This:C1470.name; lk row min height:K53:73; $properties.rowMinHeight; lk pixels:K53:22) + + Else + + LISTBOX SET ROWS HEIGHT:C835(*; This:C1470.name; $properties.rowsHeight) + + End if + + This:C1470.setScrollbars($properties.horScrollbar; $properties.verScrollbar) + + OBJECT SET RGB COLORS:C628(*; This:C1470.name; $properties.foreground; $properties.background; $properties.altBackground) + + //mark:-[PRIVATE] + // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +Function _listboxProperties() : Object + + var $o : Object + + $o:=This:C1470._commonProperties() + + $o.detailFormName:={k: lk detail form name:K53:44} + $o.displayFooter:={k: lk display footer:K53:20} + $o.displayHeader:={k: lk display header:K53:4} + $o.doubleClickOnRow:={k: lk double click on row:K53:43} + $o.extraRows:={k: lk extra rows:K53:38} + $o.hideSelectionHighlight:={k: lk hide selection highlight:K53:41} + $o.highlightSet:={k: lk highlight set:K53:66} + $o.horScrollbarHeight:={k: lk hor scrollbar height:K53:7} + $o.movableRows:={k: lk movable rows:K53:76} + $o.namedSelection:={k: lk named selection:K53:67} + $o.resizingMode:={k: lk resizing mode:K53:36} + $o.rowHeightUnit:={k: lk row height unit:K53:42} + $o.selectionMode:={k: lk selection mode:K53:35} + $o.singleClickEdit:={k: lk single click edit:K53:70} + $o.sortable:={k: lk sortable:K53:45} + $o.verScrollbarWidth:={k: lk ver scrollbar width:K53:9} + + Case of + + //______________________________________________________ + : (This:C1470.isCollection() || This:C1470.isEntitySelection()) + + $o.metaExpression:={k: lk meta expression:K53:75} + + //______________________________________________________ + End case + + return $o + + // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +Function _columnProperties() : Object + + var $o : Object + + $o:=This:C1470._commonProperties() + + $o.allowWordwrap:={k: lk allow wordwrap:K53:39} + $o.columnMaxWidth:={k: lk column max width:K53:51} + $o.columnMinWidth:={k: lk column min width:K53:50} + $o.columnResizable:={k: lk column resizable:K53:40} + $o.displayType:={k: lk display type:K53:46} + $o.multiStyle:={k: lk multi style:K53:71} + + return $o + + // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +Function _commonProperties() : Object + + return {\ + autoRowHeight: {k: lk auto row height:K53:72}; \ + backgroundColorExpression: {k: lk background color expression:K53:47}; \ + cellHorizontalPadding: {k: lk cell horizontal padding:K53:77}; \ + cellVerticalPadding: {k: lk cell vertical padding:K53:78}; \ + fontColorExpression: {k: lk font color expression:K53:48}; \ + fontStyleExpression: {k: lk font style expression:K53:49}; \ + truncate: {k: lk truncate:K53:37}\ + } + + // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** + // clear the objects that are set by the listbox object +Function _clearDatasources() + + This:C1470.item:=Null:C1517 + This:C1470.itemPosition:=0 + This:C1470.items:=Null:C1517 \ No newline at end of file diff --git a/Project/Sources/Classes/macro.4dm b/Project/Sources/Classes/macro.4dm index 4fbe19e..dfe7d82 100755 --- a/Project/Sources/Classes/macro.4dm +++ b/Project/Sources/Classes/macro.4dm @@ -11,24 +11,32 @@ property projectMethod : Boolean:=False:C215 property objectMethod : Boolean:=False:C215 property withSelection : Boolean:=False:C215 -property lineTexts : Collection:=[] -property decimalSeparator : Text +property line : Text:="" +property lines : Collection:=[] +property lineIndex : Integer:=0 + +property isCommentBlock : Boolean:=False:C215 + property _controlFlow : Object +property _ouput : Collection:=[] + +property decimalSeparator : Text + +property windowRef : Integer + +// MARK: Delegate property rgx : cs:C1710.regex:=cs:C1710.regex.new() Class constructor() - var $t : Text - var $ƒ : 4D:C1709.Function - ARRAY LONGINT:C221($len; 0) ARRAY LONGINT:C221($pos; 0) // Identify the name & the type of the current method If (Match regex:C1019("(?m-si)^([^:]*\\s*:\\s)([[:ascii:]]*)(\\.[[:ascii:]]*)?(?:\\s*\\*)?$"; This:C1470.title; 1; $pos; $len)) - $ƒ:=Formula from string:C1601(Parse formula:C1576("Get localized string:C1578($1)")) - $t:=Substring:C12(This:C1470.title; $pos{1}; $len{1}) + var $ƒ : 4D:C1709.Function:=Formula from string:C1601(Parse formula:C1576("Get localized string:C1578($1)")) + var $t : Text:=Substring:C12(This:C1470.title; $pos{1}; $len{1}) This:C1470.projectMethod:=($t=$ƒ.call(Null:C1517; "common_method")) This:C1470.objectMethod:=($t=$ƒ.call(Null:C1517; "common_objectMethod")) This:C1470.class:=(Position:C15("Class:"; $t)=1) @@ -51,7 +59,7 @@ Class constructor() If (This:C1470.form) - // #TO_DO 🚧 + // TODO: 🚧 Else @@ -72,14 +80,53 @@ Class constructor() // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== Function get macroCall() : Boolean - var $name : Text - var $state; $time : Integer + return Process info:C1843(Current process:C322).name="Macro_Call" - PROCESS PROPERTIES:C336(Current process:C322; $name; $state; $time) - return $name="Macro_Call" + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setMethodText($text : Text) + + SET MACRO PARAMETER:C998(Full method text:K5:17; $text) // === === === === === === === === === === === === === === === === === === === === === === === === === === -Function split($useSelection : Boolean) +Function setHighlightedText($text : Text) + + SET MACRO PARAMETER:C998(Highlighted method text:K5:18; $text) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function paste($text : Text; $useSelection : Boolean) + + var $i : Integer + + If (Count parameters:C259>=2) + + SET MACRO PARAMETER:C998($useSelection ? Highlighted method text:K5:18 : Full method text:K5:17; $text) + + Else + + SET MACRO PARAMETER:C998(This:C1470.withSelection ? Highlighted method text:K5:18 : Full method text:K5:17; $text) + + End if + + If (Structure file:C489=Structure file:C489(*)) + + return + + End if + + // Force tokenisation + For ($i; 1; Count tasks:C335; 1) + + If (Process info:C1843($i).type=Design process:K36:9) + + POST EVENT:C467(Key down event:K17:4; Enter:K15:35; Tickcount:C458; 0; 0; 0; $i) + + break + + End if + End for + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function split($useSelection : Boolean; $options : Integer) var $target : Text @@ -89,28 +136,174 @@ Function split($useSelection : Boolean) Else - $target:=This:C1470.withSelection ? This:C1470.highlighted : This:C1470.method + $target:=This:C1470.highlighted || This:C1470.method End if - This:C1470.lineTexts:=Split string:C1554($target; "\r"; sk trim spaces:K86:2) + $options:=Count parameters:C259>=2 ? $options : sk trim spaces:K86:2 + + This:C1470.lines:=Split string:C1554($target; "\r"; $options) + //MARK:- // === === === === === === === === === === === === === === === === === === === === === === === === === === -Function setMethodText($text : Text) +Function localizedControlFlow($control : Text) : Text - SET MACRO PARAMETER:C998(Full method text:K5:17; $text) + This:C1470._controlFlow:=This:C1470._controlFlow || JSON Parse:C1218(File:C1566("/RESOURCES/controlFlow.json").getText()) + return Command name:C538(41)="ALERT" ? $control : This:C1470._controlFlow.fr(This:C1470._controlFlow.intl.indexOf($control)) // === === === === === === === === === === === === === === === === === === === === === === === === === === -Function setHighlightedText($text : Text) +Function noSelection() : Boolean - SET MACRO PARAMETER:C998(Highlighted method text:K5:18; $text) + If (Not:C34(This:C1470.withSelection)) + + BEEP:C151 + ALERT:C41("This macro requires text to be selected before it is called!") + return True:C214 + + End if // === === === === === === === === === === === === === === === === === === === === === === === === === === -Function localizedControlFlow($control : Text) : Text +Function isEmpty( ... : Text) : Boolean - This:C1470._controlFlow:=This:C1470._controlFlow || JSON Parse:C1218(File:C1566("/RESOURCES/controlFlow.json").getText()) - return Command name:C538(41)="ALERT" ? $control : This:C1470._controlFlow.fr(This:C1470._controlFlow.intl.indexOf($control)) + return Length:C16(Copy parameters:C1790.join(""))=0 + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isNotEmpty( ... : Text) : Boolean + + return Length:C16(Copy parameters:C1790.join(""))>0 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isMultiline($line) : Boolean + + return Match regex:C1019("(?mi-s).*?\\\\$"; $line; 1; *) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isNotMultiline($line) : Boolean + + return Not:C34(This:C1470.isMultiline($line)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isComment($line : Text) : Boolean + + return (Length:C16($line)>0)\ + && ((Position:C15(kCommentMark; $line)=1) || (Position:C15("/*"; $line)=1) || (Position:C15("*/"; $line)=1)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isNotComment($line : Text) : Boolean + + return Not:C34(This:C1470.isComment($line)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isReservedComment($line : Text) : Boolean + + return ($line=(kCommentMark+"}"))\ + || ($line=(kCommentMark+"]"))\ + || ($line=(kCommentMark+")"))\ + || (Match regex:C1019("(?m-si)^//%[A-Z][-+]$"; $line; 1; *))\ + || (Match regex:C1019("(?mi-s)^/\\*.*\\*/$"; $line; 1; *)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isNotReservedComment($line : Text) : Boolean + + return Not:C34(This:C1470.isReservedComment($line)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isMarkerComment($line : Text) : Boolean + + If (This:C1470.isComment($line)) + + return Match regex:C1019("(?mi-s)^//\\s*(?:mark|todo|fixme):"; $line; 1; *) + + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isNotMarkerComment($line : Text) : Boolean + + return Not:C34(This:C1470.isMarkerComment($line)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isSeparatorLineComment($line : Text) : Boolean + + If (This:C1470.isComment($line)) + + return Match regex:C1019("(?mi-s)^//\\s*(?:mark|todo|fixme):-"; $line; 1; *)\ + || Match regex:C1019("(?mi-s)^//\\s*(.)(?:\\1|\\s){10,}"; $line; 1; *) + + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isNotSeparatorLineComment($line : Text) : Boolean + + return Not:C34(This:C1470.isSeparatorLineComment($line)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isOpeningReservedComment($line : Text) : Boolean + + return ($line=(kCommentMark+"}"))\ + || ($line=(kCommentMark+"]"))\ + || ($line=(kCommentMark+")"))\ + || (Match regex:C1019("(?m-si)^//%[A-Z]-$"; $line; 1; *)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isNotOpeningReservedComment($line : Text) : Boolean + + return Not:C34(This:C1470.isOpeningReservedComment($line)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isClosingReservedComment($line : Text) : Boolean + + return ($line=(kCommentMark+"}"))\ + || ($line=(kCommentMark+"]"))\ + || ($line=(kCommentMark+")"))\ + || (Match regex:C1019("(?m-si)^//%[A-Z]\\+$"; $line; 1; *)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isNotClosingReservedComment($line : Text) : Boolean + + return Not:C34(This:C1470.isClosingReservedComment($line)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Search for an unused character for a temporary replacement, for example 😉 +Function unusedCharacter($code : Text) : Text + + var $i : Integer + var $c : Collection:=[126; 167; 182; 248; 8225; 8226; 8734; 8776; 63743] + + Repeat + + var $t : Text:=Char:C90($c[$i]) + + If (Position:C15($t; $code)=0) + + return $t + + End if + + $i+=1 + + Until (False:C215) + +Function isNumeric($in : Text) : Boolean + + return Match regex:C1019("(?mi-s)^(?:\\+|-)?\\d*?(?:(?:\\.|,)\\d*?)??"; $in; 1; *) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isDECLARE($in : Text) : Boolean + + return Position:C15("#DECLARE"; $in)=1 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isConstructor($in : Text) : Boolean + + return Match regex:C1019("(?m-si)^(singleton\\s|shared\\s)??(singleton\\s|shared\\s)??Class constructor"; $in; 1; *) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isFunction($in : Text) : Boolean + + return Match regex:C1019("(?m-si)^(local\\s|shared\\s)??(local\\s|shared\\s)??Function(.*?)\\((.*?)\\)"; $in; 1; *) + + + //MARK:-[MACROS] // === === === === === === === === === === === === === === === === === === === === === === === === === === Function PasteColor() @@ -133,10 +326,10 @@ Function Declarations() // === === === === === === === === === === === === === === === === === === === === === === === === === === Function Beautifier() - cs:C1710.beautifier.new().beautify() + cs:C1710.beautifier.new() // === === === === === === === === === === === === === === === === === === === === === === === === === === - //#v11 Paste after transformations + //Paste after transformations Function SpecialPaste() cs:C1710.specialPaste.new() @@ -145,15 +338,13 @@ Function SpecialPaste() // Paste the contents of the clipboard and copy the selection Function PasteAndKeepTarget() - var $t : Text - - If (This:C1470._noSelection()) + If (This:C1470.noSelection()) return End if - $t:=Get text from pasteboard:C524 // Get the text content of the clipboard + var $t : Text:=Get text from pasteboard:C524 // Get the text content of the clipboard If (Length:C16($t)=0) @@ -176,63 +367,59 @@ Function Choose() var $affect; $index : Integer var $c : Collection - If (This:C1470.withSelection) + If (This:C1470.noSelection()) - $c:=Split string:C1554(This:C1470.highlighted; "\r"; sk trim spaces:K86:2+sk ignore empty strings:K86:1) + return + + End if + + $c:=Split string:C1554(This:C1470.highlighted; "\r"; sk trim spaces:K86:2+sk ignore empty strings:K86:1) + + If ($c.length=5) - If ($c.length=5) + ARRAY LONGINT:C221($pos; 0x0000) + ARRAY LONGINT:C221($len; 0x0000) + + If (Match regex:C1019(Choose:C955(Command name:C538(1)="Sum"; "If"; "Si")+"\\s*\\(([^\\)]*)\\).*"; $c[0]; 1; $pos; $len)) - ARRAY LONGINT:C221($pos; 0x0000) - ARRAY LONGINT:C221($len; 0x0000) + $index:=Position:C15(":="; $c[1]) - If (Match regex:C1019(Choose:C955(Command name:C538(1)="Sum"; "If"; "Si")+"\\s*\\(([^\\)]*)\\).*"; $c[0]; 1; $pos; $len)) + If ($index>0) - $index:=Position:C15(":="; $c[1]) + $affect:=Position:C15(":="; $c[3]) - If ($index>0) + If ($affect>0) + + $t:=Substring:C12($c[1]; 1; $index-1)\ + +":="\ + +Command name:C538(955)\ + +"("\ + +Substring:C12($c[0]; $pos{1}; $len{1})\ + +";"\ + +Substring:C12($c[1]; $index+2)\ + +";"\ + +Substring:C12($c[3]; $affect+2)\ + +")" - $affect:=Position:C15(":="; $c[3]) + This:C1470.setHighlightedText($t) - If ($affect>0) - - $t:=Substring:C12($c[1]; 1; $index-1)\ - +":="\ - +Command name:C538(955)\ - +"("\ - +Substring:C12($c[0]; $pos{1}; $len{1})\ - +";"\ - +Substring:C12($c[1]; $index+2)\ - +";"\ - +Substring:C12($c[3]; $affect+2)\ - +")" - - This:C1470.setHighlightedText($t) - - End if End if End if End if - - Else - - BEEP:C151 - End if // === === === === === === === === === === === === === === === === === === === === === === === === === === /// Copy the selected text Function CopyWithTokens() - var $line : Text - var $c : Collection - - If (This:C1470._noSelection()) + If (This:C1470.noSelection()) return End if - $c:=New collection:C1472 + var $line : Text + var $c : Collection:=[] For each ($line; Split string:C1554(This:C1470.highlighted; "\r")) @@ -246,16 +433,15 @@ Function CopyWithTokens() /// Replaces a method name in quotation marks with a tokenized call Function ConvertToCallWithToken() - If (This:C1470._noSelection()) + If (This:C1470.noSelection()) return End if - If (This:C1470.highlighted="\"@")\ - && (This:C1470.highlighted="@\"") + If (Match regex:C1019("(?mi-s)^\"[^\"]*\""; This:C1470.highlighted; 1; *)) - SET MACRO PARAMETER:C998(Highlighted method text:K5:18; "Formula:C1597("+Replace string:C233(This:C1470.highlighted; "\""; "")+").source") + This:C1470.paste("Formula:C1597("+Replace string:C233(This:C1470.highlighted; "\""; "")+").source") POST KEY:C465(3) Else @@ -264,6 +450,44 @@ Function ConvertToCallWithToken() End if + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function convert_hexa() + + If (This:C1470.noSelection()) + + return + + End if + + If (This:C1470.isNumeric(This:C1470.highlighted)) + + This:C1470.paste(String:C10(Num:C11(This:C1470.highlighted); "&x")+kCaret) + + Else + + BEEP:C151 + + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function convert_decimal() + + If (This:C1470.noSelection()) + + return + + End if + + If (This:C1470.highlighted="0x@") + + This:C1470.paste(String:C10(str_gLon_Hex_To_Long(This:C1470.highlighted))+kCaret) + + Else + + BEEP:C151 + + End if + // === === === === === === === === === === === === === === === === === === === === === === === === === === Function zipForShare() @@ -352,49 +576,16 @@ Function RemoveBlankLines() var $line; $out : Text - For each ($line; Split string:C1554(Length:C16(This:C1470.highlighted)=0 ? This:C1470.method : This:C1470.highlighted; "\r"; sk ignore empty strings:K86:1)) + For each ($line; Split string:C1554(This:C1470.highlighted || This:C1470.method; "\r"; sk ignore empty strings:K86:1)) If ($line#"// ") - $out:=$out+$line+"\r" + $out+=$line+"\r" End if End for each - If (Length:C16(This:C1470.highlighted)=0) - - This:C1470.setMethodText($out) - - Else - - This:C1470.setHighlightedText($out) - - End if - - //MARK:-[COMMENTS] - // === === === === === === === === === === === === === === === === === === === === === === === === === === -Function commentBlock - - This:C1470.setHighlightedText("/*\r"+This:C1470.highlighted+"\r*/") - - // === === === === === === === === === === === === === === === === === === === === === === === === === === -Function duplicateAndComment() - - If (This:C1470._noSelection()) - - return - - End if - - If (Split string:C1554(This:C1470.highlighted; "\r").length=1) - - This:C1470.setHighlightedText(This:C1470._comment()+"\r"+This:C1470.highlighted+kCaret)*/ - - Else - - This:C1470.setHighlightedText(This:C1470._comment()+This:C1470.highlighted+kCaret)*/ - - End if + This:C1470.paste($out) // === === === === === === === === === === === === === === === === === === === === === === === === === === Function comment() @@ -402,7 +593,7 @@ Function comment() ARRAY LONGINT:C221($len; 0) ARRAY LONGINT:C221($pos; 0) - If (This:C1470._noSelection()) + If (This:C1470.noSelection()) return @@ -427,7 +618,37 @@ Function comment() This:C1470.setHighlightedText(This:C1470._comment()) - // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function commentBlock + + This:C1470.paste("/*\r"+This:C1470.highlighted+"\r*/") + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Comments the first and the last line of a logic block +Function comment_current_level() + + COMMENTS("bloc") + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function duplicateAndComment() + + If (This:C1470.noSelection()) + + return + + End if + + If (Split string:C1554(This:C1470.highlighted; "\r").length=1) + + This:C1470.setHighlightedText(This:C1470._comment()+"\r"+This:C1470.highlighted+kCaret)*/ + + Else + + This:C1470.setHighlightedText(This:C1470._comment()+This:C1470.highlighted+kCaret)*/ + + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === Function _comment() : Text var $c : Collection @@ -466,54 +687,27 @@ Function _comment() : Text End if - // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** -Function _noSelection() : Boolean - - If (Not:C34(This:C1470.withSelection)) - - BEEP:C151 - ALERT:C41("This macro requires text to be selected before it is called!") - return True:C214 - - End if - - // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** -Function _paste($text : Text; $useSelection : Boolean) - - var $target : Integer + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function dialog($form : Text; $title : Text; $type : Integer) : Boolean - If (Count parameters:C259>=2) - - $target:=$useSelection ? Highlighted method text:K5:18 : Full method text:K5:17 - - Else - - $target:=This:C1470.withSelection ? Highlighted method text:K5:18 : Full method text:K5:17 - - End if + var $i : Integer - SET MACRO PARAMETER:C998($target; $text) + ARRAY LONGINT:C221($_winRefs; 0) - If (Structure file:C489=Structure file:C489(*)) - - return - - End if + $type:=Count parameters:C259>=3 ? $type : Movable form dialog box:K39:8 - // Force tokenisation - var $name : Text - var $i; $mode; $origin; $state; $time; $UID : Integer + WINDOW LIST:C442($_winRefs) - For ($i; 1; Count tasks:C335; 1) + For ($i; 1; Size of array:C274($_winRefs); 1) - PROCESS PROPERTIES:C336($i; $name; $state; $time; $mode; $UID; $origin) - - If ($origin=Design process:K36:9) - - POST EVENT:C467(Key down event:K17:4; Enter:K15:35; Tickcount:C458; 0; 0; 0; $i) + If (Get window title:C450($_winRefs{$i})=$title) - break + return End if End for + + This:C1470.windowRef:=Open form window:C675($form; $type; Horizontally centered:K39:1; Vertically centered:K39:4; *) + + return True:C214 \ No newline at end of file diff --git a/Project/Sources/Classes/menu.4dm b/Project/Sources/Classes/menu.4dm index 8586b16..aa22f9e 100755 --- a/Project/Sources/Classes/menu.4dm +++ b/Project/Sources/Classes/menu.4dm @@ -1,81 +1,127 @@ -Class constructor +property __CLASS__ : Object +property data; submenus : Collection +property choice; ref : Text +property autoRelease; released; localize; metacharacters; selected : Boolean +property _iconAccessor : 4D:C1709.Function + +Class constructor($data) - C_VARIANT:C1683($1) - C_COLLECTION:C1488($c) + var $c : Collection + + This:C1470.__CLASS__:=OB Class:C1730(This:C1470) - This:C1470.ref:=Null:C1517 + This:C1470.ref:="" This:C1470.autoRelease:=True:C214 + This:C1470.released:=False:C215 + This:C1470.localize:=True:C214 This:C1470.metacharacters:=False:C215 This:C1470.selected:=False:C215 This:C1470.choice:="" - This:C1470.submenus:=New collection:C1472 - This:C1470.data:=New collection:C1472 + This:C1470.submenus:=[] + This:C1470.data:=[] If (Count parameters:C259>=1) Case of //______________________________________________________ - : (Value type:C1509($1)=Is text:K8:3) + : (Value type:C1509($data)=Is text:K8:3) Case of //______________________________________________________ - : ($1="menuBar") // Load the current menu bar + : ($data="menuBar") // Load the current menu bar This:C1470.ref:=Get menu bar reference:C979 //______________________________________________________ - : (Match regex:C1019("(?m-si)\\|MR\\|\\d{12}"; $1; 1)) // Menu reference + : (Match regex:C1019("(?m-si)\\|MR\\|\\d{12}"; $data; 1)) // Menu reference - This:C1470.ref:=$1 + This:C1470.ref:=$data //______________________________________________________ Else This:C1470.ref:=Create menu:C408 - $c:=Split string:C1554(String:C10($1); ";") + $c:=Split string:C1554(String:C10($data); ";") Case of //----------------- : ($c.length>1) - This:C1470.autoRelease:=($c.indexOf("keepReference")=-1) - This:C1470.metacharacters:=($c.indexOf("displayMetacharacters")#-1) + This:C1470.autoRelease:=($c.indexOf("keep-reference")=-1) + This:C1470.metacharacters:=($c.includes("display-metacharacters")) + This:C1470.localize:=($c.indexOf("no-localization")=-1) + + //----------------- + : ($data="no-localization") + + This:C1470.localize:=False:C215 //----------------- - : ($1="keepReference") + : ($data="keep-reference") This:C1470.autoRelease:=False:C215 //----------------- - : ($1="displayMetacharacters") + : ($data="display-metacharacters") This:C1470.metacharacters:=True:C214 //----------------- - Else // Menu bar name + Else // Menu bar name - This:C1470.ref:=Create menu:C408($1) + This:C1470.ref:=Try(Create menu:C408($data)) //----------------- End case //______________________________________________________ End case + + //______________________________________________________ + : (Value type:C1509($data)=Is real:K8:4)\ + | (Value type:C1509($data)=Is longint:K8:6) // Menu bar number + + This:C1470.ref:=Create menu:C408($data) + //______________________________________________________ - : (Value type:C1509($1)=Is real:K8:4)\ - | (Value type:C1509($1)=Is longint:K8:6) // Menu bar number + : (Value type:C1509($data)=Is collection:K8:32) // Create from collection - This:C1470.ref:=Create menu:C408($1) + This:C1470.ref:=Create menu:C408 + This:C1470.append($data) //______________________________________________________ - : (Value type:C1509($1)=Is collection:K8:32) // Create from collection + : (Value type:C1509($data)=Is object:K8:27) + + If ($data.localize#Null:C1517) + + This:C1470.localize:=$data.localize + + End if + + If ($data.autoRelease#Null:C1517) + + This:C1470.autoRelease:=$data.autoRelease + + End if + + If ($data.metacharacters#Null:C1517) + + This:C1470.metacharacters:=$data.metacharacters + + End if + + If ($data.iconAccessor#Null:C1517)\ + && (OB Instance of:C1731($data.iconAccessor; 4D:C1709.Function)) + + This:C1470._iconAccessor:=$data.iconAccessor + + End if This:C1470.ref:=Create menu:C408 - This:C1470.append($1) //______________________________________________________ Else @@ -91,23 +137,28 @@ Class constructor End if - // =============================================== - // Removes the menu from memory -Function release() + // MARK:-[DEFINITION] + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Adds/insert an item + // If afterItem < 0, it is considered as the offset from the item count of the menu +Function append($item; $param; $mark; $afterItem : Integer) : cs:C1710.menu - If (This:C1470._isMenu()) + var $t : Text + var $o : Object + + If (Value type:C1509($mark)=Is longint:K8:6)\ + | (Value type:C1509($mark)=Is real:K8:4) - RELEASE MENU:C978(This:C1470.ref) - This:C1470.ref:=Null:C1517 + $afterItem:=$mark + $mark:=False:C215 + + Else + + $afterItem:=Count parameters:C259>=4 ? $afterItem : MAXLONG:K35:2 End if - // =============================================== - // Adds a new item to the menu -Function append($item : Variant; $param : Variant; $mark : Boolean)->$this : cs:C1710.menu - - var $t : Text - var $o : Object + $afterItem:=$afterItem<0 ? This:C1470.itemCount()+$afterItem-1 : $afterItem Case of @@ -119,8 +170,8 @@ Function append($item : Variant; $param : Variant; $mark : Boolean)->$this : cs: //______________________________________________________ : (Value type:C1509($item)=Is text:K8:3) - Case of + //______________________________________________________ : (Length:C16($item)=0) @@ -132,39 +183,63 @@ Function append($item : Variant; $param : Variant; $mark : Boolean)->$this : cs: // 👍 let 4D do the work //______________________________________________________ - //%W-533.1 - : ($item[[1]]=Char:C90(1)) - //%W+533.1 + : (Position:C15(Char:C90(1); $item)=1) - // 🤬 4D does not like at all + // 😱 The "Get localized string" command does not like it at all. //______________________________________________________ - Else + : (Not:C34(This:C1470.localize)) // Don't try to localize + + If ($item#"-@")\ + && ($item#"(-@") + + // Replace the hyphen by the unicode 2013 (better UI) + $item:=Replace string:C233($item; "-"; "–") + + End if - $t:=Get localized string:C991($item) - $t:=Choose:C955(Length:C16($t)>0; $t; $item) // Revert if no localization + //______________________________________________________ + Else - //ASSERT(Length($t)>0; "⚠️ An empty item will not be displayed") + $t:=Formula from string:C1601("Get localized string:C991($1)"; sk execute in host database:K88:5).call(Null:C1517; $item) //______________________________________________________ End case - $t:=Choose:C955(Length:C16($t)>0; $t; $item) + $t:=$t || $item - If (Count parameters:C259>=2) + If ($param#Null:C1517) If (Value type:C1509($param)=Is object:K8:27) // Submenu If (Asserted:C1132(OB Instance of:C1731($param; cs:C1710.menu))) + // FIXME:Remove empty submenu in the cleanup phase + // If ($param.itemCount()>0) // Don't do it if there are no items in the sub-menu + If (This:C1470.metacharacters) - APPEND MENU ITEM:C411(This:C1470.ref; $t; $param.ref) + If ($afterItem#MAXLONG:K35:2) + + INSERT MENU ITEM:C412(This:C1470.ref; $afterItem; $t; $param.ref) + + Else + + APPEND MENU ITEM:C411(This:C1470.ref; $t; $param.ref) + + End if Else - APPEND MENU ITEM:C411(This:C1470.ref; $t; $param.ref; *) - + If ($afterItem#MAXLONG:K35:2) + + INSERT MENU ITEM:C412(This:C1470.ref; $afterItem; $t; $param.ref; *) + + Else + + APPEND MENU ITEM:C411(This:C1470.ref; $t; $param.ref; *) + + End if End if // Keep the sub-menu structure @@ -177,23 +252,42 @@ Function append($item : Variant; $param : Variant; $mark : Boolean)->$this : cs: End for each + // End if + If ($param.autoRelease) RELEASE MENU:C978($param.ref) + $param.released:=True:C214 End if + End if Else If (This:C1470.metacharacters) - APPEND MENU ITEM:C411(This:C1470.ref; $t) + If ($afterItem#MAXLONG:K35:2) + + INSERT MENU ITEM:C412(This:C1470.ref; $afterItem; $t) + + Else + + APPEND MENU ITEM:C411(This:C1470.ref; $t) + + End if Else - APPEND MENU ITEM:C411(This:C1470.ref; $t; *) - + If ($afterItem#MAXLONG:K35:2) + + INSERT MENU ITEM:C412(This:C1470.ref; $afterItem; $t; *) + + Else + + APPEND MENU ITEM:C411(This:C1470.ref; $t; *) + + End if End if If (Count parameters:C259>1) @@ -205,8 +299,15 @@ Function append($item : Variant; $param : Variant; $mark : Boolean)->$this : cs: SET MENU ITEM MARK:C208(This:C1470.ref; -1; Char:C90(18)*Num:C11($mark)) End if + + Else + + // Set the parameter to the same value as the text of the element + SET MENU ITEM PARAMETER:C1004(This:C1470.ref; -1; $t) + End if End if + Else If (This:C1470.metacharacters) @@ -264,7 +365,7 @@ Function append($item : Variant; $param : Variant; $mark : Boolean)->$this : cs: If ($o.shortcut#Null:C1517) - This:C1470.shortcut($o.shortcut) + This:C1470.shortcut($o.shortcut; Num:C11($o.modifier)) End if End for each @@ -277,43 +378,34 @@ Function append($item : Variant; $param : Variant; $mark : Boolean)->$this : cs: //______________________________________________________ End case - $this:=This:C1470 + return This:C1470 - // =============================================== + // === === === === === === === === === === === === === === === === === === === === === === === === === === Function add($ref : Text; $text : Text; $param : Variant; $mark : Boolean) + // TODO: wip - But I don't remember what the purpose was :-( + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Adds/insert a line + // If afterItem < 0, it is considered as the offset from the item count of the menu +Function line($afterItem : Integer) : cs:C1710.menu - - - // =============================================== - // Adds a line to the menu -Function line()->$this : cs:C1710.menu - - APPEND MENU ITEM:C411(This:C1470.ref; "-(") - - $this:=This:C1470 - - // =============================================== - // Defines the project method associated with a menu item -Function method($method : Text; $index : Integer)->$this : cs:C1710.menu - - If (Count parameters:C259>1) + If (Count parameters:C259>=1) - SET MENU ITEM METHOD:C982(This:C1470.ref; $index; $method) + $afterItem:=$afterItem<0 ? This:C1470.itemCount()+$afterItem-1 : $afterItem + INSERT MENU ITEM:C412(This:C1470.ref; $afterItem; "-(") Else - // Last added item - SET MENU ITEM METHOD:C982(This:C1470.ref; -1; $method) + APPEND MENU ITEM:C411(This:C1470.ref; "-(") End if - $this:=This:C1470 + return This:C1470 - // =============================================== + // === === === === === === === === === === === === === === === === === === === === === === === === === === // Delete an item or the last added item -Function delete($index : Integer)->$this : cs:C1710.menu +Function delete($index : Integer) : cs:C1710.menu If (Count parameters:C259=0) @@ -325,69 +417,83 @@ Function delete($index : Integer)->$this : cs:C1710.menu End if - $this:=This:C1470 + return This:C1470 - // =============================================== - // Defines the activated status of a menu item -Function enable($enabled : Boolean; $index : Integer)->$this : cs:C1710.menu + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Removes the menu from memory +Function release() + + If (This:C1470._isMenu()) + + RELEASE MENU:C978(This:C1470.ref) + This:C1470.released:=True:C214 + + End if + + // MARK:-[PROPERTIES] + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Modifies the icon associated with a menu item +Function icon($proxy : Text; $index : Integer) : cs:C1710.menu + + $index:=Count parameters:C259>=2 ? $index : -1 + + If (This:C1470._iconAccessor#Null:C1517) + + This:C1470._iconAccessor.call(Null:C1517; This:C1470.ref; $index; This:C1470._proxy($proxy)) + + Else + + Formula from string:C1601("SET MENU ITEM ICON:C984($1; $2; $3)"; sk execute in host database:K88:5).call(Null:C1517; This:C1470.ref; $index; This:C1470._proxy($proxy)) + + End if + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Sets the check mark of a menu item +Function mark($checked : Boolean; $index : Integer) : cs:C1710.menu Case of //______________________________________________________ : (Count parameters:C259=0) - ENABLE MENU ITEM:C149(This:C1470.ref; -1) + SET MENU ITEM MARK:C208(This:C1470.ref; -1; Char:C90(18)) //______________________________________________________ : (Count parameters:C259=1) - If ($enabled) - - ENABLE MENU ITEM:C149(This:C1470.ref; -1) - - Else - - DISABLE MENU ITEM:C150(This:C1470.ref; -1) - - End if + SET MENU ITEM MARK:C208(This:C1470.ref; -1; Char:C90(18)*Num:C11($checked)) //______________________________________________________ Else - If ($enabled) - - ENABLE MENU ITEM:C149(This:C1470.ref; $index) - - Else - - DISABLE MENU ITEM:C150(This:C1470.ref; $index) - - End if + SET MENU ITEM MARK:C208(This:C1470.ref; $index; Char:C90(18)*Num:C11($checked)) //______________________________________________________ End case - $this:=This:C1470 + return This:C1470 - // =============================================== - // Disable a menu item -Function disable($index : Integer)->$this : cs:C1710.menu + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Associates a custom parameter to a menu item +Function parameter($param : Text; $index : Integer) : cs:C1710.menu If (Count parameters:C259=0) - DISABLE MENU ITEM:C150(This:C1470.ref; -1) + SET MENU ITEM PARAMETER:C1004(This:C1470.ref; -1; $param) Else - DISABLE MENU ITEM:C150(This:C1470.ref; $index) + SET MENU ITEM PARAMETER:C1004(This:C1470.ref; $index; $param) End if - $this:=This:C1470 + return This:C1470 - // =============================================== + // === === === === === === === === === === === === === === === === === === === === === === === === === === // Associate a standard action with a menu item -Function action($action : Variant; $index : Integer)->$this : cs:C1710.menu +Function action($action : Variant; $index : Integer) : cs:C1710.menu If (Count parameters:C259=1) @@ -399,31 +505,65 @@ Function action($action : Variant; $index : Integer)->$this : cs:C1710.menu End if - $this:=This:C1470 + return This:C1470 - // =============================================== - // Associates a custom parameter to a menu item -Function parameter($param : Text; $index : Integer)->$this : cs:C1710.menu + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Defines the project method associated with a menu item +Function method($method : Text; $index : Integer) : cs:C1710.menu - If (Count parameters:C259=0) + If (Count parameters:C259>1) - SET MENU ITEM PARAMETER:C1004(This:C1470.ref; -1; $param) + SET MENU ITEM METHOD:C982(This:C1470.ref; $index; $method) Else - SET MENU ITEM PARAMETER:C1004(This:C1470.ref; $index; $param) + // Last added item + SET MENU ITEM METHOD:C982(This:C1470.ref; -1; $method) + + End if + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Replaces the shortcut key associated with the menu item +Function shortcut($key; $modifier : Integer; $index : Integer) : cs:C1710.menu + + $index:=($index=0) ? -1 : $index + + If (Count parameters:C259>=2) + + If (Value type:C1509($key)=Is object:K8:27) + + SET MENU ITEM SHORTCUT:C423(This:C1470.ref; $index; String:C10($key.key); Num:C11($key.modifier)) + + Else + + SET MENU ITEM SHORTCUT:C423(This:C1470.ref; $index; String:C10($key); $modifier) + + End if + Else + + If (Value type:C1509($key)=Is object:K8:27) + + SET MENU ITEM SHORTCUT:C423(This:C1470.ref; -1; String:C10($key.key); Num:C11($key.modifier)) + + Else + + SET MENU ITEM SHORTCUT:C423(This:C1470.ref; -1; String:C10($key); 0) + + End if End if - $this:=This:C1470 + return This:C1470 - // =============================================== + // === === === === === === === === === === === === === === === === === === === === === === === === === === // Associates a property to a menu item /* ⚠️ ONE CAN SET A PROPERTY FOR ALL MENU TYPE (MENU BAR OR POPUP) BUT UNIQUELY RETRIEVE IT FOR THE MENU BAR ITEMS */ -Function property($property : Text; $value : Variant; $index : Integer)->$this : cs:C1710.menu +Function property($property : Text; $value : Variant; $index : Integer) : cs:C1710.menu If (Count parameters:C259>=3) @@ -435,49 +575,99 @@ Function property($property : Text; $value : Variant; $index : Integer)->$this : End if - $this:=This:C1470 + return This:C1470 - // =============================================== - // Returns a property of a menu item -Function getProperty($property : Text; $index : Integer)->$value + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Changes the font style of the menu item +Function setStyle($tyle : Integer; $index : Integer) : cs:C1710.menu - GET MENU ITEM PROPERTY:C972(This:C1470.ref; $index; $property; $value) + $index:=Count parameters:C259>=2 ? $index : -1 + SET MENU ITEM STYLE:C425(This:C1470.ref; $index; $tyle) - // =============================================== - // Associates data to a menu item -Function setData($name : Text; $value : Variant; $index : Integer)->$this : cs:C1710.menu + return This:C1470 - var $ref : Text - var $o : Object + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function indent($index : Integer; $number : Integer) : cs:C1710.menu + + $number:=$number>0 ? $number : 1 + $index:=Count parameters:C259>=1 ? $index : -1 + + // Special tag for indent on windows + SET MENU ITEM PROPERTY:C973(This:C1470.ref; $index; "_4D_PictureForIndent"; $number) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Defines the activated status of a menu item +Function enable($enabled : Boolean; $index : Integer) : cs:C1710.menu Case of - //_____________________________ - : (Count parameters:C259=3) + //______________________________________________________ + : (Count parameters:C259=0) // Enable last added - $ref:=Get menu item parameter:C1003(This:C1470.ref; $index) + ENABLE MENU ITEM:C149(This:C1470.ref; -1) - //_____________________________ - : (Count parameters:C259=2) + //______________________________________________________ + : (Count parameters:C259=1) // Enable/disable Last added - $ref:=Get menu item parameter:C1003(This:C1470.ref; -1) + If ($enabled) + + ENABLE MENU ITEM:C149(This:C1470.ref; -1) + + Else + + DISABLE MENU ITEM:C150(This:C1470.ref; -1) + + End if - //_____________________________ - Else + //______________________________________________________ + Else // Enable/disable item - ASSERT:C1129(False:C215; "Missing parameter") + If ($enabled) + + ENABLE MENU ITEM:C149(This:C1470.ref; $index) + + Else + + DISABLE MENU ITEM:C150(This:C1470.ref; $index) + + End if - //_____________________________ + //______________________________________________________ End case - $o:=This:C1470.data.query("ref = :1 & name = :2"; $ref; $name).pop() + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Disable a menu item +Function disable($index : Integer) : cs:C1710.menu + + $index:=Count parameters:C259>=1 ? $index : -1 + DISABLE MENU ITEM:C150(This:C1470.ref; $index) + + return This:C1470 + + // MARK:-[DATA] + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Associates data to a menu item +Function setData($name : Text; $value : Variant; $index : Integer) : cs:C1710.menu + + var $ref : Text + var $o : Object + + $index:=Count parameters:C259>=3 ? $index : -1 + $ref:=Get menu item parameter:C1003(This:C1470.ref; $index) + + $o:=This:C1470.data.query("ref = :1 & name = :2"; $ref; $name).first() If ($o=Null:C1517) - This:C1470.data.push(New object:C1471(\ - "ref"; $ref; \ - "name"; $name; \ - "value"; $value)) + This:C1470.data.push({\ + ref: $ref; \ + name: $name; \ + value: $value\ + }) Else @@ -486,165 +676,203 @@ Function setData($name : Text; $value : Variant; $index : Integer)->$this : cs:C End if - $this:=This:C1470 + return This:C1470 - // =============================================== + // === === === === === === === === === === === === === === === === === === === === === === === === === === // Retrieve data associated to selected menu item -Function getData($name : Text)->$value +Function getData($name : Text; $ref : Text) : Variant var $o : Object - If (Asserted:C1132(This:C1470.selected)) + $o:=Count parameters:C259>=2\ + ? This:C1470.data.query("name = :1 & ref = :2"; $name; $ref).first()\ + : This:C1470.data.query("name = :1"; $name).first() + + If ($o#Null:C1517) - $o:=This:C1470.data.query("name = :1"; $name).pop() + return $o.value - If ($o#Null:C1517) - - $value:=$o.value - - End if End if - // =============================================== - // Sets the check mark of a menu item -Function mark($checked : Boolean; $index : Integer)->$this : cs:C1710.menu + // MARK:-[INFORMATIONS] + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Returns the number of menu items present in the menu +Function itemCount() : Integer + + return Count menu items:C405(This:C1470.ref) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Returns a menu item from its title or index +Function item($item; $ref : Text) : Object + + var $menuItem : Object + var $indx : Integer + var $value + + $ref:=Count parameters:C259>=2 ? $ref : This:C1470.ref + + ARRAY TEXT:C222($titles; 0x0000) + ARRAY TEXT:C222($references; 0x0000) + GET MENU ITEMS:C977($ref; $titles; $references) Case of //______________________________________________________ - : (Count parameters:C259=0) + : (Value type:C1509($item)=Is text:K8:3) // -> withTitle - SET MENU ITEM MARK:C208(This:C1470.ref; -1; Char:C90(18)) + $indx:=Find in array:C230($titles; $item) //______________________________________________________ - : (Count parameters:C259=1) + : (Value type:C1509($item)=Is longint:K8:6)\ + | (Value type:C1509($item)=Is real:K8:4) // -> at - SET MENU ITEM MARK:C208(This:C1470.ref; -1; Char:C90(18)*Num:C11($checked)) + $indx:=$item //______________________________________________________ Else - SET MENU ITEM MARK:C208(This:C1470.ref; $index; Char:C90(18)*Num:C11($checked)) + ASSERT:C1129(False:C215; Current method name:C684+": invalid type") //______________________________________________________ End case - $this:=This:C1470 - - // =============================================== - // Replaces the shortcut key associated with the menu item -Function shortcut($key : Variant; $index : Integer)->$this : cs:C1710.menu - - If (Count parameters:C259>=2) + If (Asserted:C1132($indx>0; "Item \""+String:C10($item)+"\" not found")) - If (Value type:C1509($key)=Is object:K8:27) - - SET MENU ITEM SHORTCUT:C423(This:C1470.ref; $index; String:C10($key.key); Num:C11($key.modifier)) - - Else - - SET MENU ITEM SHORTCUT:C423(This:C1470.ref; $index; String:C10($key); 0) - - End if + $menuItem:=New object:C1471(\ + "title"; Get menu item:C422(This:C1470.ref; $indx); \ + "key"; Get menu item key:C424(This:C1470.ref; $indx); \ + "mark"; Get menu item mark:C428(This:C1470.ref; $indx); \ + "method"; Get menu item method:C981(This:C1470.ref; $indx); \ + "modifiers"; Get menu item modifiers:C980(This:C1470.ref; $indx); \ + "parameter"; Get menu item parameter:C1003(This:C1470.ref; $indx); \ + "style"; Get menu item style:C426(This:C1470.ref; $indx); \ + "withSubMenu"; Length:C16($references{$indx})>0; \ + "subMenuReference"; $references{$indx}; \ + "isSeparator"; This:C1470.isSeparatorItem($indx)\ + ) - Else + $menuItem.data:=This:C1470.data.query("ref = :1"; $menuItem.parameter) + + GET MENU ITEM PROPERTY:C972(This:C1470.ref; $indx; Associated standard action:K56:1; $value) + $menuItem.standardAction:=$value + + GET MENU ITEM PROPERTY:C972(This:C1470.ref; $indx; Access privileges:K56:3; $value) + $menuItem.accessPrivileges:=$value - If (Value type:C1509($key)=Is object:K8:27) - - SET MENU ITEM SHORTCUT:C423(This:C1470.ref; -1; String:C10($key.key); Num:C11($key.modifier)) - - Else - - SET MENU ITEM SHORTCUT:C423(This:C1470.ref; -1; String:C10($key); 0) - - End if End if - $this:=This:C1470 + return $menuItem - // =============================================== - // Modifies the icon associated with a menu item -Function icon($icon : Text; $index : Integer)->$this : cs:C1710.menu + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Returns a collection of the first level menu items +Function items() : Collection + + var $i : Integer + var $items : Collection + + $items:=[] + + For ($i; 1; This:C1470.itemCount(); 1) + + $items.push(This:C1470.item($i)) + + End for + + return $items + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isSeparatorItem($item : Integer; $ref : Text) : Boolean + + var $value - var $path : Text + $ref:=Count parameters:C259>=2 ? $ref : This:C1470.ref Case of - //______________________________________________________ - : ($icon="path:@") - $path:=$icon + //________________________________________ + : (Get menu item:C422($ref; $item)="(-@") - //______________________________________________________ - : ($icon="/RESOURCES/@") + return True:C214 - $path:="path:"+$icon + //________________________________________ + : (Get menu item:C422($ref; $item)="-@") - //______________________________________________________ + return True:C214 + + //________________________________________ Else - $path:="path:/RESOURCES/"+$icon + GET MENU ITEM PROPERTY:C972($ref; $item; "4D_separator"; $value) - //______________________________________________________ + return $value#0 + + //________________________________________ End case - If (Count parameters:C259>1) - - SET MENU ITEM ICON:C984(This:C1470.ref; $index; $path) - - Else - - SET MENU ITEM ICON:C984(This:C1470.ref; -1; $path) - - End if + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function itemSubMenuRef($withTitle : Text) : Text - $this:=This:C1470 + var $indx : Integer - // =============================================== - // Changes the font style of the menu item -Function setStyle($tyle : Integer; $index : Integer)->$this : cs:C1710.menu + ARRAY TEXT:C222($titles; 0x0000) + ARRAY TEXT:C222($references; 0x0000) + GET MENU ITEMS:C977(This:C1470.ref; $titles; $references) - If (Count parameters:C259>1) - - SET MENU ITEM STYLE:C425(This:C1470.ref; $index; $tyle) - - Else + $indx:=Find in array:C230($titles; $withTitle) + + If ($indx#-1) - SET MENU ITEM STYLE:C425(This:C1470.ref; -1; $tyle) + return $references{$indx} End if - $this:=This:C1470 - - // =============================================== - // Replaces the current menu bar with the current menu -Function setBar() + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Returns a property of a menu item +Function getProperty($property : Text; $index : Integer) : Variant - This:C1470._cleanup() + var $value : Text - SET MENU BAR:C67(This:C1470.ref) + GET MENU ITEM PROPERTY:C972(This:C1470.ref; $index; $property; $value) - If (This:C1470.autoRelease) - - This:C1470.release() - - End if + Case of + + //______________________________________________________ + : (Match regex:C1019("(?m-is)^(?:[tT]rue|[fF]alse)$"; $value; 1; *)) + + return $value="true" + + : (Match regex:C1019("(?m-si)^(?:\\+|-)?\\d*\\.*\\d+$"; $value; 1; *)) + + return Num:C11($value) + + //______________________________________________________ + Else + + return $value + + //______________________________________________________ + End case - // =============================================== + // MARK:-[TOOLS] + // === === === === === === === === === === === === === === === === === === === === === === === === === === // Display the current menu as a pop-up menu -Function popup($where : Variant; $x : Variant; $y : Integer)->$this : cs:C1710.menu +Function popup($where : Variant; $x : Variant; $y : Integer) : cs:C1710.menu This:C1470._cleanup() Case of //______________________________________________________ - : (Count parameters:C259=0) // At the current location of the mouse + : (Count parameters:C259=0)\ + || ($where=Null:C1517) // At the current location of the mouse This:C1470.choice:=Dynamic pop up menu:C1006(This:C1470.ref) //______________________________________________________ : (Value type:C1509($where)=Is object:K8:27) // Widget reference {; default} + Try($where.updateCoordinates()) + If (Count parameters:C259>1) This:C1470.choice:=Dynamic pop up menu:C1006(This:C1470.ref; String:C10($x); Num:C11($where.windowCoordinates.left); Num:C11($where.windowCoordinates.bottom)) @@ -686,7 +914,7 @@ Function popup($where : Variant; $x : Variant; $y : Integer)->$this : cs:C1710.m If (This:C1470.selected) // Get associated data if any - This:C1470.data:=This:C1470.data.query("ref=:1"; This:C1470.choice) + //This.data:=This.data.query("ref=:1"; This.choice) End if @@ -696,41 +924,14 @@ Function popup($where : Variant; $x : Variant; $y : Integer)->$this : cs:C1710.m End if - $this:=This:C1470 - - // =============================================== - // Returns the number of menu items present in the menu -Function itemCount()->$number : Integer - - $number:=Count menu items:C405(This:C1470.ref) - - // =============================================== -Function menuSelected()->$selected : Object - - var $menuSelected : Integer - var $menuRef : Text - - $menuSelected:=Menu selected:C152($menuRef) - - $selected:=New object:C1471(\ - "ref"; $menuRef; \ - "menu"; $menuSelected\65536; \ - "item"; $menuSelected%65536) - - // =============================================== - // Default File menu -Function file()->$this : cs:C1710.menu - - This:C1470.append(":xliff:CommonMenuItemQuit").action(ak quit:K76:61).shortcut("Q") - - $this:=This:C1470 + return This:C1470 - // =============================================== + // === === === === === === === === === === === === === === === === === === === === === === === === === === // Standard Edit menu -Function edit()->$this : cs:C1710.menu +Function edit() : cs:C1710.menu This:C1470.append(":xliff:CommonMenuItemUndo").action(ak undo:K76:51).shortcut("Z") - This:C1470.append(":xliff:CommonMenuRedo").action(ak redo:K76:52).shortcut("Z"; 512) + This:C1470.append(":xliff:CommonMenuRedo").action(ak redo:K76:52).shortcut("Z"; Shift key mask:K16:3) This:C1470.line() This:C1470.append(":xliff:CommonMenuItemCut").action(ak cut:K76:53).shortcut("X") This:C1470.append(":xliff:CommonMenuItemCopy").action(ak copy:K76:54).shortcut("C") @@ -740,26 +941,36 @@ Function edit()->$this : cs:C1710.menu This:C1470.line() This:C1470.append(":xliff:CommonMenuItemShowClipboard").action(ak show clipboard:K76:58) - $this:=This:C1470 + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Default File menu +Function file() : cs:C1710.menu + + This:C1470.append(":xliff:CommonClose").shortcut("W").action(ak cancel:K76:36) + This:C1470.line() + This:C1470.append(":xliff:CommonMenuItemQuit").action(ak quit:K76:61).shortcut("Q") - // =============================================== + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === // Fonts menu with or without styles -Function fonts($withStyle : Boolean)->$this : cs:C1710.menu +Function fonts($withStyle; $callback : Text) : cs:C1710.menu var $menuStyles : Text - var $styled : Boolean var $i; $j : Integer - If (Count parameters:C259>0) + If (Value type:C1509($withStyle)=Is text:K8:3) - $styled:=$withStyle + $callback:=$withStyle + $withStyle:=False:C215 End if ARRAY TEXT:C222($fontsFamilly; 0x0000) FONT LIST:C460($fontsFamilly) - If ($styled) + If ($withStyle) For ($i; 1; Size of array:C274($fontsFamilly); 1) @@ -778,6 +989,7 @@ Function fonts($withStyle : Boolean)->$this : cs:C1710.menu APPEND MENU ITEM:C411($menuStyles; $styles{$j}) // Localized name SET MENU ITEM PARAMETER:C1004($menuStyles; -1; $names{$j}) // System name + SET MENU ITEM METHOD:C982($menuStyles; -1; $callback) End for @@ -788,6 +1000,7 @@ Function fonts($withStyle : Boolean)->$this : cs:C1710.menu APPEND MENU ITEM:C411(This:C1470.ref; $fontsFamilly{$i}) SET MENU ITEM PARAMETER:C1004(This:C1470.ref; -1; $names{1}) + SET MENU ITEM METHOD:C982(This:C1470.ref; -1; $callback) End if @@ -807,11 +1020,11 @@ Function fonts($withStyle : Boolean)->$this : cs:C1710.menu End for End if - $this:=This:C1470 + return This:C1470 - // =============================================== + // === === === === === === === === === === === === === === === === === === === === === === === === === === // Windows menu -Function windows()->$this : cs:C1710.menu +Function windows($callback : Text) : cs:C1710.menu var $name : Text var $current; $frontmostWindow; $i : Integer @@ -821,20 +1034,22 @@ Function windows()->$this : cs:C1710.menu ARRAY LONGINT:C221($windows; 0x0000) WINDOW LIST:C442($windows) - $c:=New collection:C1472 + $c:=[] For ($i; 1; Size of array:C274($windows); 1) - $c.push(New object:C1471(\ - "ref"; $windows{$i}; \ - "name"; Get window title:C450($windows{$i}); \ - "process"; Window process:C446($windows{$i}))) + $c.push({\ + ref: $windows{$i}; \ + name: Get window title:C450($windows{$i}); \ + process: Window process:C446($windows{$i})\ + }) End for - $c:=$c.orderBy(New collection:C1472(\ - New object:C1471("propertyPath"; "process"; "descending"; True:C214); \ - New object:C1471("propertyPath"; "name"))) + $c:=$c.orderBy([\ + {propertyPath: "process"; descending: True:C214}; \ + {propertyPath: "name"}\ + ]) If ($c.length>0) @@ -856,144 +1071,19 @@ Function windows()->$this : cs:C1710.menu This:C1470.append($o.name; $o.ref; $frontmostWindow=$o.ref) - End for each - End if - - $this:=This:C1470 - - // =============================================== - // Create a default minimal menu bar -Function defaultMinimalMenuBar()->$this : cs:C1710.menu - - This:C1470.append(":xliff:CommonMenuFile"; cs:C1710.menu.new().file()) - This:C1470.append(":xliff:CommonMenuEdit"; cs:C1710.menu.new().edit()) - - $this:=This:C1470 - - // =============================================== - // Returns a menu item from its title or index -Function item($item; $ref : Text)->$menuItem : Object - - var $indx : Integer - var $value - - ARRAY TEXT:C222($titles; 0) - ARRAY TEXT:C222($references; 0) - - If (Count parameters:C259>=2) - - GET MENU ITEMS:C977($ref; $titles; $references) - - Else - - GET MENU ITEMS:C977(This:C1470.ref; $titles; $references) - - End if - - Case of - - //______________________________________________________ - : (Value type:C1509($item)=Is text:K8:3) // -> withTitle - - $indx:=Find in array:C230($titles; $item) - - //______________________________________________________ - : (Value type:C1509($item)=Is longint:K8:6)\ - | (Value type:C1509($item)=Is real:K8:4) // -> at - - $indx:=$item - - //______________________________________________________ - Else - - ASSERT:C1129(False:C215; Current method name:C684+": invalid type") + If ($callback#"") + + This:C1470.method($callback) + + End if - //______________________________________________________ - End case - - If (Asserted:C1132($indx>0; "Item \""+String:C10($item)+"\" not found")) - - $menuItem:=New object:C1471(\ - "title"; Get menu item:C422(This:C1470.ref; $indx); \ - "key"; Get menu item key:C424(This:C1470.ref; $indx); \ - "mark"; Get menu item mark:C428(This:C1470.ref; $indx); \ - "method"; Get menu item method:C981(This:C1470.ref; $indx); \ - "modifiers"; Get menu item modifiers:C980(This:C1470.ref; $indx); \ - "parameter"; Get menu item parameter:C1003(This:C1470.ref; $indx); \ - "style"; Get menu item style:C426(This:C1470.ref; $indx); \ - "withSubMenu"; Length:C16($references{$indx})>0; \ - "subMenuReference"; $references{$indx}; \ - "isSeparator"; This:C1470.isSeparatorItem($indx)\ - ) - - $menuItem.data:=This:C1470.data.query("ref = :1"; $menuItem.parameter) - - GET MENU ITEM PROPERTY:C972(This:C1470.ref; $indx; Associated standard action:K56:1; $value) - $menuItem.standardAction:=$value - - GET MENU ITEM PROPERTY:C972(This:C1470.ref; $indx; Access privileges:K56:3; $value) - $menuItem.accessPrivileges:=$value - - End if - - // =============================================== - // Returns a collection of the first level menu items -Function items()->$items : Collection - - var $i : Integer - - $items:=New collection:C1472 - - For ($i; 1; This:C1470.itemCount(); 1) - - $items.push(This:C1470.item($i)) - - End for - - // =============================================== -Function itemSubMenuRef($withTitle : Text)->$reference : Text - - var $indx : Integer - - ARRAY TEXT:C222($titles; 0x0000) - ARRAY TEXT:C222($references; 0x0000) - GET MENU ITEMS:C977(This:C1470.ref; $titles; $references) - - $indx:=Find in array:C230($titles; $withTitle) - - If ($indx#-1) - - $reference:=$references{$indx} - + End for each End if - // =============================================== -Function isSeparatorItem($item : Integer)->$isSeparator : Boolean + return This:C1470 - var $value - - Case of - - //________________________________________ - : (Get menu item:C422(This:C1470.ref; $item)="(-@") - - $isSeparator:=True:C214 - - //________________________________________ - : (Get menu item:C422(This:C1470.ref; $item)="-@") - - $isSeparator:=True:C214 - - //________________________________________ - Else - - GET MENU ITEM PROPERTY:C972(This:C1470.ref; $item; "4D_separator"; $value) - $isSeparator:=($value#0) - - //________________________________________ - End case - - // =============================================== + // MARK:- + // === === === === === === === === === === === === === === === === === === === === === === === === === === // Remove duplicates (lines or items) Function _cleanup() @@ -1055,11 +1145,53 @@ Function _cleanup() End if End for - // =============================================== -Function _isMenu()->$isMenu : Boolean + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function _isMenu() : Boolean - If (Asserted:C1132(This:C1470.ref#Null:C1517; Current method name:C684+": The menu reference is null")) + If (Asserted:C1132(Length:C16(This:C1470.ref)>0; Current method name:C684+": The menu reference is null")) - $isMenu:=True:C214 + return True:C214 - End if \ No newline at end of file + End if + + // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +Function _proxy($proxy : Text) : Text + + Case of + + //______________________________________________________ + : (Position:C15("path:"; $proxy)=1)\ + || (Position:C15("file:"; $proxy)=1)\ + || (Position:C15("var:"; $proxy)=1)\ + || (Position:C15("!"; $proxy)=1) + + return $proxy + + //______________________________________________________ + : (Position:C15("#"; $proxy)=1) // Shortcut for Resources folder + + return "path:/RESOURCES/"+Delete string:C232($proxy; 1; 1) + + //______________________________________________________ + : (Position:C15("§"; $proxy)=1) // Shortcut for current form folder + + return "path:/FORM/"+Delete string:C232($proxy; 1; 1) + + //______________________________________________________ + : ($proxy="|@") + + return "path:/.PRODUCT_RESOURCES/"+Delete string:C232($proxy; 1; 1) + + //______________________________________________________ + : (Position:C15("/"; $proxy)=1) + + return "path:"+$proxy + + //______________________________________________________ + Else + + return "path:/RESOURCES/"+$proxy + + //______________________________________________________ + End case + \ No newline at end of file diff --git a/Project/Sources/Classes/menuBar.4dm b/Project/Sources/Classes/menuBar.4dm new file mode 100644 index 0000000..ed6aeb5 --- /dev/null +++ b/Project/Sources/Classes/menuBar.4dm @@ -0,0 +1,257 @@ +property _menus : Collection + +Class extends menu + +Class constructor($menus : Collection) + + Super:C1705() + + // A collection of menu items that allows to extract one based on the value of its parameter + This:C1470._menus:=[] + + This:C1470.populate($menus) + + // MARK:-[DEFINITION] + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Create a menu bar from a collection of menus +Function populate($menus : Collection) : cs:C1710.menuBar + + var $parameter : Text + var $i; $itemIndex; $j; $menuIndex : Integer + + // TODO:Accept object instead of collection ? + + For ($i; 0; $menus.length-1; 2) + + Case of + + //______________________________________________________ + : (Value type:C1509($menus[$i+1])=Is collection:K8:32) + + This:C1470.setHelpMenu($menus[$i+1]) + + //______________________________________________________ + : (Value type:C1509($menus[$i+1])=Is object:K8:27)\ + && (OB Instance of:C1731($menus[$i+1]; cs:C1710.menu)) + + $menuIndex+=1 + $itemIndex:=0 + + This:C1470.append($menus[$i]; $menus[$i+1]) + + For ($j; 1; $menus[$i+1].itemCount(); 1) + + $itemIndex+=1 + $parameter:=Get menu item parameter:C1003($menus[$i+1].ref; $j) + + If (Length:C16($parameter)>0) + + This:C1470._menus.push({\ + ref: $parameter; \ + menu: $menuIndex; \ + item: $itemIndex}) + + End if + End for + + //______________________________________________________ + Else + + ASSERT:C1129(False:C215; "Neither a cs.menu nor a Help menu definition") + + //______________________________________________________ + End case + End for + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Replaces the current menu bar with the current one +Function set() : cs:C1710.menuBar + + This:C1470._cleanup() + + SET MENU BAR:C67(This:C1470.ref) + + If (This:C1470.autoRelease) + + This:C1470.release() + + End if + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Set the item +Function setAbout($label : Text; $method : Text) + + SET ABOUT:C316($label; $method) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Resets the About 4D menu +Function resetsAbout() + + var $language : Text + $language:=Get database localization:C1009(Default localization:K5:21; *) + + Case of + + //______________________________________________________ + : ($language="cs@") + + SET ABOUT:C316("Co je 4D..."; "") + + //______________________________________________________ + : ($language="de@") + + SET ABOUT:C316("Über 4D..."; "") + + //______________________________________________________ + : ($language="es@") + + SET ABOUT:C316("Acerca de 4D..."; "") + + //______________________________________________________ + : ($language="fr@") + + SET ABOUT:C316("A propos de 4D..."; "") + + //______________________________________________________ + : ($language="ja@") + + SET ABOUT:C316("4Dについて..."; "") + + //______________________________________________________ + : ($language="pt@") + + SET ABOUT:C316("Sobre 4D..."; "") + + //______________________________________________________ + Else + + SET ABOUT:C316("About 4D..."; "") + + //______________________________________________________ + End case + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Set the Help menu of the application mode +Function setHelpMenu($items : Collection) + + SET HELP MENU:C1801($items) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Replace a menu with a new one +Function update($index : Integer; $menu : cs:C1710.menu) : cs:C1710.menuBar + + var $parameter; $title : Text + var $i; $item : Integer + + ASSERT:C1129($index<=This:C1470.submenus.length; "Unavailabale menu index") + + // Retain menu title + $title:=Get menu item:C422(String:C10(This:C1470.ref); $index) + + // Delete the menu + DELETE MENU ITEM:C413(This:C1470.ref; $index) + + If ($index=(This:C1470.itemCount()+1)) + + This:C1470.append($title; $menu) + + Else + + This:C1470.append($title; $menu; $index-1) + + End if + + // Update the collection item references + This:C1470._menus:=This:C1470._menus.query("menu != :1 "; $index) + + For ($i; 1; $menu.itemCount(); 1) + + $item+=1 + $parameter:=Get menu item parameter:C1003($menu.ref; $i) + + If (Length:C16($parameter)>0) + + This:C1470._menus.push({\ + ref: $parameter; \ + menu: $index; \ + item: $item}) + + End if + End for + + return This:C1470 + + // MARK:-[PROPERTIES] + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function enableItem($item : Text; $enabled : Boolean) + + var $o : Object + + $o:=This:C1470._menus.query("ref = :1"; $item).pop() + + If (Asserted:C1132($o#Null:C1517; "Item \""+$item+"\" not found")) + + $enabled:=Count parameters:C259>=2 ? $enabled : True:C214 + + If ($enabled) + + ENABLE MENU ITEM:C149($o.menu; $o.item) + + Else + + DISABLE MENU ITEM:C150($o.menu; $o.item) + + End if + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function disableItem($item : Text) + + var $o : Object + + $o:=This:C1470._menus.query("ref = :1"; $item).pop() + + If (Asserted:C1132($o#Null:C1517; "Item \""+$item+"\" not found")) + + DISABLE MENU ITEM:C150($o.menu; $o.item) + + End if + + // MARK:-[INFORMATIONS] + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function menuSelected() : Object + + var $menuSelected : Integer + var $menuRef : Text + + $menuSelected:=Menu selected:C152($menuRef) + + return {\ + ref: $menuRef; \ + menu: $menuSelected\65536; \ + item: $menuSelected%65536\ + } + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getMenuItemParameter($type : Integer) : Variant + + var $o : Object + $o:=This:C1470.menuSelected() + + return $type=Is longint:K8:6\ + ? Num:C11(This:C1470._menus.query("menu = :1 & item = :2"; $o.menu; $o.item).pop().ref)\ + : This:C1470._menus.query("menu = :1 & item = :2"; $o.menu; $o.item).pop().ref + + // MARK:-[TOOLS] + // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Create a default minimal menu bar +Function defaultMinimalMenuBar() : cs:C1710.menuBar + + This:C1470.append(":xliff:CommonMenuFile"; cs:C1710.menu.new().file()) + This:C1470.append(":xliff:CommonMenuEdit"; cs:C1710.menu.new().edit()) + + return This:C1470 \ No newline at end of file diff --git a/Project/Sources/Classes/preferences.4dm b/Project/Sources/Classes/preferences.4dm index 7804948..fef3c1a 100644 --- a/Project/Sources/Classes/preferences.4dm +++ b/Project/Sources/Classes/preferences.4dm @@ -1,3 +1,5 @@ +property file:=4D:C1709.File + Class constructor This:C1470.file:=This:C1470.loadPreferences() @@ -31,7 +33,7 @@ Function loadPreferences()->$settingFile : 4D:C1709.File If ($src.exists) // Check that it is a setting file (a bug copied the macro file here) - If (xml_fileToObject($src.platformPath).value.M_4DPop#Null:C1517) + If (_o_xml_fileToObject($src.platformPath).value.M_4DPop#Null:C1517) // Get it $src.copyTo($4DPopFolder; "4DPop Preferences.xml") @@ -82,7 +84,7 @@ Function loadPreferences()->$settingFile : 4D:C1709.File Storage:C1525.macros.preferences.platformPath:=$settingFile.platformPath - $o:=xml_fileToObject($settingFile.platformPath) + $o:=_o_xml_fileToObject($settingFile.platformPath) If ($o.success) @@ -138,7 +140,7 @@ Function loadPreferences()->$settingFile : 4D:C1709.File Else - ALERT:C41(Get localized string:C991("File not found.")+" : \""+$settingFile.path+"\"") + ALERT:C41(Localized string:C991("File not found.")+" : \""+$settingFile.path+"\"") End if End use diff --git a/Project/Sources/Classes/regex.4dm b/Project/Sources/Classes/regex.4dm index 2f0f87e..6208d95 100644 --- a/Project/Sources/Classes/regex.4dm +++ b/Project/Sources/Classes/regex.4dm @@ -1,10 +1,12 @@ +property _target : Text:="" +property _pattern : Text:="" +property time : Integer:=0 +property success : Boolean:=True:C214 +property matches : Collection +property errors : Collection + Class constructor($target; $pattern : Text) - This:C1470._target:="" - This:C1470._pattern:="" - This:C1470.time:=0 - This:C1470.success:=True:C214 - This:C1470.matches:=Null:C1517 This:C1470.errors:=[] If (Count parameters:C259>=1) @@ -18,62 +20,172 @@ Class constructor($target; $pattern : Text) End if End if - // === === === === === === === === === === === === === === === === === === === === === === === === === === + // MARK:- + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== Function get target() : Text return This:C1470._target - // === === === === === === === === === === === === === === === === === === === === === === === === === === + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> Function set target($target) This:C1470._setTarget($target) // === === === === === === === === === === === === === === === === === === === === === === === === === === + // Sets the string where will be perform the search. + // Could be a text or a disk file +Function setTarget($target) : cs:C1710.regex + + This:C1470._setTarget($target) + + return This:C1470 + + // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +Function _setTarget($target) + + Case of + + //………………………………………………………………………………………… + : (Value type:C1509($target)=Is text:K8:3) + + This:C1470._target:=$target + + //………………………………………………………………………………………… + : (Value type:C1509($target)=Is object:K8:27) + + If (OB Class:C1730($target).name="File") + + If ($target.exists) + + This:C1470._target:=$target.getText() + + Else + + // File not found. + This:C1470._pushError(Current method name:C684; -43; "File not found.") + + End if + + Else + + // Argument types are incompatible. + This:C1470._pushError(Current method name:C684; 54; "The \"target\" object is not a 4D.File.") + + End if + + //………………………………………………………………………………………… + : (Value type:C1509($target)=Is BLOB:K8:12) + + This:C1470._target:=Convert to text:C1012($target; "UTF-8") + This:C1470.success:=Bool:C1537(OK) + + //………………………………………………………………………………………… + Else + + // Argument types are incompatible. + This:C1470._pushError(Current method name:C684; 54; "The \"target\" argument must be Text, a Blob or 4D.File.") + + //………………………………………………………………………………………… + End case + + // MARK:- + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== Function get pattern() : Text return This:C1470._pattern - // === === === === === === === === === === === === === === === === === === === === === === === === === === + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> Function set pattern($pattern : Text) This:C1470._pattern:=$pattern - // === === === === === === === === === === === === === === === === === === === === === === === === === === + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== Function get lastError() : Object - If (This:C1470.errors.length>0) + If (This:C1470.errors#Null:C1517)\ + && (This:C1470.errors.length>0) return This:C1470.errors[This:C1470.errors.length-1] End if // === === === === === === === === === === === === === === === === === === === === === === === === === === - // Sets the string where will be perform the search. - // Could be a text or a disk file -Function setTarget($target) : cs:C1710.regex + // Sets the regular expression to use. +Function setPattern($pattern : Text) : cs:C1710.regex - This:C1470._setTarget($target) + This:C1470._pattern:=$pattern return This:C1470 // === === === === === === === === === === === === === === === === === === === === === === === === === === - // Sets the regular expression to use. -Function setPattern($pattern : Text) : cs:C1710.regex +Function loadPattern($id : Text; $file : 4D:C1709.File) - This:C1470._pattern:=$pattern + If ($file=Null:C1517) + + $file:=Folder:C1567(fk resources folder:K87:11).file("regex.xml") + + End if - return This:C1470 + If (Not:C34($file.exists)) + + ALERT:C41("File not found: \""+$file.platformPath+"\"") + + return + + End if + var $name; $pattern : Text + + Try + + var $root : Text:=DOM Parse XML source:C719($file.platformPath; False:C215) + var $node : Text:=DOM Get first child XML element:C723(DOM Find XML element:C864($root; "/REGEX/patterns/")) + + Repeat + + DOM GET XML ATTRIBUTE BY NAME:C728($node; "name"; $name) + + If ($id=$name) + + DOM GET XML ELEMENT VALUE:C731($node; $pattern; $pattern) + + // If (Count parameters>=3) + // DOM GET XML ATTRIBUTE BY NAME($node; "groupsToExtract"; $3->) + // End if + + // Deleting Spaces & Comments + This:C1470._pattern:=cs:C1710.regex.new($pattern; "\\s*\\(\\?#[^)]*\\)|\\s").substitute("") + + break + + Else + + $node:=DOM Get next sibling XML element:C724($node) + + End if + Until (OK=0) + + DOM CLOSE XML:C722($root) + + Catch + + ALERT:C41(Last errors:C1799[0].message) + + Try(DOM CLOSE XML:C722($root)) + + return + + End try + + // MARK:- // === === === === === === === === === === === === === === === === === === === === === === === === === === Function match($start; $all : Boolean) : Boolean - var $methodCalledOnError : Text var $match : Boolean var $begin; $i; $index : Integer - var $item : Object - ARRAY LONGINT:C221($positions; 0) - ARRAY LONGINT:C221($lengths; 0) + ARRAY LONGINT:C221($pos; 0) + ARRAY LONGINT:C221($len; 0) $begin:=Milliseconds:C459 @@ -98,42 +210,39 @@ Function match($start; $all : Boolean) : Boolean This:C1470._init() - $methodCalledOnError:=This:C1470._errorCatch() - Repeat - ERROR:=0 + $match:=Try(Match regex:C1019(This:C1470._pattern; This:C1470._target; $start; $pos; $len)) - $match:=Match regex:C1019(This:C1470._pattern; This:C1470._target; $start; $positions; $lengths) - - If (ERROR=0) + If (Last errors:C1799.length=0) If ($match) This:C1470.success:=True:C214 - For ($i; 0; Size of array:C274($positions); 1) + For ($i; 0; Size of array:C274($pos); 1) - This:C1470.matches.push(New object:C1471(\ - "index"; $index; \ - "data"; Substring:C12(This:C1470._target; $positions{$i}; $lengths{$i}); \ - "position"; $positions{$i}; \ - "length"; $lengths{$i})) + This:C1470.matches.push({\ + index: $index; \ + data: Substring:C12(This:C1470._target; $pos{$i}; $len{$i}); \ + position: $pos{$i}; \ + length: $len{$i}\ + }) - If ($lengths{$i}=0) + If ($len{$i}=0) $match:=($i>0) If ($match) - $match:=($positions{$i}#$positions{$i-1}) + $match:=($pos{$i}#$pos{$i-1}) End if End if - If ($positions{$i}>0) + If ($pos{$i}>0) - $start:=$positions{$i}+$lengths{$i} + $start:=$pos{$i}+$len{$i} End if End for @@ -146,45 +255,25 @@ Function match($start; $all : Boolean) : Boolean Else - This:C1470._pushError(Current method name:C684; ERROR; "Error while parsing pattern \""+This:C1470._pattern+"\"") + This:C1470._pushError(Current method name:C684; Last errors:C1799[0].errCode; "Error while parsing pattern \""+This:C1470._pattern+"\"") + return End if Until (Not:C34($match)) - This:C1470._errorCatch($methodCalledOnError) - This:C1470.time:=Milliseconds:C459-$begin return This:C1470.success - // === === === === === === === === === === === === === === === === === === === === === === === === === === - // Count the words in a string -Function countWords($target : Text) : Integer - - This:C1470.target:=$target || This:C1470.target - This:C1470.pattern:="(?mi-s)((?:[^[:punct:]\\$\\s[:cntrl:]'‘’]+[’'][^[:punct:]\\$\\s[:cntrl:]'‘’]+)|[^[:punct:]\\s[:cntrl:]'‘’\\$]+)" - - return This:C1470.extract().length - - // === === === === === === === === === === === === === === === === === === === === === === === === === === - // Validate an email address -Function validateMail($target : Text) : Boolean - - This:C1470.target:=$target || This:C1470.target - This:C1470.pattern:="^([-a-zA-Z0-9_]+(?:\\.[-a-zA-Z0-9_]+)*)(?:@)([-a-zA-Z0-9\\._]+(?:\\.[a-zA-Z0-9]{2,}"+")+)$" - - return This:C1470.match() - // === === === === === === === === === === === === === === === === === === === === === === === === === === Function extract($groups) : Collection - var $methodCalledOnError : Text var $match : Boolean var $begin; $current; $groupIndex; $i; $index; $indx; $start : Integer var $v - ARRAY LONGINT:C221($lengths; 0) - ARRAY LONGINT:C221($positions; 0) + ARRAY LONGINT:C221($len; 0) + ARRAY LONGINT:C221($pos; 0) $begin:=Milliseconds:C459 @@ -197,13 +286,13 @@ Function extract($groups) : Collection //___________________________________ : ($groups=Null:C1517) - $groups:=New collection:C1472 + $groups:=[] //___________________________________ : (Value type:C1509($groups)=Is longint:K8:6)\ | (Value type:C1509($groups)=Is real:K8:4) - $groups:=New collection:C1472(String:C10($groups)) + $groups:=[String:C10($groups)] //___________________________________ : (Value type:C1509($groups)=Is text:K8:3) @@ -231,15 +320,11 @@ Function extract($groups) : Collection //___________________________________ End case - $methodCalledOnError:=This:C1470._errorCatch() - Repeat - ERROR:=0 + $match:=Try(Match regex:C1019(This:C1470._pattern; This:C1470._target; $start; $pos; $len)) - $match:=Match regex:C1019(This:C1470._pattern; This:C1470._target; $start; $positions; $lengths) - - If (ERROR=0) + If (Last errors:C1799.length=0) If ($match) @@ -247,7 +332,7 @@ Function extract($groups) : Collection $current:=0 - For ($i; 0; Size of array:C274($positions); 1) + For ($i; 0; Size of array:C274($pos); 1) $groupIndex:=$groups.length>0 ? $groups.indexOf(String:C10($current)) : $current @@ -256,13 +341,14 @@ Function extract($groups) : Collection If ($i>0)\ | ($index=0) - If (This:C1470.matches.query("data = :1 & pos = :2"; Substring:C12(This:C1470._target; $positions{$i}; $lengths{$i}); $positions{$i}).pop()=Null:C1517) + If (This:C1470.matches.query("data = :1 & pos = :2"; Substring:C12(This:C1470._target; $pos{$i}; $len{$i}); $pos{$i}).pop()=Null:C1517) - This:C1470.matches.push(New object:C1471(\ - "index"; $indx; \ - "data"; Substring:C12(This:C1470._target; $positions{$i}; $lengths{$i}); \ - "pos"; $positions{$i}; \ - "len"; $lengths{$i})) + This:C1470.matches.push({\ + index: $indx; \ + data: Substring:C12(This:C1470._target; $pos{$i}; $len{$i}); \ + pos: $pos{$i}; \ + len: $len{$i}\ + }) $indx+=1 @@ -270,9 +356,9 @@ Function extract($groups) : Collection End if End if - If ($positions{$i}>0) + If ($pos{$i}>0) - $start:=$positions{$i}+$lengths{$i} + $start:=$pos{$i}+$len{$i} End if @@ -283,7 +369,8 @@ Function extract($groups) : Collection Else - This:C1470._pushError(Current method name:C684; ERROR; "Error while parsing pattern \""+This:C1470._pattern+"\"") + This:C1470._pushError(Current method name:C684; Last errors:C1799[0].errCode; "Error while parsing pattern \""+This:C1470._pattern+"\"") + return End if @@ -291,8 +378,6 @@ Function extract($groups) : Collection Until (Not:C34($match)) - This:C1470._errorCatch($methodCalledOnError) - This:C1470.time:=Milliseconds:C459-$begin return This:C1470.matches.extract("data") @@ -300,13 +385,13 @@ Function extract($groups) : Collection // === === === === === === === === === === === === === === === === === === === === === === === === === === Function substitute($replacement : Text; $count : Integer; $position : Integer) : Text - var $backup; $methodCalledOnError; $replacedText; $subexpression : Text + var $backup; $replacedText; $subexpression : Text var $match : Boolean var $i; $sub; $index; $start : Integer var $o : Object - ARRAY LONGINT:C221($lengths; 0) - ARRAY LONGINT:C221($positions; 0) + ARRAY LONGINT:C221($len; 0) + ARRAY LONGINT:C221($pos; 0) // Todo:Manage count and position @@ -315,45 +400,44 @@ Function substitute($replacement : Text; $count : Integer; $position : Integer) This:C1470._init() - $methodCalledOnError:=This:C1470._errorCatch() - Repeat - $match:=Match regex:C1019(This:C1470._pattern; This:C1470._target; $start; $positions; $lengths) + $match:=Try(Match regex:C1019(This:C1470._pattern; This:C1470._target; $start; $pos; $len)) - If (ERROR=0) + If (Last errors:C1799.length=0) If ($match) $sub:=0 - For ($i; 0; Size of array:C274($positions); 1) + For ($i; 0; Size of array:C274($pos); 1) - If ($positions{$i}>0) + If ($pos{$i}>0) - $start:=$positions{$i}+$lengths{$i} + $start:=$pos{$i}+$len{$i} End if - If ($lengths{$i}=0) + If ($len{$i}=0) $match:=($i>0) If ($match) - $match:=($positions{$i}#$positions{$i-1}) + $match:=($pos{$i}#$pos{$i-1}) End if End if If ($match) - This:C1470.matches.push(New object:C1471(\ - "index"; $index; \ - "data"; Substring:C12(This:C1470._target; $positions{$i}; $lengths{$i}); \ - "pos"; $positions{$i}; \ - "len"; $lengths{$i}; \ - "_subpattern"; $sub)) + This:C1470.matches.push({\ + index: $index; \ + data: Substring:C12(This:C1470._target; $pos{$i}; $len{$i}); \ + pos: $pos{$i}; \ + len: $len{$i}; \ + _subpattern: $sub\ + }) $sub+=1 $index+=1 @@ -368,7 +452,7 @@ Function substitute($replacement : Text; $count : Integer; $position : Integer) Else - This:C1470._pushError(Current method name:C684; ERROR; "Error while parsing pattern \""+This:C1470._pattern+"\"") + This:C1470._pushError(Current method name:C684; Last errors:C1799[0].errCode; "Error while parsing pattern \""+This:C1470._pattern+"\"") return End if @@ -413,84 +497,41 @@ Function substitute($replacement : Text; $count : Integer; $position : Integer) End for each End if - This:C1470._errorCatch($methodCalledOnError) - return $replacedText + // MARK:- // === === === === === === === === === === === === === === === === === === === === === === === === === === -Function _init() + // Count the words in a string +Function countWords($target : Text) : Integer - This:C1470.success:=False:C215 - This:C1470.matches:=New collection:C1472 + This:C1470.target:=$target || This:C1470.target + This:C1470.pattern:="(?mi-s)((?:[^[:punct:]\\$\\s[:cntrl:]'‘’]+[’'][^[:punct:]\\$\\s[:cntrl:]'‘’]+)|[^[:punct:]\\s[:cntrl:]'‘’\\$]+)" + + return This:C1470.extract().length // === === === === === === === === === === === === === === === === === === === === === === === === === === -Function _errorCatch($onErrCallMethod : Text)->$currentOnErrCallMethod : Text + // Validate an email address +Function validateMail($target : Text) : Boolean - If (Count parameters:C259>=1) - - ON ERR CALL:C155($onErrCallMethod) - - Else - - $currentOnErrCallMethod:=Method called on error:C704 - ON ERR CALL:C155(Formula:C1597(NoError).source) - CLEAR VARIABLE:C89(ERROR) - - End if + This:C1470.target:=$target || This:C1470.target + This:C1470.pattern:="^([-a-zA-Z0-9_]+(?:\\.[-a-zA-Z0-9_]+)*)(?:@)([-a-zA-Z0-9\\._]+(?:\\.[a-zA-Z0-9]{2,}"+")+)$" - // === === === === === === === === === === === === === === === === === === === === === === === === === === -Function _pushError($method : Text; $code : Integer; $desc : Text) + return This:C1470.match() + + // MARK:- + // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +Function _init() This:C1470.success:=False:C215 - This:C1470.errors.push(New object:C1471(\ - "code"; $code; \ - "method"; $method; \ - "desc"; $desc)) + This:C1470.matches:=[] - // === === === === === === === === === === === === === === === === === === === === === === === === === === -Function _setTarget($target) + // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +Function _pushError($method : Text; $code : Integer; $desc : Text) - Case of - - //………………………………………………………………………………………… - : (Value type:C1509($target)=Is text:K8:3) - - This:C1470._target:=$target - - //………………………………………………………………………………………… - : (Value type:C1509($target)=Is object:K8:27) - - If (OB Class:C1730($target).name="File") - - If ($target.exists) - - This:C1470._target:=$target.getText() - - Else - - // File not found. - This:C1470._pushError(Current method name:C684; -43; "File not found.") - - End if - - Else - - // Argument types are incompatible. - This:C1470._pushError(Current method name:C684; 54; "The \"target\" object is not a 4D.File.") - - End if - - //………………………………………………………………………………………… - : (Value type:C1509($target)=Is BLOB:K8:12) - - This:C1470._target:=Convert to text:C1012($target; "UTF-8") - This:C1470.success:=Bool:C1537(OK) - - //………………………………………………………………………………………… - Else - - // Argument types are incompatible. - This:C1470._pushError(Current method name:C684; 54; "The \"target\" argument must be Text, a Blob or 4D.File.") - - //………………………………………………………………………………………… - End case \ No newline at end of file + This:C1470.success:=False:C215 + + This:C1470.errors.push({\ + code: $code; \ + method: $method; \ + desc: $desc\ + }) \ No newline at end of file diff --git a/Project/Sources/Classes/scrollable.4dm b/Project/Sources/Classes/scrollable.4dm index 4ff6753..d2f8442 100755 --- a/Project/Sources/Classes/scrollable.4dm +++ b/Project/Sources/Classes/scrollable.4dm @@ -1,80 +1,108 @@ - -/*═══════════════════*/ Class extends widget -/*═══════════════════*/ -Class constructor +property scroll +property scrollbars : Object + +// === === === === === === === === === === === === === === === === === === === === === === === === === === +Class constructor($name : Text) - C_TEXT:C284($1) - C_VARIANT:C1683($2) + Super:C1705($name) - If (Count parameters:C259>=2) - - Super:C1705($1;$2) - - Else - - Super:C1705($1) - - End if + ASSERT:C1129([\ + Object type subform:K79:40; \ + Object type listbox:K79:8; \ + Object type picture input:K79:5; \ + Object type hierarchical list:K79:7; \ + Object type text input:K79:4].includes(This:C1470.type)) - ASSERT:C1129(New collection:C1472(\ - Object type subform:K79:40;\ - Object type listbox:K79:8;\ - Object type picture input:K79:5;\ - Object type hierarchical list:K79:7).indexOf(This:C1470.type)#-1) + This:C1470.getScrollbars() -/*════════════════════════════════════════════*/ -Function getScrollPosition + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getScrollPosition() : Variant - C_OBJECT:C1216($0) - C_LONGINT:C283($lVertical;$lHorizontal) + var $h; $v : Integer - OBJECT GET SCROLL POSITION:C1114(*;This:C1470.name;$lVertical;$lHorizontal) + OBJECT GET SCROLL POSITION:C1114(*; This:C1470.name; $v; $h) If (This:C1470.type=Object type picture input:K79:5)\ - | (This:C1470.type=Object type listbox:K79:8) + | (This:C1470.type=Object type listbox:K79:8)\ + | (This:C1470.type=Object type subform:K79:40) - This:C1470.scroll:=New object:C1471(\ - "vertical";$lVertical;\ - "horizontal";$lHorizontal) + This:C1470.scroll:={\ + vertical: $v; \ + horizontal: $h} Else - This:C1470.scroll:=$lVertical + This:C1470.scroll:=$v End if - $0:=This:C1470.scroll + return This:C1470.scroll -/*════════════════════════════════════════════*/ -Function setScrollPosition + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setScrollPosition($vertical; $horizontal) : cs:C1710.scrollable - C_LONGINT:C283($1;$2;$lVertical;$lHorizontal) + var $h; $v : Integer - OBJECT GET SCROLL POSITION:C1114(*;This:C1470.name;$lVertical;$lHorizontal) + OBJECT GET SCROLL POSITION:C1114(*; This:C1470.name; $v; $h) - $lVertical:=$1 + $v:=Num:C11($vertical) If (Count parameters:C259>=2)\ & ((This:C1470.type=Object type picture input:K79:5) | (This:C1470.type=Object type listbox:K79:8)) - $lHorizontal:=$2 + $h:=Num:C11($horizontal) - OBJECT SET SCROLL POSITION:C906(*;This:C1470.name;$lVertical;$lHorizontal;*) + OBJECT SET SCROLL POSITION:C906(*; This:C1470.name; $v; $h; *) - This:C1470.scroll:=New object:C1471(\ - "vertical";$lVertical;\ - "horizontal";$lHorizontal) + This:C1470.scroll:={\ + vertical: $v; \ + horizontal: $h} Else - OBJECT SET SCROLL POSITION:C906(*;This:C1470.name;$lVertical;*) + OBJECT SET SCROLL POSITION:C906(*; This:C1470.name; $v; *) - This:C1470.scroll:=$lVertical + This:C1470.scroll:=$v End if - C_OBJECT:C1216($0) - $0:=This:C1470 + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getScrollbars + + var $horizontal; $vertical : Integer + + OBJECT GET SCROLLBAR:C1076(*; This:C1470.name; $horizontal; $vertical) + + This:C1470.scrollbars:={\ + vertical: $vertical; \ + horizontal: $horizontal} + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setScrollbars($horizontal; $vertical) : cs:C1710.scrollable + + OBJECT SET SCROLLBAR:C843(*; This:C1470.name; Num:C11($horizontal); Num:C11($vertical)) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setHorizontalScrollbar($display) : cs:C1710.scrollable + + This:C1470.getScrollbars() + + OBJECT SET SCROLLBAR:C843(*; This:C1470.name; Num:C11($display); Num:C11(This:C1470.scrollbars.vertical)) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setVerticalScrollbar($display) : cs:C1710.scrollable + + This:C1470.getScrollbars() + + OBJECT SET SCROLLBAR:C843(*; This:C1470.name; Num:C11(This:C1470.scrollbars.horizontal); Num:C11($display)) + + return This:C1470 \ No newline at end of file diff --git a/Project/Sources/Classes/settings.4dm b/Project/Sources/Classes/settings.4dm index 17d5746..8b7ee55 100644 --- a/Project/Sources/Classes/settings.4dm +++ b/Project/Sources/Classes/settings.4dm @@ -1,5 +1,12 @@ Class extends preferences +property windowRef : Integer +property pages : Collection:=["beautifier"; "declarations"] +property page : Integer:=1 +property file : 4D:C1709.File +property settings : Object +property beautifier : Collection + Class constructor($page : Text) var $indx : Integer @@ -7,16 +14,13 @@ Class constructor($page : Text) Super:C1705() // Install menu bar to allow Copy - Paste - cs:C1710.menu.new().defaultMinimalMenuBar().setBar() + cs:C1710.menuBar.new().defaultMinimalMenuBar().set() // Display the settings dialog box This:C1470.windowRef:=Open form window:C675("SETTINGS"; Plain form window:K39:10; Horizontally centered:K39:1; Vertically centered:K39:4; *) This:C1470.loadSettings() - This:C1470.pages:=New collection:C1472("beautifier"; "declarations") - This:C1470.page:=1 - If (Count parameters:C259>=1) $indx:=This:C1470.pages.indexOf($page) @@ -69,13 +73,30 @@ Function loadSettings() This:C1470.settings:=JSON Parse:C1218(This:C1470.file.getText()) + This:C1470.settings:=This:C1470.settings || {} + This:C1470.settings.beautifier:=This:C1470.settings.beautifier || {} - // Format comments - If (This:C1470.settings.beautifier.formatComments=Null:C1517) + For each ($key; [\ + "replaceDeprecatedCommand"; \ + "removeConsecutiveBlankLines"; \ + "removeEmptyLinesAtTheBeginOfMethod"; \ + "removeEmptyLinesAtTheEndOfMethod"; \ + "lineBreakBeforeBranchingStructures"; \ + "lineBreakBeforeLoopingStructures"; \ + "lineBreakBeforeAndAfterSequentialStructuresIncluded"; \ + "separationLineForCaseOf"; \ + "aLineOfCommentsMustBePrecededByALineBreak"; \ + "groupingClosureInstructions"; \ + "addTheIncrementForTheLoops"; \ + "splitTestLines"; \ + "replaceComparisonsToAnEmptyStringByLengthTest"; \ + "replaceIfElseEndIfByChoose"; \ + "splitKeyValueLines"; \ + "formatComments"]) - This:C1470.settings.beautifier.formatComments:=True:C214 + This:C1470.settings.beautifier[$key]:=This:C1470.settings.beautifier[$key]#Null:C1517 ? This:C1470.settings.beautifier[$key] : True:C214 - End if + End for each // Obsolete OB REMOVE:C1226(This:C1470.settings.beautifier; "replaceDeprecatedCommand") @@ -86,7 +107,7 @@ Function loadSettings() This:C1470.beautifier.push(New object:C1471(\ "key"; $key; \ - "label"; Get localized string:C991($key); \ + "label"; Localized string:C991($key); \ "on"; Bool:C1537(This:C1470.settings.beautifier[$key]))) End for each @@ -102,7 +123,7 @@ Function convertXmlPrefToJson()->$settings : Object If (This:C1470.file.exists) - $xml:=xml_fileToObject(This:C1470.file.platformPath) + $xml:=_o_xml_fileToObject(This:C1470.file.platformPath) If ($xml.success) diff --git a/Project/Sources/Classes/specialPaste.4dm b/Project/Sources/Classes/specialPaste.4dm index 95bd623..32dd195 100644 --- a/Project/Sources/Classes/specialPaste.4dm +++ b/Project/Sources/Classes/specialPaste.4dm @@ -1,9 +1,9 @@ Class extends macro -property windowRef : Integer:=Open form window:C675("SPECIAL_PASTE"; Plain form window:K39:10; Horizontally centered:K39:1; Vertically centered:K39:4; *) - property preview : Text:="" property original : Text:="" +property options; currentTargetIndex; selected : Integer +property currentTarget : Object property columns : Integer:=80 // Default text column number @@ -13,70 +13,72 @@ Class constructor() Super:C1705() - //This.windowRef:=Open form window("SPECIAL_PASTE"; Movable form dialog box; Horizontally centered; Vertically centered; *) //This.windowRef:=Open form window("SPECIAL_PASTE"; Plain form window; Horizontally centered; Vertically centered; *) - - var $t : Text - var $o : Object - For each ($t; [\ - "string"; \ - "comments"; \ - "tokenized"; \ - "patternRegex"; \ - "pathname"; \ - "insertInText"; \ - "htmlExpression"; \ - "htmlCode"; \ - "jsonCode"; \ - "toUTF8"; \ - "fromUTF8"]) - - $o:={\ - label: " "+Get localized string:C991($t); \ - transform: $t} - - Case of - - //______________________________________________________ - : (New collection:C1472(\ - "string"; \ - "comments"; \ - "htmlCode").indexOf($t)#-1) - - $o.options:=New object:C1471 - $o.options["1"]:="deleteIndentation" - $o.options["2"]:="ignoreBlankLines" - - //______________________________________________________ - : ($t="pathname") - - $o.options:=New object:C1471 - $o.options["1"]:="relative" - $o.options["2"]:="posix" - - //______________________________________________________ - End case - - This:C1470.target.push($o) - - End for each - - DIALOG:C40("SPECIAL_PASTE"; This:C1470) - - If (Bool:C1537(OK)) + If (This:C1470.dialog("SPECIAL_PASTE"; Localized string:C991("specialPaste"))) + + var $t : Text + var $o : Object + For each ($t; [\ + "string"; \ + "comments"; \ + "tokenized"; \ + "patternRegex"; \ + "pathname"; \ + "insertInText"; \ + "htmlExpression"; \ + "htmlCode"; \ + "jsonCode"; \ + "toUTF8"; \ + "fromUTF8"]) + + $o:={\ + label: " "+Localized string:C991($t); \ + transform: $t} + + Case of + + //______________________________________________________ + : (New collection:C1472(\ + "string"; \ + "comments"; \ + "htmlCode").indexOf($t)#-1) + + $o.options:=New object:C1471 + $o.options["1"]:="deleteIndentation" + $o.options["2"]:="ignoreBlankLines" + + //______________________________________________________ + : ($t="pathname") + + $o.options:=New object:C1471 + $o.options["1"]:="relative" + $o.options["2"]:="posix" + + //______________________________________________________ + End case + + This:C1470.target.push($o) + + End for each - var $selected : Integer:=This:C1470.currentTargetIndex - _o_Preferences("Set_Value"; "specialPasteChoice"; ->$selected) + DIALOG:C40("SPECIAL_PASTE"; This:C1470) - var $options : Integer:=This:C1470.options - _o_Preferences("Set_Value"; "specialPasteOptions"; ->$options) + If (Bool:C1537(OK)) + + var $selected : Integer:=This:C1470.currentTargetIndex + _o_Preferences("Set_Value"; "specialPasteChoice"; ->$selected) + + var $options : Integer:=This:C1470.options + _o_Preferences("Set_Value"; "specialPasteOptions"; ->$options) + + This:C1470.setHighlightedText(This:C1470.preview+kCaret) + + End if - This:C1470.setHighlightedText(This:C1470.preview+kCaret) + CLOSE WINDOW:C154(This:C1470.windowRef) End if - CLOSE WINDOW:C154(This:C1470.windowRef) - //========================================================================= Function refresh() @@ -125,10 +127,10 @@ Function update() If (This:C1470.currentTarget.options#Null:C1517) - OBJECT SET TITLE:C194(*; "option_1"; Get localized string:C991(This:C1470.currentTarget.options["1"])) + OBJECT SET TITLE:C194(*; "option_1"; Localized string:C991(This:C1470.currentTarget.options["1"])) OBJECT SET ENABLED:C1123(*; "option_1"; True:C214) - OBJECT SET TITLE:C194(*; "option_2"; Get localized string:C991(This:C1470.currentTarget.options["2"])) + OBJECT SET TITLE:C194(*; "option_2"; Localized string:C991(This:C1470.currentTarget.options["2"])) OBJECT SET ENABLED:C1123(*; "option_2"; True:C214) Else diff --git a/Project/Sources/Classes/static.4dm b/Project/Sources/Classes/static.4dm index dc7e137..0917b4f 100755 --- a/Project/Sources/Classes/static.4dm +++ b/Project/Sources/Classes/static.4dm @@ -1,252 +1,343 @@ /* +This class is the parent class of all form objects classes +*/ -Static objects are generally used for setting the appearance of the form and its -labels as well as for the graphic interface.Static objects do not have -associated variables like active objects. - - ╔══════════════════════════════════════════════╗ - ║ This is the parent class of all form objects ║ - ╚══════════════════════════════════════════════╝ +property __CLASS__ : Object +property name : Text +property type : Integer - ┏━━━━━━━━┓ ┏━━━━━━━━━┓ - ┏━━┫ button ┃ ┏━━┫ picture ┃ - ┃ ┗━━━━━━━━┛ ┃ ┗━━━━━━━━━┛ -┏━━━━━━━━┓ ┏━━━━━━━━┓ ┃ ┏━━━━━━━━━━━━┓ ┃ ┏━━━━━━━━━┓ -┃ static ┣━━━━━┫ widget ┣━━━━╋━━┫ scrollable ┣━━━━╋━━┫ listbox ┃ -┗━━━━━━━━┛ ┗━━━━━━━━┛ ┃ ┗━━━━━━━━━━━━┛ ┃ ┗━━━━━━━━━┛ - ┃ ┏━━━━━━━━━━┓ ┃ ┏━━━━━━━━━┓ - ┣━━┫ progress ┃ ┗━━┫ subform ┃ - ┃ ┗━━━━━━━━━━┛ ┗━━━━━━━━━┛ - ┃ ┏━━━━━━━┓ - ┣━━┫ input ┃ - ┃ ┗━━━━━━━┛ - ┃ ┏━━━━━━━━━┓ - ┗━━┫ stepper ┃ - ┗━━━━━━━━━┛ -*/ +property _coordinates; initialPosition : Object +property _fonts : Collection -Class constructor +Class constructor($name : Text) - C_TEXT:C284($1) - - If (Count parameters:C259>=1) - - This:C1470.name:=$1 - - Else - - // Called from the widget method - This:C1470.name:=OBJECT Get name:C1087(Object current:K67:2) - - End if + This:C1470.__CLASS__:=OB Class:C1730(This:C1470) + This:C1470.name:=Length:C16($name)>0 ? $name : OBJECT Get name:C1087(Object current:K67:2) This:C1470.type:=OBJECT Get type:C1300(*; This:C1470.name) If (Asserted:C1132(This:C1470.type#0; Current method name:C684+": No objects found named \""+This:C1470.name+"\"")) - This:C1470._updateCoordinates() + This:C1470.updateCoordinates() End if -/*════════════════════════════════════════════ -.hide() -> This -══════════════════════════*/ -Function hide + //MARK:-[Object] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get title() : Text - OBJECT SET VISIBLE:C603(*; This:C1470.name; False:C215) + return OBJECT Get title:C1068(*; This:C1470.name) - C_OBJECT:C1216($0) - $0:=This:C1470 + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set title($title : Text) -/*════════════════════════════════════════════ -.show() -> This -.show(bool) -> This -══════════════════════════*/ -Function show + This:C1470.setTitle($title) - C_BOOLEAN:C305($1) + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setTitle($title : Text) : cs:C1710.static - If (Count parameters:C259>=1) - - If ($1) - - OBJECT SET VISIBLE:C603(*; This:C1470.name; True:C214) - - Else - - OBJECT SET VISIBLE:C603(*; This:C1470.name; False:C215) - - End if - - Else - - OBJECT SET VISIBLE:C603(*; This:C1470.name; True:C214) - - End if + OBJECT SET TITLE:C194(*; This:C1470.name; This:C1470._getLocalizeString($title)) - C_OBJECT:C1216($0) - $0:=This:C1470 + return This:C1470 -/*════════════════════════════════════════════*/ -Function getVisible + //MARK:-[Coordinates & Sizing] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get resizingOptions() : Object - C_BOOLEAN:C305($0) + var $horizontal; $vertical : Integer - $0:=OBJECT Get visible:C1075(*; This:C1470.name) + OBJECT GET RESIZING OPTIONS:C1176(*; This:C1470.name; $horizontal; $vertical) -/*════════════════════════════════════════════ -.enable() -> This -.enable(bool) -> This -══════════════════════════*/ -Function enable + return {horizontal: $horizontal; vertical: $vertical} - C_BOOLEAN:C305($1) + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setResizingOptions($horizontal : Integer; $vertical : Integer) - If (Count parameters:C259>=1) + $vertical:=Count parameters:C259<2 ? This:C1470.resizingOptions.vertical : $vertical + OBJECT SET RESIZING OPTIONS:C1175(*; This:C1470.name; $horizontal; $vertical) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get width() : Integer + + var $bottom; $left; $right; $top : Integer + OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) + return $right-$left + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set width($width : Integer) + + This:C1470.setWidth($width) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setWidth($width : Integer) : cs:C1710.static + + var $o : Object + + $o:=This:C1470.getCoordinates() + $o.right:=$o.left+$width + + OBJECT SET COORDINATES:C1248(*; This:C1470.name; $o.left; $o.top; $o.right; $o.bottom) + This:C1470.updateCoordinates($o.left; $o.top; $o.right; $o.bottom) + + return This:C1470 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get height() : Integer + + var $bottom; $left; $right; $top : Integer + OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) + return $bottom-$top + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set height($height : Integer) + + This:C1470.setHeight($height) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setHeight($height : Integer) : cs:C1710.static + + var $o : Object + + $o:=This:C1470.getCoordinates() + $o.bottom:=$o.top+$height + + OBJECT SET COORDINATES:C1248(*; This:C1470.name; $o.left; $o.top; $o.right; $o.bottom) + This:C1470.updateCoordinates($o.left; $o.top; $o.right; $o.bottom) + + return This:C1470 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get left() : Integer + + return This:C1470.getCoordinates().left + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set left($left : Integer) + + var $width : Integer + var $o : cs:C1710.coord + + This:C1470.getCoordinates() + $o:=This:C1470._coordinates + $width:=$o.width + $o.left:=$left + $o.right:=$o.left+$width + This:C1470.setCoordinates($o) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get top() : Integer + + return This:C1470.getCoordinates().top + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set top($top : Integer) + + var $height : Integer + var $o : cs:C1710.coord + + This:C1470.getCoordinates() + $o:=This:C1470._coordinates + $height:=$o.height + $o.top:=$top + $o.bottom:=$o.top+$height + This:C1470.setCoordinates($o) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get right() : Integer + + return This:C1470.getCoordinates().right + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set right($right : Integer) + + var $width : Integer + var $o : cs:C1710.coord + + This:C1470.getCoordinates() + $o:=This:C1470._coordinates + $o.right:=$right + This:C1470.setCoordinates($o) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get bottom() : Integer + + return This:C1470.getCoordinates().bottom + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set bottom($bottom : Integer) + + var $width : Integer + var $o : cs:C1710.coord + + This:C1470.getCoordinates() + $o:=This:C1470._coordinates + $o.bottom:=$bottom + This:C1470.setCoordinates($o) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get dimensions() : Object + + var $o : Object + $o:=This:C1470.getCoordinates() + + return {\ + width: $o.right-$o.left; \ + height: $o.bottom-$o.top} + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set dimensions($dimensions : Object) + + var $o : Object + $o:=This:C1470.getCoordinates() + + If ($dimensions.width#Null:C1517) - If ($1) - - OBJECT SET ENABLED:C1123(*; This:C1470.name; True:C214) - - Else - - OBJECT SET ENABLED:C1123(*; This:C1470.name; False:C215) - - End if + $o.right:=$o.left+Num:C11($dimensions.width) - Else + End if + + If ($dimensions.height#Null:C1517) - OBJECT SET ENABLED:C1123(*; This:C1470.name; True:C214) + $o.bottom:=$o.top+Num:C11($dimensions.height) End if - C_OBJECT:C1216($0) - $0:=This:C1470 + OBJECT SET COORDINATES:C1248(*; This:C1470.name; $o.left; $o.top; $o.right; $o.bottom) + This:C1470.updateCoordinates($o.left; $o.top; $o.right; $o.bottom) -/*════════════════════════════════════════════ -.disable() -> This -══════════════════════════*/ -Function disable + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setDimensions($width : Integer; $height : Integer) : cs:C1710.static - OBJECT SET ENABLED:C1123(*; This:C1470.name; False:C215) + var $o : Object + + $o:=This:C1470.getCoordinates() + $o.right:=$o.left+$width - C_OBJECT:C1216($0) - $0:=This:C1470 + If (Count parameters:C259>=2) + + $o.bottom:=$o.top+$height + + End if -/*════════════════════════════════════════════ -.setTitle(text) -> This -══════════════════════════*/ -Function setTitle + OBJECT SET COORDINATES:C1248(*; This:C1470.name; $o.left; $o.top; $o.right; $o.bottom) + This:C1470.updateCoordinates($o.left; $o.top; $o.right; $o.bottom) - C_TEXT:C284($1) // Text or resname - C_TEXT:C284($t) + return This:C1470 - $t:=Get localized string:C991($1) - $t:=Choose:C955(Length:C16($t)>0; $t; $1) // Revert if no localization + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get coordinates() : Object //cs.coord - OBJECT SET TITLE:C194(*; This:C1470.name; $t) + This:C1470.getCoordinates() + //return cs.coord.new(This._coordinates) + return This:C1470._coordinates - C_OBJECT:C1216($0) - $0:=This:C1470 + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getCoordinates() : Object -/*════════════════════════════════════════════ -.getTitle() -> text -══════════════════════════*/ -Function getTitle + var $bottom; $left; $right; $top : Integer - C_TEXT:C284($0) + OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) + This:C1470.updateCoordinates($left; $top; $right; $bottom) - $0:=OBJECT Get title:C1068(*; This:C1470.name) + return This:C1470._coordinates -/*════════════════════════════════════════════ -.setCoordinates (left;top;right;bottom) -> This -.setCoordinates (obj) -> This - obj = {"left":int,"top":int,"right":int,"bottom":int} -══════════════════════════*/ -Function setCoordinates + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setCoordinates($left; $top : Integer; $right : Integer; $bottom : Integer) : cs:C1710.static - C_VARIANT:C1683($1) - C_LONGINT:C283($2; $3; $4) + var $o : Object - C_OBJECT:C1216($o) + If (Value type:C1509($left)=Is object:K8:27) + + $o:={\ + left: Num:C11($left.left); \ + top: Num:C11($left.top)} + + If ($left.right#Null:C1517) + + $o.right:=Num:C11($left.right) + + End if + + If ($left.bottom#Null:C1517) + + $o.bottom:=Num:C11($left.bottom) + + End if + + Else + + $o:={\ + left: Num:C11($left); \ + top: Num:C11($top)} + + If (Count parameters:C259>=3) + + $o.right:=Num:C11($right) + $o.bottom:=Num:C11($bottom) + + End if + End if - If (Value type:C1509($1)=Is object:K8:27) + If ($o.right#Null:C1517) - $o:=New object:C1471(\ - "left"; Num:C11($1.left); \ - "top"; Num:C11($1.top); \ - "right"; Num:C11($1.right); \ - "bottom"; Num:C11($1.bottom)) + OBJECT SET COORDINATES:C1248(*; This:C1470.name; $o.left; $o.top; $o.right; $o.bottom) Else - $o:=New object:C1471(\ - "left"; Num:C11($1); \ - "top"; Num:C11($2); \ - "right"; Num:C11($3); \ - "bottom"; Num:C11($4)) + OBJECT SET COORDINATES:C1248(*; This:C1470.name; $o.left; $o.top) End if - OBJECT SET COORDINATES:C1248(*; This:C1470.name; $o.left; $o.top; $o.right; $o.bottom) + This:C1470.updateCoordinates($o.left; $o.top; $o.right; $o.bottom) - This:C1470._updateCoordinates($o.left; $o.top; $o.right; $o.bottom) + return This:C1470 - C_OBJECT:C1216($0) - $0:=This:C1470 + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get windowCoordinates() : Object -/*════════════════════════════════════════════ -.getCoordinates() -> obj - obj = {"left":int,"top":int,"right":int,"bottom":int}) -══════════════════════════*/ -Function getCoordinates - C_OBJECT:C1216($0) - C_LONGINT:C283($left; $top; $right; $bottom) + This:C1470.updateCoordinates() - OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) - This:C1470._updateCoordinates($left; $top; $right; $bottom) + var $bottom; $left; $right; $top : Integer - $0:=This:C1470.coordinates + $left:=This:C1470._coordinates.left + $top:=This:C1470._coordinates.top + $right:=This:C1470._coordinates.right + $bottom:=This:C1470._coordinates.bottom + + CONVERT COORDINATES:C1365($left; $top; XY Current form:K27:5; XY Current window:K27:6) + CONVERT COORDINATES:C1365($right; $bottom; XY Current form:K27:5; XY Current window:K27:6) -/*════════════════════════════════════════════ -.bestSize(obj) -> This - obj = {"alignment":int,"min":int,"max:int}} + return {\ + left: $left; \ + top: $top; \ + right: $right; \ + bottom: $bottom} -.bestSize({alignment{;min{;max}}}) -> This -══════════════════════════*/ -Function bestSize + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function bestSize($alignment; $minWidth : Integer; $maxWidth : Integer) : cs:C1710.static - C_VARIANT:C1683($1) - C_LONGINT:C283($2; $3) - C_OBJECT:C1216($o) - C_LONGINT:C283($left; $top; $right; $bottom; $width; $height) + var $bottom; $height; $left; $right; $top; $width : Integer + var $o : Object If (Count parameters:C259>=1) - If (Value type:C1509($1)=Is object:K8:27) + If (Value type:C1509($alignment)=Is object:K8:27) - $o:=$1 - - If ($o.alignment=Null:C1517) - - $o.alignment:=Align left:K42:2 - - End if + $o:=OB Copy:C1225($alignment) + $o.alignment:=$o.alignment ? $o.alignment : Align left:K42:2 Else - $o:=New object:C1471 - - $o.alignment:=$1 + $o:={alignment: Num:C11($alignment)} If (Count parameters:C259>=2) - $o.min:=$2 + $o.minWidth:=$minWidth If (Count parameters:C259>=3) - $o.max:=$3 + $o.maxWidth:=$maxWidth End if End if @@ -254,223 +345,788 @@ Function bestSize Else - $o:=New object:C1471(\ - "alignment"; Align left:K42:2) + $o:={alignment: Align left:K42:2} // Default is Align left End if + // Automatic adjustments according to the type of widget, if any + Case of + + //______________________________________________________ + : (Num:C11($o.minWidth)#0) + + // + + //______________________________________________________ + : (This:C1470.type=Object type push button:K79:16)\ + || (This:C1470.type=Object type 3D button:K79:17) + + $o.minWidth:=60 + + //______________________________________________________ + End case OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) - If ($o.max#Null:C1517) - - OBJECT GET BEST SIZE:C717(*; This:C1470.name; $width; $height; $o.max) + If ([\ + Object type 3D button:K79:17; \ + Object type 3D checkbox:K79:27; \ + Object type 3D radio button:K79:24; \ + Object type checkbox:K79:26; \ + Object type listbox column:K79:10; \ + Object type picture button:K79:20; \ + Object type picture radio button:K79:25; \ + Object type push button:K79:16; \ + Object type radio button:K79:23; \ + Object type static picture:K79:3; \ + Object type static text:K79:2; \ + Object type listbox:K79:8; \ + Object type text input:K79:4].includes(This:C1470.type)) - Else - - OBJECT GET BEST SIZE:C717(*; This:C1470.name; $width; $height) - - End if - - Case of + If (Num:C11($o.maxWidth)#0) + + OBJECT GET BEST SIZE:C717(*; This:C1470.name; $width; $height; $o.maxWidth) + + Else - //______________________________ - : (This:C1470.type=Object type static text:K79:2)\ - | (This:C1470.type=Object type checkbox:K79:26) + OBJECT GET BEST SIZE:C717(*; This:C1470.name; $width; $height) - If (Num:C11($o.alignment)=Align left:K42:2) + End if + + Case of + + //______________________________ + : (This:C1470.type=Object type static text:K79:2)\ + | (This:C1470.type=Object type checkbox:K79:26) + + If (Num:C11($o.alignment)=Align left:K42:2) + + // Add 10 pixels + //$width:=$width+10 + + End if + + //______________________________ + : (This:C1470.type=Object type push button:K79:16)\ + || (This:C1470.type=Object type 3D button:K79:17) + + // Add 10% for margins + $width:=Round:C94($width*1.1; 0) + + //______________________________ + Else // Add 10 pixels $width:=$width+10 - End if - - //______________________________ - : (This:C1470.type=Object type push button:K79:16) - - // Add 10% for margins - $width:=Round:C94($width*1.1; 0) - - //______________________________ - Else + //______________________________ + End case + + If ($o.minWidth#Null:C1517) - // Add 10 pixels - $width:=$width+10 + $width:=$width<$o.minWidth ? $o.minWidth : $width - //______________________________ - End case - - If ($o.min#Null:C1517) + End if - $width:=Choose:C955($width<$o.min; $o.min; $width) + Case of + + //______________________________________________________ + : ($o.alignment=Align right:K42:4) + + $left:=$right-$width + + //______________________________________________________ + : ($o.alignment=Align center:K42:3) + + var $offset : Integer + $offset:=($width\2)-(This:C1470.width\2) + $left:=$left-$offset + $right:=$right+$offset + + //______________________________________________________ + : ($o.alignment=Align left:K42:2) + + $right:=$left+$width + + //______________________________________________________ + Else + + TRACE:C157 + + //______________________________________________________ + End case + + OBJECT SET COORDINATES:C1248(*; This:C1470.name; $left; $top; $right; $bottom) + This:C1470.updateCoordinates($left; $top; $right; $bottom) End if - If ($o.alignment=Align right:K42:4) + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getBestHeight() : Integer + + var $width; $height : Integer + OBJECT GET BEST SIZE:C717(*; This:C1470.name; $width; $height; This:C1470.dimensions.width) + + return $height + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getBestWidth($maxWidth : Integer) : Integer + + var $width; $height : Integer + + If (Count parameters:C259=0) - $left:=$right-$width + OBJECT GET BEST SIZE:C717(*; This:C1470.name; $width; $height) Else - // Default is Align left - $right:=$left+$width + OBJECT GET BEST SIZE:C717(*; This:C1470.name; $width; $height; $maxWidth) End if - OBJECT SET COORDINATES:C1248(*; This:C1470.name; $left; $top; $right; $bottom) - This:C1470._updateCoordinates($left; $top; $right; $bottom) + return $width - C_OBJECT:C1216($0) - $0:=This:C1470 + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function moveHorizontally($offset : Integer) : cs:C1710.static -/*════════════════════════════════════════════ -.moveHorizontally(int) -> This -══════════════════════════*/ -Function moveHorizontally + var $bottom; $left; $right; $top : Integer + OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) - C_LONGINT:C283($1) - C_LONGINT:C283($left; $top; $right; $bottom) + $left+=$offset + $right+=$offset + This:C1470.setCoordinates($left; $top; $right; $bottom) - OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) + return This:C1470 - $left:=$left+$1 - $right:=$right+$1 + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function moveVertically($offset : Integer) : cs:C1710.static - This:C1470.setCoordinates(New object:C1471(\ - "left"; $left; \ - "top"; $top; \ - "right"; $right; \ - "bottom"; $bottom)) + var $bottom; $left; $right; $top : Integer + OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) - C_OBJECT:C1216($0) - $0:=This:C1470 + $top+=$offset + $bottom+=$offset + This:C1470.setCoordinates($left; $top; $right; $bottom) -/*════════════════════════════════════════════ -.moveVertically(int) -> This -══════════════════════════*/ -Function moveVertically + return This:C1470 - C_LONGINT:C283($1) - C_LONGINT:C283($left; $top; $right; $bottom) + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function resizeHorizontally($offset : Integer) : cs:C1710.static + var $bottom; $left; $right; $top : Integer OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) - $top:=$top+$1 - $bottom:=$bottom+$1 + $right+=$offset + This:C1470.setCoordinates($left; $top; $right; $bottom) - This:C1470.setCoordinates(New object:C1471(\ - "left"; $left; \ - "top"; $top; \ - "right"; $right; \ - "bottom"; $bottom)) + return This:C1470 - C_OBJECT:C1216($0) - $0:=This:C1470 + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function resizeVertically($offset : Integer) : cs:C1710.static -/*════════════════════════════════════════════ -.resizeHorizontally(int) -> This -══════════════════════════*/ -Function resizeHorizontally + var $bottom; $left; $right; $top : Integer + OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) - C_LONGINT:C283($1) - C_LONGINT:C283($left; $top; $right; $bottom) + $bottom+=$offset + This:C1470.setCoordinates($left; $top; $right; $bottom) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function moveAndResizeHorizontally($offset : Integer; $resize : Integer) : cs:C1710.static + + var $bottom; $left; $right; $top : Integer OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) - $right:=$right+$1 + $left+=$offset - This:C1470.setCoordinates(New object:C1471(\ - "left"; $left; \ - "top"; $top; \ - "right"; $right; \ - "bottom"; $bottom)) + If (Count parameters:C259>=2) + + $right+=$resize + + Else + + //$right+=$offset + + End if + + This:C1470.setCoordinates({\ + left: $left; \ + top: $top; \ + right: $right; \ + bottom: $bottom}) - C_OBJECT:C1216($0) - $0:=This:C1470 + return This:C1470 -/*════════════════════════════════════════════ -.resizeVertically(int) -> This -══════════════════════════*/ -Function resizeVertically + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function moveAndResizeVertically($offset : Integer; $resize : Integer) : cs:C1710.static - C_LONGINT:C283($1) - C_LONGINT:C283($left; $top; $right; $bottom) + var $bottom; $left; $right; $top : Integer OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) - $bottom:=$bottom+$1 + $top:=$top+$offset - This:C1470.setCoordinates(New object:C1471(\ - "left"; $left; \ - "top"; $top; \ - "right"; $right; \ - "bottom"; $bottom)) + If (Count parameters:C259>=2) + + $bottom:=$bottom+$resize + + End if - C_OBJECT:C1216($0) - $0:=This:C1470 + This:C1470.setCoordinates({\ + left: $left; \ + top: $top; \ + right: $right; \ + bottom: $bottom}) -/*════════════════════════════════════════════ -.setDimension(width {; height}) -> This -══════════════════════════*/ -Function setDimension + return This:C1470 - C_LONGINT:C283($1; $2) - C_OBJECT:C1216($o) + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function updateCoordinates($left : Integer; $top : Integer; $right : Integer; $bottom : Integer) : cs:C1710.static - $o:=This:C1470.getCoordinates() - $o.right:=$o.left+$1 + If (Count parameters:C259<4) + + OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) + + End if - If (Count parameters:C259>=2) + This:C1470._coordinates:={\ + left: $left; \ + top: $top; \ + right: $right; \ + bottom: $bottom} + + // Keep the position defined in structure + This:C1470.initialPosition:=This:C1470.initialPosition || This:C1470._coordinates + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function backupCoordinates() : cs:C1710.static + + This:C1470.initialPosition:=Null:C1517 + return This:C1470.updateCoordinates() + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function restorePosition() + + This:C1470.setCoordinates(This:C1470.initialPosition) + + //MARK:-[Entry] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get enabled() : Boolean + + return OBJECT Get enabled:C1079(*; This:C1470.name) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set enabled($enabled : Boolean) + + OBJECT SET ENABLED:C1123(*; This:C1470.name; $enabled) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function enable($state : Boolean) : cs:C1710.static + + OBJECT SET ENABLED:C1123(*; This:C1470.name; Count parameters:C259=0 ? True:C214 : $state) + return This:C1470 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get disabled() : Boolean + + return Not:C34(OBJECT Get enabled:C1079(*; This:C1470.name)) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set disabled($disabled : Boolean) + + OBJECT SET VISIBLE:C603(*; This:C1470.name; Not:C34($disabled)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function disable() : cs:C1710.static + + OBJECT SET ENABLED:C1123(*; This:C1470.name; False:C215) + + return This:C1470 + + //MARK:-[Display] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get visible() : Boolean + + return OBJECT Get visible:C1075(*; This:C1470.name) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set visible($visible : Boolean) + + OBJECT SET VISIBLE:C603(*; This:C1470.name; $visible) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function show($state : Boolean) : cs:C1710.static + + OBJECT SET VISIBLE:C603(*; This:C1470.name; Count parameters:C259=0 ? True:C214 : $state) + return This:C1470 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get hidden() : Boolean + + return Not:C34(OBJECT Get visible:C1075(*; This:C1470.name)) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set hidden($hidden : Boolean) + + OBJECT SET VISIBLE:C603(*; This:C1470.name; Not:C34($hidden)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function hide() : cs:C1710.static + + OBJECT SET VISIBLE:C603(*; This:C1470.name; False:C215) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function get format() : Text + + return OBJECT Get format:C894(*; This:C1470.name) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setFormat($format : Text) : cs:C1710.widget + + OBJECT SET FORMAT:C236(*; This:C1470.name; $format) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setPicture($proxy : Text) : cs:C1710.widget + + If (Count parameters:C259>=1) + + Case of + + //______________________________________________________ + : (This:C1470.type=Object type 3D button:K79:17)\ + || (This:C1470.type=Object type 3D checkbox:K79:27)\ + || (This:C1470.type=Object type 3D radio button:K79:24) + + return This:C1470.setFormat(";"+$proxy) + + //______________________________________________________ + : (This:C1470.type=Object type picture button:K79:20)\ + || (This:C1470.type=Object type picture popup menu:K79:15) + + return This:C1470.setFormat(";;"+$proxy) + + //______________________________________________________ + : (This:C1470.type=Object type listbox header:K79:9)\ + || (This:C1470.type=Object type static picture:K79:3) + + return This:C1470.setFormat($proxy) + + //______________________________________________________ + Else + + // #ERROR + + //______________________________________________________ + End case + + Else - $o.bottom:=$o.top+$2 + // Remove picture + Case of + + //______________________________________________________ + : (This:C1470.type=Object type 3D button:K79:17)\ + || (This:C1470.type=Object type 3D checkbox:K79:27)\ + || (This:C1470.type=Object type 3D radio button:K79:24) + + return This:C1470.setFormat(";\"\"") + + //______________________________________________________ + : (This:C1470.type=Object type picture button:K79:20)\ + || (This:C1470.type=Object type picture popup menu:K79:15) + + return This:C1470.setFormat(";;\"\"") + + //______________________________________________________ + : (This:C1470.type=Object type listbox header:K79:9)\ + || (This:C1470.type=Object type static picture:K79:3) + + return This:C1470.setFormat("") + + //______________________________________________________ + Else + + // #ERROR + + //______________________________________________________ + End case End if - OBJECT SET COORDINATES:C1248(*; This:C1470.name; $o.left; $o.top; $o.right; $o.bottom) - This:C1470._updateCoordinates($o.left; $o.top; $o.right; $o.bottom) + // MARK:-[Colors] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get colors() : Object + + var $altBackground; $background; $foreground : Text + + OBJECT GET RGB COLORS:C1074(*; This:C1470.name; $foreground; $background; $altBackground) + return {\ + foreground: $foreground; \ + background: $background; \ + altBackground: $altBackground} + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set colors($colors : Object) + + This:C1470.setColors($colors) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get backgroundColor() : Variant + + var $foreground; $background + + OBJECT GET RGB COLORS:C1074(*; This:C1470.name; $foreground; $background) + return $background + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set backgroundColor($color) + + var $foreground; $background; $altBackground + + OBJECT GET RGB COLORS:C1074(*; This:C1470.name; $foreground; $background) + OBJECT SET RGB COLORS:C628(*; This:C1470.name; $foreground; $color) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get altBackgroundColor() : Variant + + var $foreground; $background; $altBackground + + OBJECT GET RGB COLORS:C1074(*; This:C1470.name; $foreground; $background; $altBackground) + return $altBackground + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set altBackgroundColor($color) + + var $foreground; $background; $altBackground + + OBJECT GET RGB COLORS:C1074(*; This:C1470.name; $foreground; $background; $altBackground) + OBJECT SET RGB COLORS:C628(*; This:C1470.name; $foreground; $background; $color) + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get foregroundColor() : Variant + + var $foreground + + OBJECT GET RGB COLORS:C1074(*; This:C1470.name; $foreground) + return $foreground + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set foregroundColor($color) + + OBJECT SET RGB COLORS:C628(*; This:C1470.name; $color) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setColors($foreground : Variant; $background : Variant; $altBackground : Variant) : cs:C1710.static + + Case of + + //______________________________________________________ + : (Value type:C1509($foreground)=Is object:K8:27) + + $altBackground:=$foreground.altBackground ? $foreground.altBackground : Null:C1517 + $background:=$foreground.background ? $foreground.background : Null:C1517 + $foreground:=$foreground.foreground ? $foreground.foreground : Null:C1517 + + Case of + + //………………………………………………………………………………………………………………………… + : ($altBackground#Null:C1517) + + $foreground:=Value type:C1509($foreground)=Is text:K8:3 ? $foreground : Num:C11($foreground) + $background:=Value type:C1509($background)=Is text:K8:3 ? $background : Num:C11($background) + $altBackground:=Value type:C1509($altBackground)=Is text:K8:3 ? $altBackground : Num:C11($altBackground) + OBJECT SET RGB COLORS:C628(*; This:C1470.name; $foreground; $background; $altBackground) + + //………………………………………………………………………………………………………………………… + : ($background#Null:C1517) + + $foreground:=Value type:C1509($foreground)=Is text:K8:3 ? $foreground : Num:C11($foreground) + $background:=Value type:C1509($background)=Is text:K8:3 ? $background : Num:C11($background) + OBJECT SET RGB COLORS:C628(*; This:C1470.name; $foreground; $background) + + //………………………………………………………………………………………………………………………… + : ($foreground#Null:C1517) + + $foreground:=Value type:C1509($foreground)=Is text:K8:3 ? $foreground : Num:C11($foreground) + OBJECT SET RGB COLORS:C628(*; This:C1470.name; $foreground) + + //………………………………………………………………………………………………………………………… + End case + + //______________________________________________________ + : (Count parameters:C259>=3) + + $foreground:=Value type:C1509($foreground)=Is text:K8:3 ? $foreground : Num:C11($foreground) + $background:=Value type:C1509($background)=Is text:K8:3 ? $background : Num:C11($background) + $altBackground:=Value type:C1509($altBackground)=Is text:K8:3 ? $altBackground : Num:C11($altBackground) + OBJECT SET RGB COLORS:C628(*; This:C1470.name; $foreground; $background; $altBackground) + + //______________________________________________________ + : (Count parameters:C259>=2) + + $foreground:=Value type:C1509($foreground)=Is text:K8:3 ? $foreground : Num:C11($foreground) + $background:=Value type:C1509($background)=Is text:K8:3 ? $background : Num:C11($background) + OBJECT SET RGB COLORS:C628(*; This:C1470.name; $foreground; $background) + + //______________________________________________________ + : (Count parameters:C259>=1) + + $foreground:=Value type:C1509($foreground)=Is text:K8:3 ? $foreground : Num:C11($foreground) + OBJECT SET RGB COLORS:C628(*; This:C1470.name; $foreground) + + //______________________________________________________ + Else + + // #ERROR + + //______________________________________________________ + End case + + return This:C1470 + + //MARK:-[Text] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get horizontalAlignment() : Integer + + return OBJECT Get horizontal alignment:C707(*; This:C1470.name) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set horizontalAlignment($alignment : Integer) + + OBJECT SET HORIZONTAL ALIGNMENT:C706(*; This:C1470.name; $alignment+Num:C11($alignment=0)) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function alignLeft() : cs:C1710.static + + OBJECT SET HORIZONTAL ALIGNMENT:C706(*; This:C1470.name; Align left:K42:2) + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function alignRight() : cs:C1710.static + + OBJECT SET HORIZONTAL ALIGNMENT:C706(*; This:C1470.name; Align right:K42:4) + return This:C1470 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get verticalAlignment() : Integer + + return OBJECT Get vertical alignment:C1188(*; This:C1470.name) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set verticalAlignment($alignment : Integer) + + OBJECT SET VERTICAL ALIGNMENT:C1187(*; This:C1470.name; $alignment+Num:C11($alignment=0)) - C_OBJECT:C1216($0) - $0:=This:C1470 + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function alignTop() : cs:C1710.static -/*════════════════════════════════════════════*/ -Function _updateCoordinates + OBJECT SET VERTICAL ALIGNMENT:C1187(*; This:C1470.name; Align top:K42:5) + return This:C1470 - C_LONGINT:C283($1; $2; $3; $4) - C_LONGINT:C283($left; $top; $right; $bottom) + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function alignBottom() : cs:C1710.static - If (Count parameters:C259>=4) + OBJECT SET VERTICAL ALIGNMENT:C1187(*; This:C1470.name; Align bottom:K42:6) + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function alignCenter($vertical : Boolean) : cs:C1710.static + + If ($vertical) - $left:=$1 - $top:=$2 - $right:=$3 - $bottom:=$4 + OBJECT SET VERTICAL ALIGNMENT:C1187(*; This:C1470.name; Align center:K42:3) Else - OBJECT GET COORDINATES:C663(*; This:C1470.name; $left; $top; $right; $bottom) + OBJECT SET HORIZONTAL ALIGNMENT:C706(*; This:C1470.name; Align center:K42:3) End if - This:C1470.coordinates:=New object:C1471(\ - "left"; $left; \ - "top"; $top; \ - "right"; $right; \ - "bottom"; $bottom) + return This:C1470 - This:C1470.dimensions:=New object:C1471(\ - "width"; $right-$left; \ - "height"; $bottom-$top) + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get font() : Text - CONVERT COORDINATES:C1365($left; $top; XY Current form:K27:5; XY Current window:K27:6) - CONVERT COORDINATES:C1365($right; $bottom; XY Current form:K27:5; XY Current window:K27:6) + return OBJECT Get font:C1069(*; This:C1470.name) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set font($font : Text) + + This:C1470.setFont($font) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setFont($font : Text) : cs:C1710.static + + Case of + + //______________________________________________________ + : ($font="")\ + | ($font="default")\ + | ($font="system") // Default font + + OBJECT SET FONT:C164(*; This:C1470.name; OBJECT Get font:C1069(*; "")) + + //______________________________________________________ + : ($font="emoji") // Compatible emoji font for Windows + + If (Is Windows:C1573) + + var $desiredFonts : Collection + $desiredFonts:=[\ + "Segoe UI Emoji"; \ + "Segoe UI Symbol"; \ + "Yu Mincho"; \ + "Yu Gothic"] + + For each ($font; $desiredFonts) + + If (This:C1470._fontList().includes($font)) + + OBJECT SET FONT:C164(*; This:C1470.name; $font) + break + + End if + + End for each + End if + + //______________________________________________________ + Else + + OBJECT SET FONT:C164(*; This:C1470.name; $font) + + //______________________________________________________ + End case + + return This:C1470 - This:C1470.windowCoordinates:=New object:C1471(\ - "left"; $left; \ - "top"; $top; \ - "right"; $right; \ - "bottom"; $bottom) + // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +Function _fontList() : Collection - C_OBJECT:C1216($0) - $0:=This:C1470 + If (This:C1470._fonts=Null:C1517) + + ARRAY TEXT:C222($fonts; 0) + FONT LIST:C460($fonts) + This:C1470._fonts:=[] + ARRAY TO COLLECTION:C1563(This:C1470._fonts; $fonts) + + End if + + return This:C1470._fonts + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get fontStyle() : Integer + + return OBJECT Get font style:C1071(*; This:C1470.name) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set fontStyle($tyle : Integer) + + This:C1470.setFontStyle($tyle) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setFontStyle($style : Integer) : cs:C1710.static + + OBJECT SET FONT STYLE:C166(*; This:C1470.name; $style) + + return This:C1470 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get fontSize() : Integer + + return OBJECT Get font size:C1070(*; This:C1470.name) + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set fontSize($size : Integer) + + OBJECT SET FONT SIZE:C165(*; This:C1470.name; $size) + + // MARK:-[Miscellaneous] + // === === === === === === === === === === === === === === === === === === === === === === === === === === + /// Adds this widget to a group +Function addToGroup($group : cs:C1710.group) : cs:C1710.static + + If (Asserted:C1132(OB Instance of:C1731($group; cs:C1710.group); "The parameter isn't a group")) + + $group.add(This:C1470) + + End if + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function hiddenFromView() : cs:C1710.static + + OBJECT SET COORDINATES:C1248(*; This:C1470.name; -100; -100; -100; -100) + + return This:C1470 + + // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +Function _proxy($proxy : Text) : Text + + Case of + + //______________________________________________________ + : (Position:C15("path:"; $proxy)=1)\ + || (Position:C15("file:"; $proxy)=1)\ + || (Position:C15("var:"; $proxy)=1)\ + || (Position:C15("!"; $proxy)=1) + + return $proxy + + //______________________________________________________ + : (Position:C15("#"; $proxy)=1) // Shortcut for Resources folder + + return "path:/RESOURCES/"+Delete string:C232($proxy; 1; 1) + + //______________________________________________________ + : ($proxy="|@") + + return "path:/.PRODUCT_RESOURCES/"+Delete string:C232($proxy; 1; 1) + + //______________________________________________________ + : (Position:C15("/"; $proxy)=1) + + return "path:"+$proxy + + //______________________________________________________ + Else + + // Relative to the form.4DForm + return "path:/FORM/"+$proxy + + //______________________________________________________ + End case + + // *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** *** +Function _getLocalizeString($resname : Text) : Text + + var $t : Text + + If (Position:C15(":xliff:"; $resname)=1) + + $resname:=Delete string:C232($resname; 1; 7) + + End if + + //%W-533.1 + If (Length:C16($resname)>0)\ + && (Length:C16($resname)<=255)\ + && ($resname[[1]]#Char:C90(1)) + + $t:=Formula from string:C1601("Get localized string:C991($1)"; sk execute in host database:K88:5).call(Null:C1517; $resname) + + End if + //%W+533.1 -/*════════════════════════════════════════════*/ \ No newline at end of file + return Length:C16($t)>0 ? $t : $resname // Revert if no localization \ No newline at end of file diff --git a/Project/Sources/Classes/test_.4dm b/Project/Sources/Classes/test_.4dm index 122483c..2239c04 100644 --- a/Project/Sources/Classes/test_.4dm +++ b/Project/Sources/Classes/test_.4dm @@ -1,8 +1,18 @@ +property url; name; handler : Text +property test : 4D:C1709.File +property context +property toBeInitialized; success : Boolean +property colorScheme : Text +property isDark : Boolean +property fieldIcons : Collection +property filterIcon : Picture + Class constructor($x : 4D:C1709.File) //comments This:C1470.test:=$x Function empty + This:C1470.context:=Form:C1466.$dialog[This:C1470.name] Function group($a : Text) @@ -178,13 +188,11 @@ Function setDatasource() End if End if -Function setURL - - var $1 : Text +Function setURL($url : Text) If (Count parameters:C259>=1) - This:C1470.url:=$1 + This:C1470.url:=$url // Add missing / if necessary If (Not:C34(Match regex:C1019("/$"; This:C1470.url; 1))) diff --git a/Project/Sources/Classes/widget.4dm b/Project/Sources/Classes/widget.4dm index 88d6c05..0526b76 100755 --- a/Project/Sources/Classes/widget.4dm +++ b/Project/Sources/Classes/widget.4dm @@ -1,308 +1,664 @@ -/* +Class extends static -Active objects perform a database task or an interface function. Fields are -active objects. Other active objects — enterable objects (variables), combo -boxes, drop-down lists, picture buttons, and so on — store data temporarily in -memory or perform some action such as opening a dialog box, printing a report, -or starting a background process. +property name; action; _uri : Text -I prefer to call them widgets to make the difference with language objects +property _events : Collection +property _data; dataSource +property _callback : 4D:C1709.Function +Class constructor($name : Text) + + Super:C1705($name) + + This:C1470.action:=OBJECT Get action:C1457(*; This:C1470.name) + +/* +The user data can be anything you want to attach to the widget. +The .data property is used to get or set this data. */ - -/*═══════════════════*/ -Class extends static -/*═══════════════════*/ - -Class constructor($name : Text; $datasource : Text) + This:C1470._data:=Null:C1517 - var $p : Pointer + // The uri associated with the widget (D&D management) + This:C1470._uri:="" - Super:C1705($name) + // Get the events handled for this widget + This:C1470._setEvents() + + //MARK:-[Object] + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set datasource($datasource) + + This:C1470.setDatasource($datasource) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setDatasource($datasource) : cs:C1710.widget + + This:C1470.dataSource:=$datasource + + Case of + //______________________________________________________ + : (Value type:C1509($datasource)=Is object:K8:27) + + If (Asserted:C1132(OB Instance of:C1731($datasource; 4D:C1709.Function); "datasource object is not a formula")) + + // Formula + This:C1470.setValue(This:C1470.dataSource.call()) + + End if + + //______________________________________________ wi ________ + : (Value type:C1509($datasource)=Is text:K8:3) + + This:C1470.setValue(Formula from string:C1601($datasource).call()) + + //______________________________________________________ + Else + + //ASSERT(False; "datasource must be a formula or a text formula") + + //______________________________________________________ + End case + + return This:C1470 + + //mark:-[Value] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get value() : Variant + + return This:C1470.getValue() + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set value($value) - $p:=OBJECT Get pointer:C1124(Object named:K67:5; This:C1470.name) - This:C1470.assignable:=Not:C34(Is nil pointer:C315($p)) + This:C1470.setValue($value) - If (This:C1470.assignable) + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getValue() : Variant + + If (This:C1470.type=Object type text input:K79:4)\ + && (This:C1470.isFocused()) - This:C1470.pointer:=$p - This:C1470.value:=$p-> + return Get edited text:C655 Else - If (Count parameters:C259>=2) + return OBJECT Get value:C1743(This:C1470.name) + + End if + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setValue($value) : cs:C1710.widget + + If (Not:C34(Undefined:C82($value))) + + OBJECT SET VALUE:C1742(This:C1470.name; $value) + + End if + + return This:C1470 + + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get isEmpty() : Boolean + + var $type : Integer + var $value + + $value:=This:C1470.getValue() + $type:=Value type:C1509($value) + + Case of - This:C1470.dataSource:=$datasource - This:C1470.value:=Formula from string:C1601($datasource).call() + //______________________________________________________ + : ($value=Null:C1517)\ + | ($type=Is undefined:K8:13) - End if - End if + return True:C214 + + //______________________________________________________ + : ($type=Is longint:K8:6)\ + | ($type=Is real:K8:4) + + return $value=0 + + //______________________________________________________ + : ($type=Is date:K8:7) + + return $value=!00-00-00! + + //______________________________________________________ + : ($type=Is time:K8:8) + + return $value=?00:00:00? + + //______________________________________________________ + : ($type=Is picture:K8:10) + + return Picture size:C356($value)=0 + + //______________________________________________________ + : ($type=Is object:K8:27) + + return OB Is empty:C1297($value) + + //______________________________________________________ + : ($type=Is collection:K8:32) + + return $value.length=0 + + //______________________________________________________ + Else + + return Length:C16(String:C10($value))=0 + + //______________________________________________________ + End case - This:C1470.action:=OBJECT Get action:C1457(*; This:C1470.name) + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get isNotEmpty() : Boolean + + return Not:C34(This:C1470.isEmpty) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function clear : cs:C1710.widget + + var $type : Integer + $type:=Value type:C1509(OBJECT Get value:C1743(This:C1470.name)) + + Case of + + //______________________________________________________ + : ($type=Is text:K8:3) + + OBJECT SET VALUE:C1742(This:C1470.name; "") + + //______________________________________________________ + : ($type=Is real:K8:4)\ + | ($type=Is longint:K8:6) + + OBJECT SET VALUE:C1742(This:C1470.name; 0) + + //______________________________________________________ + : ($type=Is boolean:K8:9) + + OBJECT SET VALUE:C1742(This:C1470.name; False:C215) + + //______________________________________________________ + : ($type=Is date:K8:7) + + OBJECT SET VALUE:C1742(This:C1470.name; !00-00-00!) + + //______________________________________________________ + : ($type=Is time:K8:8) + + OBJECT SET VALUE:C1742(This:C1470.name; ?00:00:00?) + + //______________________________________________________ + : ($type=Is object:K8:27) | ($type=Is collection:K8:32) + + OBJECT SET VALUE:C1742(This:C1470.name; Null:C1517) + + //______________________________________________________ + : ($type=Is picture:K8:10) + + OBJECT SET VALUE:C1742(This:C1470.name; OBJECT Get value:C1743(This:C1470.name)*0) + + //______________________________________________________ + Else + + OBJECT SET VALUE:C1742(This:C1470.name; Null:C1517) + + //______________________________________________________ + End case - ARRAY LONGINT:C221($_; 0x0000) - OBJECT GET EVENTS:C1238(*; This:C1470.name; $_) - This:C1470.events:=New collection:C1472 - ARRAY TO COLLECTION:C1563(This:C1470.events; $_) + return This:C1470 -Function addEvents( ... : Integer) + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function touch() : cs:C1710.widget - var $i : Integer + var $value + $value:=OBJECT Get value:C1743(This:C1470.name) - For ($i; 1; Count parameters:C259; 1) + If (Value type:C1509($value)#Is undefined:K8:13) - This:C1470.events.push(${$i}) + OBJECT SET VALUE:C1742(This:C1470.name; $value) - End for + End if + + return This:C1470 + + //MARK:-[Entry] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== + // Returns a pointer to the widget + // ⚠️ Could return a nil pointer if data source is an expression +Function get pointer() : Pointer - //ARRAY LONGINT($_; 0x0000) - //COLLECTION TO ARRAY(This.events; $_) - //OBJECT SET EVENTS(*; This.name; $_; Enable events others unchanged) + return OBJECT Get pointer:C1124(Object named:K67:5; This:C1470.name) -/*══════════════════════════*/ -Function getEnterable : Boolean + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get enterable() : Boolean return OBJECT Get enterable:C1067(*; This:C1470.name) -/*══════════════════════════ -.enterable() -.enterable(bool) -══════════════════════════*/ -Function enterable - var $0 : Object - var $1 : Boolean + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set enterable($enterable : Boolean) - If (Count parameters:C259>=1) - - OBJECT SET ENTERABLE:C238(*; This:C1470.name; $1) - - Else - - OBJECT SET ENTERABLE:C238(*; This:C1470.name; True:C214) - - End if + OBJECT SET ENTERABLE:C238(*; This:C1470.name; $enterable) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setEnterable($enterable : Boolean) : cs:C1710.widget - $0:=This:C1470 + $enterable:=Count parameters:C259>=1 ? $enterable : True:C214 + OBJECT SET ENTERABLE:C238(*; This:C1470.name; $enterable) -/*══════════════════════════ -.notEnterable() --> This -══════════════════════════*/ -Function notEnterable - var $0 : Object + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function notEnterable() : cs:C1710.widget OBJECT SET ENTERABLE:C238(*; This:C1470.name; False:C215) - $0:=This:C1470 + return This:C1470 -/*══════════════════════════*/ -Function getValue + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getShortcut : Object - C_VARIANT:C1683($0) + var $t : Text + var $l : Integer - //If (This.assignable) - //// Use pointer - //$0:=(This.pointer)-> - //Else - //$0:=Formula from string(String(This.dataSource)).call() - //End if + OBJECT GET SHORTCUT:C1186(*; This:C1470.name; $t; $l) - $0:=OBJECT Get value:C1743(This:C1470.name) + return {\ + key: $t; \ + modifier: $l} -/*══════════════════════════*/ -Function setValue - var $0 : Object - var $1 : Variant + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setShortcut($key : Text; $modifier : Integer) : cs:C1710.widget - //If (This.assignable) - //(This.pointer)->:=$1 - //Else - //If (This.dataSource#Null) - //This.value:=$1 - //EXECUTE FORMULA(This.dataSource+":=This.value") - //End if - //End if + OBJECT SET SHORTCUT:C1185(*; This:C1470.name; $key; $modifier) - OBJECT SET VALUE:C1742(This:C1470.name; $1) + return This:C1470 - $0:=This:C1470 + //MARK:-[Help] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get helpTip() : Text -/*══════════════════════════*/ -Function clear - var $0 : Object + return OBJECT Get help tip:C1182(*; This:C1470.name) - var $l : Integer + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set helpTip($helpTip : Text) - If (This:C1470.assignable) - - CLEAR VARIABLE:C89((This:C1470.pointer)->) - - Else - - If (This:C1470.dataSource#Null:C1517) - - $l:=Value type:C1509(This:C1470.getValue()) - - Case of - - //______________________________________________________ - : ($l=Is text:K8:3) - - EXECUTE FORMULA:C63(This:C1470.dataSource+":=\"\"") - - //______________________________________________________ - : ($l=Is real:K8:4)\ - | ($l=Is longint:K8:6) - - EXECUTE FORMULA:C63(This:C1470.dataSource+":=0") - - //______________________________________________________ - : ($l=Is boolean:K8:9) - - EXECUTE FORMULA:C63(This:C1470.dataSource+":=:C215") - - //______________________________________________________ - : ($l=Is date:K8:7) - - EXECUTE FORMULA:C63(This:C1470.dataSource+":=:C102(\"\")") - - //______________________________________________________ - : ($l=Is time:K8:8) - - EXECUTE FORMULA:C63(This:C1470.dataSource+":=:C179(0)") - - //______________________________________________________ - : ($l=Is object:K8:27) - - EXECUTE FORMULA:C63(This:C1470.dataSource+":=null") - - //______________________________________________________ - : ($l=Is picture:K8:10) - - EXECUTE FORMULA:C63(This:C1470.dataSource+":="+This:C1470.dataSource+"*0") - - //______________________________________________________ - Else - - EXECUTE FORMULA:C63(This:C1470.dataSource+":=null") - - //______________________________________________________ - End case - End if - End if + This:C1470.setHelpTip($helpTip) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function getHelpTip() : Text + + return OBJECT Get help tip:C1182(*; This:C1470.name) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setHelpTip($helpTip : Text) : cs:C1710.widget + + OBJECT SET HELP TIP:C1181(*; This:C1470.name; This:C1470._getLocalizeString($helpTip)) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function removeHelpTip() : cs:C1710.widget + + OBJECT SET HELP TIP:C1181(*; This:C1470.name; "") + + return This:C1470 + + //MARK:-[Events] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get events() : Collection + + return This:C1470._events#Null:C1517 ? This:C1470._events : [] + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set events($events) + + This:C1470._setEvents($events; Enable events disable others:K42:37) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function addEvent($events) : cs:C1710.widget + + This:C1470._setEvents($events; Enable events others unchanged:K42:38) + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function removeEvent($events) : cs:C1710.widget - $0:=This:C1470 + This:C1470._setEvents($events; Disable events others unchanged:K42:39) + return This:C1470 -/*══════════════════════════*/ -Function touch + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setEvents($events) : cs:C1710.widget - If (This:C1470.assignable) + This:C1470._setEvents($events; Enable events disable others:K42:37) + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function catch($e; $events) : Boolean + + var $catch : Boolean + + If (Asserted:C1132(This:C1470.type#-1; Current method name:C684+" does not apply to a group")) - (This:C1470.pointer)->:=(This:C1470.pointer)-> + $e:=(($e=Null:C1517) || (Value type:C1509($e)#Is object:K8:27)) ? FORM Event:C1606 : $e - Else + $catch:=(This:C1470.name=$e.objectName) - EXECUTE FORMULA:C63(This:C1470.dataSource+":="+This:C1470.dataSource) + Case of + + //______________________________________________________ + : (Not:C34($catch)) + + //______________________________________________________ + : (This:C1470._events.length>0) + + $catch:=(This:C1470._events.includes($e.code)) + + //______________________________________________________ + : (Count parameters:C259>=2) && (Value type:C1509($events)=Is collection:K8:32) // Old mechanism [COMPATIBILITY] + + $catch:=($events.includes($e.code)) + + //______________________________________________________ + : (Count parameters:C259>=2) && (Value type:C1509($events)=Is integer:K8:5) // Old mechanism [COMPATIBILITY] + + $catch:=($e.code=Num:C11($events)) + + //______________________________________________________ + : (Count parameters:C259=1) && (Value type:C1509($e)=Is text:K8:3) // Old mechanism [COMPATIBILITY] + + $catch:=(This:C1470.name=String:C10($e)) + + //______________________________________________________ + End case + End if + + If ($catch) + If (This:C1470._callback#Null:C1517) + + This:C1470._callback.call() + + End if End if -/*══════════════════════════*/ -Function catch - var $0 : Boolean - var $1 : Variant + return $catch - var $e : Object + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function _setEvents($events; $mode : Integer) - If (Asserted:C1132(This:C1470.type#-1; "Does not apply to a group")) - - If (Count parameters:C259=0) + ARRAY LONGINT:C221($eventCodes; 0x0000) + + This:C1470._events:=This:C1470._events || [] + + Case of + + //______________________________________________________ + : ($events=Null:C1517) - $e:=FORM Event:C1606 - $0:=(This:C1470.name=$e.objectName) + return + //______________________________________________________ + : (Value type:C1509($events)=Is collection:K8:32) + + COLLECTION TO ARRAY:C1562($events; $eventCodes) + OBJECT SET EVENTS:C1239(*; This:C1470.name; $eventCodes; $mode) + This:C1470._events.combine($events) + + //______________________________________________________ + : (Value type:C1509($events)=Is integer:K8:5)\ + | (Value type:C1509($events)=Is longint:K8:6)\ + | (Value type:C1509($events)=Is real:K8:4) + + APPEND TO ARRAY:C911($eventCodes; $events) + OBJECT SET EVENTS:C1239(*; This:C1470.name; $eventCodes; $mode) + This:C1470._events.combine([$events]) + + //______________________________________________________ Else - If (Value type:C1509($1)=Is object:K8:27) - - $e:=$1 - $0:=(This:C1470.name=String:C10($1.objectName)) - - Else - - $0:=(This:C1470.name=String:C10($1)) - - End if - End if + ASSERT:C1129(False:C215; "The event parameter must be an number or a collection") + + //______________________________________________________ + End case + +/* 📌 Update widget events +The arrEvents array is returned empty if no object method is associated with the object +or if no form method is associated with the form. +*/ + OBJECT GET EVENTS:C1238(*; This:C1470.name; $eventCodes) + var $c : Collection + $c:=[] + ARRAY TO COLLECTION:C1563($c; $eventCodes) + This:C1470._events.combine($c) + + //mark:-[Attached data] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== + /// Returns the user data attached to the widget +Function get data() : Variant + + return This:C1470._data + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> + /// Defines the user data attached to the widget +Function set data($data) + + This:C1470._data:=$data + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setData($o : Object) + + var $t : Text + + This:C1470._data:=This:C1470._data || {} + + For each ($t; $o) - //If ($0) & (This.events.length>0) - //var $l : Integer - //For each ($l; This.events) Until ($0) - //$0:=$0 & ($e.code=$l) - //End for each - //End if + This:C1470._data[$t]:=$o[$t] - End if + End for each + //mark:-[Drag & drop] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== + // Defines the uri associated with the widget +Function get uri() : Text -/*══════════════════════════ -.getHelpTip() -> text -══════════════════════════*/ -Function getHelpTip - var $0 : Text + return This:C1470._uri - $0:=OBJECT Get help tip:C1182(*; This:C1470.name) + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> + // Returns the uri associated with the widget +Function set uri($uri : Text) -/*══════════════════════════ -.setHelpTip(text) -> This -══════════════════════════*/ -Function setHelpTip - var $0 : Object - var $1 : Text + This:C1470._uri:=$uri - var $t : Text + //mark:-[Actions] + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get draggable() : Boolean - $t:=Get localized string:C991($1) - $t:=Choose:C955(Length:C16($t)>0; $t; $1) // Revert if no localization + var $automaticDrag; $automaticDrop; $draggable; $droppable : Boolean - OBJECT SET HELP TIP:C1181(*; This:C1470.name; $t) + OBJECT GET DRAG AND DROP OPTIONS:C1184(*; This:C1470.name; $draggable; $automaticDrag; $droppable; $automaticDrop) - $0:=This:C1470 + return $draggable -/*════════════════════════════════════════════*/ -Function getShortcut - var $0 : Object + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set draggable($on : Boolean) - var $t : Text - var $l : Integer + var $automaticDrag; $automaticDrop; $draggable; $droppable : Boolean - OBJECT GET SHORTCUT:C1186(*; This:C1470.name; $t; $l) + OBJECT GET DRAG AND DROP OPTIONS:C1184(*; This:C1470.name; $draggable; $automaticDrag; $droppable; $automaticDrop) + OBJECT SET DRAG AND DROP OPTIONS:C1183(*; This:C1470.name; $on; $automaticDrag; $droppable; $automaticDrop) - $0:=New object:C1471(\ - "key"; $t; \ - "modifier"; $l) + // <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== <== +Function get droppable() : Boolean -/*════════════════════════════════════════════*/ -Function setShortcut - var $0 : Object - var $1 : Text - var $2 : Integer + var $automaticDrag; $automaticDrop; $draggable; $droppable : Boolean - If (Count parameters:C259>=2) - - OBJECT SET SHORTCUT:C1185(*; This:C1470.name; $1; $2) - - Else + OBJECT GET DRAG AND DROP OPTIONS:C1184(*; This:C1470.name; $draggable; $automaticDrag; $droppable; $automaticDrop) + + return $droppable + + // ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> ==> +Function set droppable($on : Boolean) + + var $automaticDrag; $automaticDrop; $draggable; $droppable : Boolean + + OBJECT GET DRAG AND DROP OPTIONS:C1184(*; This:C1470.name; $draggable; $automaticDrag; $droppable; $automaticDrop) + OBJECT SET DRAG AND DROP OPTIONS:C1183(*; This:C1470.name; $draggable; $automaticDrag; $on; $automaticDrop) + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setDraggable($enabled : Boolean; $automatic : Boolean) : cs:C1710.widget + + var $automaticDrag; $automaticDrop; $draggable; $droppable : Boolean + + OBJECT GET DRAG AND DROP OPTIONS:C1184(*; This:C1470.name; $draggable; $automaticDrag; $droppable; $automaticDrop) + + Case of + + //______________________________________________________ + : (Count parameters:C259>=2) + + $draggable:=$enabled + $automaticDrag:=$automatic + + //______________________________________________________ + : (Count parameters:C259>=1) + + $draggable:=$enabled + $automaticDrag:=False:C215 + + //______________________________________________________ + Else + + $draggable:=True:C214 + $automaticDrag:=False:C215 + + //______________________________________________________ + End case + + OBJECT SET DRAG AND DROP OPTIONS:C1183(*; This:C1470.name; $draggable; $automaticDrag; $droppable; $automaticDrop) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setNotDraggable() : cs:C1710.widget + + var $automaticDrag; $automaticDrop; $draggable; $droppable : Boolean + + OBJECT GET DRAG AND DROP OPTIONS:C1184(*; This:C1470.name; $draggable; $automaticDrag; $droppable; $automaticDrop) + OBJECT SET DRAG AND DROP OPTIONS:C1183(*; This:C1470.name; False:C215; False:C215; $droppable; $automaticDrop) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setDroppable($enabled : Boolean; $automatic : Boolean) : cs:C1710.widget + + var $automaticDrag; $automaticDrop; $draggable; $droppable : Boolean + + OBJECT GET DRAG AND DROP OPTIONS:C1184(*; This:C1470.name; $draggable; $automaticDrag; $droppable; $automaticDrop) + + Case of + + //______________________________________________________ + : (Count parameters:C259>=2) + + $droppable:=$enabled + $automaticDrop:=$automatic + + //______________________________________________________ + : (Count parameters:C259>=1) + + $droppable:=$enabled + $automaticDrop:=False:C215 + + //______________________________________________________ + Else + + $droppable:=True:C214 + $automaticDrop:=False:C215 + + //______________________________________________________ + End case + + OBJECT SET DRAG AND DROP OPTIONS:C1183(*; This:C1470.name; $draggable; $automaticDrag; $droppable; $automaticDrop) + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setNotDroppable() : cs:C1710.widget + + var $automaticDrag; $automaticDrop; $draggable; $droppable : Boolean + + OBJECT GET DRAG AND DROP OPTIONS:C1184(*; This:C1470.name; $draggable; $automaticDrag; $droppable; $automaticDrop) + OBJECT SET DRAG AND DROP OPTIONS:C1183(*; This:C1470.name; $draggable; $automaticDrag; False:C215; False:C215) + + return This:C1470 + + // MARK:-[Callback] + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function setCallback($formula) : cs:C1710.widget + + Case of + + //______________________________________________________ + : (Value type:C1509($formula)=Is object:K8:27) + + If (Asserted:C1132(OB Instance of:C1731($formula; 4D:C1709.Function); "The formula parameter must be a 4D.Function")) + + This:C1470._callback:=$formula + + End if + + //______________________________________________________ + : (Value type:C1509($formula)=Is text:K8:3) + + // Remaps, if necessary, into the class of the current form + // If formula string is "This.xxx" or ".xxx" + + $formula:=Position:C15("this"; $formula)=1 ? Delete string:C232($formula; 1; 4) : $formula + + If (Position:C15("."; $formula)=1) + + This:C1470._callback:=Formula from string:C1601("Form:C1466.__DIALOG__"+String:C10($formula)) + + Else + + This:C1470._callback:=Formula from string:C1601(String:C10($formula)) + + End if + + //______________________________________________________ + Else + + ASSERT:C1129(False:C215; "The formula parameter must be a 4D.Function or a Text formula") + + //______________________________________________________ + End case + + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function execute() + + If (Asserted:C1132(This:C1470._callback#Null:C1517; "No callback method define")) - OBJECT SET SHORTCUT:C1185(*; This:C1470.name; $1) + This:C1470._callback.call() End if - $0:=This:C1470 - -/*════════════════════════════════════════════*/ -Function focus - var $0 : Object + // MARK:-[Miscellaneous] + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function focus() : cs:C1710.widget GOTO OBJECT:C206(*; This:C1470.name) - $0:=This:C1470 + return This:C1470 + + // === === === === === === === === === === === === === === === === === === === === === === === === === === +Function isFocused() : Boolean -/*════════════════════════════════════════════*/ \ No newline at end of file + return OBJECT Get name:C1087(Object with focus:K67:3)=This:C1470.name + \ No newline at end of file diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/Colonne2.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/Colonne2.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/Colonne2.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/Colonne2.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/NotInArray_14.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/NotInArray_14.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/NotInArray_14.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/NotInArray_14.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/NotInArray_15.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/NotInArray_15.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/NotInArray_15.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/NotInArray_15.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/NotInArray_2.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/NotInArray_2.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/NotInArray_2.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/NotInArray_2.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/NotInArray_8.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/NotInArray_8.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/NotInArray_8.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/NotInArray_8.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/_10.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_10.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/_10.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_10.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/_11.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_11.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/_11.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_11.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/_12.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_12.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/_12.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_12.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/_13.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_13.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/_13.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_13.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/_3.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_3.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/_3.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_3.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/_4.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_4.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/_4.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_4.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/_6.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_6.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/_6.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_6.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/_9.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_9.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/_9.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/_9.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/array.NotParameter.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/array.NotParameter.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/array.NotParameter.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/array.NotParameter.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/automatic_font.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/automatic_font.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/automatic_font.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/automatic_font.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/b.ok.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/b.ok.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/b.ok.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/b.ok.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/b.options.escape.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/b.options.escape.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/b.options.escape.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/b.options.escape.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/b.options.hmove.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/b.options.hmove.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/b.options.hmove.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/b.options.hmove.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/b.options.ok.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/b.options.ok.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/b.options.ok.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/b.options.ok.4dm diff --git a/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/list.hresize.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/list.hresize.4dm new file mode 100644 index 0000000..d5a30dd --- /dev/null +++ b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/list.hresize.4dm @@ -0,0 +1,157 @@ +_O_C_LONGINT:C283($Lon_error; $Lon_formEvent; $Lon_i; $Lon_reference; $Lon_styles; $Lon_type) +_O_C_LONGINT:C283($Lst_variables) +_O_C_TEXT:C284($Mnu_context; $Txt_buffer; $Txt_label; $Txt_pattern) + +$Lon_formEvent:=Form event code:C388 +$Lst_variables:=Self:C308-> + +Case of + //______________________________________________________ + : ($Lon_formEvent=On Selection Change:K2:29) + + Form:C1466.refresh() + + //______________________________________________________ + : ($Lon_formEvent=On Double Clicked:K2:5) + + GET LIST ITEM PARAMETER:C985($Lst_variables; *; "type"; $Lon_type) + + If ($Lon_type<1000) + + EDIT ITEM:C870(*; OBJECT Get name:C1087(Object current:K67:2)) + + End if + + //______________________________________________________ + : (Contextual click:C713) + + If (Contextual click:C713) + + $Mnu_context:=Create menu:C408 + + APPEND MENU ITEM:C411($Mnu_context; "Renommer") + SET MENU ITEM PARAMETER:C1004($Mnu_context; -1; "rename") + GET LIST ITEM PARAMETER:C985($Lst_variables; *; "type"; $Lon_type) + + If ($Lon_type>=1000) + + DISABLE MENU ITEM:C150($Mnu_context; -1) + + End if + + APPEND MENU ITEM:C411($Mnu_context; "-") + + APPEND MENU ITEM:C411($Mnu_context; "Effacer") + SET MENU ITEM PARAMETER:C1004($Mnu_context; -1; "erase") + + $Txt_buffer:=Dynamic pop up menu:C1006($Mnu_context) + RELEASE MENU:C978($Mnu_context) + + Case of + //______________________________________________________ + : ($Txt_buffer="rename") + + EDIT ITEM:C870(*; OBJECT Get name:C1087(Object current:K67:2)) + + //______________________________________________________ + : ($Txt_buffer="erase") + + SET LIST ITEM PARAMETER:C986($Lst_variables; *; "type"; 0) + + Form:C1466.refresh() + + //______________________________________________________ + End case + + End if + + //______________________________________________________ + : ($Lon_formEvent=On Data Change:K2:15) + + GET LIST ITEM:C378($Lst_variables; *; $Lon_reference; $Txt_label) + + If (_o_Rgx_MatchText("^\\$[\\w\\d\\s]{1,31}$"; $Txt_label)=-1) + + ALERT:C41(Localized string:C991("DeclarationtheNameOfALocalVariableAlwaysStartsWithADollarSign")) + + Else + + GET LIST ITEM PARAMETER:C985($Lst_variables; $Lon_reference; "name"; $Txt_buffer) + + If ($Txt_label#$Txt_buffer) | (Position:C15($Txt_label; $Txt_buffer; *)#1) + + //Look if a variable with the same name already exist + ARRAY LONGINT:C221($tLon_buffer; 0x0000) + $tLon_buffer{0}:=Find in list:C952($Lst_variables; $Txt_label; 0; $tLon_buffer; *) + + OK:=Num:C11(Size of array:C274($tLon_buffer)=1) + + If (OK=0) //If yes: confirm + + CONFIRM:C162(Localized string:C991("DeclarationthisVariableIsAlreadyUsedInThisMethod")) + + If (OK=1) //If OK: delete other occurrences + + For ($Lon_i; 1; Size of array:C274($tLon_buffer); 1) + + If ($tLon_buffer{$Lon_i}#$Lon_reference) + + DELETE FROM LIST:C624($Lst_variables; $tLon_buffer{$Lon_i}) + + End if + End for + End if + End if + + If (OK=1) + + //This pattern don't replace in the comments + //Turn around ACI0078383 { + //$Txt_pattern:="(?tTxt_lines); 1) + + $Lon_error:=_o_Rgx_SubstituteText($Txt_pattern; $Txt_label; -><>tTxt_lines{$Lon_i}) + + End for + + SET LIST ITEM PARAMETER:C986($Lst_variables; $Lon_reference; "name"; $Txt_label) + + //Determine the variable's type + $Lon_type:=Private_Lon_Declaration_Type($Txt_label) + SET LIST ITEM PARAMETER:C986($Lst_variables; $Lon_reference; "type"; $Lon_type) + + Case of + + //-------------------------------------- + : ($Lon_type>100) + + $Lon_type:=$Lon_type-100 + $Lon_styles:=Bold:K14:2+Underline:K14:4 + + //-------------------------------------- + : ($Lon_type=0) + + $Lon_styles:=Italic:K14:3 + + //-------------------------------------- + Else + + $Lon_styles:=Bold:K14:2 + + //-------------------------------------- + End case + + SET LIST ITEM PROPERTIES:C386($Lst_variables; $Lon_reference; False:C215; $Lon_styles; "path:/RESOURCES/Images/types/field_"+String:C10($Lon_type)+".png") + + Form:C1466.refresh() + + End if + End if + End if + + //______________________________________________________ +End case \ No newline at end of file diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/oneLinePerVariable.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/oneLinePerVariable.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/oneLinePerVariable.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/oneLinePerVariable.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/var.NotParameter.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/var.NotParameter.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/ObjectMethods/var.NotParameter.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/ObjectMethods/var.NotParameter.4dm diff --git a/Project/Sources/Forms/DECLARATIONS/form.4DForm b/Project/Sources/Forms/BINARY_DECLARATIONS/form.4DForm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/form.4DForm rename to Project/Sources/Forms/BINARY_DECLARATIONS/form.4DForm diff --git a/Project/Sources/Forms/DECLARATIONS/method.4dm b/Project/Sources/Forms/BINARY_DECLARATIONS/method.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Forms/DECLARATIONS/method.4dm rename to Project/Sources/Forms/BINARY_DECLARATIONS/method.4dm diff --git a/Project/Sources/Forms/NEW_DECLARATION/form.4DForm b/Project/Sources/Forms/DECLARATION/form.4DForm old mode 100755 new mode 100644 similarity index 98% rename from Project/Sources/Forms/NEW_DECLARATION/form.4DForm rename to Project/Sources/Forms/DECLARATION/form.4DForm index a75806d..8a2f552 --- a/Project/Sources/Forms/NEW_DECLARATION/form.4DForm +++ b/Project/Sources/Forms/DECLARATION/form.4DForm @@ -358,10 +358,10 @@ "left": 19, "width": 431, "height": 1, - "stroke": "#c0c0c0", "startPoint": "bottomLeft", "sizingX": "grow", - "sizingY": "move" + "sizingY": "move", + "stroke": "#c0c0c0" }, "array": { "type": "checkbox", @@ -388,10 +388,10 @@ "left": 335, "width": 115, "height": 0, - "stroke": "#c0c0c0", "startPoint": "topLeft", "sizingX": "move", - "sizingY": "fixed" + "sizingY": "fixed", + "stroke": "#c0c0c0" }, "Line2": { "type": "line", @@ -399,10 +399,10 @@ "left": 335, "width": 115, "height": 0, - "stroke": "#c0c0c0", "startPoint": "topLeft", "sizingX": "move", - "sizingY": "fixed" + "sizingY": "fixed", + "stroke": "#c0c0c0" }, "filter": { "type": "button", @@ -431,7 +431,6 @@ "borderStyle": "none", "fill": "transparent", "fontStyle": "italic", - "stroke": "#c0c0c0", "fontSize": 12, "sizingY": "move", "sizingX": "grow", diff --git a/Project/Sources/Forms/NEW_DECLARATION/method.4dm b/Project/Sources/Forms/DECLARATION/method.4dm old mode 100755 new mode 100644 similarity index 99% rename from Project/Sources/Forms/NEW_DECLARATION/method.4dm rename to Project/Sources/Forms/DECLARATION/method.4dm index 6d1775d..8b6282a --- a/Project/Sources/Forms/NEW_DECLARATION/method.4dm +++ b/Project/Sources/Forms/DECLARATION/method.4dm @@ -6,8 +6,7 @@ Case of //–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––– : ($e.code=On Load:K2:1) - var $c : Collection - $c:=New collection:C1472 + var $c : Collection:=[] Form:C1466.boolean:=cs:C1710.button.new("boolean").highlightShortcut().bestSize() $c.push(Form:C1466.boolean) Form:C1466.blob:=cs:C1710.button.new("blob").highlightShortcut().bestSize() diff --git a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/list.hresize.4dm b/Project/Sources/Forms/DECLARATIONS/ObjectMethods/list.hresize.4dm deleted file mode 100755 index dffaf93..0000000 --- a/Project/Sources/Forms/DECLARATIONS/ObjectMethods/list.hresize.4dm +++ /dev/null @@ -1,157 +0,0 @@ -C_LONGINT:C283($Lon_error;$Lon_formEvent;$Lon_i;$Lon_reference;$Lon_styles;$Lon_type) -C_LONGINT:C283($Lst_variables) -C_TEXT:C284($Mnu_context;$Txt_buffer;$Txt_label;$Txt_pattern) - -$Lon_formEvent:=Form event code:C388 -$Lst_variables:=Self:C308-> - -Case of - //______________________________________________________ - : ($Lon_formEvent=On Selection Change:K2:29) - - Form:C1466.refresh() - - //______________________________________________________ - : ($Lon_formEvent=On Double Clicked:K2:5) - - GET LIST ITEM PARAMETER:C985($Lst_variables;*;"type";$Lon_type) - - If ($Lon_type<1000) - - EDIT ITEM:C870(*;OBJECT Get name:C1087(Object current:K67:2)) - - End if - - //______________________________________________________ - : (Contextual click:C713) - - If (Contextual click:C713) - - $Mnu_context:=Create menu:C408 - - APPEND MENU ITEM:C411($Mnu_context;"Renommer") - SET MENU ITEM PARAMETER:C1004($Mnu_context;-1;"rename") - GET LIST ITEM PARAMETER:C985($Lst_variables;*;"type";$Lon_type) - - If ($Lon_type>=1000) - - DISABLE MENU ITEM:C150($Mnu_context;-1) - - End if - - APPEND MENU ITEM:C411($Mnu_context;"-") - - APPEND MENU ITEM:C411($Mnu_context;"Effacer") - SET MENU ITEM PARAMETER:C1004($Mnu_context;-1;"erase") - - $Txt_buffer:=Dynamic pop up menu:C1006($Mnu_context) - RELEASE MENU:C978($Mnu_context) - - Case of - //______________________________________________________ - : ($Txt_buffer="rename") - - EDIT ITEM:C870(*;OBJECT Get name:C1087(Object current:K67:2)) - - //______________________________________________________ - : ($Txt_buffer="erase") - - SET LIST ITEM PARAMETER:C986($Lst_variables;*;"type";0) - - Form:C1466.refresh() - - //______________________________________________________ - End case - - End if - - //______________________________________________________ - : ($Lon_formEvent=On Data Change:K2:15) - - GET LIST ITEM:C378($Lst_variables;*;$Lon_reference;$Txt_label) - - If (Rgx_MatchText ("^\\$[\\w\\d\\s]{1,31}$";$Txt_label)=-1) - - ALERT:C41(Get localized string:C991("DeclarationtheNameOfALocalVariableAlwaysStartsWithADollarSign")) - - Else - - GET LIST ITEM PARAMETER:C985($Lst_variables;$Lon_reference;"name";$Txt_buffer) - - If ($Txt_label#$Txt_buffer) | (Position:C15($Txt_label;$Txt_buffer;*)#1) - - //Look if a variable with the same name already exist - ARRAY LONGINT:C221($tLon_buffer;0x0000) - $tLon_buffer{0}:=Find in list:C952($Lst_variables;$Txt_label;0;$tLon_buffer;*) - - OK:=Num:C11(Size of array:C274($tLon_buffer)=1) - - If (OK=0) //If yes: confirm - - CONFIRM:C162(Get localized string:C991("DeclarationthisVariableIsAlreadyUsedInThisMethod")) - - If (OK=1) //If OK: delete other occurrences - - For ($Lon_i;1;Size of array:C274($tLon_buffer);1) - - If ($tLon_buffer{$Lon_i}#$Lon_reference) - - DELETE FROM LIST:C624($Lst_variables;$tLon_buffer{$Lon_i}) - - End if - End for - End if - End if - - If (OK=1) - - //This pattern don't replace in the comments - //Turn around ACI0078383 { - //$Txt_pattern:="(?tTxt_lines);1) - - $Lon_error:=Rgx_SubstituteText ($Txt_pattern;$Txt_label;-><>tTxt_lines{$Lon_i}) - - End for - - SET LIST ITEM PARAMETER:C986($Lst_variables;$Lon_reference;"name";$Txt_label) - - //Determine the variable's type - $Lon_type:=Private_Lon_Declaration_Type ($Txt_label) - SET LIST ITEM PARAMETER:C986($Lst_variables;$Lon_reference;"type";$Lon_type) - - Case of - - //-------------------------------------- - : ($Lon_type>100) - - $Lon_type:=$Lon_type-100 - $Lon_styles:=Bold:K14:2+Underline:K14:4 - - //-------------------------------------- - : ($Lon_type=0) - - $Lon_styles:=Italic:K14:3 - - //-------------------------------------- - Else - - $Lon_styles:=Bold:K14:2 - - //-------------------------------------- - End case - - SET LIST ITEM PROPERTIES:C386($Lst_variables;$Lon_reference;False:C215;$Lon_styles;"path:/RESOURCES/Images/types/field_"+String:C10($Lon_type)+".png") - - Form:C1466.refresh() - - End if - End if - End if - - //______________________________________________________ -End case \ No newline at end of file diff --git a/Project/Sources/Methods/00_convertComments.4dm b/Project/Sources/Methods/00_convertComments.4dm index 72a143e..6792f8a 100755 --- a/Project/Sources/Methods/00_convertComments.4dm +++ b/Project/Sources/Methods/00_convertComments.4dm @@ -1,47 +1,47 @@ //%attributes = {"invisible":true,"preemptive":"incapable"} -C_LONGINT:C283($l) -C_TEXT:C284($kTxt_separator;$t;$tComment;$tContent;$tMarkDown;$tPlainText) -C_TEXT:C284($tSyntax) -C_OBJECT:C1216($folderTarget;$o) +_O_C_LONGINT:C283($l) +_O_C_TEXT:C284($kTxt_separator; $t; $tComment; $tContent; $tMarkDown; $tPlainText) +_O_C_TEXT:C284($tSyntax) +_O_C_OBJECT:C1216($folderTarget; $o) -$t:=Select folder:C670("Select the comment folder";8858) +$t:=Select folder:C670("Select the comment folder"; 8858) $kTxt_separator:="\r________________________________________________________\r" If (OK=1) - $folderTarget:=Folder:C1567($t;fk platform path:K87:2).parent.folder("Methods") + $folderTarget:=Folder:C1567($t; fk platform path:K87:2).parent.folder("Methods") $folderTarget.create() - For each ($o;Folder:C1567($t;fk platform path:K87:2).files()) + For each ($o; Folder:C1567($t; fk platform path:K87:2).files()) CLEAR VARIABLE:C89($tSyntax) $tContent:=$o.getText() $tPlainText:=ST Get plain text:C1092($tContent) - $l:=Position:C15($kTxt_separator;$tPlainText) + $l:=Position:C15($kTxt_separator; $tPlainText) If ($l>0) - // Extract syntax - $tSyntax:=Substring:C12($tPlainText;1;$l-1) + // Extract syntax + $tSyntax:=Substring:C12($tPlainText; 1; $l-1) - // Extract description - $tComment:=Delete string:C232($tPlainText;1;$l+Length:C16($kTxt_separator)-1) + // Extract description + $tComment:=Delete string:C232($tPlainText; 1; $l+Length:C16($kTxt_separator)-1) Else - // Compatibility with older versions of separator - $l:=Position:C15("\r-\r";$tPlainText) + // Compatibility with older versions of separator + $l:=Position:C15("\r-\r"; $tPlainText) If ($l>0) - // Extract syntax - $tSyntax:=Substring:C12($tPlainText;1;$l-1) + // Extract syntax + $tSyntax:=Substring:C12($tPlainText; 1; $l-1) - // Extract description - $tComment:=Delete string:C232($tPlainText;1;$l+2) + // Extract description + $tComment:=Delete string:C232($tPlainText; 1; $l+2) Else @@ -50,16 +50,16 @@ If (OK=1) End if End if - // Method names in bold - Rgx_SubstituteText ("(?m-si)\\s*((?:\\d*\\w*_)+\\w*)\\s*";" **\\1** ";->$tComment;0) + // Method names in bold + _o_Rgx_SubstituteText("(?m-si)\\s*((?:\\d*\\w*_)+\\w*)\\s*"; " **\\1** "; ->$tComment; 0) - // Special characters - $tComment:=Replace string:C233($tComment;"<";"<") - $tComment:=Replace string:C233($tComment;">";">") - $tComment:=Replace string:C233($tComment;"_";"\\_") + // Special characters + $tComment:=Replace string:C233($tComment; "<"; "<") + $tComment:=Replace string:C233($tComment; ">"; ">") + $tComment:=Replace string:C233($tComment; "_"; "\\_") - // Carriage erturn - $tComment:=Replace string:C233($tComment;"\r";"\r
") + // Carriage erturn + $tComment:=Replace string:C233($tComment; "\r"; "\r
") $tMarkDown:="\n## Description\n"+$tComment diff --git a/Project/Sources/Methods/00_test_Dot_Notation.4dm b/Project/Sources/Methods/00_test_Dot_Notation.4dm index c736d10..3b16e33 100755 --- a/Project/Sources/Methods/00_test_Dot_Notation.4dm +++ b/Project/Sources/Methods/00_test_Dot_Notation.4dm @@ -1,33 +1,33 @@ //%attributes = {"invisible":true,"preemptive":"capable"} -C_BOOLEAN:C305($Boo_) -C_TEXT:C284($Txt_buffer;$Txt_referenceLanguage) -C_OBJECT:C1216($Obj_) +var $Boo_ : Boolean +var $Txt_buffer; $Txt_referenceLanguage : Text +var $Obj_ : Object -$Txt_referenceLanguage:=OB Get:C1224($Obj_;"reference";Is text:K8:3) +$Txt_referenceLanguage:=OB Get:C1224($Obj_; "reference"; Is text:K8:3) $Obj_:=New object:C1471 $Obj_.$test:=$Txt_buffer -OB SET:C1220($Obj_;\ -"$test";"hello") -OB SET:C1220($Obj_;\ -"is-compilable";False:C215) -OB SET:C1220($Obj_;\ -"$test";"hello") -OB SET:C1220($Obj_;\ -"is-compilable";False:C215) -OB SET:C1220($Obj_;\ -"test";"hello";\ -"test2";"world") +OB SET:C1220($Obj_; \ +"$test"; "hello") +OB SET:C1220($Obj_; \ +"is-compilable"; False:C215) +OB SET:C1220($Obj_; \ +"$test"; "hello") +OB SET:C1220($Obj_; \ +"is-compilable"; False:C215) +OB SET:C1220($Obj_; \ +"test"; "hello"; \ +"test2"; "world") $Txt_buffer:=$Obj_.test - //$Txt_buffer:=$Obj_.is-compilable - //$Txt_buffer:=$Obj_.not-compilable +//$Txt_buffer:=$Obj_.is-compilable +//$Txt_buffer:=$Obj_.not-compilable $Txt_buffer:=$Obj_.$test $Txt_buffer:=$Obj_.not_compilable $Boo_:=($Obj_.compilable#Null:C1517) -$Boo_:=OB Is defined:C1231($Obj_;"compilable") -$Boo_:=OB Is defined:C1231($Obj_;"is-compilable") -$Boo_:=OB Is defined:C1231($Obj_;"not-compilable") -$Boo_:=OB Is defined:C1231($Obj_;"$test") \ No newline at end of file +$Boo_:=OB Is defined:C1231($Obj_; "compilable") +$Boo_:=OB Is defined:C1231($Obj_; "is-compilable") +$Boo_:=OB Is defined:C1231($Obj_; "not-compilable") +$Boo_:=OB Is defined:C1231($Obj_; "$test") \ No newline at end of file diff --git a/Project/Sources/Methods/4DPop_MACROS_INIT.4dm b/Project/Sources/Methods/4DPop_MACROS_INIT.4dm index f5b6f93..5281090 100755 --- a/Project/Sources/Methods/4DPop_MACROS_INIT.4dm +++ b/Project/Sources/Methods/4DPop_MACROS_INIT.4dm @@ -6,10 +6,4 @@ // Description // initialization entry point for 4DPop // ---------------------------------------------------- -// Declarations - -// ---------------------------------------------------- -// Initialisations -Init - -// ---------------------------------------------------- +Init \ No newline at end of file diff --git a/Project/Sources/Methods/4DPop_MACROS_SETTINGS.4dm b/Project/Sources/Methods/4DPop_MACROS_SETTINGS.4dm index 9f0b710..8ec5295 100755 --- a/Project/Sources/Methods/4DPop_MACROS_SETTINGS.4dm +++ b/Project/Sources/Methods/4DPop_MACROS_SETTINGS.4dm @@ -1,8 +1,4 @@ //%attributes = {"invisible":true,"preemptive":"capable"} -C_POINTER:C301($1) - -If (False:C215) - C_POINTER:C301(4DPop_MACROS_SETTINGS; $1) -End if +#DECLARE($ptr : Pointer) CALL WORKER:C1389(1; "SETTINGS") diff --git a/Project/Sources/Methods/4DPop_TEST_Macros.4dm b/Project/Sources/Methods/4DPop_TEST_Macros.4dm index f117fe9..d979f20 100755 --- a/Project/Sources/Methods/4DPop_TEST_Macros.4dm +++ b/Project/Sources/Methods/4DPop_TEST_Macros.4dm @@ -5,13 +5,13 @@ var $t : Text // In compiled mode we propose to create the test method If (Is compiled mode:C492) - ALERT:C41(Get localized string:C991("MessagestoTryANewMacro")) + ALERT:C41(Localized string:C991("MessagestoTryANewMacro")) - CONFIRM:C162(Get localized string:C991("wouldYouWantToCreateThisMethodNow?")) + CONFIRM:C162(Localized string:C991("wouldYouWantToCreateThisMethodNow?")) If (OK=1) - $t:=Get localized string:C991("testMethodForMacros")+Command name:C538(284)+"($Txt_method;$Txt_highlighted)\r\r"+Get localized string:C991("in_txt_methodTheFullMethodContent")+Command name:C538(997)+"(1;$Txt_method)\r\r"+Get localized string:C991("in_txt_highlightedTheHighlightedText")+Command name:C538(997)+"(2;$Txt_highlighted)\r\r" + $t:=Localized string:C991("testMethodForMacros")+Command name:C538(284)+"($Txt_method;$Txt_highlighted)\r\r"+Localized string:C991("in_txt_methodTheFullMethodContent")+Command name:C538(997)+"(1;$Txt_method)\r\r"+Localized string:C991("in_txt_highlightedTheHighlightedText")+Command name:C538(997)+"(2;$Txt_highlighted)\r\r" METHOD SET CODE:C1194("4DPop_TEST_Macros"; $t; *) METHOD SET ATTRIBUTE:C1192("4DPop_TEST_Macros"; Attribute invisible:K72:6; True:C214; *) @@ -50,8 +50,8 @@ Else If ($o.variables.length>0) - $o.formWindow:=Open form window:C675("NEW_DECLARATION"; Movable form dialog box:K39:8; Horizontally centered:K39:1; At the top:K39:5; *) - DIALOG:C40("NEW_DECLARATION"; $o) + $o.formWindow:=Open form window:C675("DECLARATION"; Movable form dialog box:K39:8; Horizontally centered:K39:1; At the top:K39:5; *) + DIALOG:C40("DECLARATION"; $o) If (Bool:C1537(OK)) diff --git a/Project/Sources/Methods/ABOUT.4dm b/Project/Sources/Methods/ABOUT.4dm index a2528b7..2c6a4d5 100755 --- a/Project/Sources/Methods/ABOUT.4dm +++ b/Project/Sources/Methods/ABOUT.4dm @@ -3,26 +3,19 @@ // Method : ABOUT // Created 24/03/06 by Vincent de Lachaux // ---------------------------------------------------- -// Description -// -// ---------------------------------------------------- -C_TEXT:C284($1) - -C_LONGINT:C283($Lon_Bottom; $Lon_Height; $Lon_Left; $Lon_Right; $Lon_Top; $Lon_W) -C_LONGINT:C283($Lon_Width) +#DECLARE($text : Text) -If (False:C215) - C_TEXT:C284(ABOUT; $1) -End if +var $Lon_Bottom; $Lon_Height; $Lon_Left; $Lon_Right; $Lon_Top; $Lon_W : Integer +var $Lon_Width : Integer -C_LONGINT:C283(<>About_Lon_Flip; <>About_Lon_AutoHide; <>About_Lon_Image) -C_TEXT:C284(<>About_Txt_Buffer; <>About_Txt_Macro; <>About_Txt_Displayed) +var <>About_Lon_Flip; <>About_Lon_AutoHide; <>About_Lon_Image : Integer +var <>About_Txt_Buffer; <>About_Txt_Macro; <>About_Txt_Displayed : Text If (Count parameters:C259>0) - If (Length:C16($1)>0) + If (Length:C16($text)>0) - <>About_Lon_AutoHide:=Num:C11($1="AutoHide") + <>About_Lon_AutoHide:=Num:C11($text="AutoHide") End if End if @@ -33,8 +26,8 @@ If (<>About_Lon_AutoHide=0) FORM GET PROPERTIES:C674("ABOUT"; $Lon_Width; $Lon_Height) - $Lon_Left:=$Lon_Left+((($Lon_Right-$Lon_Left)\2)-($Lon_Width\2)) - $Lon_Top:=$Lon_Top+((($Lon_Bottom-$Lon_Top)\3)-($Lon_Height\2)) + $Lon_Left+=((($Lon_Right-$Lon_Left)\2)-($Lon_Width\2)) + $Lon_Top+=((($Lon_Bottom-$Lon_Top)\3)-($Lon_Height\2)) $Lon_W:=Open window:C153($Lon_Left; $Lon_Top; $Lon_Left+$Lon_Width; $Lon_Top+$Lon_Height; Pop up window:K34:14) Else diff --git a/Project/Sources/Methods/BEAUTIFIER_TEST.4dm b/Project/Sources/Methods/BEAUTIFIER_TEST.4dm new file mode 100644 index 0000000..6544abd --- /dev/null +++ b/Project/Sources/Methods/BEAUTIFIER_TEST.4dm @@ -0,0 +1,219 @@ +//%attributes = {"invisible":true} +// MARK: REMOVE EMPTY LINES AT THE BEGIN OF THE METHOD +var $count; $i; $x : Integer +var $Txt; $that : Text +var $b : Boolean + +// MARK: PRESERVE COMMENT BEFORE OPENING +If (True:C214) + + // MARK: A LINE OF COMMENTS MUST BE PRECEDED BY A LINE BREAK + $Txt:="toto" + + //ALL COMMENT WILL BE PRECEDED BY A SPACE AND THE FIRST LETTER WILL BE CAPITALIZED + + Case of + : (True:C214) //"Case of” elements will be preceded by a comment line, according to the level, if it is not already a comment + + Case of + //mark:- DON'T ADD SEPARATOR LINE HERE + : (True:C214) + + If (True:C214) //comment + + If (True:C214) + + For ($i; 1; 10; 1) + + While ($b) + + //comment + $count+=$x + + End while + End for + + // Use ternary operator instead If…Else…End if + $Txt:=$count=1 ? $that : "that" + + // #ACI0097825 + $count:=$b ? 1 : 2 + + End if + End if + : (True:C214) + + Case of + : (True:C214) + + If (True:C214) + + If (True:C214) + + For ($i; 1; 10; 1) +/* + THIS IS A MULTILINES BLOCK + */ + While ($b) + + // mark: THESE + // 3 LINES + // REMAIN GROUPED + $count+=$x +/* A ONE-LINE BLOCK IS CONSIDERED A ONE-LINE COMMENT */ + + End while // GROUPING CLOSURE INSTRUCTIONS BELOW + + End for + + End if + + End if + +/*NOT A BLOCK*/$count:=$count*$i + $count:=True:C214 ? 1 : 2/*NOT A BLOCK*/ + + : (True:C214) + Case of + : (True:C214) + If (True:C214) + If (True:C214) + For ($i; 1; 10; 1) + While ($b) + //comment + $count+=$x + End while + End for + End if + End if + : (True:C214) + $count:=1 + $count:=2 + : (True:C214) + For ($i; 1; 10; 1) + $count:=$count*$i + // mark:SPLIT LITERAL OBJECT WITH MORE THAN 2 MEMBERS + var $o : Object:={hello: "hello"; world: "World"} + + $o:={property1: "value1"; property2: "value2"; property3: "value3"; property4: "value4"; property5: "value5"} + // SAME FOR COLLECTIONS + var $c : Collection:=["hello"; "world"] + + $c:=[1; 2; "hello"; "world"] + + // mark:SPLIT KEY/VALUE COMMANDS + var $root; $node; $xpath : Text + var $pic : Picture + + OB SET:C1220($o; "property"; 0; "property1"; 1; "property2"; 2; "property3"; 3) + + OB SET:C1220($o; "property"; 12-(10*2); "property1"; "value1"; "property2"; "valu2"; "property3"; "value3") // Test2 + + OB SET:C1220($o; "property"; "value"; "property1"; {test: "hello"; test2: "world"}; "property2"; "valu2"; "property3"; "value3") + + OB SET:C1220($o; "property"; "value") + + //OB SET($o; "property"; 0; "property1"; 1; "property2"; 2; "property3"; 3; "zz")/* ERROR IN PARAMETER COUNT */ + + SVG SET ATTRIBUTE:C1055(*; "toto"; "id"; "attribute"; "value"; "attribute1"; "value1"; "attribute2"; "value2") + + SVG SET ATTRIBUTE:C1055($pic; "id"; "attribute"; "value"; "attribute1"; "value1"; "attribute2"; "value2") + + SVG SET ATTRIBUTE:C1055($pic; "id"; "attribute"; "value"; "attribute1"; "value1"; "attribute2"; "value2") // Comment + + SVG SET ATTRIBUTE:C1055(*; "toto"; "id"; "attribute"; "value"; "attribute1"; "value1") + + SVG SET ATTRIBUTE:C1055(*; "toto"; "id"; "attribute"; "value") + + SVG SET ATTRIBUTE:C1055($pic; "id"; "attribute"; "value") // Comment + + DOM SET XML ATTRIBUTE:C866($node; "attribute"; "value"; "attribute1"; "value1"; "attribute2"; "value2") // Comment + + DOM SET XML ATTRIBUTE:C866($node; "attribute"; "value") // Comment + + $node:=DOM Create XML element:C865($root; $xpath; "attribute"; "value"; "attribute1"; "value1"; "attribute2"; "value2") // Comment + + //ST SET ATTRIBUTES(*; "toto"; 10; 20; "attribute"; 0; "attribute1"; 1; "attribute2"; 2) // Comment + + //ST SET ATTRIBUTES($txt; $startSel; $endSel; "attribute"; "value"; "attribute1"; "value1"; "attribute2"; "value2") // Comment + + $o:=New object:C1471("property1"; 1; "property2"; 2) + + $count:=$count*$i + + + + + + //mark:REMOVE THE MULTIPLE EMPTY LINES ABOVE + End for + //BLOCK { + Begin SQL + + SELECT * + FROM _USER_COLUMNS + INTO:test + + End SQL + //} + + Else + + //mark:DELETE THE MULTIPLE EMPTY LINES BELOW + + + + + + var $v + + $v:="" + //mark:OPTIMIZE COMPARISON WITH AN EMPTY STRING + If ($v="") + + End if + End case + : (True:C214) + Try + $x:=1 + Catch + $count:=$count*$i + End try + Else + While ($b) + //%R- + $x:=1 //Don't add line before a closing compiler directive comment + //%R+ + End while + End case + : (True:C214) + For ($i; 1; 10; 1) + $count:=$count*$i + End for + Else + While ($b) + $count+=$x + End while + End case + : (True:C214) + For ($i; 1; 10; 1) + continue + For ($i; 1; 10; 1) + For ($i; 1; 10; 1) + $count:=$count*$i + End for + break + End for + End for + Else + While ($b) + $count+=$x + End while + return + End case +Else + If ((Length:C16($txt)=0) | (Length:C16($txt)#0)) && (True:C214) //SPLIT TEST LINES WITH & AND | + $Txt:="titi" + End if +End if +//mark:REMOVE EMPTY LINES AT THE END OF THE METHOD \ No newline at end of file diff --git a/Project/Sources/Methods/CODE_TO_EXECUTE.4dm b/Project/Sources/Methods/CODE_TO_EXECUTE.4dm index 5ad9d7a..8a85a6f 100755 --- a/Project/Sources/Methods/CODE_TO_EXECUTE.4dm +++ b/Project/Sources/Methods/CODE_TO_EXECUTE.4dm @@ -4,125 +4,97 @@ // ID[AE63DE138BAC461AA60933E0CF35F72A] // Created 08/10/12 by Vincent de Lachaux // ---------------------------------------------------- -// Description: -// -// ---------------------------------------------------- -// Declarations -var $Txt_input; $Txt_line; $Txt_method; $Txt_ouput; $Txt_params; $Txt_pattern : Text -var $Txt_result : Text -var $Boo_params; $Boo_result : Boolean -var $Lon_error; $Lon_i; $Lon_parameters : Integer +var $code; $line; $method; $outpout; $params; $pattern : Text +var $result : Text +var $withParams; $withResult : Boolean +var $error; $i : Integer -// ---------------------------------------------------- -// Initialisations -$Lon_parameters:=Count parameters:C259 +ARRAY TEXT:C222($_lines; 0x0000) +ARRAY TEXT:C222($_controlFlow; 0x0000) +ARRAY TEXT:C222($_extracted; 0x0000; 0x0000) -If (Asserted:C1132($Lon_parameters>=0; "Missing parameter")) - - //NO PARAMETERS REQUIRED - - ARRAY TEXT:C222($tTxt_lines; 0x0000) - ARRAY TEXT:C222($tTxt_controlFlow; 0x0000) - ARRAY TEXT:C222($tTxt_extracted; 0x0000; 0x0000) - - //Commands array { - ARRAY TEXT:C222($tTxt_commands; 0x0000) - Repeat - - $Lon_i:=$Lon_i+1 - $Txt_line:=Command name:C538($Lon_i) - - If (OK=1) - - APPEND TO ARRAY:C911($tTxt_commands; $Txt_line) - - End if - - Until (OK=0) - //} +// Mark:Get the Command names +ARRAY TEXT:C222($_commands; 0x0000) + +Repeat - _o_localizedControlFlow(""; ->$tTxt_controlFlow) + $i+=1 + $line:=Command name:C538($i) - For ($Lon_i; 1; Size of array:C274($tTxt_controlFlow); 1) + If (Bool:C1537(OK)) - APPEND TO ARRAY:C911($tTxt_commands; $tTxt_controlFlow{$Lon_i}) + APPEND TO ARRAY:C911($_commands; $line) - End for - - GET MACRO PARAMETER:C997(Highlighted method text:K5:18; $Txt_input) - - $Lon_error:=Rgx_SplitText("\\r"; $Txt_input; ->$tTxt_lines; 0 ?+ 11) - - $Txt_pattern:="^(?:(.*?):=)?(.*?)(?:\\s*\\(+(.*?)\\))?$" - -Else + End if +Until (OK=0) + +_o_localizedControlFlow(""; ->$_controlFlow) + +For ($i; 1; Size of array:C274($_controlFlow); 1) - ABORT:C156 + APPEND TO ARRAY:C911($_commands; $_controlFlow{$i}) -End if +End for -// ---------------------------------------------------- +GET MACRO PARAMETER:C997(Highlighted method text:K5:18; $code) + +$error:=_o_Rgx_SplitText("\\r"; $code; ->$_lines; 0 ?+ 11) + +$pattern:="^(?:(.*?):=)?(.*?)(?:\\s*\\(+(.*?)\\))?$" -For ($Lon_i; 1; Size of array:C274($tTxt_lines); 1) +For ($i; 1; Size of array:C274($_lines); 1) - $Txt_line:=$tTxt_lines{$Lon_i} + $line:=$_lines{$i} Case of //______________________________________ - : (Length:C16($Txt_line)=0) | ($Txt_line="//@") + : (Length:C16($line)=0)\ + | ($line="//@") - $Txt_ouput:=$Txt_ouput\ - +$Txt_line + $outpout+=$line //______________________________________ Else - $Lon_error:=Rgx_ExtractText($Txt_pattern; $Txt_line; ""; ->$tTxt_extracted) + $error:=_o_Rgx_ExtractText($pattern; $line; ""; ->$_extracted) - If ($Lon_error=0) + If ($error=0) - $Txt_method:=$tTxt_extracted{1}{2} + $method:=$_extracted{1}{2} - If (Find in array:C230($tTxt_commands; $Txt_method)=-1) + If (Find in array:C230($_commands; $method)=-1) - $Txt_result:=$tTxt_extracted{1}{1} - $Boo_result:=(Length:C16($Txt_result)>0) + $result:=$_extracted{1}{1} + $withResult:=(Length:C16($result)>0) - $Txt_params:=$tTxt_extracted{1}{3} - $Boo_params:=(Length:C16($Txt_params)>0) + $params:=$_extracted{1}{3} + $withParams:=(Length:C16($params)>0) - $Txt_ouput:=$Txt_ouput\ - +"//"+$Txt_line\ - +"\r"+$tTxt_commands{1007}\ - +"(\""+$Txt_method+"\""\ - +Choose:C955($Boo_result; ";"+$Txt_result\ - ; Choose:C955($Boo_params; ";*"; ""))\ - +Choose:C955($Boo_params; ";"+$Txt_params; "")\ + $outpout:=$outpout\ + +"//"+$line\ + +"\r"+$_commands{1007}\ + +"(\""+$method+"\""\ + +Choose:C955($withResult; ";"+$result; Choose:C955($withParams; ";*"; ""))+Choose:C955($withParams; ";"+$params; "")\ +")" Else - $Txt_ouput:=$Txt_ouput\ - +$Txt_line + $outpout+=$line End if Else - $Txt_ouput:=$Txt_ouput\ - +$Txt_line + $outpout+=$line End if //______________________________________ End case - $Txt_ouput:=$Txt_ouput+"\r" + $outpout+="\r" End for -SET MACRO PARAMETER:C998(Highlighted method text:K5:18; $Txt_ouput) - -// ---------------------------------------------------- -// End \ No newline at end of file +SET MACRO PARAMETER:C998(Highlighted method text:K5:18; $outpout) \ No newline at end of file diff --git a/Project/Sources/Methods/CODE_TO_EXECUTE_FORMULA.4dm b/Project/Sources/Methods/CODE_TO_EXECUTE_FORMULA.4dm index a79cf0d..7272418 100755 --- a/Project/Sources/Methods/CODE_TO_EXECUTE_FORMULA.4dm +++ b/Project/Sources/Methods/CODE_TO_EXECUTE_FORMULA.4dm @@ -9,8 +9,8 @@ // Modified by vdl (09/10/07) // -> v11 // ---------------------------------------------------- -C_LONGINT:C283($Lon_CommandParameters; $Lon_Error; $Lon_i; $Lon_Lignes; $Lon_Position; $Lon_x) -C_TEXT:C284($Txt_Buffer; $Txt_Code; $Txt_Command) +var $Lon_CommandParameters; $Lon_Error; $Lon_i; $Lon_Lignes; $Lon_Position; $Lon_x : Integer +var $output; $Txt_Code; $Txt_Command : Text ARRAY TEXT:C222($tTxt_Commands; 0) ARRAY TEXT:C222($tTxt_controlFlow; 0) @@ -19,22 +19,22 @@ ARRAY TEXT:C222(<>tTxt_lines; 0) // Si (Private_Boo_INIT ("4D Pack")) -GET MACRO PARAMETER:C997(Highlighted method text:K5:18; $Txt_Buffer) -$Lon_Error:=Rgx_SplitText("\\r"; $Txt_Buffer; -><>tTxt_lines; 0 ?+ 11) -$Txt_Buffer:="" +GET MACRO PARAMETER:C997(Highlighted method text:K5:18; $output) +$Lon_Error:=_o_Rgx_SplitText("\\r"; $output; -><>tTxt_lines; 0 ?+ 11) +$output:="" // Récupérer les noms de commande localisés Repeat - $Lon_i:=$Lon_i+1 - $Txt_Buffer:=Command name:C538($Lon_i) + $Lon_i+=1 + $output:=Command name:C538($Lon_i) If (OK=1) - If (Character code:C91($Txt_Buffer)#At sign:K15:46) + If (Character code:C91($output)#At sign:K15:46) - APPEND TO ARRAY:C911($tTxt_Commands; $Txt_Buffer) + APPEND TO ARRAY:C911($tTxt_Commands; $output) End if End if @@ -122,106 +122,106 @@ For ($Lon_Lignes; 1; Size of array:C274(<>tTxt_lines); 1) Case of - //______________________________________________________ + // ______________________________________________________ : (Length:C16($Txt_Command+$Txt_Code)=0) // Ligne vide - $Txt_Buffer:=$Txt_Buffer+"\r" + $output+="\r" - //______________________________________________________ + // ______________________________________________________ : ($Txt_Command="`@") // Ligne de commentaire If ($Lon_Lignes>1) - $Txt_Buffer:=$Txt_Buffer+"\r" + $output+="\r" End if - $Txt_Buffer:=$Txt_Buffer+$Txt_Command + $output+=$Txt_Command - //______________________________________________________ + // ______________________________________________________ : (Find in array:C230($tTxt_controlFlow; $Txt_Command)>0) // Structure conditionelle If ($Lon_Lignes>1) - $Txt_Buffer:=$Txt_Buffer+"\r" + $output+="\r" End if If (Length:C16(M_4DPop_tTxt_Buffer{0})>0) - $Txt_Buffer:=$Txt_Buffer+M_4DPop_tTxt_Buffer{0}+":=" + $output+=M_4DPop_tTxt_Buffer{0}+":=" End if - $Txt_Buffer:=$Txt_Buffer+$Txt_Command + $output+=$Txt_Command If ($Lon_CommandParameters>0) - $Txt_Buffer:=$Txt_Buffer+"(" + $output+="(" For ($Lon_i; 1; $Lon_CommandParameters; 1) - $Txt_Buffer:=$Txt_Buffer+M_4DPop_tTxt_Buffer{$Lon_i} + $output+=M_4DPop_tTxt_Buffer{$Lon_i} If ($Lon_i<$Lon_CommandParameters) - $Txt_Buffer:=$Txt_Buffer+";" + $output+=";" End if End for - $Txt_Buffer:=$Txt_Buffer+")" + $output+=")" End if - //______________________________________________________ + // ______________________________________________________ Else If ($Lon_Lignes>1) - $Txt_Buffer:=$Txt_Buffer+"\r" + $output+="\r" End if // D'abord la ligne d'origine en commentaires… - $Txt_Buffer:=$Txt_Buffer+"`" + $output+="`" If (Length:C16(M_4DPop_tTxt_Buffer{0})>0) - $Txt_Buffer:=$Txt_Buffer+M_4DPop_tTxt_Buffer{0}+":=" + $output+=M_4DPop_tTxt_Buffer{0}+":=" End if - $Txt_Buffer:=$Txt_Buffer+$Txt_Command + $output+=$Txt_Command If ($Lon_CommandParameters>0) - $Txt_Buffer:=$Txt_Buffer+"(" + $output+="(" For ($Lon_i; 1; $Lon_CommandParameters; 1) - $Txt_Buffer:=$Txt_Buffer+M_4DPop_tTxt_Buffer{$Lon_i} + $output+=M_4DPop_tTxt_Buffer{$Lon_i} If ($Lon_i<$Lon_CommandParameters) - $Txt_Buffer:=$Txt_Buffer+";" + $output+=";" End if End for - $Txt_Buffer:=$Txt_Buffer+")" + $output+=")" End if - $Txt_Buffer:=$Txt_Buffer+"\r" + $output+="\r" - //…Puis appel de la commande EXECUTER - $Txt_Buffer:=$Txt_Buffer+Command name:C538(63)+"(" + // …Puis appel de la commande EXECUTER + $output+=Command name:C538(63)+"(" // Eventuel retour If (Length:C16(M_4DPop_tTxt_Buffer{0})>0) - $Txt_Buffer:=$Txt_Buffer+"\""+M_4DPop_tTxt_Buffer{0}+":=\"+" + $output+="\""+M_4DPop_tTxt_Buffer{0}+":=\"+" End if @@ -230,42 +230,39 @@ For ($Lon_Lignes; 1; Size of array:C274(<>tTxt_lines); 1) If ($Lon_x>0) - $Txt_Buffer:=$Txt_Buffer+Command name:C538(538) - $Txt_Buffer:=$Txt_Buffer+"(" - $Txt_Buffer:=$Txt_Buffer+String:C10($Lon_x) - $Txt_Buffer:=$Txt_Buffer+")" + $output+=Command name:C538(538) + $output+="(" + $output+=String:C10($Lon_x) + $output+=")" Else - $Txt_Buffer:=$Txt_Buffer+"\""+$Txt_Command+"\"" + $output+="\""+$Txt_Command+"\"" End if If ($Lon_CommandParameters>0) - $Txt_Buffer:=$Txt_Buffer+"+\"(" + $output+="+\"(" For ($Lon_i; 1; $Lon_CommandParameters; 1) - $Txt_Buffer:=$Txt_Buffer+Replace string:C233(M_4DPop_tTxt_Buffer{$Lon_i}; "\""; "\\\"") + $output+=Replace string:C233(M_4DPop_tTxt_Buffer{$Lon_i}; "\""; "\\\"") If ($Lon_i<$Lon_CommandParameters) - $Txt_Buffer:=$Txt_Buffer+";" + $output+=";" End if End for - $Txt_Buffer:=$Txt_Buffer+")\"" + $output+=")\"" End if - $Txt_Buffer:=$Txt_Buffer+")" - - //______________________________________________________ + $output+=")" + //________________________________________________________________________________ End case End for -SET MACRO PARAMETER:C998(Highlighted method text:K5:18; $Txt_Buffer) - -// Fin de si \ No newline at end of file +SET MACRO PARAMETER:C998(Highlighted method text:K5:18; $output) \ No newline at end of file diff --git a/Project/Sources/Methods/COMMENTS.4dm b/Project/Sources/Methods/COMMENTS.4dm index 9d752c3..d844dfd 100755 --- a/Project/Sources/Methods/COMMENTS.4dm +++ b/Project/Sources/Methods/COMMENTS.4dm @@ -17,12 +17,6 @@ // ---------------------------------------------------- #DECLARE($selector : Text; $selected : Text; $code : Text) -If (False:C215) - C_TEXT:C284(COMMENTS; $1) - C_TEXT:C284(COMMENTS; $2) - C_TEXT:C284(COMMENTS; $3) -End if - var $t; $name; $comments; $tResult; $separator : Text var $tSyntax; $title : Text var $bReplace; $success : Boolean @@ -164,7 +158,7 @@ Case of Else - $comments:=rgx($comments).substitute("(?si-m)"; "").result + $comments:=_o_rgx($comments).substitute("(?si-m)"; "").result End if @@ -221,7 +215,7 @@ Case of METHOD GET COMMENTS:C1189($name; $comments; *) $Win_hdl:=Open form window:C675("COMMENTS"; Movable form dialog box:K39:8) - SET WINDOW TITLE:C213($name+" - "+Get localized string:C991("comments"); $Win_hdl) + SET WINDOW TITLE:C213($name+" - "+Localized string:C991("comments"); $Win_hdl) $o:=New object:C1471(\ "text"; $comments) DIALOG:C40("COMMENTS"; $o) @@ -310,7 +304,7 @@ Case of $comments:=Replace string:C233($comments; ""; Application version:C493(*)) $comments:=Replace string:C233($comments; ""; Structure file:C489) - $title:=win_title(Frontmost window:C447) + $title:=_o_win_title(Frontmost window:C447) $comments:=Replace string:C233($comments; ""; $title) $title:=Get window title:C450(Next window:C448(Frontmost window:C447)) @@ -325,7 +319,7 @@ Case of $title:=Replace string:C233($title; " *"; "") - If (Position:C15(Get localized string:C991("Form: "); $title)>0) + If (Position:C15(Localized string:C991("Form: "); $title)>0) $comments:=Replace string:C233($comments; ""; $title) diff --git a/Project/Sources/Methods/COMPILER_class.4dm b/Project/Sources/Methods/COMPILER_class.4dm index 34f22c1..d214e94 100755 --- a/Project/Sources/Methods/COMPILER_class.4dm +++ b/Project/Sources/Methods/COMPILER_class.4dm @@ -2,14 +2,14 @@ If (False:C215) //________________________________________ - C_OBJECT:C1216(_o_menu; $0) - C_TEXT:C284(_o_menu; $1) - C_OBJECT:C1216(_o_menu; $2) + //_O_C_OBJECT(_o_menu; $0) + //_O_C_TEXT(_o_menu; $1) + //_O_C_OBJECT(_o_menu; $2) //________________________________________ - C_OBJECT:C1216(rgx; $0) - C_TEXT:C284(rgx; $1) - C_OBJECT:C1216(rgx; $2) + _O_C_OBJECT:C1216(_o_rgx; $0) + _O_C_TEXT:C284(_o_rgx; $1) + _O_C_OBJECT:C1216(_o_rgx; $2) //________________________________________ End if \ No newline at end of file diff --git a/Project/Sources/Methods/COMPILER_component.4dm b/Project/Sources/Methods/COMPILER_component.4dm index f05786d..f6bfe87 100755 --- a/Project/Sources/Methods/COMPILER_component.4dm +++ b/Project/Sources/Methods/COMPILER_component.4dm @@ -37,45 +37,11 @@ var v1; v2; v3; v4 : Variant If (False:C215) - If (False:C215) - _O_C_OBJECT:C1216(declaration_UI; $0) - _O_C_TEXT:C284(declaration_UI; $1) - _O_C_OBJECT:C1216(declaration_UI; $2) - End if - - _O_C_TEXT:C284(codeForCollection; $0) - - _O_C_COLLECTION:C1488(codeForCollection; $1) - _O_C_TEXT:C284(codeForCollection; $2) - - _O_C_TEXT:C284(codeForObject; $0) - _O_C_OBJECT:C1216(codeForObject; $1) - _O_C_TEXT:C284(codeForObject; $2) - - // C_OBJECT(macro; $0) - // C_TEXT(macro; $1) - // C_OBJECT(macro; $2) - _O_C_TEXT:C284(_o_localizedControlFlow; $0) _O_C_TEXT:C284(_o_localizedControlFlow; $1) _O_C_POINTER:C301(_o_localizedControlFlow; $2) _O_C_POINTER:C301(_o_localizedControlFlow; $3) - _O_C_TEXT:C284(DOT_NOTATION; $1) - - // Private_Boo_Get_Resource - _O_C_BOOLEAN:C305(Get_resource; $0) - _O_C_TEXT:C284(Get_resource; $1) - _O_C_TEXT:C284(Get_resource; $2) - _O_C_POINTER:C301(Get_resource; $3) - - // Private_Boo_Install_Resources - _O_C_BOOLEAN:C305(Install_resources; $0) - - // Private_Txt_Get_Version - _O_C_TEXT:C284(Get_Version; $0) - _O_C_TEXT:C284(Get_Version; $1) - // Private_Boo_Set_Preferences _O_C_BOOLEAN:C305(_o_Preferences_Set; $0) _O_C_TEXT:C284(_o_Preferences_Set; $1) @@ -89,12 +55,6 @@ If (False:C215) // Private_Boo_Paste_Regex_Pattern _O_C_BOOLEAN:C305(Private_Boo_Paste_Regex_Pattern; $0) - // METHOD_Syntax - _O_C_TEXT:C284(METHOD_Syntax; $0) - _O_C_TEXT:C284(METHOD_Syntax; $1) - _O_C_TEXT:C284(METHOD_Syntax; $2) - _O_C_TEXT:C284(METHOD_Syntax; $3) - // METHOD_ANALYSE_TO_ARRAYS _O_C_TEXT:C284(METHOD_ANALYSE_TO_ARRAYS; $1) _O_C_POINTER:C301(METHOD_ANALYSE_TO_ARRAYS; $2) @@ -105,15 +65,15 @@ If (False:C215) _O_C_TEXT:C284(METHODS; $1) _O_C_TEXT:C284(METHODS; $2) - _O_C_TEXT:C284(Util_SPLIT_METHOD; $1) - _O_C_POINTER:C301(Util_SPLIT_METHOD; $2) - _O_C_LONGINT:C283(Util_SPLIT_METHOD; $3) + _O_C_TEXT:C284(_o_Util_SPLIT_METHOD; $1) + _O_C_POINTER:C301(_o_Util_SPLIT_METHOD; $2) + _O_C_LONGINT:C283(_o_Util_SPLIT_METHOD; $3) - _O_C_LONGINT:C283(util_Lon_Local_in_line; $0) - _O_C_TEXT:C284(util_Lon_Local_in_line; $1) - _O_C_POINTER:C301(util_Lon_Local_in_line; $2) - _O_C_POINTER:C301(util_Lon_Local_in_line; $3) - _O_C_LONGINT:C283(util_Lon_Local_in_line; $4) + _O_C_LONGINT:C283(_o_util_Lon_Local_in_line; $0) + _O_C_TEXT:C284(_o_util_Lon_Local_in_line; $1) + _O_C_POINTER:C301(_o_util_Lon_Local_in_line; $2) + _O_C_POINTER:C301(_o_util_Lon_Local_in_line; $3) + _O_C_LONGINT:C283(_o_util_Lon_Local_in_line; $4) // Private_Txt_Get_Preferences _O_C_TEXT:C284(Preferences_Get; $0) @@ -127,28 +87,9 @@ If (False:C215) _O_C_TEXT:C284(_o_Preferences; $2) _O_C_POINTER:C301(_o_Preferences; $3) - // BEAUTIFIER - _O_C_TEXT:C284(_o_Beautifier; $0) - _O_C_TEXT:C284(_o_Beautifier; $1) - _O_C_BOOLEAN:C305(_o_Beautifier; $2) - - _O_C_LONGINT:C283(_o_beautifier_Next_semicolon; $0) - _O_C_TEXT:C284(_o_beautifier_Next_semicolon; $1) - - _O_C_TEXT:C284(_o_beautifier_Split_key_value; $0) - _O_C_TEXT:C284(_o_beautifier_Split_key_value; $1) - _O_C_LONGINT:C283(_o_beautifier_Split_key_value; $2) - // Private_GET_OPTIONS _O_C_LONGINT:C283(OPTIONS_GET; ${1}) - // M_4DPOP_OBOO_INIT - _O_C_BOOLEAN:C305(Init; $0) - - // COMMENTS - _O_C_TEXT:C284(COMMENTS; $1) - _O_C_TEXT:C284(COMMENTS; $2) - _O_C_TEXT:C284(COMMENTS; $3) // Private_INVERT_EXPRESSION _O_C_TEXT:C284(INVERT_EXPRESSION; $0) @@ -164,9 +105,6 @@ If (False:C215) _O_C_BOOLEAN:C305(_o_isNumeric; $0) _O_C_TEXT:C284(_o_isNumeric; $1) - // PRIVATE_4DPOP_ABOUT - _O_C_TEXT:C284(ABOUT; $1) - // Str_gLon_Hex_To_Long _O_C_LONGINT:C283(str_gLon_Hex_To_Long; $0) _O_C_TEXT:C284(str_gLon_Hex_To_Long; $1) @@ -189,8 +127,8 @@ If (False:C215) _O_C_LONGINT:C283(win_NOT_UNDER_TOOLBAR; $0) // Win_title - _O_C_TEXT:C284(win_title; $0) - _O_C_LONGINT:C283(win_title; $1) + _O_C_TEXT:C284(_o_win_title; $0) + _O_C_LONGINT:C283(_o_win_title; $1) // Private_Lon_Declaration_Type _O_C_LONGINT:C283(Private_Lon_Declaration_Type; $0) @@ -201,8 +139,4 @@ If (False:C215) _O_C_TEXT:C284(_o_EXTRACT_LOCAL_VARIABLES; $1) _O_C_POINTER:C301(_o_EXTRACT_LOCAL_VARIABLES; $2) - // C_TEXT(SETTINGS; $1) - - _O_C_POINTER:C301(4DPop_MACROS_SETTINGS; $1) - End if \ No newline at end of file diff --git a/Project/Sources/Methods/COMPILER_xml.4dm b/Project/Sources/Methods/COMPILER_xml.4dm index c3066f6..6ab0933 100755 --- a/Project/Sources/Methods/COMPILER_xml.4dm +++ b/Project/Sources/Methods/COMPILER_xml.4dm @@ -4,37 +4,37 @@ var xml_ERROR : Integer If (False:C215) //____________________________________ - _O_C_OBJECT:C1216(xml_attributes; $0) - _O_C_TEXT:C284(xml_attributes; $1) + _O_C_OBJECT:C1216(_o_xml_attributes; $0) + _O_C_TEXT:C284(_o_xml_attributes; $1) //____________________________________ - _O_C_OBJECT:C1216(xml_elementToObject; $0) - _O_C_TEXT:C284(xml_elementToObject; $1) - _O_C_BOOLEAN:C305(xml_elementToObject; $2) + _O_C_OBJECT:C1216(_o_xml_elementToObject; $0) + _O_C_TEXT:C284(_o_xml_elementToObject; $1) + _O_C_BOOLEAN:C305(_o_xml_elementToObject; $2) //____________________________________ - _O_C_OBJECT:C1216(xml_fileToObject; $0) - _O_C_TEXT:C284(xml_fileToObject; $1) - _O_C_BOOLEAN:C305(xml_fileToObject; $2) + _O_C_OBJECT:C1216(_o_xml_fileToObject; $0) + _O_C_TEXT:C284(_o_xml_fileToObject; $1) + _O_C_BOOLEAN:C305(_o_xml_fileToObject; $2) //____________________________________ - _O_C_COLLECTION:C1488(xml_findByName; $0) - _O_C_TEXT:C284(xml_findByName; $1) - _O_C_TEXT:C284(xml_findByName; $2) + _O_C_COLLECTION:C1488(_o_xml_findByName; $0) + _O_C_TEXT:C284(_o_xml_findByName; $1) + _O_C_TEXT:C284(_o_xml_findByName; $2) //____________________________________ - _O_C_OBJECT:C1216(xml_refToObject; $0) - _O_C_TEXT:C284(xml_refToObject; $1) - _O_C_BOOLEAN:C305(xml_refToObject; $2) + _O_C_OBJECT:C1216(_o_xml_refToObject; $0) + _O_C_TEXT:C284(_o_xml_refToObject; $1) + _O_C_BOOLEAN:C305(_o_xml_refToObject; $2) //____________________________________ - _O_C_TEXT:C284(xml_encode; $0) - _O_C_TEXT:C284(xml_encode; $1) + _O_C_TEXT:C284(_o_xml_encode; $0) + _O_C_TEXT:C284(_o_xml_encode; $1) //____________________________________ - _O_C_OBJECT:C1216(xml_findElement; $0) - _O_C_TEXT:C284(xml_findElement; $1) - _O_C_TEXT:C284(xml_findElement; $2) + _O_C_OBJECT:C1216(_o_xml_findElement; $0) + _O_C_TEXT:C284(_o_xml_findElement; $1) + _O_C_TEXT:C284(_o_xml_findElement; $2) //____________________________________ End if \ No newline at end of file diff --git a/Project/Sources/Methods/Compiler_.4dm b/Project/Sources/Methods/Compiler_.4dm index 567000e..66d3adf 100755 --- a/Project/Sources/Methods/Compiler_.4dm +++ b/Project/Sources/Methods/Compiler_.4dm @@ -25,7 +25,7 @@ If (False:C215) End if If (False:C215) - _O_C_TEXT:C284(xml_cleanup; $0) - _O_C_TEXT:C284(xml_cleanup; $1) - _O_C_LONGINT:C283(xml_cleanup; $2) + _O_C_TEXT:C284(_o_xml_cleanup; $0) + _O_C_TEXT:C284(_o_xml_cleanup; $1) + _O_C_LONGINT:C283(_o_xml_cleanup; $2) End if \ No newline at end of file diff --git a/Project/Sources/Methods/Compiler_Rgx.4dm b/Project/Sources/Methods/Compiler_Rgx.4dm index 3b81651..bb131c3 100755 --- a/Project/Sources/Methods/Compiler_Rgx.4dm +++ b/Project/Sources/Methods/Compiler_Rgx.4dm @@ -7,44 +7,37 @@ // // ---------------------------------------------------- -var rgxError : Integer +var _o_rgxError : Integer If (False:C215) - _O_C_OBJECT:C1216(Rgx_match; $0) - _O_C_OBJECT:C1216(Rgx_match; $1) // Public ---------------------------- - _O_C_LONGINT:C283(Rgx_ExtractText; $0) - _O_C_TEXT:C284(Rgx_ExtractText; $1) - _O_C_TEXT:C284(Rgx_ExtractText; $2) - _O_C_TEXT:C284(Rgx_ExtractText; $3) - _O_C_POINTER:C301(Rgx_ExtractText; $4) - _O_C_LONGINT:C283(Rgx_ExtractText; $5) + _O_C_LONGINT:C283(_o_Rgx_ExtractText; $0) + _O_C_TEXT:C284(_o_Rgx_ExtractText; $1) + _O_C_TEXT:C284(_o_Rgx_ExtractText; $2) + _O_C_TEXT:C284(_o_Rgx_ExtractText; $3) + _O_C_POINTER:C301(_o_Rgx_ExtractText; $4) + _O_C_LONGINT:C283(_o_Rgx_ExtractText; $5) - _O_C_TEXT:C284(Rgx_Get_Pattern; $0) - _O_C_TEXT:C284(Rgx_Get_Pattern; $1) - _O_C_TEXT:C284(Rgx_Get_Pattern; $2) - _O_C_POINTER:C301(Rgx_Get_Pattern; $3) + _O_C_LONGINT:C283(_o_Rgx_MatchText; $0) + _O_C_TEXT:C284(_o_Rgx_MatchText; $1) + _O_C_TEXT:C284(_o_Rgx_MatchText; $2) + _O_C_POINTER:C301(_o_Rgx_MatchText; $3) + _O_C_LONGINT:C283(_o_Rgx_MatchText; $4) - _O_C_LONGINT:C283(Rgx_MatchText; $0) - _O_C_TEXT:C284(Rgx_MatchText; $1) - _O_C_TEXT:C284(Rgx_MatchText; $2) - _O_C_POINTER:C301(Rgx_MatchText; $3) - _O_C_LONGINT:C283(Rgx_MatchText; $4) + _O_C_LONGINT:C283(_o_Rgx_SplitText; $0) + _O_C_TEXT:C284(_o_Rgx_SplitText; $1) + _O_C_TEXT:C284(_o_Rgx_SplitText; $2) + _O_C_POINTER:C301(_o_Rgx_SplitText; $3) + _O_C_LONGINT:C283(_o_Rgx_SplitText; $4) - _O_C_LONGINT:C283(Rgx_SplitText; $0) - _O_C_TEXT:C284(Rgx_SplitText; $1) - _O_C_TEXT:C284(Rgx_SplitText; $2) - _O_C_POINTER:C301(Rgx_SplitText; $3) - _O_C_LONGINT:C283(Rgx_SplitText; $4) - - _O_C_LONGINT:C283(Rgx_SubstituteText; $0) - _O_C_TEXT:C284(Rgx_SubstituteText; $1) - _O_C_TEXT:C284(Rgx_SubstituteText; $2) - _O_C_POINTER:C301(Rgx_SubstituteText; $3) - _O_C_LONGINT:C283(Rgx_SubstituteText; $4) + _O_C_LONGINT:C283(_o_Rgx_SubstituteText; $0) + _O_C_TEXT:C284(_o_Rgx_SubstituteText; $1) + _O_C_TEXT:C284(_o_Rgx_SubstituteText; $2) + _O_C_POINTER:C301(_o_Rgx_SubstituteText; $3) + _O_C_LONGINT:C283(_o_Rgx_SubstituteText; $4) // Private ---------------------------- - _O_C_TEXT:C284(rgx_Options; $0) - _O_C_LONGINT:C283(rgx_Options; $1) + _O_C_TEXT:C284(_o_rgx_Options; $0) + _O_C_LONGINT:C283(_o_rgx_Options; $1) End if \ No newline at end of file diff --git a/Project/Sources/Methods/DECLARATION_Test.4dm b/Project/Sources/Methods/DECLARATION_Test.4dm index 5c2299d..b2a5222 100755 --- a/Project/Sources/Methods/DECLARATION_Test.4dm +++ b/Project/Sources/Methods/DECLARATION_Test.4dm @@ -1,10 +1,10 @@ //%attributes = {"invisible":true,"preemptive":"capable"} //var $1 : Text -//C_BOOLEAN($2; $3) +//var $2; $3 : Boolean ////APPEND TO ARRAY($tObj_test; ${10}->) -//var $4, $5 : Collection +//var $4; $5 : Collection //var $6 ///* ----- @@ -20,11 +20,11 @@ //$_pathToObject:=Path to object($_x) -//var $7, $_7 : Pointer +//var $7; $_pointer : Pointer //$_pointer:=->$7 -//C_OBJECT($0) +//var $0 : Object //For ($i; 1; Count parameters; 1) diff --git a/Project/Sources/Methods/DECLARE.4dm b/Project/Sources/Methods/DECLARE.4dm index f5f62d1..4959d1c 100644 --- a/Project/Sources/Methods/DECLARE.4dm +++ b/Project/Sources/Methods/DECLARE.4dm @@ -1,21 +1,11 @@ //%attributes = {"invisible":true,"preemptive":"capable"} -//C_TEXT($1) -//C_VARIANT($2) -//C_LONGINT($0)//comments #DECLARE($t : Text; $v) : Object -If (False:C215) - C_TEXT:C284(DECLARE; $1) - C_VARIANT:C1683(DECLARE; $2) - C_OBJECT:C1216(DECLARE; $0) -End if - var $text : Text var $i : Integer var $o : Object $text:=$t -//$variant:=$v $i:=20 $o:=New object:C1471 diff --git a/Project/Sources/Methods/DOT_NOTATION.4dm b/Project/Sources/Methods/DOT_NOTATION.4dm index e04b8e6..e2a2afe 100755 --- a/Project/Sources/Methods/DOT_NOTATION.4dm +++ b/Project/Sources/Methods/DOT_NOTATION.4dm @@ -1,128 +1,86 @@ //%attributes = {"invisible":true,"preemptive":"incapable"} - // ---------------------------------------------------- - // Project method : DOT_NOTATION - // Database: 4DPop Macros - // ID[B4AD544DDA924C80A5A42792F9275088] - // Created #15-3-2018 by Vincent de Lachaux - // ---------------------------------------------------- - // Description: - // - // ---------------------------------------------------- - // Declarations -C_TEXT:C284($1) +// ---------------------------------------------------- +// Project method : DOT_NOTATION +// Database: 4DPop Macros +// ID[B4AD544DDA924C80A5A42792F9275088] +// Created #15-3-2018 by Vincent de Lachaux +// ---------------------------------------------------- +#DECLARE($code : Text) -C_LONGINT:C283($Lon_parameters;$Lon_x) -C_TEXT:C284($kTxt_patternWordCharacters;$Txt_code;$Txt_pattern) +var $WORD_PATTERN; $PATTERN : Text +var $x : Integer -ARRAY TEXT:C222($tTxt_extract;0) +ARRAY TEXT:C222($_extract; 0) -If (False:C215) - C_TEXT:C284(DOT_NOTATION ;$1) -End if +$WORD_PATTERN:="(?mi-s)^(\\w|\\$)*$" - // ---------------------------------------------------- - // Initialisations -$Lon_parameters:=Count parameters:C259 - -If (Asserted:C1132($Lon_parameters>=1;"Missing parameter")) - - // Required parameters - $Txt_code:=$1 - - // Optional parameters - If ($Lon_parameters>=2) - - // - - End if - - $kTxt_patternWordCharacters:="(?mi-s)^(\\w|\\$)*$" - -Else - - ABORT:C156 - -End if - - // ---------------------------------------------------- - - // ----------------------------------------------------------------------------------------------- - //$Txt_buffer:=OB Get($Obj_;"test";Is text) -> $Txt_buffer:=$Obj_.test - //$Txt_buffer:=OB Get($Obj_;"is-compilable";Is text) -> $Txt_buffer:=$Obj_["is-compilable"] -$Txt_pattern:="(?m-si)"+Command name:C538(1224)+"\\(([^;]*);\"([^\"]*)\";(.*)\\)" +$PATTERN:="(?m-si)"+Command name:C538(1224)+"\\(([^;]*);\"([^\"]*)\";(.*)\\)" Repeat - $Lon_x:=Rgx_ExtractText ($Txt_pattern;$Txt_code;"";->$tTxt_extract) + $x:=_o_Rgx_ExtractText($PATTERN; $code; ""; ->$_extract) - If ($Lon_x=0) + If ($x=0) - If (Rgx_MatchText ($kTxt_patternWordCharacters;$tTxt_extract{3})=0) + If (_o_Rgx_MatchText($WORD_PATTERN; $_extract{3})=0) - $Txt_code:=Replace string:C233($Txt_code;$tTxt_extract{1};$tTxt_extract{2}+"."+$tTxt_extract{3};1) + $code:=Replace string:C233($code; $_extract{1}; $_extract{2}+"."+$_extract{3}; 1) Else - // Use brackets - $Txt_code:=Replace string:C233($Txt_code;$tTxt_extract{1};$tTxt_extract{2}+"[\""+$tTxt_extract{3}+"\"]";1) + // Use brackets + $code:=Replace string:C233($code; $_extract{1}; $_extract{2}+"[\""+$_extract{3}+"\"]"; 1) End if End if -Until ($Lon_x=-1) +Until ($x=-1) - // ----------------------------------------------------------------------------------------------- - //OB SET($Obj_;"$test";"hello") -> $Obj_.$test:="hello" - //OB SET($Obj_;"is-compilable";False) -> Obj_["is-compilable"]:=False -$Txt_pattern:="(?m-si)"+Command name:C538(1220)+"\\(([^;]*);(?:\\\\\\s*)?(?:\"([^\"]*)\";([^;)]*))\\)" +// MARK:- +// OB SET($Obj_;"$test";"hello") -> $Obj_.$test:="hello" +// OB SET($Obj_;"is-compilable";False) -> Obj_["is-compilable"]:=False +$PATTERN:="(?m-si)"+Command name:C538(1220)+"\\(([^;]*);(?:\\\\\\s*)?(?:\"([^\"]*)\";([^;)]*))\\)" Repeat - $Lon_x:=Rgx_ExtractText ($Txt_pattern;$Txt_code;"";->$tTxt_extract) + $x:=_o_Rgx_ExtractText($PATTERN; $code; ""; ->$_extract) - If ($Lon_x=0) + If ($x=0) - If (Rgx_MatchText ($kTxt_patternWordCharacters;$tTxt_extract{3})=0) + If (_o_Rgx_MatchText($WORD_PATTERN; $_extract{3})=0) - $Txt_code:=Replace string:C233($Txt_code;$tTxt_extract{1};$tTxt_extract{2}+"."+$tTxt_extract{3}+":="+$tTxt_extract{4};1) + $code:=Replace string:C233($code; $_extract{1}; $_extract{2}+"."+$_extract{3}+":="+$_extract{4}; 1) Else - // Use brackets - $Txt_code:=Replace string:C233($Txt_code;$tTxt_extract{1};$tTxt_extract{2}+"[\""+$tTxt_extract{3}+"\"]:="+$tTxt_extract{4};1) + // Use brackets + $code:=Replace string:C233($code; $_extract{1}; $_extract{2}+"[\""+$_extract{3}+"\"]:="+$_extract{4}; 1) End if End if -Until ($Lon_x=-1) +Until ($x=-1) - // ----------------------------------------------------------------------------------------------- - //OB Is defined($Obj_;"compilable") -> $$Obj_.compilable#Null - //OB Is defined($Obj_;"not-compilable") -> $Obj_["not-compilable"]#Null -$Txt_pattern:="(?m-si)"+Command name:C538(1231)+"\\(([^;]*);\"([^\"]*)\"\\)" +// MARK:- +// OB Is defined($Obj_;"compilable") -> $$Obj_.compilable#Null +// OB Is defined($Obj_;"not-compilable") -> $Obj_["not-compilable"]#Null +$PATTERN:="(?m-si)"+Command name:C538(1231)+"\\(([^;]*);\"([^\"]*)\"\\)" Repeat - $Lon_x:=Rgx_ExtractText ($Txt_pattern;$Txt_code;"";->$tTxt_extract) + $x:=_o_Rgx_ExtractText($PATTERN; $code; ""; ->$_extract) - If ($Lon_x=0) + If ($x=0) - If (Rgx_MatchText ($kTxt_patternWordCharacters;$tTxt_extract{3})=0) + If (_o_Rgx_MatchText($WORD_PATTERN; $_extract{3})=0) - $Txt_code:=Replace string:C233($Txt_code;$tTxt_extract{1};$tTxt_extract{2}+"."+$tTxt_extract{3}+"#"+Command name:C538(1517);1) + $code:=Replace string:C233($code; $_extract{1}; $_extract{2}+"."+$_extract{3}+"#"+Command name:C538(1517); 1) Else - // Use brackets - $Txt_code:=Replace string:C233($Txt_code;$tTxt_extract{1};$tTxt_extract{2}+"[\""+$tTxt_extract{3}+"\"]#"+Command name:C538(1517);1) + // Use brackets + $code:=Replace string:C233($code; $_extract{1}; $_extract{2}+"[\""+$_extract{3}+"\"]#"+Command name:C538(1517); 1) End if End if -Until ($Lon_x=-1) - - // ----------------------------------------------------------------------------------------------- -SET MACRO PARAMETER:C998(Highlighted method text:K5:18;$Txt_code) +Until ($x=-1) - // ---------------------------------------------------- - // Return - // - // ---------------------------------------------------- - // End \ No newline at end of file +SET MACRO PARAMETER:C998(Highlighted method text:K5:18; $code) \ No newline at end of file diff --git a/Project/Sources/Methods/Get_Version.4dm b/Project/Sources/Methods/Get_Version.4dm index 51defa4..3a381f9 100755 --- a/Project/Sources/Methods/Get_Version.4dm +++ b/Project/Sources/Methods/Get_Version.4dm @@ -1,137 +1,122 @@ //%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Method : Private_Txt_Get_Version - // Created 06/05/06 by Vincent de Lachaux - // ---------------------------------------------------- - // Description - // - // ---------------------------------------------------- -C_TEXT:C284($0) -C_TEXT:C284($1) +// ---------------------------------------------------- +// Method : Private_Txt_Get_Version +// Created 06/05/06 by Vincent de Lachaux +// ---------------------------------------------------- +#DECLARE($EntryPoint : Text) : Text -C_BOOLEAN:C305($Boo_OK) -C_TEXT:C284($Txt_Buffer;$Txt_EntryPoint;$Txt_Result;$a16_Node;$a16_Root) +var $Node; $Root; $Buffer; $Result : Text +var $OK : Boolean -If (False:C215) - C_TEXT:C284(Get_Version ;$0) - C_TEXT:C284(Get_Version ;$1) -End if - -$Txt_EntryPoint:="full" - -If (Count parameters:C259>0) - - $Txt_EntryPoint:=$1 //Action - -End if +$EntryPoint:=Count parameters:C259=0 ? "full" : $EntryPoint // Action -$a16_Root:=DOM Parse XML source:C719(Storage:C1525.macros.preferences.platformPath) -$Boo_OK:=(OK=1) +$Root:=DOM Parse XML source:C719(Storage:C1525.macros.preferences.platformPath) +$OK:=(OK=1) -If ($Boo_OK) +If ($OK) - $a16_Node:=DOM Find XML element:C864($a16_Root;"/M_4DPop/version/") - $Boo_OK:=(OK=1) + $Node:=DOM Find XML element:C864($Root; "/M_4DPop/version/") + $OK:=(OK=1) - If ($Boo_OK & (($Txt_EntryPoint="major")\ - | ($Txt_EntryPoint="full"))) + If ($OK & (($EntryPoint="major")\ + | ($EntryPoint="full"))) - $a16_Node:=DOM Find XML element:C864($a16_Root;"/M_4DPop/version/major/") - $Boo_OK:=(OK=1) + $Node:=DOM Find XML element:C864($Root; "/M_4DPop/version/major/") + $OK:=(OK=1) - If ($Boo_OK) + If ($OK) - DOM GET XML ELEMENT VALUE:C731($a16_Node;$Txt_Buffer) - $Boo_OK:=(OK=1) + DOM GET XML ELEMENT VALUE:C731($Node; $Buffer) + $OK:=(OK=1) - If ($Boo_OK) + If ($OK) - $Txt_Result:=$Txt_Buffer + $Result:=$Buffer End if End if End if - If ($Boo_OK & (($Txt_EntryPoint="minor")\ - | ($Txt_EntryPoint="full"))) + If ($OK & (($EntryPoint="minor")\ + | ($EntryPoint="full"))) - $a16_Node:=DOM Find XML element:C864($a16_Root;"/M_4DPop/version/minor/") - $Boo_OK:=(OK=1) + $Node:=DOM Find XML element:C864($Root; "/M_4DPop/version/minor/") + $OK:=(OK=1) - If ($Boo_OK) + If ($OK) - DOM GET XML ELEMENT VALUE:C731($a16_Node;$Txt_Buffer) - $Boo_OK:=(OK=1) + DOM GET XML ELEMENT VALUE:C731($Node; $Buffer) + $OK:=(OK=1) - If ($Boo_OK) + If ($OK) - If ($Txt_EntryPoint="Full") + If ($EntryPoint="Full") - If (Num:C11($Txt_Buffer)#0) + If (Num:C11($Buffer)#0) - $Txt_Result:=$Txt_Result+"."+$Txt_Buffer + $Result+="."+$Buffer End if Else - $Txt_Result:=$Txt_Buffer + $Result:=$Buffer End if End if End if End if - If ($Boo_OK & (($Txt_EntryPoint="release")\ - | ($Txt_EntryPoint="full"))) + If ($OK & (($EntryPoint="release")\ + | ($EntryPoint="full"))) - $a16_Node:=DOM Find XML element:C864($a16_Root;"/M_4DPop/version/release/") - $Boo_OK:=(OK=1) + $Node:=DOM Find XML element:C864($Root; "/M_4DPop/version/release/") + $OK:=(OK=1) - If ($Boo_OK) + If ($OK) - DOM GET XML ELEMENT VALUE:C731($a16_Node;$Txt_Buffer) - $Boo_OK:=(OK=1) + DOM GET XML ELEMENT VALUE:C731($Node; $Buffer) + $OK:=(OK=1) - If ($Boo_OK) + If ($OK) - If ($Txt_EntryPoint="Full") + If ($EntryPoint="Full") - If (Num:C11($Txt_Buffer)#0) + If (Num:C11($Buffer)#0) - $Txt_Result:=$Txt_Result+"."+$Txt_Buffer + $Result+="."+$Buffer End if Else - $Txt_Result:=$Txt_Buffer + $Result:=$Buffer End if End if End if End if - If ($Boo_OK & ($Txt_EntryPoint="date")) + If ($OK & ($EntryPoint="date")) - $a16_Node:=DOM Find XML element:C864($a16_Root;"/M_4DPop/version/date/") - $Boo_OK:=(OK=1) + $Node:=DOM Find XML element:C864($Root; "/M_4DPop/version/date/") + $OK:=(OK=1) - If ($Boo_OK) + If ($OK) - DOM GET XML ELEMENT VALUE:C731($a16_Node;$Txt_Buffer) - $Boo_OK:=(OK=1) + DOM GET XML ELEMENT VALUE:C731($Node; $Buffer) + $OK:=(OK=1) - If ($Boo_OK) + If ($OK) - $Txt_Result:=$Txt_Buffer + $Result:=$Buffer End if End if End if - DOM CLOSE XML:C722($a16_Root) + DOM CLOSE XML:C722($Root) End if -$0:=$Txt_Result \ No newline at end of file +return $Result \ No newline at end of file diff --git a/Project/Sources/Methods/Get_resource.4dm b/Project/Sources/Methods/Get_resource.4dm index 64d2eaf..9c81b87 100755 --- a/Project/Sources/Methods/Get_resource.4dm +++ b/Project/Sources/Methods/Get_resource.4dm @@ -3,83 +3,64 @@ // Method : Get_resource // Created 06/05/06 by Vincent de Lachaux // ---------------------------------------------------- -// Description -// -//---------------------------------------------------- -C_BOOLEAN:C305($0) -C_TEXT:C284($1) -C_TEXT:C284($2) -C_POINTER:C301($3) +#DECLARE($Name : Text; $Type : Text; $valuePtr : Pointer) : Boolean -C_BLOB:C604($Blb_Value) -C_BOOLEAN:C305($Boo_OK) -C_POINTER:C301($Ptr_Value) -C_TEXT:C284($Txt_Buffer; $Txt_Name; $Txt_Path; $Txt_Type; $a16_Node; $a16_Root) +var $Buffer; $Node; $Path; $Root : Text +var $OK : Boolean -If (False:C215) - C_BOOLEAN:C305(Get_resource; $0) - C_TEXT:C284(Get_resource; $1) - C_TEXT:C284(Get_resource; $2) - C_POINTER:C301(Get_resource; $3) -End if - -$Txt_Name:=$1 -$Txt_Type:=$2 -$Ptr_Value:=$3 - -$Txt_Path:=_o_Files_And_Folders("Add_Folder"; Get 4D folder:C485; "4DPop v11"; True:C214) -$Txt_Path:=_o_Files_And_Folders("Add_File"; $Txt_Path; "resources.xml") +$Path:=_o_Files_And_Folders("Add_Folder"; Get 4D folder:C485; "4DPop v11"; True:C214) +$Path:=_o_Files_And_Folders("Add_File"; $Path; "resources.xml") -$a16_Root:=DOM Parse XML source:C719($Txt_Path) -$Boo_OK:=(OK=1) +$Root:=DOM Parse XML source:C719($Path) +$OK:=(OK=1) -If ($Boo_OK) +If ($OK) - $a16_Node:=DOM Find XML element:C864($a16_Root; "/M_4DPop/"+$Txt_Name) - $Boo_OK:=(OK=1) + $Node:=DOM Find XML element:C864($Root; "/M_4DPop/"+$Name) + $OK:=(OK=1) - If ($Boo_OK) + If ($OK) - DOM GET XML ELEMENT VALUE:C731($a16_Node; $Txt_Buffer) - $Boo_OK:=(OK=1) + DOM GET XML ELEMENT VALUE:C731($Node; $Buffer) + $OK:=(OK=1) End if - DOM CLOSE XML:C722($a16_Root) + DOM CLOSE XML:C722($Root) - If ($Boo_OK) + If ($OK) - TEXT TO BLOB:C554($Txt_Buffer; $Blb_Value; Mac text without length:K22:10) - $Boo_OK:=(OK=1) + TEXT TO BLOB:C554($Buffer; $valuePtr; Mac text without length:K22:10) + $OK:=(OK=1) - If ($Boo_OK) + If ($OK) - BASE64 DECODE:C896($Blb_Value) - $Boo_OK:=(OK=1) + BASE64 DECODE:C896($valuePtr) + $OK:=(OK=1) - If ($Boo_OK) + If ($OK) Case of //______________________________________________________ - : ($Txt_Type="PICT") + : ($Type="PICT") - BLOB TO PICTURE:C682($Blb_Value; $Ptr_Value->) - $Boo_OK:=(OK=1) + BLOB TO PICTURE:C682($valuePtr; $valuePtr->) + $OK:=(OK=1) //______________________________________________________ Else - $Boo_OK:=False:C215 + $OK:=False:C215 //______________________________________________________ End case End if - SET BLOB SIZE:C606($Blb_Value; 0) + SET BLOB SIZE:C606($valuePtr; 0) End if End if End if -$0:=$Boo_OK \ No newline at end of file +return $OK \ No newline at end of file diff --git a/Project/Sources/Methods/INSTALL_LOCALIZED_MACROS.4dm b/Project/Sources/Methods/INSTALL_LOCALIZED_MACROS.4dm index 196f384..45744aa 100755 --- a/Project/Sources/Methods/INSTALL_LOCALIZED_MACROS.4dm +++ b/Project/Sources/Methods/INSTALL_LOCALIZED_MACROS.4dm @@ -39,7 +39,7 @@ If ($file.exists) If ($i>0) - If (Rgx_ExtractText("\\[([^\\]]*)\\]"; $nodes{$i}; "1"; ->$results)=0) + If (_o_Rgx_ExtractText("\\[([^\\]]*)\\]"; $nodes{$i}; "1"; ->$results)=0) $language:=$results{1} break @@ -55,7 +55,7 @@ End if If ($language#Get database localization:C1009(User system localization:K5:23)) - $src:=File:C1566(Get localized document path:C1105("4DPop_Macros.xml"); fk platform path:K87:2) + $src:=File:C1566(Localized document path:C1105("4DPop_Macros.xml"); fk platform path:K87:2) If (Bool:C1537($src.exists)) diff --git a/Project/Sources/Methods/INVERT_EXPRESSION.4dm b/Project/Sources/Methods/INVERT_EXPRESSION.4dm index 5a3cae2..fe361c2 100755 --- a/Project/Sources/Methods/INVERT_EXPRESSION.4dm +++ b/Project/Sources/Methods/INVERT_EXPRESSION.4dm @@ -10,19 +10,19 @@ // Modified by vdl (05/02/08) // v11 compatibility // ---------------------------------------------------- -C_TEXT:C284($0) -C_LONGINT:C283($1) -C_LONGINT:C283($2) -C_LONGINT:C283(${3}) +var $0 : Text +var $1 : Integer +var $2 : Integer +_O_C_LONGINT:C283(${3}) -C_LONGINT:C283($Lon_Error; $Lon_i; $Lon_Line; $Lon_Line_Number; $Lon_Parameters; $Lon_Position; $Lon_size; $Lon_start) -C_TEXT:C284($Txt_Code; $Txt_Command; $Txt_Comment; $Txt_result) +var $Lon_Error; $Lon_i; $Lon_Line; $Lon_Line_Number; $Lon_Parameters; $Lon_Position; $Lon_size; $Lon_start : Integer +var $Txt_Code; $Txt_Command; $Txt_Comment; $Txt_result : Text If (False:C215) - C_TEXT:C284(INVERT_EXPRESSION; $0) - C_LONGINT:C283(INVERT_EXPRESSION; $1) - C_LONGINT:C283(INVERT_EXPRESSION; $2) - C_LONGINT:C283(INVERT_EXPRESSION; ${3}) + _O_C_TEXT:C284(INVERT_EXPRESSION; $0) + _O_C_LONGINT:C283(INVERT_EXPRESSION; $1) + _O_C_LONGINT:C283(INVERT_EXPRESSION; $2) + _O_C_LONGINT:C283(INVERT_EXPRESSION; ${3}) End if $Lon_Parameters:=Count parameters:C259 @@ -35,7 +35,7 @@ Case of GET MACRO PARAMETER:C997(Highlighted method text:K5:18; $Txt_result) ARRAY TEXT:C222(<>tTxt_lines; 0x0000) - $Lon_Error:=Rgx_SplitText("\\r"; $Txt_result; -><>tTxt_lines; 0 ?+ 11) + $Lon_Error:=_o_Rgx_SplitText("\\r"; $Txt_result; -><>tTxt_lines; 0 ?+ 11) $Txt_result:="" $Lon_Line_Number:=Size of array:C274(<>tTxt_lines) diff --git a/Project/Sources/Methods/Init.4dm b/Project/Sources/Methods/Init.4dm index beaf990..bd72720 100644 --- a/Project/Sources/Methods/Init.4dm +++ b/Project/Sources/Methods/Init.4dm @@ -13,10 +13,6 @@ // ---------------------------------------------------- #DECLARE() : Boolean -If (False:C215) - C_BOOLEAN:C305(Init; $0) -End if - If (Storage:C1525.component=Null:C1517) Use (Storage:C1525) @@ -37,12 +33,6 @@ If (Count parameters:C259=0)\ COMPILER_component - Use (Storage:C1525.component) - - Storage:C1525.component.inited:=True:C214 - - End use - INSTALL_LOCALIZED_MACROS If (_o_Preferences) @@ -53,4 +43,10 @@ If (Count parameters:C259=0)\ End if End if + + Use (Storage:C1525.component) + + Storage:C1525.component.inited:=True:C214 + + End use End if \ No newline at end of file diff --git a/Project/Sources/Methods/Install_resources.4dm b/Project/Sources/Methods/Install_resources.4dm index 7cb4b1d..e40e075 100755 --- a/Project/Sources/Methods/Install_resources.4dm +++ b/Project/Sources/Methods/Install_resources.4dm @@ -1,25 +1,18 @@ //%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Method : Install_Resources - // Created 06/05/06 by Vincent de Lachaux - // ---------------------------------------------------- - // Description - // - // ---------------------------------------------------- -C_BOOLEAN:C305($0) +// ---------------------------------------------------- +// Method : Install_Resources +// Created 06/05/06 by Vincent de Lachaux +// ---------------------------------------------------- +#DECLARE() : Boolean -C_BOOLEAN:C305($Boo_OK) -C_TEXT:C284($t) -C_OBJECT:C1216($file) - -If (False:C215) - C_BOOLEAN:C305(Install_resources ;$0) -End if +var $OK : Boolean +var $t : Text +var $file : Object $file:=Folder:C1567(fk user preferences folder:K87:10).folder("4DPop").file("resources.xml") -$Boo_OK:=$file.exists +$OK:=$file.exists -If (Not:C34($Boo_OK)) +If (Not:C34($OK)) $t:="\r"+\ "\r"+"/9j/4AAQSkZJRgABAQEASABIAAD//gAMQXBwbGVNYXJrCv/bAIQABwUFBgUF\r"+\ @@ -166,8 +159,8 @@ If (Not:C34($Boo_OK)) "\r" $file.setText($t) - $Boo_OK:=($file.getText()=$t) + $OK:=($file.getText()=$t) End if -$0:=$Boo_OK // True if installation succesfull \ No newline at end of file +return $OK // True if installation succesfull \ No newline at end of file diff --git a/Project/Sources/Methods/METHOD_ANALYSE_TO_ARRAYS.4dm b/Project/Sources/Methods/METHOD_ANALYSE_TO_ARRAYS.4dm index f2f1628..8cadcf0 100755 --- a/Project/Sources/Methods/METHOD_ANALYSE_TO_ARRAYS.4dm +++ b/Project/Sources/Methods/METHOD_ANALYSE_TO_ARRAYS.4dm @@ -1,55 +1,55 @@ //%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Project method : METHOD_ANALYSE_TO_ARRAYS - // ID[343B51683A1C4F40A7E8BC192481999C] - // Created #3-2-2013 by Vincent de Lachaux - // ---------------------------------------------------- - // Description: - // Populates 3 arrays with the types, labels and descriptions of parameters of a method. - // ---------------------------------------------------- - // Modified by Vincent de Lachaux (23/12/13) - // Adding description of the extraction of the parameters - // ---------------------------------------------------- - // Modified by Vincent de Lachaux (04/02/14) - // Adding management of objects - // Optimization: the obsolete types was put at the end - // ---------------------------------------------------- - // Declarations -C_TEXT:C284($1) -C_POINTER:C301($2) -C_POINTER:C301($3) -C_POINTER:C301($4) +// ---------------------------------------------------- +// Project method : METHOD_ANALYSE_TO_ARRAYS +// ID[343B51683A1C4F40A7E8BC192481999C] +// Created #3-2-2013 by Vincent de Lachaux +// ---------------------------------------------------- +// Description: +// Populates 3 arrays with the types, labels and descriptions of parameters of a method. +// ---------------------------------------------------- +// Modified by Vincent de Lachaux (23/12/13) +// Adding description of the extraction of the parameters +// ---------------------------------------------------- +// Modified by Vincent de Lachaux (04/02/14) +// Adding management of objects +// Optimization: the obsolete types was put at the end +// ---------------------------------------------------- +// Declarations +var $1 : Text +var $2 : Pointer +var $3 : Pointer +var $4 : Pointer -C_BOOLEAN:C305($Boo_stop) -C_LONGINT:C283($Lon_i;$Lon_index;$Lon_indice;$Lon_parameters;$Lon_typeNumber;$Lon_x) -C_POINTER:C301($Ptr_arrayComments;$Ptr_arrayLabels;$Ptr_arrayTypes) -C_TEXT:C284($Txt_comment;$Txt_label;$Txt_method) +var $Boo_stop : Boolean +var $Lon_i; $Lon_index; $Lon_indice; $Lon_parameters; $Lon_typeNumber; $Lon_x : Integer +var $Ptr_arrayComments; $Ptr_arrayLabels; $Ptr_arrayTypes : Pointer +var $Txt_comment; $Txt_label; $Txt_method : Text -ARRAY LONGINT:C221($tLon_length;0) -ARRAY LONGINT:C221($tLon_positions;0) -ARRAY TEXT:C222($tTxt_comments;0) -ARRAY TEXT:C222($tTxt_labels;0) -ARRAY TEXT:C222($tTxt_types;0) +ARRAY LONGINT:C221($tLon_length; 0) +ARRAY LONGINT:C221($tLon_positions; 0) +ARRAY TEXT:C222($tTxt_comments; 0) +ARRAY TEXT:C222($tTxt_labels; 0) +ARRAY TEXT:C222($tTxt_types; 0) If (False:C215) - C_TEXT:C284(METHOD_ANALYSE_TO_ARRAYS ;$1) - C_POINTER:C301(METHOD_ANALYSE_TO_ARRAYS ;$2) - C_POINTER:C301(METHOD_ANALYSE_TO_ARRAYS ;$3) - C_POINTER:C301(METHOD_ANALYSE_TO_ARRAYS ;$4) + _O_C_TEXT:C284(METHOD_ANALYSE_TO_ARRAYS; $1) + _O_C_POINTER:C301(METHOD_ANALYSE_TO_ARRAYS; $2) + _O_C_POINTER:C301(METHOD_ANALYSE_TO_ARRAYS; $3) + _O_C_POINTER:C301(METHOD_ANALYSE_TO_ARRAYS; $4) End if - // ---------------------------------------------------- - // Initialisations +// ---------------------------------------------------- +// Initialisations $Lon_parameters:=Count parameters:C259 -If (Asserted:C1132($Lon_parameters>=4;"Missing parameter")) +If (Asserted:C1132($Lon_parameters>=4; "Missing parameter")) $Txt_method:=$1 // Text of the method to analyse $Ptr_arrayTypes:=$2 // Pointer to the array of types to populate $Ptr_arrayLabels:=$3 // Pointer to the array of labels to populate $Ptr_arrayComments:=$4 // Pointer to the array of comments to populate - ARRAY TEXT:C222($tTxt_commands;15) + ARRAY TEXT:C222($tTxt_commands; 15) $tTxt_commands{1}:=Command name:C538(283) // C_LONGINT $tTxt_commands{2}:=Command name:C538(284) // C_TEXT $tTxt_commands{3}:=Command name:C538(285) // C_REAL @@ -66,21 +66,21 @@ If (Asserted:C1132($Lon_parameters>=4;"Missing parameter")) $tTxt_commands{14}:=Command name:C538(1488) // C_COLLECTION $tTxt_commands{15}:=Command name:C538(1683) // C_VARIANT - ARRAY TEXT:C222($tTxt_argumentType;15) - $tTxt_argumentType{1}:=Get localized string:C991("LongInteger") - $tTxt_argumentType{2}:=Get localized string:C991("Text") - $tTxt_argumentType{3}:=Get localized string:C991("Real") - $tTxt_argumentType{4}:=Get localized string:C991("Time") - $tTxt_argumentType{5}:=Get localized string:C991("Pointer") - $tTxt_argumentType{6}:=Get localized string:C991("Picture") - $tTxt_argumentType{7}:=Get localized string:C991("Date") - $tTxt_argumentType{8}:=Get localized string:C991("Boolean") - $tTxt_argumentType{9}:=Get localized string:C991("BLOB") - $tTxt_argumentType{10}:=Get localized string:C991("Object") - $tTxt_argumentType{11}:=Get localized string:C991("Integer") - $tTxt_argumentType{12}:=Get localized string:C991("Graph") - $tTxt_argumentType{13}:=Get localized string:C991("Alpha") - $tTxt_argumentType{14}:=Get localized string:C991("Collection") + ARRAY TEXT:C222($tTxt_argumentType; 15) + $tTxt_argumentType{1}:=Localized string:C991("LongInteger") + $tTxt_argumentType{2}:=Localized string:C991("Text") + $tTxt_argumentType{3}:=Localized string:C991("Real") + $tTxt_argumentType{4}:=Localized string:C991("Time") + $tTxt_argumentType{5}:=Localized string:C991("Pointer") + $tTxt_argumentType{6}:=Localized string:C991("Picture") + $tTxt_argumentType{7}:=Localized string:C991("Date") + $tTxt_argumentType{8}:=Localized string:C991("Boolean") + $tTxt_argumentType{9}:=Localized string:C991("BLOB") + $tTxt_argumentType{10}:=Localized string:C991("Object") + $tTxt_argumentType{11}:=Localized string:C991("Integer") + $tTxt_argumentType{12}:=Localized string:C991("Graph") + $tTxt_argumentType{13}:=Localized string:C991("Alpha") + $tTxt_argumentType{14}:=Localized string:C991("Collection") $tTxt_argumentType{15}:="Variant" $Lon_typeNumber:=Size of array:C274($tTxt_commands) @@ -91,50 +91,50 @@ Else End if - // ---------------------------------------------------- +// ---------------------------------------------------- Repeat $Lon_index:=$Lon_index+1 - ARRAY TEXT:C222($tTxt_patterns;$Lon_typeNumber) + ARRAY TEXT:C222($tTxt_patterns; $Lon_typeNumber) - For ($Lon_i;1;$Lon_typeNumber;1) + For ($Lon_i; 1; $Lon_typeNumber; 1) $tTxt_patterns{$Lon_i}:="(?m)^"+$tTxt_commands{$Lon_i}+"\\s*\\([^\\)]*\\$"+String:C10($Lon_index)+"[;\\)]" End for - If (Match regex:C1019("(?m)^[\\$\\u25CA[<>]](\\w+):=\\$"+String:C10($Lon_index)+"(?:.*?//([^\\r$]*))*$";$Txt_method;1;$tLon_positions;$tLon_length)) + If (Match regex:C1019("(?m)^[\\$\\u25CA[<>]](\\w+):=\\$"+String:C10($Lon_index)+"(?:.*?//([^\\r$]*))*$"; $Txt_method; 1; $tLon_positions; $tLon_length)) - // Get label - $Txt_label:=Substring:C12($Txt_method;$tLon_positions{1};$tLon_length{1}) + // Get label + $Txt_label:=Substring:C12($Txt_method; $tLon_positions{1}; $tLon_length{1}) - // Remove prefix if any (the 1 to 4 first characters before an underscore) - $Lon_x:=Position:C15("_";$Txt_label) + // Remove prefix if any (the 1 to 4 first characters before an underscore) + $Lon_x:=Position:C15("_"; $Txt_label) If ($Lon_x>0)\ & ($Lon_x<=5) - $Txt_label:=Substring:C12($Txt_label;$Lon_x+1) + $Txt_label:=Substring:C12($Txt_label; $Lon_x+1) End if - // Remove suffix if any (the 1 to 2 last characters after an underscore) - $Lon_x:=Position:C15("_";$Txt_label) + // Remove suffix if any (the 1 to 2 last characters after an underscore) + $Lon_x:=Position:C15("_"; $Txt_label) If ($Lon_x>0)\ & ($Lon_x>=(Length:C16($Txt_label)-3)) - $Txt_label:=Substring:C12($Txt_label;1;$Lon_x-1) + $Txt_label:=Substring:C12($Txt_label; 1; $Lon_x-1) End if - $Txt_comment:=Choose:C955(Size of array:C274($tLon_positions)>1;Substring:C12($Txt_method;$tLon_positions{2};$tLon_length{2});"") + $Txt_comment:=Choose:C955(Size of array:C274($tLon_positions)>1; Substring:C12($Txt_method; $tLon_positions{2}; $tLon_length{2}); "") Else - // Not found + // Not found $Txt_label:="Param_"+String:C10($Lon_index) $Txt_comment:="" @@ -142,13 +142,13 @@ Repeat $Boo_stop:=True:C214 - For ($Lon_i;1;$Lon_typeNumber;1) + For ($Lon_i; 1; $Lon_typeNumber; 1) - If (Match regex:C1019($tTxt_patterns{$Lon_i};$Txt_method;1;$tLon_positions;$tLon_length)) + If (Match regex:C1019($tTxt_patterns{$Lon_i}; $Txt_method; 1; $tLon_positions; $tLon_length)) - APPEND TO ARRAY:C911($tTxt_types;$tTxt_argumentType{$Lon_i}) - APPEND TO ARRAY:C911($tTxt_labels;$Txt_label) - APPEND TO ARRAY:C911($tTxt_comments;$Txt_comment) + APPEND TO ARRAY:C911($tTxt_types; $tTxt_argumentType{$Lon_i}) + APPEND TO ARRAY:C911($tTxt_labels; $Txt_label) + APPEND TO ARRAY:C911($tTxt_comments; $Txt_comment) $Lon_i:=MAXLONG:K35:2-1 // STOP $Boo_stop:=False:C215 @@ -157,18 +157,18 @@ Repeat End for Until ($Boo_stop) - // Variable number of parameters of the same type -For ($Lon_i;1;$Lon_typeNumber;1) +// Variable number of parameters of the same type +For ($Lon_i; 1; $Lon_typeNumber; 1) - If (Match regex:C1019("(?m)^"+$tTxt_commands{$Lon_i}+"\\s*\\([^\\)]*\\$\\{(\\d+)\\}";$Txt_method;1;$tLon_positions;$tLon_length)) + If (Match regex:C1019("(?m)^"+$tTxt_commands{$Lon_i}+"\\s*\\([^\\)]*\\$\\{(\\d+)\\}"; $Txt_method; 1; $tLon_positions; $tLon_length)) - $Lon_indice:=Num:C11(Substring:C12($Txt_method;$tLon_positions{1};$tLon_length{1})) + $Lon_indice:=Num:C11(Substring:C12($Txt_method; $tLon_positions{1}; $tLon_length{1})) While (Size of array:C274($tTxt_types)<$Lon_indice) - APPEND TO ARRAY:C911($tTxt_types;"Undefined") - APPEND TO ARRAY:C911($tTxt_labels;"Param_"+String:C10(Size of array:C274($tTxt_types))) - APPEND TO ARRAY:C911($tTxt_comments;"") + APPEND TO ARRAY:C911($tTxt_types; "Undefined") + APPEND TO ARRAY:C911($tTxt_labels; "Param_"+String:C10(Size of array:C274($tTxt_types))) + APPEND TO ARRAY:C911($tTxt_comments; "") End while @@ -180,40 +180,40 @@ For ($Lon_i;1;$Lon_typeNumber;1) End if End for - // Type of the function if any -For ($Lon_i;1;$Lon_typeNumber;1) +// Type of the function if any +For ($Lon_i; 1; $Lon_typeNumber; 1) - If (Match regex:C1019("(?m)^"+$tTxt_commands{$Lon_i}+"\\s*\\([^\\)]*\\$0[^\\)]*";$Txt_method;1;$tLon_positions;$tLon_length)) + If (Match regex:C1019("(?m)^"+$tTxt_commands{$Lon_i}+"\\s*\\([^\\)]*\\$0[^\\)]*"; $Txt_method; 1; $tLon_positions; $tLon_length)) $tTxt_types{0}:=$tTxt_argumentType{$Lon_i} - If (Match regex:C1019("(?m)^\\$0:=[\\$\\u25CA[<>]](\\w+)"+"(?:.*?//([^\\r$]*))*$";$Txt_method;1;$tLon_positions;$tLon_length)) + If (Match regex:C1019("(?m)^\\$0:=[\\$\\u25CA[<>]](\\w+)"+"(?:.*?//([^\\r$]*))*$"; $Txt_method; 1; $tLon_positions; $tLon_length)) - $Txt_label:=Substring:C12($Txt_method;$tLon_positions{1};$tLon_length{1}) + $Txt_label:=Substring:C12($Txt_method; $tLon_positions{1}; $tLon_length{1}) - // Remove prefix if any (the 1 to 4 first characters before an underscore) - $Lon_x:=Position:C15("_";$Txt_label) + // Remove prefix if any (the 1 to 4 first characters before an underscore) + $Lon_x:=Position:C15("_"; $Txt_label) If ($Lon_x>0)\ & ($Lon_x<=5) - $Txt_label:=Substring:C12($Txt_label;$Lon_x+1) + $Txt_label:=Substring:C12($Txt_label; $Lon_x+1) End if - // Remove suffix if any (the 1 to 2 last characters after an underscore) - $Lon_x:=Position:C15("_";$Txt_label) + // Remove suffix if any (the 1 to 2 last characters after an underscore) + $Lon_x:=Position:C15("_"; $Txt_label) If ($Lon_x>0)\ & ($Lon_x>=(Length:C16($Txt_label)-3)) - $Txt_label:=Substring:C12($Txt_label;1;$Lon_x-1) + $Txt_label:=Substring:C12($Txt_label; 1; $Lon_x-1) End if $tTxt_labels{0}:=$Txt_label - $tTxt_comments{0}:=Choose:C955(Size of array:C274($tLon_positions)>1;Substring:C12($Txt_method;$tLon_positions{2};$tLon_length{2});"") + $tTxt_comments{0}:=Choose:C955(Size of array:C274($tLon_positions)>1; Substring:C12($Txt_method; $tLon_positions{2}; $tLon_length{2}); "") End if @@ -222,11 +222,11 @@ For ($Lon_i;1;$Lon_typeNumber;1) End if End for - //%W-518.1 -COPY ARRAY:C226($tTxt_types;$Ptr_arrayTypes->) -COPY ARRAY:C226($tTxt_labels;$Ptr_arrayLabels->) -COPY ARRAY:C226($tTxt_comments;$Ptr_arrayComments->) - //%W+518.1 +//%W-518.1 +COPY ARRAY:C226($tTxt_types; $Ptr_arrayTypes->) +COPY ARRAY:C226($tTxt_labels; $Ptr_arrayLabels->) +COPY ARRAY:C226($tTxt_comments; $Ptr_arrayComments->) +//%W+518.1 - // ---------------------------------------------------- - // End \ No newline at end of file +// ---------------------------------------------------- +// End \ No newline at end of file diff --git a/Project/Sources/Methods/METHOD_Syntax.4dm b/Project/Sources/Methods/METHOD_Syntax.4dm index 46535ca..60c1685 100755 --- a/Project/Sources/Methods/METHOD_Syntax.4dm +++ b/Project/Sources/Methods/METHOD_Syntax.4dm @@ -1,102 +1,65 @@ //%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Project method : METHOD_Syntax - // ID[D8D6EBA99147457E8AF91D1BE651AF8B] - // Created #4-2-2013 by Vincent de Lachaux - // ---------------------------------------------------- - // Description: - // - // ---------------------------------------------------- - // Declarations -C_TEXT:C284($0) -C_TEXT:C284($1) -C_TEXT:C284($2) -C_TEXT:C284($3) +// ---------------------------------------------------- +// Project method : METHOD_Syntax +// ID[D8D6EBA99147457E8AF91D1BE651AF8B] +// Created #4-2-2013 by Vincent de Lachaux +// ---------------------------------------------------- +#DECLARE($code : Text; $name : Text; $prefix : Text) : Text -C_LONGINT:C283($end;$i) -C_TEXT:C284($t_code;$t_name;$t_prefix;$t_syntax) +var $end; $i : Integer +var $syntax : Text -ARRAY TEXT:C222($tTxt_comments;0) -ARRAY TEXT:C222($tTxt_labels;0) -ARRAY TEXT:C222($tTxt_types;0) +ARRAY TEXT:C222($_comments; 0) +ARRAY TEXT:C222($_labels; 0) +ARRAY TEXT:C222($_types; 0) -If (False:C215) - C_TEXT:C284(METHOD_Syntax ;$0) - C_TEXT:C284(METHOD_Syntax ;$1) - C_TEXT:C284(METHOD_Syntax ;$2) - C_TEXT:C284(METHOD_Syntax ;$3) -End if +// Get types and labels +METHOD_ANALYSE_TO_ARRAYS($code; ->$_types; ->$_labels; ->$_comments) - // ---------------------------------------------------- - // Initialisations -If (Asserted:C1132(Count parameters:C259>=2;"Missing parameter")) - - $t_code:=$1 // Code of the method to analyse - $t_name:=$2 // Name of the method - - If (Count parameters:C259>=3) - - $t_prefix:=$3 // Prefix used at the beginning of each line - - End if - -Else - - ABORT:C156 - -End if - - // ---------------------------------------------------- - // Get types and labels -METHOD_ANALYSE_TO_ARRAYS ($t_code;->$tTxt_types;->$tTxt_labels;->$tTxt_comments) - - // Set style for method name -$t_name:=""\ -+$t_name\ +// Set style for method name +$name:=""\ ++$name\ +"" - // The first line is the call syntax… -$t_syntax:=""\ -+$t_prefix+Choose:C955(Length:C16($tTxt_types{0})>0;\ -Choose:C955(Length:C16($tTxt_labels{0})=0;$tTxt_types{0};$tTxt_labels{0})\ -+" := "+$t_name;$t_name) +// The first line is the call syntax… +$syntax:=""\ ++$prefix+Choose:C955(Length:C16($_types{0})>0; \ +Choose:C955(Length:C16($_labels{0})=0; $_types{0}; $_labels{0})\ ++" := "+$name; $name) -$end:=Size of array:C274($tTxt_types) +$end:=Size of array:C274($_types) -For ($i;1;$end;1) +For ($i; 1; $end; 1) - // Open parentheses or put a separator - $t_syntax:=Choose:C955($i=1;$t_syntax+" ( ";$t_syntax+" ; ") - $t_syntax:=$t_syntax+$tTxt_labels{$i} + // Open parentheses or put a separator + $syntax:=Choose:C955($i=1; $syntax+" ( "; $syntax+" ; ") + $syntax:=$syntax+$_labels{$i} If ($i=$end) - // Close the parentheses - $t_syntax:=$t_syntax+" )" + // Close the parentheses + $syntax:=$syntax+" )" End if End for - //…then describe the parameters… -For ($i;1;Size of array:C274($tTxt_types);1) +//…then describe the parameters… +For ($i; 1; Size of array:C274($_types); 1) - $t_syntax:=$t_syntax+"\r"\ - +$t_prefix+" -> "+$tTxt_labels{$i}+" ("+$tTxt_types{$i}+")"\ - +Choose:C955(Length:C16($tTxt_comments{$i})>0;" - "+$tTxt_comments{$i};"") + $syntax:=$syntax+"\r"\ + +$prefix+" -> "+$_labels{$i}+" ("+$_types{$i}+")"\ + +Choose:C955(Length:C16($_comments{$i})>0; " - "+$_comments{$i}; "") End for - //…and the return for a function. -If (Length:C16($tTxt_labels{0})>0) +//…and the return for a function. +If (Length:C16($_labels{0})>0) - $t_syntax:=$t_syntax+"\r"+$t_prefix+" <- "+$tTxt_labels{0}+" ("+$tTxt_types{0}+")"\ - +Choose:C955(Length:C16($tTxt_comments{0})>0;" - "+$tTxt_comments{0};"") + $syntax:=$syntax+"\r"+$prefix+" <- "+$_labels{0}+" ("+$_types{0}+")"\ + +Choose:C955(Length:C16($_comments{0})>0; " - "+$_comments{0}; "") End if -$t_syntax:=$t_syntax+"" - -$0:=$t_syntax // Prototype +$syntax:=$syntax+"" - // ---------------------------------------------------- - // End \ No newline at end of file +return $syntax // Prototype \ No newline at end of file diff --git a/Project/Sources/Methods/NoError.4dm b/Project/Sources/Methods/NoError.4dm deleted file mode 100755 index b79f35d..0000000 --- a/Project/Sources/Methods/NoError.4dm +++ /dev/null @@ -1,8 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Method : NoError - // Created 02/07/08 by vdl - // ---------------------------------------------------- - // Description - // Nothing here :-) - // ---------------------------------------------------- diff --git a/Project/Sources/Methods/OPTIONS_GET.4dm b/Project/Sources/Methods/OPTIONS_GET.4dm index 675f110..9b7ae02 100755 --- a/Project/Sources/Methods/OPTIONS_GET.4dm +++ b/Project/Sources/Methods/OPTIONS_GET.4dm @@ -6,18 +6,7 @@ // Description // // ---------------------------------------------------- -C_LONGINT:C283(${1}) - -C_BOOLEAN:C305($Boo_OK) -C_LONGINT:C283($Lon_i) - -If (False:C215) - C_LONGINT:C283(OPTIONS_GET; ${1}) -End if - -If (False:C215) - -End if +_O_C_LONGINT:C283(${1}) //C_LONGINT(<>options) //If (<>options=0) diff --git a/Project/Sources/Methods/Private_Lon_Declaration_Type.4dm b/Project/Sources/Methods/Private_Lon_Declaration_Type.4dm index 348295f..4309ba2 100755 --- a/Project/Sources/Methods/Private_Lon_Declaration_Type.4dm +++ b/Project/Sources/Methods/Private_Lon_Declaration_Type.4dm @@ -35,7 +35,7 @@ For ($Lon_i; 1; Size of array:C274(<>tTxt_2D_Declaration_Patterns); 1) If (Position:C15("("; $Txt_pattern)>0) - $Lon_error:=Rgx_ExtractText($Txt_pattern; $Txt_target; "1"; ->$tTxt_values) + $Lon_error:=_o_Rgx_ExtractText($Txt_pattern; $Txt_target; "1"; ->$tTxt_values) If ($Lon_error=0) diff --git a/Project/Sources/Methods/Rgx_ExtractText.4dm b/Project/Sources/Methods/Rgx_ExtractText.4dm deleted file mode 100755 index 55a8da4..0000000 --- a/Project/Sources/Methods/Rgx_ExtractText.4dm +++ /dev/null @@ -1,152 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Method : Rgx_ExtractText - // Created 28/09/07 by Vincent de Lachaux - // ---------------------------------------------------- - // Description - // Alias "QF_REExtractText" - // ---------------------------------------------------- - // Paramètres - // $1 = Regular expression - // $2 = Target text - // $3 = Group numbers to extract - // $4 = Array of extracted segments - // $5 = Regular expression flags - // $0 = Error result - // ---------------------------------------------------- -C_LONGINT:C283($0) -C_TEXT:C284($1) -C_TEXT:C284($2) -C_TEXT:C284($3) -C_POINTER:C301($4) -C_LONGINT:C283($5) - -C_BOOLEAN:C305($Boo_Array2D;$Boo_OK) -C_LONGINT:C283($Lon_Current_Group;$Lon_Groups;$Lon_i;$Lon_Index;$Lon_Index_Group;$Lon_Options;$Lon_Parameters;$Lon_Start) -C_TEXT:C284($Txt_Error_Method;$Txt_Extracted;$Txt_Pattern;$Txt_Target) - -ARRAY LONGINT:C221($tLon_Lengths;0) -ARRAY LONGINT:C221($tLon_Positions;0) -ARRAY TEXT:C222($tTxt_Groups;0) - -If (False:C215) - C_LONGINT:C283(Rgx_ExtractText ;$0) - C_TEXT:C284(Rgx_ExtractText ;$1) - C_TEXT:C284(Rgx_ExtractText ;$2) - C_TEXT:C284(Rgx_ExtractText ;$3) - C_POINTER:C301(Rgx_ExtractText ;$4) - C_LONGINT:C283(Rgx_ExtractText ;$5) -End if - -$Lon_Parameters:=Count parameters:C259 - -If ($Lon_Parameters<4) - - rgxError:=-50 //Parameter error - -Else - - If ($Lon_Parameters>=5) - - $Lon_Options:=$5 - - End if - - $Txt_Pattern:=rgx_Options ($Lon_Options)+$1 - - If (Length:C16($3)>0) - - Rgx_SplitText ("\\s";$3;->$tTxt_Groups;(0 ?+ 1) ?+ 11) - - End if - - $Lon_Groups:=Size of array:C274($tTxt_Groups) - - $Boo_Array2D:=(Type:C295($4->)=Array 2D:K8:24) - CLEAR VARIABLE:C89($4->) - - rgxError:=-50*Num:C11(($Lon_Groups>1) & Not:C34($Boo_Array2D)) //Parameter error - - $Txt_Error_Method:=Method called on error:C704 - ON ERR CALL:C155("rgx_NO_ERROR") - - $Lon_Start:=1 - - If (rgxError=0) - - $Txt_Target:=$2 - - Repeat - - $Lon_Index:=$Lon_Index+1 - - $Boo_OK:=Match regex:C1019($Txt_Pattern;$Txt_Target;$Lon_Start;$tLon_Positions;$tLon_Lengths) - - If ($Boo_OK)\ - & (rgxError=0) - - If ($Boo_Array2D) - - If ($Lon_Groups=0) - - ARRAY TEXT:C222($4->;$Lon_Index;Size of array:C274($tLon_Positions)) - - Else - - ARRAY TEXT:C222($4->;$Lon_Index;$Lon_Groups) - - End if - End if - - $Lon_Current_Group:=0 - - For ($Lon_i;0;Size of array:C274($tLon_Positions);1) - - $Lon_Index_Group:=Choose:C955($Lon_Groups>0;Find in array:C230($tTxt_Groups;String:C10($Lon_Current_Group));$Lon_Current_Group) - - If ($Lon_Index_Group>=0) - - $Txt_Extracted:=Substring:C12($Txt_Target;$tLon_Positions{$Lon_i};$tLon_Lengths{$Lon_i}) - - If ($Boo_Array2D) - - $4->{$Lon_Index}{$Lon_Index_Group}:=$Txt_Extracted - - Else - - If (($Lon_i=0)\ - & ($Lon_Index=1))\ - | ($Lon_i>0) - - APPEND TO ARRAY:C911($4->;$Txt_Extracted) - - End if - End if - End if - - If ($tLon_Positions{$Lon_i}>0) - - $Lon_Start:=$tLon_Positions{$Lon_i}+$tLon_Lengths{$Lon_i} - - End if - - $Lon_Current_Group:=$Lon_Current_Group+1 - - End for - End if - Until (Not:C34($Boo_OK)) - - If (rgxError=0) - - rgxError:=-Num:C11(Size of array:C274($4->)=0) - - End if - End if - - ON ERR CALL:C155($Txt_Error_Method) - -End if - -$0:=rgxError - -rgxError:=0 \ No newline at end of file diff --git a/Project/Sources/Methods/Rgx_Get_Pattern.4dm b/Project/Sources/Methods/Rgx_Get_Pattern.4dm deleted file mode 100755 index 7d5c840..0000000 --- a/Project/Sources/Methods/Rgx_Get_Pattern.4dm +++ /dev/null @@ -1,96 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Method : Rgx_Get_Pattern - // Created 16/12/05 by Vincent de Lachaux - // ---------------------------------------------------- - // Description - // - // ---------------------------------------------------- - // Modified by Vincent (28/09/07) - // 2004 -> v11 -C_TEXT:C284($0) -C_TEXT:C284($1) -C_TEXT:C284($2) -C_POINTER:C301($3) - -C_LONGINT:C283($Lon_Error;$Lon_Parameters) -C_TEXT:C284($Txt_Buffer;$Txt_Element_Name;$Txt_Path;$Txt_Pattern_Name;$a16_Pattern;$a16_Patterns;$a16_Root) - -ARRAY TEXT:C222($tTxt_Matches;0) - -If (False:C215) - C_TEXT:C284(Rgx_Get_Pattern ;$0) - C_TEXT:C284(Rgx_Get_Pattern ;$1) - C_TEXT:C284(Rgx_Get_Pattern ;$2) - C_POINTER:C301(Rgx_Get_Pattern ;$3) -End if - -$Lon_Parameters:=Count parameters:C259 - -If ($Lon_Parameters>0) - - $Txt_Pattern_Name:=$1 - - If ($Lon_Parameters>=2) - - $Txt_Path:=$2 - - End if - - If (Length:C16($Txt_Path)=0) - - $Txt_Path:=Get 4D folder:C485(_o_Extras folder:K5:12)+"regex.xml" - - End if - - OK:=Num:C11(Test path name:C476($Txt_Path)=Is a document:K24:1) - - If (OK=1) - - $a16_Root:=DOM Parse XML source:C719($Txt_Path;False:C215) - - If (OK=1) - - $a16_Patterns:=DOM Find XML element:C864($a16_Root;"/REGEX/patterns/") - - If (OK=1) - - $a16_Pattern:=DOM Get first child XML element:C723($a16_Patterns) - - If (OK=1) - - Repeat - - DOM GET XML ATTRIBUTE BY NAME:C728($a16_Pattern;"name";$Txt_Element_Name) - - If ($Txt_Pattern_Name=$Txt_Element_Name) - - DOM GET XML ELEMENT VALUE:C731($a16_Pattern;$Txt_Buffer;$Txt_Buffer) - - If (Count parameters:C259>=3) - - DOM GET XML ATTRIBUTE BY NAME:C728($a16_Pattern;"groupsToExtract";$3->) - - End if - - Else - - $a16_Pattern:=DOM Get next sibling XML element:C724($a16_Pattern) - - End if - Until ($Txt_Pattern_Name=$Txt_Element_Name)\ - | (OK=0) - End if - End if - - DOM CLOSE XML:C722($a16_Root) - - End if - - //Deleting Spaces & Comments - $Lon_Error:=Rgx_SubstituteText ("\\s*\\(\\?#[^)]*\\)|\\s";"";->$Txt_Buffer) - - End if -End if - -$0:=$Txt_Buffer \ No newline at end of file diff --git a/Project/Sources/Methods/Rgx_MatchText.4dm b/Project/Sources/Methods/Rgx_MatchText.4dm deleted file mode 100755 index a4ef4a0..0000000 --- a/Project/Sources/Methods/Rgx_MatchText.4dm +++ /dev/null @@ -1,134 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Method : Rgx_MatchText - // Created 28/09/07 by Vincent - // ---------------------------------------------------- - // Description - // Alias "QF_REMatchText" - // ---------------------------------------------------- - // Paramètres - // $1 = Regular expression - // $2 = Target text - // $3 = {Array of matches (Pointer)} - // $4 = {Regular expression flags} - // $0 = Error result - // ---------------------------------------------------- -C_LONGINT:C283($0) -C_TEXT:C284($1) -C_TEXT:C284($2) -C_POINTER:C301($3) -C_LONGINT:C283($4) - -C_BOOLEAN:C305($Boo_OK) -C_LONGINT:C283($Lon_i;$Lon_Options;$Lon_Parameters;$Lon_Size;$Lon_Start) -C_POINTER:C301($Ptr_Array) -C_TEXT:C284($Txt_Buffer;$Txt_Error_Method;$Txt_Pattern;$Txt_Target) - -ARRAY LONGINT:C221($tLon_Lengths;0) -ARRAY LONGINT:C221($tLon_Positions;0) - -If (False:C215) - C_LONGINT:C283(Rgx_MatchText ;$0) - C_TEXT:C284(Rgx_MatchText ;$1) - C_TEXT:C284(Rgx_MatchText ;$2) - C_POINTER:C301(Rgx_MatchText ;$3) - C_LONGINT:C283(Rgx_MatchText ;$4) -End if - -$Lon_Parameters:=Count parameters:C259 - -If ($Lon_Parameters<2) - - rgxError:=-50 //Parameter error - -Else - - rgxError:=-1 - - If ($Lon_Parameters>=3) - $Ptr_Array:=$3 - If ($Lon_Parameters>=4) - $Lon_Options:=$4 - End if - End if - - $Txt_Pattern:=rgx_Options ($Lon_Options)+$1 - $Txt_Target:=$2 - - If (Not:C34(Is nil pointer:C315($Ptr_Array))) - - CLEAR VARIABLE:C89($Ptr_Array->) - - End if - - $Txt_Error_Method:=Method called on error:C704 - ON ERR CALL:C155("rgx_NO_ERROR") - - $Lon_Start:=1 - - Repeat - - $Boo_OK:=Match regex:C1019($Txt_Pattern;$Txt_Target;$Lon_Start;$tLon_Positions;$tLon_Lengths) - - If ($Boo_OK) - - rgxError:=0 - - $Lon_Size:=Size of array:C274($tLon_Positions) - - For ($Lon_i;0;$Lon_Size;1) - - $Txt_Buffer:=Substring:C12($Txt_Target;$tLon_Positions{$Lon_i};$tLon_Lengths{$Lon_i}) - - If ($tLon_Lengths{$Lon_i}=0) - - $Boo_OK:=($Lon_i>0) - - If ($Boo_OK) - - $Boo_OK:=($tLon_Positions{$Lon_i}#$tLon_Positions{$Lon_i-1}) - - End if - - End if - - If ($Boo_OK) - - If (Not:C34(Is nil pointer:C315($Ptr_Array))) - - If ($Lon_i=0) - - $Ptr_Array->{0}:=$Txt_Buffer - - Else - - APPEND TO ARRAY:C911($Ptr_Array->;$Txt_Buffer) - - End if - - End if - - If ($tLon_Positions{$Lon_i}>0) - $Lon_Start:=$tLon_Positions{$Lon_i}+$tLon_Lengths{$Lon_i} - End if - - Else - - $Lon_i:=$Lon_Size+1 - - End if - - End for - - $Boo_OK:=False:C215 - - End if - - Until (Not:C34($Boo_OK)) - - ON ERR CALL:C155($Txt_Error_Method) -End if - -$0:=rgxError - -rgxError:=0 \ No newline at end of file diff --git a/Project/Sources/Methods/Rgx_SplitText.4dm b/Project/Sources/Methods/Rgx_SplitText.4dm deleted file mode 100755 index b1d9f3f..0000000 --- a/Project/Sources/Methods/Rgx_SplitText.4dm +++ /dev/null @@ -1,122 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Method : Rgx_SplitText - // Created 27/09/07 by Vincent de Lachaux - // ---------------------------------------------------- - // Description - // Alias "QF_SplitText" - // ---------------------------------------------------- - // Paramètres - // $1 = Regular expression - // $2 = Target text - // $3 = Array of text segments - // $4 = Regular expression flags - // $0 = Error result - // ---------------------------------------------------- -C_LONGINT:C283($0) -C_TEXT:C284($1) -C_TEXT:C284($2) -C_POINTER:C301($3) -C_LONGINT:C283($4) - -C_BOOLEAN:C305($Boo_OK) -C_LONGINT:C283($Lon_Error;$Lon_i;$Lon_Options;$Lon_Parameters;$Lon_Start) -C_TEXT:C284($Txt_Buffer;$Txt_Error_Method;$Txt_Pattern;$Txt_Target) - -ARRAY LONGINT:C221($tLon_Lengths;0) -ARRAY LONGINT:C221($tLon_Positions;0) - -If (False:C215) - C_LONGINT:C283(Rgx_SplitText ;$0) - C_TEXT:C284(Rgx_SplitText ;$1) - C_TEXT:C284(Rgx_SplitText ;$2) - C_POINTER:C301(Rgx_SplitText ;$3) - C_LONGINT:C283(Rgx_SplitText ;$4) -End if - -C_LONGINT:C283(rgxError) - -$Lon_Parameters:=Count parameters:C259 - -If ($Lon_Parameters<3) - - rgxError:=-50 //Parameter error - -Else - - If ($Lon_Parameters>=4) - $Lon_Options:=$4 - End if - - $Txt_Pattern:=rgx_Options ($Lon_Options)+$1 - $Txt_Target:=$2 - - CLEAR VARIABLE:C89($3->) - - $Txt_Error_Method:=Method called on error:C704 - ON ERR CALL:C155("rgx_NO_ERROR") - - $Lon_Start:=1 - - Repeat - - $Boo_OK:=Match regex:C1019($Txt_Pattern;$Txt_Target;$Lon_Start;$tLon_Positions;$tLon_Lengths) - - If ($Boo_OK) - - For ($Lon_i;0;Size of array:C274($tLon_Positions);1) - - If ($Lon_i=0) - $Txt_Buffer:=Substring:C12($Txt_Target;$Lon_Start;$tLon_Positions{$Lon_i}-$Lon_Start) - Else - $Txt_Buffer:=Substring:C12($Txt_Target;$tLon_Positions{$Lon_i-1};$tLon_Positions{$Lon_i}-1) - End if - - If ($Lon_Options ?? 11) //Trim unnecessary whitespace or tab from the start and the end of a string. - $Lon_Error:=Rgx_SubstituteText ("^\\s*";"";->$Txt_Buffer) - $Lon_Error:=Rgx_SubstituteText ("\\s*$";"";->$Txt_Buffer) - End if - - Case of - //______________________________________________________ - : (Length:C16($Txt_Buffer)=0) & ($Lon_Options ?? 10) //Skeep empty lines - //______________________________________________________ - Else - APPEND TO ARRAY:C911($3->;$Txt_Buffer) - //______________________________________________________ - End case - - If ($tLon_Positions{$Lon_i}>0) - $Lon_Start:=$tLon_Positions{$Lon_i}+$tLon_Lengths{$Lon_i} - End if - - End for - - Else - - $Txt_Buffer:=Substring:C12($Txt_Target;$Lon_Start) - - If ($Lon_Options ?? 11) //Trim unnecessary whitespace or tab from the start and the end of a string. - $Lon_Error:=Rgx_SubstituteText ("^\\s*";"";->$Txt_Buffer) - $Lon_Error:=Rgx_SubstituteText ("\\s*$";"";->$Txt_Buffer) - End if - - Case of - //______________________________________________________ - : (Length:C16($Txt_Buffer)=0) & ($Lon_Options ?? 10) //Skeep empty lines - //______________________________________________________ - Else - APPEND TO ARRAY:C911($3->;$Txt_Buffer) - //______________________________________________________ - End case - - End if - - Until (Not:C34($Boo_OK)) - - ON ERR CALL:C155($Txt_Error_Method) -End if - -$0:=rgxError - -rgxError:=0 \ No newline at end of file diff --git a/Project/Sources/Methods/Rgx_SubstituteText.4dm b/Project/Sources/Methods/Rgx_SubstituteText.4dm deleted file mode 100755 index 99bb062..0000000 --- a/Project/Sources/Methods/Rgx_SubstituteText.4dm +++ /dev/null @@ -1,156 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Method : Rgx_SubstituteText - // Created 28/09/07 by Vincent - // ---------------------------------------------------- - // Description - // Alias "QF_RESubstituteText" - // ---------------------------------------------------- - // Paramètres - //$1 = Regular expression - //$2 = Replacement text - //$3 = Target text - //$4 = Regular expression flags - //$0 = Error result - // ---------------------------------------------------- -C_LONGINT:C283($0) -C_TEXT:C284($1) -C_TEXT:C284($2) -C_POINTER:C301($3) -C_LONGINT:C283($4) - -C_BOOLEAN:C305($Boo_OK) -C_LONGINT:C283($Lon_i;$Lon_Index;$Lon_Options;$Lon_Parameters;$Lon_Size;$Lon_Start) -C_TEXT:C284($Txt_Buffer;$Txt_Error_Method;$Txt_Pattern;$Txt_Replacement;$Txt_Target) - -ARRAY LONGINT:C221($tLon_Lengths;0) -ARRAY LONGINT:C221($tLon_Positions;0) -ARRAY LONGINT:C221($tLon_Tempo_Index;0) -ARRAY LONGINT:C221($tLon_Tempo_Lengths;0) -ARRAY LONGINT:C221($tLon_Tempo_Positions;0) -ARRAY TEXT:C222($tTxt_Tempo;0) - -If (False:C215) - C_LONGINT:C283(Rgx_SubstituteText ;$0) - C_TEXT:C284(Rgx_SubstituteText ;$1) - C_TEXT:C284(Rgx_SubstituteText ;$2) - C_POINTER:C301(Rgx_SubstituteText ;$3) - C_LONGINT:C283(Rgx_SubstituteText ;$4) -End if - -$Lon_Parameters:=Count parameters:C259 - -If ($Lon_Parameters<3) - - rgxError:=-50 //Parameter error - -Else - - If ($Lon_Parameters>3) - $Lon_Options:=$4 - End if - - $Txt_Pattern:=rgx_Options ($Lon_Options)+$1 - $Txt_Replacement:=$2 - $Txt_Target:=$3-> - - rgxError:=0 - - If (Length:C16($Txt_Target)>0) - $Txt_Error_Method:=Method called on error:C704 - ON ERR CALL:C155("rgx_NO_ERROR") - - $Lon_Start:=1 - - Repeat - - $Boo_OK:=Match regex:C1019($Txt_Pattern;$Txt_Target;$Lon_Start;$tLon_Positions;$tLon_Lengths) - - If ($Boo_OK) - - $Lon_Index:=0 - - $Lon_Size:=Size of array:C274($tLon_Positions) - - For ($Lon_i;0;$Lon_Size;1) - - $Txt_Buffer:=Substring:C12($Txt_Target;$tLon_Positions{$Lon_i};$tLon_Lengths{$Lon_i}) - - If ($tLon_Positions{$Lon_i}>0) - $Lon_Start:=$tLon_Positions{$Lon_i}+$tLon_Lengths{$Lon_i} - End if - - If ($tLon_Lengths{$Lon_i}=0) - - $Boo_OK:=($Lon_i>0) - - If ($Boo_OK) - - $Boo_OK:=($tLon_Positions{$Lon_i}#$tLon_Positions{$Lon_i-1}) - - End if - - End if - - If ($Boo_OK) - - APPEND TO ARRAY:C911($tTxt_Tempo;$Txt_Buffer) - - APPEND TO ARRAY:C911($tLon_Tempo_Positions;$tLon_Positions{$Lon_i}) - APPEND TO ARRAY:C911($tLon_Tempo_Lengths;$tLon_Lengths{$Lon_i}) - APPEND TO ARRAY:C911($tLon_Tempo_Index;$Lon_Index) - - $Lon_Index:=$Lon_Index+1 - - Else - - $Lon_i:=$Lon_Size+1 - - End if - - End for - - End if - - Until (Not:C34($Boo_OK)) - - $Lon_Size:=Size of array:C274($tTxt_Tempo) - - If ($Lon_Size>0) - - $Lon_Index:=$Lon_Size - - Repeat - - If ($tLon_Tempo_Index{$Lon_Index}#0) - - $Txt_Buffer:="\\"+String:C10($tLon_Tempo_Index{$Lon_Index}) - - If (Position:C15($Txt_Buffer;$Txt_Replacement)>0) - - $Txt_Replacement:=Replace string:C233($Txt_Replacement;$Txt_Buffer;$tTxt_Tempo{$Lon_Index}) - - End if - - Else - - $3->:=Delete string:C232($3->;$tLon_Tempo_Positions{$Lon_Index};$tLon_Tempo_Lengths{$Lon_Index}) - $3->:=Insert string:C231($3->;$Txt_Replacement;$tLon_Tempo_Positions{$Lon_Index}) - $Txt_Replacement:=$2 - - End if - - $Lon_Index:=$Lon_Index-1 - - Until ($Lon_Index=0) - - End if - - ON ERR CALL:C155($Txt_Error_Method) - End if - -End if - -$0:=rgxError - -rgxError:=0 \ No newline at end of file diff --git a/Project/Sources/Methods/Rgx_match.4dm b/Project/Sources/Methods/Rgx_match.4dm deleted file mode 100755 index 78afc70..0000000 --- a/Project/Sources/Methods/Rgx_match.4dm +++ /dev/null @@ -1,140 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Project method : Rgx_match alias Rgx_MatchText - // ID[4FCCB6B6140F4B4593ABA2FADDB4C3A8] - // Created 5-9-2018 by Vincent de Lachaux - // ---------------------------------------------------- - // Description: - // - // ---------------------------------------------------- - // Declarations -C_OBJECT:C1216($0) -C_OBJECT:C1216($1) - -C_BOOLEAN:C305($Boo_match) -C_LONGINT:C283($Lon_i;$Lon_parameters;$Lon_size;$Lon_start) -C_TEXT:C284($Txt_errorMethod) -C_OBJECT:C1216($Obj_in;$Obj_out;$Obj_value) - -ARRAY LONGINT:C221($tLon_lengths;0) -ARRAY LONGINT:C221($tLon_positions;0) - -If (False:C215) - C_OBJECT:C1216(Rgx_match ;$0) - C_OBJECT:C1216(Rgx_match ;$1) -End if - - // ---------------------------------------------------- - // Initialisations -$Lon_parameters:=Count parameters:C259 - -If (Asserted:C1132($Lon_parameters>=1;"Missing parameter")) - - // Required parameters - $Obj_in:=$1 // { pattern , target } - - // Default values - $Obj_out:=New object:C1471("success";False:C215) - - $Lon_start:=1 - - // Optional parameters - If ($Lon_parameters>=2) - - // - - End if - -Else - - ABORT:C156 - -End if - - // ---------------------------------------------------- -If ($Obj_in.pattern#Null:C1517) & ($Obj_in.target#Null:C1517) - - If ($Obj_in.start#Null:C1517) - - $Lon_start:=Num:C11($Obj_in.start) - - End if - - $Txt_errorMethod:=Method called on error:C704 - ON ERR CALL:C155("rgx_NO_ERROR") - - Repeat - - ERROR:=0 - - $Boo_match:=Match regex:C1019($Obj_in.pattern;$Obj_in.target;$Lon_start;$tLon_positions;$tLon_lengths) - - If (ERROR=0) - - If ($Boo_match) - - $Obj_out.success:=True:C214 - - $Lon_size:=Size of array:C274($tLon_positions) - - For ($Lon_i;0;$Lon_size;1) - - $Obj_value:=New object:C1471("data";Substring:C12($Obj_in.target;$tLon_positions{$Lon_i};$tLon_lengths{$Lon_i});"position";$tLon_positions{$Lon_i};"length";$tLon_lengths{$Lon_i}) - - If ($tLon_lengths{$Lon_i}=0) - - $Boo_match:=($Lon_i>0) - - If ($Boo_match) - - $Boo_match:=($tLon_positions{$Lon_i}#$tLon_positions{$Lon_i-1}) - - End if - End if - - //If ($Boo_match) - If ($Obj_out.match=Null:C1517) - - $Obj_out.match:=New collection:C1472 - - End if - - $Obj_out.match.push($Obj_value) - - If ($tLon_positions{$Lon_i}>0) - - $Lon_start:=$tLon_positions{$Lon_i}+$tLon_lengths{$Lon_i} - - End if - - // Else - //$Lon_i:=$Lon_size+1 - // End if - - End for - - $Boo_match:=Bool:C1537($Obj_in.all) // Stop after the first match ? - - End if - - Else - - $Obj_out.error:=ERROR - - End if - Until (Not:C34($Boo_match)) - - ON ERR CALL:C155($Txt_errorMethod) - -Else - - ASSERT:C1129(False:C215;"Missing property") - -End if - - // ---------------------------------------------------- - // Return -$0:=$Obj_out // { success , match: [ { data , position , length } , … ] } - - // ---------------------------------------------------- - // End \ No newline at end of file diff --git a/Project/Sources/Methods/_4DPop_MACROS.4dm b/Project/Sources/Methods/_4DPop_MACROS.4dm index 7a6efee..b478e7a 100644 --- a/Project/Sources/Methods/_4DPop_MACROS.4dm +++ b/Project/Sources/Methods/_4DPop_MACROS.4dm @@ -10,10 +10,8 @@ #DECLARE($action : Text; $text : Text; $title : Text; ... : Pointer) var $t : Text -var $bottom; $height; $i; $left; $pos; $process : Integer -var $right; $size; $tab; $top; $width; $winRef : Integer -var $o : Object -var $c : Collection +var $bottom; $height; $i; $left; $pos; $right : Integer +var $size; $tab; $top; $width; $winRef : Integer If (Count parameters:C259>=1) @@ -36,23 +34,24 @@ If (Count parameters:C259>=1) End if -var $macro : cs:C1710.macro:=cs:C1710.macro.new() +var $mcro : cs:C1710.macro:=cs:C1710.macro.new() var $success : Boolean:=True:C214 -If ($macro.macroCall) // Install menu bar to allow Copy - Paste +If ($mcro.macroCall) - cs:C1710.menu.new().defaultMinimalMenuBar().setBar() + // MARK: Install menu bar to allow Copy - Paste + cs:C1710.menuBar.new().defaultMinimalMenuBar().set() End if Case of - //______________________________________________________ - : (OB Instance of:C1731($macro[$action]; 4D:C1709.Function)) + // ______________________________________________________ + : (OB Instance of:C1731($mcro[$action]; 4D:C1709.Function)) - $macro[$action]() + $mcro[$action]() - //______________________________________________________ + // ______________________________________________________ : ($action="upperCase")\ | ($action="lowerCase")\ | ($action="string_list")\ @@ -78,7 +77,7 @@ Case of ALERT:C41("OBSOLETE ACTION\rNo longer available or included in 4D") - //______________________________________________________ + // ______________________________________________________ : ($action="_paste_as_string")\ | ($action="_paste_in_string")\ | ($action="paste_html")\ @@ -89,26 +88,26 @@ Case of | ($action="convert_to_utf8")\ | ($action="convert_to_html") // [=>] moved to SpecialPaste - $macro.SpecialPaste() + $mcro.SpecialPaste() - //______________________________________________________ + // ______________________________________________________ : ($action="4d_folder") // • Open "Macro v2" folder in the current 4D folder - $o:=Folder:C1567(fk user preferences folder:K87:10).folder("Macros v2") - $o.create() - SHOW ON DISK:C922($o.platformPath; *) + var $folder : Object:=Folder:C1567(fk user preferences folder:K87:10).folder("Macros v2") + $folder.create() + SHOW ON DISK:C922($folder.platformPath; *) - //______________________________________________________ + // ______________________________________________________ : ($action="method-export") // #10-2-2016 - export the method METHODS("export"; $text) - //______________________________________________________ - : ($action="method-new") //#v14 Create a method with the selection + // ______________________________________________________ + : ($action="method-new") // #v14 Create a method with the selection - METHODS("new"; $macro.highlighted) + METHODS("new"; $mcro.highlighted) - //______________________________________________________ + // ______________________________________________________ : ($action="method-comments") // Edit method's comments If (Bool:C1537(Get database parameter:C643(113))) // Project mode @@ -121,13 +120,13 @@ Case of End if - //______________________________________________________ + // ______________________________________________________ : ($action="method-list") // Display a hierarchical methods' menu METHODS("list") - //______________________________________________________ - : ($action="method-attributes") //#v13 Set methodes attributes + // ______________________________________________________ + : ($action="method-attributes") // #v13 Set methodes attributes If (Bool:C1537(Get database parameter:C643(113))) // Project mode @@ -139,23 +138,24 @@ Case of End if - //______________________________________________________ - : ($action="3D_button") //#v12 Rapid 3D button génération + // ______________________________________________________ + : ($action="3D_button") // #v12 Rapid 3D button génération $winRef:=Open form window:C675("CREATE_BUTTON"; Plain form window:K39:10; Horizontally centered:K39:1; Vertically centered:K39:4; *) DIALOG:C40("CREATE_BUTTON") CLOSE WINDOW:C154 - //______________________________________________________ + + // ______________________________________________________ : ($action="edit_comment") // • Edit comments COMMENTS("edit") - //______________________________________________________ + // ______________________________________________________ : ($action="about") - If ($macro.macroCall) + If ($mcro.macroCall) - $process:=New process:C317(Current method name:C684; 0; Current method name:C684; "about"; $text) + var $process : Integer:=New process:C317(Current method name:C684; 0; Current method name:C684; "about"; $text) Else @@ -163,7 +163,7 @@ Case of End if - //______________________________________________________ + // ______________________________________________________ : ($action="_display_list@") $size:=Size of array:C274(<>tTxt_Labels) @@ -219,7 +219,7 @@ Case of // ..................................................... : ($text="str") - $t:=$macro.highlighted+";"+String:C10(<>tTxt_Labels)+")`"+<>tTxt_Labels{<>tTxt_Labels} + $t:=$mcro.highlighted+";"+String:C10(<>tTxt_Labels)+")`"+<>tTxt_Labels{<>tTxt_Labels} // ..................................................... : ($text="STR#") @@ -236,7 +236,7 @@ Case of // ..................................................... Else - $t:=Choose:C955(Macintosh option down:C545 | Windows Alt down:C563; <>tTxt_Comments{<>tTxt_Labels}; <>tTxt_Labels{<>tTxt_Labels}) + $t:=Macintosh option down:C545 | Windows Alt down:C563 ? <>tTxt_Comments{<>tTxt_Labels} : <>tTxt_Labels{<>tTxt_Labels} $t:=Replace string:C233($text+"%"+$text; "%"; $t) // ..................................................... @@ -256,23 +256,23 @@ Case of End if - //______________________________________________________ + // ______________________________________________________ : ($action="_se_Placer_au_Debut") GET MACRO PARAMETER:C997(Full method text:K5:17; $t) SET MACRO PARAMETER:C998(Full method text:K5:17; kCaret+$t) - //______________________________________________________ - : (Length:C16($macro.method)=0) // ******************************** All the macros below need a method ********************************* + // MARK:- All the macros below need a method + : (Length:C16($mcro.method)=0) $success:=False:C215 - //______________________________________________________ + // ______________________________________________________ : ($action="dot_notation") // [IN WORKS] convert OB GET/OB SET to dot notation - DOT_NOTATION($macro.highlighted) + DOT_NOTATION($mcro.highlighted) - //______________________________________________________ + // ______________________________________________________ : ($action="locals_list") // • List of local variables ARRAY TEXT:C222(<>tTxt_Labels; 0x0000) @@ -287,37 +287,38 @@ Case of Else - <>Txt_Title:=Get localized string:C991("LocalVariables") + <>Txt_Title:=Localized string:C991("LocalVariables") _4DPop_MACROS("_display_list_not_sorted") End if End if - //______________________________________________________ + // ______________________________________________________ : ($action="Keywords") // [IN WORKS] Keywords list // (method, commands, variables and more) - //______________________________________________________ + + // ______________________________________________________ : ($action="Comment_method") // [IN WORKS] - // Create a standard comment for the method according to the declaration. + // TODO: Create a standard comment for the method according to the declaration. // This comment could be past in the comment part of the explorer - //______________________________________________________ - : (Length:C16($macro.highlighted)=0) // ******************************* All the macros below need a selection ******************************* + // MARK:- All the macros below need a selection + : (Length:C16($mcro.highlighted)=0) $success:=False:C215 - //______________________________________________________ + // ______________________________________________________ : ($action="copyWithoutIndentation") - $c:=Split string:C1554($macro.highlighted; "\r") + var $c : Collection:=Split string:C1554($mcro.highlighted; "\r") $t:=$c[0] While ($t[[1]]="\t") - $tab:=$tab+1 + $tab+=1 $t:=Delete string:C232($t; 1; 1) End while @@ -334,13 +335,13 @@ Case of $t:=$c.join("\r") SET TEXT TO PASTEBOARD:C523($t) - //______________________________________________________ + // ______________________________________________________ : ($action="Asserted") // #24-8-2017 - Conditional assertion - $t:=Command name:C538(1132)+"("+$macro.highlighted+";\""+kCaret+"\")" + $t:=Command name:C538(1132)+"("+$mcro.highlighted+";\""+kCaret+"\")" SET MACRO PARAMETER:C998(Highlighted method text:K5:18; $t) - //______________________________________________________ + // ______________________________________________________ : ($action="compiler_directive") // Add compiler directive around the highlighted text $t:=Request:C163("Warning reference:"; "xxx.x") @@ -349,74 +350,52 @@ Case of && (Length:C16($t)>0)\ && ($t="@.@") - SET MACRO PARAMETER:C998(Highlighted method text:K5:18; "//%W-"+$t+"\r"+$macro.highlighted+"\r//%W+"+$t) + SET MACRO PARAMETER:C998(Highlighted method text:K5:18; " // %W-"+$t+"\r"+$mcro.highlighted+"\r//%W+"+$t) End if - //______________________________________________________ + // ______________________________________________________ : ($action="googleSearch") - OPEN URL:C673("www.google.fr/search?q="+$macro.highlighted) + OPEN URL:C673("www.google.fr/search?q="+$mcro.highlighted) - //______________________________________________________ + // ______________________________________________________ : ($action="comment_current_level") // Comments the first and the last line of a logic block COMMENTS("bloc") - //______________________________________________________ - : ($action="convert_hexa") // • Change the selection by Hexadecimal - - $success:=_o_isNumeric($macro.highlighted) - - If ($success) - - SET MACRO PARAMETER:C998(Highlighted method text:K5:18; String:C10(Num:C11($macro.highlighted); "&x")+kCaret) - - End if - - //______________________________________________________ - : ($action="convert_decimal") // • Change the selection by Decimal - - $success:=($macro.highlighted="0x@") - - If ($success) - - SET MACRO PARAMETER:C998(Highlighted method text:K5:18; String:C10(str_gLon_Hex_To_Long($macro.highlighted))+kCaret) - - End if - - //______________________________________________________ + // ______________________________________________________ : ($action="invert_expression") // Reverse expression INVERT_EXPRESSION - //______________________________________________________ + // ______________________________________________________ : ($action="convert_to_execute") // EXECUTER METHODE [New v13] CODE_TO_EXECUTE - //______________________________________________________ + // ______________________________________________________ : ($action="convert_to_formula") // EXECUTER FORMULE CODE_TO_EXECUTE_FORMULA - //______________________________________________________ + // ______________________________________________________ Else $success:=False:C215 - //______________________________________________________ + // ______________________________________________________ End case If (Not:C34($success))\ - & ($action#"_@") //error + & ($action#"_@") // Error BEEP:C151 End if -If ($macro.macroCall) +If ($mcro.macroCall) - // + // Something to do? End if \ No newline at end of file diff --git a/Project/Sources/Methods/_Method131.4dm b/Project/Sources/Methods/_Method131.4dm new file mode 100644 index 0000000..eaeeb93 --- /dev/null +++ b/Project/Sources/Methods/_Method131.4dm @@ -0,0 +1,29 @@ +//%attributes = {} + +//$line:="$o:=New object(\\\r\"property1\"; 1;\\\r\"property2\"; 2)" + +/* + +$o:=New object(\ +"property1"; 1; \ +"property2"; 2) + +A tranfomer en + +$o : Object:={\ +property1: "value1"; \ +property2: "value2"; \ +property3: "value3"; \ +property4: "value4"; \ +property5: "value5"} + +*/ + +/* +remplacer New object( par { +pour chque clef/valeur : + - supprimer le premier guillemet + - remplacer "; par : +remplacer le ) final par } + +*/ diff --git a/Project/Sources/Methods/_Method2.4dm b/Project/Sources/Methods/_Method2.4dm new file mode 100644 index 0000000..6c31f36 --- /dev/null +++ b/Project/Sources/Methods/_Method2.4dm @@ -0,0 +1,92 @@ +//%attributes = {} +// hello world +var $t : Text +var $i; $j : Integer +var $x : Integer +var $o : Object +var $c : Collection + +var $Txt_line : Text:="http://something" + +If (True:C214) && (True:C214) // if + // Affectation +Else + + // A "If" statement should never omit "Else" + If (True:C214) // true + Use ($o) // use + If (True:C214) + + // A "If" statement should never omit "Else" + + Use ($o) + + For each ($t; $c) + + // + For each ($t; $c) + + Case of + : (True:C214) + // + : (False:C215) + // + + //mark:- + Else + + //comment + While (True:C214) + + //do + End while + + End case + // + End for each + + End for each + + End use // 1 End use + End if // 1 End if + + End use // 2 End use + End if // 2 End if + +End if // 3 End if + +//mark:-test +If (True:C214) + If (True:C214) + If (True:C214) + If (True:C214) + //%R- + $x:=1 + //%R+ + End if + For ($i; 1; 100; 1) + + For ($j; 1; 100) + + Case of + : (True:C214) + continue + : (False:C215) + Begin SQL + + End SQL + + // + Else + Use ($o) + // + End use + break + End case + End for + End for + End if + + End if + +End if \ No newline at end of file diff --git a/Project/Sources/Methods/_Method4.4dm b/Project/Sources/Methods/_Method4.4dm new file mode 100644 index 0000000..fb59b00 --- /dev/null +++ b/Project/Sources/Methods/_Method4.4dm @@ -0,0 +1,111 @@ +//%attributes = {} +var $x : Integer:=1 + +If (True:C214) + $x:=1 +End if + + + + + +Case of + + : (True:C214) // True + + Case of + + : (True:C214) + + If (True:C214) + + //comment + While (True:C214) + + //do + End while + + End if + Case of + + : (True:C214) + + If (True:C214) + + //comment + While (True:C214) + + //do + End while + + End if + + : (False:C215) + + Case of + + : (True:C214) + + If (True:C214) + + //comment + While (True:C214) + + //do + End while + + End if + + : (False:C215) + + Case of + + : (True:C214) + + If (True:C214) + + //comment + While (True:C214) + + //do + End while + + End if + + : (False:C215) + + // + + Else + + // A "Case of" statement should never omit "Else" + End case + + + Else + + // A "Case of" statement should never omit "Else" + End case + + Else + + // A "Case of" statement should never omit "Else" + End case + : (False:C215) + + // + + Else + + // A "Case of" statement should never omit "Else" + End case + + //mark:-hello world + : (False:C215) // False + + // + Else // Else + + // A "Case of" statement should never omit "Else" +End case + diff --git a/Project/Sources/Methods/_Method5.4dm b/Project/Sources/Methods/_Method5.4dm new file mode 100644 index 0000000..4b77037 --- /dev/null +++ b/Project/Sources/Methods/_Method5.4dm @@ -0,0 +1,42 @@ +//%attributes = {} +var $x : Boolean +var $count; $i : Integer + +Case of + : (True:C214) + If (True:C214) //comment + If (True:C214) //comment + For ($i; 1; 10; 1) //comment + While ($x) + //comment + $count:=$count+$i + End while + End for + End if + End if + : (True:C214) + $count:=1 + $count:=2 + : (True:C214) + For ($i; 1; 10; 1) + $count:=$count*$i + End for //REMOVE CONSECUTIVE BLANK LINES { + + //bloc { + Begin SQL + + SELECT * + FROM _USER_COLUMNS + INTO + :test + + End SQL + //} + + Else //REMOVE CONSECUTIVE BLANK LINES } + While ($x) + $count:=$count+$i + End while +End case + +$count:=Choose:C955(True:C214; 1; 2) \ No newline at end of file diff --git a/Project/Sources/Methods/_Method6.4dm b/Project/Sources/Methods/_Method6.4dm new file mode 100644 index 0000000..f354d2a --- /dev/null +++ b/Project/Sources/Methods/_Method6.4dm @@ -0,0 +1,19 @@ +//%attributes = {} +var $count; $i : Integer +var $o : Object + +$o:=New object:C1471(\ +"property1"; 1; \ +"property2"; 2) + + +/* + THIS IS A COMMENT BLOC + */ +$count:=$count*$i + +/* THIS IS NOT A COMMENT BLOC */ + +/*THIS IS NOT A COMMENT BLOC*/$count:=$count*$i + +$count:=$count*$i/*THIS IS NOT A COMMENT BLOC*/ \ No newline at end of file diff --git a/Project/Sources/Methods/SETTINGS.4dm b/Project/Sources/Methods/_SETTINGS.4dm old mode 100755 new mode 100644 similarity index 100% rename from Project/Sources/Methods/SETTINGS.4dm rename to Project/Sources/Methods/_SETTINGS.4dm diff --git a/Project/Sources/Methods/_o_Beautifier.4dm b/Project/Sources/Methods/_o_Beautifier.4dm deleted file mode 100644 index c6b8244..0000000 --- a/Project/Sources/Methods/_o_Beautifier.4dm +++ /dev/null @@ -1,682 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"incapable"} -// ---------------------------------------------------- -// Project method : Beautifier -// Database: 4DPop Macros -// ID[D4EDEA4D1ADF4DBC8B65758E297D89AB] -// Created 3-12-2012 by Vincent de Lachaux -// ---------------------------------------------------- -// Description: -// Format the method like I wish for easy readability ;-) -// ---------------------------------------------------- -// Declarations -C_TEXT:C284($0) -C_TEXT:C284($1) -C_BOOLEAN:C305($2) - -C_BOOLEAN:C305($Boo_addLine; $Boo_closure; $Boo_comment; $Boo_emptyLine; $Boo_isClosure; $Boo_lineComment) -C_BOOLEAN:C305($Boo_macro; $Boo_return; $Boo_severalLines; $Boo_skipLineAfter; $Boo_testLineAfter; $Boo_testLineBefore) -C_BOOLEAN:C305($Boo_us) -C_LONGINT:C283($errorCode; $Lon_i; $level; $Lon_Lines; $Lon_options; $Lon_parameters) -C_TEXT:C284($kTxt_pattern; $Txt_buffer; $Txt_code; $Txt_lineCode; $Txt_pattern; $Txt_replacement) -C_TEXT:C284($Txt_tempo) - -ARRAY LONGINT:C221($tLon_branchAndLoop; 0) -ARRAY TEXT:C222($tTxt_lines; 0) -ARRAY TEXT:C222($tTxt_controlFlow; 0) - -If (False:C215) - C_TEXT:C284(_o_Beautifier; $0) - C_TEXT:C284(_o_Beautifier; $1) - C_BOOLEAN:C305(_o_Beautifier; $2) -End if - -// ---------------------------------------------------- -// Initialisations -var $beautifier : cs:C1710.beautifier -$beautifier:=cs:C1710.beautifier.new() - -If (Count parameters:C259>=1) - - $Txt_code:=$1 // Text to format - - If (Count parameters:C259>=2) - - $Boo_macro:=$2 // Must be true if called from a macro method - - End if -End if - - -If ($Boo_macro\ - & (Length:C16($Txt_code)=0)) - - //GET MACRO PARAMETER(Full method text; $Txt_code) - $Txt_code:=$beautifier.method - -End if - -_o_localizedControlFlow(""; ->$tTxt_controlFlow) - -// ---------------------------------------------------- -If (Length:C16($Txt_code)>0) - - If (Bool:C1537($beautifier.settings.removeConsecutiveBlankLines)) - - $errorCode:=Rgx_SubstituteText("[\\r\\n]{2,}"; "\r\r"; ->$Txt_code) - - End if - - If (Bool:C1537($beautifier.settings.removeEmptyLinesAtTheEndOfMethod)) - - $errorCode:=Rgx_SubstituteText("(\\r*)$"; ""; ->$Txt_code) - - End if - - If (Bool:C1537($beautifier.settings.removeEmptyLinesAtTheBeginOfMethod)) - - $errorCode:=Rgx_SubstituteText("^(\\r*)"; ""; ->$Txt_code) - - End if - - If (Bool:C1537($beautifier.settings.replaceComparisonsToAnEmptyStringByLengthTest)) - - ARRAY TEXT:C222($tTxt_2D_result; 0x0000; 0x0000) - - $Txt_pattern:="(?mi-s)(\\(|;)([^)#=;]*)(#|=)\"\"\\)" - - If (Rgx_ExtractText($Txt_pattern; $Txt_code; "0 1 2 3"; ->$tTxt_2D_result; 0)=0) - - For ($Lon_i; 1; Size of array:C274($tTxt_2D_result); 1) - - $Txt_replacement:=$tTxt_2D_result{$Lon_i}{2}+Command name:C538(16)+"("+$tTxt_2D_result{$Lon_i}{3}+")"+$tTxt_2D_result{$Lon_i}{4}+"0)" - $Txt_code:=Replace string:C233($Txt_code; $tTxt_2D_result{$Lon_i}{1}; $Txt_replacement) - - End for - End if - End if - - If (Bool:C1537($beautifier.settings.replaceIfElseEndIfByChoose)) - - $Boo_us:=(Command name:C538(1)="Sum") - - $Txt_pattern:="(?im)"\ - +Choose:C955($Boo_us; "If"; "Si")\ - +"\\s\\(([^\r]*\\)*)\\)(?://.*)*\\r\\s*(.*):=(?!.*\\$\\d)([^\r]*?)(//.*)*\\r\\s*"\ - +Choose:C955($Boo_us; "Else"; "Sinon")\ - +".*\\s*\\2:=([^\r]*?)(//.*)*\\r\\s*"\ - +Choose:C955($Boo_us; "End if"; "Fin de si") - - $Txt_replacement:="\\2:="+Command name:C538(955)+"(\\1;\\3;\\5) \\4 \\6" - - $Txt_code:=Replace string:C233($Txt_code; "\\"; "§§") - $errorCode:=Rgx_SubstituteText($Txt_pattern; $Txt_replacement; ->$Txt_code; 0) - $Txt_code:=Replace string:C233($Txt_code; "§§"; "\\") - - End if - - If (Bool:C1537($beautifier.settings.replaceDeprecatedCommand)) - - ARRAY TEXT:C222($tTxt_pattern; 0x0000) - ARRAY TEXT:C222($tTxt_replacement; 0x0000) - - //_o_DISABLE BUTTON({*;}object) - APPEND TO ARRAY:C911($tTxt_pattern; "(?mi-s)("+Command name:C538(193)+"\\(([^\\)]*)\\))") - APPEND TO ARRAY:C911($tTxt_replacement; "//\\1\r"+Command name:C538(1123)+"(\\2;"+Command name:C538(215)+")") - - //_o_ENABLE BUTTON({*;}object) - APPEND TO ARRAY:C911($tTxt_pattern; "(?mi-s)("+Command name:C538(192)+"\\(([^\\)]*)\\))") - APPEND TO ARRAY:C911($tTxt_replacement; "//\\1\r"+Command name:C538(1123)+"(\\2;"+Command name:C538(214)+")") - - //_o_C_STRING ( {method ;} size ; variable {; variable2 ; ... ; variableN} )   - APPEND TO ARRAY:C911($tTxt_pattern; "(?mi-s)("+Command name:C538(293)+"\\(((?:.*;)??)(?:(\\d+);){1}([^\\)]*)\\))") - APPEND TO ARRAY:C911($tTxt_replacement; "//\\1\r"+Command name:C538(284)+"(\\2\\4)") - - //_o_C_INTEGER({method;}variable{;variable2;...;variableN})   - APPEND TO ARRAY:C911($tTxt_pattern; "(?mi-s)("+Command name:C538(282)+"\\(([^\\)]*)\\))") - APPEND TO ARRAY:C911($tTxt_replacement; "//\\1\r"+Command name:C538(283)+"(\\2)") - - //_o_ARRAY STRING ( strLen ; arrayName ; size {; size2} )     - APPEND TO ARRAY:C911($tTxt_pattern; "(?mi-s)("+Command name:C538(218)+"\\(\\d*;([^\\)]*)\\))") - APPEND TO ARRAY:C911($tTxt_replacement; "//\\1\r"+Command name:C538(222)+"(\\2)") - - For ($Lon_i; 1; Size of array:C274($tTxt_pattern); 1) - - ASSERT:C1129(Rgx_SubstituteText($tTxt_pattern{$Lon_i}; $tTxt_replacement{$Lon_i}; ->$Txt_code; 0)=0) - - End for - End if - - $Txt_pattern:="("+$tTxt_controlFlow{1}+" \\([^\\r]*\\r)\\r*" //If - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - $Txt_pattern:="("+$tTxt_controlFlow{4}+"[^\\r]*\\r)\\r*" //case of - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - $Txt_pattern:="("+$tTxt_controlFlow{6}+" \\([^\\r]*\\r)\\r*" //While - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - $Txt_pattern:="("+$tTxt_controlFlow{8}+" \\([^\\r]*\\r)\\r*" //For - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - $Txt_pattern:="("+$tTxt_controlFlow{10}+"[^\\r]*\\r)\\r*" //Repeat - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - $Txt_pattern:="\\r*(\\r"+$tTxt_controlFlow{2}+"[^\\r]*\\r)\\r*" //Else - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - If (Bool:C1537($beautifier.settings.groupingClosureInstructions)) - - $Txt_pattern:="\\r*(\\r"+$tTxt_controlFlow{3}+"[^\\r]*\\r)\\r*" //End If - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - $Txt_pattern:="\\r*(\\r"+$tTxt_controlFlow{5}+"[^\\r]*\\r)\\r*" //End case - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - $Txt_pattern:="\\r*(\\r"+$tTxt_controlFlow{7}+"[^\\r]*\\r)\\r*" //End while - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - $Txt_pattern:="\\r*(\\r"+$tTxt_controlFlow{9}+"[^\\r]*\\r)\\r*" //End for - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - $Txt_pattern:="\\r*(\\r"+$tTxt_controlFlow{11}+" \\([^\\r]*\\r)\\r*" //Until - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - $Txt_pattern:="\\r*(\\r: \\([^\\r]*\\r)\\r*" //Case of test - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - $Txt_pattern:="\\r*(\\r"+$tTxt_controlFlow{13}+"[^\\r]*\\r)\\r*" //End use - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - $Txt_pattern:="\\r*(\\r"+$tTxt_controlFlow{15}+"[^\\r]*\\r)\\r*" //End for each - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\\1"; ->$Txt_code) - - End if - - If (Rgx_SplitText("\\r\\n|\\r|\\n"; $Txt_code; ->$tTxt_lines; 0 ?+ 11)=0) - - $Lon_Lines:=Size of array:C274($tTxt_lines) - - For ($Lon_i; 1; $Lon_Lines; 1) - - $Txt_lineCode:=$tTxt_lines{$Lon_i} - - $tLon_branchAndLoop:=Size of array:C274($tLon_branchAndLoop) - $tLon_branchAndLoop{0}:=$tLon_branchAndLoop{$tLon_branchAndLoop} - - $Txt_pattern:="(?0) - $Boo_testLineAfter:=False:C215 - - End if - End if - - Case of - - //…………………………………………………………… - : (Length:C16($Txt_lineCode)=0) //Line - - $Boo_emptyLine:=True:C214 - - //…………………………………………………………… - : (Position:C15(kCommentMark; $Txt_lineCode)=1) //Comment - - If (Not:C34($Boo_comment)) //multiline - - - - $Boo_testLineBefore:=Choose:C955($Lon_i>1; Bool:C1537($beautifier.settings.aLineOfCommentsMustBePrecededByALineBreak); False:C215)\ - & ($Txt_lineCode#(kCommentMark+"}"))\ - & ($Txt_lineCode#(kCommentMark+"]"))\ - & ($Txt_lineCode#(kCommentMark+")")) - - End if - - //Separator line is made with a comment mark and at least 5 times the same character - $Boo_lineComment:=(Rgx_MatchText(kCommentMark+"(.)\\1{4,}"; $Txt_lineCode)=0) - - //…………………………………………………………… - : (Rgx_MatchText("(?$Txt_lineCode) - - End if - - If (Replace string:C233($Txt_lineCode; " "; "")=($tTxt_controlFlow{1}+"("+Command name:C538(215)+")@")) - - APPEND TO ARRAY:C911($tLon_branchAndLoop; -1) - $Boo_testLineAfter:=False:C215 - $Boo_skipLineAfter:=True:C214 - - Else - - APPEND TO ARRAY:C911($tLon_branchAndLoop; 1) - $Boo_testLineAfter:=Bool:C1537($beautifier.settings.lineBreakBeforeAndAfterSequentialStructuresIncluded) - $Boo_skipLineAfter:=False:C215 - - End if - - //…………………………………………………………… - : (Rgx_MatchText("(?$Txt_lineCode) - - End if - - $Boo_testLineBefore:=Bool:C1537($beautifier.settings.lineBreakBeforeBranchingStructures) & Not:C34($Boo_comment) - $Boo_testLineAfter:=True:C214 - $Boo_skipLineAfter:=False:C215 - - APPEND TO ARRAY:C911($tLon_branchAndLoop; 13) - - //…………………………………………………………… - : (Rgx_MatchText("(?$Txt_lineCode) - - End if - - $Boo_testLineBefore:=Bool:C1537($beautifier.settings.lineBreakBeforeBranchingStructures) & Not:C34($Boo_comment) - $Boo_testLineAfter:=True:C214 - $Boo_skipLineAfter:=False:C215 - - APPEND TO ARRAY:C911($tLon_branchAndLoop; 14) - - //…………………………………………………………… - : (Rgx_MatchText("(?$Txt_lineCode) - - End if - - $Boo_addLine:=Bool:C1537($beautifier.settings.separationLineForCaseOf) - $Boo_testLineBefore:=Not:C34($Boo_comment) - $Boo_testLineAfter:=True:C214 - $Boo_skipLineAfter:=False:C215 - - //…………………………………………………………… - : (Rgx_MatchText("(?$Txt_lineCode) - - End if - - $Boo_testLineBefore:=True:C214 - $Boo_testLineAfter:=True:C214 - $Boo_skipLineAfter:=False:C215 - - APPEND TO ARRAY:C911($tLon_branchAndLoop; 6) - - //…………………………………………………………… - : (Rgx_MatchText("(?$tTxt_result)=0) - - If (Length:C16($tTxt_result{2})=0) - - $Txt_lineCode:=Replace string:C233($Txt_lineCode; $tTxt_result{1}; $tTxt_result{1}+";1") - - End if - End if - End if - - APPEND TO ARRAY:C911($tLon_branchAndLoop; 8) - - //…………………………………………………………… - : (Rgx_MatchText("(?$Txt_lineCode) - - End if - - $Boo_testLineBefore:=Not:C34($Boo_skipLineAfter) | Not:C34($Boo_closure) - $Boo_testLineAfter:=Not:C34($Boo_skipLineAfter) - $Boo_skipLineAfter:=True:C214 - - If ($tLon_branchAndLoop{$tLon_branchAndLoop}=10) - - DELETE FROM ARRAY:C228($tLon_branchAndLoop; $tLon_branchAndLoop; 1) - - End if - - //…………………………………………………………… - : (Position:C15(Command name:C538(948); $Txt_lineCode)=1) //Begin SQL - - $Boo_testLineBefore:=True:C214 - $Boo_testLineAfter:=True:C214 - $Boo_skipLineAfter:=False:C215 - - //…………………………………………………………… - : (Position:C15(Command name:C538(949); $Txt_lineCode)=1) //End SQL - - $Boo_testLineBefore:=True:C214 - $Boo_testLineAfter:=True:C214 - $Boo_skipLineAfter:=False:C215 - - //…………………………………………………………… - Else - - $Boo_emptyLine:=False:C215 - $Boo_testLineBefore:=$Boo_closure - - //…………………………………………………………… - End case - - // #18-8-2017 - If (Bool:C1537($beautifier.settings.formatComments)) // Add a space before the comment and capitalize the first letter - - If (Not:C34(Match regex:C1019("(?m-si)(.)\\1{4,}"; $Txt_lineCode; 1))) // Not for a comment with at least 5 occurrences of the same character - - If (0=Rgx_ExtractText("(?m-si)^(.*)(?=//)//\\s*([^\"$]*)$"; $Txt_lineCode; "1 2"; ->$tTxt_2D_result)) - - If (Length:C16($tTxt_2D_result{1}{1})=0) // Comment line - - If ($tTxt_2D_result{1}{2}[[1]]#"%") // Not for a compilation modifier - - $tTxt_2D_result{1}{2}[[1]]:=Uppercase:C13($tTxt_2D_result{1}{2}[[1]]; *) - $Txt_lineCode:="// "+$tTxt_2D_result{1}{2} - - End if - - Else - - $tTxt_2D_result{1}{2}[[1]]:=Uppercase:C13($tTxt_2D_result{1}{2}[[1]]; *) - $Txt_lineCode:=$tTxt_2D_result{1}{1}+"// "+$tTxt_2D_result{1}{2} - - End if - End if - End if - End if - - $Boo_closure:=$Boo_isClosure - $Boo_comment:=(Position:C15(kCommentMark; $Txt_lineCode)=1) - - If (Not:C34($Boo_severalLines)) - - If ($Boo_addLine) - - If (Not:C34($Boo_lineComment)) - - If ($level>$beautifier.numberOfSeparators) - - $level:=$beautifier.numberOfSeparators - - Else - - If ($level<1) - - $level:=1 - - End if - End if - - $Txt_lineCode:=kCommentMark\ - +($beautifier.separators[$level]*(20-($level\2)))\ - +"\r"\ - +$Txt_lineCode - - End if - - $level:=$level-Num:C11($tLon_branchAndLoop{0}=-5) - - $Boo_lineComment:=False:C215 - $Boo_addLine:=False:C215 - - End if - - If ($Boo_testLineBefore | $Boo_return) - - $Txt_lineCode:=Choose:C955($Boo_emptyLine | ($Lon_i=1); ""; "\r")+$Txt_lineCode - $Boo_emptyLine:=False:C215 - $Boo_testLineBefore:=False:C215 - $Boo_return:=False:C215 - - End if - End if - - $Boo_severalLines:=($Txt_lineCode="@\\") - - // #25-7-2014 - $kTxt_pattern:="(?mi-s)^[^/]*{command}\\(.*\\)(?:\\s*//[^$]*)?$" - - Case of - - //______________________________________________________ - : ($Boo_severalLines)\ - | (Not:C34(Bool:C1537($beautifier.settings.splitKeyValueLines))) - - //#7-4-2017 ________________________________________________________________________________ - : (Rgx_MatchText(Replace string:C233($kTxt_pattern; "{command}"; Command name:C538(1471)); $Txt_lineCode)=0) //New object - - $Txt_lineCode:=_o_beautifier_Split_key_value($Txt_lineCode; 1471) - - //__________________________________________________________________________________________ - : (Rgx_MatchText(Replace string:C233($kTxt_pattern; "{command}"; Command name:C538(1220)); $Txt_lineCode)=0) //OB SET - - $Txt_lineCode:=_o_beautifier_Split_key_value($Txt_lineCode; 1220) - - //__________________________________________________________________________________________ - : (Rgx_MatchText(Replace string:C233($kTxt_pattern; "{command}"; Command name:C538(1055)); $Txt_lineCode)=0) //SVG SET ATTRIBUTE - - $Txt_lineCode:=_o_beautifier_Split_key_value($Txt_lineCode; 1055) - - //__________________________________________________________________________________________ - : (Rgx_MatchText(Replace string:C233($kTxt_pattern; "{command}"; Command name:C538(865)); $Txt_lineCode)=0) //DOM Create XML element - - $Txt_lineCode:=_o_beautifier_Split_key_value($Txt_lineCode; 865) - - //__________________________________________________________________________________________ - : (Rgx_MatchText(Replace string:C233($kTxt_pattern; "{command}"; Command name:C538(866)); $Txt_lineCode)=0) //DOM SET XML ATTRIBUTE - - $Txt_lineCode:=_o_beautifier_Split_key_value($Txt_lineCode; 866) - - //__________________________________________________________________________________________ - : (Rgx_MatchText(Replace string:C233($kTxt_pattern; "{command}"; Command name:C538(1093)); $Txt_lineCode)=0) //ST SET ATTRIBUTES  - - $Txt_lineCode:=_o_beautifier_Split_key_value($Txt_lineCode; 1093) - - //______________________________________________________ - End case - - $tTxt_lines{$Lon_i}:=$Txt_lineCode - - End for - - CLEAR VARIABLE:C89($Txt_code) - - For ($Lon_i; 1; $Lon_Lines; 1) - - $Txt_code:=$Txt_code+$tTxt_lines{$Lon_i}+("\r"*Num:C11($Lon_i#$Lon_Lines)) - - End for - End if - - If (Bool:C1537($beautifier.settings.removeConsecutiveBlankLines)) - - $errorCode:=Rgx_SubstituteText("[\\r\\n]{2,}"; "\r\r"; ->$Txt_code) - - End if - - // #14-1-2015 - remove the line feed, if any, before a compiler directive closure - $Txt_pattern:="(?mi-s)\\r\\r.*(//%W\\+\\d{1,}\\.\\d{1,})\\r" - $errorCode:=Rgx_SubstituteText($Txt_pattern; "\r\\1\r"; ->$Txt_code) - - If ($Boo_macro) - - SET MACRO PARAMETER:C998(Full method text:K5:17; $Txt_code+kCaret) - - Else - - $0:=$Txt_code //formated code - - End if -End if - -// ---------------------------------------------------- -// End \ No newline at end of file diff --git a/Project/Sources/Methods/_o_DECLARATION.4dm b/Project/Sources/Methods/_o_DECLARATION.4dm index 27f60cb..099c6d6 100644 --- a/Project/Sources/Methods/_o_DECLARATION.4dm +++ b/Project/Sources/Methods/_o_DECLARATION.4dm @@ -41,24 +41,24 @@ // Modified by Vincent de Lachaux (05/02/14) // Adding option "Generate comment for tooltip" // ---------------------------------------------------- -C_TEXT:C284($1) -C_POINTER:C301(${2}) +var $1 : Text +_O_C_POINTER:C301(${2}) -C_BOOLEAN:C305($Boo_2Darray; $Boo_comments; $Boo_parameter; $Boo_updateComments) -C_LONGINT:C283($i; $l; $Lon_appearance; $Lon_command; $Lon_count; $Lon_currentLength) -C_LONGINT:C283($Lon_currentType; $Lon_dimensions; $Lon_end_ii; $Lon_error; $Lon_firstIndice; $Lon_icon) -C_LONGINT:C283($Lon_ignoreDeclarations; $Lon_ii; $Lon_j; $Lon_length; $Lon_parameters; $Lon_reference) -C_LONGINT:C283($Lon_size; $Lon_stringLength; $Lon_styles; $Lon_type; $Lon_variablePerLine; $Lon_version) -C_LONGINT:C283($Lon_x; $number) -C_POINTER:C301($Ptr_array) -C_TEXT:C284($Dom_node; $Dom_root; $t; $tt; $Txt_declarations; $Txt_entryPoint) -C_TEXT:C284($Txt_method; $Txt_name; $Txt_patternNonLocalVariable; $Txt_patternParameter) -C_OBJECT:C1216($file; $o; $oo) -C_COLLECTION:C1488($c; $cArrays; $cDirectives; $Col_settings; $Col_type) +var $Boo_2Darray; $Boo_comments; $Boo_parameter; $Boo_updateComments : Boolean +var $i; $l; $Lon_appearance; $Lon_command; $Lon_count; $Lon_currentLength : Integer +var $Lon_currentType; $Lon_dimensions; $Lon_end_ii; $Lon_error; $Lon_firstIndice; $Lon_icon : Integer +var $Lon_ignoreDeclarations; $Lon_ii; $Lon_j; $Lon_length; $Lon_parameters; $Lon_reference : Integer +var $Lon_size; $Lon_stringLength; $Lon_styles; $Lon_type; $Lon_variablePerLine; $Lon_version : Integer +var $Lon_x; $number : Integer +var $Ptr_array : Pointer +var $Dom_node; $Dom_root; $t; $tt; $Txt_declarations; $Txt_entryPoint : Text +var $Txt_method; $Txt_name; $Txt_patternNonLocalVariable; $Txt_patternParameter : Text +var $file; $o; $oo : Object +var $c; $cArrays; $cDirectives; $Col_settings; $Col_type : Collection If (False:C215) - C_TEXT:C284(_o_DECLARATION; $1) - C_POINTER:C301(_o_DECLARATION; ${2}) + _O_C_TEXT:C284(_o_DECLARATION; $1) + _O_C_POINTER:C301(_o_DECLARATION; ${2}) End if // ---------------------------------------------------- @@ -105,8 +105,8 @@ If ($Lon_parameters=0) // Display the dialog If ($o.variables.length>0) - $o.formWindow:=Open form window:C675("NEW_DECLARATION"; Movable form dialog box:K39:8; Horizontally centered:K39:1; At the top:K39:5; *) - DIALOG:C40("NEW_DECLARATION"; $o) + $o.formWindow:=Open form window:C675("DECLARATION"; Movable form dialog box:K39:8; Horizontally centered:K39:1; At the top:K39:5; *) + DIALOG:C40("DECLARATION"; $o) If (Bool:C1537(OK)) @@ -126,15 +126,15 @@ If ($Lon_parameters=0) // Display the dialog $o:=New object:C1471(\ "title"; Get window title:C450(Frontmost window:C447); \ - "method"; win_title(Frontmost window:C447); \ + "method"; _o_win_title(Frontmost window:C447); \ "settings"; $o; \ "controlFlow"; $c; \ "refresh"; Formula:C1597(_o_DECLARATION("DISPLAY")); \ "setType"; Formula:C1597(_o_DECLARATION("TYPE"))\ ) - $l:=Open form window:C675("DECLARATIONS"; Movable form dialog box:K39:8; *) - DIALOG:C40("DECLARATIONS"; $o) + $l:=Open form window:C675("BINARY_DECLARATIONS"; Movable form dialog box:K39:8; *) + DIALOG:C40("BINARY_DECLARATIONS"; $o) CLOSE WINDOW:C154 End if @@ -556,7 +556,7 @@ Else // Nothing to do //______________________________________________________ - : (Position:C15(Get localized string:C991("Method"); Form:C1466.title)#1) + : (Position:C15(Localized string:C991("Method"); Form:C1466.title)#1) // Not a project method @@ -629,12 +629,12 @@ Else End if End for - $Lon_error:=Rgx_SubstituteText("\\r(\\r"+kCaret+")"; "\\1"; ->$Txt_method) + $Lon_error:=_o_Rgx_SubstituteText("\\r(\\r"+kCaret+")"; "\\1"; ->$Txt_method) If (Storage:C1525.macros.preferences.options ?? 29) // Trim multiple empty lines - $Lon_error:=Rgx_SubstituteText("[\\r\\n]{2,}"; "\r\r"; ->$Txt_method) - $Lon_error:=Rgx_SubstituteText("(\\r*)$"; ""; ->$Txt_method) + $Lon_error:=_o_Rgx_SubstituteText("[\\r\\n]{2,}"; "\r\r"; ->$Txt_method) + $Lon_error:=_o_Rgx_SubstituteText("(\\r*)$"; ""; ->$Txt_method) End if @@ -762,7 +762,7 @@ Else $Boo_parameter:=Match regex:C1019("(?m-si)\\$(?:(?:\\d+)|(?:\\{\\d*\\})+)"; $t; 1) - Rgx_ExtractText($Txt_patternNonLocalVariable; $t; "1"; ->$tTxt_nonLocals) + _o_Rgx_ExtractText($Txt_patternNonLocalVariable; $t; "1"; ->$tTxt_nonLocals) $l:=Find in array:C230($tTxt_nonLocals; Form:C1466.method+" ") @@ -847,9 +847,9 @@ Else $t:=<>tTxt_lines{$i} - $Boo_parameter:=(Rgx_MatchText($Txt_patternParameter; $t)=0) + $Boo_parameter:=(_o_Rgx_MatchText($Txt_patternParameter; $t)=0) - Rgx_ExtractText($Txt_patternNonLocalVariable; $t; "1"; ->$tTxt_nonLocals) + _o_Rgx_ExtractText($Txt_patternNonLocalVariable; $t; "1"; ->$tTxt_nonLocals) $l:=Find in array:C230($tTxt_nonLocals; Form:C1466.method+" ") @@ -933,7 +933,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[5]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_LONGINT; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_LONGINT; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_LONGINT>0) & ($Lon_end_ii=0)) Else @@ -983,7 +983,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[11]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_TEXT; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_TEXT; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_TEXT>0) & ($Lon_end_ii=0)) Else @@ -1033,7 +1033,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[2]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_BOOLEAN; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_BOOLEAN; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_BOOLEAN>0) & ($Lon_end_ii=0)) Else @@ -1083,7 +1083,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[1]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_BLOB; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_BLOB; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_BLOB>0) & ($Lon_end_ii=0)) Else @@ -1133,7 +1133,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[3]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_DATE; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_DATE; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_DATE>0) & ($Lon_end_ii=0)) Else @@ -1183,7 +1183,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[7]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_TIME; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_TIME; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_TIME>0) & ($Lon_end_ii=0)) Else @@ -1233,7 +1233,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[9]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_POINTER; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_POINTER; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_POINTER>0) & ($Lon_end_ii=0)) Else @@ -1283,7 +1283,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[8]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_PICTURE; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_PICTURE; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_PICTURE>0) & ($Lon_end_ii=0)) Else @@ -1333,7 +1333,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[12]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_OBJECT; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_OBJECT; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_OBJECT>0) & ($Lon_end_ii=0)) Else @@ -1383,7 +1383,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[10]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_REAL; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_REAL; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_REAL>0) & ($Lon_end_ii=0)) Else @@ -1433,7 +1433,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[0]+"("; ""; 1) - $Lon_stringLength:=util_Lon_Local_in_line($t; ->$tTxt_ALPHA; ->$tTxt_local; $Lon_ignoreDeclarations) + $Lon_stringLength:=_o_util_Lon_Local_in_line($t; ->$tTxt_ALPHA; ->$tTxt_local; $Lon_ignoreDeclarations) $Lon_stringLength:=$Lon_stringLength+(255*Num:C11($Lon_stringLength=0)) @@ -1494,7 +1494,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[4]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_INTEGER; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_INTEGER; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_INTEGER>0) & ($Lon_end_ii=0)) Else @@ -1544,7 +1544,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[6]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_GRAPH; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_GRAPH; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_GRAPH>0) & ($Lon_end_ii=0)) Else @@ -1573,7 +1573,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[13]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_COLLECTION; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_COLLECTION; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_COLLECTION>0) & ($Lon_end_ii=0)) Else @@ -1602,7 +1602,7 @@ Else If ($Lon_ignoreDeclarations=0) | $Boo_parameter $t:=Replace string:C233($t; $cDirectives[14]+"("; ""; 1) - util_Lon_Local_in_line($t; ->$tTxt_VARIANT; ->$tTxt_local; $Lon_ignoreDeclarations) + _o_util_Lon_Local_in_line($t; ->$tTxt_VARIANT; ->$tTxt_local; $Lon_ignoreDeclarations) <>tLon_Line_Statut{$i}:=3*Num:C11((Size of array:C274($tTxt_local)>0) & ($tTxt_VARIANT>0) & ($Lon_end_ii=0)) Else @@ -1628,7 +1628,7 @@ Else //______________________________________________________ Else - util_Lon_Local_in_line($t; ->$tTxt_local) + _o_util_Lon_Local_in_line($t; ->$tTxt_local) //______________________________________________________ End case @@ -1952,7 +1952,7 @@ Else //______________________________________________________ : ($Txt_entryPoint="_init") - cs:C1710.menu.new().defaultMinimalMenuBar().setBar() + cs:C1710.menuBar.new().defaultMinimalMenuBar().set() Compiler_ @@ -2193,7 +2193,7 @@ Else End for - $Dom_root:=xml_cleanup($Dom_root) + $Dom_root:=_o_xml_cleanup($Dom_root) DOM EXPORT TO FILE:C862($Dom_root; Storage:C1525.macros.preferences.platformPath) diff --git a/Project/Sources/Methods/_o_EXTRACT_LOCAL_VARIABLES.4dm b/Project/Sources/Methods/_o_EXTRACT_LOCAL_VARIABLES.4dm index 21e8525..afc0cfa 100644 --- a/Project/Sources/Methods/_o_EXTRACT_LOCAL_VARIABLES.4dm +++ b/Project/Sources/Methods/_o_EXTRACT_LOCAL_VARIABLES.4dm @@ -6,16 +6,16 @@ // Description // // ---------------------------------------------------- -C_TEXT:C284($1) -C_POINTER:C301($2) +_O_C_TEXT:C284($1) +_O_C_POINTER:C301($2) -C_LONGINT:C283($Lon_count; $Lon_i; $Lon_options) -C_POINTER:C301($Ptr_array) -C_TEXT:C284($Txt_method; $Txt_target) +_O_C_LONGINT:C283($Lon_count; $Lon_i; $Lon_options) +_O_C_POINTER:C301($Ptr_array) +_O_C_TEXT:C284($Txt_method; $Txt_target) If (False:C215) - C_TEXT:C284(_o_EXTRACT_LOCAL_VARIABLES; $1) - C_POINTER:C301(_o_EXTRACT_LOCAL_VARIABLES; $2) + _O_C_TEXT:C284(_o_EXTRACT_LOCAL_VARIABLES; $1) + _O_C_POINTER:C301(_o_EXTRACT_LOCAL_VARIABLES; $2) End if ARRAY TEXT:C222(<>tTxt_lines; 0) @@ -36,13 +36,13 @@ End if //Split_Method $Lon_options:=$Lon_options ?+ 0 // Pas les lignes vides $Lon_options:=$Lon_options ?+ 1 // Pas les lignes de commentaires -Util_SPLIT_METHOD($Txt_method; -><>tTxt_lines; $Lon_options) +_o_Util_SPLIT_METHOD($Txt_method; -><>tTxt_lines; $Lon_options) //$Lon_Error:=Rgx_SplitText ("\\r";$Txt_Method;->◊tTxt_Lines;(0 ?+ 10) ?+ 11) For ($Lon_i; 1; Size of array:C274(<>tTxt_lines); 1) - util_Lon_Local_in_line(<>tTxt_lines{$Lon_i}; $Ptr_array) + _o_util_Lon_Local_in_line(<>tTxt_lines{$Lon_i}; $Ptr_array) End for diff --git a/Project/Sources/Methods/_o_Preferences.4dm b/Project/Sources/Methods/_o_Preferences.4dm index 015c017..def9645 100644 --- a/Project/Sources/Methods/_o_Preferences.4dm +++ b/Project/Sources/Methods/_o_Preferences.4dm @@ -12,10 +12,10 @@ var $2 : Text var $3 : Pointer If (False:C215) - C_BOOLEAN:C305(_o_Preferences; $0) - C_TEXT:C284(_o_Preferences; $1) - C_TEXT:C284(_o_Preferences; $2) - C_POINTER:C301(_o_Preferences; $3) + _O_C_BOOLEAN:C305(_o_Preferences; $0) + _O_C_TEXT:C284(_o_Preferences; $1) + _O_C_TEXT:C284(_o_Preferences; $2) + _O_C_POINTER:C301(_o_Preferences; $3) End if var $Dom_node; $Dom_root; $t; $Txt_EntryPoint; $Txt_key; $Txt_property : Text @@ -65,7 +65,7 @@ If (OK=0) If ($src.exists) - $Obj_xml:=xml_fileToObject($src.platformPath) + $Obj_xml:=_o_xml_fileToObject($src.platformPath) If ($Obj_xml.value.M_4DPop#Null:C1517) @@ -114,7 +114,7 @@ If (OK=0) Else - ALERT:C41(Get localized string:C991("File not found.")+" : \""+$tgt.path+"\"") + ALERT:C41(Localized string:C991("File not found.")+" : \""+$tgt.path+"\"") End if End use @@ -136,7 +136,7 @@ Case of //______________________________________________________ : ($Txt_EntryPoint="load") - $Obj_xml:=xml_fileToObject($Obj_preferences.platformPath) + $Obj_xml:=_o_xml_fileToObject($Obj_preferences.platformPath) OK:=Num:C11($Obj_xml.success) If (OK=1) diff --git a/Project/Sources/Methods/_o_Rgx_ExtractText.4dm b/Project/Sources/Methods/_o_Rgx_ExtractText.4dm new file mode 100644 index 0000000..bc57ec7 --- /dev/null +++ b/Project/Sources/Methods/_o_Rgx_ExtractText.4dm @@ -0,0 +1,152 @@ +//%attributes = {"invisible":true,"preemptive":"capable"} +// ---------------------------------------------------- +// Method : Rgx_ExtractText +// Created 28/09/07 by Vincent de Lachaux +// ---------------------------------------------------- +// Description +// Alias "QF_REExtractText" +// ---------------------------------------------------- +// Paramètres +// $1 = Regular expression +// $2 = Target text +// $3 = Group numbers to extract +// $4 = Array of extracted segments +// $5 = Regular expression flags +// $0 = Error result +// ---------------------------------------------------- +_O_C_LONGINT:C283($0) +_O_C_TEXT:C284($1) +_O_C_TEXT:C284($2) +_O_C_TEXT:C284($3) +_O_C_POINTER:C301($4) +_O_C_LONGINT:C283($5) + +_O_C_BOOLEAN:C305($Boo_Array2D; $Boo_OK) +_O_C_LONGINT:C283($Lon_Current_Group; $Lon_Groups; $Lon_i; $Lon_Index; $Lon_Index_Group; $Lon_Options; $Lon_Parameters; $Lon_Start) +_O_C_TEXT:C284($Txt_Error_Method; $Txt_Extracted; $Txt_Pattern; $Txt_Target) + +ARRAY LONGINT:C221($tLon_Lengths; 0) +ARRAY LONGINT:C221($tLon_Positions; 0) +ARRAY TEXT:C222($tTxt_Groups; 0) + +If (False:C215) + _O_C_LONGINT:C283(_o_Rgx_ExtractText; $0) + _O_C_TEXT:C284(_o_Rgx_ExtractText; $1) + _O_C_TEXT:C284(_o_Rgx_ExtractText; $2) + _O_C_TEXT:C284(_o_Rgx_ExtractText; $3) + _O_C_POINTER:C301(_o_Rgx_ExtractText; $4) + _O_C_LONGINT:C283(_o_Rgx_ExtractText; $5) +End if + +$Lon_Parameters:=Count parameters:C259 + +If ($Lon_Parameters<4) + + _o_rgxError:=-50 //Parameter error + +Else + + If ($Lon_Parameters>=5) + + $Lon_Options:=$5 + + End if + + $Txt_Pattern:=_o_rgx_Options($Lon_Options)+$1 + + If (Length:C16($3)>0) + + _o_Rgx_SplitText("\\s"; $3; ->$tTxt_Groups; (0 ?+ 1) ?+ 11) + + End if + + $Lon_Groups:=Size of array:C274($tTxt_Groups) + + $Boo_Array2D:=(Type:C295($4->)=Array 2D:K8:24) + CLEAR VARIABLE:C89($4->) + + _o_rgxError:=-50*Num:C11(($Lon_Groups>1) & Not:C34($Boo_Array2D)) //Parameter error + + $Txt_Error_Method:=Method called on error:C704 + ON ERR CALL:C155("rgx_NO_ERROR") + + $Lon_Start:=1 + + If (_o_rgxError=0) + + $Txt_Target:=$2 + + Repeat + + $Lon_Index:=$Lon_Index+1 + + $Boo_OK:=Match regex:C1019($Txt_Pattern; $Txt_Target; $Lon_Start; $tLon_Positions; $tLon_Lengths) + + If ($Boo_OK)\ + & (_o_rgxError=0) + + If ($Boo_Array2D) + + If ($Lon_Groups=0) + + ARRAY TEXT:C222($4->; $Lon_Index; Size of array:C274($tLon_Positions)) + + Else + + ARRAY TEXT:C222($4->; $Lon_Index; $Lon_Groups) + + End if + End if + + $Lon_Current_Group:=0 + + For ($Lon_i; 0; Size of array:C274($tLon_Positions); 1) + + $Lon_Index_Group:=Choose:C955($Lon_Groups>0; Find in array:C230($tTxt_Groups; String:C10($Lon_Current_Group)); $Lon_Current_Group) + + If ($Lon_Index_Group>=0) + + $Txt_Extracted:=Substring:C12($Txt_Target; $tLon_Positions{$Lon_i}; $tLon_Lengths{$Lon_i}) + + If ($Boo_Array2D) + + $4->{$Lon_Index}{$Lon_Index_Group}:=$Txt_Extracted + + Else + + If (($Lon_i=0)\ + & ($Lon_Index=1))\ + | ($Lon_i>0) + + APPEND TO ARRAY:C911($4->; $Txt_Extracted) + + End if + End if + End if + + If ($tLon_Positions{$Lon_i}>0) + + $Lon_Start:=$tLon_Positions{$Lon_i}+$tLon_Lengths{$Lon_i} + + End if + + $Lon_Current_Group:=$Lon_Current_Group+1 + + End for + End if + Until (Not:C34($Boo_OK)) + + If (_o_rgxError=0) + + _o_rgxError:=-Num:C11(Size of array:C274($4->)=0) + + End if + End if + + ON ERR CALL:C155($Txt_Error_Method) + +End if + +$0:=_o_rgxError + +_o_rgxError:=0 \ No newline at end of file diff --git a/Project/Sources/Methods/_o_Rgx_MatchText.4dm b/Project/Sources/Methods/_o_Rgx_MatchText.4dm new file mode 100644 index 0000000..519006f --- /dev/null +++ b/Project/Sources/Methods/_o_Rgx_MatchText.4dm @@ -0,0 +1,134 @@ +//%attributes = {"invisible":true,"preemptive":"capable"} +// ---------------------------------------------------- +// Method : Rgx_MatchText +// Created 28/09/07 by Vincent +// ---------------------------------------------------- +// Description +// Alias "QF_REMatchText" +// ---------------------------------------------------- +// Paramètres +// $1 = Regular expression +// $2 = Target text +// $3 = {Array of matches (Pointer)} +// $4 = {Regular expression flags} +// $0 = Error result +// ---------------------------------------------------- +_O_C_LONGINT:C283($0) +_O_C_TEXT:C284($1) +_O_C_TEXT:C284($2) +_O_C_POINTER:C301($3) +_O_C_LONGINT:C283($4) + +_O_C_BOOLEAN:C305($Boo_OK) +_O_C_LONGINT:C283($Lon_i; $Lon_Options; $Lon_Parameters; $Lon_Size; $Lon_Start) +_O_C_POINTER:C301($Ptr_Array) +_O_C_TEXT:C284($Txt_Buffer; $Txt_Error_Method; $Txt_Pattern; $Txt_Target) + +ARRAY LONGINT:C221($tLon_Lengths; 0) +ARRAY LONGINT:C221($tLon_Positions; 0) + +If (False:C215) + _O_C_LONGINT:C283(_o_Rgx_MatchText; $0) + _O_C_TEXT:C284(_o_Rgx_MatchText; $1) + _O_C_TEXT:C284(_o_Rgx_MatchText; $2) + _O_C_POINTER:C301(_o_Rgx_MatchText; $3) + _O_C_LONGINT:C283(_o_Rgx_MatchText; $4) +End if + +$Lon_Parameters:=Count parameters:C259 + +If ($Lon_Parameters<2) + + _o_rgxError:=-50 //Parameter error + +Else + + _o_rgxError:=-1 + + If ($Lon_Parameters>=3) + $Ptr_Array:=$3 + If ($Lon_Parameters>=4) + $Lon_Options:=$4 + End if + End if + + $Txt_Pattern:=_o_rgx_Options($Lon_Options)+$1 + $Txt_Target:=$2 + + If (Not:C34(Is nil pointer:C315($Ptr_Array))) + + CLEAR VARIABLE:C89($Ptr_Array->) + + End if + + $Txt_Error_Method:=Method called on error:C704 + ON ERR CALL:C155("rgx_NO_ERROR") + + $Lon_Start:=1 + + Repeat + + $Boo_OK:=Match regex:C1019($Txt_Pattern; $Txt_Target; $Lon_Start; $tLon_Positions; $tLon_Lengths) + + If ($Boo_OK) + + _o_rgxError:=0 + + $Lon_Size:=Size of array:C274($tLon_Positions) + + For ($Lon_i; 0; $Lon_Size; 1) + + $Txt_Buffer:=Substring:C12($Txt_Target; $tLon_Positions{$Lon_i}; $tLon_Lengths{$Lon_i}) + + If ($tLon_Lengths{$Lon_i}=0) + + $Boo_OK:=($Lon_i>0) + + If ($Boo_OK) + + $Boo_OK:=($tLon_Positions{$Lon_i}#$tLon_Positions{$Lon_i-1}) + + End if + + End if + + If ($Boo_OK) + + If (Not:C34(Is nil pointer:C315($Ptr_Array))) + + If ($Lon_i=0) + + $Ptr_Array->{0}:=$Txt_Buffer + + Else + + APPEND TO ARRAY:C911($Ptr_Array->; $Txt_Buffer) + + End if + + End if + + If ($tLon_Positions{$Lon_i}>0) + $Lon_Start:=$tLon_Positions{$Lon_i}+$tLon_Lengths{$Lon_i} + End if + + Else + + $Lon_i:=$Lon_Size+1 + + End if + + End for + + $Boo_OK:=False:C215 + + End if + + Until (Not:C34($Boo_OK)) + + ON ERR CALL:C155($Txt_Error_Method) +End if + +$0:=_o_rgxError + +_o_rgxError:=0 \ No newline at end of file diff --git a/Project/Sources/Methods/_o_Rgx_SplitText.4dm b/Project/Sources/Methods/_o_Rgx_SplitText.4dm new file mode 100644 index 0000000..cd08283 --- /dev/null +++ b/Project/Sources/Methods/_o_Rgx_SplitText.4dm @@ -0,0 +1,122 @@ +//%attributes = {"invisible":true,"preemptive":"capable"} +// ---------------------------------------------------- +// Method : Rgx_SplitText +// Created 27/09/07 by Vincent de Lachaux +// ---------------------------------------------------- +// Description +// Alias "QF_SplitText" +// ---------------------------------------------------- +// Paramètres +// $1 = Regular expression +// $2 = Target text +// $3 = Array of text segments +// $4 = Regular expression flags +// $0 = Error result +// ---------------------------------------------------- +_O_C_LONGINT:C283($0) +_O_C_TEXT:C284($1) +_O_C_TEXT:C284($2) +_O_C_POINTER:C301($3) +_O_C_LONGINT:C283($4) + +_O_C_BOOLEAN:C305($Boo_OK) +_O_C_LONGINT:C283($Lon_Error; $Lon_i; $Lon_Options; $Lon_Parameters; $Lon_Start) +_O_C_TEXT:C284($Txt_Buffer; $Txt_Error_Method; $Txt_Pattern; $Txt_Target) + +ARRAY LONGINT:C221($tLon_Lengths; 0) +ARRAY LONGINT:C221($tLon_Positions; 0) + +If (False:C215) + _O_C_LONGINT:C283(_o_Rgx_SplitText; $0) + _O_C_TEXT:C284(_o_Rgx_SplitText; $1) + _O_C_TEXT:C284(_o_Rgx_SplitText; $2) + _O_C_POINTER:C301(_o_Rgx_SplitText; $3) + _O_C_LONGINT:C283(_o_Rgx_SplitText; $4) +End if + +_O_C_LONGINT:C283(_o_rgxError) + +$Lon_Parameters:=Count parameters:C259 + +If ($Lon_Parameters<3) + + _o_rgxError:=-50 //Parameter error + +Else + + If ($Lon_Parameters>=4) + $Lon_Options:=$4 + End if + + $Txt_Pattern:=_o_rgx_Options($Lon_Options)+$1 + $Txt_Target:=$2 + + CLEAR VARIABLE:C89($3->) + + $Txt_Error_Method:=Method called on error:C704 + ON ERR CALL:C155("rgx_NO_ERROR") + + $Lon_Start:=1 + + Repeat + + $Boo_OK:=Match regex:C1019($Txt_Pattern; $Txt_Target; $Lon_Start; $tLon_Positions; $tLon_Lengths) + + If ($Boo_OK) + + For ($Lon_i; 0; Size of array:C274($tLon_Positions); 1) + + If ($Lon_i=0) + $Txt_Buffer:=Substring:C12($Txt_Target; $Lon_Start; $tLon_Positions{$Lon_i}-$Lon_Start) + Else + $Txt_Buffer:=Substring:C12($Txt_Target; $tLon_Positions{$Lon_i-1}; $tLon_Positions{$Lon_i}-1) + End if + + If ($Lon_Options ?? 11) //Trim unnecessary whitespace or tab from the start and the end of a string. + $Lon_Error:=_o_Rgx_SubstituteText("^\\s*"; ""; ->$Txt_Buffer) + $Lon_Error:=_o_Rgx_SubstituteText("\\s*$"; ""; ->$Txt_Buffer) + End if + + Case of + //______________________________________________________ + : (Length:C16($Txt_Buffer)=0) & ($Lon_Options ?? 10) //Skeep empty lines + //______________________________________________________ + Else + APPEND TO ARRAY:C911($3->; $Txt_Buffer) + //______________________________________________________ + End case + + If ($tLon_Positions{$Lon_i}>0) + $Lon_Start:=$tLon_Positions{$Lon_i}+$tLon_Lengths{$Lon_i} + End if + + End for + + Else + + $Txt_Buffer:=Substring:C12($Txt_Target; $Lon_Start) + + If ($Lon_Options ?? 11) //Trim unnecessary whitespace or tab from the start and the end of a string. + $Lon_Error:=_o_Rgx_SubstituteText("^\\s*"; ""; ->$Txt_Buffer) + $Lon_Error:=_o_Rgx_SubstituteText("\\s*$"; ""; ->$Txt_Buffer) + End if + + Case of + //______________________________________________________ + : (Length:C16($Txt_Buffer)=0) & ($Lon_Options ?? 10) //Skeep empty lines + //______________________________________________________ + Else + APPEND TO ARRAY:C911($3->; $Txt_Buffer) + //______________________________________________________ + End case + + End if + + Until (Not:C34($Boo_OK)) + + ON ERR CALL:C155($Txt_Error_Method) +End if + +$0:=_o_rgxError + +_o_rgxError:=0 \ No newline at end of file diff --git a/Project/Sources/Methods/_o_Rgx_SubstituteText.4dm b/Project/Sources/Methods/_o_Rgx_SubstituteText.4dm new file mode 100644 index 0000000..eaf9400 --- /dev/null +++ b/Project/Sources/Methods/_o_Rgx_SubstituteText.4dm @@ -0,0 +1,156 @@ +//%attributes = {"invisible":true,"preemptive":"capable"} +// ---------------------------------------------------- +// Method : Rgx_SubstituteText +// Created 28/09/07 by Vincent +// ---------------------------------------------------- +// Description +// Alias "QF_RESubstituteText" +// ---------------------------------------------------- +// Paramètres +//$1 = Regular expression +//$2 = Replacement text +//$3 = Target text +//$4 = Regular expression flags +//$0 = Error result +// ---------------------------------------------------- +_O_C_LONGINT:C283($0) +_O_C_TEXT:C284($1) +_O_C_TEXT:C284($2) +_O_C_POINTER:C301($3) +_O_C_LONGINT:C283($4) + +_O_C_BOOLEAN:C305($Boo_OK) +_O_C_LONGINT:C283($Lon_i; $Lon_Index; $Lon_Options; $Lon_Parameters; $Lon_Size; $Lon_Start) +_O_C_TEXT:C284($Txt_Buffer; $Txt_Error_Method; $Txt_Pattern; $Txt_Replacement; $Txt_Target) + +ARRAY LONGINT:C221($tLon_Lengths; 0) +ARRAY LONGINT:C221($tLon_Positions; 0) +ARRAY LONGINT:C221($tLon_Tempo_Index; 0) +ARRAY LONGINT:C221($tLon_Tempo_Lengths; 0) +ARRAY LONGINT:C221($tLon_Tempo_Positions; 0) +ARRAY TEXT:C222($tTxt_Tempo; 0) + +If (False:C215) + _O_C_LONGINT:C283(_o_Rgx_SubstituteText; $0) + _O_C_TEXT:C284(_o_Rgx_SubstituteText; $1) + _O_C_TEXT:C284(_o_Rgx_SubstituteText; $2) + _O_C_POINTER:C301(_o_Rgx_SubstituteText; $3) + _O_C_LONGINT:C283(_o_Rgx_SubstituteText; $4) +End if + +$Lon_Parameters:=Count parameters:C259 + +If ($Lon_Parameters<3) + + _o_rgxError:=-50 //Parameter error + +Else + + If ($Lon_Parameters>3) + $Lon_Options:=$4 + End if + + $Txt_Pattern:=_o_rgx_Options($Lon_Options)+$1 + $Txt_Replacement:=$2 + $Txt_Target:=$3-> + + _o_rgxError:=0 + + If (Length:C16($Txt_Target)>0) + $Txt_Error_Method:=Method called on error:C704 + ON ERR CALL:C155("rgx_NO_ERROR") + + $Lon_Start:=1 + + Repeat + + $Boo_OK:=Match regex:C1019($Txt_Pattern; $Txt_Target; $Lon_Start; $tLon_Positions; $tLon_Lengths) + + If ($Boo_OK) + + $Lon_Index:=0 + + $Lon_Size:=Size of array:C274($tLon_Positions) + + For ($Lon_i; 0; $Lon_Size; 1) + + $Txt_Buffer:=Substring:C12($Txt_Target; $tLon_Positions{$Lon_i}; $tLon_Lengths{$Lon_i}) + + If ($tLon_Positions{$Lon_i}>0) + $Lon_Start:=$tLon_Positions{$Lon_i}+$tLon_Lengths{$Lon_i} + End if + + If ($tLon_Lengths{$Lon_i}=0) + + $Boo_OK:=($Lon_i>0) + + If ($Boo_OK) + + $Boo_OK:=($tLon_Positions{$Lon_i}#$tLon_Positions{$Lon_i-1}) + + End if + + End if + + If ($Boo_OK) + + APPEND TO ARRAY:C911($tTxt_Tempo; $Txt_Buffer) + + APPEND TO ARRAY:C911($tLon_Tempo_Positions; $tLon_Positions{$Lon_i}) + APPEND TO ARRAY:C911($tLon_Tempo_Lengths; $tLon_Lengths{$Lon_i}) + APPEND TO ARRAY:C911($tLon_Tempo_Index; $Lon_Index) + + $Lon_Index:=$Lon_Index+1 + + Else + + $Lon_i:=$Lon_Size+1 + + End if + + End for + + End if + + Until (Not:C34($Boo_OK)) + + $Lon_Size:=Size of array:C274($tTxt_Tempo) + + If ($Lon_Size>0) + + $Lon_Index:=$Lon_Size + + Repeat + + If ($tLon_Tempo_Index{$Lon_Index}#0) + + $Txt_Buffer:="\\"+String:C10($tLon_Tempo_Index{$Lon_Index}) + + If (Position:C15($Txt_Buffer; $Txt_Replacement)>0) + + $Txt_Replacement:=Replace string:C233($Txt_Replacement; $Txt_Buffer; $tTxt_Tempo{$Lon_Index}) + + End if + + Else + + $3->:=Delete string:C232($3->; $tLon_Tempo_Positions{$Lon_Index}; $tLon_Tempo_Lengths{$Lon_Index}) + $3->:=Insert string:C231($3->; $Txt_Replacement; $tLon_Tempo_Positions{$Lon_Index}) + $Txt_Replacement:=$2 + + End if + + $Lon_Index:=$Lon_Index-1 + + Until ($Lon_Index=0) + + End if + + ON ERR CALL:C155($Txt_Error_Method) + End if + +End if + +$0:=_o_rgxError + +_o_rgxError:=0 \ No newline at end of file diff --git a/Project/Sources/Methods/Util_SPLIT_METHOD.4dm b/Project/Sources/Methods/_o_Util_SPLIT_METHOD.4dm old mode 100755 new mode 100644 similarity index 52% rename from Project/Sources/Methods/Util_SPLIT_METHOD.4dm rename to Project/Sources/Methods/_o_Util_SPLIT_METHOD.4dm index 1f20d01..4942035 --- a/Project/Sources/Methods/Util_SPLIT_METHOD.4dm +++ b/Project/Sources/Methods/_o_Util_SPLIT_METHOD.4dm @@ -1,28 +1,28 @@ //%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Method : Util_SPLIT_METHOD - // Created 28/12/06 by Vincent de Lachaux - // ---------------------------------------------------- - // Description - // - // ---------------------------------------------------- -C_TEXT:C284($1) -C_POINTER:C301($2) -C_LONGINT:C283($3) +// ---------------------------------------------------- +// Method : Util_SPLIT_METHOD +// Created 28/12/06 by Vincent de Lachaux +// ---------------------------------------------------- +// Description +// +// ---------------------------------------------------- +_O_C_TEXT:C284($1) +_O_C_POINTER:C301($2) +_O_C_LONGINT:C283($3) -C_BOOLEAN:C305($Boo_expurged) -C_LONGINT:C283($Lon_options;$Lon_x) -C_TEXT:C284($Txt_buffer;$Txt_toSplit) +_O_C_BOOLEAN:C305($Boo_expurged) +_O_C_LONGINT:C283($Lon_options; $Lon_x) +_O_C_TEXT:C284($Txt_buffer; $Txt_toSplit) If (False:C215) - C_TEXT:C284(Util_SPLIT_METHOD ;$1) - C_POINTER:C301(Util_SPLIT_METHOD ;$2) - C_LONGINT:C283(Util_SPLIT_METHOD ;$3) + _O_C_TEXT:C284(_o_Util_SPLIT_METHOD; $1) + _O_C_POINTER:C301(_o_Util_SPLIT_METHOD; $2) + _O_C_LONGINT:C283(_o_Util_SPLIT_METHOD; $3) End if $Txt_toSplit:=$1 -ARRAY TEXT:C222($2->;0) +ARRAY TEXT:C222($2->; 0) $Lon_x:=Length:C16($1) $Lon_x:=Length:C16($Txt_toSplit) @@ -35,12 +35,12 @@ End if Repeat - $Lon_x:=Position:C15("\r";$Txt_toSplit) + $Lon_x:=Position:C15("\r"; $Txt_toSplit) If ($Lon_x>0) - $Txt_buffer:=Substring:C12($Txt_toSplit;1;$lon_x-1) - $Txt_toSplit:=Substring:C12($Txt_toSplit;$Lon_x+1) + $Txt_buffer:=Substring:C12($Txt_toSplit; 1; $lon_x-1) + $Txt_toSplit:=Substring:C12($Txt_toSplit; $Lon_x+1) Else @@ -58,7 +58,7 @@ Repeat Case of - //__________________________________ + //__________________________________ : (Character code:C91($Txt_buffer)=Line feed:K15:40) : (Character code:C91($Txt_buffer)=Tab:K15:37) : (Character code:C91($Txt_buffer)=Space:K15:42) @@ -66,37 +66,37 @@ Repeat : (Character code:C91($Txt_buffer)=160) : (Character code:C91($Txt_buffer)=0x0060)\ & ($Lon_options ?? 3) - //__________________________________ + //__________________________________ Else $Boo_expurged:=True:C214 - //__________________________________ + //__________________________________ End case If (Not:C34($Boo_expurged)) - $Txt_buffer:=Substring:C12($Txt_buffer;2) + $Txt_buffer:=Substring:C12($Txt_buffer; 2) End if Until ($Boo_expurged) Case of - //__________________________________ + //__________________________________ : (Length:C16($Txt_buffer)=0)\ & ($Lon_options ?? 0) //skeep empty line - //__________________________________ + //__________________________________ : (Character code:C91($Txt_buffer)=96)\ & ($Lon_options ?? 1) //skeep comment line - //__________________________________ + //__________________________________ Else - APPEND TO ARRAY:C911($2->;$Txt_buffer) + APPEND TO ARRAY:C911($2->; $Txt_buffer) - //__________________________________ + //__________________________________ End case End if Until ($Lon_x=0)\ diff --git a/Project/Sources/Methods/_o_array_declaration.4dm b/Project/Sources/Methods/_o_array_declaration.4dm index b4519e7..011fea7 100644 --- a/Project/Sources/Methods/_o_array_declaration.4dm +++ b/Project/Sources/Methods/_o_array_declaration.4dm @@ -12,19 +12,19 @@ // Complete refactoring // ---------------------------------------------------- // Declarations -C_LONGINT:C283($0) -C_TEXT:C284($1) -C_POINTER:C301(${2}) +_O_C_LONGINT:C283($0) +_O_C_TEXT:C284($1) +_O_C_POINTER:C301(${2}) -C_BOOLEAN:C305($Boo_ignore; $Boo_localArray) -C_LONGINT:C283($Lon_column; $Lon_error; $Lon_parameters; $Lon_row; $Lon_stringLength; $Lon_x) -C_POINTER:C301($Ptr_Array) -C_TEXT:C284($Txt_arrayName; $Txt_column; $Txt_pattern; $Txt_row; $Txt_target) +_O_C_BOOLEAN:C305($Boo_ignore; $Boo_localArray) +_O_C_LONGINT:C283($Lon_column; $Lon_error; $Lon_parameters; $Lon_row; $Lon_stringLength; $Lon_x) +_O_C_POINTER:C301($Ptr_Array) +_O_C_TEXT:C284($Txt_arrayName; $Txt_column; $Txt_pattern; $Txt_row; $Txt_target) If (False:C215) - C_LONGINT:C283(_o_array_declaration; $0) - C_TEXT:C284(_o_array_declaration; $1) - C_POINTER:C301(_o_array_declaration; ${2}) + _O_C_LONGINT:C283(_o_array_declaration; $0) + _O_C_TEXT:C284(_o_array_declaration; $1) + _O_C_POINTER:C301(_o_array_declaration; ${2}) End if // ---------------------------------------------------- @@ -52,7 +52,7 @@ End if // ---------------------------------------------------- ARRAY TEXT:C222($tTxt_results; 0x0000; 0x0000) $Txt_pattern:="^(?:(\\d*);)?([^;]*);([^;)]*)(?:;([^)]*))?\\).*$" -$Lon_error:=Rgx_ExtractText($Txt_pattern; $Txt_target; "1 2 3 4"; ->$tTxt_results) +$Lon_error:=_o_Rgx_ExtractText($Txt_pattern; $Txt_target; "1 2 3 4"; ->$tTxt_results) If ($Lon_error=0) @@ -88,7 +88,7 @@ If ($Lon_error=0) If ($Lon_parameters>=3) //Append to local variables - util_Lon_Local_in_line($Txt_row; $3) + _o_util_Lon_Local_in_line($Txt_row; $3) End if @@ -125,7 +125,7 @@ If ($Lon_error=0) If ($Lon_parameters>=3) //Append to local variables - util_Lon_Local_in_line($Txt_column; $3) + _o_util_Lon_Local_in_line($Txt_column; $3) End if @@ -154,7 +154,7 @@ If ($Lon_error=0) If ($Lon_parameters>=3) - util_Lon_Local_in_line($Txt_arrayName; $3) + _o_util_Lon_Local_in_line($Txt_arrayName; $3) End if End if diff --git a/Project/Sources/Methods/_o_beautifier_Next_semicolon.4dm b/Project/Sources/Methods/_o_beautifier_Next_semicolon.4dm deleted file mode 100644 index e18fd41..0000000 --- a/Project/Sources/Methods/_o_beautifier_Next_semicolon.4dm +++ /dev/null @@ -1,80 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} -// ---------------------------------------------------- -// Project method : beautifier_Next_semicolon -// Database: 4DPop Macros -// ID[C958A9013881477F9E17E6A3FB51101B] -// Created #29-5-2015 by Vincent de Lachaux -// ---------------------------------------------------- -// Description: -// -// ---------------------------------------------------- -// Declarations -C_LONGINT:C283($0) -C_TEXT:C284($1) - -C_LONGINT:C283($Lon_closingParenthesis; $Lon_openParenthesis; $Lon_parameters; $Lon_semicolon; $Lon_x) -C_TEXT:C284($Txt_in) - -If (False:C215) - C_LONGINT:C283(_o_beautifier_Next_semicolon; $0) - C_TEXT:C284(_o_beautifier_Next_semicolon; $1) -End if - -// ---------------------------------------------------- -// Initialisations -$Lon_parameters:=Count parameters:C259 - -If (Asserted:C1132($Lon_parameters>=1; "Missing parameter")) - - //Required parameters - $Txt_in:=$1 - - //Optional parameters - If ($Lon_parameters>=2) - - // - - End if - -Else - - ABORT:C156 - -End if - -// ---------------------------------------------------- -//first semicolon -$Lon_x:=Position:C15(";"; $Txt_in) - -//second semicolon -$Lon_semicolon:=Position:C15(";"; $Txt_in; $Lon_x+1) - -//open parenthesis -$Lon_openParenthesis:=Position:C15("("; $Txt_in) - -If ($Lon_semicolon>0)\ - & ($Lon_openParenthesis>0)\ - & ($Lon_semicolon>$Lon_openParenthesis) - - Repeat - - //closing parenthesis - $Lon_closingParenthesis:=Position:C15(")"; $Txt_in; $Lon_openParenthesis+1) - - //next semicolon - $Lon_semicolon:=Position:C15(";"; $Txt_in; $Lon_closingParenthesis+1) - - //next opening parenthesis - $Lon_openParenthesis:=Position:C15("("; $Txt_in; $Lon_closingParenthesis+1) - - Until ($Lon_openParenthesis>$Lon_semicolon)\ - | ($Lon_openParenthesis=0) - -End if - -// ---------------------------------------------------- -// Return -$0:=$Lon_semicolon - -// ---------------------------------------------------- -// End \ No newline at end of file diff --git a/Project/Sources/Methods/_o_beautifier_Split_key_value.4dm b/Project/Sources/Methods/_o_beautifier_Split_key_value.4dm deleted file mode 100644 index a8eab69..0000000 --- a/Project/Sources/Methods/_o_beautifier_Split_key_value.4dm +++ /dev/null @@ -1,283 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} -// ---------------------------------------------------- -// Project method : beautifier_Split_key_value -// Database: 4DPop Macros -// ID[D5F4D977C4BC413CB993A46820F8DB09] -// Created #27-5-2015 by Vincent de Lachaux -// ---------------------------------------------------- -// Description: -// -// ---------------------------------------------------- -// Declarations -C_TEXT:C284($0) -C_TEXT:C284($1) -C_LONGINT:C283($2) - -C_LONGINT:C283($Lon_closingParenthesis; $Lon_command; $Lon_openParenthesis; $Lon_parameters; $Lon_semicolon; $Lon_x) -C_TEXT:C284($Txt_buffer; $Txt_in; $Txt_out; $Txt_prefix) - -If (False:C215) - C_TEXT:C284(_o_beautifier_Split_key_value; $0) - C_TEXT:C284(_o_beautifier_Split_key_value; $1) - C_LONGINT:C283(_o_beautifier_Split_key_value; $2) -End if - -// ---------------------------------------------------- -// Initialisations -$Lon_parameters:=Count parameters:C259 - -If (Asserted:C1132($Lon_parameters>=1; "Missing parameter")) - - //Required parameters - $Txt_in:=$1 - - //Optional parameters - If ($Lon_parameters>=2) - - $Lon_command:=$2 - - End if - -Else - - ABORT:C156 - -End if - -// ---------------------------------------------------- -While ($Txt_in[[1]]="\r") - - $Txt_prefix:=$Txt_prefix+"\r" - $Txt_in:=Delete string:C232($Txt_in; 1; 1) - -End while - -Case of - - //#7-4-2017 ___________________________________________ - : ($Lon_command=1471) //New Object - - //$obj:=OB New (\r - // property ; value ;\r - // property2 ; value2 ;\r - // ... - // propertyN ; valueN ) - - $Txt_buffer:=Command name:C538($Lon_command) - - $Lon_x:=Position:C15($Txt_buffer; $Txt_in) - $Txt_out:=$Txt_prefix+Substring:C12($Txt_in; 1; $Lon_x+Length:C16($Txt_buffer)) - $Txt_in:=Delete string:C232($Txt_in; 1; Length:C16($Txt_out)-Length:C16($Txt_prefix)) - $Txt_out:=$Txt_out+"\\\r" - - $Lon_x:=Position:C15(";"; $Txt_in) - $Lon_openParenthesis:=Position:C15("("; $Txt_in) //open parenthesis - - If ($Lon_openParenthesis>0)\ - & ($Lon_openParenthesis<$Lon_x) - - $Lon_closingParenthesis:=Position:C15(")"; $Txt_in; $Lon_openParenthesis+1) - $Lon_x:=Position:C15(";"; $Txt_in; $Lon_closingParenthesis+1) - - End if - - //go to the second semicolon - $Lon_x:=Position:C15(";"; $Txt_in; $Lon_x+1) - - If ($Lon_x>0) - - $Txt_out:=$Txt_out+Substring:C12($Txt_in; 1; $Lon_x)+"\\\r" - $Txt_in:=Substring:C12($Txt_in; $Lon_x+1) - - End if - - //______________________________________________________ - : ($Lon_command=1055) //SVG SET ATTRIBUTE - - //SVG SET ATTRIBUTE ( {* ;} pictureObject ;element_ID ;\r - // attribName ; attribValue ;\r - // attribName2 ; attribValue2 ;\r - // … - // attribNameN ; attribValueN {; *}) - - $Txt_out:=$Txt_prefix+Command name:C538($Lon_command)+"(" - $Txt_in:=Delete string:C232($Txt_in; 1; Length:C16($Txt_out)-Length:C16($Txt_prefix)) - - If ($Txt_in[[1]]="*") - - $Txt_out:=$Txt_out+"*;" - $Txt_in:=Substring:C12($Txt_in; 3) - - End if - - //______________________________________________________ - : ($Lon_command=1220) //OB SET - - //OB SET ( object ;\r - // property ; value ;\r - // property2 ; value2 ;\r - // ... - // propertyN ; valueN ) - - $Lon_x:=Position:C15(";"; $Txt_in) - - If ($Lon_x>0) - - $Txt_out:=$Txt_prefix+Substring:C12($Txt_in; 1; $Lon_x)+"\\\r" - $Txt_in:=Substring:C12($Txt_in; $Lon_x+1) - - End if - - //______________________________________________________ - : ($Lon_command=865) //DOM Create XML element - - //elementRef:=DOM Create XML element(elementRef;xPath;\r - // attribName ; attrValue ;\r - // attribName2 ; attrValue2 ;\r - // ... - // attribNameN ; attrValueN) - - $Txt_buffer:=Command name:C538($Lon_command) - - $Lon_x:=Position:C15($Txt_buffer; $Txt_in) - $Txt_out:=$Txt_prefix+Substring:C12($Txt_in; 1; $Lon_x+Length:C16($Txt_buffer)) - $Txt_in:=Delete string:C232($Txt_in; 1; Length:C16($Txt_out)-Length:C16($Txt_prefix)) - - $Lon_x:=Position:C15(";"; $Txt_in) - $Lon_openParenthesis:=Position:C15("("; $Txt_in) //open parenthesis - - If ($Lon_openParenthesis>0)\ - & ($Lon_openParenthesis<$Lon_x) - - $Lon_closingParenthesis:=Position:C15(")"; $Txt_in; $Lon_openParenthesis+1) - $Lon_x:=Position:C15(";"; $Txt_in; $Lon_closingParenthesis+1) - - End if - - //go to the second semicolon - $Lon_x:=Position:C15(";"; $Txt_in; $Lon_x+1) - - If ($Lon_x>0) - - $Txt_out:=$Txt_out+Substring:C12($Txt_in; 1; $Lon_x)+"\\\r" - $Txt_in:=Substring:C12($Txt_in; $Lon_x+1) - - End if - - //______________________________________________________ - : ($Lon_command=866) //DOM SET XML ATTRIBUTE - - //DOM SET XML ATTRIBUTE ( elementRef ;\r - // attribName ; attrValue ;\r - // attribName2 ; attrValue2 ;\r - // ... - // attribNameN ; attrValueN) - - $Txt_out:=Command name:C538($Lon_command)+"(" - - $Txt_in:=Delete string:C232($Txt_in; 1; Length:C16($Txt_out)) - - $Lon_x:=Position:C15(";"; $Txt_in) - $Lon_openParenthesis:=Position:C15("("; $Txt_in) //open parenthesis - - If ($Lon_openParenthesis>0)\ - & ($Lon_openParenthesis<$Lon_x) - - $Lon_closingParenthesis:=Position:C15(")"; $Txt_in; $Lon_openParenthesis+1) - $Lon_x:=Position:C15(";"; $Txt_in; $Lon_closingParenthesis+1) - - End if - - If ($Lon_x>0) - - $Txt_out:=$Txt_prefix+$Txt_out+Substring:C12($Txt_in; 1; $Lon_x)+"\\\r" - $Txt_in:=Substring:C12($Txt_in; $Lon_x+1) - - End if - - //______________________________________________________ - : ($Lon_command=1093) //ST SET ATTRIBUTES  - - //ST SET ATTRIBUTES ( {*;} object ; stratSel ; endSel ;\r - // attribName ; attrValue ;\r - // attribName2 ; attrValue2 ;\r - // ... - // attribNameN ; attrValueN) - - $Txt_out:=$Txt_prefix+Command name:C538($Lon_command)+"(" - $Txt_in:=Delete string:C232($Txt_in; 1; Length:C16($Txt_out)-Length:C16($Txt_prefix)) - - If ($Txt_in[[1]]="*") - - $Txt_out:=$Txt_out+"*;" - $Txt_in:=Substring:C12($Txt_in; 3) - - End if - - //object - $Lon_x:=Position:C15(";"; $Txt_in) - - $Txt_buffer:=Substring:C12($Txt_in; 1; $Lon_x) - $Txt_out:=$Txt_out+$Txt_buffer - $Txt_in:=Delete string:C232($Txt_in; 1; Length:C16($Txt_buffer)) - - //startSel - $Lon_x:=Position:C15(";"; $Txt_in) - - $Txt_buffer:=Substring:C12($Txt_in; 1; $Lon_x) - $Txt_out:=$Txt_out+$Txt_buffer - $Txt_in:=Delete string:C232($Txt_in; 1; Length:C16($Txt_buffer)) - - //endSel - $Lon_x:=Position:C15(";"; $Txt_in) - - $Txt_buffer:=Substring:C12($Txt_in; 1; $Lon_x) - $Txt_out:=$Txt_out+$Txt_buffer+"\\\r" - $Txt_in:=Delete string:C232($Txt_in; 1; Length:C16($Txt_buffer)) - - //______________________________________________________ - Else - - //NOTHING MORE TO DO - - //______________________________________________________ -End case - -//go to the first semicolon -$Lon_x:=_o_beautifier_Next_semicolon($Txt_in) - -If ($Lon_x>0) - - $Txt_out:=$Txt_out+Substring:C12($Txt_in; 1; $Lon_x)+"\\\r" - $Txt_in:=Substring:C12($Txt_in; $Lon_x+1) - - Repeat - - //go to the second semicolon - $Lon_semicolon:=_o_beautifier_Next_semicolon($Txt_in) - - If ($Lon_semicolon>0) - - $Txt_out:=$Txt_out+Substring:C12($Txt_in; 1; $Lon_semicolon)+"\\\r" - $Txt_in:=Substring:C12($Txt_in; $Lon_semicolon+1) - - Else - - $Txt_out:=$Txt_out+$Txt_in - - End if - Until ($Lon_x=0)\ - | ($Lon_semicolon=0) - -Else - - $Txt_out:=$Txt_out+$Txt_in - -End if - -// ---------------------------------------------------- -// Return -$0:=$Txt_out - -// ---------------------------------------------------- -// End \ No newline at end of file diff --git a/Project/Sources/Methods/_o_isNumeric.4dm b/Project/Sources/Methods/_o_isNumeric.4dm index de45667..877d640 100644 --- a/Project/Sources/Methods/_o_isNumeric.4dm +++ b/Project/Sources/Methods/_o_isNumeric.4dm @@ -6,12 +6,12 @@ // Description // Checks if all characters are numerical characters // ---------------------------------------------------- -C_BOOLEAN:C305($0) -C_TEXT:C284($1) +var $0 : Boolean +var $1 : Text If (False:C215) - C_BOOLEAN:C305(_o_isNumeric; $0) - C_TEXT:C284(_o_isNumeric; $1) + _O_C_BOOLEAN:C305(_o_isNumeric; $0) + _O_C_TEXT:C284(_o_isNumeric; $1) End if $0:=($1=String:C10(Num:C11(Replace string:C233($1; "e"; "")); "0"*Length:C16($1))) \ No newline at end of file diff --git a/Project/Sources/Methods/_o_localizedControlFlow.4dm b/Project/Sources/Methods/_o_localizedControlFlow.4dm index 92cda81..5f5cc2f 100644 --- a/Project/Sources/Methods/_o_localizedControlFlow.4dm +++ b/Project/Sources/Methods/_o_localizedControlFlow.4dm @@ -10,22 +10,22 @@ // Give the english name of the the control flow to this function, the return will be the localized. // Give an array pointer, the array will be filled with the control flow structures. // ---------------------------------------------------- -C_TEXT:C284($0) -C_TEXT:C284($1) -C_POINTER:C301($2) -C_POINTER:C301($3) -C_LONGINT:C283($Lon_parameters) -C_TEXT:C284($File_resources) -C_OBJECT:C1216($Obj_controlFlow) +var $0 : Text +var $1 : Text +var $2 : Pointer +var $3 : Pointer +var $Lon_parameters : Integer +var $File_resources : Text +var $Obj_controlFlow : Object ARRAY TEXT:C222($tTxt_FR; 0) ARRAY TEXT:C222($tTxt_tag; 0) ARRAY TEXT:C222($tTxt_US; 0) If (False:C215) - C_TEXT:C284(_o_localizedControlFlow; $0) - C_TEXT:C284(_o_localizedControlFlow; $1) - C_POINTER:C301(_o_localizedControlFlow; $2) - C_POINTER:C301(_o_localizedControlFlow; $3) + _O_C_TEXT:C284(_o_localizedControlFlow; $0) + _O_C_TEXT:C284(_o_localizedControlFlow; $1) + _O_C_POINTER:C301(_o_localizedControlFlow; $2) + _O_C_POINTER:C301(_o_localizedControlFlow; $3) End if $Lon_parameters:=Count parameters:C259 diff --git a/Project/Sources/Methods/_o_menu.4dm b/Project/Sources/Methods/_o_menu.4dm deleted file mode 100644 index 6860045..0000000 --- a/Project/Sources/Methods/_o_menu.4dm +++ /dev/null @@ -1,289 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"incapable"} -// ---------------------------------------------------- -// Project method : menu -// ID[7F62512A7B7C487C97E780DCE95400AB] -// Created 11-6-2019 by Vincent de Lachaux -// ---------------------------------------------------- -// Description: -// Manipulate menus as objects to make code more readable -// ---------------------------------------------------- -// Declarations -C_OBJECT:C1216($0) -C_TEXT:C284($1) -C_OBJECT:C1216($2) - -C_LONGINT:C283($i) -C_TEXT:C284($t) -C_OBJECT:C1216($o) -C_COLLECTION:C1488($c) - -If (False:C215) - C_OBJECT:C1216(_o_menu; $0) - C_TEXT:C284(_o_menu; $1) - C_OBJECT:C1216(_o_menu; $2) -End if - -// ---------------------------------------------------- -If (This:C1470[""]=Null:C1517) - - $o:=New object:C1471(\ - ""; "menu"; \ - "ref"; Create menu:C408; \ - "autoRelease"; True:C214; \ - "metacharacters"; False:C215; \ - "selected"; False:C215; \ - "choice"; ""; \ - "release"; Formula:C1597(RELEASE MENU:C978(This:C1470.ref)); \ - "count"; Formula:C1597(Count menu items:C405(This:C1470.ref)); \ - "action"; Formula:C1597(_o_menu("action"; New object:C1471("action"; $1; "item"; $2))); \ - "append"; Formula:C1597(_o_menu("append"; Choose:C955(Value type:C1509($2)=Is object:K8:27; New object:C1471("item"; String:C10($1); "menu"; $2); New object:C1471("item"; String:C10($1); "param"; $2; "mark"; Bool:C1537($3))))); \ - "cleanup"; Formula:C1597(_o_menu("cleanup")); \ - "editMenu"; Formula:C1597(_o_menu("editMenu")); \ - "enable"; Formula:C1597(_o_menu("enable"; New object:C1471("item"; $1))); \ - "delete"; Formula:C1597(_o_menu("delete"; New object:C1471("item"; $1))); \ - "disable"; Formula:C1597(_o_menu("disable"; New object:C1471("item"; $1))); \ - "fileMenu"; Formula:C1597(_o_menu("fileMenu")); \ - "icon"; Formula:C1597(_o_menu("icon"; New object:C1471("icon"; $1; "item"; $2))); \ - "insert"; Formula:C1597(_o_menu("insert"; Choose:C955(Value type:C1509($3)=Is object:K8:27; New object:C1471("item"; String:C10($1); "after"; Num:C11($2); "menu"; $3); New object:C1471("item"; String:C10($1); "after"; Num:C11($2); "param"; $3; "mark"; Bool:C1537($4))))); \ - "line"; Formula:C1597(_o_menu("line")); \ - "loadBar"; Formula:C1597(_o_menu("loadBar"; New object:C1471("menu"; $1))); \ - "method"; Formula:C1597(_o_menu("method"; New object:C1471("method"; String:C10($1); "item"; $2))); \ - "popup"; Formula:C1597(_o_menu("popup"; Choose:C955(Count parameters:C259=1; New object:C1471("default"; String:C10($1)); Choose:C955(Value type:C1509($2)=Is object:K8:27; New object:C1471("default"; String:C10($1); "widget"; $2); New object:C1471("default"; String:C10($1); "xCoord"; $2; "yCoord"; $3))))); \ - "setBar"; Formula:C1597(_o_menu("setBar")); \ - "shortcut"; Formula:C1597(_o_menu("shortcut"; New object:C1471("shortcut"; $1; "modifier"; Num:C11($2); "item"; $3)))\ - ) - - If (Count parameters:C259>=1) - - $c:=Split string:C1554(String:C10($1); ";") - - $o.autoRelease:=($c.indexOf("keepReference")=-1) - $o.metacharacters:=($c.indexOf("displayMetacharacters")#-1) - - End if - -Else - - $o:=This:C1470 - - Case of - - //______________________________________________________ - : ($o=Null:C1517) - - ASSERT:C1129(False:C215; "OOPS, this method must be called from a member method") - - //______________________________________________________ - : ($1="action") - - SET MENU ITEM PROPERTY:C973($o.ref; Choose:C955($2.item#Null:C1517; Num:C11($2.item); -1); Associated standard action name:K28:8; $2.action) - - //______________________________________________________ - : ($1="append") - - ASSERT:C1129(Length:C16($2.item)>0) - - If ($2.menu#Null:C1517) // Submenu - - If ($o.metacharacters) - - APPEND MENU ITEM:C411($o.ref; $2.item; $2.menu.ref) - - Else - - APPEND MENU ITEM:C411($o.ref; $2.item; $2.menu.ref; *) - - End if - - If ($2.menu.autoRelease) - - RELEASE MENU:C978($2.menu.ref) - - End if - - Else // Item - - If ($o.metacharacters) - - APPEND MENU ITEM:C411($o.ref; $2.item) - - Else - - APPEND MENU ITEM:C411($o.ref; $2.item; *) - - End if - - SET MENU ITEM PARAMETER:C1004($o.ref; -1; String:C10($2.param)) - SET MENU ITEM MARK:C208($o.ref; -1; Char:C90(18)*Num:C11($2.mark)) - - End if - - //______________________________________________________ - : ($1="cleanup") - - Repeat // Remove unnecessary lines at the end - - $i:=$o.count() - - $t:=Get menu item:C422($o.ref; $i) - - If ($t="-") - - $o.delete($i) - - End if - Until ($t#"-") - - // #MARK_TODO - // Remove duplicates (lines or items) - - //______________________________________________________ - : ($1="editMenu") // Standard edit menu - - $o.append(":xliff:CommonMenuItemUndo").action(ak undo:K76:51).shortcut("Z") - $o.append(":xliff:CommonMenuRedo").action(ak redo:K76:52).shortcut("Z"; 512) - $o.line() - $o.append(":xliff:CommonMenuItemCut").action(ak cut:K76:53).shortcut("X") - $o.append(":xliff:CommonMenuItemCopy").action(ak copy:K76:54).shortcut("C") - $o.append(":xliff:CommonMenuItemPaste").action(ak paste:K76:55).shortcut("V") - $o.append(":xliff:CommonMenuItemClear").action(ak clear:K76:56) - $o.append(":xliff:CommonMenuItemSelectAll").action(ak select all:K76:57).shortcut("A") - $o.line() - $o.append(":xliff:CommonMenuItemShowClipboard").action(ak show clipboard:K76:58) - - //______________________________________________________ - : ($1="enable") - - ENABLE MENU ITEM:C149($o.ref; Choose:C955($2.item#Null:C1517; Num:C11($2.item); -1)) - - //______________________________________________________ - : ($1="delete") - - DELETE MENU ITEM:C413(This:C1470.ref; Choose:C955($2.item#Null:C1517; Num:C11($2.item); -1)) - - //______________________________________________________ - : ($1="disable") - - DISABLE MENU ITEM:C150($o.ref; Choose:C955($2.item#Null:C1517; Num:C11($2.item); -1)) - - //______________________________________________________ - : ($1="fileMenu") // Default file menu - - $o.append(":xliff:CommonMenuItemQuit").action(ak quit:K76:61).shortcut("Q") - - //______________________________________________________ - : ($1="icon") - - SET MENU ITEM ICON:C984($o.ref; Choose:C955($2.item#Null:C1517; Num:C11($2.item); -1); "file:"+String:C10($2.icon)) - - //______________________________________________________ - : ($1="insert") - - ASSERT:C1129(Length:C16($2.item)>0) - - If (String:C10($2._is)="menu") // Submenu - - If ($o.metacharacters) - - INSERT MENU ITEM:C412($o.ref; $2.after; $2.item; $2.menu.ref) - - Else - - INSERT MENU ITEM:C412($o.ref; $2.after; $2.item; $2.menu.ref; *) - - End if - - If ($2.menu.autoRelease) - - RELEASE MENU:C978($2.menu.ref) - - End if - - Else // Item - - If ($o.metacharacters) - - INSERT MENU ITEM:C412($o.ref; $2.after; $2.item) - - Else - - INSERT MENU ITEM:C412($o.ref; $2.after; $2.item; *) - - End if - - SET MENU ITEM PARAMETER:C1004($o.ref; -1; String:C10($2.param)) - SET MENU ITEM MARK:C208($o.ref; -1; Char:C90(18)*Num:C11($2.mark)) - - End if - - //______________________________________________________ - : ($1="line") - - APPEND MENU ITEM:C411($o.ref; "-") - - //______________________________________________________ - : ($1="method") - - SET MENU ITEM METHOD:C982($o.ref; Choose:C955($2.item#Null:C1517; Num:C11($2.item); -1); $2.method) - - //______________________________________________________ - : ($1="popup") - - $o.cleanup() - - If ($2.widget#Null:C1517) // Widget reference - - $o.choice:=Dynamic pop up menu:C1006($o.ref; $2.default; Num:C11($2.widget.windowCoordinates.left); Num:C11($2.widget.windowCoordinates.bottom)) - - Else - - If ($2.xCoord#Null:C1517) - - $o.choice:=Dynamic pop up menu:C1006($o.ref; $2.default; Num:C11($2.xCoord); Num:C11($2.yCoord)) - - Else - - $o.choice:=Dynamic pop up menu:C1006($o.ref; $2.default) - - End if - End if - - $o.selected:=(Length:C16(String:C10($o.choice))>0) - - If ($o.autoRelease) - - $o.release() - - End if - - //______________________________________________________ - : ($1="setBar") - - SET MENU BAR:C67($o.ref) - - If ($o.autoRelease) - - $o.release() - - End if - - //______________________________________________________ - : ($1="shortcut") - - SET MENU ITEM SHORTCUT:C423($o.ref; Choose:C955($2.item#Null:C1517; Num:C11($2.item); -1); $2.shortcut; $2.modifier) - - //______________________________________________________ - Else - - ASSERT:C1129(False:C215; "Unknown entry point: \""+$1+"\"") - - //______________________________________________________ - End case -End if - -// ---------------------------------------------------- -// Return -$0:=$o - -// ---------------------------------------------------- -// End \ No newline at end of file diff --git a/Project/Sources/Methods/_o_rgx.4dm b/Project/Sources/Methods/_o_rgx.4dm new file mode 100644 index 0000000..f8bb295 --- /dev/null +++ b/Project/Sources/Methods/_o_rgx.4dm @@ -0,0 +1,232 @@ +//%attributes = {"invisible":true,"preemptive":"capable"} +// ---------------------------------------------------- +// Project method : rgx +// ID[091975F1C6DC4791A66BD7A5314B92CF] +// Created 7-2-2020 by Vincent de Lachaux +// ---------------------------------------------------- +// Description: +// +// ---------------------------------------------------- +// Declarations +var $0 : Object +var $1 : Text +var $2 : Object + +var $success : Boolean +var $end; $i; $indx; $start : Integer +var $t; $tMethodCalledOnError; $tPattern; $tReplacement; $tTarget; $Txt_Target : Text +var $rgx : Object + +ARRAY LONGINT:C221($tLon_Lengths; 0) +ARRAY LONGINT:C221($tLon_Positions; 0) +ARRAY TEXT:C222($tTxt_Tempo; 0) + +If (False:C215) + _O_C_OBJECT:C1216(_o_rgx; $0) + _O_C_TEXT:C284(_o_rgx; $1) + _O_C_OBJECT:C1216(_o_rgx; $2) +End if + +var _o_rgxError : Integer + +// ---------------------------------------------------- +If (This:C1470[""]=Null:C1517) // Constructor + + If (Count parameters:C259>=1) + + $t:=String:C10($1) + + End if + + $rgx:=New object:C1471(\ + ""; "rgx"; \ + "text"; $t; \ + "success"; True:C214; \ + "result"; ""; \ + "errors"; New collection:C1472; \ + "warnings"; New collection:C1472; \ + "reset"; Formula:C1597(_o_rgx("reset")); \ + "setText"; Formula:C1597(_o_rgx("setText"; New object:C1471("text"; String:C10($1)))); \ + "substitute"; Formula:C1597(_o_rgx("substitute"; New object:C1471("pattern"; String:C10($1); "replacement"; String:C10($2); "start"; $3)))\ + ) + +Else + + $rgx:=This:C1470 + + Case of + + //______________________________________________________ + : ($rgx=Null:C1517) + + ASSERT:C1129(False:C215; "OOPS, this method must be called from a member method") + + //______________________________________________________ + : ($1="reset") + + $rgx.success:=True:C214 + $rgx.text:="" + $rgx.result:="" + $rgx.errors:=New collection:C1472 + $rgx.warnings:=New collection:C1472 + + CLEAR VARIABLE:C89(_o_rgxError) + + //______________________________________________________ + : ($1="setText") + + $rgx.reset() + $rgx.text:=$2.text + + //______________________________________________________ + : ($1="substitute") + + $tPattern:=$2.pattern + $tReplacement:=$2.replacement + $tTarget:=$rgx.text + + $rgx.result:=$tTarget + + If (Length:C16($tTarget)>0) + + $rgx.success:=False:C215 + + $start:=Choose:C955($2.start#Null:C1517; Num:C11($2.start); 1) + + ARRAY LONGINT:C221($tLon_Tempo_Index; 0x0000) + ARRAY LONGINT:C221($tLon_Tempo_Lengths; 0x0000) + ARRAY LONGINT:C221($tLon_Tempo_Positions; 0x0000) + + $tMethodCalledOnError:=Method called on error:C704 + CLEAR VARIABLE:C89(_o_rgxError) + ON ERR CALL:C155("rgx_NO_ERROR") + + Repeat + + $success:=Match regex:C1019($tPattern; $tTarget; $start; $tLon_Positions; $tLon_Lengths) + + If ($success) + + $rgx.success:=True:C214 + $indx:=0 + $end:=Size of array:C274($tLon_Positions) + + For ($i; 0; $end; 1) + + $t:=Substring:C12($Txt_Target; $tLon_Positions{$i}; $tLon_Lengths{$i}) + + If ($tLon_Positions{$i}>0) + + $start:=$tLon_Positions{$i}+$tLon_Lengths{$i} + + End if + + If ($tLon_Lengths{$i}=0) + + $success:=($i>0) + + If ($success) + + $success:=($tLon_Positions{$i}#$tLon_Positions{$i-1}) + + End if + End if + + If ($success) + + APPEND TO ARRAY:C911($tTxt_Tempo; $t) + + APPEND TO ARRAY:C911($tLon_Tempo_Positions; $tLon_Positions{$i}) + APPEND TO ARRAY:C911($tLon_Tempo_Lengths; $tLon_Lengths{$i}) + APPEND TO ARRAY:C911($tLon_Tempo_Index; $indx) + + $indx:=$indx+1 + + Else + + $i:=$end+1 + + End if + End for + + Else + + $rgx.success:=(_o_rgxError=0) + + If (Not:C34($rgx.success)) + + $rgx.errors.push("error: "+String:C10(_o_rgxError)) + + End if + End if + Until (Not:C34($success)) + + ON ERR CALL:C155($tMethodCalledOnError) + + If ($rgx.success) + + $end:=Size of array:C274($tTxt_Tempo) + + If ($end>0) + + $indx:=$end + + Repeat + + If ($tLon_Tempo_Index{$indx}#0) + + $t:="\\"+String:C10($tLon_Tempo_Index{$indx}) + + If (Position:C15($t; $tReplacement)>0) + + $tReplacement:=Replace string:C233($tReplacement; $t; $tTxt_Tempo{$indx}) + + End if + + Else + + $rgx.result:=Delete string:C232($rgx.result; $tLon_Tempo_Positions{$indx}; $tLon_Tempo_Lengths{$indx}) + $rgx.result:=Insert string:C231($rgx.result; $tReplacement; $tLon_Tempo_Positions{$indx}) + + $tReplacement:=$2.replacement + + End if + + $indx:=$indx-1 + + Until ($indx=0) + + Else + + $rgx.success:=True:C214 + $rgx.warnings.push("No match for the pattern: \""+$tPattern+"\"") + + End if + + Else + + // A "If" statement should never omit "Else" + + End if + + Else + + $rgx.warnings.push("The string in which substitution will be done is empty") + + End if + + //______________________________________________________ + Else + + ASSERT:C1129(False:C215; "Unknown entry point: \""+$1+"\"") + + //______________________________________________________ + End case +End if + +// ---------------------------------------------------- +// Return +$0:=$rgx + +// ---------------------------------------------------- +// End \ No newline at end of file diff --git a/Project/Sources/Methods/rgx_Options.4dm b/Project/Sources/Methods/_o_rgx_Options.4dm old mode 100755 new mode 100644 similarity index 55% rename from Project/Sources/Methods/rgx_Options.4dm rename to Project/Sources/Methods/_o_rgx_Options.4dm index 59ddbb1..3a0b1a9 --- a/Project/Sources/Methods/rgx_Options.4dm +++ b/Project/Sources/Methods/_o_rgx_Options.4dm @@ -1,20 +1,20 @@ //%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Method : rgx_Options - // Created 28/09/07 by Vincent - // ---------------------------------------------------- - // Description - // - // ---------------------------------------------------- -C_TEXT:C284($0) -C_LONGINT:C283($1) +// ---------------------------------------------------- +// Method : rgx_Options +// Created 28/09/07 by Vincent +// ---------------------------------------------------- +// Description +// +// ---------------------------------------------------- +_O_C_TEXT:C284($0) +_O_C_LONGINT:C283($1) -C_LONGINT:C283($Lon_Options) -C_TEXT:C284($Txt_Pattern) +_O_C_LONGINT:C283($Lon_Options) +_O_C_TEXT:C284($Txt_Pattern) If (False:C215) - C_TEXT:C284(rgx_Options ;$0) - C_LONGINT:C283(rgx_Options ;$1) + _O_C_TEXT:C284(_o_rgx_Options; $0) + _O_C_LONGINT:C283(_o_rgx_Options; $1) End if $Lon_Options:=$1 diff --git a/Project/Sources/Methods/util_Lon_Local_in_line.4dm b/Project/Sources/Methods/_o_util_Lon_Local_in_line.4dm old mode 100755 new mode 100644 similarity index 88% rename from Project/Sources/Methods/util_Lon_Local_in_line.4dm rename to Project/Sources/Methods/_o_util_Lon_Local_in_line.4dm index 70e99ca..dfdecca --- a/Project/Sources/Methods/util_Lon_Local_in_line.4dm +++ b/Project/Sources/Methods/_o_util_Lon_Local_in_line.4dm @@ -10,23 +10,23 @@ // v12 bug fix with character " in first position of a line // ---------------------------------------------------- // Declarations -C_LONGINT:C283($0) -C_TEXT:C284($1) -C_POINTER:C301($2) -C_POINTER:C301($3) -C_LONGINT:C283($4) +_O_C_LONGINT:C283($0) +_O_C_TEXT:C284($1) +_O_C_POINTER:C301($2) +_O_C_POINTER:C301($3) +_O_C_LONGINT:C283($4) -C_BOOLEAN:C305($Boo_add; $Boo_escape; $Boo_start; $Boo_stop) -C_LONGINT:C283($Lon_error; $Lon_i; $Lon_ignoreDeclarations; $Lon_parameters; $Lon_size; $Lon_x) -C_POINTER:C301($Ptr_targetArray) -C_TEXT:C284($kTxt_delimitors; $Txt_buffer; $Txt_character; $Txt_pattern; $Txt_variableName) +_O_C_BOOLEAN:C305($Boo_add; $Boo_escape; $Boo_start; $Boo_stop) +_O_C_LONGINT:C283($Lon_error; $Lon_i; $Lon_ignoreDeclarations; $Lon_parameters; $Lon_size; $Lon_x) +_O_C_POINTER:C301($Ptr_targetArray) +_O_C_TEXT:C284($kTxt_delimitors; $Txt_buffer; $Txt_character; $Txt_pattern; $Txt_variableName) If (False:C215) - C_LONGINT:C283(util_Lon_Local_in_line; $0) - C_TEXT:C284(util_Lon_Local_in_line; $1) - C_POINTER:C301(util_Lon_Local_in_line; $2) - C_POINTER:C301(util_Lon_Local_in_line; $3) - C_LONGINT:C283(util_Lon_Local_in_line; $4) + _O_C_LONGINT:C283(_o_util_Lon_Local_in_line; $0) + _O_C_TEXT:C284(_o_util_Lon_Local_in_line; $1) + _O_C_POINTER:C301(_o_util_Lon_Local_in_line; $2) + _O_C_POINTER:C301(_o_util_Lon_Local_in_line; $3) + _O_C_LONGINT:C283(_o_util_Lon_Local_in_line; $4) End if // ---------------------------------------------------- @@ -66,11 +66,11 @@ End if // Remove Comments $Txt_pattern:="(?m-si)(//.*$)" -$Lon_error:=Rgx_SubstituteText($Txt_pattern; ""; ->$Txt_buffer) +$Lon_error:=_o_Rgx_SubstituteText($Txt_pattern; ""; ->$Txt_buffer) // Remove textual values $Txt_pattern:="(?m-si)(\"[^\"]*\")" -$Lon_error:=Rgx_SubstituteText($Txt_pattern; ""; ->$Txt_buffer) +$Lon_error:=_o_Rgx_SubstituteText($Txt_pattern; ""; ->$Txt_buffer) $Lon_size:=Length:C16($Txt_buffer) @@ -83,7 +83,7 @@ For ($Lon_i; 1; $Lon_size; 1) // //______________________________________________________ //: ($Txt_buffer[[$Lon_i]]="/")\ - & (Not($Boo_escape)) + & (Not($Boo_escape)) //If ($Txt_buffer[[$Lon_i+1]]="/") // Comment //$Boo_escape:=True //$Lon_i:=$Lon_size+1 diff --git a/Project/Sources/Methods/_o_win_title.4dm b/Project/Sources/Methods/_o_win_title.4dm new file mode 100644 index 0000000..6531d84 --- /dev/null +++ b/Project/Sources/Methods/_o_win_title.4dm @@ -0,0 +1,54 @@ +//%attributes = {"invisible":true,"preemptive":"incapable"} +// ---------------------------------------------------- +// Project method : win_title +// Database: 4DPop Macros +// ID[69FD98BC194541619466271C60F30493] +// Created #17-7-2014 by Vincent de Lachaux +// ---------------------------------------------------- +// Description: +// Return the target (form/method name) of an editor window +// ---------------------------------------------------- +// Declarations +_O_C_TEXT:C284($0) +_O_C_LONGINT:C283($1) + +_O_C_LONGINT:C283($l) +_O_C_TEXT:C284($t) +_O_C_COLLECTION:C1488($c) + +If (False:C215) + _O_C_TEXT:C284(_o_win_title; $0) + _O_C_LONGINT:C283(_o_win_title; $1) +End if + +// ---------------------------------------------------- +// Initialisations + +// NO PARAMETERS REQUIRED + +// Optional parameters +If (Count parameters:C259>=1) + + $l:=$1 + +Else + + $l:=Frontmost window:C447 + +End if + +// ---------------------------------------------------- +$c:=Split string:C1554(Get window title:C450($l); ":"; sk trim spaces:K86:2) +$t:=$c[Num:C11($c.length>1)] + +// #17-7-2014 +// PC bug: The window title is suffixed with a '*' when method is modified and not saved +$t:=Replace string:C233($t; " *"; "") +$t:=Replace string:C233($t; "*"; "") + +// ---------------------------------------------------- +// Return +$0:=$t + +// ---------------------------------------------------- +// End \ No newline at end of file diff --git a/Project/Sources/Methods/_o_xml_attributes.4dm b/Project/Sources/Methods/_o_xml_attributes.4dm new file mode 100644 index 0000000..cfd7140 --- /dev/null +++ b/Project/Sources/Methods/_o_xml_attributes.4dm @@ -0,0 +1,65 @@ +//%attributes = {"invisible":true,"preemptive":"capable"} +// ---------------------------------------------------- +// Project method : xml_attributes +// Database: 4DPop XLIFF 2 +// ID[CA958A0431C849868A26DB018F13A02F] +// Created #5-3-2018 by Vincent de Lachaux +// ---------------------------------------------------- +// Description: +// Return attibute object for the node $1 +// ---------------------------------------------------- +// Declarations +var $0 : Object +var $1 : Text + +var $Lon_i; $Lon_parameters : Integer +var $Dom_node; $Txt_name; $Txt_value : Text +var $Obj_attributes : Object + +If (False:C215) + _O_C_OBJECT:C1216(_o_xml_attributes; $0) + _O_C_TEXT:C284(_o_xml_attributes; $1) +End if + +// ---------------------------------------------------- +// Initialisations +$Lon_parameters:=Count parameters:C259 + +If (Asserted:C1132($Lon_parameters>=1; "Missing parameter")) + + // Required parameters + $Dom_node:=$1 + + // Optional parameters + If ($Lon_parameters>=2) + + // + + End if + + $Obj_attributes:=New object:C1471 + +Else + + ABORT:C156 + +End if + +// ---------------------------------------------------- +//If (Asserted(xml_IsValidReference ($Dom_node))) + +For ($Lon_i; 1; DOM Count XML attributes:C727($Dom_node); 1) + + DOM GET XML ATTRIBUTE BY INDEX:C729($Dom_node; $Lon_i; $Txt_name; $Txt_value) + + $Obj_attributes[$Txt_name]:=$Txt_value + +End for +//End if + +// ---------------------------------------------------- +// Return +$0:=$Obj_attributes + +// ---------------------------------------------------- +// End \ No newline at end of file diff --git a/Project/Sources/Methods/_o_xml_cleanup.4dm b/Project/Sources/Methods/_o_xml_cleanup.4dm new file mode 100644 index 0000000..aee6abd --- /dev/null +++ b/Project/Sources/Methods/_o_xml_cleanup.4dm @@ -0,0 +1,73 @@ +//%attributes = {"invisible":true,"preemptive":"capable"} +// ---------------------------------------------------- +// Project method : xml_cleanup +// Database: 4DPop Macros +// ID[3CD250E652004FC2A198FAE87ABCA0C1] +// Created #20-2-2014 by Vincent de Lachaux +// ---------------------------------------------------- +// Description: +// Clean Up an indented XML file +// Removes the extra lines feeds and the carriage returns +// added by 4D when we perform removing/adding elements +// ---------------------------------------------------- +// Declarations +_O_C_TEXT:C284($0) +_O_C_TEXT:C284($1) +_O_C_LONGINT:C283($2) + +_O_C_LONGINT:C283($Lon_indent; $Lon_parameters) +_O_C_TEXT:C284($Dom_root; $Txt_buffer) + +If (False:C215) + _O_C_TEXT:C284(_o_xml_cleanup; $0) + _O_C_TEXT:C284(_o_xml_cleanup; $1) + _O_C_LONGINT:C283(_o_xml_cleanup; $2) +End if + +// ---------------------------------------------------- +// Initialisations +$Lon_parameters:=Count parameters:C259 + +If (Asserted:C1132($Lon_parameters>=1; "Missing parameter")) + + $Dom_root:=$1 //reference of the xml to format + + $Lon_indent:=XML with indentation:K45:35 + + If ($Lon_parameters>=2) + + $Lon_indent:=$2 //{indentation} XML with indentation (default), XML No indentation + + End if + +Else + + ABORT:C156 + +End if + +// ---------------------------------------------------- +XML SET OPTIONS:C1090($Dom_root; XML indentation:K45:34; $Lon_indent) + +DOM EXPORT TO VAR:C863($Dom_root; $Txt_buffer) +DOM CLOSE XML:C722($Dom_root) + +$Txt_buffer:=Replace string:C233($Txt_buffer; "\r\n"; "") +$Txt_buffer:=Replace string:C233($Txt_buffer; "\n"; "") +$Txt_buffer:=Replace string:C233($Txt_buffer; "\r"; "") +$Txt_buffer:=Replace string:C233($Txt_buffer; "\t"; "") + +While (Position:C15(" "; $Txt_buffer)>0) + + $Txt_buffer:=Replace string:C233($Txt_buffer; " "; " ") + +End while + +$Txt_buffer:=Replace string:C233($Txt_buffer; "> <"; "><") + +$Dom_root:=DOM Parse XML variable:C720($Txt_buffer) + +$0:=$Dom_root //Warning: A new reference for the clean XML + +// ---------------------------------------------------- +// End \ No newline at end of file diff --git a/Project/Sources/Methods/_o_xml_elementToObject.4dm b/Project/Sources/Methods/_o_xml_elementToObject.4dm new file mode 100644 index 0000000..637dc48 --- /dev/null +++ b/Project/Sources/Methods/_o_xml_elementToObject.4dm @@ -0,0 +1,165 @@ +//%attributes = {"invisible":true,"preemptive":"capable"} +// ---------------------------------------------------- +// Project method : xml_elementToObject +// Database: 4D Mobile Express +// ID[EE35EDAF20D24025877FA9FC15284E38] +// Created #1-8-2017 by Vincent de Lachaux +// ---------------------------------------------------- +// Description: +// Returns an XML element as an object +// ---------------------------------------------------- +// Declarations +_O_C_OBJECT:C1216($0) +_O_C_TEXT:C284($1) +_O_C_BOOLEAN:C305($2) + +_O_C_BOOLEAN:C305($Boo_references) +_O_C_LONGINT:C283($Lon_count; $Lon_i; $Lon_parameters) +_O_C_TEXT:C284($Dom_child; $Dom_elementRef; $Txt_key; $Txt_name; $Txt_value) +_O_C_OBJECT:C1216($Obj_result) + +If (False:C215) + _O_C_OBJECT:C1216(_o_xml_elementToObject; $0) + _O_C_TEXT:C284(_o_xml_elementToObject; $1) + _O_C_BOOLEAN:C305(_o_xml_elementToObject; $2) +End if + +// ---------------------------------------------------- +// Initialisations +$Lon_parameters:=Count parameters:C259 + +If (Asserted:C1132($Lon_parameters>=1; "Missing parameter")) + + // Required parameters + $Dom_elementRef:=$1 + + // Optional parameters + If ($Lon_parameters>=2) + + $Boo_references:=$2 + + End if + + $Obj_result:=New object:C1471 + +Else + + ABORT:C156 + +End if + +// ---------------------------------------------------- +// DOM reference +If ($Boo_references) + + $Obj_result["@"]:=$Dom_elementRef + +End if + +// For all attributes { +For ($Lon_i; 1; DOM Count XML attributes:C727($Dom_elementRef); 1) + + DOM GET XML ATTRIBUTE BY INDEX:C729($Dom_elementRef; $Lon_i; $Txt_key; $Txt_value) + + Case of // Value types + + //______________________________________________________ + : (Length:C16($Txt_key)=0) + // skip malformed node + + //______________________________________________________ + : (Match regex:C1019("(?m-si)^\\d+\\.*\\d*$"; $Txt_value; 1)) // Numeric + + $Obj_result[$Txt_key]:=Num:C11($Txt_value; ".") + + //______________________________________________________ + : (Match regex:C1019("(?mi-s)^true|false$"; $Txt_value; 1)) // Boolean + + $Obj_result[$Txt_key]:=($Txt_value="true") + + //______________________________________________________ + Else // Text + + $Obj_result[$Txt_key]:=$Txt_value + + //______________________________________________________ + End case +End for +//} + +// Value if any { +DOM GET XML ELEMENT VALUE:C731($Dom_elementRef; $Txt_value) + +If (Match regex:C1019("[^\\s]+"; $Txt_value; 1)) + + $Obj_result["$"]:=$Txt_value + +End if +//} + +// Childs if any { +$Dom_child:=DOM Get first child XML element:C723($Dom_elementRef; $Txt_name) + +If (OK=1) + + // Many one? [ + $Lon_count:=DOM Count XML elements:C726($Dom_elementRef; $Txt_name) + + If ($Lon_count>1) // Yes + + $Obj_result[$Txt_name]:=New collection:C1472 + + For ($Lon_i; 1; $Lon_count; 1) + + $Obj_result[$Txt_name].push(_o_xml_elementToObject(DOM Get XML element:C725($Dom_elementRef; $Txt_name; $Lon_i); $Boo_references)) + + End for + + Else // No + + $Obj_result[$Txt_name]:=_o_xml_elementToObject($Dom_child; $Boo_references) + + End if + //] + + // Next one, if any + $Dom_child:=DOM Get next sibling XML element:C724($Dom_child; $Txt_name) + + While (OK=1) + + // Already treated? + If ($Obj_result[$Txt_name]=Null:C1517) + + // Many one? [ + $Lon_count:=DOM Count XML elements:C726($Dom_elementRef; $Txt_name) + + If ($Lon_count>1) // Yes + + $Obj_result[$Txt_name]:=New collection:C1472 + + For ($Lon_i; 1; $Lon_count; 1) + + $Obj_result[$Txt_name].push(_o_xml_elementToObject(DOM Get XML element:C725($Dom_elementRef; $Txt_name; $Lon_i); $Boo_references)) + + End for + + Else // No + + $Obj_result[$Txt_name]:=_o_xml_elementToObject($Dom_child; $Boo_references) + + End if + End if + + // Next one, if any + $Dom_child:=DOM Get next sibling XML element:C724($Dom_child; $Txt_name) + + End while +End if +//} + +// ---------------------------------------------------- +// Return +$0:=$Obj_result + +// ---------------------------------------------------- +// End \ No newline at end of file diff --git a/Project/Sources/Methods/_o_xml_encode.4dm b/Project/Sources/Methods/_o_xml_encode.4dm new file mode 100644 index 0000000..2d6e0c9 --- /dev/null +++ b/Project/Sources/Methods/_o_xml_encode.4dm @@ -0,0 +1,66 @@ +//%attributes = {"invisible":true,"preemptive":"capable"} +// ---------------------------------------------------- +// Project method : xml_encode +// Database: 4D Mobile Express +// Created #21-11-2017 by Eric Marchand +// ---------------------------------------------------- +// Description: + +// ---------------------------------------------------- +// Declarations +var $0 : Text +var $1 : Text + +var $Lon_parameters : Integer +var $Dom_ref; $Txt_in; $Txt_out : Text + +If (False:C215) + _O_C_TEXT:C284(_o_xml_encode; $0) + _O_C_TEXT:C284(_o_xml_encode; $1) +End if + + +// ---------------------------------------------------- +// Initialisations +$Lon_parameters:=Count parameters:C259 + +If (Asserted:C1132($Lon_parameters>=1; "Missing parameter")) + + // Required parameters + $Txt_in:=$1 + + // Optional parameters + If ($Lon_parameters>=2) + + // + + End if + +Else + + ABORT:C156 + +End if + +// ---------------------------------------------------- + +If (Length:C16($Txt_in)=0) + + $Txt_out:=$Txt_in + +Else + // XXX maybe find a 4D method or better ways to xml encode + + // Use DOM api to encode XML + $Dom_ref:=DOM Create XML Ref:C861("RootElement") + DOM SET XML ATTRIBUTE:C866($Dom_ref; "test"; $Txt_in) + DOM EXPORT TO VAR:C863($Dom_ref; $Txt_out) + DOM CLOSE XML:C722($Dom_ref) + + // Extract from result + $Txt_out:=Substring:C12($Txt_out; Position:C15("test=\""; $Txt_out)+6) + $Txt_out:=Substring:C12($Txt_out; 1; Length:C16($Txt_out)-4) + +End if + +$0:=$Txt_out \ No newline at end of file diff --git a/Project/Sources/Methods/_o_xml_fileToObject.4dm b/Project/Sources/Methods/_o_xml_fileToObject.4dm new file mode 100644 index 0000000..e119a13 --- /dev/null +++ b/Project/Sources/Methods/_o_xml_fileToObject.4dm @@ -0,0 +1,82 @@ +//%attributes = {"invisible":true,"preemptive":"capable"} +// ---------------------------------------------------- +// Project method : xml_fileToObject +// Database: 4D Mobile Express +// ID[0C9EE89768224AA19AEA2AFC14789A8E] +// Created #2-8-2017 by Vincent de Lachaux +// ---------------------------------------------------- +// Description: +// Returns an XML document as an object +// ---------------------------------------------------- +// Declarations +_O_C_OBJECT:C1216($0) +_O_C_TEXT:C284($1) +_O_C_BOOLEAN:C305($2) + +_O_C_BOOLEAN:C305($Boo_references) +_O_C_LONGINT:C283($Lon_parameters) +_O_C_TEXT:C284($Dom_root; $File_pathname) +_O_C_OBJECT:C1216($Obj_result) + +If (False:C215) + _O_C_OBJECT:C1216(_o_xml_fileToObject; $0) + _O_C_TEXT:C284(_o_xml_fileToObject; $1) + _O_C_BOOLEAN:C305(_o_xml_fileToObject; $2) +End if + +// ---------------------------------------------------- +// Initialisations +$Lon_parameters:=Count parameters:C259 + +If (Asserted:C1132($Lon_parameters>=1; "Missing parameter")) + + // Required parameters + $File_pathname:=$1 + + // Optional parameters + If ($Lon_parameters>=2) + + $Boo_references:=$2 + + End if + + $Obj_result:=New object:C1471(\ + "success"; False:C215) + +Else + + ABORT:C156 + +End if + +// ---------------------------------------------------- +If (Test path name:C476($File_pathname)=Is a document:K24:1) + + $Dom_root:=DOM Parse XML source:C719($File_pathname) + + If (OK=1) + + $Obj_result:=New object:C1471(\ + "success"; True:C214; \ + "value"; _o_xml_refToObject($Dom_root; $Boo_references)) + + DOM CLOSE XML:C722($Dom_root) + + Else + + $Obj_result.errors:=New collection:C1472("Failed to parse") + + End if + +Else + + $Obj_result.errors:=New collection:C1472("File "+$File_pathname+" is not a document") + +End if + +// ---------------------------------------------------- +// Return +$0:=$Obj_result + +// ---------------------------------------------------- +// End \ No newline at end of file diff --git a/Project/Sources/Methods/_o_xml_findByName.4dm b/Project/Sources/Methods/_o_xml_findByName.4dm new file mode 100644 index 0000000..40cb629 --- /dev/null +++ b/Project/Sources/Methods/_o_xml_findByName.4dm @@ -0,0 +1,67 @@ +//%attributes = {"invisible":true,"preemptive":"capable"} +// ---------------------------------------------------- +// Project method : xml_findByName +// Database: 4D Mobile App +// ID[0C9EE897E822EAA19AEA2AFC14789A8E] +// ---------------------------------------------------- +// Description: +// Returns all dom elements with specific name +// ---------------------------------------------------- +// Declarations +_O_C_COLLECTION:C1488($0) +_O_C_TEXT:C284($1) +_O_C_TEXT:C284($2) + +_O_C_LONGINT:C283($Lon_parameters) +_O_C_TEXT:C284($Dom_child; $Dom_elementRef; $Txt_name; $Txt_nameToFind) +_O_C_COLLECTION:C1488($Col_result) + +If (False:C215) + _O_C_COLLECTION:C1488(_o_xml_findByName; $0) + _O_C_TEXT:C284(_o_xml_findByName; $1) + _O_C_TEXT:C284(_o_xml_findByName; $2) +End if + +// ---------------------------------------------------- +// Initialisations +$Lon_parameters:=Count parameters:C259 + +If (Asserted:C1132($Lon_parameters>=2; "Missing parameter")) + + $Dom_elementRef:=$1 + $Txt_nameToFind:=$2 + + $Col_result:=New collection:C1472 + +Else + + ABORT:C156 + +End if + +// ---------------------------------------------------- + +// Childs if any { +$Dom_child:=DOM Get first child XML element:C723($Dom_elementRef; $Txt_name) + +While (OK=1) + + If ($Txt_name=$Txt_nameToFind) + + $Col_result.push($Dom_child) + + End if + + $Col_result:=$Col_result.combine(_o_xml_findByName($Dom_child; $Txt_nameToFind)) // <======= RECURSIVE + + // Next one, if any + $Dom_child:=DOM Get next sibling XML element:C724($Dom_child; $Txt_name) + +End while + +// ---------------------------------------------------- +// Return +$0:=$Col_result + +// ---------------------------------------------------- +// End \ No newline at end of file diff --git a/Project/Sources/Methods/_o_xml_findElement.4dm b/Project/Sources/Methods/_o_xml_findElement.4dm new file mode 100644 index 0000000..ad3c60c --- /dev/null +++ b/Project/Sources/Methods/_o_xml_findElement.4dm @@ -0,0 +1,69 @@ +//%attributes = {"invisible":true,"preemptive":"capable"} +// ---------------------------------------------------- +// Project method : xml_findElement +// Database: 4D Mobile Express +// ID[42201DC36CAD45BDB841D1B8A31AC0D0] +// Created #1-8-2017 by Eric Marchand +// ---------------------------------------------------- +// Description: +// Wrapper for DOM Find XML element to catch errors. +// ---------------------------------------------------- +// Declarations +_O_C_OBJECT:C1216($0) +_O_C_TEXT:C284($1) +_O_C_TEXT:C284($2) + +_O_C_LONGINT:C283($Lon_parameters) +_O_C_TEXT:C284($Dom_reference; $Txt_methodOnError; $Txt_xpath) +_O_C_OBJECT:C1216($Obj_result) + +If (False:C215) + _O_C_OBJECT:C1216(_o_xml_findElement; $0) + _O_C_TEXT:C284(_o_xml_findElement; $1) + _O_C_TEXT:C284(_o_xml_findElement; $2) +End if + +// ---------------------------------------------------- +// Initialisations +$Lon_parameters:=Count parameters:C259 + +If (Asserted:C1132($Lon_parameters>=2; "Missing parameter")) + + // Required parameters + $Dom_reference:=$1 + $Txt_xpath:=$2 + + $Obj_result:=New object:C1471(\ + "success"; False:C215) + +Else + + ABORT:C156 + +End if + +// ---------------------------------------------------- +$Txt_methodOnError:=Method called on error:C704 + +// TRY ( +ON ERR CALL:C155("xml_NO_ERROR") +xml_ERROR:=0 +//) { + +$Obj_result.reference:=DOM Find XML element:C864($Dom_reference; $Txt_xpath) +$Obj_result.success:=((OK=1) & (xml_ERROR#0) & \ +($Obj_result.reference#"00000000000000000000000000000000") & ($Obj_result.reference#"")) + +// } CATCH { +If (xml_ERROR#0) + $Obj_result.error:=xml_ERROR +End if +ON ERR CALL:C155($Txt_methodOnError) +// } + +// ---------------------------------------------------- +// Return +$0:=$Obj_result + +// ---------------------------------------------------- +// End diff --git a/Project/Sources/Methods/_o_xml_refToObject.4dm b/Project/Sources/Methods/_o_xml_refToObject.4dm new file mode 100644 index 0000000..c77de47 --- /dev/null +++ b/Project/Sources/Methods/_o_xml_refToObject.4dm @@ -0,0 +1,60 @@ +//%attributes = {"invisible":true,"preemptive":"capable"} +// ---------------------------------------------------- +// Project method : xml_refToObject +// Database: 4D Mobile Express +// ID[422011C36CAB45BDB84131B8A31AC0D0] +// Created #1-8-2017 by Vincent de Lachaux +// ---------------------------------------------------- +// Description: +// Returns an XML tree reference as an object +// ---------------------------------------------------- +// Declarations +_O_C_OBJECT:C1216($0) +_O_C_TEXT:C284($1) +_O_C_BOOLEAN:C305($2) + +_O_C_BOOLEAN:C305($Boo_references) +_O_C_LONGINT:C283($Lon_parameters) +_O_C_TEXT:C284($Dom_rootReference; $Txt_name) +_O_C_OBJECT:C1216($Obj_result) + +If (False:C215) + _O_C_OBJECT:C1216(_o_xml_refToObject; $0) + _O_C_TEXT:C284(_o_xml_refToObject; $1) + _O_C_BOOLEAN:C305(_o_xml_refToObject; $2) +End if + +// ---------------------------------------------------- +// Initialisations +$Lon_parameters:=Count parameters:C259 + +If (Asserted:C1132($Lon_parameters>=1; "Missing parameter")) + + // Required parameters + $Dom_rootReference:=$1 + + // Optional parameters + If ($Lon_parameters>=2) + + $Boo_references:=$2 + + End if + + $Obj_result:=New object:C1471 + +Else + + ABORT:C156 + +End if + +// ---------------------------------------------------- +DOM GET XML ELEMENT NAME:C730($Dom_rootReference; $Txt_name) +$Obj_result[$Txt_name]:=_o_xml_elementToObject($Dom_rootReference; $Boo_references) + +// ---------------------------------------------------- +// Return +$0:=$Obj_result + +// ---------------------------------------------------- +// End \ No newline at end of file diff --git a/Project/Sources/Methods/beautifier_test_1.4dm b/Project/Sources/Methods/beautifier_test_1.4dm deleted file mode 100755 index 38b2037..0000000 --- a/Project/Sources/Methods/beautifier_test_1.4dm +++ /dev/null @@ -1,141 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - -////THIS LINE WILL BE THE FIRST LINE OF THE METHOD -//C_LONGINT($count; $i; $x) -//C_TEXT($Txt; $that) - -////PRESERVE COMMENT BEFORE OPENING -//If (True) - - - -////A LINE OF COMMENTS MUST BE PRECEDED BY A LINE BREAK -//$Txt:="toto" -//Case of //comment -//: (True) //comment -//Case of -//: (True) -//If (True) //comment -//If (True) //comment -//For ($i; 1; 10; 1) //comment -//While ($x) -////comment -//$count:=$count+$x -//End while -//End for - - - -////Use Choose instead If…Else…End if -//If (($count=1) & ($x>0)) - -//$Txt:=$that - -//Else - -//$Txt:="that" - -//End if - - -////#ACI0097825 - - - - -//End if -//End if -//: (True) -//Case of -//: (True) -//If (True) //comment -//If (True) //comment -//For ($i; 1; 10; 1) //comment -//While ($x) -////BEGIN MULTILINE COMMENT -////MULTILINE COMMENT -////END MULTILINE COMMENT -//$count:=$count+$x -//End while //GROUPING CLOSURE INSTRUCTIONS - -//End for //GROUPING CLOSURE INSTRUCTIONS - -//End if //GROUPING CLOSURE INSTRUCTIONS - -//End if //GROUPING CLOSURE INSTRUCTIONS - - - -//: (True) -//Case of -//: (True) -//If (True) //comment -//If (True) //comment -//For ($i; 1; 10; 1) //comment -//While ($x) -////comment -//$count:=$count+$x -//End while -//End for -//End if -//End if -//: (True) -//$count:=1 -//$count:=2 -//: (True) -//For ($i; 1; 10; 1) -//$count:=$count*$i -//End for //REMOVE CONSECUTIVE BLANK LINES { - -////bloc { -//Begin SQL - -//SELECT * -//FROM _USER_COLUMNS -//INTO -//:test - -//End SQL -////} - -//Else //REMOVE CONSECUTIVE BLANK LINES } -//While ($x) -//$count:=$count+$x -//End while -//End case -//: (True) -//For ($i; 1; 10; 1) -//$count:=$count*$i -//End for -//Else -//While ($x) -//$count:=$count+$x -//End while -//End case -//: (True) -//For ($i; 1; 10; 1) -//$count:=$count*$i -//End for -//Else -//While ($x) -//$count:=$count+$x -//End while -//End case -//: (True) -//For ($i; 1; 10; 1) -//$count:=$count*$i -//End for -//Else -//While ($x) -//$count:=$count+$x -//End while -//End case -//Else -//If (($txt="") | ($txt#"")) & (True) //SPLIT TEST LINES WITH & AND | -//$Txt:="titi" -//End if -//End if -////END - - - diff --git a/Project/Sources/Methods/beautifier_test_10.4dm b/Project/Sources/Methods/beautifier_test_10.4dm deleted file mode 100755 index d6b2a6c..0000000 --- a/Project/Sources/Methods/beautifier_test_10.4dm +++ /dev/null @@ -1,8 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} -C_TEXT:C284($txt) - -If (Length:C16($txt)=0) | (Length:C16($txt)#0) & (True:C214) - - //SPLIT TEST LINES WITH & AND | - -End if \ No newline at end of file diff --git a/Project/Sources/Methods/beautifier_test_11.4dm b/Project/Sources/Methods/beautifier_test_11.4dm index 0c3a42a..ccbcdb6 100755 --- a/Project/Sources/Methods/beautifier_test_11.4dm +++ b/Project/Sources/Methods/beautifier_test_11.4dm @@ -1,22 +1,38 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - //1220 -C_PICTURE:C286($Pic_buffer) -C_TEXT:C284($Dom_buffer) -C_OBJECT:C1216($Obj_buffer) -C_VARIANT:C1683($v;$vv) +//%attributes = {"invisible":true,"preemptive":"incapable"} +//1220 +var $dom; $node; $root; $xpath : Text +var $pic : Picture +var $o : Object -$v:="" -$vv:="" +OB SET:C1220($o; "property"; 0; "property1"; 1; "property2"; 2; "property3"; 3) +OB SET:C1220($o; "property"; 12-(10*2); "property1"; "value1"; "property2"; "valu2"; "property3"; "value3") // Test2 -OB SET:C1220($Obj_buffer;"property";"value";"property1";"value1";"property2";"valu2";"property3";"value3") +OB SET:C1220($o; "property"; "value"; "property1"; {test: "hello"; test2: "world"}; "property2"; "valu2"; "property3"; "value3") -OB SET:C1220($Obj_buffer;"property";12-(10*2);"property1";"value1";"property2";"valu2";"property3";"value3") //test2 +OB SET:C1220($o; "property"; "value") -OB SET:C1220($Obj_buffer;"property";"value") +//OB SET($o; "property"; 0; "property1"; 1; "property2"; 2; "property3"; 3; "zz")/* ERROR IN PARAMETER COUNT */ -SVG SET ATTRIBUTE:C1055(*;"toto";"id";"attribute";"value";"attribute1";"value1";"attribute2";"value2") +SVG SET ATTRIBUTE:C1055(*; "toto"; "id"; "attribute"; "value"; "attribute1"; "value1"; "attribute2"; "value2") -SVG SET ATTRIBUTE:C1055($Pic_buffer;"id";"attribute";"value";"attribute1";"value1";"attribute2";"value2") +SVG SET ATTRIBUTE:C1055($pic; "id"; "attribute"; "value"; "attribute1"; "value1"; "attribute2"; "value2") + +SVG SET ATTRIBUTE:C1055($pic; "id"; "attribute"; "value"; "attribute1"; "value1"; "attribute2"; "value2") // Comment + +SVG SET ATTRIBUTE:C1055(*; "toto"; "id"; "attribute"; "value"; "attribute1"; "value1") + +SVG SET ATTRIBUTE:C1055(*; "toto"; "id"; "attribute"; "value") + +SVG SET ATTRIBUTE:C1055($pic; "id"; "attribute"; "value") // Comment + +DOM SET XML ATTRIBUTE:C866($dom; "attribute"; "value"; "attribute1"; "value1"; "attribute2"; "value2") // Comment + +DOM SET XML ATTRIBUTE:C866($dom; "attribute"; "value") // Comment + +$node:=DOM Create XML element:C865($root; $xpath; "attribute"; "value"; "attribute1"; "value1"; "attribute2"; "value2") // Comment + +//ST SET ATTRIBUTES(*; "toto"; 10; 20; "attribute"; 0; "attribute1"; 1; "attribute2"; 2) // Comment + +//ST SET ATTRIBUTES($txt; $startSel; $endSel; "attribute"; "value"; "attribute1"; "value1"; "attribute2"; "value2") // Comment -DOM SET XML ATTRIBUTE:C866($Dom_buffer;"attribute";"value";"attribute1";"value1";"attribute2";"value2") \ No newline at end of file diff --git a/Project/Sources/Methods/beautifier_test_12.4dm b/Project/Sources/Methods/beautifier_test_12.4dm index 54587ac..2efe11b 100755 --- a/Project/Sources/Methods/beautifier_test_12.4dm +++ b/Project/Sources/Methods/beautifier_test_12.4dm @@ -1,195 +1,195 @@ //%attributes = {"invisible":true,"preemptive":"capable"} - //1220 -C_LONGINT:C283($Lon_height;$Lon_id;$Lon_r;$Lon_viewPortHeight;$Lon_viewPortWidth;$Lon_width) -C_LONGINT:C283($Lon_x;$Lon_y) -C_PICTURE:C286($Pic_buffer) -C_REAL:C285($Num_tx;$Num_ty) -C_TEXT:C284($Dom_canvas;$Dom_g;$Dom_rect;$Dom_root;$Svg_root;$Txt_class) -C_TEXT:C284($Txt_ID;$Txt_transform;$Txt_type) -C_OBJECT:C1216($Obj_buffer) - -OB SET:C1220($Obj_buffer;\ -"id";$Lon_id;\ -"class";$Txt_class;\ -"x";$Lon_x-(10/2);\ -"y";$Lon_y) - -$Dom_rect:=DOM Create XML element:C865($Dom_root;"rect";\ -"id";$Lon_id;\ -"class";$Txt_class;\ -"x";$Lon_x-(10/2);\ -"y";$Lon_y;\ -"transform";$Txt_transform;\ -"width";$Lon_width;\ -"height";$Lon_height;\ -"editor:group";"";\ -"editor:object-type";$Txt_type;\ -"editor:object-id";$Lon_id;\ -"editor:x";$Lon_x;\ -"editor:y";$Lon_y;\ -"editor:width";$Lon_width;\ -"editor:height";$Lon_height;\ -"editor:tx";$Lon_x;\ -"editor:ty";$Lon_y;\ -"editor:sx";$Lon_x;\ -"editor:sy";$Lon_y;\ -"editor:cx";$Lon_x;\ -"editor:cy";$Lon_y;\ -"editor:r";$Lon_r;\ -"shape-rendering";"geometricPrecision") //test - -$Dom_rect:=DOM Create XML element:C865($Dom_root;"rect";\ -"id";$Lon_id;\ -"class";$Txt_class;\ -"x";$Lon_x-(10/2);\ -"y";$Lon_y;\ -"transform";$Txt_transform;\ -"width";$Lon_width;\ -"height";$Lon_height;\ -"editor:group";"";\ -"editor:object-type";$Txt_type;\ -"editor:object-id";$Lon_id;\ -"editor:x";$Lon_x;\ -"editor:y";$Lon_y;\ -"editor:width";$Lon_width;\ -"editor:height";$Lon_height;\ -"editor:tx";$Lon_x;\ -"editor:ty";$Lon_y;\ -"editor:sx";$Lon_x;\ -"editor:sy";$Lon_y;\ -"editor:cx";$Lon_x;\ -"editor:cy";$Lon_y;\ -"editor:r";$Lon_r;\ -"shape-rendering";"geometricPrecision") - -DOM SET XML ATTRIBUTE:C866($Dom_rect;\ -"id";$Lon_id;\ -"class";$Txt_class;\ -"x";$Lon_x-(10/2);\ -"y";$Lon_y;\ -"transform";$Txt_transform) //comment - -DOM SET XML ATTRIBUTE:C866($Dom_rect;\ -"id";$Lon_id;\ -"class";$Txt_class;\ -"x";$Lon_x;\ -"y";$Lon_y;\ -"transform";$Txt_transform) - -DOM SET XML ATTRIBUTE:C866($Dom_rect;\ -"id";$Lon_id) - -SVG SET ATTRIBUTE:C1055(*;"test";"id";\ -"class";$Txt_class;\ -"x";$Lon_x-(10/2);\ -"y";$Lon_y) - -SVG SET ATTRIBUTE:C1055($Dom_root;"id";\ -"class";$Txt_class;\ -"x";$Lon_x-(10/2);\ -"y";$Lon_y) - -$Dom_rect:=DOM Create XML element:C865($Dom_root;"rect";\ -"id";$Lon_id;\ -"class";$Txt_class;\ -"test";OB Get:C1224($Obj_buffer;"test";Is text:K8:3)) - -$Dom_rect:=DOM Create XML element:C865($Dom_root;"rect";\ -"test";OB Get:C1224($Obj_buffer;"test";Is text:K8:3);\ -"rect";"id") - -$Dom_rect:=DOM Create XML element:C865($Dom_root;"rect";\ -"class";$Txt_class;\ -"choose";Choose:C955($Lon_id>0;"up";"down");\ -"rect";"id") - -SVG SET ATTRIBUTE:C1055(*;"test";"id";\ -"class";Choose:C955($Lon_id>0;"up";"down");\ -"x";$Lon_x-(10/2);\ -"y";$Lon_y) - -OB SET:C1220($Obj_buffer;\ -"property";"value";\ -"property1";"value1";\ -"property2";"value2";\ -"property3";"value3") - -OB SET:C1220($Obj_buffer;\ -"property";12-(10*2);\ -"property1";"value1";\ -"property2";"value2";\ -"property3";"value3") //test2 - -OB SET:C1220($Obj_buffer;\ -"property";"value") - -DOM SET XML ATTRIBUTE:C866($Dom_root;\ -"version";"1.1";\ -"id";"svg";\ -"width";$Lon_viewPortWidth;\ -"height";$Lon_viewPortHeight;\ -"viewport-fill";"#0000FF";\ -"viewport-fill-opacity";0) - -SVG SET ATTRIBUTE:C1055(*;"test";"id";\ -"class";Choose:C955($Lon_id>0;"up";"down");\ -"x";$Lon_x-(10/2);\ -"y";$Lon_y) - -SVG SET ATTRIBUTE:C1055(*;"test";"id";\ -"class";Choose:C955($Lon_id>0;"up";"down");\ -"x";$Lon_x-(10/2);\ -"y";$Lon_y;\ +//1220 +var $Lon_height; $Lon_id; $Lon_r; $Lon_viewPortHeight; $Lon_viewPortWidth; $Lon_width : Integer +var $Lon_x; $Lon_y : Integer +var $Pic_buffer : Picture +var $Num_tx; $Num_ty : Real +var $Dom_canvas; $Dom_g; $Dom_rect; $Dom_root; $Svg_root; $Txt_class : Text +var $Txt_ID; $Txt_transform; $Txt_type : Text +var $Obj_buffer : Object + +OB SET:C1220($Obj_buffer; \ +"id"; $Lon_id; \ +"class"; $Txt_class; \ +"x"; $Lon_x-(10/2); \ +"y"; $Lon_y) + +$Dom_rect:=DOM Create XML element:C865($Dom_root; "rect"; \ +"id"; $Lon_id; \ +"class"; $Txt_class; \ +"x"; $Lon_x-(10/2); \ +"y"; $Lon_y; \ +"transform"; $Txt_transform; \ +"width"; $Lon_width; \ +"height"; $Lon_height; \ +"editor:group"; ""; \ +"editor:object-type"; $Txt_type; \ +"editor:object-id"; $Lon_id; \ +"editor:x"; $Lon_x; \ +"editor:y"; $Lon_y; \ +"editor:width"; $Lon_width; \ +"editor:height"; $Lon_height; \ +"editor:tx"; $Lon_x; \ +"editor:ty"; $Lon_y; \ +"editor:sx"; $Lon_x; \ +"editor:sy"; $Lon_y; \ +"editor:cx"; $Lon_x; \ +"editor:cy"; $Lon_y; \ +"editor:r"; $Lon_r; \ +"shape-rendering"; "geometricPrecision") //test + +$Dom_rect:=DOM Create XML element:C865($Dom_root; "rect"; \ +"id"; $Lon_id; \ +"class"; $Txt_class; \ +"x"; $Lon_x-(10/2); \ +"y"; $Lon_y; \ +"transform"; $Txt_transform; \ +"width"; $Lon_width; \ +"height"; $Lon_height; \ +"editor:group"; ""; \ +"editor:object-type"; $Txt_type; \ +"editor:object-id"; $Lon_id; \ +"editor:x"; $Lon_x; \ +"editor:y"; $Lon_y; \ +"editor:width"; $Lon_width; \ +"editor:height"; $Lon_height; \ +"editor:tx"; $Lon_x; \ +"editor:ty"; $Lon_y; \ +"editor:sx"; $Lon_x; \ +"editor:sy"; $Lon_y; \ +"editor:cx"; $Lon_x; \ +"editor:cy"; $Lon_y; \ +"editor:r"; $Lon_r; \ +"shape-rendering"; "geometricPrecision") + +DOM SET XML ATTRIBUTE:C866($Dom_rect; \ +"id"; $Lon_id; \ +"class"; $Txt_class; \ +"x"; $Lon_x-(10/2); \ +"y"; $Lon_y; \ +"transform"; $Txt_transform) //comment + +DOM SET XML ATTRIBUTE:C866($Dom_rect; \ +"id"; $Lon_id; \ +"class"; $Txt_class; \ +"x"; $Lon_x; \ +"y"; $Lon_y; \ +"transform"; $Txt_transform) + +DOM SET XML ATTRIBUTE:C866($Dom_rect; \ +"id"; $Lon_id) + +SVG SET ATTRIBUTE:C1055(*; "test"; "id"; \ +"class"; $Txt_class; \ +"x"; $Lon_x-(10/2); \ +"y"; $Lon_y) + +SVG SET ATTRIBUTE:C1055($Dom_root; "id"; \ +"class"; $Txt_class; \ +"x"; $Lon_x-(10/2); \ +"y"; $Lon_y) + +$Dom_rect:=DOM Create XML element:C865($Dom_root; "rect"; \ +"id"; $Lon_id; \ +"class"; $Txt_class; \ +"test"; OB Get:C1224($Obj_buffer; "test"; Is text:K8:3)) + +$Dom_rect:=DOM Create XML element:C865($Dom_root; "rect"; \ +"test"; OB Get:C1224($Obj_buffer; "test"; Is text:K8:3); \ +"rect"; "id") + +$Dom_rect:=DOM Create XML element:C865($Dom_root; "rect"; \ +"class"; $Txt_class; \ +"choose"; Choose:C955($Lon_id>0; "up"; "down"); \ +"rect"; "id") + +SVG SET ATTRIBUTE:C1055(*; "test"; "id"; \ +"class"; Choose:C955($Lon_id>0; "up"; "down"); \ +"x"; $Lon_x-(10/2); \ +"y"; $Lon_y) + +OB SET:C1220($Obj_buffer; \ +"property"; "value"; \ +"property1"; "value1"; \ +"property2"; "value2"; \ +"property3"; "value3") + +OB SET:C1220($Obj_buffer; \ +"property"; 12-(10*2); \ +"property1"; "value1"; \ +"property2"; "value2"; \ +"property3"; "value3") //test2 + +OB SET:C1220($Obj_buffer; \ +"property"; "value") + +DOM SET XML ATTRIBUTE:C866($Dom_root; \ +"version"; "1.1"; \ +"id"; "svg"; \ +"width"; $Lon_viewPortWidth; \ +"height"; $Lon_viewPortHeight; \ +"viewport-fill"; "#0000FF"; \ +"viewport-fill-opacity"; 0) + +SVG SET ATTRIBUTE:C1055(*; "test"; "id"; \ +"class"; Choose:C955($Lon_id>0; "up"; "down"); \ +"x"; $Lon_x-(10/2); \ +"y"; $Lon_y) + +SVG SET ATTRIBUTE:C1055(*; "test"; "id"; \ +"class"; Choose:C955($Lon_id>0; "up"; "down"); \ +"x"; $Lon_x-(10/2); \ +"y"; $Lon_y; \ *) -SVG SET ATTRIBUTE:C1055($Pic_buffer;"id";\ -"class";Choose:C955($Lon_id>0;"up";"down");\ -"x";$Lon_x-(10/2);\ -"y";$Lon_y) +SVG SET ATTRIBUTE:C1055($Pic_buffer; "id"; \ +"class"; Choose:C955($Lon_id>0; "up"; "down"); \ +"x"; $Lon_x-(10/2); \ +"y"; $Lon_y) -SVG SET ATTRIBUTE:C1055($Pic_buffer;"id";\ -"class";Choose:C955($Lon_id>0;"up";"down");\ -"x";$Lon_x-(10/2);\ -"y";$Lon_y;\ +SVG SET ATTRIBUTE:C1055($Pic_buffer; "id"; \ +"class"; Choose:C955($Lon_id>0; "up"; "down"); \ +"x"; $Lon_x-(10/2); \ +"y"; $Lon_y; \ *) -DOM SET XML ATTRIBUTE:C866($Svg_root;\ -"xmlns:svg";"http://www.w3.org/2000/svg";\ -"xmlns:xlink";"http://www.w3.org/1999/xlink";\ -"xmlns:editor";"http://www.4d.com/2014/editor") +DOM SET XML ATTRIBUTE:C866($Svg_root; \ +"xmlns:svg"; "http://www.w3.org/2000/svg"; \ +"xmlns:xlink"; "http://www.w3.org/1999/xlink"; \ +"xmlns:editor"; "http://www.4d.com/2014/editor") -$Dom_rect:=DOM Create XML element:C865(DOM Find XML element by ID:C1010($Dom_root;$Txt_ID);"rect";\ -"class";$Txt_class;\ -"choose";Choose:C955($Lon_id>0;"up";"down");\ -"rect";"id") +$Dom_rect:=DOM Create XML element:C865(DOM Find XML element by ID:C1010($Dom_root; $Txt_ID); "rect"; \ +"class"; $Txt_class; \ +"choose"; Choose:C955($Lon_id>0; "up"; "down"); \ +"rect"; "id") -$Dom_rect:=DOM Create XML element:C865($Dom_root;"rect";\ -"id";$Lon_id;\ -"class";$Txt_class;\ -"test";OB Get:C1224($Obj_buffer;"test";Is text:K8:3)) +$Dom_rect:=DOM Create XML element:C865($Dom_root; "rect"; \ +"id"; $Lon_id; \ +"class"; $Txt_class; \ +"test"; OB Get:C1224($Obj_buffer; "test"; Is text:K8:3)) -$Dom_rect:=DOM Create XML element:C865($Dom_root;"rect";\ -"test";OB Get:C1224($Obj_buffer;"test";Is text:K8:3);\ -"rect";"id") +$Dom_rect:=DOM Create XML element:C865($Dom_root; "rect"; \ +"test"; OB Get:C1224($Obj_buffer; "test"; Is text:K8:3); \ +"rect"; "id") -$Dom_rect:=DOM Create XML element:C865($Dom_root;"rect";\ -"class";$Txt_class;\ -"choose";Choose:C955($Lon_id>0;"up";"down");\ -"rect";"id") +$Dom_rect:=DOM Create XML element:C865($Dom_root; "rect"; \ +"class"; $Txt_class; \ +"choose"; Choose:C955($Lon_id>0; "up"; "down"); \ +"rect"; "id") -$Dom_g:=DOM Create XML element:C865($Dom_canvas;"g";\ -"id";OB Get:C1224($Obj_buffer;"select-prefix";Is text:K8:3)+$Txt_ID;\ -"transform";"translate("+String:C10($Num_tx;"&xml")+","+String:C10($Num_ty;"&xml")+")";\ -"editor:object-type";"";\ -"editor:object-id";"") +$Dom_g:=DOM Create XML element:C865($Dom_canvas; "g"; \ +"id"; OB Get:C1224($Obj_buffer; "select-prefix"; Is text:K8:3)+$Txt_ID; \ +"transform"; "translate("+String:C10($Num_tx; "&xml")+","+String:C10($Num_ty; "&xml")+")"; \ +"editor:object-type"; ""; \ +"editor:object-id"; "") -$Dom_g:=DOM Create XML element:C865($Dom_canvas;"g";\ -"transform";"translate("+String:C10($Num_tx;"&xml")+","+String:C10($Num_ty;"&xml")+")";\ -"id";$Txt_ID) +$Dom_g:=DOM Create XML element:C865($Dom_canvas; "g"; \ +"transform"; "translate("+String:C10($Num_tx; "&xml")+","+String:C10($Num_ty; "&xml")+")"; \ +"id"; $Txt_ID) - //comment above before tests - //DOM SET XML ATTRIBUTE($Svg_root;"xmlns:svg";"http://www.w3.org/2000/svg";"xmlns:xlink";"http://www.w3.org/1999/xlink";"xmlns:editor";"http://www.4d.com/2014/editor") +//comment above before tests +//DOM SET XML ATTRIBUTE($Svg_root;"xmlns:svg";"http://www.w3.org/2000/svg";"xmlns:xlink";"http://www.w3.org/1999/xlink";"xmlns:editor";"http://www.4d.com/2014/editor") -$Obj_buffer:=New object:C1471("property";"value") +$Obj_buffer:=New object:C1471("property"; "value") -$Obj_buffer:=New object:C1471("property";"value";"property2";"value") \ No newline at end of file +$Obj_buffer:=New object:C1471("property"; "value"; "property2"; "value") \ No newline at end of file diff --git a/Project/Sources/Methods/codeForCollection.4dm b/Project/Sources/Methods/codeForCollection.4dm index 96bca2f..23c631e 100755 --- a/Project/Sources/Methods/codeForCollection.4dm +++ b/Project/Sources/Methods/codeForCollection.4dm @@ -1,29 +1,17 @@ //%attributes = {"invisible":true,"preemptive":"capable"} -var $0 : Text -var $1 : Collection -var $2 : Text +#DECLARE($c : Collection; $key : Text) : Text -If (False:C215) - C_TEXT:C284(codeForCollection; $0) - C_COLLECTION:C1488(codeForCollection; $1) - C_TEXT:C284(codeForCollection; $2) -End if - -var $key; $t_code : Text +var $code : Text var $i : Integer -var $c : Collection - -$c:=$1 // Collection to analyse -If (Count parameters:C259=2) +If (Count parameters:C259=2) // Recursive call - $key:=$2 // If recursive call - $t_code:="New collection:C1472" + $code:="New collection:C1472" Else $key:="$c" - $t_code:="$c:=New collection:C1472" + $code:="$c:=New collection:C1472" End if @@ -31,69 +19,69 @@ For ($i; 0; $c.length-1; 1) Case of - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($c[$i])=Is object:K8:27) - $t_code:=$t_code+"\r$oo:="+codeForObject($c[$i]; "$oo")+"\r"+$key+".push($oo)" + $code+="\r$oo:="+codeForObject($c[$i]; "$oo")+"\r"+$key+".push($oo)" - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($c[$i])=Is collection:K8:32) If ($c[$i].length=0) // Put an empty collection - $t_code:=$t_code+"\r"+$key+".push("+codeForCollection($c[$i]; $key)+")" + $code+="\r"+$key+".push("+codeForCollection($c[$i]; $key)+")" Else - $t_code:=$t_code+"\r$cc:="+codeForCollection($c[$i]; "$cc")+"\r"+$key+".push($cc)" + $code+="\r$cc:="+codeForCollection($c[$i]; "$cc")+"\r"+$key+".push($cc)" End if - //______________________________________________________ + // ______________________________________________________ Else - $t_code:=$t_code+"\r"+$key+".push(" + $code+="\r"+$key+".push(" Case of - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($c[$i])=Is null:K8:31) - $t_code:=$t_code+"Null:C1517" + $code+="Null:C1517" - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($c[$i])=Is text:K8:3) - $t_code:=$t_code+"\""+$c[$i]+"\"" + $code+="\""+$c[$i]+"\"" - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($c[$i])=Is real:K8:4)\ | (Value type:C1509($c[$i])=Is longint:K8:6) - $t_code:=$t_code+String:C10($c[$i]) + $code+=String:C10($c[$i]) - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($c[$i])=Is boolean:K8:9) - $t_code:=$t_code+Choose:C955($c[$i]; "True:C214"; "False:C215") + $code+=$c[$i] ? "True:C214" : "False:C215" - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($c[$i])=Is date:K8:7) - $t_code:=$t_code+"!"+String:C10($c[$i])+"!" + $code+="!"+String:C10($c[$i])+"!" - //______________________________________________________ + // ______________________________________________________ Else // A "Case of" statement should never omit "Else" - //______________________________________________________ + // ______________________________________________________ End case - $t_code:=$t_code+")" + $code+=")" - //______________________________________________________ + // ______________________________________________________ End case End for -$0:=$t_code // 4D code \ No newline at end of file +return $code // 4D code \ No newline at end of file diff --git a/Project/Sources/Methods/codeForObject.4dm b/Project/Sources/Methods/codeForObject.4dm index 4e1aa56..b8c0fc2 100755 --- a/Project/Sources/Methods/codeForObject.4dm +++ b/Project/Sources/Methods/codeForObject.4dm @@ -1,22 +1,10 @@ //%attributes = {"invisible":true,"preemptive":"capable"} -var $0 : Text -var $1 : Object -var $2 : Text - -If (False:C215) - C_TEXT:C284(codeForObject; $0) - C_OBJECT:C1216(codeForObject; $1) - C_TEXT:C284(codeForObject; $2) -End if - -var $code; $key; $t : Text -var $Obj_object : Object +#DECLARE($Obj_object : Object; $key : Text) : Text +var $code; $t : Text -$Obj_object:=$1 // Object to analyse - -If (Count parameters:C259=2) - $key:=$2 // If recursive call +If (Count parameters:C259=2) // Recursive call + $code:="New object:C1471" Else @@ -31,93 +19,94 @@ For each ($t; $Obj_object) If (Length:C16($t)=0)\ | (Match regex:C1019("^\\d"; $t; 1)) - $code:=$code+"\r"+$key+"[\""+$t+"\"]:=" + $code+="\r"+$key+"[\""+$t+"\"]:=" Case of - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is null:K8:31) - $code:=$code+"Null:C1517" + $code+="Null:C1517" - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is object:K8:27) - $code:=$code+codeForObject($Obj_object[$t]; $key+"[\""+$t+"\"]") + $code+=codeForObject($Obj_object[$t]; $key+"[\""+$t+"\"]") - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is text:K8:3) - $code:=$code+"\""+$Obj_object[$t]+"\"" + $code+="\""+$Obj_object[$t]+"\"" - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is real:K8:4)\ | (Value type:C1509($Obj_object[$t])=Is longint:K8:6) - $code:=$code+String:C10($Obj_object[$t]) + $code+=String:C10($Obj_object[$t]) - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is boolean:K8:9) - $code:=$code+Choose:C955($Obj_object[$t]; "True:C214"; "False:C215") + $code+=$Obj_object[$t] ? "True:C214" : "False:C215" - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is date:K8:7) - $code:=$code+"!"+String:C10($Obj_object[$t])+"!" + $code+="!"+String:C10($Obj_object[$t])+"!" - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is collection:K8:32) - $code:=$code+codeForCollection($Obj_object[$t]; $key+"[\""+$t+"\"]") + $code+=codeForCollection($Obj_object[$t]; $key+"[\""+$t+"\"]") - //______________________________________________________ + // ______________________________________________________ End case + Else - $code:=$code+"\r"+$key+"."+$t+":=" + $code+="\r"+$key+"."+$t+":=" Case of - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is null:K8:31) - $code:=$code+"Null:C1517" + $code+="Null:C1517" - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is object:K8:27) - $code:=$code+codeForObject($Obj_object[$t]; $key+"."+$t) + $code+=codeForObject($Obj_object[$t]; $key+"."+$t) - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is text:K8:3) - $code:=$code+"\""+$Obj_object[$t]+"\"" + $code+="\""+$Obj_object[$t]+"\"" - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is real:K8:4)\ | (Value type:C1509($Obj_object[$t])=Is longint:K8:6) - $code:=$code+String:C10($Obj_object[$t]) + $code+=String:C10($Obj_object[$t]) - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is boolean:K8:9) - $code:=$code+Choose:C955($Obj_object[$t]; "True:C214"; "False:C215") + $code+=$Obj_object[$t] ? "True:C214" : "False:C215" - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is date:K8:7) - $code:=$code+"!"+String:C10($Obj_object[$t])+"!" + $code+="!"+String:C10($Obj_object[$t])+"!" - //______________________________________________________ + // ______________________________________________________ : (Value type:C1509($Obj_object[$t])=Is collection:K8:32) - $code:=$code+codeForCollection($Obj_object[$t]; $key+"."+$t) + $code+=codeForCollection($Obj_object[$t]; $key+"."+$t) - //______________________________________________________ + // ______________________________________________________ End case End if End for each -$0:=$code // 4D code \ No newline at end of file +return $code // 4D code \ No newline at end of file diff --git a/Project/Sources/Methods/createSymbolicLink.4dm b/Project/Sources/Methods/createSymbolicLink.4dm index fb7b95f..446db1c 100755 --- a/Project/Sources/Methods/createSymbolicLink.4dm +++ b/Project/Sources/Methods/createSymbolicLink.4dm @@ -1,6 +1,6 @@ //%attributes = {"invisible":true,"preemptive":"capable"} -C_TEXT:C284($pathname) -C_OBJECT:C1216($src) +var $pathname : Text +var $src : Object If (Shift down:C543) diff --git a/Project/Sources/Methods/declaration_UI.4dm b/Project/Sources/Methods/declaration_UI.4dm index 767634a..e0394cc 100755 --- a/Project/Sources/Methods/declaration_UI.4dm +++ b/Project/Sources/Methods/declaration_UI.4dm @@ -1,12 +1,6 @@ //%attributes = {"invisible":true,"preemptive":"incapable"} #DECLARE($entryPoint : Text; $data : Object)->$meta : Object -If (False:C215) - C_TEXT:C284(declaration_UI; $1) - C_OBJECT:C1216(declaration_UI; $2) - C_OBJECT:C1216(declaration_UI; $0) -End if - var $t : Text var $bottom; $height; $left; $right; $top; $width : Integer var $o : Object @@ -121,10 +115,12 @@ Case of End if - Form:C1466.array.enable(Not:C34(Bool:C1537($o.parameter)) & (Form:C1466.$notforArray.indexOf(Form:C1466.types[$o.type].name)=-1)) + If ($o.type#Null:C1517) + Form:C1466.array.enable(Not:C34(Bool:C1537($o.parameter)) & (Form:C1466._notforArray.indexOf(Form:C1466.types[$o.type].name)=-1)) + End if Form:C1466.array.setValue(Bool:C1537($o.array)) - For each ($t; Form:C1466.$notforArray) + For each ($t; Form:C1466._notforArray) OBJECT SET ENABLED:C1123(*; $t; Not:C34(Bool:C1537($o.array))) diff --git a/Project/Sources/Methods/options.4dm b/Project/Sources/Methods/options.4dm index 2b0483c..d72f723 100644 --- a/Project/Sources/Methods/options.4dm +++ b/Project/Sources/Methods/options.4dm @@ -1,34 +1,25 @@ //%attributes = {"invisible":true} #DECLARE($data : Object) -var $title : Text -var $run : Boolean -var $bottom; $i; $left; $right; $top : Integer +var $i : Integer ARRAY LONGINT:C221($windows; 0) - -$title:=Localized string:C991("preferences") - WINDOW LIST:C442($windows) +var $title : Text:=Localized string:C991("preferences") + For ($i; 1; Size of array:C274($windows); 1) If (Get window title:C450($windows{$i})=$title) - $run:=True:C214 - break + // Already running -> move to foreground + var $bottom; $left; $right; $top : Integer + GET WINDOW RECT:C443($left; $top; $right; $bottom; $windows{$i}) + SET WINDOW RECT:C444($left; $top; $right; $bottom; $windows{$i}) + + return End if End for -If (Not:C34($run)) - - CALL WORKER:C1389(1; "SETTINGS") - -Else - - GET WINDOW RECT:C443($left; $top; $right; $bottom; $windows{$i}) - SET WINDOW RECT:C444($left; $top; $right; $bottom; $windows{$i}) - -End if - +CALL WORKER:C1389(1; Formula:C1597(_SETTINGS)) \ No newline at end of file diff --git a/Project/Sources/Methods/rgx.4dm b/Project/Sources/Methods/rgx.4dm deleted file mode 100755 index a836672..0000000 --- a/Project/Sources/Methods/rgx.4dm +++ /dev/null @@ -1,232 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Project method : rgx - // ID[091975F1C6DC4791A66BD7A5314B92CF] - // Created 7-2-2020 by Vincent de Lachaux - // ---------------------------------------------------- - // Description: - // - // ---------------------------------------------------- - // Declarations -C_OBJECT:C1216($0) -C_TEXT:C284($1) -C_OBJECT:C1216($2) - -C_BOOLEAN:C305($success) -C_LONGINT:C283($end;$i;$indx;$start) -C_TEXT:C284($t;$tMethodCalledOnError;$tPattern;$tReplacement;$tTarget;$Txt_Target) -C_OBJECT:C1216($rgx) - -ARRAY LONGINT:C221($tLon_Lengths;0) -ARRAY LONGINT:C221($tLon_Positions;0) -ARRAY TEXT:C222($tTxt_Tempo;0) - -If (False:C215) - C_OBJECT:C1216(rgx ;$0) - C_TEXT:C284(rgx ;$1) - C_OBJECT:C1216(rgx ;$2) -End if - -C_LONGINT:C283(rgxError) - - // ---------------------------------------------------- -If (This:C1470[""]=Null:C1517) // Constructor - - If (Count parameters:C259>=1) - - $t:=String:C10($1) - - End if - - $rgx:=New object:C1471(\ - "";"rgx";\ - "text";$t;\ - "success";True:C214;\ - "result";"";\ - "errors";New collection:C1472;\ - "warnings";New collection:C1472;\ - "reset";Formula:C1597(rgx ("reset"));\ - "setText";Formula:C1597(rgx ("setText";New object:C1471("text";String:C10($1))));\ - "substitute";Formula:C1597(rgx ("substitute";New object:C1471("pattern";String:C10($1);"replacement";String:C10($2);"start";$3)))\ - ) - -Else - - $rgx:=This:C1470 - - Case of - - //______________________________________________________ - : ($rgx=Null:C1517) - - ASSERT:C1129(False:C215;"OOPS, this method must be called from a member method") - - //______________________________________________________ - : ($1="reset") - - $rgx.success:=True:C214 - $rgx.text:="" - $rgx.result:="" - $rgx.errors:=New collection:C1472 - $rgx.warnings:=New collection:C1472 - - CLEAR VARIABLE:C89(rgxError) - - //______________________________________________________ - : ($1="setText") - - $rgx.reset() - $rgx.text:=$2.text - - //______________________________________________________ - : ($1="substitute") - - $tPattern:=$2.pattern - $tReplacement:=$2.replacement - $tTarget:=$rgx.text - - $rgx.result:=$tTarget - - If (Length:C16($tTarget)>0) - - $rgx.success:=False:C215 - - $start:=Choose:C955($2.start#Null:C1517;Num:C11($2.start);1) - - ARRAY LONGINT:C221($tLon_Tempo_Index;0x0000) - ARRAY LONGINT:C221($tLon_Tempo_Lengths;0x0000) - ARRAY LONGINT:C221($tLon_Tempo_Positions;0x0000) - - $tMethodCalledOnError:=Method called on error:C704 - CLEAR VARIABLE:C89(rgxError) - ON ERR CALL:C155("rgx_NO_ERROR") - - Repeat - - $success:=Match regex:C1019($tPattern;$tTarget;$start;$tLon_Positions;$tLon_Lengths) - - If ($success) - - $rgx.success:=True:C214 - $indx:=0 - $end:=Size of array:C274($tLon_Positions) - - For ($i;0;$end;1) - - $t:=Substring:C12($Txt_Target;$tLon_Positions{$i};$tLon_Lengths{$i}) - - If ($tLon_Positions{$i}>0) - - $start:=$tLon_Positions{$i}+$tLon_Lengths{$i} - - End if - - If ($tLon_Lengths{$i}=0) - - $success:=($i>0) - - If ($success) - - $success:=($tLon_Positions{$i}#$tLon_Positions{$i-1}) - - End if - End if - - If ($success) - - APPEND TO ARRAY:C911($tTxt_Tempo;$t) - - APPEND TO ARRAY:C911($tLon_Tempo_Positions;$tLon_Positions{$i}) - APPEND TO ARRAY:C911($tLon_Tempo_Lengths;$tLon_Lengths{$i}) - APPEND TO ARRAY:C911($tLon_Tempo_Index;$indx) - - $indx:=$indx+1 - - Else - - $i:=$end+1 - - End if - End for - - Else - - $rgx.success:=(rgxError=0) - - If (Not:C34($rgx.success)) - - $rgx.errors.push("error: "+String:C10(rgxError)) - - End if - End if - Until (Not:C34($success)) - - ON ERR CALL:C155($tMethodCalledOnError) - - If ($rgx.success) - - $end:=Size of array:C274($tTxt_Tempo) - - If ($end>0) - - $indx:=$end - - Repeat - - If ($tLon_Tempo_Index{$indx}#0) - - $t:="\\"+String:C10($tLon_Tempo_Index{$indx}) - - If (Position:C15($t;$tReplacement)>0) - - $tReplacement:=Replace string:C233($tReplacement;$t;$tTxt_Tempo{$indx}) - - End if - - Else - - $rgx.result:=Delete string:C232($rgx.result;$tLon_Tempo_Positions{$indx};$tLon_Tempo_Lengths{$indx}) - $rgx.result:=Insert string:C231($rgx.result;$tReplacement;$tLon_Tempo_Positions{$indx}) - - $tReplacement:=$2.replacement - - End if - - $indx:=$indx-1 - - Until ($indx=0) - - Else - - $rgx.success:=True:C214 - $rgx.warnings.push("No match for the pattern: \""+$tPattern+"\"") - - End if - - Else - - // A "If" statement should never omit "Else" - - End if - - Else - - $rgx.warnings.push("The string in which substitution will be done is empty") - - End if - - //______________________________________________________ - Else - - ASSERT:C1129(False:C215;"Unknown entry point: \""+$1+"\"") - - //______________________________________________________ - End case -End if - - // ---------------------------------------------------- - // Return -$0:=$rgx - - // ---------------------------------------------------- - // End \ No newline at end of file diff --git a/Project/Sources/Methods/rgx_NO_ERROR.4dm b/Project/Sources/Methods/rgx_NO_ERROR.4dm index 94e8f18..e1205ee 100755 --- a/Project/Sources/Methods/rgx_NO_ERROR.4dm +++ b/Project/Sources/Methods/rgx_NO_ERROR.4dm @@ -1,3 +1,3 @@ //%attributes = {"invisible":true,"preemptive":"capable"} -rgxError:=ERROR +_o_rgxError:=ERROR diff --git a/Project/Sources/Methods/test_rgx.4dm b/Project/Sources/Methods/test_rgx.4dm index a92bbab..9b295a5 100755 --- a/Project/Sources/Methods/test_rgx.4dm +++ b/Project/Sources/Methods/test_rgx.4dm @@ -1,16 +1,16 @@ //%attributes = {"invisible":true,"preemptive":"capable"} -C_TEXT:C284($tExpected;$tPattern;$tReplacement;$tTarget) -C_OBJECT:C1216($rgx) +var $tExpected; $tPattern; $tReplacement; $tTarget : Text +var $rgx : Object $tTarget:="Hello world" -$rgx:=rgx ($tTarget) +$rgx:=_o_rgx($tTarget) ASSERT:C1129($rgx.success) ASSERT:C1129($rgx.text=$tTarget) $tPattern:="world" $tReplacement:="all" $tExpected:="Hello all" -$rgx.substitute($tPattern;$tReplacement) +$rgx.substitute($tPattern; $tReplacement) ASSERT:C1129($rgx.success) ASSERT:C1129($rgx.result=$tExpected) @@ -27,7 +27,7 @@ ASSERT:C1129($rgx.result=$tExpected) $tPattern:="none" $tExpected:="No match for the pattern: \""+$tPattern+"\"" -$rgx.setText($tTarget).substitute($tPattern;$tReplacement) +$rgx.setText($tTarget).substitute($tPattern; $tReplacement) ASSERT:C1129($rgx.success) ASSERT:C1129($rgx.text=$tTarget) ASSERT:C1129($rgx.warnings.length=1) @@ -37,7 +37,7 @@ $tTarget:="" $tPattern:="(?si-m)" $tReplacement:="" $tExpected:=$tReplacement -$rgx.setText($tTarget).substitute($tPattern;$tReplacement) +$rgx.setText($tTarget).substitute($tPattern; $tReplacement) ASSERT:C1129($rgx.success) ASSERT:C1129($rgx.text=$tTarget) ASSERT:C1129($rgx.warnings.length=0) @@ -48,14 +48,14 @@ $tTarget:="HELLO world, hello WORLD" $tPattern:="(?mi-s)hello " $tReplacement:="_" $tExpected:="_world, _WORLD" -$rgx.setText($tTarget).substitute($tPattern;$tReplacement) +$rgx.setText($tTarget).substitute($tPattern; $tReplacement) ASSERT:C1129($rgx.text=$tTarget) ASSERT:C1129($rgx.success) ASSERT:C1129($rgx.result=$tExpected) $tPattern:="(?mi-s)hello [" $tExpected:="Error: -1" -$rgx.substitute($tPattern;$tReplacement) +$rgx.substitute($tPattern; $tReplacement) ASSERT:C1129(Not:C34($rgx.success)) ASSERT:C1129($rgx.errors.length=1) ASSERT:C1129($rgx.errors[0]=$tExpected) diff --git a/Project/Sources/Methods/win_title.4dm b/Project/Sources/Methods/win_title.4dm deleted file mode 100755 index 4af3fcf..0000000 --- a/Project/Sources/Methods/win_title.4dm +++ /dev/null @@ -1,54 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"incapable"} - // ---------------------------------------------------- - // Project method : win_title - // Database: 4DPop Macros - // ID[69FD98BC194541619466271C60F30493] - // Created #17-7-2014 by Vincent de Lachaux - // ---------------------------------------------------- - // Description: - // Return the target (form/method name) of an editor window - // ---------------------------------------------------- - // Declarations -C_TEXT:C284($0) -C_LONGINT:C283($1) - -C_LONGINT:C283($l) -C_TEXT:C284($t) -C_COLLECTION:C1488($c) - -If (False:C215) - C_TEXT:C284(win_title ;$0) - C_LONGINT:C283(win_title ;$1) -End if - - // ---------------------------------------------------- - // Initialisations - - // NO PARAMETERS REQUIRED - - // Optional parameters -If (Count parameters:C259>=1) - - $l:=$1 - -Else - - $l:=Frontmost window:C447 - -End if - - // ---------------------------------------------------- -$c:=Split string:C1554(Get window title:C450($l);":";sk trim spaces:K86:2) -$t:=$c[Num:C11($c.length>1)] - - // #17-7-2014 - // PC bug: The window title is suffixed with a '*' when method is modified and not saved -$t:=Replace string:C233($t;" *";"") -$t:=Replace string:C233($t;"*";"") - - // ---------------------------------------------------- - // Return -$0:=$t - - // ---------------------------------------------------- - // End \ No newline at end of file diff --git a/Project/Sources/Methods/xml_attributes.4dm b/Project/Sources/Methods/xml_attributes.4dm deleted file mode 100755 index 28297db..0000000 --- a/Project/Sources/Methods/xml_attributes.4dm +++ /dev/null @@ -1,65 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Project method : xml_attributes - // Database: 4DPop XLIFF 2 - // ID[CA958A0431C849868A26DB018F13A02F] - // Created #5-3-2018 by Vincent de Lachaux - // ---------------------------------------------------- - // Description: - // Return attibute object for the node $1 - // ---------------------------------------------------- - // Declarations -C_OBJECT:C1216($0) -C_TEXT:C284($1) - -C_LONGINT:C283($Lon_i;$Lon_parameters) -C_TEXT:C284($Dom_node;$Txt_name;$Txt_value) -C_OBJECT:C1216($Obj_attributes) - -If (False:C215) - C_OBJECT:C1216(xml_attributes ;$0) - C_TEXT:C284(xml_attributes ;$1) -End if - - // ---------------------------------------------------- - // Initialisations -$Lon_parameters:=Count parameters:C259 - -If (Asserted:C1132($Lon_parameters>=1;"Missing parameter")) - - // Required parameters - $Dom_node:=$1 - - // Optional parameters - If ($Lon_parameters>=2) - - // - - End if - - $Obj_attributes:=New object:C1471 - -Else - - ABORT:C156 - -End if - - // ---------------------------------------------------- - //If (Asserted(xml_IsValidReference ($Dom_node))) - -For ($Lon_i;1;DOM Count XML attributes:C727($Dom_node);1) - - DOM GET XML ATTRIBUTE BY INDEX:C729($Dom_node;$Lon_i;$Txt_name;$Txt_value) - - $Obj_attributes[$Txt_name]:=$Txt_value - -End for - //End if - - // ---------------------------------------------------- - // Return -$0:=$Obj_attributes - - // ---------------------------------------------------- - // End \ No newline at end of file diff --git a/Project/Sources/Methods/xml_cleanup.4dm b/Project/Sources/Methods/xml_cleanup.4dm deleted file mode 100755 index fab8bdb..0000000 --- a/Project/Sources/Methods/xml_cleanup.4dm +++ /dev/null @@ -1,73 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Project method : xml_cleanup - // Database: 4DPop Macros - // ID[3CD250E652004FC2A198FAE87ABCA0C1] - // Created #20-2-2014 by Vincent de Lachaux - // ---------------------------------------------------- - // Description: - // Clean Up an indented XML file - // Removes the extra lines feeds and the carriage returns - // added by 4D when we perform removing/adding elements - // ---------------------------------------------------- - // Declarations -C_TEXT:C284($0) -C_TEXT:C284($1) -C_LONGINT:C283($2) - -C_LONGINT:C283($Lon_indent;$Lon_parameters) -C_TEXT:C284($Dom_root;$Txt_buffer) - -If (False:C215) - C_TEXT:C284(xml_cleanup ;$0) - C_TEXT:C284(xml_cleanup ;$1) - C_LONGINT:C283(xml_cleanup ;$2) -End if - - // ---------------------------------------------------- - // Initialisations -$Lon_parameters:=Count parameters:C259 - -If (Asserted:C1132($Lon_parameters>=1;"Missing parameter")) - - $Dom_root:=$1 //reference of the xml to format - - $Lon_indent:=XML with indentation:K45:35 - - If ($Lon_parameters>=2) - - $Lon_indent:=$2 //{indentation} XML with indentation (default), XML No indentation - - End if - -Else - - ABORT:C156 - -End if - - // ---------------------------------------------------- -XML SET OPTIONS:C1090($Dom_root;XML indentation:K45:34;$Lon_indent) - -DOM EXPORT TO VAR:C863($Dom_root;$Txt_buffer) -DOM CLOSE XML:C722($Dom_root) - -$Txt_buffer:=Replace string:C233($Txt_buffer;"\r\n";"") -$Txt_buffer:=Replace string:C233($Txt_buffer;"\n";"") -$Txt_buffer:=Replace string:C233($Txt_buffer;"\r";"") -$Txt_buffer:=Replace string:C233($Txt_buffer;"\t";"") - -While (Position:C15(" ";$Txt_buffer)>0) - - $Txt_buffer:=Replace string:C233($Txt_buffer;" ";" ") - -End while - -$Txt_buffer:=Replace string:C233($Txt_buffer;"> <";"><") - -$Dom_root:=DOM Parse XML variable:C720($Txt_buffer) - -$0:=$Dom_root //Warning: A new reference for the clean XML - - // ---------------------------------------------------- - // End \ No newline at end of file diff --git a/Project/Sources/Methods/xml_elementToObject.4dm b/Project/Sources/Methods/xml_elementToObject.4dm deleted file mode 100755 index 79b5136..0000000 --- a/Project/Sources/Methods/xml_elementToObject.4dm +++ /dev/null @@ -1,165 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Project method : xml_elementToObject - // Database: 4D Mobile Express - // ID[EE35EDAF20D24025877FA9FC15284E38] - // Created #1-8-2017 by Vincent de Lachaux - // ---------------------------------------------------- - // Description: - // Returns an XML element as an object - // ---------------------------------------------------- - // Declarations -C_OBJECT:C1216($0) -C_TEXT:C284($1) -C_BOOLEAN:C305($2) - -C_BOOLEAN:C305($Boo_references) -C_LONGINT:C283($Lon_count;$Lon_i;$Lon_parameters) -C_TEXT:C284($Dom_child;$Dom_elementRef;$Txt_key;$Txt_name;$Txt_value) -C_OBJECT:C1216($Obj_result) - -If (False:C215) - C_OBJECT:C1216(xml_elementToObject ;$0) - C_TEXT:C284(xml_elementToObject ;$1) - C_BOOLEAN:C305(xml_elementToObject ;$2) -End if - - // ---------------------------------------------------- - // Initialisations -$Lon_parameters:=Count parameters:C259 - -If (Asserted:C1132($Lon_parameters>=1;"Missing parameter")) - - // Required parameters - $Dom_elementRef:=$1 - - // Optional parameters - If ($Lon_parameters>=2) - - $Boo_references:=$2 - - End if - - $Obj_result:=New object:C1471 - -Else - - ABORT:C156 - -End if - - // ---------------------------------------------------- - // DOM reference -If ($Boo_references) - - $Obj_result["@"]:=$Dom_elementRef - -End if - - // For all attributes { -For ($Lon_i;1;DOM Count XML attributes:C727($Dom_elementRef);1) - - DOM GET XML ATTRIBUTE BY INDEX:C729($Dom_elementRef;$Lon_i;$Txt_key;$Txt_value) - - Case of // Value types - - //______________________________________________________ - : (Length:C16($Txt_key)=0) - // skip malformed node - - //______________________________________________________ - : (Match regex:C1019("(?m-si)^\\d+\\.*\\d*$";$Txt_value;1)) // Numeric - - $Obj_result[$Txt_key]:=Num:C11($Txt_value;".") - - //______________________________________________________ - : (Match regex:C1019("(?mi-s)^true|false$";$Txt_value;1)) // Boolean - - $Obj_result[$Txt_key]:=($Txt_value="true") - - //______________________________________________________ - Else // Text - - $Obj_result[$Txt_key]:=$Txt_value - - //______________________________________________________ - End case -End for - //} - - // Value if any { -DOM GET XML ELEMENT VALUE:C731($Dom_elementRef;$Txt_value) - -If (Match regex:C1019("[^\\s]+";$Txt_value;1)) - - $Obj_result["$"]:=$Txt_value - -End if - //} - - // Childs if any { -$Dom_child:=DOM Get first child XML element:C723($Dom_elementRef;$Txt_name) - -If (OK=1) - - // Many one? [ - $Lon_count:=DOM Count XML elements:C726($Dom_elementRef;$Txt_name) - - If ($Lon_count>1) // Yes - - $Obj_result[$Txt_name]:=New collection:C1472 - - For ($Lon_i;1;$Lon_count;1) - - $Obj_result[$Txt_name].push(xml_elementToObject (DOM Get XML element:C725($Dom_elementRef;$Txt_name;$Lon_i);$Boo_references)) - - End for - - Else // No - - $Obj_result[$Txt_name]:=xml_elementToObject ($Dom_child;$Boo_references) - - End if - //] - - // Next one, if any - $Dom_child:=DOM Get next sibling XML element:C724($Dom_child;$Txt_name) - - While (OK=1) - - // Already treated? - If ($Obj_result[$Txt_name]=Null:C1517) - - // Many one? [ - $Lon_count:=DOM Count XML elements:C726($Dom_elementRef;$Txt_name) - - If ($Lon_count>1) // Yes - - $Obj_result[$Txt_name]:=New collection:C1472 - - For ($Lon_i;1;$Lon_count;1) - - $Obj_result[$Txt_name].push(xml_elementToObject (DOM Get XML element:C725($Dom_elementRef;$Txt_name;$Lon_i);$Boo_references)) - - End for - - Else // No - - $Obj_result[$Txt_name]:=xml_elementToObject ($Dom_child;$Boo_references) - - End if - End if - - // Next one, if any - $Dom_child:=DOM Get next sibling XML element:C724($Dom_child;$Txt_name) - - End while -End if - //} - - // ---------------------------------------------------- - // Return -$0:=$Obj_result - - // ---------------------------------------------------- - // End \ No newline at end of file diff --git a/Project/Sources/Methods/xml_encode.4dm b/Project/Sources/Methods/xml_encode.4dm deleted file mode 100755 index c9b4037..0000000 --- a/Project/Sources/Methods/xml_encode.4dm +++ /dev/null @@ -1,66 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Project method : xml_encode - // Database: 4D Mobile Express - // Created #21-11-2017 by Eric Marchand - // ---------------------------------------------------- - // Description: - - // ---------------------------------------------------- - // Declarations -C_TEXT:C284($0) -C_TEXT:C284($1) - -C_LONGINT:C283($Lon_parameters) -C_TEXT:C284($Dom_ref;$Txt_in;$Txt_out) - -If (False:C215) - C_TEXT:C284(xml_encode ;$0) - C_TEXT:C284(xml_encode ;$1) -End if - - - // ---------------------------------------------------- - // Initialisations -$Lon_parameters:=Count parameters:C259 - -If (Asserted:C1132($Lon_parameters>=1;"Missing parameter")) - - // Required parameters - $Txt_in:=$1 - - // Optional parameters - If ($Lon_parameters>=2) - - // - - End if - -Else - - ABORT:C156 - -End if - - // ---------------------------------------------------- - -If (Length:C16($Txt_in)=0) - - $Txt_out:=$Txt_in - -Else - // XXX maybe find a 4D method or better ways to xml encode - - // Use DOM api to encode XML - $Dom_ref:=DOM Create XML Ref:C861("RootElement") - DOM SET XML ATTRIBUTE:C866($Dom_ref;"test";$Txt_in) - DOM EXPORT TO VAR:C863($Dom_ref;$Txt_out) - DOM CLOSE XML:C722($Dom_ref) - - // Extract from result - $Txt_out:=Substring:C12($Txt_out;Position:C15("test=\"";$Txt_out)+6) - $Txt_out:=Substring:C12($Txt_out;1;Length:C16($Txt_out)-4) - -End if - -$0:=$Txt_out \ No newline at end of file diff --git a/Project/Sources/Methods/xml_fileToObject.4dm b/Project/Sources/Methods/xml_fileToObject.4dm deleted file mode 100755 index dfaa366..0000000 --- a/Project/Sources/Methods/xml_fileToObject.4dm +++ /dev/null @@ -1,82 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Project method : xml_fileToObject - // Database: 4D Mobile Express - // ID[0C9EE89768224AA19AEA2AFC14789A8E] - // Created #2-8-2017 by Vincent de Lachaux - // ---------------------------------------------------- - // Description: - // Returns an XML document as an object - // ---------------------------------------------------- - // Declarations -C_OBJECT:C1216($0) -C_TEXT:C284($1) -C_BOOLEAN:C305($2) - -C_BOOLEAN:C305($Boo_references) -C_LONGINT:C283($Lon_parameters) -C_TEXT:C284($Dom_root;$File_pathname) -C_OBJECT:C1216($Obj_result) - -If (False:C215) - C_OBJECT:C1216(xml_fileToObject ;$0) - C_TEXT:C284(xml_fileToObject ;$1) - C_BOOLEAN:C305(xml_fileToObject ;$2) -End if - - // ---------------------------------------------------- - // Initialisations -$Lon_parameters:=Count parameters:C259 - -If (Asserted:C1132($Lon_parameters>=1;"Missing parameter")) - - // Required parameters - $File_pathname:=$1 - - // Optional parameters - If ($Lon_parameters>=2) - - $Boo_references:=$2 - - End if - - $Obj_result:=New object:C1471(\ - "success";False:C215) - -Else - - ABORT:C156 - -End if - - // ---------------------------------------------------- -If (Test path name:C476($File_pathname)=Is a document:K24:1) - - $Dom_root:=DOM Parse XML source:C719($File_pathname) - - If (OK=1) - - $Obj_result:=New object:C1471(\ - "success";True:C214;\ - "value";xml_refToObject ($Dom_root;$Boo_references)) - - DOM CLOSE XML:C722($Dom_root) - - Else - - $Obj_result.errors:=New collection:C1472("Failed to parse") - - End if - -Else - - $Obj_result.errors:=New collection:C1472("File "+$File_pathname+" is not a document") - -End if - - // ---------------------------------------------------- - // Return -$0:=$Obj_result - - // ---------------------------------------------------- - // End \ No newline at end of file diff --git a/Project/Sources/Methods/xml_findByName.4dm b/Project/Sources/Methods/xml_findByName.4dm deleted file mode 100755 index c2b552a..0000000 --- a/Project/Sources/Methods/xml_findByName.4dm +++ /dev/null @@ -1,67 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Project method : xml_findByName - // Database: 4D Mobile App - // ID[0C9EE897E822EAA19AEA2AFC14789A8E] - // ---------------------------------------------------- - // Description: - // Returns all dom elements with specific name - // ---------------------------------------------------- - // Declarations -C_COLLECTION:C1488($0) -C_TEXT:C284($1) -C_TEXT:C284($2) - -C_LONGINT:C283($Lon_parameters) -C_TEXT:C284($Dom_child;$Dom_elementRef;$Txt_name;$Txt_nameToFind) -C_COLLECTION:C1488($Col_result) - -If (False:C215) - C_COLLECTION:C1488(xml_findByName ;$0) - C_TEXT:C284(xml_findByName ;$1) - C_TEXT:C284(xml_findByName ;$2) -End if - - // ---------------------------------------------------- - // Initialisations -$Lon_parameters:=Count parameters:C259 - -If (Asserted:C1132($Lon_parameters>=2;"Missing parameter")) - - $Dom_elementRef:=$1 - $Txt_nameToFind:=$2 - - $Col_result:=New collection:C1472 - -Else - - ABORT:C156 - -End if - - // ---------------------------------------------------- - - // Childs if any { -$Dom_child:=DOM Get first child XML element:C723($Dom_elementRef;$Txt_name) - -While (OK=1) - - If ($Txt_name=$Txt_nameToFind) - - $Col_result.push($Dom_child) - - End if - - $Col_result:=$Col_result.combine(xml_findByName ($Dom_child;$Txt_nameToFind)) // <======= RECURSIVE - - // Next one, if any - $Dom_child:=DOM Get next sibling XML element:C724($Dom_child;$Txt_name) - -End while - - // ---------------------------------------------------- - // Return -$0:=$Col_result - - // ---------------------------------------------------- - // End \ No newline at end of file diff --git a/Project/Sources/Methods/xml_findElement.4dm b/Project/Sources/Methods/xml_findElement.4dm deleted file mode 100755 index aca32eb..0000000 --- a/Project/Sources/Methods/xml_findElement.4dm +++ /dev/null @@ -1,69 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Project method : xml_findElement - // Database: 4D Mobile Express - // ID[42201DC36CAD45BDB841D1B8A31AC0D0] - // Created #1-8-2017 by Eric Marchand - // ---------------------------------------------------- - // Description: - // Wrapper for DOM Find XML element to catch errors. - // ---------------------------------------------------- - // Declarations -C_OBJECT:C1216($0) -C_TEXT:C284($1) -C_TEXT:C284($2) - -C_LONGINT:C283($Lon_parameters) -C_TEXT:C284($Dom_reference;$Txt_methodOnError;$Txt_xpath) -C_OBJECT:C1216($Obj_result) - -If (False:C215) - C_OBJECT:C1216(xml_findElement ;$0) - C_TEXT:C284(xml_findElement ;$1) - C_TEXT:C284(xml_findElement ;$2) -End if - - // ---------------------------------------------------- - // Initialisations -$Lon_parameters:=Count parameters:C259 - -If (Asserted:C1132($Lon_parameters>=2;"Missing parameter")) - - // Required parameters - $Dom_reference:=$1 - $Txt_xpath:=$2 - - $Obj_result:=New object:C1471(\ - "success";False:C215) - -Else - - ABORT:C156 - -End if - - // ---------------------------------------------------- -$Txt_methodOnError:=Method called on error:C704 - - // TRY ( -ON ERR CALL:C155("xml_NO_ERROR") -xml_ERROR:=0 - //) { - -$Obj_result.reference:=DOM Find XML element:C864($Dom_reference;$Txt_xpath) -$Obj_result.success:=((OK=1) & (xml_ERROR#0) & \ -($Obj_result.reference#"00000000000000000000000000000000") & ($Obj_result.reference#"")) - - // } CATCH { -If (xml_ERROR#0) - $Obj_result.error:=xml_ERROR -End if -ON ERR CALL:C155($Txt_methodOnError) - // } - - // ---------------------------------------------------- - // Return -$0:=$Obj_result - - // ---------------------------------------------------- - // End diff --git a/Project/Sources/Methods/xml_refToObject.4dm b/Project/Sources/Methods/xml_refToObject.4dm deleted file mode 100755 index 64592b1..0000000 --- a/Project/Sources/Methods/xml_refToObject.4dm +++ /dev/null @@ -1,60 +0,0 @@ -//%attributes = {"invisible":true,"preemptive":"capable"} - // ---------------------------------------------------- - // Project method : xml_refToObject - // Database: 4D Mobile Express - // ID[422011C36CAB45BDB84131B8A31AC0D0] - // Created #1-8-2017 by Vincent de Lachaux - // ---------------------------------------------------- - // Description: - // Returns an XML tree reference as an object - // ---------------------------------------------------- - // Declarations -C_OBJECT:C1216($0) -C_TEXT:C284($1) -C_BOOLEAN:C305($2) - -C_BOOLEAN:C305($Boo_references) -C_LONGINT:C283($Lon_parameters) -C_TEXT:C284($Dom_rootReference;$Txt_name) -C_OBJECT:C1216($Obj_result) - -If (False:C215) - C_OBJECT:C1216(xml_refToObject ;$0) - C_TEXT:C284(xml_refToObject ;$1) - C_BOOLEAN:C305(xml_refToObject ;$2) -End if - - // ---------------------------------------------------- - // Initialisations -$Lon_parameters:=Count parameters:C259 - -If (Asserted:C1132($Lon_parameters>=1;"Missing parameter")) - - // Required parameters - $Dom_rootReference:=$1 - - // Optional parameters - If ($Lon_parameters>=2) - - $Boo_references:=$2 - - End if - - $Obj_result:=New object:C1471 - -Else - - ABORT:C156 - -End if - - // ---------------------------------------------------- -DOM GET XML ELEMENT NAME:C730($Dom_rootReference;$Txt_name) -$Obj_result[$Txt_name]:=xml_elementToObject ($Dom_rootReference;$Boo_references) - - // ---------------------------------------------------- - // Return -$0:=$Obj_result - - // ---------------------------------------------------- - // End \ No newline at end of file diff --git a/Project/Sources/dependencies.json b/Project/Sources/dependencies.json index 3aa6d85..5df1788 100644 --- a/Project/Sources/dependencies.json +++ b/Project/Sources/dependencies.json @@ -59,6 +59,10 @@ "4DPop Window": { "github": "vdelachaux/4DPop-Window", "version": "latest" + }, + "4d macros": { + "github": "4d/4d-macros", + "version": "latest" } } } \ No newline at end of file diff --git a/Project/Sources/folders.json b/Project/Sources/folders.json index 47046b8..88901a5 100755 --- a/Project/Sources/folders.json +++ b/Project/Sources/folders.json @@ -3,9 +3,6 @@ "methods": [ "_o_array_Attributes", "_o_array_declaration", - "_o_Beautifier", - "_o_beautifier_Next_semicolon", - "_o_beautifier_Split_key_value", "_o_CENTERED", "_o_DECLARATION", "_o_EXTRACT_LOCAL_VARIABLES", @@ -13,10 +10,50 @@ "_o_isNumeric", "_o_localizedControlFlow", "_o_Preferences", - "_o_Preferences_Set" + "_o_Preferences_Set", + "_o_rgx", + "_o_Rgx_ExtractText", + "_o_Rgx_MatchText", + "_o_rgx_Options", + "_o_Rgx_SplitText", + "_o_Rgx_SubstituteText", + "_o_util_Lon_Local_in_line", + "_o_Util_SPLIT_METHOD", + "_o_win_title", + "_o_xml_attributes", + "_o_xml_cleanup", + "_o_xml_elementToObject", + "_o_xml_encode", + "_o_xml_fileToObject", + "_o_xml_findByName", + "_o_xml_findElement", + "_o_xml_refToObject", + "4DPop_MACROS_INIT", + "4DPop_MACROS_SETTINGS", + "COMPILER_class", + "Compiler_Rgx", + "COMPILER_xml", + "rgx_NO_ERROR", + "test_rgx", + "xml_NO_ERROR" ] }, + "(BINARY)": {}, + "(classes)": {}, + "(lib)": { + "groups": [ + "(xml (thread-safe))" + ] + }, + "(pseudo-classes)": {}, + "(rgx)": {}, + "(shared)": {}, + "(Tools)": {}, + "(xml (thread-safe))": {}, "# 🚧 DEV": { + "groups": [ + "TESTS" + ], "methods": [ "0_DOCUMENTATION", "00_convertComments", @@ -30,7 +67,19 @@ "#️⃣ API": {}, "♻️ LIBRAIRIES": { "classes": [ - "regex" + "button", + "coord", + "dim", + "evt", + "group", + "input", + "listbox", + "menu", + "menuBar", + "regex", + "scrollable", + "static", + "widget" ] }, "⚙️ MACROS": { @@ -50,48 +99,16 @@ }, "📦 COMPONENT": { "groups": [ - "private", - "shared" + "Binary database", + "FORMS", + "private" ] }, - "🛠️ Tools": {}, - "00_dev": { + "🛠️ Tools": { "methods": [ - "__test", - "_TEST", - "_test_choose", - "00_test_Dot_Notation", - "beautifier_test_1", - "beautifier_test_10", - "beautifier_test_11", - "beautifier_test_12", - "beautifier_test_13", - "beautifier_test_14", - "beautifier_test_15", - "beautifier_test_16", - "beautifier_test_17", - "beautifier_test_2", - "beautifier_test_3", - "beautifier_test_4", - "beautifier_test_5", - "beautifier_test_6", - "beautifier_test_7", - "beautifier_test_8", - "beautifier_test_9", - "beutifier_OB", - "createFR2USMacro", - "DECLARATION_Formula", - "DECLARATION_Test", - "DECLARE", - "literals", - "test_replace_o", - "TrueMethod" - ], - "forms": [ - "TEST" - ], - "classes": [ - "test_" + "str_gLon_Hex_To_Long", + "str_hyphenation", + "win_NOT_UNDER_TOOLBAR" ] }, "4️⃣ 4DPop": { @@ -106,31 +123,24 @@ "OPTIONS_SET" ], "forms": [ - "DECLARATIONS" - ] - }, - "classes": { - "classes": [ - "button", - "group", - "input", - "listbox", - "menu", - "scrollable", - "static", - "widget" + "BINARY_DECLARATIONS" ] }, - "lib": { - "groups": [ - "classes", - "pseudo-classes", - "rgx", - "xml (thread-safe)" + "FORMS": { + "forms": [ + "ABOUT", + "COMMENTS", + "CREATE_BUTTON", + "DECLARATION", + "DECLARATIONS_SETTINGS", + "LIST", + "SETTINGS", + "SPECIAL_PASTE" ] }, "private": { "methods": [ + "_SETTINGS", "ABOUT", "Beautifier_init", "CODE_TO_EXECUTE", @@ -154,71 +164,55 @@ "METHODS", "Preferences_Get", "Private_Boo_Paste_Regex_Pattern", - "Private_Lon_Declaration_Type", - "SETTINGS", - "util_Lon_Local_in_line", - "Util_SPLIT_METHOD" - ], - "forms": [ - "ABOUT", - "COMMENTS", - "CREATE_BUTTON", - "DECLARATIONS_SETTINGS", - "LIST", - "NEW_DECLARATION", - "SETTINGS", - "SPECIAL_PASTE" - ] - }, - "pseudo-classes": { - "methods": [ - "_o_menu", - "COMPILER_class", - "rgx", - "test_rgx" + "Private_Lon_Declaration_Type" ] }, - "rgx": { + "TESTS": { "methods": [ - "Compiler_Rgx", - "Rgx_ExtractText", - "Rgx_Get_Pattern", - "Rgx_match", - "Rgx_MatchText", - "rgx_NO_ERROR", - "rgx_Options", - "Rgx_SplitText", - "Rgx_SubstituteText" - ] - }, - "shared": { - "methods": [ - "4DPop_MACROS_INIT", - "4DPop_MACROS_SETTINGS" - ] - }, - "Tools": { - "methods": [ - "NoError", - "str_gLon_Hex_To_Long", - "str_hyphenation", - "win_NOT_UNDER_TOOLBAR", - "win_title", - "xml_cleanup" - ] - }, - "xml (thread-safe)": { - "methods": [ - "COMPILER_xml", - "xml_attributes", - "xml_elementToObject", - "xml_encode", - "xml_fileToObject", - "xml_findByName", - "xml_findElement", - "xml_NO_ERROR", - "xml_refToObject" + "__test", + "_TEST", + "_test_choose", + "00_test_Dot_Notation", + "BEAUTIFIER_TEST", + "beautifier_test_11", + "beautifier_test_12", + "beautifier_test_13", + "beautifier_test_14", + "beautifier_test_15", + "beautifier_test_16", + "beautifier_test_17", + "beautifier_test_2", + "beautifier_test_3", + "beautifier_test_4", + "beautifier_test_5", + "beautifier_test_6", + "beautifier_test_7", + "beautifier_test_8", + "beautifier_test_9", + "beutifier_OB", + "createFR2USMacro", + "DECLARATION_Formula", + "DECLARE", + "literals", + "test_replace_o", + "TrueMethod" + ], + "forms": [ + "TEST" + ], + "classes": [ + "test_" ] }, - "trash": {} + "trash": { + "groups": [ + "(BINARY)", + "(classes)", + "(lib)", + "(pseudo-classes)", + "(rgx)", + "(shared)", + "(Tools)" + ] + } } \ No newline at end of file diff --git a/Project/Sources/settings.4DSettings b/Project/Sources/settings.4DSettings index b20d8e3..d055975 100755 --- a/Project/Sources/settings.4DSettings +++ b/Project/Sources/settings.4DSettings @@ -1,4 +1,4 @@ - + @@ -47,7 +47,7 @@ - + diff --git a/Resources/InfoPlist.strings b/Resources/InfoPlist.strings index 2dc5f67..8fd1d73 100755 Binary files a/Resources/InfoPlist.strings and b/Resources/InfoPlist.strings differ