From ab2caea6242c1941947220a7a028f018719820e8 Mon Sep 17 00:00:00 2001 From: deaspo Date: Wed, 4 Nov 2015 17:50:16 +0300 Subject: [PATCH] Changes to the button controls and the Rsyntax --- instat/MultilingualResources/instat.fr-FR.xlf | 3 +- instat/MultilingualResources/instat.sw-KE.xlf | 3 +- instat/dlgBoxPlot.designer.vb | 3 -- instat/dlgBoxPlot.vb | 1 + instat/dlgRegularSequence.designer.vb | 6 +-- instat/dlgRegularSequence.vb | 50 +++++++++++-------- instat/dlgStartofRains.vb | 1 + instat/frmMain.resx | 2 +- instat/rLink.vb | 2 +- instat/rSyntax.vb | 38 ++++---------- instat/ucrButtons.Designer.vb | 16 +++++- instat/ucrButtons.vb | 27 ++++++---- 12 files changed, 83 insertions(+), 69 deletions(-) diff --git a/instat/MultilingualResources/instat.fr-FR.xlf b/instat/MultilingualResources/instat.fr-FR.xlf index 3c926c9f90a..6c8c9d57fd9 100644 --- a/instat/MultilingualResources/instat.fr-FR.xlf +++ b/instat/MultilingualResources/instat.fr-FR.xlf @@ -311,8 +311,9 @@ 122, 95 - 25 + 40 25 + Please verify the translation’s accuracy as the source string was updated after it was translated. diff --git a/instat/MultilingualResources/instat.sw-KE.xlf b/instat/MultilingualResources/instat.sw-KE.xlf index 77ee4aa09bd..cb9d901adec 100644 --- a/instat/MultilingualResources/instat.sw-KE.xlf +++ b/instat/MultilingualResources/instat.sw-KE.xlf @@ -885,8 +885,9 @@ 122, 95 - 25 + 40 25 + Please verify the translation’s accuracy as the source string was updated after it was translated. diff --git a/instat/dlgBoxPlot.designer.vb b/instat/dlgBoxPlot.designer.vb index a205b8b9eb6..f87e462fce8 100644 --- a/instat/dlgBoxPlot.designer.vb +++ b/instat/dlgBoxPlot.designer.vb @@ -32,7 +32,6 @@ Partial Class dlgBoxPlot Me.UcrDataSelection1.Name = "UcrDataSelection1" Me.UcrDataSelection1.Size = New System.Drawing.Size(297, 122) Me.UcrDataSelection1.TabIndex = 1 - Me.UcrDataSelection1.UseWaitCursor = True ' 'UcrButtons1 ' @@ -40,7 +39,6 @@ Partial Class dlgBoxPlot Me.UcrButtons1.Name = "UcrButtons1" Me.UcrButtons1.Size = New System.Drawing.Size(337, 32) Me.UcrButtons1.TabIndex = 0 - Me.UcrButtons1.UseWaitCursor = True ' 'dlgBoxPlot ' @@ -54,7 +52,6 @@ Partial Class dlgBoxPlot Me.Name = "dlgBoxPlot" Me.ShowIcon = False Me.Text = "Boxplot" - Me.UseWaitCursor = True Me.ResumeLayout(False) End Sub diff --git a/instat/dlgBoxPlot.vb b/instat/dlgBoxPlot.vb index d090a86f775..a0098a1eee1 100644 --- a/instat/dlgBoxPlot.vb +++ b/instat/dlgBoxPlot.vb @@ -22,6 +22,7 @@ Next strScript = strScript & ")])" frmMain.clsRInterface.RunScript(strScript) + Me.Hide() End If End Sub diff --git a/instat/dlgRegularSequence.designer.vb b/instat/dlgRegularSequence.designer.vb index 03039121f34..6c1aeb43352 100644 --- a/instat/dlgRegularSequence.designer.vb +++ b/instat/dlgRegularSequence.designer.vb @@ -242,7 +242,7 @@ Partial Class dlgRegularSequence Me.grpSequence2.Controls.Add(Me.Label4) Me.grpSequence2.Controls.Add(Me.Label5) Me.grpSequence2.Font = New System.Drawing.Font("Microsoft Sans Serif", 8.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte)) - Me.grpSequence2.Location = New System.Drawing.Point(8, 56) + Me.grpSequence2.Location = New System.Drawing.Point(213, 47) Me.grpSequence2.Name = "grpSequence2" Me.grpSequence2.Size = New System.Drawing.Size(180, 95) Me.grpSequence2.TabIndex = 10 @@ -314,14 +314,14 @@ Partial Class dlgRegularSequence ' Me.UcrButtons1.Location = New System.Drawing.Point(12, 157) Me.UcrButtons1.Name = "UcrButtons1" - Me.UcrButtons1.Size = New System.Drawing.Size(333, 32) + Me.UcrButtons1.Size = New System.Drawing.Size(403, 32) Me.UcrButtons1.TabIndex = 5 ' 'dlgRegularSequence ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font - Me.ClientSize = New System.Drawing.Size(350, 186) + Me.ClientSize = New System.Drawing.Size(427, 186) Me.Controls.Add(Me.grpSequence2) Me.Controls.Add(Me.grpSequence) Me.Controls.Add(Me.grpRepeatSingle) diff --git a/instat/dlgRegularSequence.vb b/instat/dlgRegularSequence.vb index 598088e83a2..b953697e62c 100644 --- a/instat/dlgRegularSequence.vb +++ b/instat/dlgRegularSequence.vb @@ -15,23 +15,14 @@ ' along with this program. If not, see . Public Class dlgRegularSequence Public clsRSyntax As New RSyntax + Public lstOfStrings As New List(Of String) Private Sub dlgRegularSequence_Load(sender As Object, e As EventArgs) Handles MyBase.Load grpSequence2.Hide() grpRepeatSingle.Hide() End Sub Private Sub UcrButtons1_ClickOk(sender As Object, e As EventArgs) Handles UcrButtons1.ClickOk - Dim lstOfStrings - If rdSequence.Checked = True Then - lstOfStrings = New List(Of String)({txtFrom.Text, txtTo.Text, txtSteps.Text}) - clsRSyntax.manage(lstOfStrings, "regular") - ElseIf rdSIngleValue.Checked = True - lstOfStrings = New List(Of String)({txtValue.Text, txtRepeatTimes.Text}) - clsRSyntax.manage(lstOfStrings, "repeated") - ElseIf rdDates.Checked = True - lstOfStrings = New List(Of Object)({datePicker1.Value, datePicker2.Value, cboBy.SelectedItem.ToString()}) - clsRSyntax.manage(lstOfStrings, "date") - End If + UcrButtons1.clsRsyntax.GetScript() End Sub Private Sub rdSIngleValue_Click(sender As Object, e As EventArgs) Handles rdSIngleValue.Click @@ -52,17 +43,34 @@ Public Class dlgRegularSequence grpSequence.Visible = True End Sub - 'Private Sub txtColName_Validating(sender As Object, e As EventArgs) Handles txtColName.Validating - ' If txtColName.Text = String.Empty Then - ' 'UcrButtons1.Enabled = False - ' errorProvider.SetError(txtColName, "Please Enter the name for the column") - ' End If - 'End Sub - 'Private Sub txtColName_Validated(sender As Object, e As EventArgs) Handles txtColName.Validated - ' UcrButtons1.Enabled = True - 'End Sub + Private Sub UcrButtons1_Load(sender As Object, e As EventArgs) + UcrButtons1.clsRsyntax.SetFunction("seq") + End Sub + + Private Sub txtFrom_Validating(sender As Object, e As EventArgs) Handles txtFrom.Validating + If IsNumeric(txtFrom.Text) Then + UcrButtons1.clsRsyntax.AddParameter("from", txtFrom.Text) + Else + MsgBox("Please Enter a number!", vbCritical, "Message for Instat+") + txtFrom.Focus() + End If + End Sub - Private Sub UcrButtons1_Load(sender As Object, e As EventArgs) Handles UcrButtons1.Load + Private Sub txtTo_Validating(sender As Object, e As EventArgs) Handles txtTo.Validating + If IsNumeric(txtTo.Text) Then + UcrButtons1.clsRsyntax.AddParameter("to", txtFrom.Text) + Else + MsgBox("Please Enter a number!", vbCritical, "Message for Instat+") + txtTo.Focus() + End If + End Sub + Private Sub txtSteps_Validating(sender As Object, e As EventArgs) Handles txtSteps.Validating + If IsNumeric(txtSteps.Text) Then + UcrButtons1.clsRsyntax.AddParameter("by", txtFrom.Text) + Else + MsgBox("Please Enter a number!", vbCritical, "Message for Instat+") + txtSteps.Focus() + End If End Sub End Class \ No newline at end of file diff --git a/instat/dlgStartofRains.vb b/instat/dlgStartofRains.vb index d4e1cb00a0c..346f83c8cb4 100644 --- a/instat/dlgStartofRains.vb +++ b/instat/dlgStartofRains.vb @@ -29,6 +29,7 @@ Public Class dlgStartofRains Private Sub dlgStartofRains_Load(sender As Object, e As EventArgs) Handles Me.Load UpdateVisible() autoTranslate(Me) + End Sub Private Sub UpdateVisible() diff --git a/instat/frmMain.resx b/instat/frmMain.resx index d61046b4aa6..8c57b7a779c 100644 --- a/instat/frmMain.resx +++ b/instat/frmMain.resx @@ -253,6 +253,6 @@ 122, 95 - 25 + 40 \ No newline at end of file diff --git a/instat/rLink.vb b/instat/rLink.vb index 1c3b5e216bc..9cee5d0647c 100644 --- a/instat/rLink.vb +++ b/instat/rLink.vb @@ -92,7 +92,7 @@ Public Class RInterface If bReturnOutput Then 'strCapturedScript = "capture.output(" & strScript & ")" 'txtOutput.Text = txtOutput.Text & String.Join(vbCrLf, clsEngine.Evaluate(strCapturedScript).AsCharacter) & vbCrLf - txtOutput.Text = txtOutput.Text & vbCrLf & "> " & String.Join(vbCrLf, clsEngine.Evaluate(strScript).AsCharacter) & vbCrLf + txtOutput.Text = txtOutput.Text & "> " & String.Join(",", clsEngine.Evaluate(strScript).AsCharacter) & vbCrLf Else clsEngine.Evaluate(strScript) End If diff --git a/instat/rSyntax.vb b/instat/rSyntax.vb index 6845c0e3304..f5f2d56c132 100644 --- a/instat/rSyntax.vb +++ b/instat/rSyntax.vb @@ -1,4 +1,4 @@ -' Instat-R +' Instat+R ' Copyright (C) 2015 ' ' This program is free software: you can redistribute it and/or modify @@ -14,39 +14,23 @@ ' You should have received a copy of the GNU General Public License k ' along with this program. If not, see . + Public Class RSyntax Dim strScript As String - Public Sub manage(lstOfString As Object, type As String) - Select Case type - Case "regular" - strScript = "capture.output(seq(from = " & Convert.ToInt32(lstOfString(0)) & ", to = " & Convert.ToInt32(lstOfString(1)) & ", by = " & Convert.ToInt32(lstOfString(2)) & "))" - frmMain.clsRInterface.RunScript(strScript) - Case "repeated" - strScript = "capture.output(seq(from = " & Convert.ToInt32(lstOfString(0)) & ", to = " & Convert.ToInt32(lstOfString(0)) & ", length.out = " & Convert.ToInt32(lstOfString(1)) & "))" - frmMain.clsRInterface.RunScript(strScript) - Case "date" - strScript = "capture.output(seq(from = as.Date('" & Format(lstOfString(0), "yyyy/MM/dd") & "'), to = as.Date('" & Format(lstOfString(1), "yyyy/MM/dd") & "'), by = '" & lstOfString(2) & "'))" - frmMain.clsRInterface.RunScript(strScript) - End Select - + Public Sub SetFunction(strFunctionName As String) + strScript = strFunctionName End Sub - Public Sub graphics(strString As String, submenu As String) - - - + Public Sub AddParameter(strParameterName As String, strParameterValue As String) + strScript = strParameterName & "=" & strParameterValue End Sub - Public Sub statistcs(strString As String, submenu As String) - - - + Public Sub RemoveParameter(strParameterName As String, strParameterValue As String) + strScript = strParameterName & "=" & strParameterValue End Sub - Public Sub climatic(strString As String, submenu As String) - - - - End Sub + Public Function GetScript() As String + Return MsgBox("Empty") + End Function End Class diff --git a/instat/ucrButtons.Designer.vb b/instat/ucrButtons.Designer.vb index bbcfa61ffe0..d8b2890082c 100644 --- a/instat/ucrButtons.Designer.vb +++ b/instat/ucrButtons.Designer.vb @@ -26,6 +26,7 @@ Partial Class ucrButtons Me.cmdCancel = New System.Windows.Forms.Button() Me.cmdReset = New System.Windows.Forms.Button() Me.cmdHelp = New System.Windows.Forms.Button() + Me.cmdPaste = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'cmdOk @@ -45,7 +46,7 @@ Partial Class ucrButtons Me.cmdCancel.Size = New System.Drawing.Size(75, 23) Me.cmdCancel.TabIndex = 81 Me.cmdCancel.Tag = "Cancel" - Me.cmdCancel.Text = "Cancel " + Me.cmdCancel.Text = "Close" Me.cmdCancel.UseVisualStyleBackColor = True ' 'cmdReset @@ -68,16 +69,26 @@ Partial Class ucrButtons Me.cmdHelp.Text = "Help " Me.cmdHelp.UseVisualStyleBackColor = True ' + 'cmdPaste + ' + Me.cmdPaste.Location = New System.Drawing.Point(326, 4) + Me.cmdPaste.Name = "cmdPaste" + Me.cmdPaste.Size = New System.Drawing.Size(75, 23) + Me.cmdPaste.TabIndex = 83 + Me.cmdPaste.Text = "Paste Script" + Me.cmdPaste.UseVisualStyleBackColor = True + ' 'ucrButtons ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font + Me.Controls.Add(Me.cmdPaste) Me.Controls.Add(Me.cmdOk) Me.Controls.Add(Me.cmdCancel) Me.Controls.Add(Me.cmdReset) Me.Controls.Add(Me.cmdHelp) Me.Name = "ucrButtons" - Me.Size = New System.Drawing.Size(324, 32) + Me.Size = New System.Drawing.Size(410, 32) Me.ResumeLayout(False) End Sub @@ -86,4 +97,5 @@ Partial Class ucrButtons Friend WithEvents cmdCancel As Button Friend WithEvents cmdReset As Button Friend WithEvents cmdHelp As Button + Friend WithEvents cmdPaste As Button End Class diff --git a/instat/ucrButtons.vb b/instat/ucrButtons.vb index dcfe0c82ada..e38c729353f 100644 --- a/instat/ucrButtons.vb +++ b/instat/ucrButtons.vb @@ -1,24 +1,33 @@  - - Public Class ucrButtons + Public clsRsyntax As New RSyntax + Private Sub cmdCancel_Click(sender As Object, e As EventArgs) Handles cmdCancel.Click - 'Gets the current active window - Dim ActiveWindow As Form = Form.ActiveForm - ActiveWindow.Close() + Me.ParentForm.Hide() End Sub Private Sub cmdReset_Click(sender As Object, e As EventArgs) Handles cmdReset.Click - + EmptyTxt() End Sub Public Event ClickOk(sender As Object, e As EventArgs) + Public Event ClickReset(sender As Object, e As EventArgs) Private Sub cmdOk_Click(sender As Object, e As EventArgs) Handles cmdOk.Click RaiseEvent ClickOk(sender, e) End Sub - - Private Sub ucrButtons_Load(sender As Object, e As EventArgs) Handles MyBase.Load - + Public Sub EmptyTxt() + Dim Ctrl As Control + For Each Ctrl In Me.ParentForm.Controls + If TypeOf Ctrl Is TextBox Then Ctrl.Text = "" + If TypeOf Ctrl Is GroupBox Then + Dim Ctrl1 As Control + For Each Ctrl1 In Ctrl.Controls + If TypeOf Ctrl1 Is TextBox Then + Ctrl1.Text = "" + End If + Next + End If + Next End Sub End Class