diff --git a/instat/dlgClimaticLengthOfSeason.Designer.vb b/instat/dlgClimaticLengthOfSeason.Designer.vb index e245d05139..f3c30266ed 100644 --- a/instat/dlgClimaticLengthOfSeason.Designer.vb +++ b/instat/dlgClimaticLengthOfSeason.Designer.vb @@ -37,7 +37,8 @@ Partial Class dlgClimaticLengthOfSeason Me.ucrSelectorLengthofSeason = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() Me.ucrChkLengthmore = New instat.ucrCheck() - Me.ucrNudLenghtmore = New instat.ucrNud() + Me.ucrInputFilterPreview = New instat.ucrInputTextBox() + Me.cmdDoyRange = New System.Windows.Forms.Button() Me.SuspendLayout() ' 'lblStartofRains @@ -198,18 +199,27 @@ Partial Class dlgClimaticLengthOfSeason Me.ucrChkLengthmore.Size = New System.Drawing.Size(143, 23) Me.ucrChkLengthmore.TabIndex = 14 ' - 'ucrNudLenghtmore + 'ucrInputFilterPreview ' - Me.ucrNudLenghtmore.AutoSize = True - Me.ucrNudLenghtmore.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudLenghtmore.Increment = New Decimal(New Integer() {1, 0, 0, 0}) - Me.ucrNudLenghtmore.Location = New System.Drawing.Point(149, 291) - Me.ucrNudLenghtmore.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) - Me.ucrNudLenghtmore.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) - Me.ucrNudLenghtmore.Name = "ucrNudLenghtmore" - Me.ucrNudLenghtmore.Size = New System.Drawing.Size(50, 20) - Me.ucrNudLenghtmore.TabIndex = 15 - Me.ucrNudLenghtmore.Value = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrInputFilterPreview.AddQuotesIfUnrecognised = True + Me.ucrInputFilterPreview.AutoSize = True + Me.ucrInputFilterPreview.IsMultiline = False + Me.ucrInputFilterPreview.IsReadOnly = True + Me.ucrInputFilterPreview.Location = New System.Drawing.Point(243, 293) + Me.ucrInputFilterPreview.Name = "ucrInputFilterPreview" + Me.ucrInputFilterPreview.Size = New System.Drawing.Size(160, 22) + Me.ucrInputFilterPreview.TabIndex = 17 + ' + 'cmdDoyRange + ' + Me.cmdDoyRange.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.cmdDoyRange.Location = New System.Drawing.Point(149, 293) + Me.cmdDoyRange.Name = "cmdDoyRange" + Me.cmdDoyRange.Size = New System.Drawing.Size(83, 26) + Me.cmdDoyRange.TabIndex = 16 + Me.cmdDoyRange.Tag = "" + Me.cmdDoyRange.Text = "Day Range" + Me.cmdDoyRange.UseVisualStyleBackColor = True ' 'dlgClimaticLengthOfSeason ' @@ -217,7 +227,8 @@ Partial Class dlgClimaticLengthOfSeason Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.AutoSize = True Me.ClientSize = New System.Drawing.Size(416, 384) - Me.Controls.Add(Me.ucrNudLenghtmore) + Me.Controls.Add(Me.ucrInputFilterPreview) + Me.Controls.Add(Me.cmdDoyRange) Me.Controls.Add(Me.ucrChkLengthmore) Me.Controls.Add(Me.ucrChkType) Me.Controls.Add(Me.ucrChkLengthofSeason) @@ -256,6 +267,7 @@ Partial Class dlgClimaticLengthOfSeason Friend WithEvents ucrChkLengthofSeason As ucrCheck Friend WithEvents ucrInputTextType As ucrInputTextBox Friend WithEvents ucrInputLengthofSeason As ucrInputTextBox - Friend WithEvents ucrNudLenghtmore As ucrNud Friend WithEvents ucrChkLengthmore As ucrCheck + Friend WithEvents ucrInputFilterPreview As ucrInputTextBox + Friend WithEvents cmdDoyRange As Button End Class diff --git a/instat/dlgClimaticLengthOfSeason.vb b/instat/dlgClimaticLengthOfSeason.vb index 673c14b017..0896d77d35 100644 --- a/instat/dlgClimaticLengthOfSeason.vb +++ b/instat/dlgClimaticLengthOfSeason.vb @@ -20,8 +20,8 @@ Public Class dlgClimaticLengthOfSeason Private bReset As Boolean = True Private strCurrDataName As String = "" - Private clsLengthOfSeasonFunction, clsLengthmoreFunction, clsListFunction, clsAscharactermoreFunction, clsConvertColumnTypeFunction, clsElseIfMoreFunction, clsApplyInstatCalcFunction, clsAsCharacterFunction, clsCombinationCalcFunction, clsStartEndStatusFunction, clsCaseWhenFunction, clsIsNAFunction, clsIsNA1Function, clsCombinationListFunction As New RFunction - Private clsMinusOpertor, clsAssignMoreOperator, clsMinusmoreOPerator, clsAndOperator, clsOROperator, clsCaseWhenOperator, clsCaseWhen1Operator, clsCaseWhen2Operator, clsCaseWhen3Operator, clsAssignOperator, clsAssign1Operator, clsAssign2Operator, clsAssign3Operator, clsAssign4Operator, clsAnd1Operator, clsAnd2Operator As New ROperator + Private clsLengthOfSeasonFunction, clsDayFromAndToFunction, clsLengthmoreFunction, clsListFunction, clsAscharactermoreFunction, clsIfElseFirstDoyFilledFunction, clsConvertColumnTypeFunction, clsElseIfMoreFunction, clsApplyInstatCalcFunction, clsAsCharacterFunction, clsDayFilterCalcFromListFunction, clsCombinationCalcFunction, clsStartEndStatusFunction, clsCaseWhenFunction, clsIsNAFunction, clsIsNA1Function, clsCombinationListFunction As New RFunction + Private clsMinusOpertor, clsAssignMoreOperator, clsDayToOperator, clsMinusmoreOPerator, clsAndOperator, clsOROperator, clsCaseWhenOperator, clsCaseWhen1Operator, clsDayFromOperator, clsCaseWhen2Operator, clsCaseWhen3Operator, clsAssignOperator, clsAssign1Operator, clsAssign2Operator, clsAssign3Operator, clsAssign4Operator, clsAnd1Operator, clsAnd2Operator As New ROperator Private Sub dlgClimaticLengthOfSeason_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -81,24 +81,23 @@ Public Class dlgClimaticLengthOfSeason ucrChkLengthmore.SetText("Length_More") ucrChkLengthmore.AddParameterPresentCondition(True, "sub3", True) ucrChkLengthmore.AddParameterPresentCondition(False, "sub3", False) - ucrChkLengthmore.AddToLinkedControls(ucrNudLenghtmore, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=366) + ucrChkLengthmore.AddToLinkedControls(ucrInputFilterPreview, {True}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=366) - ucrNudLenghtmore.SetParameter(New RParameter("left", 0, False)) - ucrNudLenghtmore.DecimalPlaces = 0 - ucrNudLenghtmore.Increment = 1 - ucrNudLenghtmore.Minimum = 1 - ucrNudLenghtmore.Maximum = 366 EnableLengthmore() + ucrInputFilterPreview.IsReadOnly = True End Sub Private Sub SetDefaults() Dim strLengthName As String = "length" Dim strTypeName As String = "length_status" + clsDayFilterCalcFromListFunction = New RFunction clsAscharactermoreFunction = New RFunction clsListFunction = New RFunction - clsMinusmoreOPerator =New ROperator + clsMinusmoreOPerator = New ROperator + clsDayToOperator.Clear() + clsDayFromAndToFunction.Clear() clsLengthOfSeasonFunction.Clear() clsCombinationCalcFunction.Clear() clsApplyInstatCalcFunction.Clear() @@ -260,6 +259,10 @@ Public Class dlgClimaticLengthOfSeason clsMinusmoreOPerator.SetOperation("-") + clsDayToOperator.SetOperation("") + clsDayToOperator.AddParameter("to", 366) + clsDayToOperator.bAllBrackets = False + 'Base Function ucrBase.clsRsyntax.ClearCodes() ucrBase.clsRsyntax.SetBaseRFunction(clsApplyInstatCalcFunction) @@ -287,7 +290,7 @@ Public Class dlgClimaticLengthOfSeason ucrChkLengthofSeason.SetRCode(clsCombinationListFunction, bReset) ucrChkType.SetRCode(clsCombinationListFunction, bReset) ucrChkLengthmore.SetRCode(clsCombinationListFunction, bReset) - ucrNudLenghtmore.SetRCode(clsMinusmoreOPerator, bReset) + ucrInputFilterPreview.SetRCode(clsMinusmoreOPerator, bReset) End Sub Private Sub TestOKEnabled() @@ -364,6 +367,7 @@ Public Class dlgClimaticLengthOfSeason Private Sub EnableLengthmore() ucrChkLengthmore.Enabled = ucrChkType.Checked + cmdDoyRange.Visible = ucrChkLengthmore.Checked End Sub Private Sub ucrInputLengthofSeason_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputLengthofSeason.ControlValueChanged @@ -383,4 +387,21 @@ Public Class dlgClimaticLengthOfSeason clsAscharactermoreFunction.RemoveParameterByName("x") End If End Sub + + Private Sub cmdDoyRange_Click(sender As Object, e As EventArgs) Handles cmdDoyRange.Click + Dim newSdgDoyRange As New sdgDoyRange() + newSdgDoyRange.isFromDlgClimaticLengthOfSeason = True + newSdgDoyRange.Setup(clsNewDoyFilterCalc:=clsDayFromAndToFunction, clsNewIfElseFirstDoyFilledFunction:=clsIfElseFirstDoyFilledFunction, clsNewDayFromOperator:=clsDayFromOperator, clsNewDayToOperator:=clsDayToOperator, clsNewCalcFromList:=clsDayFilterCalcFromListFunction, strNewMainDataFrame:=ucrSelectorLengthofSeason.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strNewDoyColumn:="") + newSdgDoyRange.ShowDialog() + newSdgDoyRange.Desablecontrols() + ucrInputFilterPreview.SetName(clsDayToOperator.ToScript()) + End Sub + + Private Sub ucrInputFilterPreview_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputFilterPreview.ControlValueChanged + If Not ucrInputFilterPreview.IsEmpty Then + clsMinusmoreOPerator.AddParameter("left", ucrInputFilterPreview.GetText(), iPosition:=0, bIncludeArgumentName:=False) + Else + clsMinusmoreOPerator.RemoveParameterByName("left") + End If + End Sub End Class \ No newline at end of file diff --git a/instat/sdgDoyRange.Designer.vb b/instat/sdgDoyRange.Designer.vb index 997ea1bdcc..25edef612b 100644 --- a/instat/sdgDoyRange.Designer.vb +++ b/instat/sdgDoyRange.Designer.vb @@ -246,7 +246,6 @@ Partial Class sdgDoyRange ' 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(587, 357) Me.Controls.Add(Me.grpTo) Me.Controls.Add(Me.ucrSelectorDoy) diff --git a/instat/sdgDoyRange.vb b/instat/sdgDoyRange.vb index cab5c87e4e..1a60bc9e09 100644 --- a/instat/sdgDoyRange.vb +++ b/instat/sdgDoyRange.vb @@ -18,6 +18,7 @@ Imports instat.Translations Imports RDotNet Public Class sdgDoyRange + Public isFromDlgClimaticLengthOfSeason As Boolean = False Private clsDoyFilterCalc As RFunction Private clsCalcFromList As RFunction Private clsCalcFromMainDataFrame As RFunction @@ -31,6 +32,7 @@ Public Class sdgDoyRange Private Sub sdgDoyRange_Load(sender As Object, e As EventArgs) Handles MyBase.Load autoTranslate(Me) + Desablecontrols() End Sub Public Sub Setup(clsNewDoyFilterCalc As RFunction, clsNewDayFromOperator As ROperator, clsNewDayToOperator As ROperator, clsNewCalcFromList As RFunction, strNewMainDataFrame As String, strNewDoyColumn As String, Optional clsNewIfElseFirstDoyFilledFunction As RFunction = Nothing) @@ -264,4 +266,22 @@ Public Class sdgDoyRange UpdateFromValues() UpdateToValues() End Sub + + Public Sub Desablecontrols() + If Me.isFromDlgClimaticLengthOfSeason Then + Me.rdoFromFixed.Enabled = False + Me.rdoFromVariable.Enabled = False + Me.ucrDoyFrom.Enabled = False + Me.ucrReceiverFrom.Enabled = False + Me.rdoToVariable.Enabled = False + Me.rdoLength.Enabled = False + Me.ucrReceiverTo.Enabled = False + Me.ucrNudToDiff.Enabled = False + Me.ucrSelectorDoy.Enabled = False + Me.Size = New Size(603, 218) + Me.grpFrom.Location = New Size(10, 12) + Me.grpTo.Location = New Size(269, 12) + Me.ucrBaseSub.Location = New Size(185, 140) + End If + End Sub End Class