From 84c38f754f63b7de16cfa086b4ee5571665d0e31 Mon Sep 17 00:00:00 2001 From: deaspo Date: Thu, 11 Feb 2016 11:49:03 +0300 Subject: [PATCH 1/7] Disabled the autoformat on the grid[still needs a discussion], modified the Rlink to allow different formatting options [still needs discussion to finalize] but not yet connected to the options dialog and added the formating options to the dlgOptions for Comments, R script and R Output. Probably a quick discussion and I finalize all these. --- instat/clsRLink.vb | 52 ++-- instat/dlgOptions.Designer.vb | 436 +++++++++++++++++++++++++++------- instat/dlgOptions.vb | 34 ++- instat/frmEditor.vb | 4 + 4 files changed, 416 insertions(+), 110 deletions(-) diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index 786e453561d..b9a1a5b4e1d 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -1,19 +1,19 @@ -' Instat+R -' Copyright (C) 2015 -' -' This program is free software: you can redistribute it and/or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, or -' (at your option) any later version. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU General Public License for more details. -' -' You should have received a copy of the GNU General Public License k -' along with this program. If not, see . - +' Instat+R +' Copyright (C) 2015 +' +' This program is free software: you can redistribute it and/or modify +' it under the terms of the GNU General Public License as published by +' the Free Software Foundation, either version 3 of the License, or +' (at your option) any later version. +' +' This program is distributed in the hope that it will be useful, +' but WITHOUT ANY WARRANTY; without even the implied warranty of +' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +' GNU General Public License for more details. +' +' You should have received a copy of the GNU General Public License k +' along with this program. If not, see . + Imports RDotNet Public Class RLink @@ -106,8 +106,9 @@ Public Class RLink txtLog.Text = txtLog.Text & strScript & vbCrLf End If If bOutput Then - txtOutput.Text = txtOutput.Text & strScript & vbCrLf + 'input format here + AppendText(txtOutput, Color.Black, strScript & vbCrLf) End If If bReturnOutput = 0 Then clsEngine.Evaluate(strScript) @@ -127,14 +128,29 @@ Public Class RLink strOutput = strOutput & strTemp & vbCrLf End If If bOutput Then - txtOutput.Text = txtOutput.Text & strOutput + 'txtOutput.Text = txtOutput.Text & strOutput 'output format here + AppendText(txtOutput, Color.Blue, strOutput) End If Catch MsgBox(strScript) End Try frmMain.clsGrids.UpdateGrids() End Sub + Private Sub AppendText(box As RichTextBox, color As Color, text As String) + Dim start As Integer = box.TextLength + box.AppendText(text) + Dim [end] As Integer = box.TextLength + + ' Textbox may transform chars, so (end-start) != text.Length + box.[Select](start, [end] - start) + If True Then + box.SelectionColor = color + 'To set Font and Font Size after Discussion + End If + box.SelectionLength = 0 + ' clear + End Sub Public Function GetData(strLabel As String) As DataFrame diff --git a/instat/dlgOptions.Designer.vb b/instat/dlgOptions.Designer.vb index 3c5f946c9e4..57ee253936d 100644 --- a/instat/dlgOptions.Designer.vb +++ b/instat/dlgOptions.Designer.vb @@ -30,28 +30,54 @@ Partial Class dlgOptions Me.tbpComments = New System.Windows.Forms.TabPage() Me.txtComment = New System.Windows.Forms.TextBox() Me.lblComment = New System.Windows.Forms.Label() - Me.tbpOutput = New System.Windows.Forms.TabPage() - Me.cmdChangeSettings = New System.Windows.Forms.Button() - Me.txtFontFamily = New System.Windows.Forms.TextBox() - Me.txtFontColor = New System.Windows.Forms.TextBox() - Me.lblColorFont = New System.Windows.Forms.Label() - Me.lblFamilyFont = New System.Windows.Forms.Label() + Me.tbpFormat = New System.Windows.Forms.TabPage() Me.cmdOk = New System.Windows.Forms.Button() Me.cmdApply = New System.Windows.Forms.Button() Me.cmdCancel = New System.Windows.Forms.Button() Me.cmdHelp = New System.Windows.Forms.Button() - Me.lblTitle = New System.Windows.Forms.Label() + Me.thpOptions = New System.Windows.Forms.TabControl() + Me.tbpScript = New System.Windows.Forms.TabPage() + Me.tbpROutput = New System.Windows.Forms.TabPage() + Me.tbpComment = New System.Windows.Forms.TabPage() + Me.lblScriptTitle = New System.Windows.Forms.Label() + Me.cmdScriptChange = New System.Windows.Forms.Button() + Me.txtScriptFont = New System.Windows.Forms.TextBox() + Me.txtScriptColor = New System.Windows.Forms.TextBox() + Me.lblScriptColor = New System.Windows.Forms.Label() + Me.lblScriptFont = New System.Windows.Forms.Label() + Me.lblOutputTitle = New System.Windows.Forms.Label() + Me.cmdOutputChange = New System.Windows.Forms.Button() + Me.txtOutputFont = New System.Windows.Forms.TextBox() + Me.txtOutputcolor = New System.Windows.Forms.TextBox() + Me.lblOutputColor = New System.Windows.Forms.Label() + Me.lblOutputFont = New System.Windows.Forms.Label() + Me.lblCommentsTitle = New System.Windows.Forms.Label() + Me.cmdCommentsChange = New System.Windows.Forms.Button() + Me.txtCommentsFont = New System.Windows.Forms.TextBox() + Me.txtCommentsColor = New System.Windows.Forms.TextBox() + Me.lblCommentsColor = New System.Windows.Forms.Label() + Me.lblCommentsFont = New System.Windows.Forms.Label() + Me.lblScriptSize = New System.Windows.Forms.Label() + Me.txtScriptSize = New System.Windows.Forms.TextBox() + Me.txtOutputSize = New System.Windows.Forms.TextBox() + Me.lblOutputsize = New System.Windows.Forms.Label() + Me.txtCommentsSize = New System.Windows.Forms.TextBox() + Me.lblCommentsSize = New System.Windows.Forms.Label() Me.tbcOptions.SuspendLayout() Me.tbpLanguageSettings.SuspendLayout() Me.tbpComments.SuspendLayout() - Me.tbpOutput.SuspendLayout() + Me.tbpFormat.SuspendLayout() + Me.thpOptions.SuspendLayout() + Me.tbpScript.SuspendLayout() + Me.tbpROutput.SuspendLayout() + Me.tbpComment.SuspendLayout() Me.SuspendLayout() ' 'tbcOptions ' Me.tbcOptions.Controls.Add(Me.tbpLanguageSettings) Me.tbcOptions.Controls.Add(Me.tbpComments) - Me.tbcOptions.Controls.Add(Me.tbpOutput) + Me.tbcOptions.Controls.Add(Me.tbpFormat) Me.tbcOptions.Location = New System.Drawing.Point(13, 13) Me.tbcOptions.Name = "tbcOptions" Me.tbcOptions.SelectedIndex = 0 @@ -137,64 +163,16 @@ Partial Class dlgOptions Me.lblComment.Tag = "Comment" Me.lblComment.Text = "Comment" ' - 'tbpOutput - ' - Me.tbpOutput.Controls.Add(Me.lblTitle) - Me.tbpOutput.Controls.Add(Me.cmdChangeSettings) - Me.tbpOutput.Controls.Add(Me.txtFontFamily) - Me.tbpOutput.Controls.Add(Me.txtFontColor) - Me.tbpOutput.Controls.Add(Me.lblColorFont) - Me.tbpOutput.Controls.Add(Me.lblFamilyFont) - Me.tbpOutput.Location = New System.Drawing.Point(4, 22) - Me.tbpOutput.Name = "tbpOutput" - Me.tbpOutput.Padding = New System.Windows.Forms.Padding(3) - Me.tbpOutput.Size = New System.Drawing.Size(392, 233) - Me.tbpOutput.TabIndex = 2 - Me.tbpOutput.Text = "Output Window" - Me.tbpOutput.UseVisualStyleBackColor = True - ' - 'cmdChangeSettings - ' - Me.cmdChangeSettings.Location = New System.Drawing.Point(153, 145) - Me.cmdChangeSettings.Name = "cmdChangeSettings" - Me.cmdChangeSettings.Size = New System.Drawing.Size(100, 23) - Me.cmdChangeSettings.TabIndex = 4 - Me.cmdChangeSettings.Text = "Change settings" - Me.cmdChangeSettings.UseVisualStyleBackColor = True - ' - 'txtFontFamily - ' - Me.txtFontFamily.Location = New System.Drawing.Point(96, 63) - Me.txtFontFamily.Name = "txtFontFamily" - Me.txtFontFamily.ReadOnly = True - Me.txtFontFamily.Size = New System.Drawing.Size(157, 20) - Me.txtFontFamily.TabIndex = 3 - ' - 'txtFontColor - ' - Me.txtFontColor.Location = New System.Drawing.Point(153, 106) - Me.txtFontColor.Name = "txtFontColor" - Me.txtFontColor.ReadOnly = True - Me.txtFontColor.Size = New System.Drawing.Size(100, 20) - Me.txtFontColor.TabIndex = 2 - ' - 'lblColorFont - ' - Me.lblColorFont.AutoSize = True - Me.lblColorFont.Location = New System.Drawing.Point(21, 109) - Me.lblColorFont.Name = "lblColorFont" - Me.lblColorFont.Size = New System.Drawing.Size(55, 13) - Me.lblColorFont.TabIndex = 1 - Me.lblColorFont.Text = "Font Color" - ' - 'lblFamilyFont - ' - Me.lblFamilyFont.AutoSize = True - Me.lblFamilyFont.Location = New System.Drawing.Point(21, 66) - Me.lblFamilyFont.Name = "lblFamilyFont" - Me.lblFamilyFont.Size = New System.Drawing.Size(60, 13) - Me.lblFamilyFont.TabIndex = 0 - Me.lblFamilyFont.Text = "Font Family" + 'tbpFormat + ' + Me.tbpFormat.Controls.Add(Me.thpOptions) + Me.tbpFormat.Location = New System.Drawing.Point(4, 22) + Me.tbpFormat.Name = "tbpFormat" + Me.tbpFormat.Padding = New System.Windows.Forms.Padding(3) + Me.tbpFormat.Size = New System.Drawing.Size(392, 233) + Me.tbpFormat.TabIndex = 2 + Me.tbpFormat.Text = "Format Options" + Me.tbpFormat.UseVisualStyleBackColor = True ' 'cmdOk ' @@ -236,14 +214,276 @@ Partial Class dlgOptions Me.cmdHelp.Text = "&Help" Me.cmdHelp.UseVisualStyleBackColor = True ' - 'lblTitle - ' - Me.lblTitle.AutoSize = True - Me.lblTitle.Location = New System.Drawing.Point(21, 13) - Me.lblTitle.Name = "lblTitle" - Me.lblTitle.Size = New System.Drawing.Size(223, 13) - Me.lblTitle.TabIndex = 5 - Me.lblTitle.Text = "Font and Color options for the Output Window" + 'thpOptions + ' + Me.thpOptions.Controls.Add(Me.tbpScript) + Me.thpOptions.Controls.Add(Me.tbpROutput) + Me.thpOptions.Controls.Add(Me.tbpComment) + Me.thpOptions.Location = New System.Drawing.Point(0, 0) + Me.thpOptions.Name = "thpOptions" + Me.thpOptions.SelectedIndex = 0 + Me.thpOptions.Size = New System.Drawing.Size(283, 227) + Me.thpOptions.TabIndex = 0 + ' + 'tbpScript + ' + Me.tbpScript.Controls.Add(Me.txtScriptSize) + Me.tbpScript.Controls.Add(Me.lblScriptSize) + Me.tbpScript.Controls.Add(Me.lblScriptTitle) + Me.tbpScript.Controls.Add(Me.cmdScriptChange) + Me.tbpScript.Controls.Add(Me.txtScriptFont) + Me.tbpScript.Controls.Add(Me.txtScriptColor) + Me.tbpScript.Controls.Add(Me.lblScriptColor) + Me.tbpScript.Controls.Add(Me.lblScriptFont) + Me.tbpScript.Location = New System.Drawing.Point(4, 22) + Me.tbpScript.Name = "tbpScript" + Me.tbpScript.Padding = New System.Windows.Forms.Padding(3) + Me.tbpScript.Size = New System.Drawing.Size(275, 201) + Me.tbpScript.TabIndex = 0 + Me.tbpScript.Text = "R Script" + Me.tbpScript.UseVisualStyleBackColor = True + ' + 'tbpROutput + ' + Me.tbpROutput.Controls.Add(Me.txtOutputSize) + Me.tbpROutput.Controls.Add(Me.lblOutputsize) + Me.tbpROutput.Controls.Add(Me.lblOutputTitle) + Me.tbpROutput.Controls.Add(Me.cmdOutputChange) + Me.tbpROutput.Controls.Add(Me.txtOutputFont) + Me.tbpROutput.Controls.Add(Me.txtOutputcolor) + Me.tbpROutput.Controls.Add(Me.lblOutputColor) + Me.tbpROutput.Controls.Add(Me.lblOutputFont) + Me.tbpROutput.Location = New System.Drawing.Point(4, 22) + Me.tbpROutput.Name = "tbpROutput" + Me.tbpROutput.Padding = New System.Windows.Forms.Padding(3) + Me.tbpROutput.Size = New System.Drawing.Size(275, 201) + Me.tbpROutput.TabIndex = 1 + Me.tbpROutput.Text = "R Output" + Me.tbpROutput.UseVisualStyleBackColor = True + ' + 'tbpComment + ' + Me.tbpComment.Controls.Add(Me.txtCommentsSize) + Me.tbpComment.Controls.Add(Me.lblCommentsSize) + Me.tbpComment.Controls.Add(Me.lblCommentsTitle) + Me.tbpComment.Controls.Add(Me.cmdCommentsChange) + Me.tbpComment.Controls.Add(Me.txtCommentsFont) + Me.tbpComment.Controls.Add(Me.txtCommentsColor) + Me.tbpComment.Controls.Add(Me.lblCommentsColor) + Me.tbpComment.Controls.Add(Me.lblCommentsFont) + Me.tbpComment.Location = New System.Drawing.Point(4, 22) + Me.tbpComment.Name = "tbpComment" + Me.tbpComment.Size = New System.Drawing.Size(275, 201) + Me.tbpComment.TabIndex = 2 + Me.tbpComment.Text = "Comments" + Me.tbpComment.UseVisualStyleBackColor = True + ' + 'lblScriptTitle + ' + Me.lblScriptTitle.AutoSize = True + Me.lblScriptTitle.Location = New System.Drawing.Point(10, 5) + Me.lblScriptTitle.Name = "lblScriptTitle" + Me.lblScriptTitle.Size = New System.Drawing.Size(187, 13) + Me.lblScriptTitle.TabIndex = 11 + Me.lblScriptTitle.Text = "Font and Color options for the R Script" + ' + 'cmdScriptChange + ' + Me.cmdScriptChange.Location = New System.Drawing.Point(142, 158) + Me.cmdScriptChange.Name = "cmdScriptChange" + Me.cmdScriptChange.Size = New System.Drawing.Size(100, 23) + Me.cmdScriptChange.TabIndex = 10 + Me.cmdScriptChange.Text = "Change settings" + Me.cmdScriptChange.UseVisualStyleBackColor = True + ' + 'txtScriptFont + ' + Me.txtScriptFont.Location = New System.Drawing.Point(85, 23) + Me.txtScriptFont.Name = "txtScriptFont" + Me.txtScriptFont.ReadOnly = True + Me.txtScriptFont.Size = New System.Drawing.Size(157, 20) + Me.txtScriptFont.TabIndex = 9 + ' + 'txtScriptColor + ' + Me.txtScriptColor.Location = New System.Drawing.Point(142, 66) + Me.txtScriptColor.Name = "txtScriptColor" + Me.txtScriptColor.ReadOnly = True + Me.txtScriptColor.Size = New System.Drawing.Size(100, 20) + Me.txtScriptColor.TabIndex = 8 + ' + 'lblScriptColor + ' + Me.lblScriptColor.AutoSize = True + Me.lblScriptColor.Location = New System.Drawing.Point(10, 69) + Me.lblScriptColor.Name = "lblScriptColor" + Me.lblScriptColor.Size = New System.Drawing.Size(55, 13) + Me.lblScriptColor.TabIndex = 7 + Me.lblScriptColor.Text = "Font Color" + ' + 'lblScriptFont + ' + Me.lblScriptFont.AutoSize = True + Me.lblScriptFont.Location = New System.Drawing.Point(10, 26) + Me.lblScriptFont.Name = "lblScriptFont" + Me.lblScriptFont.Size = New System.Drawing.Size(60, 13) + Me.lblScriptFont.TabIndex = 6 + Me.lblScriptFont.Text = "Font Family" + ' + 'lblOutputTitle + ' + Me.lblOutputTitle.AutoSize = True + Me.lblOutputTitle.Location = New System.Drawing.Point(7, 8) + Me.lblOutputTitle.Name = "lblOutputTitle" + Me.lblOutputTitle.Size = New System.Drawing.Size(192, 13) + Me.lblOutputTitle.TabIndex = 17 + Me.lblOutputTitle.Text = "Font and Color options for the R Output" + ' + 'cmdOutputChange + ' + Me.cmdOutputChange.Location = New System.Drawing.Point(139, 140) + Me.cmdOutputChange.Name = "cmdOutputChange" + Me.cmdOutputChange.Size = New System.Drawing.Size(100, 23) + Me.cmdOutputChange.TabIndex = 16 + Me.cmdOutputChange.Text = "Change settings" + Me.cmdOutputChange.UseVisualStyleBackColor = True + ' + 'txtOutputFont + ' + Me.txtOutputFont.Location = New System.Drawing.Point(82, 27) + Me.txtOutputFont.Name = "txtOutputFont" + Me.txtOutputFont.ReadOnly = True + Me.txtOutputFont.Size = New System.Drawing.Size(157, 20) + Me.txtOutputFont.TabIndex = 15 + ' + 'txtOutputcolor + ' + Me.txtOutputcolor.Location = New System.Drawing.Point(139, 70) + Me.txtOutputcolor.Name = "txtOutputcolor" + Me.txtOutputcolor.ReadOnly = True + Me.txtOutputcolor.Size = New System.Drawing.Size(100, 20) + Me.txtOutputcolor.TabIndex = 14 + ' + 'lblOutputColor + ' + Me.lblOutputColor.AutoSize = True + Me.lblOutputColor.Location = New System.Drawing.Point(7, 73) + Me.lblOutputColor.Name = "lblOutputColor" + Me.lblOutputColor.Size = New System.Drawing.Size(55, 13) + Me.lblOutputColor.TabIndex = 13 + Me.lblOutputColor.Text = "Font Color" + ' + 'lblOutputFont + ' + Me.lblOutputFont.AutoSize = True + Me.lblOutputFont.Location = New System.Drawing.Point(7, 30) + Me.lblOutputFont.Name = "lblOutputFont" + Me.lblOutputFont.Size = New System.Drawing.Size(60, 13) + Me.lblOutputFont.TabIndex = 12 + Me.lblOutputFont.Text = "Font Family" + ' + 'lblCommentsTitle + ' + Me.lblCommentsTitle.AutoSize = True + Me.lblCommentsTitle.Location = New System.Drawing.Point(7, 9) + Me.lblCommentsTitle.Name = "lblCommentsTitle" + Me.lblCommentsTitle.Size = New System.Drawing.Size(198, 13) + Me.lblCommentsTitle.TabIndex = 17 + Me.lblCommentsTitle.Text = "Font and Color options for the Comments" + ' + 'cmdCommentsChange + ' + Me.cmdCommentsChange.Location = New System.Drawing.Point(139, 141) + Me.cmdCommentsChange.Name = "cmdCommentsChange" + Me.cmdCommentsChange.Size = New System.Drawing.Size(100, 23) + Me.cmdCommentsChange.TabIndex = 16 + Me.cmdCommentsChange.Text = "Change settings" + Me.cmdCommentsChange.UseVisualStyleBackColor = True + ' + 'txtCommentsFont + ' + Me.txtCommentsFont.Location = New System.Drawing.Point(82, 26) + Me.txtCommentsFont.Name = "txtCommentsFont" + Me.txtCommentsFont.ReadOnly = True + Me.txtCommentsFont.Size = New System.Drawing.Size(157, 20) + Me.txtCommentsFont.TabIndex = 15 + ' + 'txtCommentsColor + ' + Me.txtCommentsColor.Location = New System.Drawing.Point(139, 69) + Me.txtCommentsColor.Name = "txtCommentsColor" + Me.txtCommentsColor.ReadOnly = True + Me.txtCommentsColor.Size = New System.Drawing.Size(100, 20) + Me.txtCommentsColor.TabIndex = 14 + ' + 'lblCommentsColor + ' + Me.lblCommentsColor.AutoSize = True + Me.lblCommentsColor.Location = New System.Drawing.Point(7, 72) + Me.lblCommentsColor.Name = "lblCommentsColor" + Me.lblCommentsColor.Size = New System.Drawing.Size(55, 13) + Me.lblCommentsColor.TabIndex = 13 + Me.lblCommentsColor.Text = "Font Color" + ' + 'lblCommentsFont + ' + Me.lblCommentsFont.AutoSize = True + Me.lblCommentsFont.Location = New System.Drawing.Point(7, 29) + Me.lblCommentsFont.Name = "lblCommentsFont" + Me.lblCommentsFont.Size = New System.Drawing.Size(60, 13) + Me.lblCommentsFont.TabIndex = 12 + Me.lblCommentsFont.Text = "Font Family" + ' + 'lblScriptSize + ' + Me.lblScriptSize.AutoSize = True + Me.lblScriptSize.Location = New System.Drawing.Point(10, 107) + Me.lblScriptSize.Name = "lblScriptSize" + Me.lblScriptSize.Size = New System.Drawing.Size(51, 13) + Me.lblScriptSize.TabIndex = 12 + Me.lblScriptSize.Text = "Font Size" + ' + 'txtScriptSize + ' + Me.txtScriptSize.Location = New System.Drawing.Point(142, 100) + Me.txtScriptSize.Name = "txtScriptSize" + Me.txtScriptSize.ReadOnly = True + Me.txtScriptSize.Size = New System.Drawing.Size(100, 20) + Me.txtScriptSize.TabIndex = 13 + ' + 'txtOutputSize + ' + Me.txtOutputSize.Location = New System.Drawing.Point(139, 107) + Me.txtOutputSize.Name = "txtOutputSize" + Me.txtOutputSize.ReadOnly = True + Me.txtOutputSize.Size = New System.Drawing.Size(100, 20) + Me.txtOutputSize.TabIndex = 19 + ' + 'lblOutputsize + ' + Me.lblOutputsize.AutoSize = True + Me.lblOutputsize.Location = New System.Drawing.Point(7, 114) + Me.lblOutputsize.Name = "lblOutputsize" + Me.lblOutputsize.Size = New System.Drawing.Size(51, 13) + Me.lblOutputsize.TabIndex = 18 + Me.lblOutputsize.Text = "Font Size" + ' + 'txtCommentsSize + ' + Me.txtCommentsSize.Location = New System.Drawing.Point(140, 102) + Me.txtCommentsSize.Name = "txtCommentsSize" + Me.txtCommentsSize.ReadOnly = True + Me.txtCommentsSize.Size = New System.Drawing.Size(100, 20) + Me.txtCommentsSize.TabIndex = 19 + ' + 'lblCommentsSize + ' + Me.lblCommentsSize.AutoSize = True + Me.lblCommentsSize.Location = New System.Drawing.Point(8, 109) + Me.lblCommentsSize.Name = "lblCommentsSize" + Me.lblCommentsSize.Size = New System.Drawing.Size(51, 13) + Me.lblCommentsSize.TabIndex = 18 + Me.lblCommentsSize.Text = "Font Size" ' 'dlgOptions ' @@ -265,8 +505,14 @@ Partial Class dlgOptions Me.tbpLanguageSettings.PerformLayout() Me.tbpComments.ResumeLayout(False) Me.tbpComments.PerformLayout() - Me.tbpOutput.ResumeLayout(False) - Me.tbpOutput.PerformLayout() + Me.tbpFormat.ResumeLayout(False) + Me.thpOptions.ResumeLayout(False) + Me.tbpScript.ResumeLayout(False) + Me.tbpScript.PerformLayout() + Me.tbpROutput.ResumeLayout(False) + Me.tbpROutput.PerformLayout() + Me.tbpComment.ResumeLayout(False) + Me.tbpComment.PerformLayout() Me.ResumeLayout(False) End Sub @@ -282,11 +528,33 @@ Partial Class dlgOptions Friend WithEvents txtComment As TextBox Friend WithEvents lblComment As Label Friend WithEvents cmdHelp As Button - Friend WithEvents tbpOutput As TabPage - Friend WithEvents cmdChangeSettings As Button - Friend WithEvents txtFontFamily As TextBox - Friend WithEvents txtFontColor As TextBox - Friend WithEvents lblColorFont As Label - Friend WithEvents lblFamilyFont As Label - Friend WithEvents lblTitle As Label + Friend WithEvents tbpFormat As TabPage + Friend WithEvents thpOptions As TabControl + Friend WithEvents tbpScript As TabPage + Friend WithEvents txtScriptSize As TextBox + Friend WithEvents lblScriptSize As Label + Friend WithEvents lblScriptTitle As Label + Friend WithEvents cmdScriptChange As Button + Friend WithEvents txtScriptFont As TextBox + Friend WithEvents txtScriptColor As TextBox + Friend WithEvents lblScriptColor As Label + Friend WithEvents lblScriptFont As Label + Friend WithEvents tbpROutput As TabPage + Friend WithEvents txtOutputSize As TextBox + Friend WithEvents lblOutputsize As Label + Friend WithEvents lblOutputTitle As Label + Friend WithEvents cmdOutputChange As Button + Friend WithEvents txtOutputFont As TextBox + Friend WithEvents txtOutputcolor As TextBox + Friend WithEvents lblOutputColor As Label + Friend WithEvents lblOutputFont As Label + Friend WithEvents tbpComment As TabPage + Friend WithEvents txtCommentsSize As TextBox + Friend WithEvents lblCommentsSize As Label + Friend WithEvents lblCommentsTitle As Label + Friend WithEvents cmdCommentsChange As Button + Friend WithEvents txtCommentsFont As TextBox + Friend WithEvents txtCommentsColor As TextBox + Friend WithEvents lblCommentsColor As Label + Friend WithEvents lblCommentsFont As Label End Class diff --git a/instat/dlgOptions.vb b/instat/dlgOptions.vb index ccde7b3caa5..41691afe2c6 100644 --- a/instat/dlgOptions.vb +++ b/instat/dlgOptions.vb @@ -21,7 +21,8 @@ Imports instat.Translations Public Class dlgOptions Public strComment As String = "code generated by the dialog" Public strCurrLanguage As String - + 'Define the Fonts dialog (only one) + Dim dlgFont As New FontDialog Private Sub dlgOptions_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) @@ -41,9 +42,6 @@ Public Class dlgOptions End Select cmdApply.Enabled = False cmdOk.Enabled = False - 'Formatting - txtFontFamily.Text = frmCommand.txtcommand.Font.Name - txtFontColor.Text = frmCommand.txtcommand.BackColor.Name End Sub Private Sub cmdCancel_Click(sender As Object, e As EventArgs) Handles cmdCancel.Click Me.Close() @@ -126,16 +124,36 @@ Public Class dlgOptions cmdOk.Enabled = True End Sub - Private Sub cmdChangeSettings_Click(sender As Object, e As EventArgs) Handles cmdChangeSettings.Click - Dim dlgFont As New FontDialog + Private Sub cmdScriptChange_Click(sender As Object, e As EventArgs) Handles cmdScriptChange.Click dlgFont.ShowColor = True dlgFont.MaxSize = 15 dlgFont.MinSize = 8 + If dlgFont.ShowDialog = DialogResult.OK Then + txtScriptFont.Text = dlgFont.Font.FontFamily.Name + txtScriptColor.Text = dlgFont.Color.Name + txtScriptSize.Text = dlgFont.Font.Size + End If + End Sub + Private Sub cmdOutputChange_Click(sender As Object, e As EventArgs) Handles cmdOutputChange.Click + dlgFont.ShowColor = True + dlgFont.MaxSize = 15 + dlgFont.MinSize = 8 If dlgFont.ShowDialog = DialogResult.OK Then - txtFontFamily.Text = dlgFont.Font.FontFamily.Name - txtFontColor.Text = dlgFont.Color.Name + txtOutputFont.Text = dlgFont.Font.FontFamily.Name + txtOutputcolor.Text = dlgFont.Color.Name + txtOutputSize.Text = dlgFont.Font.Size End If + End Sub + Private Sub cmdCommentsChange_Click(sender As Object, e As EventArgs) Handles cmdCommentsChange.Click + dlgFont.ShowColor = True + dlgFont.MaxSize = 15 + dlgFont.MinSize = 8 + If dlgFont.ShowDialog = DialogResult.OK Then + txtCommentsFont.Text = dlgFont.Font.FontFamily.Name + txtCommentsColor.Text = dlgFont.Color.Name + txtCommentsSize.Text = dlgFont.Font.Size + End If End Sub End Class \ No newline at end of file diff --git a/instat/frmEditor.vb b/instat/frmEditor.vb index d1406d0bcb9..ac68a5da979 100644 --- a/instat/frmEditor.vb +++ b/instat/frmEditor.vb @@ -28,6 +28,10 @@ Public Class frmEditor frmMain.clsGrids.SetData(grdData) grdData.Visible = False autoTranslate(Me) + 'Disable Autoformat cell + 'This needs to be added at the part when we are writing data to the grid, not here + 'Needs discussion, with this the grid can show NA's + grdData.SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_AutoFormatCell, False) End Sub ''' ''' Hides the form when it is closed and not exiting it. From 0fb0c4db3eb8ae3c66ef1b836acb313fb1de89ae Mon Sep 17 00:00:00 2001 From: deaspo Date: Thu, 11 Feb 2016 15:58:07 +0300 Subject: [PATCH 2/7] Added the sync between the dlgOptions and Rlink --- instat/clsRLink.vb | 42 +++++++++++++++++++++++++++++++----------- instat/dlgOptions.vb | 20 +++++++++++++++++++- 2 files changed, 50 insertions(+), 12 deletions(-) diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index b9a1a5b4e1d..4f409174371 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -30,10 +30,28 @@ Public Class RLink Public bClimateObjectExists As Boolean = False Public bInstatObjectExists As Boolean = False Public bClimsoftLinkExists As Boolean = False - + 'sets the font for the strScript + Public fScript As Font = New Font(txtOutput.Font.FontFamily, txtOutput.Font.Size) + Public clrScript As Color = Color.Black + 'sets the font for the strOutput + Public fOutput As Font = New Font(txtOutput.Font.FontFamily, txtOutput.Font.Size) + Public clrOutput As Color = Color.Blue + 'sets the font for the Comments + 'ToDo + Public Sub New(Optional bWithInstatObj As Boolean = False, Optional bWithClimsoft As Boolean = False) End Sub + Public Sub setFormatOutput(tempFont As Font, tempColor As Color) + fOutput = tempFont + clrOutput = tempColor + End Sub + + Public Sub setFormatScript(tempFont As Font, tempColor As Color) + fScript = tempFont + clrScript = tempColor + End Sub + Public Sub SetOutput(tempOutput As RichTextBox) txtOutput = tempOutput bOutput = True @@ -108,7 +126,7 @@ Public Class RLink If bOutput Then 'input format here - AppendText(txtOutput, Color.Black, strScript & vbCrLf) + AppendText(txtOutput, clrScript, fScript, strScript & vbCrLf) End If If bReturnOutput = 0 Then clsEngine.Evaluate(strScript) @@ -130,24 +148,26 @@ Public Class RLink If bOutput Then 'txtOutput.Text = txtOutput.Text & strOutput 'output format here - AppendText(txtOutput, Color.Blue, strOutput) + AppendText(txtOutput, clrOutput, fOutput, strOutput) End If Catch MsgBox(strScript) End Try frmMain.clsGrids.UpdateGrids() End Sub - Private Sub AppendText(box As RichTextBox, color As Color, text As String) - Dim start As Integer = box.TextLength + + Private Sub AppendText(box As RichTextBox, color As Color, font As Font, text As String) + Dim iStart As Integer = box.TextLength + Dim iEnd As Integer + box.AppendText(text) - Dim [end] As Integer = box.TextLength + iEnd = box.TextLength ' Textbox may transform chars, so (end-start) != text.Length - box.[Select](start, [end] - start) - If True Then - box.SelectionColor = color - 'To set Font and Font Size after Discussion - End If + box.[Select](iStart, iEnd - iStart) + box.SelectionColor = color + box.SelectionFont = font + 'TClears selection box.SelectionLength = 0 ' clear End Sub diff --git a/instat/dlgOptions.vb b/instat/dlgOptions.vb index 41691afe2c6..73ee7086310 100644 --- a/instat/dlgOptions.vb +++ b/instat/dlgOptions.vb @@ -41,7 +41,17 @@ Public Class dlgOptions rdoKiswahili.Checked = True End Select cmdApply.Enabled = False - cmdOk.Enabled = False + 'cmdOk.Enabled = False + 'Loads the current font and color + txtScriptFont.Text = frmMain.clsRLink.fScript.FontFamily.Name + txtScriptColor.Text = frmMain.clsRLink.clrScript.Name + txtScriptColor.ForeColor = frmMain.clsRLink.clrScript + txtScriptSize.Text = frmMain.clsRLink.fScript.Size + 'For the output + txtOutputFont.Text = frmMain.clsRLink.fScript.FontFamily.Name + txtOutputcolor.Text = frmMain.clsRLink.clrScript.Name + txtOutputcolor.ForeColor = frmMain.clsRLink.clrScript + txtOutputSize.Text = frmMain.clsRLink.fScript.Size End Sub Private Sub cmdCancel_Click(sender As Object, e As EventArgs) Handles cmdCancel.Click Me.Close() @@ -49,6 +59,8 @@ Public Class dlgOptions Private Sub cmdOk_Click(sender As Object, e As EventArgs) Handles cmdOk.Click cmdApply_Click(sender, e) + frmMain.clsRLink.setFormatOutput(txtOutputFont.Font, txtOutputcolor.ForeColor) + frmMain.clsRLink.setFormatScript(txtScriptFont.Font, txtScriptColor.ForeColor) Me.Close() End Sub @@ -130,8 +142,11 @@ Public Class dlgOptions dlgFont.MinSize = 8 If dlgFont.ShowDialog = DialogResult.OK Then txtScriptFont.Text = dlgFont.Font.FontFamily.Name + txtScriptColor.ForeColor = dlgFont.Color + txtScriptFont.Font = dlgFont.Font txtScriptColor.Text = dlgFont.Color.Name txtScriptSize.Text = dlgFont.Font.Size + dlgFont.Reset() End If End Sub @@ -141,8 +156,11 @@ Public Class dlgOptions dlgFont.MinSize = 8 If dlgFont.ShowDialog = DialogResult.OK Then txtOutputFont.Text = dlgFont.Font.FontFamily.Name + txtOutputFont.Font = dlgFont.Font txtOutputcolor.Text = dlgFont.Color.Name + txtOutputcolor.ForeColor = dlgFont.Color txtOutputSize.Text = dlgFont.Font.Size + dlgFont.Reset() End If End Sub From f1982a3eca64f6db8a1c385c87658a57ba162f4e Mon Sep 17 00:00:00 2001 From: deaspo Date: Thu, 11 Feb 2016 18:14:12 +0300 Subject: [PATCH 3/7] Added the formatting for comments also. --- instat/clsRLink.vb | 18 +++++++++++++----- instat/dlgOptions.vb | 19 ++++++++++++++----- instat/ucrButtons.vb | 5 +++-- 3 files changed, 30 insertions(+), 12 deletions(-) diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index 4f409174371..cf522ef1d48 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -37,7 +37,8 @@ Public Class RLink Public fOutput As Font = New Font(txtOutput.Font.FontFamily, txtOutput.Font.Size) Public clrOutput As Color = Color.Blue 'sets the font for the Comments - 'ToDo + Public fComments As Font = New Font(txtOutput.Font.FontFamily, txtOutput.Font.Size) + Public clrComments As Color = Color.Brown Public Sub New(Optional bWithInstatObj As Boolean = False, Optional bWithClimsoft As Boolean = False) End Sub @@ -52,6 +53,11 @@ Public Class RLink clrScript = tempColor End Sub + Public Sub setFormatComment(tempFont As Font, tempColor As Color) + fComments = tempFont + clrComments = tempColor + End Sub + Public Sub SetOutput(tempOutput As RichTextBox) txtOutput = tempOutput bOutput = True @@ -112,7 +118,7 @@ Public Class RLink Return lstNextDefaults End Function - Public Sub RunScript(strScript As String, Optional bReturnOutput As Integer = 0) + Public Sub RunScript(strScript As String, Optional bReturnOutput As Integer = 0, Optional strComment As String = "") Dim strCapturedScript As String Dim temp As RDotNet.SymbolicExpression Dim strTemp As String @@ -120,12 +126,14 @@ Public Class RLink Dim strSplitScript As String strOutput = "" Try - If bLog Then + If bLog And strComment <> "" Then + txtLog.Text = txtLog.Text & strComment & vbCrLf txtLog.Text = txtLog.Text & strScript & vbCrLf End If If bOutput Then - - 'input format here + If strComment <> "" Then + AppendText(txtOutput, clrComments, fComments, strComment & vbCrLf) + End If AppendText(txtOutput, clrScript, fScript, strScript & vbCrLf) End If If bReturnOutput = 0 Then diff --git a/instat/dlgOptions.vb b/instat/dlgOptions.vb index 73ee7086310..be308d6c08c 100644 --- a/instat/dlgOptions.vb +++ b/instat/dlgOptions.vb @@ -42,16 +42,22 @@ Public Class dlgOptions End Select cmdApply.Enabled = False 'cmdOk.Enabled = False - 'Loads the current font and color + 'Loads the current font and color for the Script txtScriptFont.Text = frmMain.clsRLink.fScript.FontFamily.Name txtScriptColor.Text = frmMain.clsRLink.clrScript.Name txtScriptColor.ForeColor = frmMain.clsRLink.clrScript txtScriptSize.Text = frmMain.clsRLink.fScript.Size 'For the output - txtOutputFont.Text = frmMain.clsRLink.fScript.FontFamily.Name - txtOutputcolor.Text = frmMain.clsRLink.clrScript.Name - txtOutputcolor.ForeColor = frmMain.clsRLink.clrScript - txtOutputSize.Text = frmMain.clsRLink.fScript.Size + txtOutputFont.Text = frmMain.clsRLink.fOutput.FontFamily.Name + txtOutputcolor.Text = frmMain.clsRLink.clrOutput.Name + txtOutputcolor.ForeColor = frmMain.clsRLink.clrOutput + txtOutputSize.Text = frmMain.clsRLink.fOutput.Size + 'For the Comments + txtCommentsFont.Text = frmMain.clsRLink.fComments.FontFamily.Name + txtCommentsColor.Text = frmMain.clsRLink.clrComments.Name + txtCommentsColor.ForeColor = frmMain.clsRLink.clrComments + txtCommentsSize.Text = frmMain.clsRLink.fComments.Size + End Sub Private Sub cmdCancel_Click(sender As Object, e As EventArgs) Handles cmdCancel.Click Me.Close() @@ -61,6 +67,7 @@ Public Class dlgOptions cmdApply_Click(sender, e) frmMain.clsRLink.setFormatOutput(txtOutputFont.Font, txtOutputcolor.ForeColor) frmMain.clsRLink.setFormatScript(txtScriptFont.Font, txtScriptColor.ForeColor) + frmMain.clsRLink.setFormatComment(txtCommentsFont.Font, txtCommentsColor.ForeColor) Me.Close() End Sub @@ -170,7 +177,9 @@ Public Class dlgOptions dlgFont.MinSize = 8 If dlgFont.ShowDialog = DialogResult.OK Then txtCommentsFont.Text = dlgFont.Font.FontFamily.Name + txtCommentsFont.Font = dlgFont.Font txtCommentsColor.Text = dlgFont.Color.Name + txtCommentsColor.ForeColor = dlgFont.Color txtCommentsSize.Text = dlgFont.Font.Size End If End Sub diff --git a/instat/ucrButtons.vb b/instat/ucrButtons.vb index e5ca191bfa7..4bde7a1a4b8 100644 --- a/instat/ucrButtons.vb +++ b/instat/ucrButtons.vb @@ -15,10 +15,11 @@ Public Class ucrButtons Public Event ClickReset(sender As Object, e As EventArgs) Private Sub cmdOk_Click(sender As Object, e As EventArgs) Handles cmdOk.Click + Dim strComments As String = "" If chkComment.Checked Then - clsRsyntax.strScript = "# " & txtComment.Text & vbCrLf + strComments = txtComment.Text End If - frmMain.clsRLink.RunScript(clsRsyntax.GetScript(), clsRsyntax.iCallType) + frmMain.clsRLink.RunScript(clsRsyntax.GetScript(), clsRsyntax.iCallType, strComment:=strComments) RaiseEvent ClickOk(sender, e) Me.ParentForm.Hide() From a92d4d9abe9ebe0f53a77c6a39a5212a3377a846 Mon Sep 17 00:00:00 2001 From: max Date: Thu, 11 Feb 2016 19:14:24 +0300 Subject: [PATCH 4/7] First ever GGPlot.... Box plot --- instat/clsRSyntax.vb | 35 +++++++++----- instat/dlgBoxPlot.designer.vb | 49 ++++++++++++++----- instat/dlgBoxPlot.vb | 89 ++++++++++++++++++++++++++++------- 3 files changed, 131 insertions(+), 42 deletions(-) diff --git a/instat/clsRSyntax.vb b/instat/clsRSyntax.vb index 57b0efff29d..c19c94face7 100644 --- a/instat/clsRSyntax.vb +++ b/instat/clsRSyntax.vb @@ -34,11 +34,8 @@ Public Class RSyntax bUseBaseOperator = False End Sub - Public Sub SetOperation(strOp As String, Optional ByRef clsROp As ROperator = Nothing) - If clsROp Is Nothing Then - clsROp = clsBaseOperator - End If - clsROp.SetOperation(strOp) + Public Sub SetOperation(strOp As String) + clsBaseOperator.SetOperation(strOp) bUseBaseFunction = False bUseBaseOperator = True End Sub @@ -60,6 +57,10 @@ Public Class RSyntax clsBaseFunction.AddParameter(clsRParam) End Sub + Public Sub SetOperatorParameter(bSetLeftNotRight As Boolean, Optional clsParam As RParameter = Nothing, Optional clsRFunc As RFunction = Nothing, Optional clsOp As ROperator = Nothing) + clsBaseOperator.SetParameter(bSetLeftNotRight, clsParam, clsRFunc, clsOp) + End Sub + Public Sub RemoveParameter(strParameterName As String, Optional ByRef clsFunction As RFunction = Nothing) Dim clsParam As New RParameter @@ -79,18 +80,26 @@ Public Class RSyntax Public Function GetScript(Optional ByRef clsFunction As RFunction = Nothing, Optional bExcludeAssignedFunctionOutput As Boolean = True) As String - Dim strTemp As String + Dim strTemp As String = "" If IsNothing(clsFunction) Then - clsFunction = clsBaseFunction - End If - - strTemp = clsFunction.ToScript(strScript) - If bExcludeAssignedFunctionOutput And clsFunction.bIsAssigned Then - Return strScript + If bUseBaseFunction Then + clsFunction = clsBaseFunction + strTemp = clsBaseFunction.ToScript(strScript) + End If + If bUseBaseOperator Then + strTemp = clsBaseOperator.ToScript(strScript) + End If Else - Return strScript & strTemp + strTemp = clsFunction.ToScript(strScript) + End If + If bUseBaseFunction Then + If bExcludeAssignedFunctionOutput And clsFunction.bIsAssigned Then + Return strScript + Exit Function + End If End If + Return strScript & strTemp End Function diff --git a/instat/dlgBoxPlot.designer.vb b/instat/dlgBoxPlot.designer.vb index b2298ea6aeb..1fd8beffef7 100644 --- a/instat/dlgBoxPlot.designer.vb +++ b/instat/dlgBoxPlot.designer.vb @@ -28,10 +28,12 @@ Partial Class dlgBoxplot Me.chkVariableWidth = New System.Windows.Forms.CheckBox() Me.chkHorizontalBoxplot = New System.Windows.Forms.CheckBox() Me.chkNotchedBoxplot = New System.Windows.Forms.CheckBox() - Me.ucrReceiverDataToPlot = New instat.ucrReceiverMultiple() Me.ucrByFactorsReceiver = New instat.ucrReceiverSingle() Me.lblByFactors = New System.Windows.Forms.Label() Me.ucrSelectorBoxPlot = New instat.ucrSelectorByDataFrameAddRemove() + Me.ucrSecondFactorReceiver = New instat.ucrReceiverSingle() + Me.lblBySecondFactor = New System.Windows.Forms.Label() + Me.ucrYvariableReceiver = New instat.ucrReceiverSingle() Me.SuspendLayout() ' 'ucrBase @@ -53,7 +55,7 @@ Partial Class dlgBoxplot ' 'cmdOptions ' - Me.cmdOptions.Location = New System.Drawing.Point(274, 245) + Me.cmdOptions.Location = New System.Drawing.Point(276, 208) Me.cmdOptions.Name = "cmdOptions" Me.cmdOptions.Size = New System.Drawing.Size(75, 23) Me.cmdOptions.TabIndex = 14 @@ -94,16 +96,9 @@ Partial Class dlgBoxplot Me.chkNotchedBoxplot.Text = "Notched boxplot" Me.chkNotchedBoxplot.UseVisualStyleBackColor = True ' - 'ucrReceiverDataToPlot - ' - Me.ucrReceiverDataToPlot.Location = New System.Drawing.Point(266, 74) - Me.ucrReceiverDataToPlot.Name = "ucrReceiverDataToPlot" - Me.ucrReceiverDataToPlot.Size = New System.Drawing.Size(121, 133) - Me.ucrReceiverDataToPlot.TabIndex = 18 - ' 'ucrByFactorsReceiver ' - Me.ucrByFactorsReceiver.Location = New System.Drawing.Point(271, 213) + Me.ucrByFactorsReceiver.Location = New System.Drawing.Point(276, 120) Me.ucrByFactorsReceiver.Name = "ucrByFactorsReceiver" Me.ucrByFactorsReceiver.Size = New System.Drawing.Size(126, 26) Me.ucrByFactorsReceiver.TabIndex = 19 @@ -111,7 +106,7 @@ Partial Class dlgBoxplot 'lblByFactors ' Me.lblByFactors.AutoSize = True - Me.lblByFactors.Location = New System.Drawing.Point(263, 194) + Me.lblByFactors.Location = New System.Drawing.Point(278, 104) Me.lblByFactors.Name = "lblByFactors" Me.lblByFactors.Size = New System.Drawing.Size(60, 13) Me.lblByFactors.TabIndex = 20 @@ -125,15 +120,41 @@ Partial Class dlgBoxplot Me.ucrSelectorBoxPlot.Size = New System.Drawing.Size(230, 215) Me.ucrSelectorBoxPlot.TabIndex = 21 ' + 'ucrSecondFactorReceiver + ' + Me.ucrSecondFactorReceiver.Location = New System.Drawing.Point(276, 176) + Me.ucrSecondFactorReceiver.Name = "ucrSecondFactorReceiver" + Me.ucrSecondFactorReceiver.Size = New System.Drawing.Size(106, 26) + Me.ucrSecondFactorReceiver.TabIndex = 22 + ' + 'lblBySecondFactor + ' + Me.lblBySecondFactor.AutoSize = True + Me.lblBySecondFactor.Location = New System.Drawing.Point(278, 158) + Me.lblBySecondFactor.Name = "lblBySecondFactor" + Me.lblBySecondFactor.Size = New System.Drawing.Size(92, 13) + Me.lblBySecondFactor.TabIndex = 20 + Me.lblBySecondFactor.Tag = "By_Second_Factor" + Me.lblBySecondFactor.Text = "By Second Factor" + ' + 'ucrYvariableReceiver + ' + Me.ucrYvariableReceiver.Location = New System.Drawing.Point(276, 75) + Me.ucrYvariableReceiver.Name = "ucrYvariableReceiver" + Me.ucrYvariableReceiver.Size = New System.Drawing.Size(106, 26) + Me.ucrYvariableReceiver.TabIndex = 23 + ' 'dlgBoxplot ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(412, 368) + Me.Controls.Add(Me.ucrYvariableReceiver) + Me.Controls.Add(Me.ucrSecondFactorReceiver) Me.Controls.Add(Me.ucrSelectorBoxPlot) + Me.Controls.Add(Me.lblBySecondFactor) Me.Controls.Add(Me.lblByFactors) Me.Controls.Add(Me.ucrByFactorsReceiver) - Me.Controls.Add(Me.ucrReceiverDataToPlot) Me.Controls.Add(Me.chkNotchedBoxplot) Me.Controls.Add(Me.chkHorizontalBoxplot) Me.Controls.Add(Me.chkVariableWidth) @@ -158,8 +179,10 @@ Partial Class dlgBoxplot Friend WithEvents chkVariableWidth As CheckBox Friend WithEvents chkHorizontalBoxplot As CheckBox Friend WithEvents chkNotchedBoxplot As CheckBox - Friend WithEvents ucrReceiverDataToPlot As ucrReceiverMultiple Friend WithEvents ucrByFactorsReceiver As ucrReceiverSingle Friend WithEvents lblByFactors As Label Friend WithEvents ucrSelectorBoxPlot As ucrSelectorByDataFrameAddRemove + Friend WithEvents ucrSecondFactorReceiver As ucrReceiverSingle + Friend WithEvents lblBySecondFactor As Label + Friend WithEvents ucrYvariableReceiver As ucrReceiverSingle End Class diff --git a/instat/dlgBoxPlot.vb b/instat/dlgBoxPlot.vb index 54c4998fb79..a74fff7b84b 100644 --- a/instat/dlgBoxPlot.vb +++ b/instat/dlgBoxPlot.vb @@ -15,29 +15,41 @@ ' along with this program. If not, see . Imports instat.Translations Public Class dlgBoxplot + Private clsRggplotFunction As New RFunction + Private clsRgeom_boxplotFunction As New RFunction + Private clsRaesFunction As New RFunction Private Sub dlgBoxPlot_Load(sender As Object, e As EventArgs) Handles MyBase.Load - ucrBase.clsRsyntax.SetFunction("ggplot") + ucrBase.clsRsyntax.SetOperation("+") + clsRggplotFunction.SetRCommand("ggplot") + clsRgeom_boxplotFunction.SetRCommand("geom_boxplot") + clsRaesFunction.SetRCommand("aes") + clsRaesFunction.AddParameter("x", "") ' Empty string is default x value in case no factor is chosen + clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRaesFunction) + SetOperator() ucrBase.clsRsyntax.iCallType = 0 - ucrReceiverDataToPlot.Selector = ucrSelectorBoxPlot - ucrReceiverDataToPlot.SetMeAsReceiver() + ucrYvariableReceiver.Selector = ucrSelectorBoxPlot + ucrYvariableReceiver.SetMeAsReceiver() + ucrByFactorsReceiver.Selector = ucrSelectorBoxPlot + ucrSecondFactorReceiver.Selector = ucrSelectorBoxPlot autoTranslate(Me) ucrBase.OKEnabled(False) End Sub - Private Sub ucrReceiveBoxplotVariable_Enter(sender As Object, e As EventArgs) - ucrReceiverDataToPlot.SetMeAsReceiver() + Private Sub SetOperator() + Dim clsTempOp As New ROperator + Dim clsTempRFunc As New RFunction + If chkHorizontalBoxplot.Checked Then + clsTempOp.SetOperation("+") + clsTempOp.SetParameter(True, clsRFunc:=clsRggplotFunction) + clsTempOp.SetParameter(False, clsRFunc:=clsRgeom_boxplotFunction) + clsTempRFunc.SetRCommand("coord_flip") + ucrBase.clsRsyntax.SetOperatorParameter(True, clsOp:=clsTempOp) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsTempRFunc) + Else + ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRggplotFunction) + ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRgeom_boxplotFunction) + End If End Sub - - Private Sub ucrReceiveBoxplotVariable_ValueChanged(sender As Object, e As EventArgs) - 'TODO fix this - 'If Not (ucrReceiverDataToPlot.lstSelectedVariables.SelectedItem = "") Then - ' ucrBase.clsRsyntax.AddParameter("x", clsRFunctionParameter:=ucrReceiverDataToPlot.GetVariables()) - ' ucrBase.OKEnabled(True) - 'Else - ' ucrBase.OKEnabled(False) - 'End If - End Sub - Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click sdgPlots.ShowDialog() End Sub @@ -45,4 +57,49 @@ Public Class dlgBoxplot Private Sub ucrByFactorsReceiver_Enter(sender As Object, e As EventArgs) Handles ucrByFactorsReceiver.Enter ucrByFactorsReceiver.SetMeAsReceiver() End Sub + + Private Sub ucrSelectorBoxPlot_DataFrameChanged(sender As Object, e As EventArgs) Handles ucrSelectorBoxPlot.DataFrameChanged + clsRggplotFunction.AddParameter("data", clsRFunctionParameter:=ucrSelectorBoxPlot.ucrAvailableDataFrames.clsCurrDataFrame) + End Sub + + Private Sub ucrByFactorsReceiver_Leave(sender As Object, e As EventArgs) Handles ucrByFactorsReceiver.Leave + clsRaesFunction.AddParameter("x", ucrByFactorsReceiver.GetVariableNames(False)) + End Sub + + Private Sub chkHorizontalBoxplot_CheckedChanged(sender As Object, e As EventArgs) Handles chkHorizontalBoxplot.CheckedChanged + SetOperator() + End Sub + + Private Sub chkNotchedBoxplot_CheckedChanged(sender As Object, e As EventArgs) Handles chkNotchedBoxplot.CheckedChanged + If chkNotchedBoxplot.Checked Then + clsRgeom_boxplotFunction.AddParameter("notch", "TRUE") + Else + clsRgeom_boxplotFunction.RemoveParameterByName("notch") + End If + End Sub + + Private Sub chkVariableWidth_CheckedChanged(sender As Object, e As EventArgs) Handles chkVariableWidth.CheckedChanged + If chkVariableWidth.Checked Then + clsRgeom_boxplotFunction.AddParameter("varwidth", "TRUE") + Else + clsRgeom_boxplotFunction.RemoveParameterByName("varwidth") + End If + End Sub + + Private Sub ucrYvariableReceiver_Leave(sender As Object, e As EventArgs) Handles ucrYvariableReceiver.Leave + If Not (ucrYvariableReceiver.GetVariableNames = "") Then + clsRaesFunction.AddParameter("y", ucrYvariableReceiver.GetVariableNames(False)) + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + End Sub + + Private Sub ucrSecondFactorReceiver_Leave(sender As Object, e As EventArgs) Handles ucrSecondFactorReceiver.Leave + clsRaesFunction.AddParameter("fill", ucrSecondFactorReceiver.GetVariableNames(False)) + End Sub + + Private Sub ucrSecondFactorReceiver_Enter(sender As Object, e As EventArgs) Handles ucrSecondFactorReceiver.Enter + ucrSecondFactorReceiver.SetMeAsReceiver() + End Sub End Class \ No newline at end of file From 0a9ef54a81083e624d35646abcf43036b658106e Mon Sep 17 00:00:00 2001 From: max Date: Thu, 11 Feb 2016 20:00:15 +0300 Subject: [PATCH 5/7] Removed the waiting cursor to default cursor --- instat/dlgBoxPlot.designer.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/instat/dlgBoxPlot.designer.vb b/instat/dlgBoxPlot.designer.vb index 1fd8beffef7..dee6cf8b57a 100644 --- a/instat/dlgBoxPlot.designer.vb +++ b/instat/dlgBoxPlot.designer.vb @@ -161,7 +161,7 @@ Partial Class dlgBoxplot Me.Controls.Add(Me.cmdOptions) Me.Controls.Add(Me.lblYVarToPlot) Me.Controls.Add(Me.ucrBase) - Me.Cursor = System.Windows.Forms.Cursors.WaitCursor + Me.Cursor = System.Windows.Forms.Cursors.Default Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "dlgBoxplot" From 2656a04faf16c3c0c31f883b9af1eb05abc4ae2d Mon Sep 17 00:00:00 2001 From: deaspo Date: Thu, 11 Feb 2016 20:05:57 +0300 Subject: [PATCH 6/7] Changed the default comment color and added # --- instat/clsRLink.vb | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index cf522ef1d48..ea9eb309737 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -38,7 +38,7 @@ Public Class RLink Public clrOutput As Color = Color.Blue 'sets the font for the Comments Public fComments As Font = New Font(txtOutput.Font.FontFamily, txtOutput.Font.Size) - Public clrComments As Color = Color.Brown + Public clrComments As Color = Color.Green Public Sub New(Optional bWithInstatObj As Boolean = False, Optional bWithClimsoft As Boolean = False) End Sub @@ -123,16 +123,21 @@ Public Class RLink Dim temp As RDotNet.SymbolicExpression Dim strTemp As String Dim strOutput As String + Dim strScriptWithComment As String Dim strSplitScript As String strOutput = "" Try - If bLog And strComment <> "" Then - txtLog.Text = txtLog.Text & strComment & vbCrLf - txtLog.Text = txtLog.Text & strScript & vbCrLf + If strComment <> "" Then + strScriptWithComment = "# " & strComment & vbCrLf & strScript + Else + strScriptWithComment = strScript + End If + If bLog Then + txtLog.Text = txtLog.Text & strScriptWithComment & vbCrLf End If If bOutput Then If strComment <> "" Then - AppendText(txtOutput, clrComments, fComments, strComment & vbCrLf) + AppendText(txtOutput, clrComments, fComments, strScriptWithComment & vbCrLf) End If AppendText(txtOutput, clrScript, fScript, strScript & vbCrLf) End If From 3096b820055140474c17d56409f136f225ff092d Mon Sep 17 00:00:00 2001 From: Mary Mutahi Date: Fri, 12 Feb 2016 12:00:48 +0300 Subject: [PATCH 7/7] changes on the ANOVA one way dialog --- instat/dlgOneWayAnova.Designer.vb | 40 ++++++++++++------------------- instat/dlgOneWayAnova.vb | 10 ++++---- 2 files changed, 20 insertions(+), 30 deletions(-) diff --git a/instat/dlgOneWayAnova.Designer.vb b/instat/dlgOneWayAnova.Designer.vb index 6943c57058a..04e0a83721a 100644 --- a/instat/dlgOneWayAnova.Designer.vb +++ b/instat/dlgOneWayAnova.Designer.vb @@ -23,8 +23,6 @@ Partial Class dlgOneWayANOVA _ Private Sub InitializeComponent() Me.ucrBase = New instat.ucrButtons() - Me.ucrDataSelector = New instat.ucrDataFrame() - Me.ucrAddRemove = New instat.ucrSelectorAddRemove() Me.ucrYVariate = New instat.ucrReceiverSingle() Me.ucrFactor = New instat.ucrReceiverSingle() Me.lblYVariate = New System.Windows.Forms.Label() @@ -34,6 +32,7 @@ Partial Class dlgOneWayANOVA Me.rdoResiduals = New System.Windows.Forms.RadioButton() Me.rdoMeans = New System.Windows.Forms.RadioButton() Me.rdoNone = New System.Windows.Forms.RadioButton() + Me.ucrAddRemoveDataFrame = New instat.ucrSelectorByDataFrameAddRemove() Me.grpPlots.SuspendLayout() Me.SuspendLayout() ' @@ -44,30 +43,16 @@ Partial Class dlgOneWayANOVA Me.ucrBase.Size = New System.Drawing.Size(410, 57) Me.ucrBase.TabIndex = 0 ' - 'ucrDataSelector - ' - Me.ucrDataSelector.Location = New System.Drawing.Point(8, 11) - Me.ucrDataSelector.Name = "ucrDataSelector" - Me.ucrDataSelector.Size = New System.Drawing.Size(127, 41) - Me.ucrDataSelector.TabIndex = 1 - ' - 'ucrAddRemove - ' - Me.ucrAddRemove.Location = New System.Drawing.Point(4, 61) - Me.ucrAddRemove.Name = "ucrAddRemove" - Me.ucrAddRemove.Size = New System.Drawing.Size(203, 127) - Me.ucrAddRemove.TabIndex = 2 - ' 'ucrYVariate ' - Me.ucrYVariate.Location = New System.Drawing.Point(265, 88) + Me.ucrYVariate.Location = New System.Drawing.Point(265, 112) Me.ucrYVariate.Name = "ucrYVariate" Me.ucrYVariate.Size = New System.Drawing.Size(106, 26) Me.ucrYVariate.TabIndex = 3 ' 'ucrFactor ' - Me.ucrFactor.Location = New System.Drawing.Point(265, 136) + Me.ucrFactor.Location = New System.Drawing.Point(265, 160) Me.ucrFactor.Name = "ucrFactor" Me.ucrFactor.Size = New System.Drawing.Size(106, 26) Me.ucrFactor.TabIndex = 4 @@ -75,7 +60,7 @@ Partial Class dlgOneWayANOVA 'lblYVariate ' Me.lblYVariate.AutoSize = True - Me.lblYVariate.Location = New System.Drawing.Point(271, 74) + Me.lblYVariate.Location = New System.Drawing.Point(271, 98) Me.lblYVariate.Name = "lblYVariate" Me.lblYVariate.Size = New System.Drawing.Size(49, 13) Me.lblYVariate.TabIndex = 5 @@ -85,7 +70,7 @@ Partial Class dlgOneWayANOVA 'lblFactor ' Me.lblFactor.AutoSize = True - Me.lblFactor.Location = New System.Drawing.Point(272, 124) + Me.lblFactor.Location = New System.Drawing.Point(272, 148) Me.lblFactor.Name = "lblFactor" Me.lblFactor.Size = New System.Drawing.Size(37, 13) Me.lblFactor.TabIndex = 6 @@ -98,7 +83,7 @@ Partial Class dlgOneWayANOVA Me.grpPlots.Controls.Add(Me.rdoResiduals) Me.grpPlots.Controls.Add(Me.rdoMeans) Me.grpPlots.Controls.Add(Me.rdoNone) - Me.grpPlots.Location = New System.Drawing.Point(13, 194) + Me.grpPlots.Location = New System.Drawing.Point(11, 216) Me.grpPlots.Name = "grpPlots" Me.grpPlots.Size = New System.Drawing.Size(231, 76) Me.grpPlots.TabIndex = 7 @@ -154,18 +139,24 @@ Partial Class dlgOneWayANOVA Me.rdoNone.Text = "None" Me.rdoNone.UseVisualStyleBackColor = True ' + 'ucrAddRemoveDataFrame + ' + Me.ucrAddRemoveDataFrame.Location = New System.Drawing.Point(4, 20) + Me.ucrAddRemoveDataFrame.Name = "ucrAddRemoveDataFrame" + Me.ucrAddRemoveDataFrame.Size = New System.Drawing.Size(242, 179) + Me.ucrAddRemoveDataFrame.TabIndex = 8 + ' 'dlgOneWayANOVA ' Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font Me.ClientSize = New System.Drawing.Size(420, 371) + Me.Controls.Add(Me.ucrAddRemoveDataFrame) Me.Controls.Add(Me.grpPlots) Me.Controls.Add(Me.lblFactor) Me.Controls.Add(Me.lblYVariate) Me.Controls.Add(Me.ucrFactor) Me.Controls.Add(Me.ucrYVariate) - Me.Controls.Add(Me.ucrAddRemove) - Me.Controls.Add(Me.ucrDataSelector) Me.Controls.Add(Me.ucrBase) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.Name = "dlgOneWayANOVA" @@ -179,8 +170,6 @@ Partial Class dlgOneWayANOVA End Sub Friend WithEvents ucrBase As ucrButtons - Friend WithEvents ucrDataSelector As ucrDataFrame - Friend WithEvents ucrAddRemove As ucrSelectorAddRemove Friend WithEvents ucrYVariate As ucrReceiverSingle Friend WithEvents ucrFactor As ucrReceiverSingle Friend WithEvents lblYVariate As Label @@ -190,4 +179,5 @@ Partial Class dlgOneWayANOVA Friend WithEvents rdoMeans As RadioButton Friend WithEvents rdoNone As RadioButton Friend WithEvents rdoANOVA As RadioButton + Friend WithEvents ucrAddRemoveDataFrame As ucrSelectorByDataFrameAddRemove End Class diff --git a/instat/dlgOneWayAnova.vb b/instat/dlgOneWayAnova.vb index 790a846492b..68d1045cf2c 100644 --- a/instat/dlgOneWayAnova.vb +++ b/instat/dlgOneWayAnova.vb @@ -18,11 +18,11 @@ Public Class dlgOneWayANOVA Private Sub dlgOneWayAnova_Load(sender As Object, e As EventArgs) Handles MyBase.Load ucrBase.clsRsyntax.SetFunction("aov") ucrBase.clsRsyntax.iCallType = 2 - ucrYVariate.Selector = ucrAddRemove + ucrYVariate.Selector = ucrAddRemoveDataFrame ucrYVariate.SetMeAsReceiver() - ucrFactor.Selector = ucrAddRemove + ucrFactor.Selector = ucrAddRemoveDataFrame ucrFactor.SetDataType("factor") - ucrBase.clsRsyntax.AddParameter("data", clsRFunctionParameter:=ucrDataSelector.clsCurrDataFrame) + ucrBase.clsRsyntax.AddParameter("data", clsRFunctionParameter:=ucrAddRemoveDataFrame.ucrAvailableDataFrames.clsCurrDataFrame) autoTranslate(Me) Fillformula() @@ -52,7 +52,7 @@ Public Class dlgOneWayANOVA End If End Sub - Private Sub ucrDataSelector_Leave(sender As Object, e As EventArgs) Handles ucrDataSelector.Leave - ucrBase.clsRsyntax.AddParameter("data", clsRFunctionParameter:=ucrDataSelector.clsCurrDataFrame) + Private Sub ucrAddRemoveDataframe_Leave(sender As Object, e As EventArgs) Handles ucrAddRemoveDataFrame.Leave + ucrBase.clsRsyntax.AddParameter("data", clsRFunctionParameter:=ucrAddRemoveDataFrame.ucrAvailableDataFrames.clsCurrDataFrame) End Sub End Class \ No newline at end of file