diff --git a/instat/clsRCodeStructure.vb b/instat/clsRCodeStructure.vb index 34600eb25ee..fa73333a9e7 100644 --- a/instat/clsRCodeStructure.vb +++ b/instat/clsRCodeStructure.vb @@ -201,7 +201,8 @@ Public Class RCodeStructure clsParam.SetArgument(clsROperatorParameter) End If clsParam.bIncludeArgumentName = bIncludeArgumentName - AddParameter(clsParam, iPosition) + clsParam.Position = iPosition + AddParameter(clsParam) End Sub 'TODO This should be call AddParameter but need to make it unambiguous with above @@ -213,20 +214,16 @@ Public Class RCodeStructure End If End Sub - Public Overridable Sub AddParameter(clsNewParam As RParameter, Optional iPosition As Integer = -1) + Public Overridable Sub AddParameter(clsNewParam As RParameter) Dim i As Integer = -1 Dim strTempArgumentName As String = clsNewParam.strArgumentName - clsNewParam.Position = iPosition - If clsNewParam.strArgumentName Is Nothing Then - Dim x = 1 - End If If clsParameters IsNot Nothing Then If clsNewParam.strArgumentName IsNot Nothing Then 'Dim match As Predicate(Of RParameter) = Function(x) x.strArgumentName.Equals(clsParam.strArgumentName) i = clsParameters.FindIndex(Function(x) x.strArgumentName.Equals(strTempArgumentName)) End If If i = -1 Then - ShiftParametersPositions(iPosition) 'Checking if there is room in the parameter's positions to add a parameter with position = iPosition + ShiftParametersPositions(clsNewParam.Position) 'Checking if there is room in the parameter's positions to add a parameter with position = iPosition clsParameters.Add(clsNewParam) Else If clsNewParam.bIsString AndAlso clsNewParam.strArgumentValue IsNot Nothing Then @@ -236,12 +233,12 @@ Public Class RCodeStructure Else 'message End If - If clsParameters(i).Position <> iPosition Then + If clsParameters(i).Position <> clsNewParam.Position Then 'In case the position needs to be changed, there might exist another parameter with the new position in the list 'The parameter i is then temporarily set to unordered until the Shift in positions has been operated within the clsParameters (if necessary). clsParameters(i).Position = -1 - If iPosition <> -1 Then - ShiftParametersPositions(iPosition) + If clsNewParam.Position <> -1 Then + ShiftParametersPositions(clsNewParam.Position) clsParameters(i).Position = clsNewParam.Position End If End If diff --git a/instat/clsRFunction.vb b/instat/clsRFunction.vb index 06d4031e681..5e28313af7a 100644 --- a/instat/clsRFunction.vb +++ b/instat/clsRFunction.vb @@ -50,8 +50,9 @@ Public Class RFunction Public Overrides Sub AddParameter(Optional strParameterName As String = "", Optional strParameterValue As String = "", Optional clsRFunctionParameter As RFunction = Nothing, Optional clsROperatorParameter As ROperator = Nothing, Optional bIncludeArgumentName As Boolean = True, Optional iPosition As Integer = -1) MyBase.AddParameter(strParameterName, strParameterValue, clsRFunctionParameter, clsROperatorParameter, bIncludeArgumentName, iPosition) End Sub - Public Overrides Sub AddParameter(clsParam As RParameter, Optional iPosition As Integer = -1) - MyBase.AddParameter(clsParam, iPosition) + + Public Overrides Sub AddParameter(clsParam As RParameter) + MyBase.AddParameter(clsParam) End Sub Public Overrides Function GetParameter(strName As String) As RParameter diff --git a/instat/clsROperator.vb b/instat/clsROperator.vb index 050e7c9fd1a..0bd7cf02aa7 100644 --- a/instat/clsROperator.vb +++ b/instat/clsROperator.vb @@ -48,9 +48,9 @@ Public Class ROperator End Function - Public Overrides Sub AddParameter(clsParam As RParameter, Optional iPosition As Integer = -1) + Public Overrides Sub AddParameter(clsParam As RParameter) clsParam.bIncludeArgumentName = False 'We don't want to allow names in operator parameters... - MyBase.AddParameter(clsParam, iPosition) + MyBase.AddParameter(clsParam) End Sub Public Overrides Function GetParameter(strName As String) As RParameter diff --git a/instat/clsRParameter.vb b/instat/clsRParameter.vb index 9d2c6bb2fab..909827e0030 100644 --- a/instat/clsRParameter.vb +++ b/instat/clsRParameter.vb @@ -26,15 +26,16 @@ Public Class RParameter Public bIsString As Boolean = False 'iPosition determines the position this parameter should take among other parameters of an Operator or Function. If iPosition is 0, then it is part of the unordered parameters that are added after the ordered ones. 'Note, it is allowed to have gaps in the positions: parameters with positions a 0, b 2, c 5, d 3, e 0 will be sorted as b d c (a e). See CompareParametersPosition in clsRCodeStructure. - Private iPosition As Integer = 0 + Private iPosition As Integer = -1 'See strArgumentName Public bIncludeArgumentName As Boolean = True Public Sub New() End Sub - Public Sub New(strParameterName As String) + Public Sub New(strParameterName As String, Optional iNewPosition As Integer = -1) SetArgumentName(strParameterName) + Position = iNewPosition End Sub ''Public Event PositionChanged() diff --git a/instat/dlgColourbyProperty.vb b/instat/dlgColourbyProperty.vb index 8020b1fa3d5..3bcf77fb2c7 100644 --- a/instat/dlgColourbyProperty.vb +++ b/instat/dlgColourbyProperty.vb @@ -42,15 +42,15 @@ Public Class dlgColourbyProperty Private Sub SetDefaults() ucrSelectorColourByMetadata.Reset() SetOrRemoveColours() - chkRemoveColours.Checked = False + 'chkRemoveColours.Checked = False End Sub Private Sub TestOKEnabled() - If Not ucrReceiverMetadataProperty.IsEmpty OrElse chkRemoveColours.Checked Then - ucrBase.OKEnabled(True) - Else - ucrBase.OKEnabled(False) - End If + 'If Not ucrReceiverMetadataProperty.IsEmpty OrElse chkRemoveColours.Checked Then + ' ucrBase.OKEnabled(True) + 'Else + ' ucrBase.OKEnabled(False) + 'End If End Sub Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset @@ -72,21 +72,21 @@ Public Class dlgColourbyProperty TestOKEnabled() End Sub - Private Sub chkRemoveColours_CheckedChanged(sender As Object, e As EventArgs) Handles chkRemoveColours.CheckedChanged + Private Sub chkRemoveColours_CheckedChanged(sender As Object, e As EventArgs) 'Handles chkRemoveColours.CheckedChanged SetOrRemoveColours() End Sub Private Sub SetOrRemoveColours() - If chkRemoveColours.Checked Then - ucrSelectorColourByMetadata.Reset() - ucrSelectorColourByMetadata.SetCurrentReceiver(Nothing) - ucrReceiverMetadataProperty.Enabled = False - ucrBase.clsRsyntax.SetBaseRFunction(clsRemoveColoursFunction) - Else - ucrBase.clsRsyntax.SetBaseRFunction(clsSetColoursFunction) - ucrReceiverMetadataProperty.Enabled = True - ucrReceiverMetadataProperty.SetMeAsReceiver() - End If - TestOKEnabled() + 'If chkRemoveColours.Checked Then + ' ucrSelectorColourByMetadata.Reset() + ' ucrSelectorColourByMetadata.SetCurrentReceiver(Nothing) + ' ucrReceiverMetadataProperty.Enabled = False + ' ucrBase.clsRsyntax.SetBaseRFunction(clsRemoveColoursFunction) + 'Else + ' ucrBase.clsRsyntax.SetBaseRFunction(clsSetColoursFunction) + ' ucrReceiverMetadataProperty.Enabled = True + ' ucrReceiverMetadataProperty.SetMeAsReceiver() + 'End If + 'TestOKEnabled() End Sub End Class \ No newline at end of file diff --git a/instat/dlgInventoryPlot.vb b/instat/dlgInventoryPlot.vb index 2c1d45910a6..b77e3dca3f4 100644 --- a/instat/dlgInventoryPlot.vb +++ b/instat/dlgInventoryPlot.vb @@ -77,7 +77,7 @@ Public Class dlgInventoryPlot ucrBase.clsRsyntax.iCallType = 3 ucrSaveInventoryPlot.SetDataFrameSelector(ucrInventoryPlotSelector.ucrAvailableDataFrames) - clsDefaultRFunction.AddParameter(ucrInventoryPlotSelector.GetParameter(), 0) + clsDefaultRFunction.AddParameter(ucrInventoryPlotSelector.GetParameter()) End Sub diff --git a/instat/dlgOneVariableGraph.vb b/instat/dlgOneVariableGraph.vb index 4ab92af80bd..6e629bacbd3 100644 --- a/instat/dlgOneVariableGraph.vb +++ b/instat/dlgOneVariableGraph.vb @@ -56,10 +56,10 @@ Public Class dlgOneVariableGraph ucrReceiverOneVarGraph.Selector = ucrSelectorOneVarGraph ucrReceiverOneVarGraph.SetMeAsReceiver() - ucrReceiverOneVarGraph.SetParameter(New RParameter("columns")) + ucrReceiverOneVarGraph.SetParameter(New RParameter("columns", 1)) ucrReceiverOneVarGraph.SetParameterIsString() - ucrSelectorOneVarGraph.SetParameter(New RParameter("data_name")) + ucrSelectorOneVarGraph.SetParameter(New RParameter("data_name", 0)) ucrSelectorOneVarGraph.SetParameterIsString() ucrChkFlip.SetText("Flip Coordinates") diff --git a/instat/ucrCore.vb b/instat/ucrCore.vb index cd6998db07c..07259a94491 100644 --- a/instat/ucrCore.vb +++ b/instat/ucrCore.vb @@ -20,7 +20,6 @@ Public Class ucrCore 'Function or Operator that this control's parameter is added/removed from Protected clsRCode As New RCodeStructure - Protected iParameterPosition As Integer = -1 'Parameter that this control manages 'Either by editing its value or adding/removing it from an RCodeStructure Protected clsParameter As RParameter @@ -203,7 +202,7 @@ Public Class ucrCore Public Overridable Sub AddOrRemoveParameter(bAdd As Boolean) If clsRCode IsNot Nothing AndAlso clsParameter IsNot Nothing Then If bAdd Then - clsRCode.AddParameter(clsParameter, iParameterPosition) + clsRCode.AddParameter(clsParameter) Else clsRCode.RemoveParameter(clsParameter) End If