From 2962c8323be2d8a6e7de881c41562895d4d2e14b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Tue, 14 Aug 2012 17:56:24 +0000 Subject: [PATCH] [DEVELOPMENT ENVIRONMENT] * NEW: Initial implementation of automatic local variable declaration. git-svn-id: svn://localhost/gambas/trunk@5042 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- app/src/gambas3/.lang/.pot | 394 +++++++++--------- .../gambas3/.src/Component/CSymbolInfo.class | 7 +- app/src/gambas3/.src/Debug/FDebugInfo.class | 6 + .../.src/Editor/Code/CExpressionSymbol.class | 92 ++++ .../gambas3/.src/Editor/Code/FEditor.class | 198 +++++++-- app/src/gambas3/.src/Options/FOption.class | 8 + app/src/gambas3/.src/Options/FOption.form | 187 +++++---- app/src/gambas3/.src/Project.module | 2 + 8 files changed, 575 insertions(+), 319 deletions(-) create mode 100644 app/src/gambas3/.src/Editor/Code/CExpressionSymbol.class diff --git a/app/src/gambas3/.lang/.pot b/app/src/gambas3/.lang/.pot index beb5f4a7c..9028b50db 100644 --- a/app/src/gambas3/.lang/.pot +++ b/app/src/gambas3/.lang/.pot @@ -387,19 +387,19 @@ msgid "Event loop" msgstr "" #: CProjectTree.class:290 FMain.form:1001 FSearch.class:98 FSelectIcon.form:31 -#: Project.module:1627 +#: Project.module:1629 msgid "Project" msgstr "" -#: CProjectTree.class:293 Project.module:1630 +#: CProjectTree.class:293 Project.module:1632 msgid "Sources" msgstr "" -#: CProjectTree.class:296 Project.module:1633 +#: CProjectTree.class:296 Project.module:1635 msgid "Connections" msgstr "" -#: CProjectTree.class:305 Project.module:1642 +#: CProjectTree.class:305 Project.module:1644 msgid "Data" msgstr "" @@ -425,18 +425,18 @@ msgstr "" #: CWaitingAnimation.class:56 FColorChooser.form:60 FCommit.form:229 #: FConflict.class:191 FConnectionEditor.class:294 FCreateFile.form:437 -#: FDebugInfo.form:229 FEditor.class:2410 FExportData.class:126 +#: FDebugInfo.form:229 FEditor.class:2380 FExportData.class:126 #: FFieldChooser.form:138 FFontChooser.form:40 FForm.class:3131 #: FGotoLine.form:23 FHelpBrowser.form:61 FIconEditor.class:1415 #: FList.form:121 FMain.class:198 FMakeInstall.class:356 FMenu.form:377 #: FNewConnection.form:255 FNewTable.form:86 FNewTranslation.form:21 -#: FOpenProject.form:177 FOption.class:652 FPasteSpecial.form:77 +#: FOpenProject.form:177 FOption.class:660 FPasteSpecial.form:77 #: FPasteTable.form:107 FPropertyComponent.form:221 FPropertyProject.form:723 #: FProxy.form:57 FReportBorderChooser.form:48 FReportBrushChooser.form:34 #: FReportCoordChooser.form:26 FReportPaddingChooser.form:75 FSave.form:28 #: FSaveProjectAs.form:76 FSearch.class:838 FSelectExtraFile.form:43 #: FSelectIcon.form:86 FSnippet.form:57 FTableChooser.form:68 FText.form:41 -#: FTextEditor.class:510 FTranslate.class:636 Project.module:427 +#: FTextEditor.class:510 FTranslate.class:636 Project.module:429 msgid "Cancel" msgstr "" @@ -446,19 +446,19 @@ msgid "" "the GNU General Public License." msgstr "" -#: Design.module:151 Project.module:2054 +#: Design.module:151 Project.module:2056 msgid "first" msgstr "" -#: Design.module:153 Project.module:2056 +#: Design.module:153 Project.module:2058 msgid "second" msgstr "" -#: Design.module:155 Project.module:2058 +#: Design.module:155 Project.module:2060 msgid "third" msgstr "" -#: Design.module:243 Project.module:2117 +#: Design.module:243 Project.module:2119 msgid "in &1:&2." msgstr "" @@ -585,7 +585,7 @@ msgstr "" #: FCommit.form:109 FConflict.form:71 FConnectionEditor.form:386 #: FEditor.form:127 FForm.form:213 FIconEditor.form:87 FImageEditor.form:99 -#: FOption.form:458 FOutput.form:41 FTextEditor.form:89 +#: FOption.form:463 FOutput.form:41 FTextEditor.form:89 msgid "Undo" msgstr "" @@ -815,7 +815,7 @@ msgid "Run query" msgstr "" #: FConnectionEditor.form:445 FForm.form:257 FMain.class:198 -#: FNewConnection.class:325 FOption.class:799 FTranslate.class:636 +#: FNewConnection.class:325 FOption.class:807 FTranslate.class:636 msgid "Delete" msgstr "" @@ -829,7 +829,7 @@ msgstr "" #: FConnectionEditor.class:34 FCreateFile.form:289 FDebugInfo.class:37 #: FMakeInstall.form:162 FNewConnection.form:60 FNewTable.form:33 -#: FOption.form:944 +#: FOption.form:977 msgid "Name" msgstr "" @@ -1222,7 +1222,7 @@ msgstr "" msgid "Debug" msgstr "" -#: FDebugInfo.form:58 FMain.form:1029 FOption.form:263 FSearch.class:94 +#: FDebugInfo.form:58 FMain.form:1029 FOption.form:268 FSearch.class:94 msgid "Console" msgstr "" @@ -1242,7 +1242,7 @@ msgstr "" msgid "Add expression" msgstr "" -#: FDebugInfo.form:118 FMakeInstall.form:589 FOption.form:907 +#: FDebugInfo.form:118 FMakeInstall.form:589 FOption.form:940 #: FPropertyComponent.form:184 msgid "&Add" msgstr "" @@ -1251,7 +1251,7 @@ msgstr "" msgid "Remove current expression" msgstr "" -#: FDebugInfo.form:126 FMain.form:785 FMakeInstall.form:595 FOption.form:747 +#: FDebugInfo.form:126 FMain.form:785 FMakeInstall.form:595 FOption.form:877 #: FPropertyComponent.form:190 FPropertyProject.form:464 msgid "&Remove" msgstr "" @@ -1317,7 +1317,7 @@ msgid "Function" msgstr "" #: FDebugInfo.class:61 FIconEditor.form:200 FImportTable.class:68 -#: FOption.form:521 +#: FOption.form:526 msgid "Line" msgstr "" @@ -1338,7 +1338,7 @@ msgid "Do you want to clear the expression list ?" msgstr "" #: FDebugInfo.class:548 FIconEditor.class:1415 FList.class:155 -#: FOption.class:652 FOutput.form:79 +#: FOption.class:660 FOutput.form:79 msgid "Clear" msgstr "" @@ -1458,7 +1458,7 @@ msgstr "" msgid "Paste as comments" msgstr "" -#: FEditor.form:346 FOption.form:245 +#: FEditor.form:346 FOption.form:250 msgid "Editor" msgstr "" @@ -1482,14 +1482,14 @@ msgstr "" msgid "Procedure list" msgstr "" -#: FEditor.class:2410 FIconEditor.class:2048 FTextEditor.class:510 +#: FEditor.class:2380 FIconEditor.class:2048 FTextEditor.class:510 msgid "" "The file has been modified.\n" "\n" "All your changes will be lost." msgstr "" -#: FEditor.class:2836 FTextEditor.class:854 +#: FEditor.class:2806 FTextEditor.class:854 msgid "(Declarations)" msgstr "" @@ -2461,7 +2461,7 @@ msgstr "" msgid "Refresh project" msgstr "" -#: FMain.form:946 FOption.form:187 +#: FMain.form:946 FOption.form:192 msgid "Preferences" msgstr "" @@ -2677,7 +2677,7 @@ msgstr "" msgid "Package name" msgstr "" -#: FMakeInstall.form:143 FOption.form:1027 +#: FMakeInstall.form:143 FOption.form:1060 msgid "Prefix package name with the vendor name" msgstr "" @@ -2685,19 +2685,19 @@ msgstr "" msgid "Maintainer information" msgstr "" -#: FMakeInstall.form:178 FOption.form:976 +#: FMakeInstall.form:178 FOption.form:1009 msgid "E-mail" msgstr "" -#: FMakeInstall.form:194 FOption.form:960 +#: FMakeInstall.form:194 FOption.form:993 msgid "Vendor name" msgstr "" -#: FMakeInstall.form:210 FOption.form:1011 +#: FMakeInstall.form:210 FOption.form:1044 msgid "URL" msgstr "" -#: FMakeInstall.form:247 FOption.form:992 +#: FMakeInstall.form:247 FOption.form:1025 msgid "License" msgstr "" @@ -2844,7 +2844,7 @@ msgid "There is no CHANGELOG entry for this release." msgstr "" #: FMakeInstall.class:356 FPropertyProject.class:859 FSave.form:21 -#: Project.module:3181 +#: Project.module:3183 msgid "Continue" msgstr "" @@ -2948,7 +2948,7 @@ msgstr "" msgid "This menu is too deep !" msgstr "" -#: FMenu.class:947 Project.module:5143 +#: FMenu.class:947 Project.module:5145 msgid "modified" msgstr "" @@ -3076,267 +3076,279 @@ msgstr "" msgid "Quick" msgstr "" -#: FOption.form:199 +#: FOption.form:204 msgid "Foreground color..." msgstr "" -#: FOption.form:203 +#: FOption.form:208 msgid "Background color..." msgstr "" -#: FOption.form:210 +#: FOption.form:215 msgid "Bold" msgstr "" -#: FOption.form:214 +#: FOption.form:219 msgid "Italic" msgstr "" -#: FOption.form:218 +#: FOption.form:223 msgid "Underline" msgstr "" -#: FOption.form:228 +#: FOption.form:233 msgid "Interface" msgstr "" -#: FOption.form:234 +#: FOption.form:239 msgid "Fonts" msgstr "" -#: FOption.form:281 +#: FOption.form:286 msgid "Default font size" msgstr "" -#: FOption.form:287 FPropertyProject.form:192 +#: FOption.form:292 FPropertyProject.form:192 msgid "Normal" msgstr "" -#: FOption.form:287 +#: FOption.form:292 msgid "Small" msgstr "" -#: FOption.form:287 +#: FOption.form:292 msgid "Tiny" msgstr "" -#: FOption.form:299 +#: FOption.form:304 msgid "Small font size" msgstr "" -#: FOption.form:312 +#: FOption.form:317 msgid "Icons" msgstr "" -#: FOption.form:323 +#: FOption.form:328 msgid "Icon theme" msgstr "" -#: FOption.form:335 Project.module:196 +#: FOption.form:340 Project.module:196 msgid "Miscellaneous" msgstr "" -#: FOption.form:346 +#: FOption.form:351 msgid "Sort properties" msgstr "" -#: FOption.form:352 FPropertyComponent.form:90 FPropertyProject.form:322 +#: FOption.form:357 FPropertyComponent.form:90 FPropertyProject.form:322 msgid "No" msgstr "" -#: FOption.form:352 FPropertyComponent.form:90 FPropertyProject.form:322 +#: FOption.form:357 FPropertyComponent.form:90 FPropertyProject.form:322 msgid "Yes" msgstr "" -#: FOption.form:368 +#: FOption.form:373 msgid "Minimize at runtime" msgstr "" -#: FOption.form:390 +#: FOption.form:395 msgid "Use utility windows" msgstr "" -#: FOption.form:412 +#: FOption.form:417 msgid "Toolbox size" msgstr "" -#: FOption.form:422 +#: FOption.form:427 msgid "Theme" msgstr "" -#: FOption.form:446 +#: FOption.form:451 msgid "Import theme" msgstr "" -#: FOption.form:452 +#: FOption.form:457 msgid "Export theme" msgstr "" -#: FOption.form:491 +#: FOption.form:496 msgid "Default tab size" msgstr "" -#: FOption.form:503 FPropertyProject.form:297 +#: FOption.form:508 FPropertyProject.form:297 msgid "space(s)" msgstr "" -#: FOption.form:515 +#: FOption.form:520 msgid "Procedure separation" msgstr "" -#: FOption.form:521 FProperty.class:753 +#: FOption.form:526 FProperty.class:753 msgid "None" msgstr "" -#: FOption.form:521 +#: FOption.form:526 msgid "Blend" msgstr "" -#: FOption.form:521 MTheme.module:6 +#: FOption.form:526 MTheme.module:6 msgid "Background" msgstr "" -#: FOption.form:533 +#: FOption.form:538 msgid "Highlight current line" msgstr "" -#: FOption.form:555 +#: FOption.form:560 msgid "Highlight modified lines" msgstr "" -#: FOption.form:577 +#: FOption.form:582 msgid "Show line numbers" msgstr "" -#: FOption.form:599 +#: FOption.form:604 msgid "Show spaces at end of line with dots" msgstr "" -#: FOption.form:621 +#: FOption.form:626 msgid "Procedure folding" msgstr "" -#: FOption.form:643 +#: FOption.form:648 msgid "Fold procedures by default" msgstr "" -#: FOption.form:665 +#: FOption.form:670 msgid "Keywords in upper case" msgstr "" -#: FOption.form:687 -msgid "Control structure automatic completion" -msgstr "" - -#: FOption.form:701 -msgid "Code snippets" -msgstr "" - -#: FOption.form:712 -msgid "Activate code snippets" -msgstr "" - -#: FOption.form:733 FTranslate.form:299 -msgid "&New..." -msgstr "" - -#: FOption.form:740 -msgid "&Edit..." -msgstr "" - -#: FOption.form:755 -msgid "Re&set" -msgstr "" - -#: FOption.form:763 -msgid "E&xport..." -msgstr "" - -#: FOption.form:771 -msgid "&Import..." -msgstr "" - -#: FOption.form:777 +#: FOption.form:684 msgid "Code formatting" msgstr "" -#: FOption.form:794 +#: FOption.form:690 +msgid "Automatic formatting" +msgstr "" + +#: FOption.form:701 +msgid "Control structure automatic completion" +msgstr "" + +#: FOption.form:723 +msgid "Local variable automatic declaration" +msgstr "" + +#: FOption.form:740 +msgid "Explicit formating" +msgstr "" + +#: FOption.form:751 msgid "Format on load & save" msgstr "" -#: FOption.form:816 +#: FOption.form:773 msgid "Indent local variable declaration" msgstr "" -#: FOption.form:838 +#: FOption.form:795 msgid "Remove useless spaces at end of line" msgstr "" -#: FOption.form:860 +#: FOption.form:817 msgid "Keep successive void lines" msgstr "" -#: FOption.form:874 +#: FOption.form:831 +msgid "Code snippets" +msgstr "" + +#: FOption.form:842 +msgid "Activate code snippets" +msgstr "" + +#: FOption.form:863 FTranslate.form:299 +msgid "&New..." +msgstr "" + +#: FOption.form:870 +msgid "&Edit..." +msgstr "" + +#: FOption.form:885 +msgid "Re&set" +msgstr "" + +#: FOption.form:893 +msgid "E&xport..." +msgstr "" + +#: FOption.form:901 +msgid "&Import..." +msgstr "" + +#: FOption.form:907 msgid "Source archives" msgstr "" -#: FOption.form:887 +#: FOption.form:920 msgid "These files will be ignored when making source archives." msgstr "" -#: FOption.form:927 +#: FOption.form:960 msgid "Packaging" msgstr "" -#: FOption.form:933 +#: FOption.form:966 msgid "Default maintainer information" msgstr "" -#: FOption.form:1037 +#: FOption.form:1070 msgid "Applications" msgstr "" -#: FOption.form:1054 +#: FOption.form:1087 msgid "Browser" msgstr "" -#: FOption.form:1071 +#: FOption.form:1104 msgid "Terminal" msgstr "" -#: FOption.form:1088 +#: FOption.form:1121 msgid "Image editor" msgstr "" -#: FOption.form:1105 +#: FOption.form:1138 msgid "Quiet external commands" msgstr "" -#: FOption.form:1119 MTheme.module:6 +#: FOption.form:1152 MTheme.module:6 msgid "Help" msgstr "" -#: FOption.form:1136 +#: FOption.form:1169 msgid "Display property help" msgstr "" -#: FOption.form:1158 +#: FOption.form:1191 msgid "Show tooltips" msgstr "" -#: FOption.form:1180 +#: FOption.form:1213 msgid "Show documentation in popups" msgstr "" -#: FOption.form:1202 +#: FOption.form:1235 msgid "Always display optional messages" msgstr "" -#: FOption.form:1224 +#: FOption.form:1257 msgid "Clear documentation cache" msgstr "" -#: FOption.form:1237 +#: FOption.form:1270 msgid "Proxy configuration..." msgstr "" @@ -3352,39 +3364,39 @@ msgstr "" msgid "(Default)" msgstr "" -#: FOption.class:127 +#: FOption.class:128 msgid "Define..." msgstr "" -#: FOption.class:173 +#: FOption.class:174 msgid "Gambas highlight theme files" msgstr "" -#: FOption.class:174 +#: FOption.class:175 msgid "Export a theme file" msgstr "" -#: FOption.class:335 +#: FOption.class:336 msgid "Select a theme file" msgstr "" -#: FOption.class:358 +#: FOption.class:359 msgid "You need to restart the application to see your changes." msgstr "" -#: FOption.class:652 +#: FOption.class:660 msgid "Do you really want to clear the documentation cache?" msgstr "" -#: FOption.class:799 +#: FOption.class:807 msgid "Do you really want to delete this snippet?" msgstr "" -#: FOption.class:935 +#: FOption.class:943 msgid "Do you really want to reset the list to its default value?" msgstr "" -#: FOption.class:935 +#: FOption.class:943 msgid "Reset" msgstr "" @@ -3746,7 +3758,7 @@ msgstr "" msgid "Snapping value is incorrect." msgstr "" -#: FPropertyProject.class:425 Project.module:3180 +#: FPropertyProject.class:425 Project.module:3182 msgid "Some components are missing: &1" msgstr "" @@ -5756,260 +5768,260 @@ msgstr "" msgid "This project does not exist." msgstr "" -#: Project.module:421 +#: Project.module:423 msgid "This is not a Gambas project." msgstr "" -#: Project.module:424 +#: Project.module:426 msgid "This is a Gambas 1.0 project. Use Gambas 2 to convert it." msgstr "" -#: Project.module:427 +#: Project.module:429 msgid "" "This is a Gambas 2.0 project.\n" "\n" "Do you want to convert it?" msgstr "" -#: Project.module:427 +#: Project.module:429 msgid "Convert" msgstr "" -#: Project.module:439 +#: Project.module:441 msgid "" "This project seems to be already opened.\n" "\n" "Opening the same project twice can lead to data loss." msgstr "" -#: Project.module:439 +#: Project.module:441 msgid "Open after all" msgstr "" -#: Project.module:439 +#: Project.module:441 msgid "Do not open" msgstr "" -#: Project.module:465 +#: Project.module:467 msgid "This project is read-only." msgstr "" -#: Project.module:465 +#: Project.module:467 msgid "It cannot be converted." msgstr "" -#: Project.module:483 +#: Project.module:485 msgid "Copying project inside a temporary directory..." msgstr "" -#: Project.module:486 +#: Project.module:488 msgid "Unable to create temporary directory" msgstr "" -#: Project.module:507 +#: Project.module:509 msgid "Converting project structure..." msgstr "" -#: Project.module:536 +#: Project.module:538 msgid "Applying conversion..." msgstr "" -#: Project.module:542 +#: Project.module:544 msgid "Unable to apply conversion" msgstr "" -#: Project.module:642 +#: Project.module:644 msgid "Cannot open project file :\n" msgstr "" -#: Project.module:1359 +#: Project.module:1361 msgid "The following classes have circular inheritance:" msgstr "" -#: Project.module:1524 +#: Project.module:1526 msgid "read-only" msgstr "" -#: Project.module:1526 +#: Project.module:1528 msgid "ALPHA VERSION, USE AT YOUR OWN RISK! :-)" msgstr "" -#: Project.module:1808 +#: Project.module:1810 msgid "Loading &1..." msgstr "" -#: Project.module:1857 +#: Project.module:1859 msgid "Cannot open a binary file." msgstr "" -#: Project.module:1890 +#: Project.module:1892 msgid "Cannot open file." msgstr "" -#: Project.module:1948 +#: Project.module:1950 msgid "File not found!" msgstr "" -#: Project.module:2060 +#: Project.module:2062 msgid "&1th" msgstr "" -#: Project.module:2113 +#: Project.module:2115 msgid "in form definition" msgstr "" -#: Project.module:2120 +#: Project.module:2122 msgid "in &1." msgstr "" -#: Project.module:2275 +#: Project.module:2277 msgid "" "Some project source files are in conflict.\n" "Please solve them if you want to compile the project." msgstr "" -#: Project.module:2279 +#: Project.module:2281 msgid "Compiling project" msgstr "" -#: Project.module:2295 +#: Project.module:2297 msgid "Nothing to do." msgstr "" -#: Project.module:2494 +#: Project.module:2496 msgid "File already exists." msgstr "" -#: Project.module:2527 +#: Project.module:2529 msgid "Directory already exists." msgstr "" -#: Project.module:2539 +#: Project.module:2541 msgid "Cannot link template file." msgstr "" -#: Project.module:2545 +#: Project.module:2547 msgid "Cannot copy template file." msgstr "" -#: Project.module:2756 +#: Project.module:2758 msgid "Making executable..." msgstr "" -#: Project.module:2800 +#: Project.module:2802 msgid "Cannot make executable." msgstr "" -#: Project.module:3375 +#: Project.module:3377 msgid "Cannot write project file." msgstr "" -#: Project.module:3418 +#: Project.module:3420 msgid "Unable to create desktop shortcut." msgstr "" -#: Project.module:3664 +#: Project.module:3666 msgid "The directory will be removed at the next commit." msgstr "" -#: Project.module:3681 +#: Project.module:3683 msgid "You must define a startup class or form!" msgstr "" -#: Project.module:3712 +#: Project.module:3714 msgid "Please type a name." msgstr "" -#: Project.module:3716 +#: Project.module:3718 msgid "This name contains a forbidden character:" msgstr "" -#: Project.module:3720 +#: Project.module:3722 msgid "The name cannot begins with a dot." msgstr "" -#: Project.module:3724 +#: Project.module:3726 msgid "This name is already used. Choose another one." msgstr "" -#: Project.module:3760 +#: Project.module:3762 msgid "" "A class name must begin with a letter or an underscore, followed by any " "letter or digit." msgstr "" -#: Project.module:3808 +#: Project.module:3810 msgid "Destination already exists." msgstr "" -#: Project.module:4021 +#: Project.module:4023 msgid "Unable to rename '&1'" msgstr "" -#: Project.module:4137 +#: Project.module:4139 msgid "Please type a project name." msgstr "" -#: Project.module:4145 +#: Project.module:4147 msgid "The project name cannot begin with a dot." msgstr "" -#: Project.module:4148 +#: Project.module:4150 msgid "Non-ASCII characters are forbidden in a project name." msgstr "" -#: Project.module:4149 +#: Project.module:4151 msgid "" "The following characters are forbidden in a project name: ? * / \\ SPACE" msgstr "" -#: Project.module:4156 +#: Project.module:4158 msgid "This project already exists." msgstr "" -#: Project.module:4159 +#: Project.module:4161 msgid "The project directory already exists." msgstr "" -#: Project.module:4161 +#: Project.module:4163 msgid "" "The project directory cannot be created because a file with the same name " "already exists." msgstr "" -#: Project.module:4220 +#: Project.module:4222 msgid "Create source package" msgstr "" -#: Project.module:4221 +#: Project.module:4223 msgid "Source packages" msgstr "" -#: Project.module:4512 +#: Project.module:4514 msgid "Cannot copy file &1." msgstr "" -#: Project.module:4561 +#: Project.module:4563 msgid "Cannot create link &1." msgstr "" -#: Project.module:4578 +#: Project.module:4580 msgid "Cannot move a directory inside itself." msgstr "" -#: Project.module:4646 +#: Project.module:4648 msgid "Cannot move file &1." msgstr "" -#: Project.module:5296 +#: Project.module:5298 msgid "Project cleanup..." msgstr "" -#: Project.module:5302 +#: Project.module:5304 msgid "Project files conversion..." msgstr "" -#: Project.module:5332 +#: Project.module:5334 msgid "Unable to convert &1" msgstr "" diff --git a/app/src/gambas3/.src/Component/CSymbolInfo.class b/app/src/gambas3/.src/Component/CSymbolInfo.class index 97a091d98..919569e2a 100644 --- a/app/src/gambas3/.src/Component/CSymbolInfo.class +++ b/app/src/gambas3/.src/Component/CSymbolInfo.class @@ -76,6 +76,11 @@ Public Function IsStatic() As Boolean End +Public Sub IsProperty() As Boolean + + Return InStr("rpRPv", Kind) > 0 + +End Public Function GetIcon() As String @@ -569,7 +574,7 @@ Public Function GetDescription(Optional bBalise As Boolean) As String End -Static Private Function GetType(sType As String, Optional bBalise As Boolean) As String +Static Public Function GetType(sType As String, Optional bBalise As Boolean) As String If Len(sType) = 1 Then sType = $cTypeName[sType] diff --git a/app/src/gambas3/.src/Debug/FDebugInfo.class b/app/src/gambas3/.src/Debug/FDebugInfo.class index b45185d24..8e97f4832 100644 --- a/app/src/gambas3/.src/Debug/FDebugInfo.class +++ b/app/src/gambas3/.src/Debug/FDebugInfo.class @@ -1169,6 +1169,12 @@ End Public Sub btnClearSearch_Click() FSearch.ResetBrowse + If tabDebug[TAB_CONSOLE].Visible Then + tabDebug.Index = TAB_CONSOLE + Else + tabDebug.Index = TAB_BREAK + Endif + tabDebug[TAB_SEARCH].Visible = False End diff --git a/app/src/gambas3/.src/Editor/Code/CExpressionSymbol.class b/app/src/gambas3/.src/Editor/Code/CExpressionSymbol.class new file mode 100644 index 000000000..51a9830f0 --- /dev/null +++ b/app/src/gambas3/.src/Editor/Code/CExpressionSymbol.class @@ -0,0 +1,92 @@ +' Gambas class file + +Private $sType As String +Private $hSymbol As CSymbolInfo + +Static Private MAGIC_NUMBER As Integer = 314159265 + +Static Public Sub Get(sType As String, Optional hSymbol As CSymbolInfo) As Variant + + Dim vVal As Variant + + Select Case sType + + Case "b" + vVal = True + Case "c" + vVal = CByte(MAGIC_NUMBER) + Case "d" + vVal = Now + Case "f" + vVal = Pi + Case "i" + vVal = MAGIC_NUMBER + Case "l" + vVal = CLong(MAGIC_NUMBER) + Case "o" + vVal = New CExpressionSymbol("o", Null) + Case "p" + vVal = CPointer(MAGIC_NUMBER) + Case "h" + vVal = CShort(MAGIC_NUMBER) + Case "g" + vVal = CSingle(MAGIC_NUMBER) + Case "s" + vVal = "Gambas" + Case "v" + vVal = New CExpressionSymbol("v", Null) + Case Else + vVal = New CExpressionSymbol(sType, hSymbol) + + End Select + + Return vVal + +End + + +Public Sub _new(sType As String, hSymbol As CSymbolInfo) + + $sType = sType + $hSymbol = hSymbol + +End + +Public Sub _get(...) As Variant + + Dim hSymbol As CSymbolInfo + + If $sType = "o" Or If $sType = "v" Then Return Get("v") + + Try hSymbol = CComponent.GetClassSymbols($sType)["_get"] + If hSymbol Then Return Get(hSymbol.Type, hSymbol) + +End + +Public Sub _put(vVal As Variant, ...) + +End + +Public Sub _property() As Boolean + + Dim hSymbol As CSymbolInfo + + Try hSymbol = CComponent.GetClassSymbols($sType)[Param.Name] + If hSymbol Then Return hSymbol.IsProperty() + +End + +Public Sub _unknown(...) As Variant + + Dim hSymbol As CSymbolInfo + + Try hSymbol = CComponent.GetClassSymbols($sType)[Param.Name] + If hSymbol Then Return Get(hSymbol.Type, hSymbol) + +End + +Public Sub __GetType() As String + + Return $sType + +End diff --git a/app/src/gambas3/.src/Editor/Code/FEditor.class b/app/src/gambas3/.src/Editor/Code/FEditor.class index f1fa5c45b..97993d210 100644 --- a/app/src/gambas3/.src/Editor/Code/FEditor.class +++ b/app/src/gambas3/.src/Editor/Code/FEditor.class @@ -36,6 +36,7 @@ Public Const IDENT_CAR As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqr Public Const NBR_COLOR As Integer = 15 Static Public StructControlCompletion As Boolean = True +Static Public LocalVariableDeclaration As Boolean = True Static Public ExpressionStart As Integer Static Private $cStructClose As New Collection(gb.IgnoreCase) @@ -1113,6 +1114,8 @@ Public Sub Editors_KeyPress() Endif Endif + CreateLocalVariable() + If DoStructControlCompletion(iLine, sLine, aSymbol) Then Return Else If Key.Code = Key.Space Then @@ -1660,11 +1663,10 @@ Static Public Function ReadLocalSymbolType(aSym As String[], iIndex As Integer, hSymbol.Type = sType & "[]" Return True Endif - - If $cType.Exist(sType) Then sType = $cType[sType] - Endif + If $cType.Exist(sType) Then sType = $cType[sType] + hSymbol.Type = sType Return True Endif @@ -1959,44 +1961,6 @@ Public Function GetExpressionType(aExpr As String[], aType As Integer[], bPointA $hSymbol = Null - ' 'IF aExpr.Count = 0 THEN RETURN - ' - ' iInd = aExpr.Count - 1 - ' - ' For iInd = iInd To 0 Step -1 - ' - ' sPattern = aExpr[iInd] - ' If sPattern = ")" Then - ' aWait.Push("(") - ' bLastSymbol = False - ' Continue - ' Else If sPattern = "]" Then - ' aWait.Push("[") - ' bLastSymbol = False - ' Continue - ' Else If aWait.Count Then - ' If sPattern = aWait[aWait.Count - 1] Then - ' aWait.Pop - ' Endif - ' bLastSymbol = False - ' Continue - ' Else If sPattern = "." Then - ' bLastSymbol = False - ' Continue - ' Else If IsTypeSymbol(sPattern, aType[iInd]) Then - ' If Not bLastSymbol Then - ' bLastSymbol = True - ' Continue - ' Endif - ' Endif - ' - ' Break - ' - ' Next - ' - ' aWait.Clear - ' Inc iInd - iInd = GetExpressionStart(aExpr, aType) If iInd >= aExpr.Count Then @@ -2088,10 +2052,16 @@ Public Function GetExpressionType(aExpr As String[], aType As Integer[], bPointA $bLastStatic = False Endif Else If sPattern = "]" Then - Try $hSymbol = CComponent.GetClassSymbols(sType)["_get"] - If Not $hSymbol Then Return - sType = $hSymbol.Type - $bLastStatic = False ' A method cannot return static classes + + If Not sType Then ' Array constructor operator [ ... ] + Return + Else + Try $hSymbol = CComponent.GetClassSymbols(sType)["_get"] + If Not $hSymbol Then Return + sType = $hSymbol.Type + $bLastStatic = False ' A method cannot return static classes + Endif + Endif Next @@ -3473,3 +3443,141 @@ Public Sub GetFunctionSource(Optional sFunc As String) As String Return sCode End + +Private Sub GetExpressionTypeWithEval(aSym As String[], aType As Integer[]) As String + + Dim I, N As Integer + Dim cExpr As New Collection + Dim sExpr As String + Dim sType As String + Dim hSymbol As CSymbolInfo + Dim hExpr As CExpressionSymbol + Dim vVal As Variant + + For I = 0 To aSym.Max + + hExpr = Null + hSymbol = Null + sType = "" + + If aType[I] = Highlight.Keyword Then + + If aSym[I] = "ME" Then + sType = GetSymbolType("ME") + Else If aSym[I] = "SUPER" Then + sType = GetSymbolType("SUPER") + Endif + + Else If aType[I] = Highlight.Symbol Then + + sType = GetSymbolType(aSym[I]) + + Endif + + If sType Then + + Inc N + sExpr &= "__" & CStr(N) + cExpr["__" & CStr(N)] = CExpressionSymbol.Get(sType, $hSymbol) + + Else + sExpr &= aSym[I] + Endif + + Next + + vVal = Eval(sExpr, cExpr) + Try hExpr = vVal + If Error Then + Select TypeOf(vVal) + Case gb.Boolean + Return "b" + Case gb.Byte + Return "c" + Case gb.Date + Return "d" + Case gb.Float + Return "f" + Case gb.Integer + Return "i" + Case gb.Long + Return "l" + Case gb.Object + Return "o" + Case gb.Pointer + Return "p" + Case gb.Short + Return "h" + Case gb.Single + Return "g" + Case gb.String + Return "s" + Case gb.Variant + Return "v" + End Select + Else + Return hExpr.__GetType() + Endif + +Catch + + 'Debug Error.Where; ":"; Error.Text + +End + +Private Sub AddLocalVariable(sName As String, sType As String) + + Dim I, iLine As Integer = GetCurrentProcLine(Editor.Line) + Dim sLine As String + Dim iIndent As Integer + + Do + Inc I + If I >= (Editor.Line - 1) Then Break + sLine = Trim(Highlight.Purge(Editor.Lines[I].Text)) + If sLine And If Left(sLine) <> "'" Then Break + Loop + + iLine = I + + Do + If I >= (Editor.Line - 1) Then Break + + sLine = Trim(Highlight.Purge(Editor.Lines[I].Text)) + + If sLine And If Left(sLine) <> "'" Then + Highlight.Analyze(sLine) + If Highlight.Symbols[0] <> "DIM" Then Break + iIndent = Editor.GetIndent(Editor.Lines[I].Text) + iLine = I + 1 + Endif + + Inc I + Loop + + Editor.Insert(Space$(iIndent) & "Dim " & sName & " As " & sType & "\n", iLine, 0) + +End + + +Private Sub CreateLocalVariable() + + Dim aSym As String[] = Highlight.Symbols + Dim aType As Integer[] = Highlight.Types + Dim sName As String + Dim sType As String + + If aSym.Count >= 3 And If aType[0] = Highlight.Symbol And If aSym[1] = "=" Then + + sName = aSym[0] + sType = GetSymbolType(sName) + If sType Then Return + + aSym.Remove(0, 2) + aType.Remove(0, 2) + sType = GetExpressionTypeWithEval(aSym, aType) + If sType Then AddLocalVariable(sName, CSymbolInfo.GetType(sType)) + + Endif + +End diff --git a/app/src/gambas3/.src/Options/FOption.class b/app/src/gambas3/.src/Options/FOption.class index be43782af..880a0b29b 100644 --- a/app/src/gambas3/.src/Options/FOption.class +++ b/app/src/gambas3/.src/Options/FOption.class @@ -102,6 +102,7 @@ Public Sub _new() [cmbMinimize, "/MinimizeOnRun", 0], [cmbUpperCaseKeywords, "/Editor/KeywordsUseUpperCase", 0], [cmbControlStructCompletion, "/Editor/ControlStructCompletion", 1], + [cmbLocalVarDecl, "/Editor/LocalVariableDeclaration", 1], [cmbIndentDim, "/FormatCode/IndentLocal", 1], [cmbRemoveSpace, "/FormatCode/RemoveSpaces", 0], [cmbKeepVoidLine, "/FormatCode/KeepVoidLines", 0], @@ -627,6 +628,13 @@ Public Sub cmbControlStructCompletion_Click() End +Public Sub cmbLocalVarDecl_Click() + + Settings["/Editor/LocalVariableDeclaration"] = cmbLocalVarDecl.Index = 1 + FEditor.LocalVariableDeclaration = cmbLocalVarDecl.Index = 1 + +End + Public Sub cmbFold_Click() Settings["/Editor/ShowFolding"] = cmbFold.Index = 1 diff --git a/app/src/gambas3/.src/Options/FOption.form b/app/src/gambas3/.src/Options/FOption.form index 8574dffc0..9ada05d46 100644 --- a/app/src/gambas3/.src/Options/FOption.form +++ b/app/src/gambas3/.src/Options/FOption.form @@ -409,8 +409,16 @@ MoveScaled(59,0,7,4) } } + Index = 3 + Text = ("Code formatting") + Picture = Picture["icon:/32/wizard"] + { Label52 Label + MoveScaled(0,0,63,3) + Font = Font["Bold"] + Text = ("Automatic formatting") + } { HBox25 HBox - MoveScaled(0,49,66,4) + MoveScaled(0,4,66,4) Spacing = True Indent = True { Label22 Label @@ -427,7 +435,102 @@ MoveScaled(59,0,7,4) } } - Index = 3 + { HBox43 HBox + MoveScaled(0,9,66,4) + Spacing = True + Indent = True + { Label51 Label + MoveScaled(0,0,47,4) + Expand = True + Text = ("Local variable automatic declaration") + } + { cmbLocalVarDecl ComboBox + MoveScaled(48,0,10,4) + ReadOnly = True + List = [("No"), ("Yes")] + } + { Panel22 Panel + MoveScaled(59,0,7,4) + } + } + { Label48 Label + MoveScaled(0,17,63,3) + Font = Font["Bold"] + Text = ("Explicit formating") + } + { HBox33 HBox + MoveScaled(0,25,66,4) + Spacing = True + Indent = True + { Label31 Label + MoveScaled(0,0,47,4) + Expand = True + Text = ("Format on load & save") + } + { cmbFormatOnLoad ComboBox + MoveScaled(48,0,10,4) + ReadOnly = True + List = [("No"), ("Yes")] + } + { Panel20 Panel + MoveScaled(59,0,7,4) + } + } + { HBox30 HBox + MoveScaled(0,30,66,4) + Spacing = True + Indent = True + { Label28 Label + MoveScaled(0,0,47,4) + Expand = True + Text = ("Indent local variable declaration") + } + { cmbIndentDim ComboBox + MoveScaled(48,0,10,4) + ReadOnly = True + List = [("No"), ("Yes")] + } + { Panel17 Panel + MoveScaled(59,0,7,4) + } + } + { HBox31 HBox + MoveScaled(0,35,66,4) + Spacing = True + Indent = True + { Label29 Label + MoveScaled(0,0,47,4) + Expand = True + Text = ("Remove useless spaces at end of line") + } + { cmbRemoveSpace ComboBox + MoveScaled(48,0,10,4) + ReadOnly = True + List = [("No"), ("Yes")] + } + { Panel18 Panel + MoveScaled(59,0,7,4) + } + } + { HBox32 HBox + MoveScaled(0,40,66,4) + Spacing = True + Indent = True + { Label30 Label + MoveScaled(0,0,47,4) + Expand = True + Text = ("Keep successive void lines") + } + { cmbKeepVoidLine ComboBox + MoveScaled(48,0,10,4) + ReadOnly = True + List = [("No"), ("Yes")] + } + { Panel19 Panel + MoveScaled(59,0,7,4) + } + } + Index = 4 Text = ("Code snippets") Picture = Picture["icon:/large/insert-text"] { Label47 Label @@ -492,86 +595,6 @@ } } } - Index = 4 - Text = ("Code formatting") - Picture = Picture["icon:/32/wizard"] - { Label48 Label - MoveScaled(0,0,63,3) - Font = Font["Bold"] - Text = ("Code formatting") - } - { HBox33 HBox - MoveScaled(0,5,66,4) - Spacing = True - Indent = True - { Label31 Label - MoveScaled(0,0,47,4) - Expand = True - Text = ("Format on load & save") - } - { cmbFormatOnLoad ComboBox - MoveScaled(48,0,10,4) - ReadOnly = True - List = [("No"), ("Yes")] - } - { Panel20 Panel - MoveScaled(59,0,7,4) - } - } - { HBox30 HBox - MoveScaled(0,10,66,4) - Spacing = True - Indent = True - { Label28 Label - MoveScaled(0,0,47,4) - Expand = True - Text = ("Indent local variable declaration") - } - { cmbIndentDim ComboBox - MoveScaled(48,0,10,4) - ReadOnly = True - List = [("No"), ("Yes")] - } - { Panel17 Panel - MoveScaled(59,0,7,4) - } - } - { HBox31 HBox - MoveScaled(0,15,66,4) - Spacing = True - Indent = True - { Label29 Label - MoveScaled(0,0,47,4) - Expand = True - Text = ("Remove useless spaces at end of line") - } - { cmbRemoveSpace ComboBox - MoveScaled(48,0,10,4) - ReadOnly = True - List = [("No"), ("Yes")] - } - { Panel18 Panel - MoveScaled(59,0,7,4) - } - } - { HBox32 HBox - MoveScaled(0,20,66,4) - Spacing = True - Indent = True - { Label30 Label - MoveScaled(0,0,47,4) - Expand = True - Text = ("Keep successive void lines") - } - { cmbKeepVoidLine ComboBox - MoveScaled(48,0,10,4) - ReadOnly = True - List = [("No"), ("Yes")] - } - { Panel19 Panel - MoveScaled(59,0,7,4) - } - } Index = 5 Text = ("Source archives") Picture = Picture["icon:/32/archive"] diff --git a/app/src/gambas3/.src/Project.module b/app/src/gambas3/.src/Project.module index fbae9ed42..9b133d104 100644 --- a/app/src/gambas3/.src/Project.module +++ b/app/src/gambas3/.src/Project.module @@ -408,6 +408,8 @@ Public Function Open(sDir As String, Optional bInAnotherWindow As Boolean) As Bo Endif If bInAnotherWindow Then + Config.Save + Settings.Save Exec [Application.Path &/ Application.Name & ".gambas", sDir] Return True Endif