diff --git a/.gitignore b/.gitignore index cc25c123cb9..1ed6e973e09 100644 --- a/.gitignore +++ b/.gitignore @@ -252,3 +252,7 @@ installer/Output/ /packages/NLog.*/ /packages/Newtonsoft.Json.*/ + +# RScript package and dependencies +/packages/RScript.*/ +/packages/System.Collections.Specialized.*/ diff --git a/instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb b/instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb index 648c7193873..cc7bfc838c0 100644 --- a/instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb +++ b/instat/UserControls/DataGrid/ReoGrid/ucrDataViewReoGrid.vb @@ -14,6 +14,7 @@ ' You should have received a copy of the GNU General Public License ' along with this program. If not, see . +Imports System.Text.RegularExpressions Imports unvell.ReoGrid Imports unvell.ReoGrid.Events @@ -76,10 +77,8 @@ Public Class ucrDataViewReoGrid For i = 0 To grdData.CurrentWorksheet.Rows - 1 For j = 0 To grdData.CurrentWorksheet.Columns - 1 Dim strData As String = dataFrame.DisplayedData(i, j) - If grdData.CurrentWorksheet.ColumnHeaders.Item(j).Text.Contains("(LT)") AndAlso - strData IsNot Nothing Then - strData = GetInnerBracketedString(strData) - strData = If(strData.Contains(":"), strData.Replace(":", ", "), strData) + If strData IsNot Nothing AndAlso grdData.CurrentWorksheet.ColumnHeaders.Item(j).Text.Contains("(LT)") Then + strData = GetTransformedLTColumnContents(strData) End If grdData.CurrentWorksheet(row:=i, col:=j) = strData Next @@ -104,6 +103,50 @@ Public Class ucrDataViewReoGrid grdData.CurrentWorksheet.RowHeaderWidth = TextRenderer.MeasureText(strLongestRowHeaderText, Me.Font).Width End Sub + ''' + ''' Transforms contents of LT column(s) that have structured R-like data into a more readable and user-friendly format that is consistent with R Viewer. + ''' For example, content like list(Birmingham = list(IATA = c("BHM", NA, NA, NA), Hartford = list(IATA = "BDL", ICAO = "KBDL")) + ''' will be transformed to BHM, NA, NA, NA,BDL,KBDL + ''' + ''' Data from column type LT + ''' Transformed data + Private Function GetTransformedLTColumnContents(strLstData As String) As String + ' Check if strLstData is "numeric(0)", + If strLstData = "numeric(0)" Then + '"numeric(0)" represents an empty data set in R so just return an empty output + Return String.Empty + End If + + ' Check if strLstData contains "list(" or "c(". These are patterns found in R list and vector data structures. + If Not strLstData.Contains("list(") AndAlso Not strLstData.Contains("c(") Then + Return strLstData + End If + + ' Regular expression pattern to match values inside c(...) or "..." + Dim pattern As String = "c\(([^)]+)\)|""([^""]+)""" + Dim matches As MatchCollection = Regex.Matches(strLstData, pattern) + Dim lstExtractedContents As New List(Of String) + + ' Iterate through matches + For Each match As Match In matches + ' If it's a c(...) match, extracts the content inside the parentheses. Split the extracted content by commas, trimm extra spaces and double quotes then added to a list of extracted contents. + ' if it's a string "..." match, directly add the content (minus the double quotes) to the list of extracted contents. + + Dim strInnerListContent As String = If(match.Value.Contains("c("), match.Groups(1).Value, match.Value) + Dim arrInnerListContentTrimmed As String() = strInnerListContent.Split(","c).Select(Function(item) item.Trim().Trim(""""c)).ToArray() + lstExtractedContents.AddRange(arrInnerListContentTrimmed) + Next + + ' Join the extracted contents + Dim strExtractedContents As String = String.Join(", ", lstExtractedContents) + + ' Replace ":" with ", " because, in R data structure format, colons are often used to separate key-value pairs. + ' Replacing colons with commas and spaces make the data more user-friendly. + strExtractedContents = strExtractedContents.Replace(":", ", ") + + Return strExtractedContents + End Function + Public Sub AdjustColumnWidthAfterWrapping(strColumn As String, Optional bApplyWrap As Boolean = False) Implements IDataViewGrid.AdjustColumnWidthAfterWrapping Dim iColumnIndex As Integer = GetColumnIndex(strColName:=strColumn) If iColumnIndex < 0 OrElse grdData.CurrentWorksheet.ColumnHeaders(iColumnIndex).Text.Contains("(G)") Then @@ -126,19 +169,6 @@ Public Class ucrDataViewReoGrid grdData.CurrentWorksheet(iRow, iColumn) = GetCurrentDataFrameFocus.DisplayedData(iRow, iColumn) End Sub - Private Function GetInnerBracketedString(strData As String) As String - Dim intFirstRightBracket As Integer = InStr(strData, ")") - Dim intLastLeftBracket As Integer = InStrRev(strData, "(") - If intFirstRightBracket = 0 Or intLastLeftBracket = 0 Then - Return strData - ElseIf strData = "numeric(0)" Then - Return String.Empty - Else - Dim strOutput As String = Mid(strData, intLastLeftBracket + 1, intFirstRightBracket - intLastLeftBracket - 1) - Return strOutput - End If - End Function - Public Function GetSelectedColumns() As List(Of clsColumnHeaderDisplay) Implements IDataViewGrid.GetSelectedColumns Dim lstColumns As New List(Of clsColumnHeaderDisplay) For i As Integer = grdData.CurrentWorksheet.SelectionRange.Col To grdData.CurrentWorksheet.SelectionRange.Col + grdData.CurrentWorksheet.SelectionRange.Cols - 1 diff --git a/instat/clsRLink.vb b/instat/clsRLink.vb index 76c2baca7d9..c0974c90af9 100644 --- a/instat/clsRLink.vb +++ b/instat/clsRLink.vb @@ -715,6 +715,163 @@ Public Class RLink End Function + '''-------------------------------------------------------------------------------------------- + ''' Executes . If it is not an assignment + ''' statement, then attempts to display the output. + ''' + ''' The R code statement to execute + '''-------------------------------------------------------------------------------------------- + Public Sub RunRStatement(clsRStatement As clsRStatement) + + Dim strRStatement = clsRStatement.GetAsExecutableScript() + + 'if there is no script to run then just ignore and exit sub + If String.IsNullOrWhiteSpace(strRStatement) Then + Exit Sub + End If + + Try + Dim strOutput As String = "" + + 'if not an assignment operation, then capture the output + Dim strRStatementNoFormatting As String = + clsRStatement.GetAsExecutableScript(bIncludeFormatting:=False) + If IsStatementViewObject(strRStatementNoFormatting) Then + strOutput = GetFileOutput(strRStatementNoFormatting, bSilent:=False, + bSeparateThread:=False, bShowWaitDialogOverride:=Nothing) + ElseIf clsRStatement.clsAssignment Is Nothing _ + AndAlso Not String.IsNullOrWhiteSpace(strRStatementNoFormatting) Then + strOutput = GetFileOutput("view_object_data(object = " _ + & strRStatementNoFormatting _ + & " , object_format = 'text' )", bSilent:=False, + bSeparateThread:=False, bShowWaitDialogOverride:=Nothing) + Else + Evaluate(strRStatement, bSilent:=False, bSeparateThread:=False, + bShowWaitDialogOverride:=Nothing) + End If + + clsOutputLogger.AddOutput(strRStatement, strOutput, bAsFile:=True, + bDisplayOutputInExternalViewer:=strRStatementNoFormatting.StartsWith("view_object_data")) + LogScript(strRStatement.TrimEnd(vbCr, vbLf)) + + Catch e As Exception + MsgBox(e.Message & Environment.NewLine & + "The error occurred in attempting to run the following R command:" & + Environment.NewLine & strRStatement, MsgBoxStyle.Critical, + "Error running R command") + End Try + End Sub + + '''-------------------------------------------------------------------------------------------- + ''' This method executes the R script and displays + ''' the output as text or graph (determined by ). + ''' R commands may be split over multiple lines. This is only allowed if the + ''' non-final line ends with '+', ',', or '%>%'; or there are one or more brackets/ + ''' quotations that have not been closed. + ''' This function is named '...FromWindow' because it's designed to execute scripts + ''' entered by a human from a dialog window (e.g. a script window). These scripts + ''' may contain R commands split over multiple lines to make the commands more + ''' readable. + ''' + ''' + ''' The R script to execute. + ''' The comment to prefix to the script. + '''-------------------------------------------------------------------------------------------- + Public Sub RunScriptFromWindow(strScript As String, strComment As String) + + If String.IsNullOrWhiteSpace(strScript) Then + Exit Sub + End If + + 'Prefix comment to script + Dim strRStatement As String = "" + Dim strRStatementComment As String = If(String.IsNullOrEmpty(strComment), "", GetFormattedComment(strComment)) + + 'for each line in script + For Each strScriptLine As String In strScript.Split(Environment.NewLine) + + 'if line is empty or only whitespace then ignore line + Dim strTrimmedLine As String = strScriptLine.Trim(vbLf).Trim() + If strTrimmedLine.Length <= 0 Then + Continue For + End If + + 'find any comments (character '#' and anything after) + Dim iCommentPos As Integer = strTrimmedLine.IndexOf("#") + Select Case iCommentPos + Case 0 'a normal comment line (starts with '#') + strRStatementComment &= If(String.IsNullOrEmpty(strRStatementComment), "", Environment.NewLine) _ + & strTrimmedLine + Continue For + Case Is > 0 ' a line with an appended comment (e.g. 'x <- 1 # generate data' converted to 'x <- 1 ') + strRStatementComment &= If(String.IsNullOrEmpty(strRStatementComment), "", Environment.NewLine) _ + & strTrimmedLine.Substring(strTrimmedLine.IndexOf("#"c)) + strTrimmedLine = strTrimmedLine.Substring(0, iCommentPos).Trim() + End Select + + 'else append line of script to command + strRStatement &= If(String.IsNullOrEmpty(strRStatement), "", Environment.NewLine) & strTrimmedLine + + 'if line ends in a '+', ',', or '%>%'; or there are open brackets; or open quotations, + ' then assume command is not complete + Dim cLastChar As Char = strTrimmedLine.Last + Dim strLast3Chars As String = "" + Dim iNumOpenRound As Integer = strRStatement.Where(Function(c) c = "("c).Count + Dim iNumClosedRound As Integer = strRStatement.Where(Function(c) c = ")"c).Count + Dim iNumOpenCurlies As Integer = strRStatement.Where(Function(c) c = "{"c).Count + Dim iNumClosedCurlies As Integer = strRStatement.Where(Function(c) c = "}"c).Count + Dim iNumDoubleQuotes As Integer = strRStatement.Where(Function(c) c = """"c).Count + If strTrimmedLine.Length >= 3 Then + strLast3Chars = strTrimmedLine.Substring(strTrimmedLine.Length - 3) + End If + If cLastChar = "+" OrElse cLastChar = "," OrElse strLast3Chars = "%>%" _ + OrElse iNumOpenRound <> iNumClosedRound _ + OrElse iNumOpenCurlies <> iNumClosedCurlies _ + OrElse iNumDoubleQuotes Mod 2 Then + Continue For + End If + + 'We now have what we think is a complete R statement, so try and execute it + Try + Dim strOutput As String = "" + Dim bAsFile As Boolean = True + Dim bDisplayOutputInExternalViewer As Boolean = False + + If IsStatementViewObject(strRStatement) Then + strOutput = GetFileOutput(strRStatement, False, False, Nothing) + 'if statement generates a view_object then display in external viewer (maximised) + bDisplayOutputInExternalViewer = strRStatement.Contains("view_object_data") + ElseIf IsStatementPrint(strRStatement) Then + bAsFile = False + Evaluate(strRStatement, bSilent:=False, bSeparateThread:=False, bShowWaitDialogOverride:=Nothing) + ElseIf Not IsStatementAssignment(strRStatement) Then 'if not an assignment operation, then capture the output + Dim strRStatementAsSingleLine As String = strRStatement.Replace(vbCr, String.Empty) + strRStatementAsSingleLine = strRStatementAsSingleLine.Replace(vbLf, String.Empty) + 'wrap final command inside view_object_data just in case there is an output object + strOutput = GetFileOutput("view_object_data(object = " & strRStatementAsSingleLine & " , object_format = 'text' )", False, False, Nothing) + Else + Evaluate(strRStatement, bSilent:=False, bSeparateThread:=False, bShowWaitDialogOverride:=Nothing) + End If + + clsOutputLogger.AddOutput(If(String.IsNullOrEmpty(strRStatementComment), "", + strRStatementComment & Environment.NewLine) & strRStatement, + strOutput, bAsFile, bDisplayOutputInExternalViewer) + LogScript(strRStatement, strRStatementComment) + + Catch e As Exception + MsgBox(e.Message & Environment.NewLine & + "The error occurred in attempting to run the following R command(s):" & + Environment.NewLine & + strRStatement, MsgBoxStyle.Critical, "Error running R command(s)") + End Try + + strRStatement = "" + strRStatementComment = "" + Next + + frmMain.UpdateAllGrids() + End Sub + '''-------------------------------------------------------------------------------------------- ''' ''' This method executes the R script(s) and displays the output. The @@ -794,15 +951,11 @@ Public Class RLink If arrExecutableRScriptLines.Length > 0 Then 'get the last R script command. todo, this should eventually use the RScript library functions to identify the last R script command Dim strLastScript As String = arrExecutableRScriptLines.Last() - If strLastScript.StartsWith(strInstatDataObject & "$get_object_data") OrElse - strLastScript.StartsWith(strInstatDataObject & "$get_last_object_data") OrElse - strLastScript.StartsWith("view_object_data") Then - + If IsStatementViewObject(strLastScript) Then strOutput = GetFileOutput(strScript, bSilent, bSeparateThread, bShowWaitDialogOverride) 'if last function is view_object then display in external viewer (maximised) bDisplayOutputInExternalViewer = strLastScript.Contains("view_object_data") - - ElseIf strLastScript.StartsWith("print") Then + ElseIf IsStatementPrint(strLastScript) Then bAsFile = False Evaluate(strScript, bSilent:=bSilent, bSeparateThread:=bSeparateThread, bShowWaitDialogOverride:=bShowWaitDialogOverride) ElseIf iCallType = 0 Then @@ -822,15 +975,11 @@ Public Class RLink If expTemp IsNot Nothing Then strOutput = String.Join(Environment.NewLine, expTemp.AsCharacter()) & Environment.NewLine End If - ElseIf iCallType = 5 Then - 'else if script comes from script window - 'wrap command inside view_object_data just incase there is an output object - strOutput = GetFileOutput("view_object_data(object = " & strScript & " , object_format = 'text' )", bSilent, bSeparateThread, bShowWaitDialogOverride) Else 'else if script output should not be ignored or not stored as an object or variable 'if output should be stored as a variable just execute the script - If arrExecutableRScriptLines.Last().Contains("<-") Then + If IsStatementAssignment(arrExecutableRScriptLines.Last()) Then Evaluate(strScript, bSilent:=bSilent, bSeparateThread:=bSeparateThread, bShowWaitDialogOverride:=bShowWaitDialogOverride) Else 'else capture the output as plain text @@ -865,7 +1014,8 @@ Public Class RLink ''' ''' Gets the file path name if file is available and has contents, else returns an empty string ''' - ''' Script that produces a file output + ''' Script that produces a file output. The last line of the script + ''' must be a single line R statement that generates output. ''' ''' ''' @@ -890,76 +1040,6 @@ Public Class RLink Return strFilePath End Function - '''-------------------------------------------------------------------------------------------- - ''' This method executes the R script and displays - ''' the output as text or graph (determined by ). - ''' R commands may be split over multiple lines. This is only allowed if the - ''' non-final line ends with '+', ',', or '%>%'; or there are one or more '{' - ''' brackets that have not been closed with an equivalent '}' bracket. - ''' This function is named '...FromWindow' because it's designed to execute scripts - ''' entered by a human from a dialog window (e.g. a script window). These scripts - ''' may contain R commands split over multiple lines to make the commands more - ''' readable. - ''' - ''' The R script to execute. - ''' Shown as a comment. If this parameter is "" then shows - ''' as the comment. - ''' - ''' Any text at the end of that was not executed. - ''' If all the text in was executed then returns "". - ''' - '''-------------------------------------------------------------------------------------------- - Public Function RunScriptFromWindow(strNewScript As String, strNewComment As String) As String - Dim strScriptCmd As String = "" - - - 'for each line in script - For Each strScriptLine As String In strNewScript.Split(Environment.NewLine) - 'remove any comments (character '#' and anything after) - Dim iCommentPos As Integer = strScriptLine.IndexOf("#") - Select Case iCommentPos - Case 0 'a normal comment line (starts with '#') - Continue For - Case Is > 0 ' a line with an appended comment (e.g. 'x <- 1 # generate data' converted to 'x <- 1 ') - strScriptLine = strScriptLine.Substring(0, iCommentPos - 1) - End Select - - 'if line is empty or only whitespace then ignore line - Dim strTrimmedLine As String = strScriptLine.Trim(vbLf).Trim() - If strTrimmedLine.Length <= 0 Then - Continue For - End If - - 'else append line of script to command - strScriptCmd &= strScriptLine - - 'if line ends in a '+', ',', or '%>%'; or there are open curly braces; or open quotations, - ' then assume command is not complete - Dim cLastChar As Char = strTrimmedLine.Last - Dim strLast3Chars As String = "" - Dim iNumOpenRound As Integer = strScriptCmd.Where(Function(c) c = "("c).Count - Dim iNumClosedRound As Integer = strScriptCmd.Where(Function(c) c = ")"c).Count - Dim iNumOpenCurlies As Integer = strScriptCmd.Where(Function(c) c = "{"c).Count - Dim iNumClosedCurlies As Integer = strScriptCmd.Where(Function(c) c = "}"c).Count - Dim iNumDoubleQuotes As Integer = strScriptCmd.Where(Function(c) c = """"c).Count - If strTrimmedLine.Length >= 3 Then - strLast3Chars = strTrimmedLine.Substring(strTrimmedLine.Length - 3) - End If - If cLastChar = "+" OrElse cLastChar = "," OrElse strLast3Chars = "%>%" _ - OrElse iNumOpenRound <> iNumClosedRound _ - OrElse iNumOpenCurlies <> iNumClosedCurlies _ - OrElse iNumDoubleQuotes Mod 2 Then - Continue For - End If - - 'else execute command - RunScript(strScriptCmd.Trim(vbLf), iCallType:=5, strComment:=strNewComment, bSeparateThread:=False, bSilent:=False) - strScriptCmd = "" - strNewComment = "" - Next - Return strScriptCmd - End Function - '''-------------------------------------------------------------------------------------------- ''' Executes the the R script and returns the result ''' as a 'SymbolicExpression' object. @@ -1440,6 +1520,23 @@ Public Class RLink End If End Sub + Private Sub LogScript(strScript As String, Optional strComment As String = "") + + Dim strScriptWithComment As String = + If(String.IsNullOrWhiteSpace(strComment), + "", strComment & Environment.NewLine) & + If(String.IsNullOrWhiteSpace(strScript), + "", + strScript & Environment.NewLine) + + If String.IsNullOrWhiteSpace(strScriptWithComment) Then + Exit Sub + End If + + frmMain.ucrScriptWindow.LogText(strScriptWithComment) + AppendToAutoSaveLog(strScriptWithComment) + End Sub + '''-------------------------------------------------------------------------------------------- ''' Selects the specified data frame columns in ''' the receiver. @@ -2167,13 +2264,13 @@ Public Class RLink 'check to remove the [1] notation before some parameter values If expTemp.AsCharacter(iParameterValue).Contains("[1]") Then Dim strcleanArgument As String = expTemp.AsCharacter(iParameterValue).Remove(expTemp.AsCharacter(iParameterValue).IndexOf("["), 3) - clsNewRParameter.clsArgValueDefault = New clsRScript(strcleanArgument).lstRStatements(0).clsElement + clsNewRParameter.clsArgValueDefault = New clsRScript(strcleanArgument).dctRStatements(0).clsElement Else 'Empty String are Not accepted hence the modification below If String.IsNullOrEmpty(expTemp.AsCharacter(iParameterValue)) Then - clsNewRParameter.clsArgValueDefault = New clsRScript("NODEFAULTVALUE").lstRStatements(0).clsElement + clsNewRParameter.clsArgValueDefault = New clsRScript("NODEFAULTVALUE").dctRStatements(0).clsElement Else - clsNewRParameter.clsArgValueDefault = New clsRScript(expTemp.AsCharacter(iParameterValue)).lstRStatements(0).clsElement + clsNewRParameter.clsArgValueDefault = New clsRScript(expTemp.AsCharacter(iParameterValue)).dctRStatements(0).clsElement End If End If @@ -2194,4 +2291,26 @@ Public Class RLink Return lstRParameters End Function + + Private Function IsStatementAssignment(strRStatement As String) As Boolean + Return strRStatement.Contains("<-") + End Function + + Private Function IsStatementPrint(strRStatement As String) As Boolean + Dim strRStatementTrimmed As String = TrimStartRStatement(strRStatement) + Return strRStatementTrimmed.StartsWith("print") + End Function + + Private Function IsStatementViewObject(strRStatement As String) As Boolean + Dim strRStatementTrimmed As String = TrimStartRStatement(strRStatement) + Return strRStatementTrimmed.StartsWith(strInstatDataObject & "$get_object_data") _ + OrElse strRStatementTrimmed.StartsWith(strInstatDataObject & "$get_last_object_data") _ + OrElse strRStatementTrimmed.StartsWith("view_object_data") + End Function + + Private Function TrimStartRStatement(strRStatement As String) As String + Dim arrTrimChars As Char() = {" "c, vbTab, vbLf, vbCr} + Return strRStatement.TrimStart(arrTrimChars) + End Function + End Class \ No newline at end of file diff --git a/instat/dlgDeleteObjects.Designer.vb b/instat/dlgDeleteObjects.Designer.vb index 61f7fe01e2d..2e3ccaab2c1 100644 --- a/instat/dlgDeleteObjects.Designer.vb +++ b/instat/dlgDeleteObjects.Designer.vb @@ -44,15 +44,15 @@ Partial Class dlgDeleteObjects Me.ucrReceiverObjectsToDelete = New instat.ucrReceiverMultiple() Me.ucrSelectorDeleteObject = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.lblDeleteNumber = New System.Windows.Forms.Label() Me.SuspendLayout() ' 'lblObjectsToDelete ' Me.lblObjectsToDelete.AutoSize = True - Me.lblObjectsToDelete.Location = New System.Drawing.Point(251, 24) + Me.lblObjectsToDelete.Location = New System.Drawing.Point(372, 124) + Me.lblObjectsToDelete.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblObjectsToDelete.Name = "lblObjectsToDelete" - Me.lblObjectsToDelete.Size = New System.Drawing.Size(92, 13) + Me.lblObjectsToDelete.Size = New System.Drawing.Size(136, 20) Me.lblObjectsToDelete.TabIndex = 1 Me.lblObjectsToDelete.Tag = "Objects_to_Delete" Me.lblObjectsToDelete.Text = "Objects to Delete:" @@ -60,9 +60,10 @@ Partial Class dlgDeleteObjects 'lblType ' Me.lblType.AutoSize = True - Me.lblType.Location = New System.Drawing.Point(251, 149) + Me.lblType.Location = New System.Drawing.Point(373, 56) + Me.lblType.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblType.Name = "lblType" - Me.lblType.Size = New System.Drawing.Size(34, 13) + Me.lblType.Size = New System.Drawing.Size(47, 20) Me.lblType.TabIndex = 3 Me.lblType.Text = "Type:" ' @@ -72,20 +73,21 @@ Partial Class dlgDeleteObjects Me.ucrInputComboType.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputComboType.GetSetSelectedIndex = -1 Me.ucrInputComboType.IsReadOnly = False - Me.ucrInputComboType.Location = New System.Drawing.Point(254, 165) + Me.ucrInputComboType.Location = New System.Drawing.Point(378, 80) + Me.ucrInputComboType.Margin = New System.Windows.Forms.Padding(14) Me.ucrInputComboType.Name = "ucrInputComboType" - Me.ucrInputComboType.Size = New System.Drawing.Size(120, 21) + Me.ucrInputComboType.Size = New System.Drawing.Size(194, 32) Me.ucrInputComboType.TabIndex = 4 ' 'ucrReceiverObjectsToDelete ' Me.ucrReceiverObjectsToDelete.AutoSize = True Me.ucrReceiverObjectsToDelete.frmParent = Me - Me.ucrReceiverObjectsToDelete.Location = New System.Drawing.Point(254, 39) + Me.ucrReceiverObjectsToDelete.Location = New System.Drawing.Point(377, 146) Me.ucrReceiverObjectsToDelete.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverObjectsToDelete.Name = "ucrReceiverObjectsToDelete" Me.ucrReceiverObjectsToDelete.Selector = Nothing - Me.ucrReceiverObjectsToDelete.Size = New System.Drawing.Size(120, 100) + Me.ucrReceiverObjectsToDelete.Size = New System.Drawing.Size(195, 150) Me.ucrReceiverObjectsToDelete.strNcFilePath = "" Me.ucrReceiverObjectsToDelete.TabIndex = 2 Me.ucrReceiverObjectsToDelete.ucrSelector = Nothing @@ -96,38 +98,28 @@ Partial Class dlgDeleteObjects Me.ucrSelectorDeleteObject.bDropUnusedFilterLevels = False Me.ucrSelectorDeleteObject.bShowHiddenColumns = False Me.ucrSelectorDeleteObject.bUseCurrentFilter = True - Me.ucrSelectorDeleteObject.Location = New System.Drawing.Point(10, 10) + Me.ucrSelectorDeleteObject.Location = New System.Drawing.Point(15, 15) Me.ucrSelectorDeleteObject.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorDeleteObject.Name = "ucrSelectorDeleteObject" - Me.ucrSelectorDeleteObject.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorDeleteObject.Size = New System.Drawing.Size(320, 274) Me.ucrSelectorDeleteObject.TabIndex = 0 ' 'ucrBase ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 204) + Me.ucrBase.Location = New System.Drawing.Point(15, 306) + Me.ucrBase.Margin = New System.Windows.Forms.Padding(6) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(408, 52) + Me.ucrBase.Size = New System.Drawing.Size(611, 77) Me.ucrBase.TabIndex = 5 ' - 'lblDeleteNumber - ' - Me.lblDeleteNumber.AutoSize = True - Me.lblDeleteNumber.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblDeleteNumber.Location = New System.Drawing.Point(338, 24) - Me.lblDeleteNumber.Name = "lblDeleteNumber" - Me.lblDeleteNumber.Size = New System.Drawing.Size(21, 13) - Me.lblDeleteNumber.TabIndex = 9 - Me.lblDeleteNumber.Text = "DF" - ' 'dlgDeleteObjects ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) + Me.AutoScaleDimensions = New System.Drawing.SizeF(144.0!, 144.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(416, 260) - Me.Controls.Add(Me.lblDeleteNumber) + Me.ClientSize = New System.Drawing.Size(624, 390) Me.Controls.Add(Me.lblType) Me.Controls.Add(Me.ucrInputComboType) Me.Controls.Add(Me.ucrReceiverObjectsToDelete) @@ -135,6 +127,7 @@ Partial Class dlgDeleteObjects Me.Controls.Add(Me.ucrSelectorDeleteObject) Me.Controls.Add(Me.ucrBase) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Margin = New System.Windows.Forms.Padding(4) Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "dlgDeleteObjects" @@ -152,5 +145,4 @@ Partial Class dlgDeleteObjects Friend WithEvents ucrReceiverObjectsToDelete As ucrReceiverMultiple Friend WithEvents lblType As Label Friend WithEvents ucrInputComboType As ucrInputComboBox - Friend WithEvents lblDeleteNumber As Label End Class diff --git a/instat/dlgDeleteObjects.vb b/instat/dlgDeleteObjects.vb index 89024bf98bb..fa78b766a2c 100644 --- a/instat/dlgDeleteObjects.vb +++ b/instat/dlgDeleteObjects.vb @@ -19,14 +19,12 @@ Public Class dlgDeleteObjects Private bFirstLoad As Boolean = True Private dctTypes As New Dictionary(Of String, String) Private bReset As Boolean = True - Private clsDefaultFunction As New RFunction + Private clsDeleteRFunction As New RFunction Private Sub dlgDeleteObjects_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then InitialiseDialog() bFirstLoad = False - Else - ReopenDialog() End If If bReset Then SetDefaults() @@ -34,50 +32,53 @@ Public Class dlgDeleteObjects SetRCodeforControls(bReset) bReset = False autoTranslate(Me) - CountLevels() TestOKEnabled() End Sub Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 352 - ' Selector ucrSelectorDeleteObject.SetParameter(New RParameter("data_name", 0)) ucrSelectorDeleteObject.SetParameterIsString() - ' Receiver - ucrReceiverObjectsToDelete.SetParameter(New RParameter("object_names", 1)) - ucrReceiverObjectsToDelete.SetParameterIsString() - ucrReceiverObjectsToDelete.Selector = ucrSelectorDeleteObject - ucrReceiverObjectsToDelete.SetMeAsReceiver() - ucrInputComboType.SetParameter(New RParameter("object_type", 2)) dctTypes.Add("Objects", Chr(34) & "object" & Chr(34)) + dctTypes.Add("Summaries", Chr(34) & RObjectTypeLabel.Summary & Chr(34)) + dctTypes.Add("Tables", Chr(34) & RObjectTypeLabel.Table & Chr(34)) + dctTypes.Add("Graphs", Chr(34) & RObjectTypeLabel.Graph & Chr(34)) + dctTypes.Add("Models", Chr(34) & RObjectTypeLabel.Model & Chr(34)) + dctTypes.Add("Structured", Chr(34) & RObjectTypeLabel.StructureLabel & Chr(34)) dctTypes.Add("Filters", Chr(34) & "filter" & Chr(34)) dctTypes.Add("Column selections", Chr(34) & "column_selection" & Chr(34)) dctTypes.Add("Calculations", Chr(34) & "calculation" & Chr(34)) - dctTypes.Add("Tables", Chr(34) & "table" & Chr(34)) - dctTypes.Add("Graphs", Chr(34) & "graph" & Chr(34)) - dctTypes.Add("Models", Chr(34) & "model" & Chr(34)) ucrInputComboType.SetItems(dctTypes) ucrInputComboType.SetDropDownStyleAsNonEditable() - lblDeleteNumber.ForeColor = Color.Red + ucrReceiverObjectsToDelete.SetParameter(New RParameter("object_names", 1)) + ucrReceiverObjectsToDelete.SetParameterIsString() + ucrReceiverObjectsToDelete.Selector = ucrSelectorDeleteObject + ucrReceiverObjectsToDelete.SetMeAsReceiver() + + + End Sub Private Sub SetDefaults() - clsDefaultFunction = New RFunction + clsDeleteRFunction = New RFunction ucrSelectorDeleteObject.Reset() - clsDefaultFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$delete_objects") - clsDefaultFunction.AddParameter("object_type", Chr(34) & "object" & Chr(34), iPosition:=2) + clsDeleteRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$delete_objects") + clsDeleteRFunction.AddParameter("object_type", Chr(34) & "object" & Chr(34), iPosition:=2) - ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultFunction) + ucrBase.clsRsyntax.SetBaseRFunction(clsDeleteRFunction) End Sub Private Sub SetRCodeforControls(bReset As Boolean) - SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) + ucrSelectorDeleteObject.SetRCode(clsDeleteRFunction, bReset) + ucrInputComboType.SetRCode(clsDeleteRFunction, bReset) + ucrReceiverObjectsToDelete.SetRCode(clsDeleteRFunction, bReset) + 'SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) End Sub Private Sub TestOKEnabled() @@ -88,10 +89,6 @@ Public Class dlgDeleteObjects End If End Sub - Private Sub ReopenDialog() - ucrSelectorDeleteObject.Reset() ' temporary fix - End Sub - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset SetDefaults() SetRCodeforControls(True) @@ -99,22 +96,15 @@ Public Class dlgDeleteObjects End Sub Private Sub ucrInputComboType_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputComboType.ControlValueChanged - Dim key As String = dctTypes.Keys(ucrInputComboType.cboInput.SelectedIndex) - Dim value As String = "" - - If key IsNot Nothing AndAlso dctTypes.TryGetValue(key, value) Then - ucrReceiverObjectsToDelete.strSelectorHeading = key - ucrReceiverObjectsToDelete.SetItemType(value.Replace(Chr(34), "")) + ucrReceiverObjectsToDelete.Clear() + If dctTypes.ContainsKey(ucrInputComboType.GetText()) Then + ucrReceiverObjectsToDelete.strSelectorHeading = ucrInputComboType.GetText() + ucrReceiverObjectsToDelete.SetItemType(dctTypes.Item(ucrInputComboType.GetText()).Replace(Chr(34), "")) End If End Sub Private Sub ucrReceiverObjectsToDelete_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverObjectsToDelete.ControlContentsChanged TestOKEnabled() - CountLevels() End Sub - Private Sub CountLevels() - lblDeleteNumber.Text = " " & ucrReceiverObjectsToDelete.Count - lblDeleteNumber.Visible = ucrReceiverObjectsToDelete.Count > 0 - End Sub End Class diff --git a/instat/dlgRenameObjects.Designer.vb b/instat/dlgRenameObjects.Designer.vb index fd37c9950c1..ff50e46eed6 100644 --- a/instat/dlgRenameObjects.Designer.vb +++ b/instat/dlgRenameObjects.Designer.vb @@ -52,9 +52,10 @@ Partial Class dlgRenameObjects ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 207) + Me.ucrBase.Location = New System.Drawing.Point(15, 310) + Me.ucrBase.Margin = New System.Windows.Forms.Padding(6) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.Size = New System.Drawing.Size(611, 77) Me.ucrBase.TabIndex = 7 ' 'ucrSelectorForRenameObject @@ -63,39 +64,41 @@ Partial Class dlgRenameObjects Me.ucrSelectorForRenameObject.bDropUnusedFilterLevels = False Me.ucrSelectorForRenameObject.bShowHiddenColumns = False Me.ucrSelectorForRenameObject.bUseCurrentFilter = True - Me.ucrSelectorForRenameObject.Location = New System.Drawing.Point(10, 10) + Me.ucrSelectorForRenameObject.Location = New System.Drawing.Point(15, 15) Me.ucrSelectorForRenameObject.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorForRenameObject.Name = "ucrSelectorForRenameObject" - Me.ucrSelectorForRenameObject.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorForRenameObject.Size = New System.Drawing.Size(320, 274) Me.ucrSelectorForRenameObject.TabIndex = 0 ' 'ucrReceiverCurrentName ' Me.ucrReceiverCurrentName.AutoSize = True Me.ucrReceiverCurrentName.frmParent = Me - Me.ucrReceiverCurrentName.Location = New System.Drawing.Point(262, 60) + Me.ucrReceiverCurrentName.Location = New System.Drawing.Point(389, 152) Me.ucrReceiverCurrentName.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverCurrentName.Name = "ucrReceiverCurrentName" Me.ucrReceiverCurrentName.Selector = Nothing - Me.ucrReceiverCurrentName.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverCurrentName.Size = New System.Drawing.Size(180, 30) Me.ucrReceiverCurrentName.strNcFilePath = "" Me.ucrReceiverCurrentName.TabIndex = 2 Me.ucrReceiverCurrentName.ucrSelector = Nothing ' 'lblCurrentName ' - Me.lblCurrentName.Location = New System.Drawing.Point(262, 45) + Me.lblCurrentName.Location = New System.Drawing.Point(389, 130) + Me.lblCurrentName.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblCurrentName.Name = "lblCurrentName" - Me.lblCurrentName.Size = New System.Drawing.Size(100, 15) + Me.lblCurrentName.Size = New System.Drawing.Size(150, 22) Me.lblCurrentName.TabIndex = 1 Me.lblCurrentName.Tag = "Current_Name" Me.lblCurrentName.Text = "Current Name:" ' 'lblNewName ' - Me.lblNewName.Location = New System.Drawing.Point(262, 93) + Me.lblNewName.Location = New System.Drawing.Point(389, 202) + Me.lblNewName.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblNewName.Name = "lblNewName" - Me.lblNewName.Size = New System.Drawing.Size(100, 13) + Me.lblNewName.Size = New System.Drawing.Size(150, 20) Me.lblNewName.TabIndex = 3 Me.lblNewName.Tag = "New_Name" Me.lblNewName.Text = "New Name:" @@ -106,9 +109,10 @@ Partial Class dlgRenameObjects Me.ucrInputNewName.AutoSize = True Me.ucrInputNewName.IsMultiline = False Me.ucrInputNewName.IsReadOnly = False - Me.ucrInputNewName.Location = New System.Drawing.Point(262, 106) + Me.ucrInputNewName.Location = New System.Drawing.Point(389, 234) + Me.ucrInputNewName.Margin = New System.Windows.Forms.Padding(14) Me.ucrInputNewName.Name = "ucrInputNewName" - Me.ucrInputNewName.Size = New System.Drawing.Size(120, 21) + Me.ucrInputNewName.Size = New System.Drawing.Size(180, 32) Me.ucrInputNewName.TabIndex = 4 ' 'ucrInputType @@ -117,27 +121,29 @@ Partial Class dlgRenameObjects Me.ucrInputType.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink Me.ucrInputType.GetSetSelectedIndex = -1 Me.ucrInputType.IsReadOnly = False - Me.ucrInputType.Location = New System.Drawing.Point(262, 153) + Me.ucrInputType.Location = New System.Drawing.Point(389, 84) + Me.ucrInputType.Margin = New System.Windows.Forms.Padding(14) Me.ucrInputType.Name = "ucrInputType" - Me.ucrInputType.Size = New System.Drawing.Size(120, 21) + Me.ucrInputType.Size = New System.Drawing.Size(180, 32) Me.ucrInputType.TabIndex = 6 ' 'lblType ' Me.lblType.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblType.Location = New System.Drawing.Point(262, 140) + Me.lblType.Location = New System.Drawing.Point(389, 64) + Me.lblType.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblType.Name = "lblType" - Me.lblType.Size = New System.Drawing.Size(65, 13) + Me.lblType.Size = New System.Drawing.Size(98, 20) Me.lblType.TabIndex = 5 Me.lblType.Tag = "New_Name" Me.lblType.Text = "Type:" ' 'dlgRenameObjects ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) + Me.AutoScaleDimensions = New System.Drawing.SizeF(144.0!, 144.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(417, 264) + Me.ClientSize = New System.Drawing.Size(626, 396) Me.Controls.Add(Me.lblType) Me.Controls.Add(Me.ucrInputType) Me.Controls.Add(Me.ucrReceiverCurrentName) @@ -147,12 +153,13 @@ Partial Class dlgRenameObjects Me.Controls.Add(Me.ucrSelectorForRenameObject) Me.Controls.Add(Me.ucrBase) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Margin = New System.Windows.Forms.Padding(4) Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "dlgRenameObjects" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen Me.Tag = "Rename_Object" - Me.Text = "Rename Objects" + Me.Text = "Rename Object" Me.ResumeLayout(False) Me.PerformLayout() diff --git a/instat/dlgRenameObjects.vb b/instat/dlgRenameObjects.vb index 3b8b65f260d..87bd7bc2e6d 100644 --- a/instat/dlgRenameObjects.vb +++ b/instat/dlgRenameObjects.vb @@ -18,18 +18,13 @@ Imports instat.Translations Public Class dlgRenameObjects Public bFirstLoad As Boolean = True Private bReset As Boolean = True - Dim bUseSelectedColumn As Boolean = False - Dim strSelectedColumn As String = "" - Dim strSelectedDataFrame As String = "" - Private clsDefaultFunction As New RFunction + Private clsRenameRFunction As New RFunction Private dctTypes As New Dictionary(Of String, String) Private Sub dlgRenameObjects_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then InitialiseDialog() bFirstLoad = False - Else - ReopenDialog() End If If bReset Then SetDefaults() @@ -37,59 +32,53 @@ Public Class dlgRenameObjects SetRCodeforControls(bReset) bReset = False TestOKEnabled() - If bUseSelectedColumn Then - SetDefaultColumn() - End If autoTranslate(Me) End Sub - Private Sub ReopenDialog() - ' temp. fix, the receivers should clear only if the name of the object in it has changed - ucrSelectorForRenameObject.Reset() - ucrInputNewName.SetName("") - End Sub - Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 350 - 'ucrSelector ucrSelectorForRenameObject.SetParameter(New RParameter("data_name", 0)) ucrSelectorForRenameObject.SetParameterIsString() - 'ucrReceiver + ucrInputType.SetParameter(New RParameter("object_type", 3)) + dctTypes.Add("Objects", Chr(34) & "object" & Chr(34)) + dctTypes.Add("Summaries", Chr(34) & RObjectTypeLabel.Summary & Chr(34)) + dctTypes.Add("Tables", Chr(34) & RObjectTypeLabel.Table & Chr(34)) + dctTypes.Add("Graphs", Chr(34) & RObjectTypeLabel.Graph & Chr(34)) + dctTypes.Add("Models", Chr(34) & RObjectTypeLabel.Model & Chr(34)) + dctTypes.Add("Structured", Chr(34) & RObjectTypeLabel.StructureLabel & Chr(34)) + dctTypes.Add("Filters", Chr(34) & "filter" & Chr(34)) + dctTypes.Add("Column selections", Chr(34) & "column_selection" & Chr(34)) + dctTypes.Add("Calculations", Chr(34) & "calculation" & Chr(34)) + ucrInputType.SetItems(dctTypes) + ucrInputType.SetDropDownStyleAsNonEditable() + ucrReceiverCurrentName.SetParameter(New RParameter("object_name", 1)) ucrReceiverCurrentName.Selector = ucrSelectorForRenameObject ucrReceiverCurrentName.SetMeAsReceiver() ucrReceiverCurrentName.SetParameterIsString() - 'ucrNewName ucrInputNewName.SetParameter(New RParameter("new_name", 2)) ucrInputNewName.SetValidationTypeAsRVariable() - ucrInputType.SetParameter(New RParameter("object_type", 3)) - dctTypes.Add("Objects", Chr(34) & "object" & Chr(34)) - dctTypes.Add("Filters", Chr(34) & "filter" & Chr(34)) - dctTypes.Add("Column selections", Chr(34) & "column_selection" & Chr(34)) - dctTypes.Add("Calculations", Chr(34) & "calculation" & Chr(34)) - dctTypes.Add("Tables", Chr(34) & "table" & Chr(34)) - dctTypes.Add("Graphs", Chr(34) & "graph" & Chr(34)) - dctTypes.Add("Models", Chr(34) & "model" & Chr(34)) - ucrInputType.SetItems(dctTypes) - ucrInputType.SetDropDownStyleAsNonEditable() End Sub Private Sub SetDefaults() - clsDefaultFunction = New RFunction + clsRenameRFunction = New RFunction ucrSelectorForRenameObject.Reset() - clsDefaultFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$rename_object") - clsDefaultFunction.AddParameter("object_type", Chr(34) & "object" & Chr(34), iPosition:=3) - ucrBase.clsRsyntax.SetBaseRFunction(clsDefaultFunction) + clsRenameRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$rename_object") + clsRenameRFunction.AddParameter("object_type", Chr(34) & "object" & Chr(34), iPosition:=3) + ucrBase.clsRsyntax.SetBaseRFunction(clsRenameRFunction) End Sub Private Sub SetRCodeforControls(bReset As Boolean) - SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) + ucrSelectorForRenameObject.SetRCode(clsRenameRFunction, bReset) + ucrInputType.SetRCode(clsRenameRFunction, bReset) + ucrReceiverCurrentName.SetRCode(clsRenameRFunction, bReset) + ucrInputNewName.SetRCode(clsRenameRFunction, bReset) End Sub Private Sub TestOKEnabled() @@ -100,22 +89,17 @@ Public Class dlgRenameObjects End If End Sub - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset - SetDefaults() - SetRCodeforControls(True) - TestOKEnabled() - End Sub - Public Sub SetCurrentColumn(strcolumn As String, strdataframe As String) - strSelectedColumn = strcolumn - strSelectedDataFrame = strdataframe - bUseSelectedColumn = True + Private Sub CoreControls_ContentsChanged() Handles ucrInputNewName.ControlContentsChanged, ucrSelectorForRenameObject.ControlContentsChanged, ucrReceiverCurrentName.ControlContentsChanged + TestOKEnabled() End Sub - Private Sub SetDefaultColumn() - ucrSelectorForRenameObject.SetDataframe(strSelectedDataFrame) - ucrReceiverCurrentName.Add(strSelectedColumn, strSelectedDataFrame) - bUseSelectedColumn = False + Private Sub ucrInputType_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputType.ControlValueChanged + ucrReceiverCurrentName.Clear() + If dctTypes.ContainsKey(ucrInputType.GetText()) Then + ucrReceiverCurrentName.strSelectorHeading = ucrInputType.GetText() + ucrReceiverCurrentName.SetItemType(dctTypes.Item(ucrInputType.GetText()).Replace(Chr(34), "")) + End If End Sub Private Sub ucrReceiverCurrentName_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverCurrentName.ControlValueChanged @@ -124,17 +108,13 @@ Public Class dlgRenameObjects End If End Sub - Private Sub ucrInputType_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputType.ControlValueChanged - Dim key As String = dctTypes.Keys(ucrInputType.cboInput.SelectedIndex) - Dim value As String = "" - If key IsNot Nothing AndAlso dctTypes.TryGetValue(key, value) Then - ucrReceiverCurrentName.strSelectorHeading = key - ucrReceiverCurrentName.SetItemType(value.Replace(Chr(34), "")) - End If - End Sub - Private Sub CoreControls_ContentsChanged() Handles ucrInputNewName.ControlContentsChanged, ucrSelectorForRenameObject.ControlContentsChanged, ucrReceiverCurrentName.ControlContentsChanged + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + SetDefaults() + SetRCodeforControls(True) TestOKEnabled() End Sub + + End Class \ No newline at end of file diff --git a/instat/dlgReorderObjects.Designer.vb b/instat/dlgReorderObjects.Designer.vb index fd83943c9cb..9d1b1eee4e0 100644 --- a/instat/dlgReorderObjects.Designer.vb +++ b/instat/dlgReorderObjects.Designer.vb @@ -42,21 +42,25 @@ Partial Class dlgReorderObjects Me.lblObjectsToReoder = New System.Windows.Forms.Label() Me.ucrDataFrameReorder = New instat.ucrDataFrame() Me.ucrReorderObjects = New instat.ucrReorder() + Me.rdoOutputObjects = New System.Windows.Forms.RadioButton() + Me.rdoDataObjects = New System.Windows.Forms.RadioButton() + Me.ucrPnlOptions = New instat.UcrPanel() Me.SuspendLayout() ' 'ucrBase ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 229) + Me.ucrBase.Location = New System.Drawing.Point(6, 270) + Me.ucrBase.Margin = New System.Windows.Forms.Padding(4, 4, 4, 4) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 3 ' 'lblObjectsToReoder ' Me.lblObjectsToReoder.AutoSize = True - Me.lblObjectsToReoder.Location = New System.Drawing.Point(182, 28) + Me.lblObjectsToReoder.Location = New System.Drawing.Point(178, 67) Me.lblObjectsToReoder.Name = "lblObjectsToReoder" Me.lblObjectsToReoder.Size = New System.Drawing.Size(99, 13) Me.lblObjectsToReoder.TabIndex = 1 @@ -68,7 +72,7 @@ Partial Class dlgReorderObjects Me.ucrDataFrameReorder.AutoSize = True Me.ucrDataFrameReorder.bDropUnusedFilterLevels = False Me.ucrDataFrameReorder.bUseCurrentFilter = True - Me.ucrDataFrameReorder.Location = New System.Drawing.Point(10, 10) + Me.ucrDataFrameReorder.Location = New System.Drawing.Point(6, 49) Me.ucrDataFrameReorder.Margin = New System.Windows.Forms.Padding(0) Me.ucrDataFrameReorder.Name = "ucrDataFrameReorder" Me.ucrDataFrameReorder.Size = New System.Drawing.Size(153, 43) @@ -76,19 +80,70 @@ Partial Class dlgReorderObjects ' 'ucrReorderObjects ' - Me.ucrReorderObjects.Location = New System.Drawing.Point(182, 45) + Me.ucrReorderObjects.Location = New System.Drawing.Point(178, 85) + Me.ucrReorderObjects.Margin = New System.Windows.Forms.Padding(6, 6, 6, 6) Me.ucrReorderObjects.Name = "ucrReorderObjects" Me.ucrReorderObjects.Size = New System.Drawing.Size(209, 178) Me.ucrReorderObjects.TabIndex = 2 Me.ucrReorderObjects.ucrDataFrameList = Nothing Me.ucrReorderObjects.ucrReceiver = Nothing ' + 'rdoOutputObjects + ' + Me.rdoOutputObjects.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoOutputObjects.BackColor = System.Drawing.SystemColors.Control + Me.rdoOutputObjects.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoOutputObjects.FlatAppearance.BorderSize = 2 + Me.rdoOutputObjects.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoOutputObjects.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoOutputObjects.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoOutputObjects.Location = New System.Drawing.Point(93, 7) + Me.rdoOutputObjects.Name = "rdoOutputObjects" + Me.rdoOutputObjects.Size = New System.Drawing.Size(120, 28) + Me.rdoOutputObjects.TabIndex = 18 + Me.rdoOutputObjects.TabStop = True + Me.rdoOutputObjects.Tag = "" + Me.rdoOutputObjects.Text = "Output Objects" + Me.rdoOutputObjects.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoOutputObjects.UseVisualStyleBackColor = False + ' + 'rdoDataObjects + ' + Me.rdoDataObjects.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoDataObjects.BackColor = System.Drawing.SystemColors.Control + Me.rdoDataObjects.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoDataObjects.FlatAppearance.BorderSize = 2 + Me.rdoDataObjects.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoDataObjects.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoDataObjects.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoDataObjects.Location = New System.Drawing.Point(213, 7) + Me.rdoDataObjects.Name = "rdoDataObjects" + Me.rdoDataObjects.Size = New System.Drawing.Size(120, 28) + Me.rdoDataObjects.TabIndex = 19 + Me.rdoDataObjects.TabStop = True + Me.rdoDataObjects.Tag = "" + Me.rdoDataObjects.Text = "Data Objects" + Me.rdoDataObjects.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoDataObjects.UseVisualStyleBackColor = False + ' + 'ucrPnlOptions + ' + Me.ucrPnlOptions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlOptions.Location = New System.Drawing.Point(2, 5) + Me.ucrPnlOptions.Margin = New System.Windows.Forms.Padding(6, 6, 6, 6) + Me.ucrPnlOptions.Name = "ucrPnlOptions" + Me.ucrPnlOptions.Size = New System.Drawing.Size(401, 36) + Me.ucrPnlOptions.TabIndex = 17 + ' 'dlgReorderObjects ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(418, 287) + Me.ClientSize = New System.Drawing.Size(418, 325) + Me.Controls.Add(Me.rdoOutputObjects) + Me.Controls.Add(Me.rdoDataObjects) + Me.Controls.Add(Me.ucrPnlOptions) Me.Controls.Add(Me.lblObjectsToReoder) Me.Controls.Add(Me.ucrDataFrameReorder) Me.Controls.Add(Me.ucrBase) @@ -109,4 +164,7 @@ Partial Class dlgReorderObjects Friend WithEvents lblObjectsToReoder As Label Friend WithEvents ucrDataFrameReorder As ucrDataFrame Friend WithEvents ucrReorderObjects As ucrReorder + Friend WithEvents rdoOutputObjects As RadioButton + Friend WithEvents rdoDataObjects As RadioButton + Friend WithEvents ucrPnlOptions As UcrPanel End Class diff --git a/instat/dlgReorderObjects.vb b/instat/dlgReorderObjects.vb index bf5eecbc8c5..cb14c909bec 100644 --- a/instat/dlgReorderObjects.vb +++ b/instat/dlgReorderObjects.vb @@ -38,6 +38,13 @@ Public Class dlgReorderObjects Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 351 + ucrPnlOptions.AddRadioButton(rdoOutputObjects) + ucrPnlOptions.AddRadioButton(rdoDataObjects) + 'todo disabled until functionality of viewing data objects is implemented + rdoDataObjects.Enabled = False + ucrPnlOptions.AddFunctionNamesCondition(rdoOutputObjects, frmMain.clsRLink.strInstatDataObject & "$reorder_objects") + + ' ucrSelector DataFrame ucrDataFrameReorder.SetParameter(New RParameter("data_name", 0)) ucrDataFrameReorder.SetParameterIsString() @@ -69,10 +76,10 @@ Public Class dlgReorderObjects SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) End Sub - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset - SetDefaults() + Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset + SetDefaults() SetRCodeforControls(True) - TestOKEnabled() + TestOKEnabled() End Sub Private Sub ucrReorderObjects_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReorderObjects.ControlContentsChanged diff --git a/instat/dlgScatterPlot.Designer.vb b/instat/dlgScatterPlot.Designer.vb index 614b377b877..a722c9958a4 100644 --- a/instat/dlgScatterPlot.Designer.vb +++ b/instat/dlgScatterPlot.Designer.vb @@ -51,11 +51,24 @@ Partial Class dlgScatterPlot Me.toolStripMenuItemSmoothOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemTextrepelOptions = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemJitterOptions = New System.Windows.Forms.ToolStripMenuItem() - Me.lblWidth = New System.Windows.Forms.Label() + Me.toolStripMenuItemCountOptions = New System.Windows.Forms.ToolStripMenuItem() + Me.grpGeom = New System.Windows.Forms.GroupBox() + Me.ucrInputPosition = New instat.ucrInputComboBox() + Me.lblPosition = New System.Windows.Forms.Label() + Me.ucrInputLegend = New instat.ucrInputComboBox() + Me.lblLegend = New System.Windows.Forms.Label() + Me.ucrInputShape = New instat.ucrInputComboBox() + Me.lblPointsize = New System.Windows.Forms.Label() + Me.ucrNudPointsize = New instat.ucrNud() + Me.lblShape = New System.Windows.Forms.Label() + Me.rdoCount = New System.Windows.Forms.RadioButton() + Me.rdoPoint = New System.Windows.Forms.RadioButton() Me.lblHeith = New System.Windows.Forms.Label() Me.ucrNudHeigth = New instat.ucrNud() + Me.lblWidth = New System.Windows.Forms.Label() Me.ucrNudWidth = New instat.ucrNud() - Me.ucrChkJitter = New instat.ucrCheck() + Me.rdoJitter = New System.Windows.Forms.RadioButton() + Me.ucrPnlGeoms = New instat.UcrPanel() Me.cmdOptions = New instat.ucrSplitButton() Me.ucrInputSides = New instat.ucrInputComboBox() Me.ucrNudSize = New instat.ucrNud() @@ -70,13 +83,14 @@ Partial Class dlgScatterPlot Me.ucrReceiverX = New instat.ucrReceiverSingle() Me.ucrBase = New instat.ucrButtons() Me.contextMenuStripOptions.SuspendLayout() + Me.grpGeom.SuspendLayout() Me.SuspendLayout() ' 'lblFactorOptional ' Me.lblFactorOptional.AutoSize = True Me.lblFactorOptional.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblFactorOptional.Location = New System.Drawing.Point(334, 224) + Me.lblFactorOptional.Location = New System.Drawing.Point(347, 224) Me.lblFactorOptional.Name = "lblFactorOptional" Me.lblFactorOptional.Size = New System.Drawing.Size(111, 13) Me.lblFactorOptional.TabIndex = 4 @@ -87,7 +101,7 @@ Partial Class dlgScatterPlot ' Me.lblXVariable.AutoSize = True Me.lblXVariable.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblXVariable.Location = New System.Drawing.Point(334, 175) + Me.lblXVariable.Location = New System.Drawing.Point(347, 175) Me.lblXVariable.Name = "lblXVariable" Me.lblXVariable.Size = New System.Drawing.Size(58, 13) Me.lblXVariable.TabIndex = 2 @@ -98,7 +112,7 @@ Partial Class dlgScatterPlot ' Me.lblVariable.AutoSize = True Me.lblVariable.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblVariable.Location = New System.Drawing.Point(334, 273) + Me.lblVariable.Location = New System.Drawing.Point(347, 273) Me.lblVariable.Name = "lblVariable" Me.lblVariable.Size = New System.Drawing.Size(125, 13) Me.lblVariable.TabIndex = 6 @@ -125,62 +139,188 @@ Partial Class dlgScatterPlot ' 'contextMenuStripOptions ' - Me.contextMenuStripOptions.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripMenuItemPlotOptions, Me.toolStripMenuItemPointOptions, Me.toolStripMenuItemRugOptions, Me.toolStripMenuItemSmoothOptions, Me.toolStripMenuItemTextrepelOptions, Me.toolStripMenuItemJitterOptions}) + Me.contextMenuStripOptions.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripMenuItemPlotOptions, Me.toolStripMenuItemPointOptions, Me.toolStripMenuItemRugOptions, Me.toolStripMenuItemSmoothOptions, Me.toolStripMenuItemTextrepelOptions, Me.toolStripMenuItemJitterOptions, Me.toolStripMenuItemCountOptions}) Me.contextMenuStripOptions.Name = "contextMenuStripOk" - Me.contextMenuStripOptions.Size = New System.Drawing.Size(181, 158) + Me.contextMenuStripOptions.Size = New System.Drawing.Size(172, 158) ' 'toolStripMenuItemPlotOptions ' Me.toolStripMenuItemPlotOptions.Name = "toolStripMenuItemPlotOptions" - Me.toolStripMenuItemPlotOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemPlotOptions.Size = New System.Drawing.Size(171, 22) Me.toolStripMenuItemPlotOptions.Text = "Plot Options" ' 'toolStripMenuItemPointOptions ' Me.toolStripMenuItemPointOptions.Name = "toolStripMenuItemPointOptions" - Me.toolStripMenuItemPointOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemPointOptions.Size = New System.Drawing.Size(171, 22) Me.toolStripMenuItemPointOptions.Text = "Point Options" ' 'toolStripMenuItemRugOptions ' Me.toolStripMenuItemRugOptions.Name = "toolStripMenuItemRugOptions" - Me.toolStripMenuItemRugOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemRugOptions.Size = New System.Drawing.Size(171, 22) Me.toolStripMenuItemRugOptions.Text = "Rug Options" ' 'toolStripMenuItemSmoothOptions ' Me.toolStripMenuItemSmoothOptions.Name = "toolStripMenuItemSmoothOptions" - Me.toolStripMenuItemSmoothOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemSmoothOptions.Size = New System.Drawing.Size(171, 22) Me.toolStripMenuItemSmoothOptions.Text = "Smooth Options" ' 'toolStripMenuItemTextrepelOptions ' Me.toolStripMenuItemTextrepelOptions.Name = "toolStripMenuItemTextrepelOptions" - Me.toolStripMenuItemTextrepelOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemTextrepelOptions.Size = New System.Drawing.Size(171, 22) Me.toolStripMenuItemTextrepelOptions.Text = "Text_repel Options" ' 'toolStripMenuItemJitterOptions ' Me.toolStripMenuItemJitterOptions.Name = "toolStripMenuItemJitterOptions" - Me.toolStripMenuItemJitterOptions.Size = New System.Drawing.Size(180, 22) + Me.toolStripMenuItemJitterOptions.Size = New System.Drawing.Size(171, 22) Me.toolStripMenuItemJitterOptions.Text = "Jitter Options" ' - 'lblWidth - ' - Me.lblWidth.AutoSize = True - Me.lblWidth.Location = New System.Drawing.Point(111, 314) - Me.lblWidth.Name = "lblWidth" - Me.lblWidth.Size = New System.Drawing.Size(38, 13) - Me.lblWidth.TabIndex = 19 - Me.lblWidth.Text = "Width:" + 'toolStripMenuItemCountOptions + ' + Me.toolStripMenuItemCountOptions.Name = "toolStripMenuItemCountOptions" + Me.toolStripMenuItemCountOptions.Size = New System.Drawing.Size(171, 22) + Me.toolStripMenuItemCountOptions.Text = "Count Options" + ' + 'grpGeom + ' + Me.grpGeom.Controls.Add(Me.ucrInputPosition) + Me.grpGeom.Controls.Add(Me.lblPosition) + Me.grpGeom.Controls.Add(Me.ucrInputLegend) + Me.grpGeom.Controls.Add(Me.lblLegend) + Me.grpGeom.Controls.Add(Me.ucrInputShape) + Me.grpGeom.Controls.Add(Me.lblPointsize) + Me.grpGeom.Controls.Add(Me.ucrNudPointsize) + Me.grpGeom.Controls.Add(Me.lblShape) + Me.grpGeom.Controls.Add(Me.rdoCount) + Me.grpGeom.Controls.Add(Me.rdoPoint) + Me.grpGeom.Controls.Add(Me.lblHeith) + Me.grpGeom.Controls.Add(Me.ucrNudHeigth) + Me.grpGeom.Controls.Add(Me.lblWidth) + Me.grpGeom.Controls.Add(Me.ucrNudWidth) + Me.grpGeom.Controls.Add(Me.rdoJitter) + Me.grpGeom.Controls.Add(Me.ucrPnlGeoms) + Me.grpGeom.Location = New System.Drawing.Point(10, 298) + Me.grpGeom.Name = "grpGeom" + Me.grpGeom.Size = New System.Drawing.Size(334, 122) + Me.grpGeom.TabIndex = 23 + Me.grpGeom.TabStop = False + Me.grpGeom.Text = "Geoms" + ' + 'ucrInputPosition + ' + Me.ucrInputPosition.AddQuotesIfUnrecognised = True + Me.ucrInputPosition.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputPosition.GetSetSelectedIndex = -1 + Me.ucrInputPosition.IsReadOnly = False + Me.ucrInputPosition.Location = New System.Drawing.Point(240, 52) + Me.ucrInputPosition.Name = "ucrInputPosition" + Me.ucrInputPosition.Size = New System.Drawing.Size(83, 21) + Me.ucrInputPosition.TabIndex = 39 + ' + 'lblPosition + ' + Me.lblPosition.AutoSize = True + Me.lblPosition.Location = New System.Drawing.Point(192, 57) + Me.lblPosition.Name = "lblPosition" + Me.lblPosition.Size = New System.Drawing.Size(47, 13) + Me.lblPosition.TabIndex = 38 + Me.lblPosition.Text = "Position:" + ' + 'ucrInputLegend + ' + Me.ucrInputLegend.AddQuotesIfUnrecognised = True + Me.ucrInputLegend.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputLegend.GetSetSelectedIndex = -1 + Me.ucrInputLegend.IsReadOnly = False + Me.ucrInputLegend.Location = New System.Drawing.Point(113, 52) + Me.ucrInputLegend.Name = "ucrInputLegend" + Me.ucrInputLegend.Size = New System.Drawing.Size(61, 21) + Me.ucrInputLegend.TabIndex = 37 + ' + 'lblLegend + ' + Me.lblLegend.AutoSize = True + Me.lblLegend.Location = New System.Drawing.Point(59, 57) + Me.lblLegend.Name = "lblLegend" + Me.lblLegend.Size = New System.Drawing.Size(46, 13) + Me.lblLegend.TabIndex = 36 + Me.lblLegend.Text = "Legend:" + ' + 'ucrInputShape + ' + Me.ucrInputShape.AddQuotesIfUnrecognised = True + Me.ucrInputShape.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputShape.GetSetSelectedIndex = -1 + Me.ucrInputShape.IsReadOnly = False + Me.ucrInputShape.Location = New System.Drawing.Point(227, 16) + Me.ucrInputShape.Name = "ucrInputShape" + Me.ucrInputShape.Size = New System.Drawing.Size(96, 21) + Me.ucrInputShape.TabIndex = 35 + ' + 'lblPointsize + ' + Me.lblPointsize.AutoSize = True + Me.lblPointsize.Location = New System.Drawing.Point(59, 21) + Me.lblPointsize.Name = "lblPointsize" + Me.lblPointsize.Size = New System.Drawing.Size(30, 13) + Me.lblPointsize.TabIndex = 33 + Me.lblPointsize.Text = "Size:" + ' + 'ucrNudPointsize + ' + Me.ucrNudPointsize.AutoSize = True + Me.ucrNudPointsize.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudPointsize.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudPointsize.Location = New System.Drawing.Point(113, 17) + Me.ucrNudPointsize.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudPointsize.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudPointsize.Name = "ucrNudPointsize" + Me.ucrNudPointsize.Size = New System.Drawing.Size(45, 20) + Me.ucrNudPointsize.TabIndex = 34 + Me.ucrNudPointsize.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'lblShape + ' + Me.lblShape.AutoSize = True + Me.lblShape.Location = New System.Drawing.Point(186, 21) + Me.lblShape.Name = "lblShape" + Me.lblShape.Size = New System.Drawing.Size(41, 13) + Me.lblShape.TabIndex = 31 + Me.lblShape.Text = "Shape:" + ' + 'rdoCount + ' + Me.rdoCount.AutoSize = True + Me.rdoCount.Location = New System.Drawing.Point(4, 55) + Me.rdoCount.Name = "rdoCount" + Me.rdoCount.Size = New System.Drawing.Size(53, 17) + Me.rdoCount.TabIndex = 30 + Me.rdoCount.TabStop = True + Me.rdoCount.Text = "Count" + Me.rdoCount.UseVisualStyleBackColor = True + ' + 'rdoPoint + ' + Me.rdoPoint.AutoSize = True + Me.rdoPoint.Location = New System.Drawing.Point(4, 20) + Me.rdoPoint.Name = "rdoPoint" + Me.rdoPoint.Size = New System.Drawing.Size(49, 17) + Me.rdoPoint.TabIndex = 29 + Me.rdoPoint.TabStop = True + Me.rdoPoint.Text = "Point" + Me.rdoPoint.UseVisualStyleBackColor = True ' 'lblHeith ' Me.lblHeith.AutoSize = True - Me.lblHeith.Location = New System.Drawing.Point(221, 314) + Me.lblHeith.Location = New System.Drawing.Point(182, 92) Me.lblHeith.Name = "lblHeith" Me.lblHeith.Size = New System.Drawing.Size(41, 13) - Me.lblHeith.TabIndex = 21 + Me.lblHeith.TabIndex = 27 Me.lblHeith.Text = "Heigth:" ' 'ucrNudHeigth @@ -188,35 +328,54 @@ Partial Class dlgScatterPlot Me.ucrNudHeigth.AutoSize = True Me.ucrNudHeigth.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudHeigth.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudHeigth.Location = New System.Drawing.Point(262, 312) + Me.ucrNudHeigth.Location = New System.Drawing.Point(223, 90) Me.ucrNudHeigth.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudHeigth.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudHeigth.Name = "ucrNudHeigth" Me.ucrNudHeigth.Size = New System.Drawing.Size(45, 20) - Me.ucrNudHeigth.TabIndex = 22 + Me.ucrNudHeigth.TabIndex = 28 Me.ucrNudHeigth.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' + 'lblWidth + ' + Me.lblWidth.AutoSize = True + Me.lblWidth.Location = New System.Drawing.Point(59, 92) + Me.lblWidth.Name = "lblWidth" + Me.lblWidth.Size = New System.Drawing.Size(38, 13) + Me.lblWidth.TabIndex = 25 + Me.lblWidth.Text = "Width:" + ' 'ucrNudWidth ' Me.ucrNudWidth.AutoSize = True Me.ucrNudWidth.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudWidth.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudWidth.Location = New System.Drawing.Point(152, 312) + Me.ucrNudWidth.Location = New System.Drawing.Point(113, 90) Me.ucrNudWidth.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) Me.ucrNudWidth.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) Me.ucrNudWidth.Name = "ucrNudWidth" Me.ucrNudWidth.Size = New System.Drawing.Size(45, 20) - Me.ucrNudWidth.TabIndex = 20 + Me.ucrNudWidth.TabIndex = 26 Me.ucrNudWidth.Value = New Decimal(New Integer() {0, 0, 0, 0}) ' - 'ucrChkJitter + 'rdoJitter ' - Me.ucrChkJitter.AutoSize = True - Me.ucrChkJitter.Checked = False - Me.ucrChkJitter.Location = New System.Drawing.Point(10, 312) - Me.ucrChkJitter.Name = "ucrChkJitter" - Me.ucrChkJitter.Size = New System.Drawing.Size(89, 23) - Me.ucrChkJitter.TabIndex = 18 + Me.rdoJitter.AutoSize = True + Me.rdoJitter.Location = New System.Drawing.Point(4, 90) + Me.rdoJitter.Name = "rdoJitter" + Me.rdoJitter.Size = New System.Drawing.Size(47, 17) + Me.rdoJitter.TabIndex = 24 + Me.rdoJitter.TabStop = True + Me.rdoJitter.Text = "Jitter" + Me.rdoJitter.UseVisualStyleBackColor = True + ' + 'ucrPnlGeoms + ' + Me.ucrPnlGeoms.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlGeoms.Location = New System.Drawing.Point(2, 14) + Me.ucrPnlGeoms.Name = "ucrPnlGeoms" + Me.ucrPnlGeoms.Size = New System.Drawing.Size(321, 102) + Me.ucrPnlGeoms.TabIndex = 24 ' 'cmdOptions ' @@ -268,7 +427,7 @@ Partial Class dlgScatterPlot ' Me.ucrReceiverLabel.AutoSize = True Me.ucrReceiverLabel.frmParent = Me - Me.ucrReceiverLabel.Location = New System.Drawing.Point(334, 289) + Me.ucrReceiverLabel.Location = New System.Drawing.Point(347, 289) Me.ucrReceiverLabel.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverLabel.Name = "ucrReceiverLabel" Me.ucrReceiverLabel.Selector = Nothing @@ -298,7 +457,7 @@ Partial Class dlgScatterPlot 'ucrSaveScatterPlot ' Me.ucrSaveScatterPlot.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveScatterPlot.Location = New System.Drawing.Point(10, 346) + Me.ucrSaveScatterPlot.Location = New System.Drawing.Point(10, 428) Me.ucrSaveScatterPlot.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) Me.ucrSaveScatterPlot.Name = "ucrSaveScatterPlot" Me.ucrSaveScatterPlot.Size = New System.Drawing.Size(312, 24) @@ -320,7 +479,7 @@ Partial Class dlgScatterPlot ' Me.ucrVariablesAsFactorForScatter.AutoSize = True Me.ucrVariablesAsFactorForScatter.frmParent = Me - Me.ucrVariablesAsFactorForScatter.Location = New System.Drawing.Point(334, 30) + Me.ucrVariablesAsFactorForScatter.Location = New System.Drawing.Point(347, 30) Me.ucrVariablesAsFactorForScatter.Name = "ucrVariablesAsFactorForScatter" Me.ucrVariablesAsFactorForScatter.Selector = Nothing Me.ucrVariablesAsFactorForScatter.Size = New System.Drawing.Size(125, 136) @@ -333,7 +492,7 @@ Partial Class dlgScatterPlot ' Me.ucrFactorOptionalReceiver.AutoSize = True Me.ucrFactorOptionalReceiver.frmParent = Me - Me.ucrFactorOptionalReceiver.Location = New System.Drawing.Point(334, 237) + Me.ucrFactorOptionalReceiver.Location = New System.Drawing.Point(347, 237) Me.ucrFactorOptionalReceiver.Margin = New System.Windows.Forms.Padding(0) Me.ucrFactorOptionalReceiver.Name = "ucrFactorOptionalReceiver" Me.ucrFactorOptionalReceiver.Selector = Nothing @@ -346,7 +505,7 @@ Partial Class dlgScatterPlot ' Me.ucrReceiverX.AutoSize = True Me.ucrReceiverX.frmParent = Me - Me.ucrReceiverX.Location = New System.Drawing.Point(334, 188) + Me.ucrReceiverX.Location = New System.Drawing.Point(347, 188) Me.ucrReceiverX.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverX.Name = "ucrReceiverX" Me.ucrReceiverX.Selector = Nothing @@ -359,7 +518,7 @@ Partial Class dlgScatterPlot ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 377) + Me.ucrBase.Location = New System.Drawing.Point(10, 459) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(408, 52) Me.ucrBase.TabIndex = 17 @@ -369,12 +528,8 @@ Partial Class dlgScatterPlot Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(477, 438) - Me.Controls.Add(Me.lblHeith) - Me.Controls.Add(Me.ucrNudHeigth) - Me.Controls.Add(Me.lblWidth) - Me.Controls.Add(Me.ucrNudWidth) - Me.Controls.Add(Me.ucrChkJitter) + Me.ClientSize = New System.Drawing.Size(483, 521) + Me.Controls.Add(Me.grpGeom) Me.Controls.Add(Me.cmdOptions) Me.Controls.Add(Me.ucrInputSides) Me.Controls.Add(Me.lblSides) @@ -398,8 +553,10 @@ Partial Class dlgScatterPlot Me.MinimizeBox = False Me.Name = "dlgScatterPlot" Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Text = "Point Plot" + Me.Text = "Scatter Plot" Me.contextMenuStripOptions.ResumeLayout(False) + Me.grpGeom.ResumeLayout(False) + Me.grpGeom.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() @@ -429,10 +586,23 @@ Partial Class dlgScatterPlot Friend WithEvents toolStripMenuItemRugOptions As ToolStripMenuItem Friend WithEvents toolStripMenuItemSmoothOptions As ToolStripMenuItem Friend WithEvents toolStripMenuItemTextrepelOptions As ToolStripMenuItem + Friend WithEvents toolStripMenuItemJitterOptions As ToolStripMenuItem + Friend WithEvents grpGeom As GroupBox Friend WithEvents lblHeith As Label Friend WithEvents ucrNudHeigth As ucrNud Friend WithEvents lblWidth As Label Friend WithEvents ucrNudWidth As ucrNud - Friend WithEvents ucrChkJitter As ucrCheck - Friend WithEvents toolStripMenuItemJitterOptions As ToolStripMenuItem + Friend WithEvents rdoJitter As RadioButton + Friend WithEvents ucrPnlGeoms As UcrPanel + Friend WithEvents rdoCount As RadioButton + Friend WithEvents rdoPoint As RadioButton + Friend WithEvents toolStripMenuItemCountOptions As ToolStripMenuItem + Friend WithEvents lblPointsize As Label + Friend WithEvents ucrNudPointsize As ucrNud + Friend WithEvents lblShape As Label + Friend WithEvents ucrInputShape As ucrInputComboBox + Friend WithEvents ucrInputPosition As ucrInputComboBox + Friend WithEvents lblPosition As Label + Friend WithEvents ucrInputLegend As ucrInputComboBox + Friend WithEvents lblLegend As Label End Class diff --git a/instat/dlgScatterPlot.vb b/instat/dlgScatterPlot.vb index 51dd512edf0..24238bce012 100644 --- a/instat/dlgScatterPlot.vb +++ b/instat/dlgScatterPlot.vb @@ -43,12 +43,14 @@ Public Class dlgScatterPlot Private clsAnnotateFunction As New RFunction Private clsGeomRugFunction As New RFunction Private clsGeomJitterFunction As New RFunction + Private clsCountGeomFunction, clsDummyFunction As New RFunction 'Parameter names for geoms Private strFirstParameterName As String = "geomfunc" Private strGeomSmoothParameterName As String = "geom_smooth" Private strGeomTextRepelParameterName As String = "geom_text_repel" Private strGeomJitterParameterName As String = "geom_jitter" - Private strGeomParameterNames() As String = {strFirstParameterName, strGeomJitterParameterName, strGeomSmoothParameterName, strGeomTextRepelParameterName} + Private strGeomCountParameterName As String = "geom_count" + Private strGeomParameterNames() As String = {strFirstParameterName, strGeomJitterParameterName, strGeomCountParameterName, strGeomSmoothParameterName, strGeomTextRepelParameterName} Private Sub dlgScatterPlot_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -67,6 +69,8 @@ Public Class dlgScatterPlot Private Sub InitialiseDialog() Dim clsGeomRugParameter As New RParameter Dim dctSidesOptions As New Dictionary(Of String, String) + Dim dctShapePoint As New Dictionary(Of String, String) + Dim dctPositioncount As New Dictionary(Of String, String) ucrBase.iHelpTopicID = 433 ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False @@ -119,10 +123,17 @@ Public Class dlgScatterPlot ucrChkAddRugPlot.AddParameterPresentCondition(False, "geom_rug", False) ucrChkAddRugPlot.AddToLinkedControls({ucrNudSize, ucrInputSides}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - ucrChkJitter.SetText("Jitter") - ucrChkJitter.AddParameterPresentCondition(True, "geom_jitter") - ucrChkJitter.AddParameterPresentCondition(False, "geom_jitter", False) - ucrChkJitter.AddToLinkedControls({ucrNudHeigth, ucrNudWidth}, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="0.40") + ucrPnlGeoms.AddRadioButton(rdoJitter) + ucrPnlGeoms.AddRadioButton(rdoPoint) + ucrPnlGeoms.AddRadioButton(rdoCount) + ucrPnlGeoms.SetParameter(New RParameter("checked", 9)) + ucrPnlGeoms.AddParameterValuesCondition(rdoPoint, "checked", "geom_point") + ucrPnlGeoms.AddParameterValuesCondition(rdoCount, "checked", "geom_count") + ucrPnlGeoms.AddParameterValuesCondition(rdoJitter, "checked", "geom_jitter") + ucrPnlGeoms.AddToLinkedControls({ucrNudWidth, ucrNudHeigth}, {rdoJitter}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="0.40") + ucrPnlGeoms.AddToLinkedControls({ucrNudPointsize, ucrInputShape}, {rdoPoint}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlGeoms.AddToLinkedControls(ucrInputPosition, {rdoCount}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="identity") + ucrPnlGeoms.AddToLinkedControls(ucrInputLegend, {rdoCount}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="NA") ucrSaveScatterPlot.SetPrefix("scatter_plot") ucrSaveScatterPlot.SetSaveType(strRObjectType:=RObjectTypeLabel.Graph, @@ -135,6 +146,7 @@ Public Class dlgScatterPlot ucrNudSize.SetParameter(New RParameter("size", 0)) ucrNudSize.Increment = 0.1 ucrNudSize.DecimalPlaces = 1 + ucrNudSize.SetRDefault("0.5") ucrNudHeigth.SetParameter(New RParameter("height", 5)) ucrNudHeigth.Maximum = 0.5 @@ -148,6 +160,51 @@ Public Class dlgScatterPlot ucrNudWidth.Increment = 0.01 ucrNudWidth.DecimalPlaces = 2 + ucrNudPointsize.SetParameter(New RParameter("size", 7)) + ucrNudPointsize.Increment = 0.1 + ucrNudPointsize.DecimalPlaces = 1 + ucrNudPointsize.SetRDefault("1.5") + + ucrInputShape.SetParameter(New RParameter("shape", 8)) + dctShapePoint.Add("Circle", Chr(34) & "circle" & Chr(34)) + dctShapePoint.Add("Circle Open", Chr(34) & "circle open" & Chr(34)) + dctShapePoint.Add("Circle Filled", Chr(34) & "circle filled" & Chr(34)) + dctShapePoint.Add("Circle Cross", Chr(34) & "circle cross" & Chr(34)) + dctShapePoint.Add("circle Plus", Chr(34) & "circle plus" & Chr(34)) + dctShapePoint.Add("Circle Small", Chr(34) & "circle small" & Chr(34)) + dctShapePoint.Add("Bullet", Chr(34) & "bullet" & Chr(34)) + dctShapePoint.Add("Square", Chr(34) & "square" & Chr(34)) + dctShapePoint.Add("Square Triangle", Chr(34) & "square triangle" & Chr(34)) + dctShapePoint.Add("Square Plus", Chr(34) & "square plus" & Chr(34)) + dctShapePoint.Add("Square Cross", Chr(34) & "square cross" & Chr(34)) + dctShapePoint.Add("Square Filled", Chr(34) & "square filled" & Chr(34)) + dctShapePoint.Add("Square Open", Chr(34) & "square open" & Chr(34)) + dctShapePoint.Add("Diamond", Chr(34) & "diamond" & Chr(34)) + dctShapePoint.Add("Diamond Open", Chr(34) & "diamond open" & Chr(34)) + dctShapePoint.Add("Diamond Filled", Chr(34) & "diamond filled" & Chr(34)) + dctShapePoint.Add("Diamond Plus", Chr(34) & "diamond plus" & Chr(34)) + dctShapePoint.Add("Triangle", Chr(34) & "triangle" & Chr(34)) + dctShapePoint.Add("Triangle Open", Chr(34) & "triangle open" & Chr(34)) + dctShapePoint.Add("Triangle Filled", Chr(34) & "triangle filled" & Chr(34)) + dctShapePoint.Add("Triangle Square", Chr(34) & "triangle square" & Chr(34)) + dctShapePoint.Add("Triangle Down Open", Chr(34) & "triangle down open" & Chr(34)) + dctShapePoint.Add("Triangle Down Filled", Chr(34) & "triangle down filled" & Chr(34)) + dctShapePoint.Add("Plus", Chr(34) & "plus" & Chr(34)) + dctShapePoint.Add("Cross", Chr(34) & "cross" & Chr(34)) + dctShapePoint.Add("Asterisk", Chr(34) & "asterisk" & Chr(34)) + ucrInputShape.SetItems(dctShapePoint) + ucrInputShape.SetRDefault(Chr(34) & "circle" & Chr(34)) + ucrInputShape.SetDropDownStyleAsNonEditable() + + ucrInputPosition.SetParameter(New RParameter("position", 10)) + ucrInputPosition.SetItems({"identity", "stack", "dodge", "jitter", "fill", "position_dodge", "position_jitter(width=0.2,height=0.0)"}) + ucrInputPosition.SetDropDownStyleAsNonEditable() + + ucrInputLegend.SetParameter(New RParameter("show.legend", 11)) + ucrInputLegend.SetItems({"NA", "TRUE", "FALSE"}) + ucrInputLegend.SetDropDownStyleAsNonEditable() + ucrInputLegend.AddQuotesIfUnrecognised = False + ucrInputSides.SetParameter(New RParameter("sides", 1)) dctSidesOptions.Add("Bottom and left", Chr(34) & "bl" & Chr(34)) dctSidesOptions.Add("Top, right and bottom", Chr(34) & "trb" & Chr(34)) @@ -170,7 +227,11 @@ Public Class dlgScatterPlot ucrNudSize.SetLinkedDisplayControl(lblSize) ucrNudWidth.SetLinkedDisplayControl(lblWidth) ucrNudHeigth.SetLinkedDisplayControl(lblHeith) + ucrInputShape.SetLinkedDisplayControl(lblShape) + ucrNudPointsize.SetLinkedDisplayControl(lblPointsize) ucrInputSides.SetLinkedDisplayControl(lblSides) + ucrInputPosition.SetLinkedDisplayControl(lblPosition) + ucrInputLegend.SetLinkedDisplayControl(lblLegend) End Sub Private Sub SetDefaults() @@ -182,6 +243,8 @@ Public Class dlgScatterPlot clsGeomSmoothFunction = New RFunction clsGeomRugFunction = New RFunction clsGeomJitterFunction = New RFunction + clsCountGeomFunction = New RFunction + clsDummyFunction = New RFunction ucrSelectorForScatter.Reset() ucrSelectorForScatter.SetGgplotFunction(clsBaseOperator) @@ -195,6 +258,9 @@ Public Class dlgScatterPlot toolStripMenuItemSmoothOptions.Enabled = False toolStripMenuItemTextrepelOptions.Enabled = False toolStripMenuItemJitterOptions.Enabled = False + toolStripMenuItemCountOptions.Enabled = False + + clsDummyFunction.AddParameter("checked", "geom_point", iPosition:=0) clsBaseOperator.SetOperation("+") clsBaseOperator.AddParameter("ggplot", clsRFunctionParameter:=clsRggplotFunction, iPosition:=0) @@ -212,6 +278,9 @@ Public Class dlgScatterPlot clsRScatterGeomFunction.SetPackageName("ggplot2") clsRScatterGeomFunction.SetRCommand("geom_point") + clsCountGeomFunction.SetPackageName("ggplot2") + clsCountGeomFunction.SetRCommand("geom_count") + clsLabelFunction.SetPackageName("ggrepel") clsLabelFunction.SetRCommand("geom_text_repel") @@ -267,12 +336,16 @@ Public Class dlgScatterPlot ucrChkWithSE.SetRCode(clsGeomSmoothFunction, bReset) ucrChkAddRugPlot.SetRCode(clsBaseOperator, bReset) ucrNudSize.SetRCode(clsGeomRugFunction, bReset) - If bReset Then - ucrChkJitter.SetRCode(clsBaseOperator, bReset) - End If ucrNudHeigth.SetRCode(clsGeomJitterFunction, bReset) ucrNudWidth.SetRCode(clsGeomJitterFunction, bReset) ucrInputSides.SetRCode(clsGeomRugFunction, bReset) + ucrInputShape.SetRCode(clsRScatterGeomFunction, bReset) + ucrNudPointsize.SetRCode(clsRScatterGeomFunction, bReset) + ucrInputLegend.SetRCode(clsCountGeomFunction, bReset) + ucrInputPosition.SetRCode(clsCountGeomFunction, bReset) + If bReset Then + ucrPnlGeoms.SetRCode(clsDummyFunction, bReset) + End If End Sub Private Sub TestOkEnabled() @@ -308,19 +381,6 @@ Public Class dlgScatterPlot toolStripMenuItemRugOptions.Enabled = ucrChkAddRugPlot.Checked End Sub - Private Sub ucrChkJitter_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkJitter.ControlValueChanged - If ucrChkJitter.Checked Then - clsGeomJitterFunction.AddParameter("width", ucrNudWidth.GetText, iPosition:=0) - clsGeomJitterFunction.AddParameter("height", ucrNudHeigth.GetText, iPosition:=1) - clsBaseOperator.AddParameter(strGeomJitterParameterName, clsRFunctionParameter:=clsGeomJitterFunction, iPosition:=2) - clsBaseOperator.RemoveParameterByName(strFirstParameterName) - Else - clsBaseOperator.AddParameter(strFirstParameterName, clsRFunctionParameter:=clsRScatterGeomFunction, iPosition:=2) - clsBaseOperator.RemoveParameterByName(strGeomJitterParameterName) - End If - toolStripMenuItemJitterOptions.Enabled = ucrChkJitter.Checked - End Sub - Private Sub cmdOptions_Click(sender As Object, e As EventArgs) Handles cmdOptions.Click, toolStripMenuItemPlotOptions.Click sdgPlots.SetRCode(clsNewOperator:=ucrBase.clsRsyntax.clsBaseOperator, clsNewGlobalAesFunction:=clsRaesFunction, clsNewYScalecontinuousFunction:=clsYScalecontinuousFunction, clsNewXScalecontinuousFunction:=clsXScalecontinuousFunction, @@ -354,6 +414,10 @@ Public Class dlgScatterPlot EnableDisableOptions(clsGeomJitterFunction) End Sub + Private Sub toolStripMenuItemCountOptions_Click(sender As Object, e As EventArgs) Handles toolStripMenuItemCountOptions.Click + EnableDisableOptions(clsCountGeomFunction) + End Sub + Private Sub EnableDisableOptions(clsTempFunction As RFunction) 'SetupLayer sends the components storing the plot info (clsRaesFunction, clsRggplotFunction, ...) of dlgScatteredPlot through to sdgLayerOptions where these will be edited. sdgLayerOptions.SetupLayer(clsNewGgPlot:=clsRggplotFunction, clsNewGeomFunc:=clsTempFunction, @@ -405,4 +469,33 @@ Public Class dlgScatterPlot End If toolStripMenuItemTextrepelOptions.Enabled = Not ucrReceiverLabel.IsEmpty End Sub + + Private Sub ucrPnlGeoms_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlGeoms.ControlValueChanged, ucrNudHeigth.ControlValueChanged, ucrNudWidth.ControlValueChanged, ucrInputLegend.ControlValueChanged, ucrInputPosition.ControlValueChanged, ucrInputShape.ControlValueChanged, ucrNudPointsize.ControlValueChanged + If rdoJitter.Checked Then + clsGeomJitterFunction.AddParameter("width", ucrNudWidth.GetText, iPosition:=0) + clsGeomJitterFunction.AddParameter("height", ucrNudHeigth.GetText, iPosition:=1) + clsBaseOperator.AddParameter(strGeomJitterParameterName, clsRFunctionParameter:=clsGeomJitterFunction, iPosition:=2) + clsBaseOperator.RemoveParameterByName(strFirstParameterName) + clsBaseOperator.RemoveParameterByName(strGeomCountParameterName) + ElseIf rdoPoint.Checked Then + clsBaseOperator.AddParameter(strFirstParameterName, clsRFunctionParameter:=clsRScatterGeomFunction, iPosition:=2) + clsBaseOperator.RemoveParameterByName(strGeomJitterParameterName) + clsBaseOperator.RemoveParameterByName(strGeomCountParameterName) + ElseIf rdoCount.Checked Then + ChangePositionCount() + clsBaseOperator.AddParameter(strGeomCountParameterName, clsRFunctionParameter:=clsCountGeomFunction, iPosition:=2) + clsBaseOperator.RemoveParameterByName(strGeomJitterParameterName) + clsBaseOperator.RemoveParameterByName(strFirstParameterName) + End If + toolStripMenuItemJitterOptions.Enabled = rdoJitter.Checked + toolStripMenuItemCountOptions.Enabled = rdoCount.Checked + End Sub + + Private Sub ChangePositionCount() + If ucrInputPosition.GetText = "position_jitter(width=0.2,height=0.0)" Then + clsCountGeomFunction.AddParameter("position", "position_jitter(width=0.2,height=0.0)", iPosition:=0) + Else + clsCountGeomFunction.AddParameter("position", Chr(34) & ucrInputPosition.GetText & Chr(34), iPosition:=0) + End If + End Sub End Class diff --git a/instat/dlgScript.vb b/instat/dlgScript.vb index 1c929fb7f78..0fc7d6eb369 100644 --- a/instat/dlgScript.vb +++ b/instat/dlgScript.vb @@ -192,7 +192,7 @@ Public Class dlgScript End Sub Private Sub ucrBase_ClickOk(sender As Object, e As EventArgs) Handles ucrBase.ClickOk - frmMain.clsRLink.RunScriptFromWindow(strNewScript:=txtScript.Text, strNewComment:=strComment) + frmMain.clsRLink.RunScriptFromWindow(txtScript.Text.Trim(vbLf), strComment:=strComment) End Sub Private Sub ucrPnlGetData_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlGetData.ControlValueChanged diff --git a/instat/dlgViewObjects.Designer.vb b/instat/dlgViewObjects.Designer.vb index 93cd343fd03..08b8c508d04 100644 --- a/instat/dlgViewObjects.Designer.vb +++ b/instat/dlgViewObjects.Designer.vb @@ -40,66 +40,48 @@ Partial Class dlgViewObjects Private Sub InitializeComponent() Me.lblSelectedObject = New System.Windows.Forms.Label() Me.rdoStructure = New System.Windows.Forms.RadioButton() - Me.rdoAllContents = New System.Windows.Forms.RadioButton() - Me.rdoComponent = New System.Windows.Forms.RadioButton() Me.rdoPrint = New System.Windows.Forms.RadioButton() Me.ucrReceiverSelectedObject = New instat.ucrReceiverSingle() Me.ucrSelectorForViewObject = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() Me.ucrPnlContentsToView = New instat.UcrPanel() + Me.ucrInputObjectType = New instat.ucrInputComboBox() + Me.lblObjectType = New System.Windows.Forms.Label() + Me.rdoOutputObjects = New System.Windows.Forms.RadioButton() + Me.rdoDataObjects = New System.Windows.Forms.RadioButton() + Me.ucrPnlOptions = New instat.UcrPanel() Me.SuspendLayout() ' 'lblSelectedObject ' Me.lblSelectedObject.AutoSize = True - Me.lblSelectedObject.Location = New System.Drawing.Point(250, 45) + Me.lblSelectedObject.Location = New System.Drawing.Point(369, 144) + Me.lblSelectedObject.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) Me.lblSelectedObject.Name = "lblSelectedObject" - Me.lblSelectedObject.Size = New System.Drawing.Size(79, 13) + Me.lblSelectedObject.Size = New System.Drawing.Size(59, 20) Me.lblSelectedObject.TabIndex = 1 - Me.lblSelectedObject.Text = "Object to View:" + Me.lblSelectedObject.Text = "Object:" ' 'rdoStructure ' Me.rdoStructure.AutoSize = True - Me.rdoStructure.Location = New System.Drawing.Point(256, 116) + Me.rdoStructure.Location = New System.Drawing.Point(378, 252) + Me.rdoStructure.Margin = New System.Windows.Forms.Padding(4) Me.rdoStructure.Name = "rdoStructure" - Me.rdoStructure.Size = New System.Drawing.Size(68, 17) + Me.rdoStructure.Size = New System.Drawing.Size(100, 24) Me.rdoStructure.TabIndex = 5 Me.rdoStructure.TabStop = True Me.rdoStructure.Tag = "Structure" Me.rdoStructure.Text = "Structure" Me.rdoStructure.UseVisualStyleBackColor = True ' - 'rdoAllContents - ' - Me.rdoAllContents.AutoSize = True - Me.rdoAllContents.Location = New System.Drawing.Point(256, 136) - Me.rdoAllContents.Name = "rdoAllContents" - Me.rdoAllContents.Size = New System.Drawing.Size(81, 17) - Me.rdoAllContents.TabIndex = 6 - Me.rdoAllContents.TabStop = True - Me.rdoAllContents.Tag = "All_Contents" - Me.rdoAllContents.Text = "All Contents" - Me.rdoAllContents.UseVisualStyleBackColor = True - ' - 'rdoComponent - ' - Me.rdoComponent.AutoSize = True - Me.rdoComponent.Location = New System.Drawing.Point(256, 158) - Me.rdoComponent.Name = "rdoComponent" - Me.rdoComponent.Size = New System.Drawing.Size(79, 17) - Me.rdoComponent.TabIndex = 7 - Me.rdoComponent.TabStop = True - Me.rdoComponent.Tag = "Component" - Me.rdoComponent.Text = "Component" - Me.rdoComponent.UseVisualStyleBackColor = True - ' 'rdoPrint ' Me.rdoPrint.AutoSize = True - Me.rdoPrint.Location = New System.Drawing.Point(256, 94) + Me.rdoPrint.Location = New System.Drawing.Point(378, 219) + Me.rdoPrint.Margin = New System.Windows.Forms.Padding(4) Me.rdoPrint.Name = "rdoPrint" - Me.rdoPrint.Size = New System.Drawing.Size(46, 17) + Me.rdoPrint.Size = New System.Drawing.Size(66, 24) Me.rdoPrint.TabIndex = 4 Me.rdoPrint.TabStop = True Me.rdoPrint.Text = "Print" @@ -109,11 +91,11 @@ Partial Class dlgViewObjects ' Me.ucrReceiverSelectedObject.AutoSize = True Me.ucrReceiverSelectedObject.frmParent = Me - Me.ucrReceiverSelectedObject.Location = New System.Drawing.Point(250, 60) + Me.ucrReceiverSelectedObject.Location = New System.Drawing.Point(369, 166) Me.ucrReceiverSelectedObject.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverSelectedObject.Name = "ucrReceiverSelectedObject" Me.ucrReceiverSelectedObject.Selector = Nothing - Me.ucrReceiverSelectedObject.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverSelectedObject.Size = New System.Drawing.Size(206, 30) Me.ucrReceiverSelectedObject.strNcFilePath = "" Me.ucrReceiverSelectedObject.TabIndex = 2 Me.ucrReceiverSelectedObject.ucrSelector = Nothing @@ -124,40 +106,114 @@ Partial Class dlgViewObjects Me.ucrSelectorForViewObject.bDropUnusedFilterLevels = False Me.ucrSelectorForViewObject.bShowHiddenColumns = False Me.ucrSelectorForViewObject.bUseCurrentFilter = True - Me.ucrSelectorForViewObject.Location = New System.Drawing.Point(10, 10) + Me.ucrSelectorForViewObject.Location = New System.Drawing.Point(9, 51) Me.ucrSelectorForViewObject.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorForViewObject.Name = "ucrSelectorForViewObject" - Me.ucrSelectorForViewObject.Size = New System.Drawing.Size(213, 183) + Me.ucrSelectorForViewObject.Size = New System.Drawing.Size(320, 274) Me.ucrSelectorForViewObject.TabIndex = 0 ' 'ucrBase ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 206) - Me.ucrBase.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrBase.Location = New System.Drawing.Point(6, 369) + Me.ucrBase.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) + Me.ucrBase.Size = New System.Drawing.Size(611, 77) Me.ucrBase.TabIndex = 8 ' 'ucrPnlContentsToView ' Me.ucrPnlContentsToView.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlContentsToView.Location = New System.Drawing.Point(250, 90) - Me.ucrPnlContentsToView.Margin = New System.Windows.Forms.Padding(6, 8, 6, 8) + Me.ucrPnlContentsToView.Location = New System.Drawing.Point(369, 208) + Me.ucrPnlContentsToView.Margin = New System.Windows.Forms.Padding(9, 12, 9, 12) Me.ucrPnlContentsToView.Name = "ucrPnlContentsToView" - Me.ucrPnlContentsToView.Size = New System.Drawing.Size(120, 100) + Me.ucrPnlContentsToView.Size = New System.Drawing.Size(180, 100) Me.ucrPnlContentsToView.TabIndex = 3 ' + 'ucrInputObjectType + ' + Me.ucrInputObjectType.AddQuotesIfUnrecognised = True + Me.ucrInputObjectType.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputObjectType.GetSetSelectedIndex = -1 + Me.ucrInputObjectType.IsReadOnly = False + Me.ucrInputObjectType.Location = New System.Drawing.Point(369, 106) + Me.ucrInputObjectType.Margin = New System.Windows.Forms.Padding(14) + Me.ucrInputObjectType.Name = "ucrInputObjectType" + Me.ucrInputObjectType.Size = New System.Drawing.Size(206, 32) + Me.ucrInputObjectType.TabIndex = 9 + ' + 'lblObjectType + ' + Me.lblObjectType.AutoSize = True + Me.lblObjectType.Location = New System.Drawing.Point(369, 84) + Me.lblObjectType.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblObjectType.Name = "lblObjectType" + Me.lblObjectType.Size = New System.Drawing.Size(47, 20) + Me.lblObjectType.TabIndex = 10 + Me.lblObjectType.Text = "Type:" + ' + 'rdoOutputObjects + ' + Me.rdoOutputObjects.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoOutputObjects.BackColor = System.Drawing.SystemColors.Control + Me.rdoOutputObjects.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoOutputObjects.FlatAppearance.BorderSize = 2 + Me.rdoOutputObjects.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoOutputObjects.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoOutputObjects.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoOutputObjects.Location = New System.Drawing.Point(141, 3) + Me.rdoOutputObjects.Margin = New System.Windows.Forms.Padding(4) + Me.rdoOutputObjects.Name = "rdoOutputObjects" + Me.rdoOutputObjects.Size = New System.Drawing.Size(180, 42) + Me.rdoOutputObjects.TabIndex = 15 + Me.rdoOutputObjects.TabStop = True + Me.rdoOutputObjects.Tag = "" + Me.rdoOutputObjects.Text = "Output Objects" + Me.rdoOutputObjects.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoOutputObjects.UseVisualStyleBackColor = False + ' + 'rdoDataObjects + ' + Me.rdoDataObjects.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoDataObjects.BackColor = System.Drawing.SystemColors.Control + Me.rdoDataObjects.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoDataObjects.FlatAppearance.BorderSize = 2 + Me.rdoDataObjects.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoDataObjects.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoDataObjects.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoDataObjects.Location = New System.Drawing.Point(320, 3) + Me.rdoDataObjects.Margin = New System.Windows.Forms.Padding(4) + Me.rdoDataObjects.Name = "rdoDataObjects" + Me.rdoDataObjects.Size = New System.Drawing.Size(180, 42) + Me.rdoDataObjects.TabIndex = 16 + Me.rdoDataObjects.TabStop = True + Me.rdoDataObjects.Tag = "" + Me.rdoDataObjects.Text = "Data Objects" + Me.rdoDataObjects.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoDataObjects.UseVisualStyleBackColor = False + ' + 'ucrPnlOptions + ' + Me.ucrPnlOptions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlOptions.Location = New System.Drawing.Point(4, -2) + Me.ucrPnlOptions.Margin = New System.Windows.Forms.Padding(9) + Me.ucrPnlOptions.Name = "ucrPnlOptions" + Me.ucrPnlOptions.Size = New System.Drawing.Size(602, 54) + Me.ucrPnlOptions.TabIndex = 14 + ' 'dlgViewObjects ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) + Me.AutoScaleDimensions = New System.Drawing.SizeF(144.0!, 144.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True - Me.ClientSize = New System.Drawing.Size(416, 262) + Me.ClientSize = New System.Drawing.Size(624, 453) + Me.Controls.Add(Me.rdoOutputObjects) + Me.Controls.Add(Me.rdoDataObjects) + Me.Controls.Add(Me.ucrPnlOptions) + Me.Controls.Add(Me.lblObjectType) + Me.Controls.Add(Me.ucrInputObjectType) Me.Controls.Add(Me.rdoPrint) - Me.Controls.Add(Me.rdoComponent) - Me.Controls.Add(Me.rdoAllContents) Me.Controls.Add(Me.rdoStructure) Me.Controls.Add(Me.ucrReceiverSelectedObject) Me.Controls.Add(Me.lblSelectedObject) @@ -165,6 +221,7 @@ Partial Class dlgViewObjects Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.ucrPnlContentsToView) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow + Me.Margin = New System.Windows.Forms.Padding(4) Me.MaximizeBox = False Me.MinimizeBox = False Me.Name = "dlgViewObjects" @@ -181,8 +238,11 @@ Partial Class dlgViewObjects Friend WithEvents lblSelectedObject As Label Friend WithEvents ucrReceiverSelectedObject As ucrReceiverSingle Friend WithEvents rdoStructure As RadioButton - Friend WithEvents rdoAllContents As RadioButton - Friend WithEvents rdoComponent As RadioButton Friend WithEvents rdoPrint As RadioButton Friend WithEvents ucrPnlContentsToView As UcrPanel + Friend WithEvents lblObjectType As Label + Friend WithEvents ucrInputObjectType As ucrInputComboBox + Friend WithEvents rdoOutputObjects As RadioButton + Friend WithEvents rdoDataObjects As RadioButton + Friend WithEvents ucrPnlOptions As UcrPanel End Class diff --git a/instat/dlgViewObjects.vb b/instat/dlgViewObjects.vb index 0d213eb734e..216af6b2ba4 100644 --- a/instat/dlgViewObjects.vb +++ b/instat/dlgViewObjects.vb @@ -21,6 +21,7 @@ Public Class dlgViewObjects Private bFirstLoad As Boolean = True Private bReset As Boolean = True Private clsStructureRFunction, clsPrintRFunction As New RFunction + Private dctTypes As New Dictionary(Of String, String) Private Sub dlgViewObjects_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -41,27 +42,36 @@ Public Class dlgViewObjects 'todo. temporary to have the str() output captured as text ucrBase.clsRsyntax.iCallType = -1 - ' ucr receiver - ucrReceiverSelectedObject.SetParameter(New RParameter("x", 1)) - ucrReceiverSelectedObject.SetParameterIsRFunction() + ucrPnlOptions.AddRadioButton(rdoOutputObjects) + ucrPnlOptions.AddRadioButton(rdoDataObjects) + 'todo disabled until functionality of viewing data objects is implemented + rdoDataObjects.Enabled = False + ucrPnlOptions.AddFunctionNamesCondition(rdoOutputObjects, {frmMain.clsRLink.strInstatDataObject & "$get_object_data", "str"}) + + ucrSelectorForViewObject.SetParameter(New RParameter("data_name", 0)) + ucrSelectorForViewObject.SetParameterIsString() + + dctTypes.Add("Objects", "object") + dctTypes.Add("Summaries", RObjectTypeLabel.Summary) + dctTypes.Add("Tables", RObjectTypeLabel.Table) + dctTypes.Add("Graphs", RObjectTypeLabel.Graph) + dctTypes.Add("Models", RObjectTypeLabel.Model) + dctTypes.Add("Structured", RObjectTypeLabel.StructureLabel) + ucrInputObjectType.SetItems(dctTypes, bSetConditions:=False) + ucrInputObjectType.SetDropDownStyleAsNonEditable() + + ucrReceiverSelectedObject.SetParameter(New RParameter("object_name", 1)) ucrReceiverSelectedObject.Selector = ucrSelectorForViewObject ucrReceiverSelectedObject.SetMeAsReceiver() ucrReceiverSelectedObject.strSelectorHeading = "Objects" ucrReceiverSelectedObject.SetItemType("object") ucrReceiverSelectedObject.bAutoFill = True - 'todo. disabling and hiding this for now until they're working correctly. - 'calling print via a dialog currently does not work correctly - rdoPrint.Enabled = False - rdoAllContents.Visible = False - rdoComponent.Visible = False - - 'add radio buttons to the panel rdo's - 'ucrPnlContentsToView.AddRadioButton(rdoPrint) + ucrPnlContentsToView.AddRadioButton(rdoPrint) ucrPnlContentsToView.AddRadioButton(rdoStructure) - 'ucrPnlContentsToView.AddFunctionNamesCondition(rdoPrint, "print") - ucrPnlContentsToView.AddFunctionNamesCondition(rdoStructure, "str") + ucrPnlContentsToView.AddFunctionNamesCondition(rdoPrint, frmMain.clsRLink.strInstatDataObject & "$get_object_data", bNewIsPositive:=True) + ucrPnlContentsToView.AddFunctionNamesCondition(rdoStructure, "str", bNewIsPositive:=True) End Sub @@ -72,32 +82,46 @@ Public Class dlgViewObjects 'reset controls to default states ucrSelectorForViewObject.Reset() - rdoStructure.Checked = True + ucrInputObjectType.GetSetSelectedIndex = 0 + rdoPrint.Checked = True 'set R function for showing selected object structure - clsPrintRFunction.SetRCommand("print") clsStructureRFunction.SetRCommand("str") + 'as of 02/3/2023 get object data is used instead of print command because the print command is not yet supported for html formats. + clsPrintRFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_object_data") + clsPrintRFunction.AddParameter("as_file", "TRUE", iPosition:=2) - 'set the base function - ucrBase.clsRsyntax.SetBaseRFunction(clsStructureRFunction) + ucrBase.clsRsyntax.SetBaseRFunction(clsPrintRFunction) End Sub Private Sub SetRCodeforControls(bReset As Boolean) ucrReceiverSelectedObject.AddAdditionalCodeParameterPair(clsStructureRFunction, New RParameter("object", 1)) + ucrSelectorForViewObject.SetRCode(clsPrintRFunction, bReset) ucrReceiverSelectedObject.SetRCode(clsPrintRFunction, bReset) - ucrPnlContentsToView.SetRCode(ucrBase.clsRsyntax.clsBaseFunction, bReset) + ucrPnlContentsToView.SetRCode(ucrBase.clsRsyntax.clsBaseFunction) + ucrPnlOptions.SetRCode(ucrBase.clsRsyntax.clsBaseFunction) End Sub Private Sub TestOKEnabled() ucrBase.OKEnabled(Not ucrReceiverSelectedObject.IsEmpty) End Sub + Private Sub ucrInputObjectType_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputObjectType.ControlValueChanged + ucrReceiverSelectedObject.Clear() + If dctTypes.ContainsKey(ucrInputObjectType.GetText()) Then + ucrReceiverSelectedObject.strSelectorHeading = ucrInputObjectType.GetText() + ucrReceiverSelectedObject.SetItemType(dctTypes.Item(ucrInputObjectType.GetText())) + End If + End Sub + Private Sub ucrPnlContentsToReview_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlContentsToView.ControlContentsChanged - 'set the appropriate Base RFunction + 'set the appropriate base RFunction If rdoPrint.Checked Then + ucrReceiverSelectedObject.SetParameterIsString() ucrBase.clsRsyntax.SetBaseRFunction(clsPrintRFunction) ElseIf rdoStructure.Checked Then + ucrReceiverSelectedObject.SetParameterIsRFunction() ucrBase.clsRsyntax.SetBaseRFunction(clsStructureRFunction) End If End Sub diff --git a/instat/instat.vbproj b/instat/instat.vbproj index 1d5045c78be..168dc6702f1 100644 --- a/instat/instat.vbproj +++ b/instat/instat.vbproj @@ -155,13 +155,18 @@ ..\packages\R.NET.1.8.2\lib\netstandard2.0\RDotNet.dll - - ..\packages\RScript.1.0.6\lib\net461\RScript.dll + + ..\packages\RScript.1.0.9\lib\net461\RScript.dll ..\packages\jacobslusser.ScintillaNET.3.6.3\lib\net40\ScintillaNET.dll + + ..\packages\System.Collections.Specialized.4.3.0\lib\net46\System.Collections.Specialized.dll + True + True + diff --git a/instat/packages.config b/instat/packages.config index 706fdd44476..51f542b07de 100644 --- a/instat/packages.config +++ b/instat/packages.config @@ -11,8 +11,9 @@ - + + diff --git a/instat/static/InstatObject/R/data_object_R6.R b/instat/static/InstatObject/R/data_object_R6.R index bd57034b5f9..508099aedbc 100644 --- a/instat/static/InstatObject/R/data_object_R6.R +++ b/instat/static/InstatObject/R/data_object_R6.R @@ -456,13 +456,15 @@ DataSheet$set("public", "get_variables_metadata", function(data_type = "all", co if(missing(column)) { curr_data <- private$data cols <- names(curr_data) + if(self$column_selection_applied()) cols <- self$current_column_selection } else { cols <- column + if(self$column_selection_applied()) cols <- self$current_column_selection curr_data <- private$data[column] } - for(i in seq_along(cols)) { - col <- curr_data[[i]] + for (i in seq_along(cols)) { + col <- curr_data[[cols[i]]] ind <- which(names(attributes(col)) == "levels") if(length(ind) > 0) col_attributes <- attributes(col)[-ind] else col_attributes <- attributes(col) @@ -2157,9 +2159,11 @@ DataSheet$set("public", "get_object", function(object_name) { ) DataSheet$set("public", "rename_object", function(object_name, new_name, object_type = "object") { - if(!object_type %in% c("object", "filter", "calculation", "graph", "table","model", "column_selection")) stop(object_type, " must be either object (graph, table or model), filter, column_selection or a calculation.") + if(!object_type %in% c("object", "filter", "calculation", "graph", "table","model","structure","summary", "column_selection")) stop(object_type, " must be either object (graph, table or model), filter, column_selection or a calculation.") + #Temp fix:: added graph, table and model so as to distinguish this when implementing it in the dialog. Otherwise they remain as objects - if (object_type %in% c("object", "graph", "table","model")){ + if (object_type %in% c("object", "graph", "table","model","structure","summary")){ + if(!object_name %in% names(private$objects)) stop(object_name, " not found in objects list") if(new_name %in% names(private$objects)) stop(new_name, " is already an object name. Cannot rename ", object_name, " to ", new_name) names(private$objects)[names(private$objects) == object_name] <- new_name @@ -2187,8 +2191,10 @@ DataSheet$set("public", "rename_object", function(object_name, new_name, object_ ) DataSheet$set("public", "delete_objects", function(data_name, object_names, object_type = "object") { - if(!object_type %in% c("object", "graph", "table","model","filter", "calculation", "column_selection")) stop(object_type, " must be either object (graph, table or model), filter, column selection or a calculation.") - if(any(object_type %in% c("object", "graph", "table","model"))){ + if(!object_type %in% c("object", "graph", "table","model","structure","summary","filter", "calculation", "column_selection")) stop(object_type, " must be either object (graph, table or model), filter, column selection or a calculation.") + + if(any(object_type %in% c("object", "graph", "table","model","structure","summary"))){ + if(!all(object_names %in% names(private$objects))) stop("Not all object_names found in overall objects list.") private$objects[names(private$objects) %in% object_names] <- NULL }else if(object_type == "filter"){ diff --git a/instat/ucrAdditionalLayers.Designer.vb b/instat/ucrAdditionalLayers.Designer.vb index 88b5190cd5e..5588aabaaf2 100644 --- a/instat/ucrAdditionalLayers.Designer.vb +++ b/instat/ucrAdditionalLayers.Designer.vb @@ -50,12 +50,8 @@ Partial Class ucrAdditionalLayers Me.toolStripMenuItemGeomCol = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemGeomCount = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemGeomDensity = New System.Windows.Forms.ToolStripMenuItem() - Me.toolStripMenuItemGeomJitter = New System.Windows.Forms.ToolStripMenuItem() - Me.toolStripMenuItemGeomPath = New System.Windows.Forms.ToolStripMenuItem() - Me.toolStripMenuItemGeomEncircle = New System.Windows.Forms.ToolStripMenuItem() - Me.toolStripMenuItemGeomDumbbell = New System.Windows.Forms.ToolStripMenuItem() - Me.cmdEdit = New System.Windows.Forms.Button() Me.toolStripMenuItemGeomDensityRidges = New System.Windows.Forms.ToolStripMenuItem() + Me.toolStripMenuItemGeomJitter = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemGeomLabel = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemGeomLabelRepel = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemGeomLine = New System.Windows.Forms.ToolStripMenuItem() @@ -63,6 +59,13 @@ Partial Class ucrAdditionalLayers Me.toolStripMenuItemGeomRugSmooth = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemGeomText = New System.Windows.Forms.ToolStripMenuItem() Me.toolStripMenuItemGeomTextRepel = New System.Windows.Forms.ToolStripMenuItem() + Me.cmdEdit = New System.Windows.Forms.Button() + Me.toolStripMenuItemGeomtile = New System.Windows.Forms.ToolStripMenuItem() + Me.toolStripMenuItemGeomparallelslopes = New System.Windows.Forms.ToolStripMenuItem() + Me.toolStripMenuItemGeomcategoricalmodel = New System.Windows.Forms.ToolStripMenuItem() + Me.toolStripMenuItemGeomhistogram = New System.Windows.Forms.ToolStripMenuItem() + Me.toolStripMenuItemGeomcontour = New System.Windows.Forms.ToolStripMenuItem() + Me.GeomsmoothToolStripMenuItem = New System.Windows.Forms.ToolStripMenuItem() Me.grpGeoms.SuspendLayout() Me.contextMenuStripAdd.SuspendLayout() Me.SuspendLayout() @@ -70,10 +73,9 @@ Partial Class ucrAdditionalLayers 'lblLayers ' Me.lblLayers.AutoSize = True - Me.lblLayers.Location = New System.Drawing.Point(6, 20) - Me.lblLayers.Margin = New System.Windows.Forms.Padding(4, 0, 4, 0) + Me.lblLayers.Location = New System.Drawing.Point(4, 13) Me.lblLayers.Name = "lblLayers" - Me.lblLayers.Size = New System.Drawing.Size(60, 20) + Me.lblLayers.Size = New System.Drawing.Size(41, 13) Me.lblLayers.TabIndex = 5 Me.lblLayers.Text = "Layers:" ' @@ -81,10 +83,9 @@ Partial Class ucrAdditionalLayers ' Me.lstLayers.FullRowSelect = True Me.lstLayers.HideSelection = False - Me.lstLayers.Location = New System.Drawing.Point(4, 42) - Me.lstLayers.Margin = New System.Windows.Forms.Padding(4) + Me.lstLayers.Location = New System.Drawing.Point(3, 28) Me.lstLayers.Name = "lstLayers" - Me.lstLayers.Size = New System.Drawing.Size(186, 222) + Me.lstLayers.Size = New System.Drawing.Size(125, 149) Me.lstLayers.TabIndex = 4 Me.lstLayers.UseCompatibleStateImageBehavior = False Me.lstLayers.View = System.Windows.Forms.View.List @@ -94,21 +95,18 @@ Partial Class ucrAdditionalLayers Me.grpGeoms.Controls.Add(Me.cmdDelete) Me.grpGeoms.Controls.Add(Me.cmdAdd) Me.grpGeoms.Controls.Add(Me.cmdEdit) - Me.grpGeoms.Location = New System.Drawing.Point(201, 80) - Me.grpGeoms.Margin = New System.Windows.Forms.Padding(4) + Me.grpGeoms.Location = New System.Drawing.Point(134, 53) Me.grpGeoms.Name = "grpGeoms" - Me.grpGeoms.Padding = New System.Windows.Forms.Padding(4) - Me.grpGeoms.Size = New System.Drawing.Size(159, 150) + Me.grpGeoms.Size = New System.Drawing.Size(106, 100) Me.grpGeoms.TabIndex = 9 Me.grpGeoms.TabStop = False Me.grpGeoms.Text = "Geoms:" ' 'cmdDelete ' - Me.cmdDelete.Location = New System.Drawing.Point(24, 108) - Me.cmdDelete.Margin = New System.Windows.Forms.Padding(4) + Me.cmdDelete.Location = New System.Drawing.Point(16, 72) Me.cmdDelete.Name = "cmdDelete" - Me.cmdDelete.Size = New System.Drawing.Size(112, 34) + Me.cmdDelete.Size = New System.Drawing.Size(75, 23) Me.cmdDelete.TabIndex = 9 Me.cmdDelete.Text = "Delete" Me.cmdDelete.UseVisualStyleBackColor = True @@ -117,10 +115,9 @@ Partial Class ucrAdditionalLayers ' Me.cmdAdd.AutoSize = True Me.cmdAdd.ContextMenuStrip = Me.contextMenuStripAdd - Me.cmdAdd.Location = New System.Drawing.Point(24, 22) - Me.cmdAdd.Margin = New System.Windows.Forms.Padding(4) + Me.cmdAdd.Location = New System.Drawing.Point(16, 15) Me.cmdAdd.Name = "cmdAdd" - Me.cmdAdd.Size = New System.Drawing.Size(112, 34) + Me.cmdAdd.Size = New System.Drawing.Size(75, 23) Me.cmdAdd.SplitMenuStrip = Me.contextMenuStripAdd Me.cmdAdd.TabIndex = 11 Me.cmdAdd.Tag = "Add" @@ -130,133 +127,149 @@ Partial Class ucrAdditionalLayers 'contextMenuStripAdd ' Me.contextMenuStripAdd.ImageScalingSize = New System.Drawing.Size(24, 24) - Me.contextMenuStripAdd.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripMenuItemGeomBoxPlot, Me.toolStripMenuItemGeomBar, Me.toolStripMenuItemGeomCol, Me.toolStripMenuItemGeomCount, Me.toolStripMenuItemGeomDensity, Me.toolStripMenuItemGeomDensityRidges, Me.toolStripMenuItemGeomJitter, Me.toolStripMenuItemGeomPath, Me.toolStripMenuItemGeomEncircle, Me.toolStripMenuItemGeomDumbbell, Me.toolStripMenuItemGeomLabel, Me.toolStripMenuItemGeomLabelRepel, Me.toolStripMenuItemGeomLine, Me.toolStripMenuItemGeomPoint, Me.toolStripMenuItemGeomRugSmooth, Me.toolStripMenuItemGeomText, Me.toolStripMenuItemGeomTextRepel}) + Me.contextMenuStripAdd.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.toolStripMenuItemGeomBar, Me.toolStripMenuItemGeomBoxPlot, Me.toolStripMenuItemGeomcategoricalmodel, Me.toolStripMenuItemGeomCol, Me.toolStripMenuItemGeomcontour, Me.toolStripMenuItemGeomCount, Me.toolStripMenuItemGeomDensity, Me.toolStripMenuItemGeomDensityRidges, Me.toolStripMenuItemGeomhistogram, Me.toolStripMenuItemGeomJitter, Me.toolStripMenuItemGeomLabel, Me.toolStripMenuItemGeomLabelRepel, Me.toolStripMenuItemGeomLine, Me.toolStripMenuItemGeomparallelslopes, Me.toolStripMenuItemGeomPoint, Me.toolStripMenuItemGeomRugSmooth, Me.GeomsmoothToolStripMenuItem, Me.toolStripMenuItemGeomText, Me.toolStripMenuItemGeomTextRepel, Me.toolStripMenuItemGeomtile}) Me.contextMenuStripAdd.Name = "contextMenuStripOk" - Me.contextMenuStripAdd.Size = New System.Drawing.Size(252, 581) + Me.contextMenuStripAdd.Size = New System.Drawing.Size(208, 466) ' 'toolStripMenuItemGeomBoxPlot ' Me.toolStripMenuItemGeomBoxPlot.Name = "toolStripMenuItemGeomBoxPlot" - Me.toolStripMenuItemGeomBoxPlot.Size = New System.Drawing.Size(251, 32) + Me.toolStripMenuItemGeomBoxPlot.Size = New System.Drawing.Size(207, 22) Me.toolStripMenuItemGeomBoxPlot.Text = "geom_boxplot" ' 'toolStripMenuItemGeomBar ' Me.toolStripMenuItemGeomBar.Name = "toolStripMenuItemGeomBar" - Me.toolStripMenuItemGeomBar.Size = New System.Drawing.Size(251, 32) + Me.toolStripMenuItemGeomBar.Size = New System.Drawing.Size(207, 22) Me.toolStripMenuItemGeomBar.Text = "geom_bar" ' 'toolStripMenuItemGeomCol ' Me.toolStripMenuItemGeomCol.Name = "toolStripMenuItemGeomCol" - Me.toolStripMenuItemGeomCol.Size = New System.Drawing.Size(251, 32) + Me.toolStripMenuItemGeomCol.Size = New System.Drawing.Size(207, 22) Me.toolStripMenuItemGeomCol.Text = "geom_col" ' 'toolStripMenuItemGeomCount ' Me.toolStripMenuItemGeomCount.Name = "toolStripMenuItemGeomCount" - Me.toolStripMenuItemGeomCount.Size = New System.Drawing.Size(251, 32) + Me.toolStripMenuItemGeomCount.Size = New System.Drawing.Size(207, 22) Me.toolStripMenuItemGeomCount.Text = "geom_count" ' 'toolStripMenuItemGeomDensity ' Me.toolStripMenuItemGeomDensity.Name = "toolStripMenuItemGeomDensity" - Me.toolStripMenuItemGeomDensity.Size = New System.Drawing.Size(251, 32) + Me.toolStripMenuItemGeomDensity.Size = New System.Drawing.Size(207, 22) Me.toolStripMenuItemGeomDensity.Text = "geom_density" ' - 'toolStripMenuItemGeomJitter - ' - Me.toolStripMenuItemGeomJitter.Name = "toolStripMenuItemGeomJitter" - Me.toolStripMenuItemGeomJitter.Size = New System.Drawing.Size(251, 32) - Me.toolStripMenuItemGeomJitter.Text = "geom_jitter" - ' - 'toolStripMenuItemGeomPath - ' - Me.toolStripMenuItemGeomPath.Name = "toolStripMenuItemGeomPath" - Me.toolStripMenuItemGeomPath.Size = New System.Drawing.Size(251, 32) - Me.toolStripMenuItemGeomPath.Text = "geom_path" - ' - 'toolStripMenuItemGeomEncircle - ' - Me.toolStripMenuItemGeomEncircle.Name = "toolStripMenuItemGeomEncircle" - Me.toolStripMenuItemGeomEncircle.Size = New System.Drawing.Size(251, 32) - Me.toolStripMenuItemGeomEncircle.Text = "geom_encircle" - ' - 'toolStripMenuItemGeomDumbbell - ' - Me.toolStripMenuItemGeomDumbbell.Name = "toolStripMenuItemGeomDumbbell" - Me.toolStripMenuItemGeomDumbbell.Size = New System.Drawing.Size(251, 32) - Me.toolStripMenuItemGeomDumbbell.Text = "geom_dumbbell" - ' - 'cmdEdit - ' - Me.cmdEdit.Location = New System.Drawing.Point(24, 64) - Me.cmdEdit.Margin = New System.Windows.Forms.Padding(4) - Me.cmdEdit.Name = "cmdEdit" - Me.cmdEdit.Size = New System.Drawing.Size(112, 34) - Me.cmdEdit.TabIndex = 10 - Me.cmdEdit.Text = "Edit" - Me.cmdEdit.UseVisualStyleBackColor = True - ' 'toolStripMenuItemGeomDensityRidges ' Me.toolStripMenuItemGeomDensityRidges.Name = "toolStripMenuItemGeomDensityRidges" - Me.toolStripMenuItemGeomDensityRidges.Size = New System.Drawing.Size(251, 32) + Me.toolStripMenuItemGeomDensityRidges.Size = New System.Drawing.Size(207, 22) Me.toolStripMenuItemGeomDensityRidges.Text = "geom_density_ridges" ' + 'toolStripMenuItemGeomJitter + ' + Me.toolStripMenuItemGeomJitter.Name = "toolStripMenuItemGeomJitter" + Me.toolStripMenuItemGeomJitter.Size = New System.Drawing.Size(207, 22) + Me.toolStripMenuItemGeomJitter.Text = "geom_jitter" + ' 'toolStripMenuItemGeomLabel ' Me.toolStripMenuItemGeomLabel.Name = "toolStripMenuItemGeomLabel" - Me.toolStripMenuItemGeomLabel.Size = New System.Drawing.Size(251, 32) + Me.toolStripMenuItemGeomLabel.Size = New System.Drawing.Size(207, 22) Me.toolStripMenuItemGeomLabel.Text = "geom_label" ' 'toolStripMenuItemGeomLabelRepel ' Me.toolStripMenuItemGeomLabelRepel.Name = "toolStripMenuItemGeomLabelRepel" - Me.toolStripMenuItemGeomLabelRepel.Size = New System.Drawing.Size(251, 32) + Me.toolStripMenuItemGeomLabelRepel.Size = New System.Drawing.Size(207, 22) Me.toolStripMenuItemGeomLabelRepel.Text = "geom_label_repel" ' 'toolStripMenuItemGeomLine ' Me.toolStripMenuItemGeomLine.Name = "toolStripMenuItemGeomLine" - Me.toolStripMenuItemGeomLine.Size = New System.Drawing.Size(251, 32) + Me.toolStripMenuItemGeomLine.Size = New System.Drawing.Size(207, 22) Me.toolStripMenuItemGeomLine.Text = "geom_line" ' 'toolStripMenuItemGeomPoint ' Me.toolStripMenuItemGeomPoint.Name = "toolStripMenuItemGeomPoint" - Me.toolStripMenuItemGeomPoint.Size = New System.Drawing.Size(251, 32) + Me.toolStripMenuItemGeomPoint.Size = New System.Drawing.Size(207, 22) Me.toolStripMenuItemGeomPoint.Text = "geom_point" ' 'toolStripMenuItemGeomRugSmooth ' Me.toolStripMenuItemGeomRugSmooth.Name = "toolStripMenuItemGeomRugSmooth" - Me.toolStripMenuItemGeomRugSmooth.Size = New System.Drawing.Size(251, 32) - Me.toolStripMenuItemGeomRugSmooth.Text = "geom_rug_smooth" + Me.toolStripMenuItemGeomRugSmooth.Size = New System.Drawing.Size(207, 22) + Me.toolStripMenuItemGeomRugSmooth.Text = "geom_rug" ' 'toolStripMenuItemGeomText ' Me.toolStripMenuItemGeomText.Name = "toolStripMenuItemGeomText" - Me.toolStripMenuItemGeomText.Size = New System.Drawing.Size(251, 32) + Me.toolStripMenuItemGeomText.Size = New System.Drawing.Size(207, 22) Me.toolStripMenuItemGeomText.Text = "geom_text" ' 'toolStripMenuItemGeomTextRepel ' Me.toolStripMenuItemGeomTextRepel.Name = "toolStripMenuItemGeomTextRepel" - Me.toolStripMenuItemGeomTextRepel.Size = New System.Drawing.Size(251, 32) + Me.toolStripMenuItemGeomTextRepel.Size = New System.Drawing.Size(207, 22) Me.toolStripMenuItemGeomTextRepel.Text = "geom_text_repel" ' + 'cmdEdit + ' + Me.cmdEdit.Location = New System.Drawing.Point(16, 43) + Me.cmdEdit.Name = "cmdEdit" + Me.cmdEdit.Size = New System.Drawing.Size(75, 23) + Me.cmdEdit.TabIndex = 10 + Me.cmdEdit.Text = "Edit" + Me.cmdEdit.UseVisualStyleBackColor = True + ' + 'toolStripMenuItemGeomtile + ' + Me.toolStripMenuItemGeomtile.Name = "toolStripMenuItemGeomtile" + Me.toolStripMenuItemGeomtile.Size = New System.Drawing.Size(207, 22) + Me.toolStripMenuItemGeomtile.Text = "geom_tile" + ' + 'toolStripMenuItemGeomparallelslopes + ' + Me.toolStripMenuItemGeomparallelslopes.Name = "toolStripMenuItemGeomparallelslopes" + Me.toolStripMenuItemGeomparallelslopes.Size = New System.Drawing.Size(207, 22) + Me.toolStripMenuItemGeomparallelslopes.Text = "geom_parallel_slopes" + ' + 'toolStripMenuItemGeomcategoricalmodel + ' + Me.toolStripMenuItemGeomcategoricalmodel.Name = "toolStripMenuItemGeomcategoricalmodel" + Me.toolStripMenuItemGeomcategoricalmodel.Size = New System.Drawing.Size(207, 22) + Me.toolStripMenuItemGeomcategoricalmodel.Text = "geom_categorical_model" + ' + 'toolStripMenuItemGeomhistogram + ' + Me.toolStripMenuItemGeomhistogram.Name = "toolStripMenuItemGeomhistogram" + Me.toolStripMenuItemGeomhistogram.Size = New System.Drawing.Size(207, 22) + Me.toolStripMenuItemGeomhistogram.Text = "geom_histogram " + ' + 'toolStripMenuItemGeomcontour + ' + Me.toolStripMenuItemGeomcontour.Name = "toolStripMenuItemGeomcontour" + Me.toolStripMenuItemGeomcontour.Size = New System.Drawing.Size(207, 22) + Me.toolStripMenuItemGeomcontour.Text = "geom_contour" + ' + 'GeomsmoothToolStripMenuItem + ' + Me.GeomsmoothToolStripMenuItem.Name = "GeomsmoothToolStripMenuItem" + Me.GeomsmoothToolStripMenuItem.Size = New System.Drawing.Size(207, 22) + Me.GeomsmoothToolStripMenuItem.Text = "geom_smooth" + ' 'ucrAdditionalLayers ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(144.0!, 144.0!) + Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True Me.Controls.Add(Me.grpGeoms) Me.Controls.Add(Me.lblLayers) Me.Controls.Add(Me.lstLayers) - Me.Margin = New System.Windows.Forms.Padding(4) Me.Name = "ucrAdditionalLayers" - Me.Size = New System.Drawing.Size(374, 270) + Me.Size = New System.Drawing.Size(249, 180) Me.grpGeoms.ResumeLayout(False) Me.grpGeoms.PerformLayout() Me.contextMenuStripAdd.ResumeLayout(False) @@ -277,9 +290,6 @@ Partial Class ucrAdditionalLayers Friend WithEvents toolStripMenuItemGeomCount As ToolStripMenuItem Friend WithEvents toolStripMenuItemGeomDensity As ToolStripMenuItem Friend WithEvents toolStripMenuItemGeomJitter As ToolStripMenuItem - Friend WithEvents toolStripMenuItemGeomPath As ToolStripMenuItem - Friend WithEvents toolStripMenuItemGeomEncircle As ToolStripMenuItem - Friend WithEvents toolStripMenuItemGeomDumbbell As ToolStripMenuItem Friend WithEvents toolStripMenuItemGeomDensityRidges As ToolStripMenuItem Friend WithEvents toolStripMenuItemGeomLabel As ToolStripMenuItem Friend WithEvents toolStripMenuItemGeomLabelRepel As ToolStripMenuItem @@ -288,4 +298,10 @@ Partial Class ucrAdditionalLayers Friend WithEvents toolStripMenuItemGeomRugSmooth As ToolStripMenuItem Friend WithEvents toolStripMenuItemGeomText As ToolStripMenuItem Friend WithEvents toolStripMenuItemGeomTextRepel As ToolStripMenuItem + Friend WithEvents toolStripMenuItemGeomcategoricalmodel As ToolStripMenuItem + Friend WithEvents toolStripMenuItemGeomcontour As ToolStripMenuItem + Friend WithEvents toolStripMenuItemGeomhistogram As ToolStripMenuItem + Friend WithEvents toolStripMenuItemGeomparallelslopes As ToolStripMenuItem + Friend WithEvents GeomsmoothToolStripMenuItem As ToolStripMenuItem + Friend WithEvents toolStripMenuItemGeomtile As ToolStripMenuItem End Class diff --git a/instat/ucrAdditionalLayers.vb b/instat/ucrAdditionalLayers.vb index 77857eed708..a5431af837e 100644 --- a/instat/ucrAdditionalLayers.vb +++ b/instat/ucrAdditionalLayers.vb @@ -90,8 +90,8 @@ Public Class ucrAdditionalLayers SetEditDeleteEnabled() End Sub - Private Sub cmdAdd_Click(sender As Object, e As EventArgs) Handles cmdAdd.Click, toolStripMenuItemGeomBar.Click, toolStripMenuItemGeomBoxPlot.Click, toolStripMenuItemGeomCol.Click, toolStripMenuItemGeomCount.Click, - toolStripMenuItemGeomDensity.Click, toolStripMenuItemGeomEncircle.Click, toolStripMenuItemGeomJitter.Click, toolStripMenuItemGeomPath.Click, toolStripMenuItemGeomDumbbell.Click, toolStripMenuItemGeomLabel.Click, + Private Sub cmdAdd_Click(sender As Object, e As EventArgs) Handles cmdAdd.Click, toolStripMenuItemGeomBar.Click, toolStripMenuItemGeomBoxPlot.Click, toolStripMenuItemGeomCol.Click, toolStripMenuItemGeomCount.Click, toolStripMenuItemGeomcategoricalmodel.Click, + toolStripMenuItemGeomDensity.Click, toolStripMenuItemGeomJitter.Click, toolStripMenuItemGeomLabel.Click, toolStripMenuItemGeomparallelslopes.Click, toolStripMenuItemGeomtile.Click, toolStripMenuItemGeomcontour.Click, toolStripMenuItemGeomhistogram.Click, toolStripMenuItemGeomLabelRepel.Click, toolStripMenuItemGeomLine.Click, toolStripMenuItemGeomPoint.Click, toolStripMenuItemGeomRugSmooth.Click, toolStripMenuItemGeomText.Click, toolStripMenuItemGeomTextRepel.Click, toolStripMenuItemGeomDensityRidges.Click 'setup the geom function to use @@ -110,16 +110,14 @@ Public Class ucrAdditionalLayers strGeomRCommand = "geom_col" ElseIf sender Is toolStripMenuItemGeomDensity Then strGeomRCommand = "geom_density" - ElseIf sender Is toolStripMenuItemGeomEncircle Then - strPackage = "ggalt" - strGeomRCommand = "geom_encircle" + ElseIf sender Is toolStripMenuItemGeomtile Then + strGeomRCommand = "geom_tile" ElseIf sender Is toolStripMenuItemGeomJitter Then strGeomRCommand = "geom_jitter" - ElseIf sender Is toolStripMenuItemGeomPath Then - strGeomRCommand = "geom_path" - ElseIf sender Is toolStripMenuItemGeomDumbbell Then - strPackage = "ggalt" - strGeomRCommand = "geom_dumbbell" + ElseIf sender Is toolStripMenuItemGeomhistogram Then + strGeomRCommand = "geom_histogram" + ElseIf sender Is toolStripMenuItemGeomcontour Then + strGeomRCommand = "geom_contour" ElseIf sender Is toolStripMenuItemGeomDensityRidges Then strPackage = "ggridges" strGeomRCommand = "geom_density_ridges" @@ -139,6 +137,12 @@ Public Class ucrAdditionalLayers ElseIf sender Is toolStripMenuItemGeomTextRepel Then strPackage = "ggrepel" strGeomRCommand = "geom_text_repel" + ElseIf sender Is toolStripMenuItemGeomcategoricalmodel Then + strPackage = "moderndive" + strGeomRCommand = "geom_categorical_model" + ElseIf sender Is toolStripMenuItemGeomparallelslopes Then + strPackage = "moderndive" + strGeomRCommand = "geom_parallel_slopes" ElseIf sender Is cmdAdd Then bShowLayerSubdialog = True End If diff --git a/instat/ucrGeom.vb b/instat/ucrGeom.vb index 114757d40f9..48dd0d564fd 100644 --- a/instat/ucrGeom.vb +++ b/instat/ucrGeom.vb @@ -1793,7 +1793,7 @@ Public Class ucrGeom 'Geom_line Parameters clsgeom_rug.AddLayerParameter("sides", "list", Chr(34) & "bl" & Chr(34), lstParameterStrings:={Chr(34) & "trbl" & Chr(34), Chr(34) & "trb" & Chr(34), Chr(34) & "trl" & Chr(34), Chr(34) & "tbl" & Chr(34), Chr(34) & "rbl" & Chr(34), Chr(34) & "tr" & Chr(34), Chr(34) & "tb" & Chr(34), Chr(34) & "tl" & Chr(34), Chr(34) & "rb" & Chr(34), Chr(34) & "rl" & Chr(34), Chr(34) & "bl" & Chr(34), Chr(34) & "t" & Chr(34), Chr(34) & "r" & Chr(34), Chr(34) & "b" & Chr(34), Chr(34) & "l" & Chr(34)}) 'Global Layer parameters - clsgeom_rug.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34), lstParameterStrings:={Chr(34) & "stack" & Chr(34), Chr(34) & "dodge" & Chr(34), Chr(34) & "dodge2" & Chr(34), Chr(34) & "identity" & Chr(34), Chr(34) & "jitter" & Chr(34), Chr(34) & "fill" & Chr(34)}) + clsgeom_rug.AddLayerParameter("position", "list", Chr(34) & "identity" & Chr(34), lstParameterStrings:={Chr(34) & "stack" & Chr(34), Chr(34) & "dodge" & Chr(34), Chr(34) & "dodge2" & Chr(34), Chr(34) & "identity" & Chr(34), "position_jitter(width=0.2,height=0.1)", Chr(34) & "fill" & Chr(34), Chr(34) & "jitter" & Chr(34)}) clsgeom_rug.AddLayerParameter("outside", "boolean", "FALSE") clsgeom_rug.AddLayerParameter("stat", "list", Chr(34) & "identity" & Chr(34), lstParameterStrings:={Chr(34) & "identity" & Chr(34), Chr(34) & "ecdf" & Chr(34), Chr(34) & "sum" & Chr(34), Chr(34) & "summary" & Chr(34), Chr(34) & "unique" & Chr(34)}) 'Warning, stat count cannot be used with y aesthetic !!! clsgeom_rug.AddLayerParameter("show.legend", "list", "TRUE", lstParameterStrings:={"NA", "TRUE", "FALSE"}) diff --git a/instat/ucrReceiver.vb b/instat/ucrReceiver.vb index 8594abe6044..77ee806b729 100644 --- a/instat/ucrReceiver.vb +++ b/instat/ucrReceiver.vb @@ -486,14 +486,18 @@ Public Class ucrReceiver Next DirectCast(Me, ucrReceiverMultiple).AddMultiple(lstItems) + 'TODO. In PR #8605, this subroutine was found to also be called in the selector control when LoadList is called (CurrentReceiver.RemoveAnyVariablesNotInSelector()). + 'This can lead to slow perfomance in dialogs when it comes to wide datasets RemoveAnyVariablesNotInSelector() 'needed due to the Autofill option Else For Each strTemp As String In lstCurrentVariables 'TODO This only works if the selector is updated before receivers and dialog only uses one data frame! ' Needs to change eventually. + 'TODO. This subroutine call also makes the single receiver automatically clear deleted columns when dialogs are reopened + 'However, it does not clear output objects and other data objects. What causes clearing of such objects is + 'when CurrentReceiver.RemoveAnyVariablesNotInSelector() is called in the LoadList() of selector control Add(strTemp, strTempDataName) Next - End If diff --git a/instat/ucrReceiverSingle.vb b/instat/ucrReceiverSingle.vb index 6ae7be192e6..156dbbd5601 100644 --- a/instat/ucrReceiverSingle.vb +++ b/instat/ucrReceiverSingle.vb @@ -123,6 +123,16 @@ Public Class ucrReceiverSingle MyBase.RemoveSelected() End Sub + ''' + ''' Removes any variable in the single receiver + ''' that is not in the list of variables of the selector + ''' + Public Overrides Sub RemoveAnyVariablesNotInSelector() + If Not IsEmpty() AndAlso Selector?.lstAvailableVariable.FindItemWithText(txtReceiverSingle.Text) Is Nothing Then + Clear() + End If + End Sub + Public Overrides Sub Clear() RemoveSelected() End Sub diff --git a/instat/ucrScript.Designer.vb b/instat/ucrScript.Designer.vb index 8721a9711a3..4b5e8b5c6dd 100644 --- a/instat/ucrScript.Designer.vb +++ b/instat/ucrScript.Designer.vb @@ -49,7 +49,7 @@ Partial Class ucrScript Me.mnuSelectAll = New System.Windows.Forms.ToolStripMenuItem() Me.mnuClear = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator2 = New System.Windows.Forms.ToolStripSeparator() - Me.mnuRunCurrentLineSelection = New System.Windows.Forms.ToolStripMenuItem() + Me.mnuRunCurrentStatementSelection = New System.Windows.Forms.ToolStripMenuItem() Me.mnuRunAllText = New System.Windows.Forms.ToolStripMenuItem() Me.ToolStripSeparator3 = New System.Windows.Forms.ToolStripSeparator() Me.mnuOpenScriptasFile = New System.Windows.Forms.ToolStripMenuItem() @@ -67,7 +67,7 @@ Partial Class ucrScript Me.cmdHelp = New System.Windows.Forms.Button() Me.cmdClear = New System.Windows.Forms.Button() Me.cmdRunAll = New System.Windows.Forms.Button() - Me.cmdRunLineSelection = New System.Windows.Forms.Button() + Me.cmdRunStatementSelection = New System.Windows.Forms.Button() Me.TabControl = New System.Windows.Forms.TabControl() Me.toolTipScriptWindow = New System.Windows.Forms.ToolTip(Me.components) Me.mnuContextScript.SuspendLayout() @@ -78,115 +78,115 @@ Partial Class ucrScript 'mnuContextScript ' Me.mnuContextScript.ImageScalingSize = New System.Drawing.Size(24, 24) - Me.mnuContextScript.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuUndo, Me.mnuRedo, Me.ToolStripSeparator1, Me.mnuCut, Me.mnuCopy, Me.mnuPaste, Me.mnuSelectAll, Me.mnuClear, Me.ToolStripSeparator2, Me.mnuRunCurrentLineSelection, Me.mnuRunAllText, Me.ToolStripSeparator3, Me.mnuOpenScriptasFile, Me.mnuLoadScriptFromFile, Me.mnuSaveScript, Me.ToolStripSeparator4, Me.mnuHelp}) + Me.mnuContextScript.Items.AddRange(New System.Windows.Forms.ToolStripItem() {Me.mnuUndo, Me.mnuRedo, Me.ToolStripSeparator1, Me.mnuCut, Me.mnuCopy, Me.mnuPaste, Me.mnuSelectAll, Me.mnuClear, Me.ToolStripSeparator2, Me.mnuRunCurrentStatementSelection, Me.mnuRunAllText, Me.ToolStripSeparator3, Me.mnuOpenScriptasFile, Me.mnuLoadScriptFromFile, Me.mnuSaveScript, Me.ToolStripSeparator4, Me.mnuHelp}) Me.mnuContextScript.Name = "mnuContextLogFile" - Me.mnuContextScript.Size = New System.Drawing.Size(274, 314) + Me.mnuContextScript.Size = New System.Drawing.Size(306, 314) ' 'mnuUndo ' Me.mnuUndo.Name = "mnuUndo" Me.mnuUndo.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.Z), System.Windows.Forms.Keys) - Me.mnuUndo.Size = New System.Drawing.Size(273, 22) + Me.mnuUndo.Size = New System.Drawing.Size(305, 22) Me.mnuUndo.Text = "Undo" ' 'mnuRedo ' Me.mnuRedo.Name = "mnuRedo" Me.mnuRedo.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.Y), System.Windows.Forms.Keys) - Me.mnuRedo.Size = New System.Drawing.Size(273, 22) + Me.mnuRedo.Size = New System.Drawing.Size(305, 22) Me.mnuRedo.Text = "Redo" ' 'ToolStripSeparator1 ' Me.ToolStripSeparator1.Name = "ToolStripSeparator1" - Me.ToolStripSeparator1.Size = New System.Drawing.Size(270, 6) + Me.ToolStripSeparator1.Size = New System.Drawing.Size(302, 6) ' 'mnuCut ' Me.mnuCut.Name = "mnuCut" Me.mnuCut.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.X), System.Windows.Forms.Keys) - Me.mnuCut.Size = New System.Drawing.Size(273, 22) + Me.mnuCut.Size = New System.Drawing.Size(305, 22) Me.mnuCut.Text = "Cut" ' 'mnuCopy ' Me.mnuCopy.Name = "mnuCopy" Me.mnuCopy.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.C), System.Windows.Forms.Keys) - Me.mnuCopy.Size = New System.Drawing.Size(273, 22) + Me.mnuCopy.Size = New System.Drawing.Size(305, 22) Me.mnuCopy.Text = "Copy" ' 'mnuPaste ' Me.mnuPaste.Name = "mnuPaste" Me.mnuPaste.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.V), System.Windows.Forms.Keys) - Me.mnuPaste.Size = New System.Drawing.Size(273, 22) + Me.mnuPaste.Size = New System.Drawing.Size(305, 22) Me.mnuPaste.Text = "Paste" ' 'mnuSelectAll ' Me.mnuSelectAll.Name = "mnuSelectAll" Me.mnuSelectAll.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.A), System.Windows.Forms.Keys) - Me.mnuSelectAll.Size = New System.Drawing.Size(273, 22) + Me.mnuSelectAll.Size = New System.Drawing.Size(305, 22) Me.mnuSelectAll.Text = "Select All" ' 'mnuClear ' Me.mnuClear.Name = "mnuClear" Me.mnuClear.ShortcutKeys = CType((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.L), System.Windows.Forms.Keys) - Me.mnuClear.Size = New System.Drawing.Size(273, 22) + Me.mnuClear.Size = New System.Drawing.Size(305, 22) Me.mnuClear.Text = "Clear All" ' 'ToolStripSeparator2 ' Me.ToolStripSeparator2.Name = "ToolStripSeparator2" - Me.ToolStripSeparator2.Size = New System.Drawing.Size(270, 6) + Me.ToolStripSeparator2.Size = New System.Drawing.Size(302, 6) ' - 'mnuRunCurrentLineSelection + 'mnuRunCurrentStatementSelection ' - Me.mnuRunCurrentLineSelection.Name = "mnuRunCurrentLineSelection" - Me.mnuRunCurrentLineSelection.Size = New System.Drawing.Size(273, 22) - Me.mnuRunCurrentLineSelection.Text = "Run Current Line/Selection Ctrl+Enter" + Me.mnuRunCurrentStatementSelection.Name = "mnuRunCurrentStatementSelection" + Me.mnuRunCurrentStatementSelection.Size = New System.Drawing.Size(305, 22) + Me.mnuRunCurrentStatementSelection.Text = "Run Current Statement/Selection Ctrl+Enter" ' 'mnuRunAllText ' Me.mnuRunAllText.Name = "mnuRunAllText" Me.mnuRunAllText.ShortcutKeys = CType(((System.Windows.Forms.Keys.Control Or System.Windows.Forms.Keys.Alt) _ Or System.Windows.Forms.Keys.R), System.Windows.Forms.Keys) - Me.mnuRunAllText.Size = New System.Drawing.Size(273, 22) + Me.mnuRunAllText.Size = New System.Drawing.Size(305, 22) Me.mnuRunAllText.Text = "Run All Text" ' 'ToolStripSeparator3 ' Me.ToolStripSeparator3.Name = "ToolStripSeparator3" - Me.ToolStripSeparator3.Size = New System.Drawing.Size(270, 6) + Me.ToolStripSeparator3.Size = New System.Drawing.Size(302, 6) ' 'mnuOpenScriptasFile ' Me.mnuOpenScriptasFile.Name = "mnuOpenScriptasFile" - Me.mnuOpenScriptasFile.Size = New System.Drawing.Size(273, 22) + Me.mnuOpenScriptasFile.Size = New System.Drawing.Size(305, 22) Me.mnuOpenScriptasFile.Text = "Open Script as File" ' 'mnuLoadScriptFromFile ' Me.mnuLoadScriptFromFile.Name = "mnuLoadScriptFromFile" - Me.mnuLoadScriptFromFile.Size = New System.Drawing.Size(273, 22) + Me.mnuLoadScriptFromFile.Size = New System.Drawing.Size(305, 22) Me.mnuLoadScriptFromFile.Text = "Load Script from File..." ' 'mnuSaveScript ' Me.mnuSaveScript.Name = "mnuSaveScript" - Me.mnuSaveScript.Size = New System.Drawing.Size(273, 22) + Me.mnuSaveScript.Size = New System.Drawing.Size(305, 22) Me.mnuSaveScript.Text = "Save Script..." ' 'ToolStripSeparator4 ' Me.ToolStripSeparator4.Name = "ToolStripSeparator4" - Me.ToolStripSeparator4.Size = New System.Drawing.Size(270, 6) + Me.ToolStripSeparator4.Size = New System.Drawing.Size(302, 6) ' 'mnuHelp ' Me.mnuHelp.Name = "mnuHelp" - Me.mnuHelp.Size = New System.Drawing.Size(273, 22) + Me.mnuHelp.Size = New System.Drawing.Size(305, 22) Me.mnuHelp.Text = "Help" ' 'lblHeaderScript @@ -231,7 +231,7 @@ Partial Class ucrScript Me.Panel.Controls.Add(Me.cmdHelp) Me.Panel.Controls.Add(Me.cmdClear) Me.Panel.Controls.Add(Me.cmdRunAll) - Me.Panel.Controls.Add(Me.cmdRunLineSelection) + Me.Panel.Controls.Add(Me.cmdRunStatementSelection) Me.Panel.Dock = System.Windows.Forms.DockStyle.Fill Me.Panel.Location = New System.Drawing.Point(3, 23) Me.Panel.Name = "Panel" @@ -301,14 +301,14 @@ Partial Class ucrScript Me.cmdRunAll.Text = "Run All" Me.cmdRunAll.UseVisualStyleBackColor = True ' - 'cmdRunLineSelection + 'cmdRunStatementSelection ' - Me.cmdRunLineSelection.Location = New System.Drawing.Point(2, 1) - Me.cmdRunLineSelection.Name = "cmdRunLineSelection" - Me.cmdRunLineSelection.Size = New System.Drawing.Size(55, 23) - Me.cmdRunLineSelection.TabIndex = 0 - Me.cmdRunLineSelection.Text = "Run" - Me.cmdRunLineSelection.UseVisualStyleBackColor = True + Me.cmdRunStatementSelection.Location = New System.Drawing.Point(2, 1) + Me.cmdRunStatementSelection.Name = "cmdRunStatementSelection" + Me.cmdRunStatementSelection.Size = New System.Drawing.Size(55, 23) + Me.cmdRunStatementSelection.TabIndex = 0 + Me.cmdRunStatementSelection.Text = "Run" + Me.cmdRunStatementSelection.UseVisualStyleBackColor = True ' 'TabControl ' @@ -345,12 +345,12 @@ Partial Class ucrScript Friend WithEvents mnuCut As ToolStripMenuItem Friend WithEvents mnuPaste As ToolStripMenuItem Friend WithEvents mnuRunAllText As ToolStripMenuItem - Friend WithEvents mnuRunCurrentLineSelection As ToolStripMenuItem + Friend WithEvents mnuRunCurrentStatementSelection As ToolStripMenuItem Friend WithEvents ToolStripSeparator4 As ToolStripSeparator Friend WithEvents mnuHelp As ToolStripMenuItem Friend WithEvents Panel As Panel Friend WithEvents cmdRunAll As Button - Friend WithEvents cmdRunLineSelection As Button + Friend WithEvents cmdRunStatementSelection As Button Friend WithEvents toolTipScriptWindow As ToolTip Friend WithEvents cmdClear As Button Friend WithEvents cmdHelp As Button diff --git a/instat/ucrScript.vb b/instat/ucrScript.vb index 8db84f86f7c..941f89ff8c5 100644 --- a/instat/ucrScript.vb +++ b/instat/ucrScript.vb @@ -14,8 +14,10 @@ ' You should have received a copy of the GNU General Public License ' along with this program. If not, see . +Imports System.Collections.Specialized Imports System.IO Imports System.Windows.Controls +Imports RScript Imports ScintillaNET Public Class ucrScript @@ -23,7 +25,6 @@ Public Class ucrScript Private bIsTextChanged = False Private iMaxLineNumberCharLength As Integer = 0 Private Const iTabIndexLog As Integer = 0 - Private Const strComment As String = "Code run from Script Window" Private strRInstatLogFilesFolderPath As String = Path.Combine(Path.GetFullPath(FileIO.SpecialDirectories.MyDocuments), "R-Instat_Log_files") Friend WithEvents clsScriptActive As Scintilla @@ -41,7 +42,7 @@ Public Class ucrScript Private Sub ucrScript_Load(sender As Object, e As EventArgs) Handles Me.Load - toolTipScriptWindow.SetToolTip(cmdRunLineSelection, "Run the current line or selection. (Ctrl+Enter)") + toolTipScriptWindow.SetToolTip(cmdRunStatementSelection, "Run the current statement or selection. (Ctrl+Enter)") toolTipScriptWindow.SetToolTip(cmdRunAll, "Run all the text in the tab. (Ctrl+Alt+R)") toolTipScriptWindow.SetToolTip(cmdLoadScript, "Load a script from file into the current tab.") toolTipScriptWindow.SetToolTip(cmdSave, "Save the script in the current tab to a file.") @@ -57,7 +58,7 @@ Public Class ucrScript mnuPaste.ToolTipText = "Paste the contents of the clipboard into the current tab. (Ctrl+V)" mnuSelectAll.ToolTipText = "Select all the contents of the current tab. (Ctrl+A)" mnuClear.ToolTipText = "Clear the contents of the current tab. (Ctrl+L)" - mnuRunCurrentLineSelection.ToolTipText = "Run the current line or selection. (Ctrl+Enter)" + mnuRunCurrentStatementSelection.ToolTipText = "Run the current statement or selection. (Ctrl+Enter)" mnuRunAllText.ToolTipText = "Run all the text in the tab. (Ctrl+Alt+R)" mnuOpenScriptasFile.ToolTipText = "Save file to log folder and open file in external editor." mnuLoadScriptFromFile.ToolTipText = "Load script from file into the current tab." @@ -65,7 +66,7 @@ Public Class ucrScript mnuHelp.ToolTipText = "Display the Script Window help information." 'normally we would do this in the designer, but designer doesn't allow enter key as shortcut - mnuRunCurrentLineSelection.ShortcutKeys = Keys.Enter Or Keys.Control + mnuRunCurrentStatementSelection.ShortcutKeys = Keys.Enter Or Keys.Control 'Make the log tab the selected tab TabControl.SelectTab(iTabIndexLog) @@ -290,7 +291,7 @@ Public Class ucrScript Dim bIsLogTab As Boolean = TabControl.SelectedIndex = iTabIndexLog Dim bScriptExists As Boolean = clsScriptActive.TextLength > 0 - cmdRunLineSelection.Enabled = bScriptExists + cmdRunStatementSelection.Enabled = bScriptExists cmdRunAll.Enabled = bScriptExists cmdLoadScript.Enabled = Not bIsLogTab cmdSave.Enabled = bScriptExists @@ -299,15 +300,10 @@ Public Class ucrScript cmdRemoveTab.Enabled = TabControl.TabCount > 2 AndAlso Not bIsLogTab End Sub - Private Sub EnableRunButtons(bEnable As Boolean) - cmdRunLineSelection.Enabled = bEnable - cmdRunAll.Enabled = bEnable - End Sub - ''' ''' Enables or disables all right click menu options ''' - ''' If true, enables all right click options,false otherwise + ''' If true, enables all right click options, false disables them Private Sub EnableRightClickMenuOptions(bEnable As Boolean) mnuUndo.Enabled = bEnable mnuRedo.Enabled = bEnable @@ -316,13 +312,23 @@ Public Class ucrScript mnuPaste.Enabled = bEnable mnuSelectAll.Enabled = bEnable mnuClear.Enabled = bEnable - mnuRunCurrentLineSelection.Enabled = bEnable + mnuRunCurrentStatementSelection.Enabled = bEnable mnuRunAllText.Enabled = bEnable mnuLoadScriptFromFile.Enabled = bEnable mnuOpenScriptasFile.Enabled = bEnable mnuSaveScript.Enabled = bEnable End Sub + ''' + ''' Enables or disables the run buttons and all right click menu options + ''' + ''' If true, enables buttons/options, else disables them + Private Sub EnableRunOptions(bEnable As Boolean) + cmdRunStatementSelection.Enabled = bEnable + cmdRunAll.Enabled = bEnable + EnableRightClickMenuOptions(bEnable) + End Sub + '''-------------------------------------------------------------------------------------------- ''' ''' If the caret is next to a bracket, then it highlights the paired open/close bracket. @@ -473,6 +479,12 @@ Public Class ucrScript End Sub Private Function IsBracket(iNewChar As Integer) As Boolean + 'the `Chr()` function may throw an exception for higher value integers, + ' so check value is in a reasonable range. Note: 40 = `(` and 125 = `}` + If iNewChar < 40 OrElse iNewChar > 125 Then + Return False + End If + Dim arrRBrackets() As String = {"(", ")", "{", "}", "[", "]"} Return arrRBrackets.Contains(Chr(iNewChar)) End Function @@ -604,24 +616,104 @@ Public Class ucrScript Return clsNewScript End Function - Private Sub RunCurrentLine() - Static strScriptCmd As String = "" 'static so that script can be added to with successive calls of this function - - If clsScriptActive.TextLength > 0 Then - Dim strLineTextString = clsScriptActive.Lines(clsScriptActive.CurrentLine).Text - strScriptCmd &= vbCrLf & strLineTextString 'insert carriage return to ensure that new text starts on new line - strScriptCmd = RunText(strScriptCmd) + Private Sub RunCurrentStatement() - Dim iNextLinePos As Integer = clsScriptActive.Lines(clsScriptActive.CurrentLine).EndPosition - clsScriptActive.GotoPosition(iNextLinePos) + If clsScriptActive.TextLength <= 0 Then + Exit Sub End If + + 'temporarily disable the buttons in case its a long operation + EnableRunOptions(False) + + Try + Dim dctRStatements As OrderedDictionary + Try + dctRStatements = New clsRScript(clsScriptActive.Text).dctRStatements + Catch ex As Exception + MsgBox("R script parsing failed with message:" & Environment.NewLine _ + & Environment.NewLine & ex.Message & Environment.NewLine & Environment.NewLine _ + & "Try using 'Run All' or 'Run Selected'. This will execute the script using a less strict method.", + MsgBoxStyle.Information, "Could not parse R script") + Exit Sub + End Try + + If IsNothing(dctRStatements) OrElse dctRStatements.Count = 0 Then + Exit Sub + End If + + Dim iCaretPos As Integer = clsScriptActive.CurrentPosition + Dim iNextStatementPos As Integer = 0 + Dim clsRStatement As clsRStatement = Nothing + + For Each kvpDictEntry As DictionaryEntry In dctRStatements + If kvpDictEntry.Key > iCaretPos Then + iNextStatementPos = kvpDictEntry.Key + Exit For + End If + clsRStatement = kvpDictEntry.Value + Next + + 'if we will execute the only/last statement + If iNextStatementPos = 0 Then + ' if there is no blank line at end of text, then add blank line + If Not (clsScriptActive.Text.EndsWith(vbCr) _ + OrElse clsScriptActive.Text.EndsWith(vbLf)) Then + clsScriptActive.AppendText(vbCrLf) + End If + iNextStatementPos = clsScriptActive.TextLength + + Else 'else move caret to first non-blank line of next statement + For iTextPos As Integer = iNextStatementPos To clsScriptActive.Text.Length - 1 + Dim chrNext As Char = clsScriptActive.Text.Chars(iTextPos) + If chrNext <> vbLf AndAlso chrNext <> vbCr AndAlso Not Char.IsWhiteSpace(chrNext) Then + iNextStatementPos = iTextPos + Exit For + End If + Next + End If + + clsScriptActive.GotoPosition(iNextStatementPos) + + frmMain.clsRLink.RunRStatement(clsRStatement) + frmMain.UpdateAllGrids() + Finally + EnableRunOptions(True) + End Try End Sub - Private Function RunText(strText As String) As String - Return If(Not String.IsNullOrEmpty(strText), - frmMain.clsRLink.RunScriptFromWindow(strNewScript:=strText, strNewComment:=strComment), - "") - End Function + '''-------------------------------------------------------------------------------------------- + ''' + ''' Executes the R script. + ''' + ''' The R script to execute. + ''' Converted into an R comment and prefixed to the script. + '''-------------------------------------------------------------------------------------------- + Private Sub RunScript(strScript As String, strComment As String) + + EnableRunOptions(False) 'temporarily disable the run buttons in case its a long operation + + Dim dctRStatements As OrderedDictionary + Try + dctRStatements = New clsRScript(frmMain.clsRLink.GetFormattedComment(strComment) _ + & Environment.NewLine & strScript).dctRStatements + Catch ex As Exception + MsgBox("R script parsing failed with message:" & Environment.NewLine _ + & Environment.NewLine & ex.Message & Environment.NewLine & Environment.NewLine _ + & "R-Instat will now attempt to execute the script using a less strict method.", + MsgBoxStyle.Information, "Could Not Parse R Script") + frmMain.clsRLink.RunScriptFromWindow(strScript.Trim(vbLf), strComment) + dctRStatements = Nothing + End Try + + If Not IsNothing(dctRStatements) Then + For Each kvpDictEntry As DictionaryEntry In dctRStatements + frmMain.clsRLink.RunRStatement(kvpDictEntry.Value) + Next + frmMain.UpdateAllGrids() + End If + + EnableRunOptions(True) + End Sub '''-------------------------------------------------------------------------------------------- ''' @@ -694,7 +786,6 @@ Public Class ucrScript EnableDisableButtons() End Sub - Private Sub mnuContextScript_Opening(sender As Object, e As EventArgs) Handles mnuContextScript.Opening 'enable and disable menu options based on the active script properties before the user views them @@ -718,7 +809,7 @@ Public Class ucrScript 'enable remaining options based on tab state mnuSelectAll.Enabled = bScriptExists - mnuRunCurrentLineSelection.Enabled = bScriptExists + mnuRunCurrentStatementSelection.Enabled = bScriptExists mnuRunAllText.Enabled = bScriptExists mnuOpenScriptasFile.Enabled = bScriptExists mnuSaveScript.Enabled = bScriptExists @@ -811,24 +902,15 @@ Public Class ucrScript Exit Sub End If - EnableRunButtons(False) 'temporarily disable the run buttons in case its a long operation - EnableRightClickMenuOptions(False) - RunText(clsScriptActive.Text) - EnableRunButtons(True) - EnableRightClickMenuOptions(True) + RunScript(clsScriptActive.Text, "Code run from Script Window (all text)") End Sub - Private Sub mnuRunCurrentLineSelection_Click(sender As Object, e As EventArgs) Handles mnuRunCurrentLineSelection.Click, cmdRunLineSelection.Click - 'temporarily disable the buttons in case its a long operation - EnableRunButtons(False) - EnableRightClickMenuOptions(False) + Private Sub mnuRunCurrentStatementSelection_Click(sender As Object, e As EventArgs) Handles mnuRunCurrentStatementSelection.Click, cmdRunStatementSelection.Click If clsScriptActive.SelectedText.Length > 0 Then - RunText(clsScriptActive.SelectedText) + RunScript(clsScriptActive.SelectedText, "Code run from Script Window (selected text)") Else - RunCurrentLine() + RunCurrentStatement() End If - EnableRunButtons(True) - EnableRightClickMenuOptions(True) End Sub Private Sub cmdSave_Click(sender As Object, e As EventArgs) Handles cmdSave.Click @@ -873,7 +955,7 @@ Public Class ucrScript Next If IsNothing(clsScriptActive) Then - MsgBox("Developer error: could not find editor winfow in tab.") + MsgBox("Developer error: could not find editor window in tab.") End If End Sub diff --git a/instat/ucrSelector.vb b/instat/ucrSelector.vb index 19c21d3620b..879349ac503 100644 --- a/instat/ucrSelector.vb +++ b/instat/ucrSelector.vb @@ -149,6 +149,8 @@ Public Class ucrSelector strHeading:=CurrentReceiver.strSelectorHeading, strDataFrameName:=strCurrentDataFrame, strExcludedItems:=arrStrExclud, strDatabaseQuery:=CurrentReceiver.strDatabaseQuery, strNcFilePath:=CurrentReceiver.strNcFilePath) If Not CurrentReceiver.bExcludeFromSelector Then + 'TODO. Investigate why this has to be called here instead of just being called in ucrReceiver control.SetControlValue() + 'See PR #8605 for related comments added in ucrReceiver. CurrentReceiver.RemoveAnyVariablesNotInSelector() 'this needed for the multiple receiver(s) where the autofill is not applied End If EnableDataOptions(strCurrentType) diff --git a/packages/RScript.1.0.6/.signature.p7s b/packages/RScript.1.0.6/.signature.p7s deleted file mode 100644 index 6db6249328f..00000000000 Binary files a/packages/RScript.1.0.6/.signature.p7s and /dev/null differ diff --git a/packages/RScript.1.0.6/lib/net461/RScript.dll b/packages/RScript.1.0.6/lib/net461/RScript.dll deleted file mode 100644 index 731e11dfaa6..00000000000 Binary files a/packages/RScript.1.0.6/lib/net461/RScript.dll and /dev/null differ diff --git a/packages/RScript.1.0.6/lib/net461/RScript.xml b/packages/RScript.1.0.6/lib/net461/RScript.xml deleted file mode 100644 index 683778596c6..00000000000 --- a/packages/RScript.1.0.6/lib/net461/RScript.xml +++ /dev/null @@ -1,691 +0,0 @@ - - - - -RScript - - - - - - A strongly-typed resource class, for looking up localized strings, etc. - - - - - Returns the cached ResourceManager instance used by this class. - - - - - Overrides the current thread's CurrentUICulture property for all - resource lookups using this strongly typed resource class. - - - - The text representation of the element (e.g. '+', '/', 'myFunction', - '"my string constant"' etc.). - - - If true, then the element is surrounded by round brackets. For example, if the - script is 'a*(b+c)', then the element representing the '+' operator will have - 'bBracketed' set to true. - - - - Any formatting text that precedes the element. The formatting text may consist of spaces, - comments and new lines to make the script more readable for humans. For example, in the - example below, 'strprefix' for the 'myFunction' element shall be set to - "#comment1\n #comment2\n ". - - #comment1 - #comment2 - myFunction() - - --------------------------------------------------------------------------------------------- - TODO. - - as debug string. --------------------------------------------------------------------------------------------- - - - - The statement where this element is assigned. For example, for the following R script, on the 2nd line, the statement associated with 'a' will be 'a=1'. - - a=1 - b=a - - --------------------------------------------------------------------------------------------- - TODO. - - as debug string. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - TODO. - - as debug string. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - TODO. - - as debug string. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - TODO. - - as debug string. --------------------------------------------------------------------------------------------- - - - TODO Add class summary. - - - The R statements in the script - - - The current state of the token parsing. - - --------------------------------------------------------------------------------------------- - Parses the R script in and populates the list of - R statements. - - This subroutine will accept, and correctly process all valid R. However, this - class does not attempt to validate . If it is not - valid R then this subroutine may still process the script without throwing an - exception. In this case, the list of R statements will be undefined. - - In other words, this subroutine will not generate false negatives (reject - valid R) but may generate false positives (accept invalid R). - - - The R script to parse. This must be valid R according to the - R language specification at - https://cran.r-project.org/doc/manuals/r-release/R-lang.html - (referenced 01 Feb 2021). --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns as a list of its constituent lexemes. - A lexeme is a string of characters that represent a valid R element - (identifier, operator, keyword, seperator, bracket etc.). A lexeme does not - include any type information. - - This function identifies lexemes using a technique known as 'longest match' - or 'maximal munch'. It keeps adding characters to the lexeme one at a time - until it reaches a character that is not in the set of characters acceptable - for that lexeme. - - - The R script to convert (must be syntactically correct R). - - as a list of its constituent lexemes. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns as a list of tokens. - - A token is a string of characters that represent a valid R element, plus meta - data about the token type (identifier, operator, keyword, bracket etc.). - - - The list of lexemes to convert to tokens. - - as a list of tokens. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns this object as a valid, executable R script. - - The current state of this object as a valid, executable R script. --------------------------------------------------------------------------------------------- - - - TODO Add class summary. - - - If true, then when this R statement is converted to a script, then it will be - terminated with a newline (else if false then a semicolon) - - - - The assignment operator used in this statement (e.g. '=' in the statement 'a=b'). - If there is no assignment (e.g. as in 'myFunction(a)' then set to 'nothing'. - - - If this R statement is converted to a script, then contains the formatting - string that will prefix the assignment operator. - This is typically used to insert spaces before the assignment operator to line - up the assignment operators in a list of assignments. For example: - - shortName = 1 - veryLongName = 2 - - - - If this R statement is converted to a script, then contains the formatting - string that will be placed at the end of the statement. - This is typically used to insert a comment at the end of the statement. - For example: - - a = b * 2 # comment1 - - - - The element assigned to by the statement (e.g. 'a' in the statement 'a=b'). - If there is no assignment (e.g. as in 'myFunction(a)' then set to 'nothing'. - - - The element assigned in the statement (e.g. 'b' in the statement 'a=b'). - If there is no assignment (e.g. as in 'myFunction(a)' then set to the top- - level element in the statement (e.g. 'myFunction'). - - - The relative precedence of the R operators. This is a two-dimensional array - because the operators are stored in groups together with operators that - have the same precedence. - - --------------------------------------------------------------------------------------------- - - Constructs an object representing a valid R statement. - Processes the tokens from from position - to the end of statement, end of script or end of list (whichever comes first). - - The list of R tokens to process - [in,out] The position in the list to start processing --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - - Returns this object as a valid, executable R statement. - The script may contain formatting information such as spaces, comments and extra new lines. - If this object was created by analysing original R script, then the returned script's - formatting will be as close as possible to the original. - The script may vary slightly because some formatting information is lost in the object - model. For lost formatting, the formatting will be done according to the guidelines in - https://style.tidyverse.org/syntax.html - The returned script will always show: - No spaces before commas - No spaces before brackets - No spaces before package ('::') and object ('$') operators - One space before parameter assignments ('=') - For example, 'pkg ::obj1 $obj2$fn1 (a ,b=1, c = 2 )' will be returned as - 'pkg::obj1$obj2$fn1(a, b =1, c = 2)' - - - The current state of this object as a valid, executable R statement. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns as an executable R script. - - The R element to convert to an executable R script. - The R element may be a function, operator, constant, - syntactic name, key word etc. - - as an executable R script. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns as an executable R script. - - The R element to convert to an executable R script. The R element - may have an associated package name, and a list of associated - objects e.g. 'pkg::obj1$obj2$fn1(a)'. - - as an executable R script. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - - Iterates through the tokens in and makes each presentation - element a child of the next non-presentation element. - - A presentation element is an element that has no functionality and is only used to make - the script easier to read. It may be a block of spaces, a comment or a newline that does - not end a statement. - - For example, the list of tokens representing the following block of script: - - # comment1 - a =b # comment2 - - Will be structured as: - a - .."# comment1\n" - = - .." " - b - (endStatement) - .." # comment2" - - - The list of tokens to process. - - A token tree where presentation information is stored as a child of the next - non-presentation element. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - - Iterates through the tokens in . - If the token is a '(' then it makes everything inside the brackets a child of the '(' token. - If the '(' belongs to a function then makes the '(' a child of the function. Brackets may - be nested. For example, '(a*(b+c))' is structured as: - ( - ..a - ..* - ..( - ....b - ....+ - ....c - ....) - ..) - - The token tree to restructure. - - A token tree restructured for round brackets. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - - Traverses the tree of tokens in . If the token is a function name then it - makes the subsequent '(' a child of the function name token. - - The token tree to restructure. - - A token tree restructured for function names. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - - Traverses the tree of tokens in . If the token is a ',' then it - makes everything up to the next ',' or ')' a child of the ',' token. Commas are used to - separate function parameters. Parameters between commas are optional. For example, - 'myFunction(a,,b)' is structured as: - myFunction ( - ..a - .., - .., - ....b - ....) - - - The token tree to restructure. - [in,out] The position in the list to start processing. - (Optional) True to processing comma. - - A token tree restructured for function commas. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - - Iterates through all the possible operators in order of precedence. For each operator, - traverses the tree of tokens in . If the operator is found then - the operator's parameters (typically the tokens to the left and right of the operator) are - made children of the operator. For example, 'a*b+c' is structured as: - + - ..* - ....a - ....b - ..c - - The token tree to restructure. - - A token tree restructured for all the possible operators. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - - Traverses the tree of tokens in . If one of the operators in - the group is found, then the operator's parameters - (typically the tokens to the left and right of the operator) are made children of the - operator. For example, 'a*b+c' is structured as: - + - ..* - ....a - ....b - ..c - - Edge case: This function cannot process the case where a binary operator is immediately - followed by a unary operator with the same or a lower precedence (e.g. 'a^-b', 'a+~b', - 'a~~b' etc.). This is because of the R default precedence rules. The workaround is to - enclose the unary operator in brackets (e.g. 'a^(-b)', 'a+(~b)', 'a~(~b)' etc.). - - The token tree to restructure. - The group of operators to search for in the tree. - - A token tree restructured for the specified group of operators. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns a clone of the next token in the list, - after . If there is no next token then throws - an error. - - The list of tokens. - The position of the current token in the list. - - A clone of the next token in the list. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns an R element object constructed from the - token. - - The token to convert into an R element object. - Dictionary containing all the current existing assignments. - The key is the name of the variable. The value is a reference - to the R statement that performed the assignment. - (Optional) True if the token is enclosed in brackets. - (Optional) The package name associated with the token. - (Optional) The formatting string that prefixes the package - name (e.g. spaces or comment lines). - (Optional) The list of objects associated with the token - (e.g. 'obj1$obj2$myFn()'). - - An R element object constructed from the - token. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns the package name token associated with the - package operator. - - Package operator ('::') token. - - The package name associated with the package - operator. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns the formatting prefix (spaces or comment lines) associated with the - package operator. If the package operator has no - associated formatting, then returns an empty string. - - Package operator ('::') token. - - The formatting prefix (spaces or comment lines) associated with the - package operator. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - - Returns a named parameter element constructed from the token - tree. The top-level element in the token tree may be: - 'value' e.g. for fn(a) - '=' e.g. for 'fn(a=1)' - ',' e.g. for 'fn(a,b) or 'fn(a=1,b,,c,)' - ')' indicates the end of the parameter list, returns nothing - - - The token tree to convert into a named parameter element. - Dictionary containing all the current existing assignments. - The key is the name of the variable. The value is a reference - to the R statement that performed the assignment. - - A named parameter element constructed from the token - tree. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns the first child of that is not a - presentation token or a close bracket ')'. - - The token tree to search for non-presentation children. - - The first child of that is not a presentation token - or a close bracket ')'. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns a parameter element constructed from the - token tree. - - The token tree to convert into a parameter element. - Dictionary containing all the current existing assignments. - The key is the name of the variable. The value is a reference - to the R statement that performed the assignment. - - A parameter element constructed from the token tree. --------------------------------------------------------------------------------------------- - - - The different types of R element (function name, key word, comment etc.) - that the token may represent. - - - The lexeme associated with the token. - - - The token type (function name, key word, comment etc.). - - - The token's children. - - --------------------------------------------------------------------------------------------- - - Constructs a new token with lexeme and token type - . - - A token is a string of characters that represent a valid R element, plus meta data about - the token type (identifier, operator, keyword, bracket etc.). - - - - The lexeme to associate with the token. - The token type (function name, key word, comment etc.). --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - - Constructs a token from . - - A token is a string of characters that represent a valid R element, plus meta data about - the token type (identifier, operator, keyword, bracket etc.). - - and are needed - to correctly identify if is a unary or binary - operator. - - - The non-space lexeme immediately to the left of - . - The lexeme to convert to a token. - The non-space lexeme immediately to the right of - . - --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Creates and returns a clone of this object. - - Thrown when the object has an empty child token. - - A clone of this object. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns true if is a valid lexeme (either partial or - complete), else returns false. - - - A sequence of characters from a syntactically correct R script - - True if is a valid lexeme, else false. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns true if is a complete or partial - valid R syntactic name or key word, else returns false. - Please note that the rules for syntactic names are actually stricter than - the rules used in this function, but this library assumes it is parsing valid - R code. - - The text to check. - - True if is a valid R syntactic name or key word, - else returns false. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns true if is a complete or partial string - constant, else returns false. - String constants are delimited by a pair of single (‘'’), double (‘"’) - or backtick ('`') quotes and can contain all other printable characters. - Quotes and other special characters within strings are specified using escape - sequences. - - The text to check. - - True if is a complete or partial string constant, - else returns false. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns true if is a comment, else returns false. - - Any text from a # character to the end of the line is taken to be a comment, - unless the # character is inside a quoted string. - - The text to check. - - True if is a comment, else returns false. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns true if is sequence of spaces (and no other - characters), else returns false. - - The text to check . - - True if is sequence of spaces (and no other - characters), else returns false. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns true if is a functional R element - (i.e. not empty, and not a space, comment or new line), else returns false. - - The text to check . - - True if is a functional R element - (i.e. not a space, comment or new line), else returns false. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns true if is a complete or partial - user-defined operator, else returns false. - - The text to check. - - True if is a complete or partial - user-defined operator, else returns false. --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns true if is a resrved operator, else returns - false. - - The text to check. - - True if is a reserved operator, else returns false. - --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns true if is a bracket operator, else returns - false. - - The text to check. - - True if is a bracket operator, else returns false. - --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns true if is a unary operator, else returns - false. - - The text to check. - - True if is a unary operator, else returns false. - --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns true if is a bracket, else returns - false. - - The text to check. - - True if is a bracket, else returns false. - --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns true if is a new line, else returns - false. - - The text to check. - - True if is a new line, else returns false. - --------------------------------------------------------------------------------------------- - - --------------------------------------------------------------------------------------------- - Returns true if is a key word, else returns - false. - - The text to check. - - True if is a key word, else returns false. - --------------------------------------------------------------------------------------------- - - -