From 2ab907bbaf88c99e8827647bc50667e41ac7f5ea Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Minisini?= Date: Mon, 3 Oct 2011 20:26:21 +0000 Subject: [PATCH] [DEVELOPMENT ENVIRONMENT] * NEW: Move an option in the option dialog. [EXAMPLES] * BUG: Fix the Evaluator example so that the initial values are localized, and the computed expression always use Float values. git-svn-id: svn://localhost/gambas/trunk@4171 867c0c6c-44f3-4631-809d-bfa615b0a4ec --- app/src/gambas3/.lang/.pot | 62 +++++++++---------- app/src/gambas3/.src/FOption.form | 38 ++++++------ examples/examples/Misc/Evaluator/.project | 4 +- .../examples/Misc/Evaluator/.src/FEval.class | 45 ++++++++------ .../examples/Misc/Evaluator/.src/FEval.form | 49 ++++++++------- 5 files changed, 106 insertions(+), 92 deletions(-) diff --git a/app/src/gambas3/.lang/.pot b/app/src/gambas3/.lang/.pot index 7787393a2..d2cd38d1f 100644 --- a/app/src/gambas3/.lang/.pot +++ b/app/src/gambas3/.lang/.pot @@ -519,7 +519,7 @@ msgstr "" #: FCommit.form:109 FConflict.form:71 FConnectionEditor.form:368 #: FEditor.form:137 FForm.form:470 FIconEditor.form:86 FImageEditor.form:99 -#: FOption.form:632 FOutput.form:46 FTextEditor.form:76 +#: FOption.form:611 FOutput.form:46 FTextEditor.form:76 msgid "Undo" msgstr "" @@ -1154,7 +1154,7 @@ msgstr "" msgid "Debug" msgstr "" -#: FDebugInfo.form:58 FMain.form:965 FOption.form:589 FSearch.class:92 +#: FDebugInfo.form:58 FMain.form:965 FOption.form:568 FSearch.class:92 msgid "Console" msgstr "" @@ -1252,7 +1252,7 @@ msgid "Function" msgstr "" #: FDebugInfo.class:57 FIconEditor.form:199 FImportTable.class:68 -#: FOption.form:403 +#: FOption.form:382 msgid "Line" msgstr "" @@ -1397,7 +1397,7 @@ msgstr "" msgid "Paste as comments" msgstr "" -#: FEditor.form:350 FOption.form:364 +#: FEditor.form:350 FOption.form:343 msgid "Editor" msgstr "" @@ -3170,105 +3170,105 @@ msgid "Icon theme" msgstr "" #: FOption.form:308 -msgid "Quiet external commands" -msgstr "" - -#: FOption.form:329 msgid "Use utility windows" msgstr "" -#: FOption.form:350 +#: FOption.form:329 msgid "Always display optional messages" msgstr "" -#: FOption.form:374 +#: FOption.form:353 msgid "Default tab size" msgstr "" -#: FOption.form:386 FPropertyProject.form:258 +#: FOption.form:365 FPropertyProject.form:258 msgid "space(s)" msgstr "" -#: FOption.form:397 +#: FOption.form:376 msgid "Procedure separation" msgstr "" -#: FOption.form:403 FProperty.class:724 +#: FOption.form:382 FProperty.class:724 msgid "None" msgstr "" -#: FOption.form:403 +#: FOption.form:382 msgid "Blend" msgstr "" -#: FOption.form:403 MTheme.module:6 +#: FOption.form:382 MTheme.module:6 msgid "Background" msgstr "" -#: FOption.form:414 +#: FOption.form:393 msgid "Highlight current line" msgstr "" -#: FOption.form:435 +#: FOption.form:414 msgid "Highlight modified lines" msgstr "" -#: FOption.form:456 +#: FOption.form:435 msgid "Show line numbers" msgstr "" -#: FOption.form:477 +#: FOption.form:456 msgid "Show spaces at end of line with dots" msgstr "" -#: FOption.form:498 +#: FOption.form:477 msgid "Fold procedures by default" msgstr "" -#: FOption.form:519 +#: FOption.form:498 msgid "Keywords in upper case" msgstr "" -#: FOption.form:540 +#: FOption.form:519 msgid "Control structure automatic completion" msgstr "" -#: FOption.form:554 +#: FOption.form:533 msgid "Style" msgstr "" -#: FOption.form:560 +#: FOption.form:539 msgid "Fonts" msgstr "" -#: FOption.form:602 +#: FOption.form:581 msgid "Theme" msgstr "" -#: FOption.form:620 +#: FOption.form:599 msgid "Import theme" msgstr "" -#: FOption.form:626 +#: FOption.form:605 msgid "Export theme" msgstr "" -#: FOption.form:648 +#: FOption.form:627 msgid "Applications" msgstr "" -#: FOption.form:658 +#: FOption.form:637 msgid "Browser" msgstr "" -#: FOption.form:675 +#: FOption.form:654 msgid "Terminal" msgstr "" -#: FOption.form:692 +#: FOption.form:671 msgid "Image editor" msgstr "" +#: FOption.form:688 +msgid "Quiet external commands" +msgstr "" + #: FOption.form:702 MTheme.module:6 msgid "Help" msgstr "" diff --git a/app/src/gambas3/.src/FOption.form b/app/src/gambas3/.src/FOption.form index c109fb7c0..5ae9f2b40 100644 --- a/app/src/gambas3/.src/FOption.form +++ b/app/src/gambas3/.src/FOption.form @@ -128,25 +128,8 @@ List = [] } } - { HBox10 HBox - MoveScaled(0,30,66,4) - Spacing = True - { Label16 Label - MoveScaled(0,0,47,4) - Expand = True - Text = ("Quiet external commands") - } - { cmbOutput ComboBox - MoveScaled(48,0,10,4) - ReadOnly = True - List = [("No"), ("Yes")] - } - { Panel12 Panel - MoveScaled(59,0,7,4) - } - } { HBox26 HBox - MoveScaled(0,35,66,4) + MoveScaled(0,30,66,4) Spacing = True { Label15 Label MoveScaled(0,0,47,4) @@ -163,7 +146,7 @@ } } { HBox28 HBox - MoveScaled(0,40,66,4) + MoveScaled(0,35,66,4) Spacing = True { Label9 Label MoveScaled(0,0,47,4) @@ -458,6 +441,23 @@ List = [] } } + { HBox10 HBox + MoveScaled(0,15,66,4) + Spacing = True + { Label16 Label + MoveScaled(0,0,47,4) + Expand = True + Text = ("Quiet external commands") + } + { cmbOutput ComboBox + MoveScaled(48,0,10,4) + ReadOnly = True + List = [("No"), ("Yes")] + } + { Panel12 Panel + MoveScaled(59,0,7,4) + } + } Index = 4 Text = ("Help") Picture = Picture["icon:/large/help"] diff --git a/examples/examples/Misc/Evaluator/.project b/examples/examples/Misc/Evaluator/.project index 357453a63..9f92b1760 100644 --- a/examples/examples/Misc/Evaluator/.project +++ b/examples/examples/Misc/Evaluator/.project @@ -1,9 +1,9 @@ # Gambas Project File 3.0 -# Compiled with Gambas 2.99.3 +# Compiled with Gambas 2.99.5 Title=Expression evaluation example Startup=FEval Icon=calculator.png -Version=0.0.1 +Version=1.0.0 Component=gb.image Component=gb.gui Component=gb.eval diff --git a/examples/examples/Misc/Evaluator/.src/FEval.class b/examples/examples/Misc/Evaluator/.src/FEval.class index 70e47281a..589d4a5a7 100644 --- a/examples/examples/Misc/Evaluator/.src/FEval.class +++ b/examples/examples/Misc/Evaluator/.src/FEval.class @@ -1,46 +1,53 @@ ' Gambas class file -PRIVATE $hExpr AS NEW Expression -PRIVATE $cEnv AS NEW Collection +Private $hExpr As New Expression +Private $cEnv As New Collection -STATIC PUBLIC SUB Main() +Static Public Sub Main() - DIM hForm AS Form + Dim hForm As Form - hForm = NEW FEval + hForm = New FEval hForm.Show -END +End -PUBLIC SUB btnUpdate_Click() +Public Sub btnUpdate_Click() - DIM cCol AS NEW Collection + Dim cCol As New Collection - IF $hExpr.Text <> txtExpr.Text THEN + If $hExpr.Text <> txtExpr.Text Then $hExpr.Text = txtExpr.Text - ENDIF + Endif 'cEnv.Compare = gb.Case - $cEnv["a"] = Val(txtValueA.Text) - $cEnv["b"] = Val(txtValueB.Text) - $cEnv["x"] = Val(txtValueX.Text) - $cEnv["y"] = Val(txtValueY.Text) + $cEnv["a"] = CFloat(Val(txtValueA.Text)) + $cEnv["b"] = CFloat(Val(txtValueB.Text)) + $cEnv["x"] = CFloat(Val(txtValueX.Text)) + $cEnv["y"] = CFloat(Val(txtValueY.Text)) $hExpr.Compile $hExpr.Environment = $cEnv txtResult.Text = Str($hExpr.Value) -CATCH +Catch txtResult.Text = Error.Text -END +End -PUBLIC SUB btnClose_Click() +Public Sub btnClose_Click() - ME.Close + Me.Close -END +End + +Public Sub Form_Open() + + txtValueA.Text = Str(0.5) + txtValueB.Text = Str(1) + +End diff --git a/examples/examples/Misc/Evaluator/.src/FEval.form b/examples/examples/Misc/Evaluator/.src/FEval.form index 47b1ecb82..9c55dceb1 100644 --- a/examples/examples/Misc/Evaluator/.src/FEval.form +++ b/examples/examples/Misc/Evaluator/.src/FEval.form @@ -1,76 +1,83 @@ # Gambas Form File 3.0 { Form Form - MoveScaled(32,28,49,37) + MoveScaled(32,28,51,41) Text = ("Evaluator") Icon = Picture["calculator.png"] Resizable = False { Label4 Label - MoveScaled(27,15,7,4) + MoveScaled(27,17,7,4) Text = ("y =") } { Label3 Label - MoveScaled(27,10,7,4) + MoveScaled(27,12,7,4) Text = ("x =") } { Label2 Label - MoveScaled(2,15,7,4) + MoveScaled(2,17,7,4) Text = ("b =") } { Label1 Label - MoveScaled(2,10,7,4) + MoveScaled(2,12,7,4) Text = ("a =") } { txtValueA TextBox txtValue Name = "txtValueA" - MoveScaled(6,10,17,4) - Text = ("0,5") + MoveScaled(6,12,17,4) } { txtValueB TextBox txtValue Name = "txtValueB" - MoveScaled(6,15,17,4) - Text = ("1") + MoveScaled(6,17,17,4) } { txtValueX TextBox txtValue Name = "txtValueX" - MoveScaled(31,10,17,4) + MoveScaled(31,12,17,4) Text = ("45") } { txtValueY TextBox txtValue Name = "txtValueY" - MoveScaled(31,15,17,4) + MoveScaled(31,17,17,4) Text = ("60") } { Label6 Label - MoveScaled(2,21,13,4) + MoveScaled(2,23,13,4) Text = ("Expression") } { txtExpr TextBox - MoveScaled(13,21,35,4) + MoveScaled(15,23,35,4) Text = ("a * Cos(Rad(x)) + b * Sin(Rad(y))") } { Label7 Label - MoveScaled(2,26,9,4) + MoveScaled(2,28,9,4) Text = ("Result") } { txtResult TextBox - MoveScaled(13,26,35,4) + MoveScaled(15,28,35,4) ReadOnly = True } { btnUpdate Button - MoveScaled(1,32,16,4) + MoveScaled(23,36,16,4) Text = ("&Update result") Default = True } { btnClose Button - MoveScaled(38,32,10,4) + MoveScaled(40,36,10,4) Text = ("&Quit") Cancel = True } { TextLabel1 TextLabel - MoveScaled(1,1,47,6) - Font = Font["Bold,+2"] - Text = ("This is a sample of how to use the expression evaluator.") - Alignment = Align.Center + MoveScaled(1,1,49,7) + Font = Font["Bold,Italic"] + Background = Color.SelectedBackground + Foreground = Color.SelectedForeground + Padding = 6 + Text = ("This is an example of how to use the gb.eval expression evaluator component.") + Alignment = Align.Normal + } + { Separator1 Separator + MoveScaled(1,9,49,1) + } + { Separator2 Separator + MoveScaled(0,34,50,1) } }