diff --git a/instat/Model/DataFrame/clsDataFramePage.vb b/instat/Model/DataFrame/clsDataFramePage.vb index a4c35506c93..b4a6a621210 100644 --- a/instat/Model/DataFrame/clsDataFramePage.vb +++ b/instat/Model/DataFrame/clsDataFramePage.vb @@ -293,9 +293,10 @@ Public Class clsDataFramePage End If _lstColumns.Clear() + For i = 0 To _clsRDotNetDataFrame.ColumnNames.ToList.Count - 1 columnHeader = GetColumnDispayDetails(_clsRDotNetDataFrame.ColumnNames.ToList(i), vecColumnDataTypes(i)) - If bApplyBackGroundColumnColours AndAlso vecColumnColours IsNot Nothing Then + If bApplyBackGroundColumnColours AndAlso Not Double.IsNaN(vecColumnColours(i)) Then columnHeader.clsBackGroundColour = GetColumnBackGroundColor(i, vecColumnColours(i).ToString()) End If _lstColumns.Add(columnHeader) diff --git a/instat/UserControls/DataGrid/ReoGrid/ucrDataframeMetadataReoGrid.vb b/instat/UserControls/DataGrid/ReoGrid/ucrDataframeMetadataReoGrid.vb index 75515ddcd6f..ba68e880f55 100644 --- a/instat/UserControls/DataGrid/ReoGrid/ucrDataframeMetadataReoGrid.vb +++ b/instat/UserControls/DataGrid/ReoGrid/ucrDataframeMetadataReoGrid.vb @@ -54,6 +54,7 @@ Public Class ucrDataframeMetadataReoGrid grdData.Worksheets(0).SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToMoveCells, False) grdData.Worksheets(0).SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToMoveCells, False) grdData.Worksheets(0).SetSettings(unvell.ReoGrid.WorksheetSettings.Edit_DragSelectionToFillSerial, False) + grdData.Worksheets(0).SetSettings(unvell.ReoGrid.WorksheetSettings.View_AllowCellTextOverflow, False) grdData.Worksheets(0).SelectionForwardDirection = unvell.ReoGrid.SelectionForwardDirection.Down grdData.SheetTabNewButtonVisible = False AttachEventsToWorksheet(grdData.Worksheets(0)) diff --git a/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb b/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb index 28bac1507e8..af92f346d21 100644 --- a/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb +++ b/instat/UserControls/DataGrid/ReoGrid/ucrReoGrid.vb @@ -190,15 +190,24 @@ Public MustInherit Class ucrReoGrid End Function Private Sub UpdateWorksheetStyle(workSheet As Worksheet) + 'issue with reo grid that means if RangePosition.EntireRange is used then the back color + 'changes. This would then override the back color set in R If frmMain.clsInstatOptions IsNot Nothing Then - workSheet.SetRangeStyles(RangePosition.EntireRange, New WorksheetRangeStyle() With { + 'Set enitre range apart from top row + workSheet.SetRangeStyles(New RangePosition(1, 0, workSheet.RowCount, workSheet.ColumnCount), New WorksheetRangeStyle() With { + .Flag = PlainStyleFlag.TextColor Or PlainStyleFlag.FontSize Or PlainStyleFlag.FontName, + .TextColor = frmMain.clsInstatOptions.clrEditor, + .FontSize = frmMain.clsInstatOptions.fntEditor.Size, + .FontName = frmMain.clsInstatOptions.fntEditor.Name + }) + 'Set top row + workSheet.SetRangeStyles(New RangePosition(0, 0, 1, workSheet.ColumnCount), New WorksheetRangeStyle() With { .Flag = PlainStyleFlag.TextColor Or PlainStyleFlag.FontSize Or PlainStyleFlag.FontName, .TextColor = frmMain.clsInstatOptions.clrEditor, .FontSize = frmMain.clsInstatOptions.fntEditor.Size, .FontName = frmMain.clsInstatOptions.fntEditor.Name }) End If - End Sub Private Sub ucrReoGrid_Load(sender As Object, e As EventArgs) Handles MyBase.Load diff --git a/instat/dlgColourbyProperty.Designer.vb b/instat/dlgColourbyProperty.Designer.vb index f3331584896..be061243ae1 100644 --- a/instat/dlgColourbyProperty.Designer.vb +++ b/instat/dlgColourbyProperty.Designer.vb @@ -49,7 +49,7 @@ Partial Class dlgColourbyProperty ' Me.lblMetadataProp.AutoSize = True Me.lblMetadataProp.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblMetadataProp.Location = New System.Drawing.Point(263, 45) + Me.lblMetadataProp.Location = New System.Drawing.Point(263, 36) Me.lblMetadataProp.Name = "lblMetadataProp" Me.lblMetadataProp.Size = New System.Drawing.Size(97, 13) Me.lblMetadataProp.TabIndex = 3 @@ -59,7 +59,7 @@ Partial Class dlgColourbyProperty ' Me.ucrChkRemoveColours.AutoSize = True Me.ucrChkRemoveColours.Checked = False - Me.ucrChkRemoveColours.Location = New System.Drawing.Point(263, 84) + Me.ucrChkRemoveColours.Location = New System.Drawing.Point(263, 82) Me.ucrChkRemoveColours.Name = "ucrChkRemoveColours" Me.ucrChkRemoveColours.Size = New System.Drawing.Size(147, 23) Me.ucrChkRemoveColours.TabIndex = 4 @@ -68,7 +68,7 @@ Partial Class dlgColourbyProperty ' Me.ucrReceiverMetadataProperty.AutoSize = True Me.ucrReceiverMetadataProperty.frmParent = Me - Me.ucrReceiverMetadataProperty.Location = New System.Drawing.Point(263, 60) + Me.ucrReceiverMetadataProperty.Location = New System.Drawing.Point(263, 51) Me.ucrReceiverMetadataProperty.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverMetadataProperty.Name = "ucrReceiverMetadataProperty" Me.ucrReceiverMetadataProperty.Selector = Nothing diff --git a/instat/dlgColourbyProperty.vb b/instat/dlgColourbyProperty.vb index 73ecaf870fb..ccf731c407a 100644 --- a/instat/dlgColourbyProperty.vb +++ b/instat/dlgColourbyProperty.vb @@ -15,11 +15,13 @@ ' along with this program. If not, see . Imports instat.Translations +Imports RDotNet Public Class dlgColourbyProperty Public bFirstLoad As Boolean = True Private clsColourByMetadata As New RFunction Private clsRemoveColour As New RFunction Private bReset As Boolean = True + Private bApplyColumnColours As Boolean Private Sub dlgColourbyProperty_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -32,6 +34,8 @@ Public Class dlgColourbyProperty SetRCodeForControls(bReset) bReset = False TestOKEnabled() + AutoFill() + SetBaseFunction() autoTranslate(Me) End Sub @@ -61,7 +65,6 @@ Public Class dlgColourbyProperty clsColourByMetadata.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$set_column_colours_by_metadata") clsRemoveColour.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$remove_column_colours") - ucrBase.clsRsyntax.SetBaseRFunction(clsColourByMetadata) End Sub @@ -73,7 +76,7 @@ Public Class dlgColourbyProperty End Sub Private Sub TestOKEnabled() - If Not ucrReceiverMetadataProperty.IsEmpty Then + If Not ucrReceiverMetadataProperty.IsEmpty OrElse ucrChkRemoveColours.Checked Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -86,14 +89,41 @@ Public Class dlgColourbyProperty TestOKEnabled() End Sub - Private Sub ucrChkRemoveColours_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkRemoveColours.ControlValueChanged - If ucrChkRemoveColours.Checked Then + + Private Sub AutoFill() + If ucrSelectorColourByMetadata.lstAvailableVariable.Items.Count > 0 Then + Dim clsHasColoursFunc As New RFunction + clsHasColoursFunc.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$has_colours") + clsHasColoursFunc.AddParameter("data_name", Chr(34) & ucrSelectorColourByMetadata.ucrAvailableDataFrames.strCurrDataFrame & Chr(34)) + bApplyColumnColours = frmMain.clsRLink.RunInternalScriptGetValue(clsHasColoursFunc.ToScript()).AsLogical(0) + If Not bApplyColumnColours Then + For Each lviItem As ListViewItem In ucrSelectorColourByMetadata.lstAvailableVariable.Items + If lviItem.Text = "class" Then + ucrReceiverMetadataProperty.Add(lviItem.Text, ucrSelectorColourByMetadata.ucrAvailableDataFrames.strCurrDataFrame) + Exit For + End If + Next + End If + ucrChkRemoveColours.Visible = bApplyColumnColours + End If + End Sub + + Private Sub SetBaseFunction() + If ucrChkRemoveColours.Checked AndAlso bApplyColumnColours Then ucrBase.clsRsyntax.SetBaseRFunction(clsRemoveColour) Else ucrBase.clsRsyntax.SetBaseRFunction(clsColourByMetadata) End If End Sub + Private Sub ucrChkRemoveColours_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkRemoveColours.ControlValueChanged + SetBaseFunction() + End Sub + + Private Sub ucrSelectorColourByMetadata_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorColourByMetadata.ControlValueChanged + AutoFill() + End Sub + Private Sub Controls_ControContententsChanged(ucrChangedControl As ucrCore) Handles ucrSelectorColourByMetadata.ControlContentsChanged, ucrReceiverMetadataProperty.ControlContentsChanged, ucrChkRemoveColours.ControlContentsChanged TestOKEnabled() End Sub diff --git a/instat/dlgConversions.Designer.vb b/instat/dlgConversions.Designer.vb index da41686d7ed..8bf3a1d9f87 100644 --- a/instat/dlgConversions.Designer.vb +++ b/instat/dlgConversions.Designer.vb @@ -51,23 +51,28 @@ Partial Class dlgConversions Me.lblMinutes = New System.Windows.Forms.Label() Me.lblSeconds = New System.Windows.Forms.Label() Me.lblDegrees = New System.Windows.Forms.Label() - Me.ucrReceiverLetters = New instat.ucrReceiverSingle() + Me.lblDirection = New System.Windows.Forms.Label() + Me.ucrSaveColumn = New instat.ucrSave() + Me.ucrInputDirection = New instat.ucrInputComboBox() Me.ucrChkVariable = New instat.ucrCheck() Me.ucrInputSecond = New instat.ucrInputTextBox() - Me.ucrInputMinute = New instat.ucrInputTextBox() Me.ucrInputDegree = New instat.ucrInputTextBox() + Me.ucrReceiverLetters = New instat.ucrReceiverSingle() Me.ucrSaveConversions = New instat.ucrSave() Me.ucrReceiverDegrees = New instat.ucrReceiverSingle() - Me.ucrReceiverMinutes = New instat.ucrReceiverSingle() Me.ucrReceiverSeconds = New instat.ucrReceiverSingle() Me.ucrReceiverDate = New instat.ucrReceiverSingle() Me.ucrReceiverElement = New instat.ucrReceiverSingle() Me.ucrPnlConversions = New instat.UcrPanel() Me.ucrSelectorConversions = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrBase = New instat.ucrButtons() - Me.ucrInputDirection = New instat.ucrInputComboBox() - Me.lblDirection = New System.Windows.Forms.Label() - Me.ucrSaveColumn = New instat.ucrSave() + Me.ucrInputMinute = New instat.ucrInputTextBox() + Me.ucrReceiverMinutes = New instat.ucrReceiverSingle() + Me.rdoYear = New System.Windows.Forms.RadioButton() + Me.ucrReceiverYear = New instat.ucrReceiverSingle() + Me.lblYear = New System.Windows.Forms.Label() + Me.ucrNudBaseYear = New instat.ucrNud() + Me.lblBaseYear = New System.Windows.Forms.Label() Me.grpLatitude.SuspendLayout() Me.grpElements.SuspendLayout() Me.SuspendLayout() @@ -83,9 +88,9 @@ Partial Class dlgConversions Me.rdoDayLength.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoDayLength.ForeColor = System.Drawing.SystemColors.ActiveCaptionText Me.rdoDayLength.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoDayLength.Location = New System.Drawing.Point(166, 21) + Me.rdoDayLength.Location = New System.Drawing.Point(127, 21) Me.rdoDayLength.Name = "rdoDayLength" - Me.rdoDayLength.Size = New System.Drawing.Size(99, 28) + Me.rdoDayLength.Size = New System.Drawing.Size(90, 28) Me.rdoDayLength.TabIndex = 2 Me.rdoDayLength.Text = "Day Length" Me.rdoDayLength.TextAlign = System.Drawing.ContentAlignment.MiddleCenter @@ -101,9 +106,9 @@ Partial Class dlgConversions Me.rdoUnits.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoUnits.ForeColor = System.Drawing.SystemColors.ControlText Me.rdoUnits.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoUnits.Location = New System.Drawing.Point(67, 21) + Me.rdoUnits.Location = New System.Drawing.Point(39, 21) Me.rdoUnits.Name = "rdoUnits" - Me.rdoUnits.Size = New System.Drawing.Size(99, 28) + Me.rdoUnits.Size = New System.Drawing.Size(90, 28) Me.rdoUnits.TabIndex = 1 Me.rdoUnits.Text = "Units" Me.rdoUnits.TextAlign = System.Drawing.ContentAlignment.MiddleCenter @@ -410,9 +415,9 @@ Partial Class dlgConversions Me.rdoCoordinates.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoCoordinates.ForeColor = System.Drawing.SystemColors.ActiveCaptionText Me.rdoCoordinates.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoCoordinates.Location = New System.Drawing.Point(264, 21) + Me.rdoCoordinates.Location = New System.Drawing.Point(215, 21) Me.rdoCoordinates.Name = "rdoCoordinates" - Me.rdoCoordinates.Size = New System.Drawing.Size(99, 28) + Me.rdoCoordinates.Size = New System.Drawing.Size(90, 28) Me.rdoCoordinates.TabIndex = 3 Me.rdoCoordinates.Text = "Coordinates" Me.rdoCoordinates.TextAlign = System.Drawing.ContentAlignment.MiddleCenter @@ -448,18 +453,35 @@ Partial Class dlgConversions Me.lblDegrees.TabIndex = 7 Me.lblDegrees.Text = "Degrees:" ' - 'ucrReceiverLetters + 'lblDirection ' - Me.ucrReceiverLetters.AutoSize = True - Me.ucrReceiverLetters.frmParent = Me - Me.ucrReceiverLetters.Location = New System.Drawing.Point(353, 239) - Me.ucrReceiverLetters.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverLetters.Name = "ucrReceiverLetters" - Me.ucrReceiverLetters.Selector = Nothing - Me.ucrReceiverLetters.Size = New System.Drawing.Size(81, 21) - Me.ucrReceiverLetters.strNcFilePath = "" - Me.ucrReceiverLetters.TabIndex = 6 - Me.ucrReceiverLetters.ucrSelector = Nothing + Me.lblDirection.AutoSize = True + Me.lblDirection.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblDirection.Location = New System.Drawing.Point(265, 223) + Me.lblDirection.Name = "lblDirection" + Me.lblDirection.Size = New System.Drawing.Size(52, 13) + Me.lblDirection.TabIndex = 24 + Me.lblDirection.Text = "Direction:" + ' + 'ucrSaveColumn + ' + Me.ucrSaveColumn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrSaveColumn.Location = New System.Drawing.Point(9, 413) + Me.ucrSaveColumn.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSaveColumn.Name = "ucrSaveColumn" + Me.ucrSaveColumn.Size = New System.Drawing.Size(320, 22) + Me.ucrSaveColumn.TabIndex = 25 + ' + 'ucrInputDirection + ' + Me.ucrInputDirection.AddQuotesIfUnrecognised = True + Me.ucrInputDirection.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputDirection.GetSetSelectedIndex = -1 + Me.ucrInputDirection.IsReadOnly = False + Me.ucrInputDirection.Location = New System.Drawing.Point(265, 239) + Me.ucrInputDirection.Name = "ucrInputDirection" + Me.ucrInputDirection.Size = New System.Drawing.Size(86, 21) + Me.ucrInputDirection.TabIndex = 23 ' 'ucrChkVariable ' @@ -481,17 +503,6 @@ Partial Class dlgConversions Me.ucrInputSecond.Size = New System.Drawing.Size(120, 20) Me.ucrInputSecond.TabIndex = 12 ' - 'ucrInputMinute - ' - Me.ucrInputMinute.AddQuotesIfUnrecognised = True - Me.ucrInputMinute.AutoSize = True - Me.ucrInputMinute.IsMultiline = False - Me.ucrInputMinute.IsReadOnly = False - Me.ucrInputMinute.Location = New System.Drawing.Point(265, 152) - Me.ucrInputMinute.Name = "ucrInputMinute" - Me.ucrInputMinute.Size = New System.Drawing.Size(120, 20) - Me.ucrInputMinute.TabIndex = 10 - ' 'ucrInputDegree ' Me.ucrInputDegree.AddQuotesIfUnrecognised = True @@ -503,6 +514,19 @@ Partial Class dlgConversions Me.ucrInputDegree.Size = New System.Drawing.Size(120, 20) Me.ucrInputDegree.TabIndex = 8 ' + 'ucrReceiverLetters + ' + Me.ucrReceiverLetters.AutoSize = True + Me.ucrReceiverLetters.frmParent = Me + Me.ucrReceiverLetters.Location = New System.Drawing.Point(353, 239) + Me.ucrReceiverLetters.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverLetters.Name = "ucrReceiverLetters" + Me.ucrReceiverLetters.Selector = Nothing + Me.ucrReceiverLetters.Size = New System.Drawing.Size(81, 21) + Me.ucrReceiverLetters.strNcFilePath = "" + Me.ucrReceiverLetters.TabIndex = 6 + Me.ucrReceiverLetters.ucrSelector = Nothing + ' 'ucrSaveConversions ' Me.ucrSaveConversions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink @@ -525,19 +549,6 @@ Partial Class dlgConversions Me.ucrReceiverDegrees.TabIndex = 9 Me.ucrReceiverDegrees.ucrSelector = Nothing ' - 'ucrReceiverMinutes - ' - Me.ucrReceiverMinutes.AutoSize = True - Me.ucrReceiverMinutes.frmParent = Me - Me.ucrReceiverMinutes.Location = New System.Drawing.Point(265, 152) - Me.ucrReceiverMinutes.Margin = New System.Windows.Forms.Padding(0) - Me.ucrReceiverMinutes.Name = "ucrReceiverMinutes" - Me.ucrReceiverMinutes.Selector = Nothing - Me.ucrReceiverMinutes.Size = New System.Drawing.Size(120, 20) - Me.ucrReceiverMinutes.strNcFilePath = "" - Me.ucrReceiverMinutes.TabIndex = 10 - Me.ucrReceiverMinutes.ucrSelector = Nothing - ' 'ucrReceiverSeconds ' Me.ucrReceiverSeconds.AutoSize = True @@ -580,9 +591,9 @@ Partial Class dlgConversions 'ucrPnlConversions ' Me.ucrPnlConversions.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPnlConversions.Location = New System.Drawing.Point(62, 21) + Me.ucrPnlConversions.Location = New System.Drawing.Point(30, 21) Me.ucrPnlConversions.Name = "ucrPnlConversions" - Me.ucrPnlConversions.Size = New System.Drawing.Size(310, 28) + Me.ucrPnlConversions.Size = New System.Drawing.Size(376, 28) Me.ucrPnlConversions.TabIndex = 0 ' 'ucrSelectorConversions @@ -606,58 +617,118 @@ Partial Class dlgConversions Me.ucrBase.Size = New System.Drawing.Size(405, 52) Me.ucrBase.TabIndex = 17 ' - 'ucrInputDirection - ' - Me.ucrInputDirection.AddQuotesIfUnrecognised = True - Me.ucrInputDirection.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputDirection.GetSetSelectedIndex = -1 - Me.ucrInputDirection.IsReadOnly = False - Me.ucrInputDirection.Location = New System.Drawing.Point(265, 239) - Me.ucrInputDirection.Name = "ucrInputDirection" - Me.ucrInputDirection.Size = New System.Drawing.Size(86, 21) - Me.ucrInputDirection.TabIndex = 23 + 'ucrInputMinute ' - 'lblDirection + Me.ucrInputMinute.AddQuotesIfUnrecognised = True + Me.ucrInputMinute.AutoSize = True + Me.ucrInputMinute.IsMultiline = False + Me.ucrInputMinute.IsReadOnly = False + Me.ucrInputMinute.Location = New System.Drawing.Point(265, 152) + Me.ucrInputMinute.Name = "ucrInputMinute" + Me.ucrInputMinute.Size = New System.Drawing.Size(120, 20) + Me.ucrInputMinute.TabIndex = 10 ' - Me.lblDirection.AutoSize = True - Me.lblDirection.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblDirection.Location = New System.Drawing.Point(265, 223) - Me.lblDirection.Name = "lblDirection" - Me.lblDirection.Size = New System.Drawing.Size(52, 13) - Me.lblDirection.TabIndex = 24 - Me.lblDirection.Text = "Direction:" + 'ucrReceiverMinutes ' - 'ucrSaveColumn + Me.ucrReceiverMinutes.AutoSize = True + Me.ucrReceiverMinutes.frmParent = Me + Me.ucrReceiverMinutes.Location = New System.Drawing.Point(265, 152) + Me.ucrReceiverMinutes.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverMinutes.Name = "ucrReceiverMinutes" + Me.ucrReceiverMinutes.Selector = Nothing + Me.ucrReceiverMinutes.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverMinutes.strNcFilePath = "" + Me.ucrReceiverMinutes.TabIndex = 10 + Me.ucrReceiverMinutes.ucrSelector = Nothing ' - Me.ucrSaveColumn.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveColumn.Location = New System.Drawing.Point(9, 413) - Me.ucrSaveColumn.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) - Me.ucrSaveColumn.Name = "ucrSaveColumn" - Me.ucrSaveColumn.Size = New System.Drawing.Size(320, 22) - Me.ucrSaveColumn.TabIndex = 25 + 'rdoYear + ' + Me.rdoYear.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoYear.BackgroundImageLayout = System.Windows.Forms.ImageLayout.None + Me.rdoYear.CheckAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoYear.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoYear.FlatAppearance.BorderSize = 2 + Me.rdoYear.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoYear.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoYear.ForeColor = System.Drawing.SystemColors.ActiveCaptionText + Me.rdoYear.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoYear.Location = New System.Drawing.Point(303, 21) + Me.rdoYear.Name = "rdoYear" + Me.rdoYear.Size = New System.Drawing.Size(90, 28) + Me.rdoYear.TabIndex = 27 + Me.rdoYear.Text = "Year" + Me.rdoYear.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoYear.UseVisualStyleBackColor = True + ' + 'ucrReceiverYear + ' + Me.ucrReceiverYear.AutoSize = True + Me.ucrReceiverYear.frmParent = Me + Me.ucrReceiverYear.Location = New System.Drawing.Point(265, 109) + Me.ucrReceiverYear.Margin = New System.Windows.Forms.Padding(0) + Me.ucrReceiverYear.Name = "ucrReceiverYear" + Me.ucrReceiverYear.Selector = Nothing + Me.ucrReceiverYear.Size = New System.Drawing.Size(120, 20) + Me.ucrReceiverYear.strNcFilePath = "" + Me.ucrReceiverYear.TabIndex = 28 + Me.ucrReceiverYear.ucrSelector = Nothing + ' + 'lblYear + ' + Me.lblYear.AutoSize = True + Me.lblYear.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblYear.Location = New System.Drawing.Point(265, 93) + Me.lblYear.Name = "lblYear" + Me.lblYear.Size = New System.Drawing.Size(32, 13) + Me.lblYear.TabIndex = 29 + Me.lblYear.Text = "Year:" + ' + 'ucrNudBaseYear + ' + Me.ucrNudBaseYear.AutoSize = True + Me.ucrNudBaseYear.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudBaseYear.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudBaseYear.Location = New System.Drawing.Point(265, 152) + Me.ucrNudBaseYear.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudBaseYear.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudBaseYear.Name = "ucrNudBaseYear" + Me.ucrNudBaseYear.Size = New System.Drawing.Size(64, 20) + Me.ucrNudBaseYear.TabIndex = 30 + Me.ucrNudBaseYear.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'lblBaseYear + ' + Me.lblBaseYear.AutoSize = True + Me.lblBaseYear.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblBaseYear.Location = New System.Drawing.Point(265, 136) + Me.lblBaseYear.Name = "lblBaseYear" + Me.lblBaseYear.Size = New System.Drawing.Size(59, 13) + Me.lblBaseYear.TabIndex = 31 + Me.lblBaseYear.Text = "Base Year:" ' 'dlgConversions ' Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi Me.ClientSize = New System.Drawing.Size(436, 503) + Me.Controls.Add(Me.lblBaseYear) + Me.Controls.Add(Me.ucrNudBaseYear) + Me.Controls.Add(Me.lblYear) + Me.Controls.Add(Me.ucrReceiverYear) + Me.Controls.Add(Me.rdoYear) Me.Controls.Add(Me.ucrSaveColumn) Me.Controls.Add(Me.lblDirection) Me.Controls.Add(Me.ucrInputDirection) Me.Controls.Add(Me.ucrChkVariable) Me.Controls.Add(Me.ucrInputSecond) - Me.Controls.Add(Me.ucrInputMinute) - Me.Controls.Add(Me.ucrInputDegree) Me.Controls.Add(Me.ucrReceiverLetters) Me.Controls.Add(Me.ucrSaveConversions) Me.Controls.Add(Me.lblDegrees) Me.Controls.Add(Me.lblSeconds) Me.Controls.Add(Me.lblMinutes) Me.Controls.Add(Me.ucrReceiverDegrees) - Me.Controls.Add(Me.ucrReceiverMinutes) Me.Controls.Add(Me.ucrReceiverSeconds) Me.Controls.Add(Me.rdoCoordinates) - Me.Controls.Add(Me.grpLatitude) Me.Controls.Add(Me.lblDate) Me.Controls.Add(Me.ucrReceiverDate) Me.Controls.Add(Me.lblElement) @@ -668,6 +739,10 @@ Partial Class dlgConversions Me.Controls.Add(Me.ucrSelectorConversions) Me.Controls.Add(Me.ucrBase) Me.Controls.Add(Me.grpElements) + Me.Controls.Add(Me.ucrInputMinute) + Me.Controls.Add(Me.ucrReceiverMinutes) + Me.Controls.Add(Me.grpLatitude) + Me.Controls.Add(Me.ucrInputDegree) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -729,4 +804,9 @@ Partial Class dlgConversions Friend WithEvents lblDirection As Label Friend WithEvents ucrInputDirection As ucrInputComboBox Friend WithEvents ucrSaveColumn As ucrSave + Friend WithEvents lblBaseYear As Label + Friend WithEvents ucrNudBaseYear As ucrNud + Friend WithEvents lblYear As Label + Friend WithEvents ucrReceiverYear As ucrReceiverSingle + Friend WithEvents rdoYear As RadioButton End Class \ No newline at end of file diff --git a/instat/dlgConversions.vb b/instat/dlgConversions.vb index 45d910af42b..8de14f90963 100644 --- a/instat/dlgConversions.vb +++ b/instat/dlgConversions.vb @@ -21,6 +21,7 @@ Public Class dlgConversions Private clsPrecipitationFunction, clsTemperatureFunction, clsWindSpeedFunction, clsConvertToDegreeFunction As New RFunction Private clsRoundFunction As New RFunction Private clsDayLengthFunction As New RFunction + Private clsYearConversionFunction As New RFunction Private clsDummyFunction As New RFunction Private Sub dlgConversions_Load(sender As Object, e As EventArgs) Handles MyBase.Load @@ -50,10 +51,12 @@ Public Class dlgConversions ucrPnlConversions.AddRadioButton(rdoUnits) ucrPnlConversions.AddRadioButton(rdoDayLength) ucrPnlConversions.AddRadioButton(rdoCoordinates) + ucrPnlConversions.AddRadioButton(rdoYear) ucrPnlConversions.AddFunctionNamesCondition(rdoUnits, {"convert_precip", "convert_temperature", "convert_wind_speed"}) ucrPnlConversions.AddFunctionNamesCondition(rdoDayLength, "daylength") ucrPnlConversions.AddFunctionNamesCondition(rdoCoordinates, "convert_to_dec_deg") + ucrPnlConversions.AddFunctionNamesCondition(rdoYear, "convert_yy_to_yyyy") ucrPnlLatitude.AddRadioButton(rdoSingleValue) ucrPnlLatitude.AddRadioButton(rdoColumn) @@ -100,6 +103,18 @@ Public Class dlgConversions ucrReceiverLetters.Selector = ucrSelectorConversions ucrReceiverLetters.bUseFilteredData = False + ucrReceiverYear.SetParameter(New RParameter("x", 0)) + ucrReceiverYear.Selector = ucrSelectorConversions + ucrReceiverYear.SetParameterIsRFunction() + ucrReceiverYear.bUseFilteredData = False + ucrReceiverYear.SetIncludedDataTypes({"numeric"}) + ucrReceiverYear.SetLinkedDisplayControl(lblYear) + + ucrNudBaseYear.SetParameter(New RParameter("base", 1)) + ucrNudBaseYear.SetMinMax(iNewMin:=2000, iNewMax:=2100) + ucrNudBaseYear.Increment = 1 + ucrNudBaseYear.SetLinkedDisplayControl(lblBaseYear) + ucrInputLatitude.SetValidationTypeAsNumeric(dcmMin:=-90, dcmMax:=90) ucrInputFromPrecipitation.SetParameter(New RParameter("old_metric", 1)) @@ -143,6 +158,8 @@ Public Class dlgConversions ucrPnlConversions.AddToLinkedControls(ucrReceiverElement, {rdoUnits}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls(ucrNudDecimal, {rdoUnits}, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls(ucrPnlElements, {rdoUnits}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=rdoRain) + ucrPnlConversions.AddToLinkedControls(ucrReceiverYear, {rdoYear}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlConversions.AddToLinkedControls(ucrNudBaseYear, {rdoYear}, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls(ucrReceiverDate, {rdoDayLength}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls(ucrPnlLatitude, {rdoDayLength}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:=rdoSingleValue) @@ -168,7 +185,7 @@ Public Class dlgConversions ucrPnlConversions.AddToLinkedControls(ucrReceiverMinutes, {rdoCoordinates}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls(ucrReceiverSeconds, {rdoCoordinates}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls(ucrInputDirection, {rdoCoordinates}, bNewLinkedHideIfParameterMissing:=True) - ucrPnlConversions.AddToLinkedControls(ucrSaveConversions, {rdoUnits, rdoDayLength}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlConversions.AddToLinkedControls(ucrSaveConversions, {rdoUnits, rdoDayLength, rdoYear}, bNewLinkedHideIfParameterMissing:=True) ucrPnlConversions.AddToLinkedControls({ucrChkVariable}, {rdoCoordinates}, bNewLinkedHideIfParameterMissing:=True) ucrInputDirection.AddToLinkedControls(ucrReceiverLetters, {"Variable"}, bNewLinkedHideIfParameterMissing:=True) ucrChkVariable.AddToLinkedControls({ucrInputDegree, ucrInputMinute, ucrInputSecond}, {False}, bNewLinkedHideIfParameterMissing:=True) @@ -178,12 +195,12 @@ Public Class dlgConversions ucrReceiverMinutes.SetLinkedDisplayControl(lblMinutes) ucrReceiverSeconds.SetLinkedDisplayControl(lblSeconds) ucrInputDirection.SetLinkedDisplayControl(lblDirection) + ucrPnlElements.SetLinkedDisplayControl(grpElements) ucrReceiverElement.SetLinkedDisplayControl(lblElement) ucrNudDecimal.SetLinkedDisplayControl(lstLabels) ucrReceiverDate.SetLinkedDisplayControl(lblDate) ucrPnlLatitude.SetLinkedDisplayControl(grpLatitude) - ucrPnlElements.SetLinkedDisplayControl(grpElements) ucrSaveConversions.SetSaveTypeAsColumn() ucrSaveConversions.SetDataFrameSelector(ucrSelectorConversions.ucrAvailableDataFrames) @@ -206,6 +223,7 @@ Public Class dlgConversions clsConvertToDegreeFunction = New RFunction clsRoundFunction = New RFunction clsDummyFunction = New RFunction + clsYearConversionFunction = New RFunction ucrSelectorConversions.Reset() ucrSaveConversions.Reset() @@ -237,6 +255,9 @@ Public Class dlgConversions clsRoundFunction.AddParameter("x", clsRFunctionParameter:=clsConvertToDegreeFunction, iPosition:=0) clsRoundFunction.AddParameter("digits", 3, iPosition:=1) + clsYearConversionFunction.SetRCommand("convert_yy_to_yyyy") + clsYearConversionFunction.AddParameter("base", "2030", iPosition:=1) + clsPrecipitationFunction.SetAssignTo(ucrSaveConversions.GetText, strTempDataframe:=ucrSelectorConversions.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:=ucrSaveConversions.GetText, bAssignToIsPrefix:=True) ucrBase.clsRsyntax.SetBaseRFunction(clsPrecipitationFunction) End Sub @@ -249,6 +270,7 @@ Public Class dlgConversions ucrSaveConversions.AddAdditionalRCode(clsTemperatureFunction, iAdditionalPairNo:=1) ucrSaveConversions.AddAdditionalRCode(clsWindSpeedFunction, iAdditionalPairNo:=2) ucrSaveConversions.AddAdditionalRCode(clsDayLengthFunction, iAdditionalPairNo:=3) + ucrSaveConversions.AddAdditionalRCode(clsYearConversionFunction, iAdditionalPairNo:=4) ucrReceiverElement.SetRCode(clsPrecipitationFunction, bReset) ucrInputFromPrecipitation.SetRCode(clsPrecipitationFunction, bReset) @@ -262,6 +284,8 @@ Public Class dlgConversions ucrSaveConversions.SetRCode(clsPrecipitationFunction, bReset) ucrSaveColumn.SetRCode(clsRoundFunction, bReset) ucrInputDirection.SetRCode(clsConvertToDegreeFunction, bReset) + ucrReceiverYear.SetRCode(clsYearConversionFunction, bReset) + ucrNudBaseYear.SetRCode(clsYearConversionFunction, bReset) If bReset Then ucrPnlConversions.SetRCode(clsPrecipitationFunction, bReset) @@ -271,12 +295,12 @@ Public Class dlgConversions End Sub Private Sub TestOkEnabled() - If rdoUnits.Checked AndAlso Not ucrReceiverElement.IsEmpty AndAlso ucrNudDecimal.GetText <> "" AndAlso ucrSaveConversions.IsComplete Then - If rdoRain.Checked AndAlso ucrInputFromPrecipitation.GetText <> ucrInputToPrecipitation.GetText Then + If rdoUnits.Checked AndAlso Not ucrReceiverElement.IsEmpty AndAlso ucrSaveConversions.IsComplete Then + If rdoRain.Checked AndAlso ucrNudDecimal.GetText <> "" AndAlso ucrInputFromPrecipitation.GetText <> ucrInputToPrecipitation.GetText Then ucrBase.OKEnabled(True) - ElseIf rdoTemperature.Checked AndAlso ucrInputFromTemperature.GetText <> ucrInputToTemperature.GetText Then + ElseIf rdoTemperature.Checked AndAlso ucrNudDecimal.GetText <> "" AndAlso ucrInputFromTemperature.GetText <> ucrInputToTemperature.GetText Then ucrBase.OKEnabled(True) - ElseIf rdoWindSpeed.Checked AndAlso ucrInputFromWindSpeed.GetText <> ucrInputToWindSpeed.GetText Then + ElseIf rdoWindSpeed.Checked AndAlso ucrNudDecimal.GetText <> "" AndAlso ucrInputFromWindSpeed.GetText <> ucrInputToWindSpeed.GetText Then ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) @@ -291,6 +315,8 @@ Public Class dlgConversions Else ucrBase.OKEnabled(False) End If + ElseIf rdoYear.Checked AndAlso Not ucrReceiverYear.IsEmpty AndAlso ucrNudBaseYear.GetText <> "" AndAlso ucrSaveConversions.IsComplete Then + ucrBase.OKEnabled(True) Else ucrBase.OKEnabled(False) End If @@ -325,7 +351,6 @@ Public Class dlgConversions End Sub Private Sub ucrPnlConversions_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlConversions.ControlValueChanged - If rdoDayLength.Checked Then ucrBase.clsRsyntax.SetBaseRFunction(clsDayLengthFunction) ucrBase.clsRsyntax.iCallType = 0 @@ -341,6 +366,12 @@ Public Class dlgConversions ucrBase.clsRsyntax.SetBaseRFunction(clsRoundFunction) ucrReceiverDegrees.SetMeAsReceiver() ChangeParameter() + ElseIf rdoYear.Checked Then + ucrBase.clsRsyntax.SetBaseRFunction(clsYearConversionFunction) + ucrReceiverYear.SetMeAsReceiver() + ucrSaveConversions.SetPrefix("conversion") + ucrSaveConversions.setLinkedReceiver(ucrReceiverYear) + ucrReceiverYear.strSelectorHeading = "Numerics" End If ChangeLatParameter() End Sub @@ -439,7 +470,14 @@ Public Class dlgConversions ChangeLatParameter() End Sub - Private Sub ucrPnlConversions_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlConversions.ControlContentsChanged, ucrReceiverElement.ControlContentsChanged, ucrReceiverDate.ControlContentsChanged, ucrNudDecimal.ControlContentsChanged, ucrPnlLatitude.ControlContentsChanged, ucrInputLatitude.ControlContentsChanged, ucrReceiverLatitude.ControlContentsChanged, ucrInputFromPrecipitation.ControlContentsChanged, ucrInputToPrecipitation.ControlContentsChanged, ucrInputFromTemperature.ControlContentsChanged, ucrInputToTemperature.ControlContentsChanged, ucrInputFromWindSpeed.ControlContentsChanged, ucrInputToWindSpeed.ControlContentsChanged, ucrPnlElements.ControlContentsChanged, ucrReceiverDegrees.ControlContentsChanged, ucrChkVariable.ControlContentsChanged, ucrInputDegree.ControlContentsChanged, ucrSaveConversions.ControlContentsChanged + Private Sub ucrPnlConversions_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrPnlConversions.ControlContentsChanged, + ucrReceiverElement.ControlContentsChanged, ucrReceiverDate.ControlContentsChanged, ucrNudDecimal.ControlContentsChanged, + ucrPnlLatitude.ControlContentsChanged, ucrInputLatitude.ControlContentsChanged, ucrReceiverLatitude.ControlContentsChanged, + ucrInputFromPrecipitation.ControlContentsChanged, ucrInputToPrecipitation.ControlContentsChanged, ucrInputFromTemperature.ControlContentsChanged, + ucrInputToTemperature.ControlContentsChanged, ucrInputFromWindSpeed.ControlContentsChanged, ucrInputToWindSpeed.ControlContentsChanged, + ucrPnlElements.ControlContentsChanged, ucrReceiverDegrees.ControlContentsChanged, ucrChkVariable.ControlContentsChanged, + ucrInputDegree.ControlContentsChanged, ucrSaveConversions.ControlContentsChanged, ucrReceiverYear.ControlContentsChanged, + ucrNudBaseYear.ControlContentsChanged TestOkEnabled() End Sub End Class \ No newline at end of file diff --git a/instat/dlgDuplicates.Designer.vb b/instat/dlgDuplicates.Designer.vb index 610adfca7ec..360c1cb81b7 100644 --- a/instat/dlgDuplicates.Designer.vb +++ b/instat/dlgDuplicates.Designer.vb @@ -59,7 +59,7 @@ Partial Class dlgDuplicateRows Me.rdoDataFrame.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoDataFrame.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoDataFrame.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoDataFrame.Location = New System.Drawing.Point(11, 12) + Me.rdoDataFrame.Location = New System.Drawing.Point(142, 12) Me.rdoDataFrame.Name = "rdoDataFrame" Me.rdoDataFrame.Size = New System.Drawing.Size(135, 27) Me.rdoDataFrame.TabIndex = 1 @@ -76,7 +76,7 @@ Partial Class dlgDuplicateRows Me.rdoSelectedVariables.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption Me.rdoSelectedVariables.FlatStyle = System.Windows.Forms.FlatStyle.Flat Me.rdoSelectedVariables.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoSelectedVariables.Location = New System.Drawing.Point(144, 12) + Me.rdoSelectedVariables.Location = New System.Drawing.Point(11, 12) Me.rdoSelectedVariables.Name = "rdoSelectedVariables" Me.rdoSelectedVariables.Size = New System.Drawing.Size(135, 27) Me.rdoSelectedVariables.TabIndex = 2 diff --git a/instat/dlgDuplicates.vb b/instat/dlgDuplicates.vb index 09874ab387e..cce88ba4679 100644 --- a/instat/dlgDuplicates.vb +++ b/instat/dlgDuplicates.vb @@ -58,7 +58,7 @@ Public Class dlgDuplicateRows ucrPnlDuplicates.AddRadioButton(rdoDuplicatesOnly) ucrPnlDuplicates.AddRadioButton(rdoIndexNumberOfDuplicates) - ucrPnlDuplicates.AddToLinkedControls(ucrInputComboType, {rdoIndexNumberOfDuplicates}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) + ucrPnlDuplicates.AddToLinkedControls(ucrInputComboType, {rdoIndexNumberOfDuplicates}, bNewLinkedHideIfParameterMissing:=True) ucrInputComboType.SetLinkedDisplayControl(lblType) ucrPnlDuplicates.AddFunctionNamesCondition(rdoAllDuplicateCases, "duplicated2") @@ -114,9 +114,8 @@ Public Class dlgDuplicateRows ucrInputConditions.SetDropDownStyleAsNonEditable() ucrInputComboType.SetParameter(New RParameter("type")) - dctType.Add("Count", Chr(34) & "count" & Chr(34)) dctType.Add("Index", Chr(34) & "index" & Chr(34)) - ucrInputComboType.SetRDefault(Chr(34) & "count" & Chr(34)) + dctType.Add("Count", Chr(34) & "count" & Chr(34)) ucrInputComboType.SetDropDownStyleAsNonEditable() ucrInputComboType.SetItems(dctType) @@ -156,6 +155,7 @@ Public Class dlgDuplicateRows clsStreakFunction.AddParameter("ignore", "NULL") clsDupCountIndex.SetRCommand("duplicated_count_index") + clsDupCountIndex.AddParameter("type", Chr(34) & "index" & Chr(34)) clsGetColumnsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") @@ -166,7 +166,7 @@ Public Class dlgDuplicateRows clsSubsetCol.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$get_columns_from_data") ucrBase.clsRsyntax.ClearCodes() ucrBase.clsRsyntax.SetAssignTo(strAssignToName:=ucrNewColumnName.GetText, strTempDataframe:=ucrSelectorDuplicateswithVariables.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempColumn:=ucrNewColumnName.GetText) - ucrBase.clsRsyntax.SetBaseRFunction(clsDuplicated2) + ucrBase.clsRsyntax.SetBaseRFunction(clsDuplicated) ucrBase.clsRsyntax.AddToAfterCodes(clsSummaryFunction, iPosition:=0) End Sub @@ -251,17 +251,15 @@ Public Class dlgDuplicateRows End Sub Private Sub SetDataFrameOrColumns() - If rdoDataFrame.Checked Then - ucrSelectorDuplicateswithVariables.SetVariablesVisible(False) - ucrSelectorDuplicateswithVariables.SetParameterIsrfunction() + If rdoSelectedVariables.Checked Then + ucrReceiverForSelectedVariables.SetMeAsReceiver() + ucrReceiverForSelectedVariables.SetParameterIsRFunction() + ucrSelectorDuplicateswithVariables.SetVariablesVisible(True) + ElseIf rdoDataFrame.Checked Then ' note that we have to run this here because the parameter x is used for both functions and all four radio buttons clsDuplicated.AddParameter("x", clsRFunctionParameter:=ucrSelectorDuplicateswithVariables.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) clsDuplicated2.AddParameter("x", clsRFunctionParameter:=ucrSelectorDuplicateswithVariables.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) clsDupCountIndex.AddParameter("x", clsRFunctionParameter:=ucrSelectorDuplicateswithVariables.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) - ElseIf rdoSelectedVariables.Checked Then - ucrReceiverForSelectedVariables.SetMeAsReceiver() - ucrReceiverForSelectedVariables.SetParameterIsRFunction() - ucrSelectorDuplicateswithVariables.SetVariablesVisible(True) ElseIf rdoSuccessiveValues.Checked Then ucrReceiverForSuccessiveValues.SetMeAsReceiver() ucrSelectorDuplicateswithVariables.SetParameterIsString() diff --git a/instat/dlgImportDataset.vb b/instat/dlgImportDataset.vb index cbdad83fd04..74bbec05691 100644 --- a/instat/dlgImportDataset.vb +++ b/instat/dlgImportDataset.vb @@ -928,7 +928,10 @@ Public Class dlgImportDataset HideDropEmptyCheckBox() End Sub - Private Sub MissingValuesInputControls_ContentsChanged() Handles ucrInputMissingValueStringText.ContentsChanged, ucrInputMissingValueStringCSV.ContentsChanged, ucrInputMissingValueStringExcel.ContentsChanged + Private Sub MissingValuesInputControls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputMissingValueStringText.ControlContentsChanged, ucrInputMissingValueStringCSV.ControlContentsChanged, ucrInputMissingValueStringExcel.ControlContentsChanged + 'todo. as of 11/04/2022, control rasing the event is passed in as the event parameter. + 'Refactor code to use control checks for updating the below R parameter? + 'currently we have no way of knowing which control has raised this event and therefore can't do that check 'so instead we are using the strFileType to identify which RFunctions should be updated accordingly If IsExcelFileFormat() Then diff --git a/instat/dlgMerge.vb b/instat/dlgMerge.vb index 7ccc9644abf..a93fdeafbb1 100644 --- a/instat/dlgMerge.vb +++ b/instat/dlgMerge.vb @@ -19,14 +19,14 @@ Imports instat.Translations Public Class dlgMerge Private bFirstLoad As Boolean = True - Private clsMerge As RFunction - Private clsByList As RFunction + Private clsMergeFunction As New RFunction + Private clsByListFunction As New RFunction Private bReset As Boolean = True Private bResetSubdialog As Boolean = True Private ttJoinType As New ToolTip Private dctJoinTexts As New Dictionary(Of String, String) Private bMergeColumnsExist As Boolean - Private clsSuffixC As RFunction + Private clsSuffixCFunction As New RFunction ' This dialog has a bug when using numeric and integer columns as the joining columns. ' Issue reported here: https://github.com/hadley/dplyr/issues/2164 @@ -96,28 +96,28 @@ Public Class dlgMerge End Sub Private Sub SetDefaults() - clsMerge = New RFunction - clsByList = New RFunction - clsSuffixC = New RFunction + clsMergeFunction = New RFunction + clsByListFunction = New RFunction + clsSuffixCFunction = New RFunction ucrFirstDataFrame.Reset() ucrSecondDataFrame.Reset() ucrSaveMerge.Reset() - clsMerge.SetPackageName("dplyr") - clsMerge.SetRCommand("full_join") - clsByList.SetRCommand("c") - clsSuffixC.SetRCommand("c") + clsMergeFunction.SetPackageName("dplyr") + clsMergeFunction.SetRCommand("full_join") + clsByListFunction.SetRCommand("c") + clsSuffixCFunction.SetRCommand("c") - ucrBase.clsRsyntax.SetBaseRFunction(clsMerge) + ucrBase.clsRsyntax.SetBaseRFunction(clsMergeFunction) bResetSubdialog = True End Sub Private Sub SetRCodeForControls(bResetControls As Boolean) - ucrFirstDataFrame.SetRCode(clsMerge, bResetControls) - ucrSecondDataFrame.SetRCode(clsMerge, bResetControls) - ucrInputJoinType.SetRCode(clsMerge, bResetControls) - ucrSaveMerge.SetRCode(clsMerge, bResetControls) + ucrFirstDataFrame.SetRCode(clsMergeFunction, bResetControls) + ucrSecondDataFrame.SetRCode(clsMergeFunction, bResetControls) + ucrInputJoinType.SetRCode(clsMergeFunction, bResetControls) + ucrSaveMerge.SetRCode(clsMergeFunction, bResetControls) End Sub Private Sub TestOKEnabled() @@ -135,14 +135,14 @@ Public Class dlgMerge End Sub Private Sub cmdJoinOptions_Click(sender As Object, e As EventArgs) Handles cmdJoinOptions.Click - sdgMerge.Setup(ucrFirstDataFrame.cboAvailableDataFrames.Text, ucrSecondDataFrame.cboAvailableDataFrames.Text, clsMerge, clsByList, bResetSubdialog) + sdgMerge.Setup(ucrFirstDataFrame.cboAvailableDataFrames.Text, ucrSecondDataFrame.cboAvailableDataFrames.Text, clsMergeFunction, clsByListFunction, bResetSubdialog) sdgMerge.ShowDialog() bResetSubdialog = False SetMergingBy() End Sub Private Sub cmdColumnOptions_Click(sender As Object, e As EventArgs) Handles cmdColumnOptions.Click - sdgMergeColumnstoInclude.Setup(ucrFirstDataFrame.cboAvailableDataFrames.Text, ucrSecondDataFrame.cboAvailableDataFrames.Text, clsMerge, clsByList, bResetSubdialog) + sdgMergeColumnstoInclude.Setup(ucrFirstDataFrame.cboAvailableDataFrames.Text, ucrSecondDataFrame.cboAvailableDataFrames.Text, clsMergeFunction, clsByListFunction, bResetSubdialog) sdgMergeColumnstoInclude.ShowDialog() bResetSubdialog = False SetMergingBy() @@ -154,17 +154,17 @@ Public Class dlgMerge If Not ucrInputJoinType.IsEmpty() Then Select Case ucrInputJoinType.GetText() Case "Full Join" - clsMerge.SetRCommand("full_join") + clsMergeFunction.SetRCommand("full_join") Case "Left Join" - clsMerge.SetRCommand("left_join") + clsMergeFunction.SetRCommand("left_join") Case "Right Join" - clsMerge.SetRCommand("right_join") + clsMergeFunction.SetRCommand("right_join") Case "Inner Join" - clsMerge.SetRCommand("inner_join") + clsMergeFunction.SetRCommand("inner_join") Case "Semi Join" - clsMerge.SetRCommand("semi_join") + clsMergeFunction.SetRCommand("semi_join") Case "Anti Join" - clsMerge.SetRCommand("anti_join") + clsMergeFunction.SetRCommand("anti_join") Case Else bFound = False End Select @@ -179,16 +179,16 @@ Public Class dlgMerge Private Sub DataFrames_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrFirstDataFrame.ControlValueChanged, ucrSecondDataFrame.ControlValueChanged If ucrFirstDataFrame.cboAvailableDataFrames.Text <> "" AndAlso ucrSecondDataFrame.cboAvailableDataFrames.Text <> "" Then - clsSuffixC.AddParameter("0", strParameterValue:=Chr(34) & ucrFirstDataFrame.cboAvailableDataFrames.Text & Chr(34), iPosition:=0, bIncludeArgumentName:=False) - clsSuffixC.AddParameter("1", strParameterValue:=Chr(34) & ucrSecondDataFrame.cboAvailableDataFrames.Text & Chr(34), iPosition:=1, bIncludeArgumentName:=False) + clsSuffixCFunction.AddParameter("0", strParameterValue:=Chr(34) & ucrFirstDataFrame.cboAvailableDataFrames.Text & Chr(34), iPosition:=0, bIncludeArgumentName:=False) + clsSuffixCFunction.AddParameter("1", strParameterValue:=Chr(34) & ucrSecondDataFrame.cboAvailableDataFrames.Text & Chr(34), iPosition:=1, bIncludeArgumentName:=False) Else - clsMerge.RemoveParameterByName("suffix") + clsMergeFunction.RemoveParameterByName("suffix") End If ' Ensures options set on the subdialog are "reset" since they depend on data frame choice - clsMerge.RemoveParameterByName("by") - clsByList.ClearParameters() - clsMerge.AddParameter("x", clsRFunctionParameter:=ucrFirstDataFrame.clsCurrDataFrame, iPosition:=0) - clsMerge.AddParameter("y", clsRFunctionParameter:=ucrSecondDataFrame.clsCurrDataFrame, iPosition:=1) + clsMergeFunction.RemoveParameterByName("by") + clsByListFunction.ClearParameters() + clsMergeFunction.AddParameter("x", clsRFunctionParameter:=ucrFirstDataFrame.clsCurrDataFrame, iPosition:=0) + clsMergeFunction.AddParameter("y", clsRFunctionParameter:=ucrSecondDataFrame.clsCurrDataFrame, iPosition:=1) SetMergingBy() End Sub @@ -204,8 +204,8 @@ Public Class dlgMerge Dim i As Integer = 0 If ucrFirstDataFrame.cboAvailableDataFrames.Text <> "" AndAlso ucrSecondDataFrame.cboAvailableDataFrames.Text <> "" Then - If clsMerge.ContainsParameter("by") Then - For Each clsTempParam As RParameter In clsByList.clsParameters + If clsMergeFunction.ContainsParameter("by") Then + For Each clsTempParam As RParameter In clsByListFunction.clsParameters dctJoinColumns.Add(clsTempParam.strArgumentName.Trim(Chr(34)), clsTempParam.strArgumentValue.Trim(Chr(34))) Next Else @@ -215,12 +215,12 @@ Public Class dlgMerge For Each strFirst As String In lstFirstColumns If lstSecondColumns.Contains(strFirst) Then dctJoinColumns.Add(strFirst, strFirst) - clsByList.AddParameter(Chr(34) & strFirst & Chr(34), Chr(34) & strFirst & Chr(34), iPosition:=i) + clsByListFunction.AddParameter(Chr(34) & strFirst & Chr(34), Chr(34) & strFirst & Chr(34), iPosition:=i) i = i + 1 End If Next - If clsByList.iParameterCount > 0 Then - clsMerge.AddParameter("by", clsRFunctionParameter:=clsByList, iPosition:=2) + If clsByListFunction.iParameterCount > 0 Then + clsMergeFunction.AddParameter("by", clsRFunctionParameter:=clsByListFunction, iPosition:=2) End If End If If dctJoinColumns.Count > 0 Then @@ -239,8 +239,8 @@ Public Class dlgMerge Else ucrInputMergingBy.SetName("") ucrInputMergingBy.txtInput.BackColor = SystemColors.Control - clsMerge.RemoveParameterByName("by") - clsByList.ClearParameters() + clsMergeFunction.RemoveParameterByName("by") + clsByListFunction.ClearParameters() End If bMergeColumnsExist = (dctJoinColumns.Count > 0) TestOKEnabled() diff --git a/instat/dlgMergeAdditionalData.vb b/instat/dlgMergeAdditionalData.vb index 610ad7becc7..73d7a235abb 100644 --- a/instat/dlgMergeAdditionalData.vb +++ b/instat/dlgMergeAdditionalData.vb @@ -279,6 +279,7 @@ Public Class dlgMergeAdditionalData Private Sub ucrInputMergingBy_TextChanged(sender As Object, e As EventArgs) Handles ucrInputMergingBy.TextChanged AddColumns() CheckUnique() + SetDataFrameAssign() SetInputCheckVisibility(False) End Sub diff --git a/instat/dlgNewDataFrame.vb b/instat/dlgNewDataFrame.vb index 2fcf5eaa950..de596bd1d5a 100644 --- a/instat/dlgNewDataFrame.vb +++ b/instat/dlgNewDataFrame.vb @@ -291,7 +291,7 @@ Public Class dlgNewDataFrame autoTranslate(Me) End Sub - Private Sub ucrInputCommand_ContentsChanged() Handles ucrInputCommand.ContentsChanged + Private Sub ucrInputCommand_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputCommand.ControlContentsChanged ucrTryNewDataFrame.ClearTryText() ucrBase.clsRsyntax.SetCommandString(ucrInputCommand.GetText()) TestOKEnabled() diff --git a/instat/dlgPopulationPyramids.Designer.vb b/instat/dlgPopulationPyramids.Designer.vb deleted file mode 100644 index bbe227cb5c3..00000000000 --- a/instat/dlgPopulationPyramids.Designer.vb +++ /dev/null @@ -1,183 +0,0 @@ -' R- Instat -' Copyright (C) 2015-2017 -' -' This program is free software: you can redistribute it and/or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, or -' (at your option) any later version. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU General Public License for more details. -' -' You should have received a copy of the GNU General Public License -' along with this program. If not, see . - - -Partial Class dlgPopulationPyramids - Inherits System.Windows.Forms.Form - - 'Form overrides dispose to clean up the component list. - _ - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - 'NOTE: The following procedure is required by the Windows Form Designer - 'It can be modified using the Windows Form Designer. - 'Do not modify it using the code editor. - _ - Private Sub InitializeComponent() - Me.ucrBase = New instat.ucrButtons() - Me.ucrPopulationPyramidselector = New instat.ucrSelectorByDataFrameAddRemove() - Me.lblXVariable = New System.Windows.Forms.Label() - Me.ucrXVariableReceiver = New instat.ucrReceiverSingle() - Me.lblYVariable = New System.Windows.Forms.Label() - Me.ucrYVariableReceiver = New instat.ucrReceiverSingle() - Me.lblSecondFactor = New System.Windows.Forms.Label() - Me.ucrSecondFactorReceiver = New instat.ucrReceiverSingle() - Me.ucrSavePopulationPyramid = New instat.ucrSaveGraph() - Me.SuspendLayout() - ' - 'ucrBase - ' - Me.ucrBase.AutoSize = True - Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 244) - Me.ucrBase.Name = "ucrBase" - Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 0 - ' - 'ucrPopulationPyramidselector - ' - Me.ucrPopulationPyramidselector.AutoSize = True - Me.ucrPopulationPyramidselector.bDropUnusedFilterLevels = False - Me.ucrPopulationPyramidselector.bShowHiddenColumns = False - Me.ucrPopulationPyramidselector.bUseCurrentFilter = True - Me.ucrPopulationPyramidselector.Location = New System.Drawing.Point(10, 10) - Me.ucrPopulationPyramidselector.Margin = New System.Windows.Forms.Padding(0) - Me.ucrPopulationPyramidselector.Name = "ucrPopulationPyramidselector" - Me.ucrPopulationPyramidselector.Size = New System.Drawing.Size(213, 183) - Me.ucrPopulationPyramidselector.TabIndex = 1 - ' - 'lblXVariable - ' - Me.lblXVariable.AutoSize = True - Me.lblXVariable.Location = New System.Drawing.Point(255, 25) - Me.lblXVariable.Name = "lblXVariable" - Me.lblXVariable.Size = New System.Drawing.Size(55, 13) - Me.lblXVariable.TabIndex = 2 - Me.lblXVariable.Text = "X Variable" - ' - 'ucrXVariableReceiver - ' - Me.ucrXVariableReceiver.AutoSize = True - Me.ucrXVariableReceiver.frmParent = Me - Me.ucrXVariableReceiver.Location = New System.Drawing.Point(258, 42) - Me.ucrXVariableReceiver.Margin = New System.Windows.Forms.Padding(0) - Me.ucrXVariableReceiver.Name = "ucrXVariableReceiver" - Me.ucrXVariableReceiver.Selector = Nothing - Me.ucrXVariableReceiver.Size = New System.Drawing.Size(120, 20) - Me.ucrXVariableReceiver.strNcFilePath = "" - Me.ucrXVariableReceiver.TabIndex = 3 - Me.ucrXVariableReceiver.ucrSelector = Nothing - ' - 'lblYVariable - ' - Me.lblYVariable.AutoSize = True - Me.lblYVariable.Location = New System.Drawing.Point(255, 76) - Me.lblYVariable.Name = "lblYVariable" - Me.lblYVariable.Size = New System.Drawing.Size(55, 13) - Me.lblYVariable.TabIndex = 2 - Me.lblYVariable.Text = "Y Variable" - ' - 'ucrYVariableReceiver - ' - Me.ucrYVariableReceiver.AutoSize = True - Me.ucrYVariableReceiver.frmParent = Me - Me.ucrYVariableReceiver.Location = New System.Drawing.Point(258, 92) - Me.ucrYVariableReceiver.Margin = New System.Windows.Forms.Padding(0) - Me.ucrYVariableReceiver.Name = "ucrYVariableReceiver" - Me.ucrYVariableReceiver.Selector = Nothing - Me.ucrYVariableReceiver.Size = New System.Drawing.Size(120, 20) - Me.ucrYVariableReceiver.strNcFilePath = "" - Me.ucrYVariableReceiver.TabIndex = 3 - Me.ucrYVariableReceiver.ucrSelector = Nothing - ' - 'lblSecondFactor - ' - Me.lblSecondFactor.AutoSize = True - Me.lblSecondFactor.Location = New System.Drawing.Point(255, 125) - Me.lblSecondFactor.Name = "lblSecondFactor" - Me.lblSecondFactor.Size = New System.Drawing.Size(77, 13) - Me.lblSecondFactor.TabIndex = 2 - Me.lblSecondFactor.Text = "Second Factor" - ' - 'ucrSecondFactorReceiver - ' - Me.ucrSecondFactorReceiver.AutoSize = True - Me.ucrSecondFactorReceiver.frmParent = Me - Me.ucrSecondFactorReceiver.Location = New System.Drawing.Point(258, 142) - Me.ucrSecondFactorReceiver.Margin = New System.Windows.Forms.Padding(0) - Me.ucrSecondFactorReceiver.Name = "ucrSecondFactorReceiver" - Me.ucrSecondFactorReceiver.Selector = Nothing - Me.ucrSecondFactorReceiver.Size = New System.Drawing.Size(120, 20) - Me.ucrSecondFactorReceiver.strNcFilePath = "" - Me.ucrSecondFactorReceiver.TabIndex = 3 - Me.ucrSecondFactorReceiver.ucrSelector = Nothing - ' - 'ucrSavePopulationPyramid - ' - Me.ucrSavePopulationPyramid.AutoSize = True - Me.ucrSavePopulationPyramid.Location = New System.Drawing.Point(10, 209) - Me.ucrSavePopulationPyramid.Name = "ucrSavePopulationPyramid" - Me.ucrSavePopulationPyramid.Size = New System.Drawing.Size(265, 23) - Me.ucrSavePopulationPyramid.TabIndex = 4 - ' - 'dlgPopulationPyramids - ' - 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(421, 298) - Me.Controls.Add(Me.ucrSavePopulationPyramid) - Me.Controls.Add(Me.ucrSecondFactorReceiver) - Me.Controls.Add(Me.lblSecondFactor) - Me.Controls.Add(Me.ucrYVariableReceiver) - Me.Controls.Add(Me.lblYVariable) - Me.Controls.Add(Me.ucrXVariableReceiver) - Me.Controls.Add(Me.lblXVariable) - Me.Controls.Add(Me.ucrPopulationPyramidselector) - Me.Controls.Add(Me.ucrBase) - Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow - Me.MaximizeBox = False - Me.MinimizeBox = False - Me.Name = "dlgPopulationPyramids" - Me.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen - Me.Tag = "Population Pyramids" - Me.Text = "Population Pyramids" - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - - Friend WithEvents ucrBase As ucrButtons - Friend WithEvents ucrPopulationPyramidselector As ucrSelectorByDataFrameAddRemove - Friend WithEvents lblXVariable As Label - Friend WithEvents ucrXVariableReceiver As ucrReceiverSingle - Friend WithEvents lblYVariable As Label - Friend WithEvents ucrYVariableReceiver As ucrReceiverSingle - Friend WithEvents lblSecondFactor As Label - Friend WithEvents ucrSecondFactorReceiver As ucrReceiverSingle - Friend WithEvents ucrSavePopulationPyramid As ucrSaveGraph -End Class diff --git a/instat/dlgPopulationPyramids.resx b/instat/dlgPopulationPyramids.resx deleted file mode 100644 index 29dcb1b3a35..00000000000 --- a/instat/dlgPopulationPyramids.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/instat/dlgPopulationPyramids.sw-KE.resx b/instat/dlgPopulationPyramids.sw-KE.resx deleted file mode 100644 index a3df4f013d3..00000000000 --- a/instat/dlgPopulationPyramids.sw-KE.resx +++ /dev/null @@ -1,15 +0,0 @@ - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/instat/dlgPopulationPyramids.vb b/instat/dlgPopulationPyramids.vb deleted file mode 100644 index 529fa644e53..00000000000 --- a/instat/dlgPopulationPyramids.vb +++ /dev/null @@ -1,136 +0,0 @@ -' R- Instat -' Copyright (C) 2015-2017 -' -' This program is free software: you can redistribute it and/or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, or -' (at your option) any later version. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU General Public License for more details. -' -' You should have received a copy of the GNU General Public License -' along with this program. If not, see . - -Imports instat.Translations -Public Class dlgPopulationPyramids - Private clsRggplotFunction As New RFunction - Private clsRgeom_bar As New RFunction - Private clsRgeom_bar2 As New RFunction - Private clsRaesFunction As New RFunction - Private clsRgeom_CoordFlip As New RFunction - Private bFirstLoad As Boolean = True - Private Sub dlgPopulationPyramids_Load(sender As Object, e As EventArgs) Handles MyBase.Load - If bFirstLoad Then - InitialiseDialog() - SetDefaults() - bFirstLoad = False - Else - ReopenDialog() - - End If - autoTranslate(Me) - TestOkEnabled() - End Sub - - Private Sub InitialiseDialog() - ucrBase.iHelpTopicID = 455 - ucrBase.clsRsyntax.SetOperation("+") - - clsRggplotFunction.SetPackageName("ggplot") - clsRggplotFunction.SetRCommand("ggplot") - - clsRaesFunction.SetPackageName("ggplot") - clsRaesFunction.SetRCommand("aes") - clsRggplotFunction.AddParameter("mapping", clsRFunctionParameter:=clsRaesFunction) - ucrBase.clsRsyntax.SetOperatorParameter(True, clsRFunc:=clsRggplotFunction) - - clsRgeom_bar.SetPackageName("ggplot") - clsRgeom_bar.SetRCommand("geom_bar") - clsRgeom_bar.AddParameter("stat", Chr(34) & "identity" & Chr(34)) - ucrBase.clsRsyntax.SetOperatorParameter(False, clsRFunc:=clsRgeom_bar) - - clsRgeom_bar2.SetPackageName("ggplot") - clsRgeom_bar2.SetRCommand("geom_bar") - clsRgeom_bar2.AddParameter("stat", Chr(34) & "identity" & Chr(34)) - ucrBase.clsRsyntax.AddOperatorParameter("geom_bar", clsRFunc:=clsRgeom_bar) - - clsRgeom_CoordFlip.SetPackageName("ggplot") - clsRgeom_CoordFlip.SetRCommand("coord_flip") - ucrBase.clsRsyntax.AddOperatorParameter("coord_flip", "coord_flip") - - ucrBase.clsRsyntax.bExcludeAssignedFunctionOutput = False - - ucrXVariableReceiver.Selector = ucrPopulationPyramidselector - ucrYVariableReceiver.Selector = ucrPopulationPyramidselector - ucrSecondFactorReceiver.Selector = ucrPopulationPyramidselector - ucrBase.clsRsyntax.iCallType = 3 - - End Sub - - Private Sub SetDefaults() - ucrPopulationPyramidselector.Reset() - ucrXVariableReceiver.SetMeAsReceiver() - TestOkEnabled() - End Sub - - Private Sub ReopenDialog() - - End Sub - Private Sub TestOkEnabled() - If (ucrXVariableReceiver.IsEmpty AndAlso ucrYVariableReceiver.IsEmpty) Then - ucrBase.OKEnabled(False) - Else - ucrBase.OKEnabled(True) - End If - - End Sub - - Private Sub ucrBase_ClickReset(sender As Object, e As EventArgs) Handles ucrBase.ClickReset - SetDefaults() - End Sub - - Private Sub ucrPopulationPyramidselector_DataFrameChanged() Handles ucrPopulationPyramidselector.DataFrameChanged - clsRggplotFunction.AddParameter("data", clsRFunctionParameter:=ucrPopulationPyramidselector.ucrAvailableDataFrames.clsCurrDataFrame) - End Sub - Private Sub ucrXVariableReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrXVariableReceiver.SelectionChanged - If Not ucrXVariableReceiver.IsEmpty Then - clsRaesFunction.AddParameter("x", ucrXVariableReceiver.GetVariableNames(False)) - Else - clsRaesFunction.RemoveParameterByName("x") - End If - TestOkEnabled() - End Sub - - Private Sub ucrYVariableReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrYVariableReceiver.SelectionChanged - If Not ucrYVariableReceiver.IsEmpty Then - clsRaesFunction.AddParameter("y", ucrYVariableReceiver.GetVariableNames(False)) - Else - clsRaesFunction.RemoveParameterByName("y") - End If - TestOkEnabled() - End Sub - - Private Sub ucrSecondFactorReceiver_SelectionChanged(sender As Object, e As EventArgs) Handles ucrSecondFactorReceiver.SelectionChanged - If Not ucrSecondFactorReceiver.IsEmpty Then - clsRaesFunction.AddParameter("fill", ucrSecondFactorReceiver.GetVariableNames(False)) - Else - clsRaesFunction.RemoveParameterByName("fill") - End If - End Sub - - Private Sub ucrSavePopulationPyramid_ContentsChanged() Handles ucrSavePopulationPyramid.ContentsChanged - TestOkEnabled() - End Sub - - Private Sub ucrSavePopulationPyramid_GraphNameChanged() Handles ucrSavePopulationPyramid.GraphNameChanged, ucrSavePopulationPyramid.SaveGraphCheckedChanged - If ucrSavePopulationPyramid.bSaveGraph Then - ucrBase.clsRsyntax.SetAssignTo(ucrSavePopulationPyramid.strGraphName, strTempDataframe:=ucrPopulationPyramidselector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:=ucrSavePopulationPyramid.strGraphName) - Else - ucrBase.clsRsyntax.SetAssignTo("last_graph", strTempDataframe:=ucrPopulationPyramidselector.ucrAvailableDataFrames.cboAvailableDataFrames.Text, strTempGraph:="last_graph") - End If - TestOkEnabled() - End Sub -End Class \ No newline at end of file diff --git a/instat/dlgRowSummary.Designer.vb b/instat/dlgRowSummary.Designer.vb index 2d4a1a98787..2d8b2bbb43e 100644 --- a/instat/dlgRowSummary.Designer.vb +++ b/instat/dlgRowSummary.Designer.vb @@ -15,95 +15,131 @@ ' along with this program. If not, see . -Partial Class dlgRowSummary - Inherits System.Windows.Forms.Form - - 'Form overrides dispose to clean up the component list. +Partial Class dlgRowSummary + Inherits System.Windows.Forms.Form + + 'Form overrides dispose to clean up the component list. - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - 'NOTE: The following procedure is required by the Windows Form Designer - 'It can be modified using the Windows Form Designer. - 'Do not modify it using the code editor. + Protected Overrides Sub Dispose(ByVal disposing As Boolean) + Try + If disposing AndAlso components IsNot Nothing Then + components.Dispose() + End If + Finally + MyBase.Dispose(disposing) + End Try + End Sub + + 'Required by the Windows Form Designer + Private components As System.ComponentModel.IContainer + + 'NOTE: The following procedure is required by the Windows Form Designer + 'It can be modified using the Windows Form Designer. + 'Do not modify it using the code editor. - Private Sub InitializeComponent() - Me.lblSelected = New System.Windows.Forms.Label() - Me.cmdUserDefined = New System.Windows.Forms.Button() + Private Sub InitializeComponent() + Me.lblSelectedVariables = New System.Windows.Forms.Label() Me.grpStatistic = New System.Windows.Forms.GroupBox() + Me.lblTrim = New System.Windows.Forms.Label() + Me.rdoMore = New System.Windows.Forms.RadioButton() Me.rdoMinimum = New System.Windows.Forms.RadioButton() Me.rdoMaximum = New System.Windows.Forms.RadioButton() Me.rdoCount = New System.Windows.Forms.RadioButton() Me.rdoMean = New System.Windows.Forms.RadioButton() Me.rdoStandardDeviation = New System.Windows.Forms.RadioButton() - Me.rdoNumberofMissing = New System.Windows.Forms.RadioButton() + Me.rdoNumberMissing = New System.Windows.Forms.RadioButton() Me.rdoMedian = New System.Windows.Forms.RadioButton() Me.rdoSum = New System.Windows.Forms.RadioButton() - Me.ucrPanelStatistics = New instat.UcrPanel() + Me.lblProp = New System.Windows.Forms.Label() + Me.ucrInputUserDefined = New instat.ucrInputComboBox() + Me.ucrNudProp = New instat.ucrNud() + Me.ucrNudTrim = New instat.ucrNud() + Me.ucrPnlStatistics = New instat.UcrPanel() + Me.grpMultipleRowSummary = New System.Windows.Forms.GroupBox() + Me.ucrInputTiesMethod = New instat.ucrInputComboBox() + Me.ucrInputType = New instat.ucrInputComboBox() + Me.ucrChkType = New instat.ucrCheck() + Me.ucrChkTiesMethod = New instat.ucrCheck() + Me.ucrInputProbability = New instat.ucrInputComboBox() + Me.rdoRowRanks = New System.Windows.Forms.RadioButton() + Me.rdoRowQuantile = New System.Windows.Forms.RadioButton() + Me.rdoRowRange = New System.Windows.Forms.RadioButton() + Me.ucrPnlMultipleRowSummary = New instat.UcrPanel() + Me.rdoSingle = New System.Windows.Forms.RadioButton() + Me.rdoMultiple = New System.Windows.Forms.RadioButton() Me.ucrChkIgnoreMissingValues = New instat.ucrCheck() - Me.ucrSaveResults = New instat.ucrSave() Me.ucrSelectorForRowSummaries = New instat.ucrSelectorByDataFrameAddRemove() Me.ucrReceiverForRowSummaries = New instat.ucrReceiverMultiple() Me.ucrBase = New instat.ucrButtons() + Me.ucrPnlRowSummaries = New instat.UcrPanel() + Me.ucrSaveNewDataFrame = New instat.ucrSave() Me.grpStatistic.SuspendLayout() + Me.grpMultipleRowSummary.SuspendLayout() Me.SuspendLayout() ' - 'lblSelected - ' - Me.lblSelected.AutoSize = True - Me.lblSelected.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.lblSelected.Location = New System.Drawing.Point(250, 45) - Me.lblSelected.Name = "lblSelected" - Me.lblSelected.Size = New System.Drawing.Size(53, 13) - Me.lblSelected.TabIndex = 1 - Me.lblSelected.Tag = "Rows_to_Summarise:" - Me.lblSelected.Text = "Variables:" - ' - 'cmdUserDefined + 'lblSelectedVariables ' - Me.cmdUserDefined.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.cmdUserDefined.Location = New System.Drawing.Point(308, 271) - Me.cmdUserDefined.Name = "cmdUserDefined" - Me.cmdUserDefined.Size = New System.Drawing.Size(100, 23) - Me.cmdUserDefined.TabIndex = 6 - Me.cmdUserDefined.Tag = "User_Define" - Me.cmdUserDefined.Text = "User Define" - Me.cmdUserDefined.UseVisualStyleBackColor = True + Me.lblSelectedVariables.AutoSize = True + Me.lblSelectedVariables.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.lblSelectedVariables.Location = New System.Drawing.Point(276, 73) + Me.lblSelectedVariables.Name = "lblSelectedVariables" + Me.lblSelectedVariables.Size = New System.Drawing.Size(98, 13) + Me.lblSelectedVariables.TabIndex = 5 + Me.lblSelectedVariables.Tag = "Selected_Variables" + Me.lblSelectedVariables.Text = "Selected Variables:" ' 'grpStatistic ' + Me.grpStatistic.Controls.Add(Me.lblTrim) + Me.grpStatistic.Controls.Add(Me.rdoMore) Me.grpStatistic.Controls.Add(Me.rdoMinimum) Me.grpStatistic.Controls.Add(Me.rdoMaximum) Me.grpStatistic.Controls.Add(Me.rdoCount) Me.grpStatistic.Controls.Add(Me.rdoMean) Me.grpStatistic.Controls.Add(Me.rdoStandardDeviation) - Me.grpStatistic.Controls.Add(Me.rdoNumberofMissing) + Me.grpStatistic.Controls.Add(Me.rdoNumberMissing) Me.grpStatistic.Controls.Add(Me.rdoMedian) Me.grpStatistic.Controls.Add(Me.rdoSum) - Me.grpStatistic.Controls.Add(Me.ucrPanelStatistics) - Me.grpStatistic.Location = New System.Drawing.Point(10, 195) + Me.grpStatistic.Controls.Add(Me.lblProp) + Me.grpStatistic.Controls.Add(Me.ucrInputUserDefined) + Me.grpStatistic.Controls.Add(Me.ucrNudProp) + Me.grpStatistic.Controls.Add(Me.ucrNudTrim) + Me.grpStatistic.Controls.Add(Me.ucrPnlStatistics) + Me.grpStatistic.Location = New System.Drawing.Point(10, 238) Me.grpStatistic.Name = "grpStatistic" - Me.grpStatistic.Size = New System.Drawing.Size(398, 70) - Me.grpStatistic.TabIndex = 4 + Me.grpStatistic.Size = New System.Drawing.Size(435, 88) + Me.grpStatistic.TabIndex = 8 Me.grpStatistic.TabStop = False Me.grpStatistic.Tag = "Statistic" Me.grpStatistic.Text = "Row Statistic" ' + 'lblTrim + ' + Me.lblTrim.AutoSize = True + Me.lblTrim.Location = New System.Drawing.Point(353, 66) + Me.lblTrim.Name = "lblTrim" + Me.lblTrim.Size = New System.Drawing.Size(30, 13) + Me.lblTrim.TabIndex = 15 + Me.lblTrim.Text = "Trim:" + ' + 'rdoMore + ' + Me.rdoMore.AutoSize = True + Me.rdoMore.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoMore.Location = New System.Drawing.Point(198, 63) + Me.rdoMore.Name = "rdoMore" + Me.rdoMore.Size = New System.Drawing.Size(49, 17) + Me.rdoMore.TabIndex = 9 + Me.rdoMore.TabStop = True + Me.rdoMore.Tag = "More" + Me.rdoMore.Text = "More" + Me.rdoMore.UseVisualStyleBackColor = True + ' 'rdoMinimum ' Me.rdoMinimum.AutoSize = True Me.rdoMinimum.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoMinimum.Location = New System.Drawing.Point(327, 19) + Me.rdoMinimum.Location = New System.Drawing.Point(6, 42) Me.rdoMinimum.Name = "rdoMinimum" Me.rdoMinimum.Size = New System.Drawing.Size(66, 17) Me.rdoMinimum.TabIndex = 7 @@ -116,7 +152,7 @@ Partial Class dlgRowSummary ' Me.rdoMaximum.AutoSize = True Me.rdoMaximum.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoMaximum.Location = New System.Drawing.Point(327, 42) + Me.rdoMaximum.Location = New System.Drawing.Point(91, 42) Me.rdoMaximum.Name = "rdoMaximum" Me.rdoMaximum.Size = New System.Drawing.Size(69, 17) Me.rdoMaximum.TabIndex = 8 @@ -129,10 +165,10 @@ Partial Class dlgRowSummary ' Me.rdoCount.AutoSize = True Me.rdoCount.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoCount.Location = New System.Drawing.Point(197, 19) + Me.rdoCount.Location = New System.Drawing.Point(6, 63) Me.rdoCount.Name = "rdoCount" Me.rdoCount.Size = New System.Drawing.Size(53, 17) - Me.rdoCount.TabIndex = 5 + Me.rdoCount.TabIndex = 4 Me.rdoCount.TabStop = True Me.rdoCount.Tag = "Count" Me.rdoCount.Text = "Count" @@ -142,7 +178,7 @@ Partial Class dlgRowSummary ' Me.rdoMean.AutoSize = True Me.rdoMean.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoMean.Location = New System.Drawing.Point(6, 19) + Me.rdoMean.Location = New System.Drawing.Point(6, 21) Me.rdoMean.Name = "rdoMean" Me.rdoMean.Size = New System.Drawing.Size(52, 17) Me.rdoMean.TabIndex = 1 @@ -155,33 +191,33 @@ Partial Class dlgRowSummary ' Me.rdoStandardDeviation.AutoSize = True Me.rdoStandardDeviation.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoStandardDeviation.Location = New System.Drawing.Point(77, 42) + Me.rdoStandardDeviation.Location = New System.Drawing.Point(198, 19) Me.rdoStandardDeviation.Name = "rdoStandardDeviation" Me.rdoStandardDeviation.Size = New System.Drawing.Size(116, 17) - Me.rdoStandardDeviation.TabIndex = 4 + Me.rdoStandardDeviation.TabIndex = 5 Me.rdoStandardDeviation.TabStop = True Me.rdoStandardDeviation.Tag = "Standard_Deviation" Me.rdoStandardDeviation.Text = "Standard Deviation" Me.rdoStandardDeviation.UseVisualStyleBackColor = True ' - 'rdoNumberofMissing + 'rdoNumberMissing ' - Me.rdoNumberofMissing.AutoSize = True - Me.rdoNumberofMissing.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoNumberofMissing.Location = New System.Drawing.Point(196, 42) - Me.rdoNumberofMissing.Name = "rdoNumberofMissing" - Me.rdoNumberofMissing.Size = New System.Drawing.Size(112, 17) - Me.rdoNumberofMissing.TabIndex = 6 - Me.rdoNumberofMissing.TabStop = True - Me.rdoNumberofMissing.Tag = "Number_of_Missing" - Me.rdoNumberofMissing.Text = "Number of Missing" - Me.rdoNumberofMissing.UseVisualStyleBackColor = True + Me.rdoNumberMissing.AutoSize = True + Me.rdoNumberMissing.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoNumberMissing.Location = New System.Drawing.Point(91, 63) + Me.rdoNumberMissing.Name = "rdoNumberMissing" + Me.rdoNumberMissing.Size = New System.Drawing.Size(100, 17) + Me.rdoNumberMissing.TabIndex = 6 + Me.rdoNumberMissing.TabStop = True + Me.rdoNumberMissing.Tag = "Number_Missing" + Me.rdoNumberMissing.Text = "Number Missing" + Me.rdoNumberMissing.UseVisualStyleBackColor = True ' 'rdoMedian ' Me.rdoMedian.AutoSize = True Me.rdoMedian.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoMedian.Location = New System.Drawing.Point(6, 42) + Me.rdoMedian.Location = New System.Drawing.Point(198, 42) Me.rdoMedian.Name = "rdoMedian" Me.rdoMedian.Size = New System.Drawing.Size(60, 17) Me.rdoMedian.TabIndex = 2 @@ -194,7 +230,7 @@ Partial Class dlgRowSummary ' Me.rdoSum.AutoSize = True Me.rdoSum.ImeMode = System.Windows.Forms.ImeMode.NoControl - Me.rdoSum.Location = New System.Drawing.Point(77, 19) + Me.rdoSum.Location = New System.Drawing.Point(91, 21) Me.rdoSum.Name = "rdoSum" Me.rdoSum.Size = New System.Drawing.Size(46, 17) Me.rdoSum.TabIndex = 3 @@ -203,31 +239,223 @@ Partial Class dlgRowSummary Me.rdoSum.Text = "Sum" Me.rdoSum.UseVisualStyleBackColor = True ' - 'ucrPanelStatistics - ' - Me.ucrPanelStatistics.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrPanelStatistics.Location = New System.Drawing.Point(3, 12) - Me.ucrPanelStatistics.Name = "ucrPanelStatistics" - Me.ucrPanelStatistics.Size = New System.Drawing.Size(393, 56) - Me.ucrPanelStatistics.TabIndex = 0 + 'lblProp + ' + Me.lblProp.AutoSize = True + Me.lblProp.Location = New System.Drawing.Point(353, 66) + Me.lblProp.Name = "lblProp" + Me.lblProp.Size = New System.Drawing.Size(32, 13) + Me.lblProp.TabIndex = 13 + Me.lblProp.Text = "Prop:" + ' + 'ucrInputUserDefined + ' + Me.ucrInputUserDefined.AddQuotesIfUnrecognised = True + Me.ucrInputUserDefined.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputUserDefined.GetSetSelectedIndex = -1 + Me.ucrInputUserDefined.IsReadOnly = False + Me.ucrInputUserDefined.Location = New System.Drawing.Point(247, 61) + Me.ucrInputUserDefined.Name = "ucrInputUserDefined" + Me.ucrInputUserDefined.Size = New System.Drawing.Size(104, 25) + Me.ucrInputUserDefined.TabIndex = 10 + ' + 'ucrNudProp + ' + Me.ucrNudProp.AutoSize = True + Me.ucrNudProp.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudProp.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudProp.Location = New System.Drawing.Point(385, 62) + Me.ucrNudProp.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudProp.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudProp.Name = "ucrNudProp" + Me.ucrNudProp.Size = New System.Drawing.Size(42, 20) + Me.ucrNudProp.TabIndex = 14 + Me.ucrNudProp.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrNudTrim + ' + Me.ucrNudTrim.AutoSize = True + Me.ucrNudTrim.DecimalPlaces = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudTrim.Increment = New Decimal(New Integer() {1, 0, 0, 0}) + Me.ucrNudTrim.Location = New System.Drawing.Point(387, 62) + Me.ucrNudTrim.Maximum = New Decimal(New Integer() {100, 0, 0, 0}) + Me.ucrNudTrim.Minimum = New Decimal(New Integer() {0, 0, 0, 0}) + Me.ucrNudTrim.Name = "ucrNudTrim" + Me.ucrNudTrim.Size = New System.Drawing.Size(42, 20) + Me.ucrNudTrim.TabIndex = 13 + Me.ucrNudTrim.Value = New Decimal(New Integer() {0, 0, 0, 0}) + ' + 'ucrPnlStatistics + ' + Me.ucrPnlStatistics.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlStatistics.Location = New System.Drawing.Point(4, 14) + Me.ucrPnlStatistics.Name = "ucrPnlStatistics" + Me.ucrPnlStatistics.Size = New System.Drawing.Size(425, 68) + Me.ucrPnlStatistics.TabIndex = 0 + ' + 'grpMultipleRowSummary + ' + Me.grpMultipleRowSummary.Controls.Add(Me.ucrInputTiesMethod) + Me.grpMultipleRowSummary.Controls.Add(Me.ucrInputType) + Me.grpMultipleRowSummary.Controls.Add(Me.ucrChkType) + Me.grpMultipleRowSummary.Controls.Add(Me.ucrChkTiesMethod) + Me.grpMultipleRowSummary.Controls.Add(Me.ucrInputProbability) + Me.grpMultipleRowSummary.Controls.Add(Me.rdoRowRanks) + Me.grpMultipleRowSummary.Controls.Add(Me.rdoRowQuantile) + Me.grpMultipleRowSummary.Controls.Add(Me.rdoRowRange) + Me.grpMultipleRowSummary.Controls.Add(Me.ucrPnlMultipleRowSummary) + Me.grpMultipleRowSummary.Location = New System.Drawing.Point(10, 238) + Me.grpMultipleRowSummary.Name = "grpMultipleRowSummary" + Me.grpMultipleRowSummary.Size = New System.Drawing.Size(385, 84) + Me.grpMultipleRowSummary.TabIndex = 11 + Me.grpMultipleRowSummary.TabStop = False + Me.grpMultipleRowSummary.Tag = "Statistic" + Me.grpMultipleRowSummary.Text = "Row Statistic" + ' + 'ucrInputTiesMethod + ' + Me.ucrInputTiesMethod.AddQuotesIfUnrecognised = True + Me.ucrInputTiesMethod.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputTiesMethod.GetSetSelectedIndex = -1 + Me.ucrInputTiesMethod.IsReadOnly = False + Me.ucrInputTiesMethod.Location = New System.Drawing.Point(163, 21) + Me.ucrInputTiesMethod.Name = "ucrInputTiesMethod" + Me.ucrInputTiesMethod.Size = New System.Drawing.Size(98, 21) + Me.ucrInputTiesMethod.TabIndex = 15 + ' + 'ucrInputType + ' + Me.ucrInputType.AddQuotesIfUnrecognised = True + Me.ucrInputType.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputType.GetSetSelectedIndex = -1 + Me.ucrInputType.IsReadOnly = False + Me.ucrInputType.Location = New System.Drawing.Point(277, 48) + Me.ucrInputType.Name = "ucrInputType" + Me.ucrInputType.Size = New System.Drawing.Size(35, 24) + Me.ucrInputType.TabIndex = 14 + ' + 'ucrChkType + ' + Me.ucrChkType.AutoSize = True + Me.ucrChkType.Checked = False + Me.ucrChkType.Location = New System.Drawing.Point(222, 49) + Me.ucrChkType.Name = "ucrChkType" + Me.ucrChkType.Size = New System.Drawing.Size(53, 23) + Me.ucrChkType.TabIndex = 13 + ' + 'ucrChkTiesMethod + ' + Me.ucrChkTiesMethod.AutoSize = True + Me.ucrChkTiesMethod.Checked = False + Me.ucrChkTiesMethod.Location = New System.Drawing.Point(73, 22) + Me.ucrChkTiesMethod.Name = "ucrChkTiesMethod" + Me.ucrChkTiesMethod.Size = New System.Drawing.Size(86, 23) + Me.ucrChkTiesMethod.TabIndex = 12 + ' + 'ucrInputProbability + ' + Me.ucrInputProbability.AddQuotesIfUnrecognised = True + Me.ucrInputProbability.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrInputProbability.GetSetSelectedIndex = -1 + Me.ucrInputProbability.IsReadOnly = False + Me.ucrInputProbability.Location = New System.Drawing.Point(73, 47) + Me.ucrInputProbability.Name = "ucrInputProbability" + Me.ucrInputProbability.Size = New System.Drawing.Size(140, 21) + Me.ucrInputProbability.TabIndex = 10 + ' + 'rdoRowRanks + ' + Me.rdoRowRanks.AutoSize = True + Me.rdoRowRanks.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoRowRanks.Location = New System.Drawing.Point(6, 21) + Me.rdoRowRanks.Name = "rdoRowRanks" + Me.rdoRowRanks.Size = New System.Drawing.Size(56, 17) + Me.rdoRowRanks.TabIndex = 1 + Me.rdoRowRanks.TabStop = True + Me.rdoRowRanks.Tag = "Ranks" + Me.rdoRowRanks.Text = "Ranks" + Me.rdoRowRanks.UseVisualStyleBackColor = True + ' + 'rdoRowQuantile + ' + Me.rdoRowQuantile.AutoSize = True + Me.rdoRowQuantile.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoRowQuantile.Location = New System.Drawing.Point(6, 49) + Me.rdoRowQuantile.Name = "rdoRowQuantile" + Me.rdoRowQuantile.Size = New System.Drawing.Size(69, 17) + Me.rdoRowQuantile.TabIndex = 5 + Me.rdoRowQuantile.TabStop = True + Me.rdoRowQuantile.Tag = "Quantile" + Me.rdoRowQuantile.Text = "Quantiles" + Me.rdoRowQuantile.UseVisualStyleBackColor = True + ' + 'rdoRowRange + ' + Me.rdoRowRange.AutoSize = True + Me.rdoRowRange.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoRowRange.Location = New System.Drawing.Point(280, 21) + Me.rdoRowRange.Name = "rdoRowRange" + Me.rdoRowRange.Size = New System.Drawing.Size(57, 17) + Me.rdoRowRange.TabIndex = 3 + Me.rdoRowRange.TabStop = True + Me.rdoRowRange.Tag = "Range" + Me.rdoRowRange.Text = "Range" + Me.rdoRowRange.UseVisualStyleBackColor = True + ' + 'ucrPnlMultipleRowSummary + ' + Me.ucrPnlMultipleRowSummary.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlMultipleRowSummary.Location = New System.Drawing.Point(4, 14) + Me.ucrPnlMultipleRowSummary.Name = "ucrPnlMultipleRowSummary" + Me.ucrPnlMultipleRowSummary.Size = New System.Drawing.Size(365, 64) + Me.ucrPnlMultipleRowSummary.TabIndex = 0 + ' + 'rdoSingle + ' + Me.rdoSingle.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoSingle.BackColor = System.Drawing.SystemColors.Control + Me.rdoSingle.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSingle.FlatAppearance.BorderSize = 2 + Me.rdoSingle.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoSingle.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoSingle.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoSingle.Location = New System.Drawing.Point(101, 8) + Me.rdoSingle.Name = "rdoSingle" + Me.rdoSingle.Size = New System.Drawing.Size(117, 28) + Me.rdoSingle.TabIndex = 2 + Me.rdoSingle.TabStop = True + Me.rdoSingle.Tag = "" + Me.rdoSingle.Text = "Single" + Me.rdoSingle.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoSingle.UseVisualStyleBackColor = False + ' + 'rdoMultiple + ' + Me.rdoMultiple.Appearance = System.Windows.Forms.Appearance.Button + Me.rdoMultiple.BackColor = System.Drawing.SystemColors.Control + Me.rdoMultiple.FlatAppearance.BorderColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoMultiple.FlatAppearance.BorderSize = 2 + Me.rdoMultiple.FlatAppearance.CheckedBackColor = System.Drawing.SystemColors.ActiveCaption + Me.rdoMultiple.FlatStyle = System.Windows.Forms.FlatStyle.Flat + Me.rdoMultiple.ImeMode = System.Windows.Forms.ImeMode.NoControl + Me.rdoMultiple.Location = New System.Drawing.Point(216, 8) + Me.rdoMultiple.Name = "rdoMultiple" + Me.rdoMultiple.Size = New System.Drawing.Size(117, 28) + Me.rdoMultiple.TabIndex = 3 + Me.rdoMultiple.TabStop = True + Me.rdoMultiple.Tag = "" + Me.rdoMultiple.Text = "Multiple" + Me.rdoMultiple.TextAlign = System.Drawing.ContentAlignment.MiddleCenter + Me.rdoMultiple.UseVisualStyleBackColor = False ' 'ucrChkIgnoreMissingValues ' Me.ucrChkIgnoreMissingValues.AutoSize = True Me.ucrChkIgnoreMissingValues.Checked = False - Me.ucrChkIgnoreMissingValues.Location = New System.Drawing.Point(230, 170) + Me.ucrChkIgnoreMissingValues.Location = New System.Drawing.Point(276, 199) Me.ucrChkIgnoreMissingValues.Name = "ucrChkIgnoreMissingValues" - Me.ucrChkIgnoreMissingValues.Size = New System.Drawing.Size(190, 23) - Me.ucrChkIgnoreMissingValues.TabIndex = 3 - ' - 'ucrSaveResults - ' - Me.ucrSaveResults.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrSaveResults.Location = New System.Drawing.Point(10, 271) - Me.ucrSaveResults.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) - Me.ucrSaveResults.Name = "ucrSaveResults" - Me.ucrSaveResults.Size = New System.Drawing.Size(269, 22) - Me.ucrSaveResults.TabIndex = 5 + Me.ucrChkIgnoreMissingValues.Size = New System.Drawing.Size(140, 23) + Me.ucrChkIgnoreMissingValues.TabIndex = 7 ' 'ucrSelectorForRowSummaries ' @@ -235,48 +463,68 @@ Partial Class dlgRowSummary Me.ucrSelectorForRowSummaries.bDropUnusedFilterLevels = False Me.ucrSelectorForRowSummaries.bShowHiddenColumns = False Me.ucrSelectorForRowSummaries.bUseCurrentFilter = True - Me.ucrSelectorForRowSummaries.Location = New System.Drawing.Point(10, 10) + Me.ucrSelectorForRowSummaries.Location = New System.Drawing.Point(12, 45) Me.ucrSelectorForRowSummaries.Margin = New System.Windows.Forms.Padding(0) Me.ucrSelectorForRowSummaries.Name = "ucrSelectorForRowSummaries" Me.ucrSelectorForRowSummaries.Size = New System.Drawing.Size(213, 183) - Me.ucrSelectorForRowSummaries.TabIndex = 0 + Me.ucrSelectorForRowSummaries.TabIndex = 4 ' 'ucrReceiverForRowSummaries ' Me.ucrReceiverForRowSummaries.AutoSize = True Me.ucrReceiverForRowSummaries.frmParent = Me - Me.ucrReceiverForRowSummaries.Location = New System.Drawing.Point(250, 60) + Me.ucrReceiverForRowSummaries.Location = New System.Drawing.Point(276, 89) Me.ucrReceiverForRowSummaries.Margin = New System.Windows.Forms.Padding(0) Me.ucrReceiverForRowSummaries.Name = "ucrReceiverForRowSummaries" Me.ucrReceiverForRowSummaries.Selector = Nothing Me.ucrReceiverForRowSummaries.Size = New System.Drawing.Size(120, 100) Me.ucrReceiverForRowSummaries.strNcFilePath = "" - Me.ucrReceiverForRowSummaries.TabIndex = 2 + Me.ucrReceiverForRowSummaries.TabIndex = 6 Me.ucrReceiverForRowSummaries.ucrSelector = Nothing ' 'ucrBase ' Me.ucrBase.AutoSize = True Me.ucrBase.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrBase.Location = New System.Drawing.Point(10, 300) + Me.ucrBase.Location = New System.Drawing.Point(12, 361) Me.ucrBase.Name = "ucrBase" Me.ucrBase.Size = New System.Drawing.Size(405, 52) - Me.ucrBase.TabIndex = 7 + Me.ucrBase.TabIndex = 10 + ' + 'ucrPnlRowSummaries + ' + Me.ucrPnlRowSummaries.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrPnlRowSummaries.Location = New System.Drawing.Point(93, 3) + Me.ucrPnlRowSummaries.Name = "ucrPnlRowSummaries" + Me.ucrPnlRowSummaries.Size = New System.Drawing.Size(254, 39) + Me.ucrPnlRowSummaries.TabIndex = 1 + ' + 'ucrSaveNewDataFrame + ' + Me.ucrSaveNewDataFrame.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink + Me.ucrSaveNewDataFrame.Location = New System.Drawing.Point(13, 334) + Me.ucrSaveNewDataFrame.Margin = New System.Windows.Forms.Padding(4, 5, 4, 5) + Me.ucrSaveNewDataFrame.Name = "ucrSaveNewDataFrame" + Me.ucrSaveNewDataFrame.Size = New System.Drawing.Size(391, 22) + Me.ucrSaveNewDataFrame.TabIndex = 12 ' 'dlgRowSummary ' 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(419, 357) + Me.ClientSize = New System.Drawing.Size(453, 426) + Me.Controls.Add(Me.rdoMultiple) + Me.Controls.Add(Me.rdoSingle) Me.Controls.Add(Me.ucrChkIgnoreMissingValues) - Me.Controls.Add(Me.ucrSaveResults) - Me.Controls.Add(Me.grpStatistic) - Me.Controls.Add(Me.cmdUserDefined) Me.Controls.Add(Me.ucrSelectorForRowSummaries) - Me.Controls.Add(Me.lblSelected) + Me.Controls.Add(Me.lblSelectedVariables) Me.Controls.Add(Me.ucrReceiverForRowSummaries) Me.Controls.Add(Me.ucrBase) + Me.Controls.Add(Me.ucrPnlRowSummaries) + Me.Controls.Add(Me.ucrSaveNewDataFrame) + Me.Controls.Add(Me.grpMultipleRowSummary) + Me.Controls.Add(Me.grpStatistic) Me.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedToolWindow Me.MaximizeBox = False Me.MinimizeBox = False @@ -286,26 +534,46 @@ Partial Class dlgRowSummary Me.Text = "Row Summaries" Me.grpStatistic.ResumeLayout(False) Me.grpStatistic.PerformLayout() + Me.grpMultipleRowSummary.ResumeLayout(False) + Me.grpMultipleRowSummary.PerformLayout() Me.ResumeLayout(False) Me.PerformLayout() - End Sub - + End Sub + Friend WithEvents ucrBase As ucrButtons Friend WithEvents ucrReceiverForRowSummaries As ucrReceiverMultiple - Friend WithEvents lblSelected As Label + Friend WithEvents lblSelectedVariables As Label Friend WithEvents ucrSelectorForRowSummaries As ucrSelectorByDataFrameAddRemove - Friend WithEvents cmdUserDefined As Button Friend WithEvents grpStatistic As GroupBox Friend WithEvents rdoMinimum As RadioButton Friend WithEvents rdoMaximum As RadioButton Friend WithEvents rdoCount As RadioButton Friend WithEvents rdoMean As RadioButton Friend WithEvents rdoStandardDeviation As RadioButton - Friend WithEvents rdoNumberofMissing As RadioButton + Friend WithEvents rdoNumberMissing As RadioButton Friend WithEvents rdoMedian As RadioButton Friend WithEvents rdoSum As RadioButton - Friend WithEvents ucrPanelStatistics As UcrPanel - Friend WithEvents ucrSaveResults As ucrSave + Friend WithEvents ucrPnlStatistics As UcrPanel Friend WithEvents ucrChkIgnoreMissingValues As ucrCheck -End Class + Friend WithEvents rdoMultiple As RadioButton + Friend WithEvents rdoSingle As RadioButton + Friend WithEvents ucrPnlRowSummaries As UcrPanel + Friend WithEvents rdoMore As RadioButton + Friend WithEvents ucrInputUserDefined As ucrInputComboBox + Friend WithEvents grpMultipleRowSummary As GroupBox + Friend WithEvents ucrInputProbability As ucrInputComboBox + Friend WithEvents rdoRowRanks As RadioButton + Friend WithEvents rdoRowQuantile As RadioButton + Friend WithEvents rdoRowRange As RadioButton + Friend WithEvents ucrPnlMultipleRowSummary As UcrPanel + Friend WithEvents ucrSaveNewDataFrame As ucrSave + Friend WithEvents ucrInputTiesMethod As ucrInputComboBox + Friend WithEvents ucrInputType As ucrInputComboBox + Friend WithEvents ucrChkType As ucrCheck + Friend WithEvents ucrChkTiesMethod As ucrCheck + Friend WithEvents lblProp As Label + Friend WithEvents ucrNudTrim As ucrNud + Friend WithEvents lblTrim As Label + Friend WithEvents ucrNudProp As ucrNud +End Class diff --git a/instat/dlgRowSummary.vb b/instat/dlgRowSummary.vb index 7f3c55dec7e..ea151c777cf 100644 --- a/instat/dlgRowSummary.vb +++ b/instat/dlgRowSummary.vb @@ -1,4 +1,5 @@ -' R- Instat +' +'R- Instat ' Copyright (C) 2015-2017 ' ' This program is free software: you can redistribute it and/or modify @@ -18,7 +19,19 @@ Imports instat.Translations Public Class dlgRowSummary Private bFirstLoad As Boolean = True Private bReset As Boolean = True - Private clsApplyFunction As New RFunction + Private clsDummyRowFunction As New RFunction + Private clsGetColumnsFunction As New RFunction + Private clsPipeOperator As New ROperator + Private clsRowWisePipeOperator As New ROperator + Private clsAddColumnsFunction As New RFunction + Private clsAssignOperator As New ROperator + Private clsRowWiseFunction, clsMutateFunction As New RFunction + Private clsMeanFunction, clsSumFunction, clsStandardDeviationFunction, clsMinimumFunction, clsMaximumFunction, + clsMedianFunction, clsIsNaFunction, clsIsNotNaFunction, clsAnyDuplicatedFunction, clsTrimmedMeanFunction, + clsAnyNaFuction, clsCvFunction, clsGmeanFunction, clsHmeanFunction, clsIQRFunction, clsKurtosisFunction, clsMadFunction, clsMcFunction, + clsMfv1Function, clsQuantileFunction, clsSkewnessFunction, clsRowRanksFunction, clsRowRangesFunction, clsSelectFunction, + clsRowQuantilesFunction, clsAsMatrixFunction, clsDimensionFunction, clsConcatenateFunction, clsColumnNamesFunction As New RFunction + Private clsListFunction As New RFunction Private Sub dlgRowSummary_Load(sender As Object, e As EventArgs) Handles MyBase.Load If bFirstLoad Then @@ -35,68 +48,363 @@ Public Class dlgRowSummary Private Sub InitialiseDialog() ucrBase.iHelpTopicID = 45 - cmdUserDefined.Enabled = False ' temporarily disabled - 'Setting receiver data types and parameters - ucrReceiverForRowSummaries.SetParameter(New RParameter("X", 0)) + Dim dctTiesValues As New Dictionary(Of String, String) + Dim dctProbabilityValues As New Dictionary(Of String, String) + Dim dctRangeValues As New Dictionary(Of String, String) + Dim dctTypeValues As New Dictionary(Of String, String) + + ucrReceiverForRowSummaries.SetParameter(New RParameter("x", 0, bNewIncludeArgumentName:=False)) ucrReceiverForRowSummaries.Selector = ucrSelectorForRowSummaries ucrReceiverForRowSummaries.SetMeAsReceiver() ucrReceiverForRowSummaries.strSelectorHeading = "Numerics" ucrReceiverForRowSummaries.SetIncludedDataTypes({"numeric"}) - ucrReceiverForRowSummaries.bUseFilteredData = False - ucrReceiverForRowSummaries.bForceAsDataFrame = True - ucrReceiverForRowSummaries.SetParameterIsRFunction() + ucrReceiverForRowSummaries.bUseFilteredData = True + ucrReceiverForRowSummaries.bForceAsDataFrame = False + ucrReceiverForRowSummaries.SetParameterIsString() + ucrReceiverForRowSummaries.bWithQuotes = False + + ucrChkTiesMethod.AddParameterPresentCondition(True, "ties.method", True) + ucrChkTiesMethod.AddParameterPresentCondition(False, "ties.method", False) + ucrChkTiesMethod.SetText("Ties method") + + ucrInputTiesMethod.SetParameter(New RParameter("ties.method", 2)) + dctTiesValues.Add("average", Chr(34) & "average" & Chr(34)) + dctTiesValues.Add("first", Chr(34) & "first" & Chr(34)) + dctTiesValues.Add("last", Chr(34) & "last" & Chr(34)) + dctTiesValues.Add("max", Chr(34) & "max" & Chr(34)) + dctTiesValues.Add("min", Chr(34) & "min" & Chr(34)) + ucrInputTiesMethod.SetItems(dctTiesValues) + ucrInputTiesMethod.bAllowNonConditionValues = True + ucrInputTiesMethod.SetDropDownStyleAsNonEditable() + + 'function ran here is probs = c(VALUES) + ucrInputProbability.SetParameter(New RParameter("p", 1, bNewIncludeArgumentName:=False)) + ucrInputProbability.AddQuotesIfUnrecognised = False + ucrInputProbability.SetValidationTypeAsNumericList() + + ucrChkType.SetText("Type") + ucrChkType.AddParameterPresentCondition(True, "type", True) + ucrChkType.AddParameterPresentCondition(False, "type", False) + + ucrInputType.SetParameter(New RParameter("type", 2)) + dctTypeValues.Add("1", "1") + dctTypeValues.Add("2", "2") + dctTypeValues.Add("3", "3") + dctTypeValues.Add("4", "4") + dctTypeValues.Add("5", "5") + dctTypeValues.Add("6", "6") + dctTypeValues.Add("7", "7") + dctTypeValues.Add("8", "8") + dctTypeValues.Add("9", "9") + ucrInputType.SetItems(dctTypeValues) + ucrInputType.AddQuotesIfUnrecognised = False + ucrInputType.SetDropDownStyleAsNonEditable() - ucrChkIgnoreMissingValues.AddParameterPresentCondition(True, "na.rm") - ucrChkIgnoreMissingValues.AddParameterPresentCondition(False, "na.rm", False) + ucrChkIgnoreMissingValues.SetParameter(New RParameter("na.rm", 2)) + ucrChkIgnoreMissingValues.SetRDefault("TRUE") + ucrChkIgnoreMissingValues.bAddRemoveParameter = True + ucrChkIgnoreMissingValues.bChangeParameterValue = False ucrChkIgnoreMissingValues.SetText("Ignore Missing Values") 'linking controls - ucrPanelStatistics.AddToLinkedControls(ucrChkIgnoreMissingValues, {rdoMean, rdoMinimum, rdoSum, rdoMedian, rdoStandardDeviation, rdoMaximum}, bNewLinkedAddRemoveParameter:=True, bNewLinkedHideIfParameterMissing:=True) - - ucrPanelStatistics.SetParameter(New RParameter("FUN", 2)) - ucrPanelStatistics.AddRadioButton(rdoMean, "mean") - ucrPanelStatistics.AddRadioButton(rdoMinimum, "min") - ucrPanelStatistics.AddRadioButton(rdoSum, "sum") - ucrPanelStatistics.AddRadioButton(rdoMedian, "median") - ucrPanelStatistics.AddRadioButton(rdoNumberofMissing, "function(z) sum(is.na(z))") - ucrPanelStatistics.AddRadioButton(rdoStandardDeviation, "sd") - ucrPanelStatistics.AddRadioButton(rdoMaximum, "max") - ucrPanelStatistics.AddRadioButton(rdoCount, "function(z) sum(!is.na(z))") - - ucrSaveResults.SetPrefix("row_summary") - ucrSaveResults.SetSaveTypeAsColumn() - ucrSaveResults.SetDataFrameSelector(ucrSelectorForRowSummaries.ucrAvailableDataFrames) - ucrSaveResults.SetLabelText("New Column Name:") - ucrSaveResults.SetIsComboBox() - ucrSaveResults.setLinkedReceiver(ucrReceiverForRowSummaries) + ucrPnlRowSummaries.AddRadioButton(rdoSingle) + ucrPnlRowSummaries.AddRadioButton(rdoMultiple) + + ucrPnlRowSummaries.AddFunctionNamesCondition(rdoSingle, {"rowwise"}, False) + ucrPnlRowSummaries.AddFunctionNamesCondition(rdoMultiple, {"rowRanks", "rowRanges", "rowQuantiles"}) + + ucrPnlStatistics.AddRadioButton(rdoMean) + ucrPnlStatistics.AddRadioButton(rdoMinimum) + ucrPnlStatistics.AddRadioButton(rdoSum) + ucrPnlStatistics.AddRadioButton(rdoMedian) + ucrPnlStatistics.AddRadioButton(rdoNumberMissing) + ucrPnlStatistics.AddRadioButton(rdoStandardDeviation) + ucrPnlStatistics.AddRadioButton(rdoMaximum) + ucrPnlStatistics.AddRadioButton(rdoCount) + ucrPnlStatistics.AddRadioButton(rdoMore) + + ucrPnlStatistics.AddFunctionNamesCondition(rdoMean, "Mean", False) + ucrPnlStatistics.AddFunctionNamesCondition(rdoMinimum, "Minimum") + ucrPnlStatistics.AddFunctionNamesCondition(rdoSum, "Sum") + ucrPnlStatistics.AddFunctionNamesCondition(rdoMedian, "Median") + ucrPnlStatistics.AddFunctionNamesCondition(rdoNumberMissing, "Number_missing") + ucrPnlStatistics.AddFunctionNamesCondition(rdoStandardDeviation, "Standard_deviation") + ucrPnlStatistics.AddFunctionNamesCondition(rdoMaximum, "Maximum") + ucrPnlStatistics.AddFunctionNamesCondition(rdoCount, "Count") + ucrPnlStatistics.AddFunctionNamesCondition(rdoMore, {"anyDuplicated", "anyNA", "cv", "Gmean", "Hmean", "IQR", "kurtosis", + "mad", "mc", "mean, trim=0.2", "mfv1", "quantile, probs=0.5", "skewness"}) + + ucrPnlMultipleRowSummary.AddRadioButton(rdoRowRanks) + ucrPnlMultipleRowSummary.AddRadioButton(rdoRowRange) + ucrPnlMultipleRowSummary.AddRadioButton(rdoRowQuantile) + ucrPnlMultipleRowSummary.AddParameterValuesCondition(rdoRowRanks, "check", "rowRanks") + ucrPnlMultipleRowSummary.AddParameterValuesCondition(rdoRowRange, "check", "rowRange") + ucrPnlMultipleRowSummary.AddParameterValuesCondition(rdoRowQuantile, "check", "rowQuantiles") + + ucrPnlStatistics.AddToLinkedControls(ucrChkIgnoreMissingValues, {rdoMean, rdoMinimum, rdoSum, rdoMedian, rdoStandardDeviation, rdoMaximum}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlStatistics.AddToLinkedControls(ucrInputUserDefined, {rdoMore}, bNewLinkedHideIfParameterMissing:=True) + + ucrPnlMultipleRowSummary.AddToLinkedControls(ucrChkTiesMethod, {rdoRowRanks}, bNewLinkedHideIfParameterMissing:=True) + ucrPnlMultipleRowSummary.AddToLinkedControls({ucrInputProbability, ucrChkType}, {rdoRowQuantile}, bNewLinkedHideIfParameterMissing:=True) + + ucrPnlRowSummaries.AddToLinkedControls({ucrPnlStatistics, ucrSaveNewDataFrame}, {rdoSingle}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) + ucrPnlRowSummaries.AddToLinkedControls(ucrPnlMultipleRowSummary, {rdoMultiple}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True) + + ucrPnlStatistics.SetLinkedDisplayControl(grpStatistic) + ucrPnlMultipleRowSummary.SetLinkedDisplayControl(grpMultipleRowSummary) + + ucrChkTiesMethod.AddToLinkedControls({ucrInputTiesMethod}, {True}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True, + bNewLinkedUpdateFunction:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="average") + ucrChkType.AddToLinkedControls({ucrInputType}, {True}, bNewLinkedHideIfParameterMissing:=True, bNewLinkedAddRemoveParameter:=True, + bNewLinkedUpdateFunction:=True, bNewLinkedChangeToDefaultState:=True, objNewDefaultState:="7") + 'ucrInputUserDefined + ucrInputUserDefined.SetItems({"anyDuplicated", "anyNA", "cv", "Gmean", "Hmean", "IQR", "kurtosis", "mad", "mc", "mean", + "mfv1", "quantile", "skewness"}) + ucrInputUserDefined.AddToLinkedControls(ucrNudProp, {"quantile"}, bNewLinkedHideIfParameterMissing:=True) + ucrInputUserDefined.AddToLinkedControls(ucrNudTrim, {"mean"}, bNewLinkedHideIfParameterMissing:=True) + + + ucrNudProp.SetParameter(New RParameter("probs", 1)) + ucrNudProp.SetMinMax(0.00, 1.0) + ucrNudProp.Increment = 0.01 + ucrNudProp.DecimalPlaces = 2 + ucrNudProp.SetLinkedDisplayControl(lblProp) + + ucrNudTrim.SetParameter(New RParameter("trim", 1)) + ucrNudTrim.Minimum = 0.0 + ucrNudTrim.Maximum = 0.5 + ucrNudTrim.DecimalPlaces = 2 + ucrNudTrim.Increment = 0.01 + ucrNudTrim.SetLinkedDisplayControl(lblTrim) + + ucrSaveNewDataFrame.SetLabelText("New Column Name:") + ucrSaveNewDataFrame.SetSaveTypeAsColumn() + ucrSaveNewDataFrame.SetIsComboBox() + ucrSaveNewDataFrame.SetPrefix("row_summary") + ucrSaveNewDataFrame.SetDataFrameSelector(ucrSelectorForRowSummaries.ucrAvailableDataFrames) End Sub Private Sub SetDefaults() - clsApplyFunction = New RFunction + clsPipeOperator = New ROperator + clsRowWisePipeOperator = New ROperator + clsAssignOperator = New ROperator + clsDummyRowFunction = New RFunction + clsGetColumnsFunction = New RFunction + clsRowWiseFunction = New RFunction + clsMutateFunction = New RFunction + clsListFunction = New RFunction + clsMeanFunction = New RFunction + clsSumFunction = New RFunction + clsStandardDeviationFunction = New RFunction + clsMinimumFunction = New RFunction + clsMaximumFunction = New RFunction + clsMedianFunction = New RFunction + clsIsNaFunction = New RFunction + clsIsNotNaFunction = New RFunction + clsAnyDuplicatedFunction = New RFunction + clsAnyNaFuction = New RFunction + clsCvFunction = New RFunction + clsGmeanFunction = New RFunction + clsHmeanFunction = New RFunction + clsIQRFunction = New RFunction + clsKurtosisFunction = New RFunction + clsMadFunction = New RFunction + clsMcFunction = New RFunction + clsMfv1Function = New RFunction + clsQuantileFunction = New RFunction + clsSkewnessFunction = New RFunction + clsRowRanksFunction = New RFunction + clsRowRangesFunction = New RFunction + clsRowQuantilesFunction = New RFunction + clsAsMatrixFunction = New RFunction + clsDimensionFunction = New RFunction + clsTrimmedMeanFunction = New RFunction + clsSelectFunction = New RFunction + clsConcatenateFunction = New RFunction + clsColumnNamesFunction = New RFunction + clsAddColumnsFunction = New RFunction 'reset ucrSelectorForRowSummaries.Reset() - ucrSaveResults.Reset() - - 'Defining the default RFunction - clsApplyFunction.SetPackageName("base") - clsApplyFunction.SetRCommand("apply") - clsApplyFunction.AddParameter("FUN", "mean") - clsApplyFunction.AddParameter("MARGIN", 1) - clsApplyFunction.SetAssignTo(ucrSaveResults.GetText, strTempDataframe:=ucrSelectorForRowSummaries.ucrAvailableDataFrames.cboAvailableDataFrames.Text) - ucrBase.clsRsyntax.SetBaseRFunction(clsApplyFunction) + ucrReceiverForRowSummaries.SetMeAsReceiver() + ucrSaveNewDataFrame.Reset() + ucrInputProbability.Reset() + ucrInputUserDefined.SetName("anyDuplicated") + + clsDummyRowFunction.AddParameter("check", "rowRanks", iPosition:=0) + + clsPipeOperator.SetOperation("%>%") + clsPipeOperator.AddParameter("left", clsRFunctionParameter:=ucrSelectorForRowSummaries.ucrAvailableDataFrames.clsCurrDataFrame, iPosition:=0) + clsPipeOperator.AddParameter("right", clsROperatorParameter:=clsRowWisePipeOperator, iPosition:=1) + + clsRowWiseFunction.SetPackageName("dplyr") + clsRowWiseFunction.SetRCommand("rowwise") + + clsMutateFunction.SetPackageName("dplyr") + clsMutateFunction.SetRCommand("mutate") + clsMutateFunction.AddParameter("Mean", clsRFunctionParameter:=clsMeanFunction, iPosition:=0) + + clsSelectFunction.SetPackageName("dplyr") + clsSelectFunction.SetRCommand("select") + + clsRowWisePipeOperator.SetOperation("%>%") + clsRowWisePipeOperator.AddParameter("left", clsRFunctionParameter:=clsRowWiseFunction, iPosition:=0) + clsRowWisePipeOperator.AddParameter("right", clsRFunctionParameter:=clsMutateFunction, iPosition:=1) + clsRowWisePipeOperator.AddParameter("select_function", clsRFunctionParameter:=clsSelectFunction, iPosition:=2) + + clsMeanFunction.SetRCommand("mean") + + clsTrimmedMeanFunction.SetRCommand("mean") + clsTrimmedMeanFunction.AddParameter("trim", "0.2", iPosition:=1) + + clsSumFunction.SetRCommand("sum") + + clsStandardDeviationFunction.SetRCommand("sd") + + clsMinimumFunction.SetRCommand("min") + + clsMaximumFunction.SetRCommand("max") + + clsMedianFunction.SetRCommand("median") + + clsAnyDuplicatedFunction.SetRCommand("anyDuplicated") + + clsAnyNaFuction.SetRCommand("anyNA") + + clsCvFunction.SetPackageName("raster") + clsCvFunction.SetRCommand("cv") + + clsGmeanFunction.SetPackageName("DescTools") + clsGmeanFunction.SetRCommand("Gmean" + ) + clsHmeanFunction.SetPackageName("DescTools") + clsHmeanFunction.SetRCommand("Hmean") + + clsIQRFunction.SetRCommand("IQR") + + clsKurtosisFunction.SetPackageName("e1071") + clsKurtosisFunction.SetRCommand("kurtosis") + + clsMadFunction.SetRCommand("mad") + + clsMcFunction.SetPackageName("robustbase") + clsMcFunction.SetRCommand("mc") + + clsMfv1Function.SetPackageName("statip") + clsMfv1Function.SetRCommand("mfv1") + + clsQuantileFunction.SetRCommand("quantile") + clsQuantileFunction.AddParameter("probs", "0.5", iPosition:=1) + + clsSkewnessFunction.SetPackageName("e1071") + clsSkewnessFunction.SetRCommand("skewness") + + clsIsNaFunction.SetRCommand("is.na") + clsIsNotNaFunction.SetRCommand("!is.na") + + clsListFunction.SetRCommand("list") + + clsRowRanksFunction.SetPackageName("matrixStats") + clsRowRanksFunction.SetRCommand("rowRanks") + clsRowRanksFunction.AddParameter("x", clsRFunctionParameter:=clsAsMatrixFunction, iPosition:=0, bIncludeArgumentName:=False) + clsRowRanksFunction.AddParameter("dim.", clsRFunctionParameter:=clsDimensionFunction, iPosition:=1) + clsRowRanksFunction.SetAssignTo("col") + + clsColumnNamesFunction.SetRCommand("colnames") + + clsConcatenateFunction.SetRCommand("c") + + clsAssignOperator.SetOperation("<-") + clsAssignOperator.AddParameter("left", clsRFunctionParameter:=clsColumnNamesFunction, iPosition:=0) + clsAssignOperator.AddParameter("right", clsRFunctionParameter:=clsConcatenateFunction, iPosition:=1) + + + clsRowRangesFunction.SetPackageName("matrixStats") + clsRowRangesFunction.SetRCommand("rowRanges") + clsRowRangesFunction.AddParameter("dim.", clsRFunctionParameter:=clsDimensionFunction, iPosition:=1) + clsRowRangesFunction.AddParameter("x", clsRFunctionParameter:=clsAsMatrixFunction, iPosition:=0, bIncludeArgumentName:=False) + clsRowRangesFunction.SetAssignTo("col") + + + clsDimensionFunction.SetRCommand("dim") + + clsRowQuantilesFunction.SetPackageName("matrixStats") + clsRowQuantilesFunction.SetRCommand("rowQuantiles") + clsRowQuantilesFunction.AddParameter("x", clsRFunctionParameter:=clsAsMatrixFunction, iPosition:=0, bIncludeArgumentName:=False) + clsRowQuantilesFunction.SetAssignTo("col") + + clsAddColumnsFunction.SetRCommand(frmMain.clsRLink.strInstatDataObject & "$add_columns_to_data") + clsAddColumnsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRowSummaries.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + clsAddColumnsFunction.AddParameter("col_data", "col", iPosition:=1) + clsAddColumnsFunction.AddParameter("before", "FALSE", iPosition:=2) + + clsAsMatrixFunction.SetRCommand("as.matrix") + + ucrBase.clsRsyntax.SetBaseROperator(clsPipeOperator) End Sub Private Sub SetRCodeforControls(bReset As Boolean) - SetRCode(Me, ucrBase.clsRsyntax.clsBaseFunction, bReset) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsSumFunction, ucrReceiverForRowSummaries.GetParameter(), iAdditionalPairNo:=1) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsStandardDeviationFunction, ucrReceiverForRowSummaries.GetParameter(), iAdditionalPairNo:=2) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsMinimumFunction, ucrReceiverForRowSummaries.GetParameter(), iAdditionalPairNo:=3) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsMaximumFunction, ucrReceiverForRowSummaries.GetParameter(), iAdditionalPairNo:=4) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsMedianFunction, ucrReceiverForRowSummaries.GetParameter(), iAdditionalPairNo:=5) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsIsNotNaFunction, New RParameter("x", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=6) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsIsNaFunction, New RParameter("x", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=7) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsAnyDuplicatedFunction, New RParameter("anyDuplicated", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=8) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsAnyNaFuction, New RParameter("anyNA", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=9) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsCvFunction, New RParameter("cv", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=10) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsGmeanFunction, New RParameter("Gmean", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=11) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsHmeanFunction, New RParameter("Hmean", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=12) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsIQRFunction, New RParameter("IQR", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=13) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsKurtosisFunction, New RParameter("kurtosis", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=14) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsMadFunction, New RParameter("mad", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=15) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsMcFunction, New RParameter("mc", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=16) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsMfv1Function, New RParameter("mfv1", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=17) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsQuantileFunction, New RParameter("quantile", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=18) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsSkewnessFunction, New RParameter("skewness", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=19) + ucrReceiverForRowSummaries.AddAdditionalCodeParameterPair(clsTrimmedMeanFunction, New RParameter("mean", 0, bNewIncludeArgumentName:=False), iAdditionalPairNo:=20) + + ucrChkIgnoreMissingValues.AddAdditionalCodeParameterPair(clsSumFunction, ucrChkIgnoreMissingValues.GetParameter(), iAdditionalPairNo:=1) + ucrChkIgnoreMissingValues.AddAdditionalCodeParameterPair(clsStandardDeviationFunction, ucrChkIgnoreMissingValues.GetParameter(), iAdditionalPairNo:=2) + ucrChkIgnoreMissingValues.AddAdditionalCodeParameterPair(clsMinimumFunction, ucrChkIgnoreMissingValues.GetParameter(), iAdditionalPairNo:=3) + ucrChkIgnoreMissingValues.AddAdditionalCodeParameterPair(clsMaximumFunction, ucrChkIgnoreMissingValues.GetParameter(), iAdditionalPairNo:=4) + ucrChkIgnoreMissingValues.AddAdditionalCodeParameterPair(clsMedianFunction, ucrChkIgnoreMissingValues.GetParameter(), iAdditionalPairNo:=5) + ucrChkTiesMethod.SetRCode(clsRowRanksFunction, bReset) + ucrChkType.SetRCode(clsRowQuantilesFunction, bReset) + ucrChkIgnoreMissingValues.SetRCode(clsMeanFunction, bReset) + ucrReceiverForRowSummaries.SetRCode(clsMeanFunction, bReset) + ucrPnlMultipleRowSummary.SetRCode(clsDummyRowFunction, bReset) + ucrNudProp.SetRCode(clsQuantileFunction, bReset) + ucrNudTrim.SetRCode(clsTrimmedMeanFunction, bReset) + ucrSaveNewDataFrame.SetRCode(clsPipeOperator, bReset) + If bReset Then + ucrPnlStatistics.SetRCode(clsMeanFunction, bReset) + End If End Sub Private Sub TestOKEnabled() - If Not ucrReceiverForRowSummaries.IsEmpty AndAlso ucrSaveResults.IsComplete Then - ucrBase.OKEnabled(True) + If rdoSingle.Checked Then + If Not ucrReceiverForRowSummaries.IsEmpty AndAlso ucrSaveNewDataFrame.IsComplete AndAlso ucrInputUserDefined.GetText <> "" Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If Else - ucrBase.OKEnabled(False) + If Not ucrReceiverForRowSummaries.IsEmpty Then + If rdoRowQuantile.Checked Then + If ucrInputProbability.GetText <> "" Then + ucrBase.OKEnabled(True) + Else + ucrBase.OKEnabled(False) + End If + Else + ucrBase.OKEnabled(True) + End If + Else + ucrBase.OKEnabled(False) + End If End If End Sub @@ -106,19 +414,219 @@ Public Class dlgRowSummary TestOKEnabled() End Sub - Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverForRowSummaries.ControlContentsChanged, ucrSaveResults.ControlContentsChanged - TestOKEnabled() - End Sub + Private Sub ucrPnlRowSummaries_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrPnlRowSummaries.ControlValueChanged, ucrPnlStatistics.ControlValueChanged, ucrInputUserDefined.ControlValueChanged, ucrPnlMultipleRowSummary.ControlValueChanged + If rdoSingle.Checked Then + ucrReceiverForRowSummaries.SetMeAsReceiver() + clsMutateFunction.RemoveParameterByName("Mean") + clsMutateFunction.RemoveParameterByName("Sum") + clsMutateFunction.RemoveParameterByName("Standard_deviation") + clsMutateFunction.RemoveParameterByName("Minimum") + clsMutateFunction.RemoveParameterByName("Maximum") + clsMutateFunction.RemoveParameterByName("Median") + clsMutateFunction.RemoveParameterByName("Count") + clsMutateFunction.RemoveParameterByName("Number_missing") + clsMutateFunction.RemoveParameterByName("anyDuplicated") + clsMutateFunction.RemoveParameterByName("anyNA") + clsMutateFunction.RemoveParameterByName("cv") + clsMutateFunction.RemoveParameterByName("Gmean") + clsMutateFunction.RemoveParameterByName("Hmean") + clsMutateFunction.RemoveParameterByName("IQR") + clsMutateFunction.RemoveParameterByName("kurtosis") + clsMutateFunction.RemoveParameterByName("mad") + clsMutateFunction.RemoveParameterByName("mc") + clsMutateFunction.RemoveParameterByName("mean") + clsMutateFunction.RemoveParameterByName("mfv1") + clsMutateFunction.RemoveParameterByName("quantile") + clsMutateFunction.RemoveParameterByName("skewness") + clsSumFunction.RemoveParameterByName("x") + clsListFunction.ClearParameters() + If rdoMean.Checked Then + clsMutateFunction.AddParameter("Mean", clsRFunctionParameter:=clsMeanFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Mean", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Mean") + ElseIf rdoSum.Checked Then + clsSumFunction.AddParameter("x", ucrReceiverForRowSummaries.GetVariableNames("False"), bIncludeArgumentName:=False, iPosition:=0) + clsMutateFunction.AddParameter("Sum", clsRFunctionParameter:=clsSumFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Sum", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Sum") + ElseIf rdoStandardDeviation.Checked Then + clsMutateFunction.AddParameter("Standard_deviation", clsRFunctionParameter:=clsStandardDeviationFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Standard_deviation", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Standard_deviation") + ElseIf rdoMinimum.Checked Then + clsMutateFunction.AddParameter("Minimum", clsRFunctionParameter:=clsMinimumFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Minimum", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Minimum") + ElseIf rdoMaximum.Checked Then + clsMutateFunction.AddParameter("Maximum", clsRFunctionParameter:=clsMaximumFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Maximum", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Maximum") + ElseIf rdoMedian.Checked Then + clsMutateFunction.AddParameter("Median", clsRFunctionParameter:=clsMedianFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Median", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Median") + ElseIf rdoCount.Checked Then + clsSumFunction.AddParameter("x", clsRFunctionParameter:=clsIsNotNaFunction, iPosition:=0, bIncludeArgumentName:=False) + clsMutateFunction.AddParameter("Count", clsRFunctionParameter:=clsSumFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Count", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Count") + ElseIf rdoNumberMissing.Checked Then + clsSumFunction.AddParameter("x", clsRFunctionParameter:=clsIsNaFunction, iPosition:=0, bIncludeArgumentName:=False) + clsMutateFunction.AddParameter("Number_missing", clsRFunctionParameter:=clsSumFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Number_missing", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Number_missing") - Private Sub ucrChkIgnoreMissingValues_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrChkIgnoreMissingValues.ControlValueChanged, ucrPanelStatistics.ControlValueChanged - If ucrChkIgnoreMissingValues.Checked Then - If rdoMean.Checked OrElse rdoMedian.Checked OrElse rdoSum.Checked OrElse rdoStandardDeviation.Checked OrElse rdoMinimum.Checked OrElse rdoMaximum.Checked Then - clsApplyFunction.AddParameter("na.rm", "TRUE", iPosition:=3) - Else - clsApplyFunction.RemoveParameterByName("na.rm") + ElseIf rdoMore.Checked Then + Select Case ucrInputUserDefined.GetText() + Case "anyDuplicated" + clsMutateFunction.AddParameter("anyDuplicated", clsRFunctionParameter:=clsAnyDuplicatedFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "anyDuplicated", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("anyDuplicated") + Case "anyNA" + clsMutateFunction.AddParameter("anyNA", clsRFunctionParameter:=clsAnyNaFuction, iPosition:=0) + clsSelectFunction.AddParameter("x", "anyNA", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("anyNA") + Case "cv" + clsMutateFunction.AddParameter("cv", clsRFunctionParameter:=clsCvFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "cv", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("cv") + Case "Gmean" + clsMutateFunction.AddParameter("Gmean", clsRFunctionParameter:=clsGmeanFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Gmean", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Gmean") + Case "Hmean" + clsMutateFunction.AddParameter("Hmean", clsRFunctionParameter:=clsHmeanFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "Hmean", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("Hmean") + Case "IQR" + clsMutateFunction.AddParameter("IQR", clsRFunctionParameter:=clsIQRFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "IQR", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("IQR") + Case "kurtosis" + clsMutateFunction.AddParameter("kurtosis", clsRFunctionParameter:=clsKurtosisFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "kurtosis", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("kurtosis") + Case "mad" + clsMutateFunction.AddParameter("mad", clsRFunctionParameter:=clsMadFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "mad", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("mad") + Case "mc" + clsMutateFunction.AddParameter("mc", clsRFunctionParameter:=clsMcFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "mc", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("mc") + Case "mean" + clsMutateFunction.AddParameter("mean", clsRFunctionParameter:=clsTrimmedMeanFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "mean", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("trimmed_mean") + Case "mfv1" + clsMutateFunction.AddParameter("mfv1", clsRFunctionParameter:=clsMfv1Function, iPosition:=0) + clsSelectFunction.AddParameter("x", "mfv1", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("mfv1") + Case "quantile" + clsMutateFunction.AddParameter("quantile", clsRFunctionParameter:=clsQuantileFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "quantile", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("quantile") + Case "skewness" + clsMutateFunction.AddParameter("skewness", clsRFunctionParameter:=clsSkewnessFunction, iPosition:=0) + clsSelectFunction.AddParameter("x", "skewness", iPosition:=0, bIncludeArgumentName:=False) + ucrSaveNewDataFrame.SetPrefix("skewness") + End Select End If + ucrBase.clsRsyntax.SetBaseROperator(clsPipeOperator) Else - clsApplyFunction.RemoveParameterByName("na.rm") + If rdoMultiple.Checked Then + If rdoRowRange.Checked Then + clsDummyRowFunction.AddParameter("check", "rowRange", iPosition:=0) + clsColumnNamesFunction.AddParameter("x", clsRFunctionParameter:=clsRowRangesFunction, iPosition:=0, bIncludeArgumentName:=False) + ucrBase.clsRsyntax.SetBaseROperator(clsAssignOperator) + ElseIf rdoRowQuantile.Checked Then + clsDummyRowFunction.AddParameter("check", "rowQuantiles", iPosition:=0) + clsColumnNamesFunction.AddParameter("x", clsRFunctionParameter:=clsRowQuantilesFunction, iPosition:=0, bIncludeArgumentName:=False) + ucrBase.clsRsyntax.SetBaseROperator(clsAssignOperator) + Else + clsDummyRowFunction.AddParameter("check", "rowRanks", iPosition:=0) + clsColumnNamesFunction.AddParameter("x", clsRFunctionParameter:=clsRowRanksFunction, iPosition:=0, bIncludeArgumentName:=False) + ucrBase.clsRsyntax.SetBaseROperator(clsAssignOperator) + End If + End If + End If + + If rdoMultiple.Checked AndAlso rdoRowQuantile.Checked Then + clsDummyRowFunction.AddParameter("0", clsRFunctionParameter:=clsRowQuantilesFunction, iPosition:=0) + ucrInputProbability.SetName("0.25,0.5,0.75") + ucrInputProbability.SetItems({"0.25,0.5,0.75", "0, 0.2, 0.4, 0.6, 0.8, 1", "0.5, 0.8, 1"}) + End If + + If ucrChangedControl Is ucrPnlRowSummaries Then + If rdoMultiple.Checked Then + ucrBase.clsRsyntax.AddToAfterCodes(clsAddColumnsFunction) + Else + ucrBase.clsRsyntax.RemoveFromAfterCodes(clsAddColumnsFunction) + End If + End If + + If ucrChangedControl Is ucrPnlMultipleRowSummary Then + AddConcatenateParameters() + End If + End Sub + + Private Sub AddConcatenateParameters() + clsConcatenateFunction.ClearParameters() + If rdoRowRanks.Checked Then + For Each strVariable In ucrReceiverForRowSummaries.GetVariableNamesAsList + clsConcatenateFunction.AddParameter(strVariable, Chr(34) & strVariable & "_r" & Chr(34), bIncludeArgumentName:=False, iPosition:=0) + Next + ElseIf rdoRowRange.Checked Then + clsConcatenateFunction.AddParameter("r_min", Chr(34) & "r_min" & Chr(34), bIncludeArgumentName:=False, iPosition:=0) + clsConcatenateFunction.AddParameter("r_max", Chr(34) & "r_max" & Chr(34), bIncludeArgumentName:=False, iPosition:=1) + ElseIf rdoRowQuantile.Checked Then + Select Case ucrInputProbability.GetText + Case "0.25,0.5,0.75" + clsConcatenateFunction.AddParameter("q0.25", Chr(34) & "q0.25" & Chr(34), bIncludeArgumentName:=False, iPosition:=0) + clsConcatenateFunction.AddParameter("q0.5", Chr(34) & "q0.5" & Chr(34), bIncludeArgumentName:=False, iPosition:=1) + clsConcatenateFunction.AddParameter("q0.75", Chr(34) & "q0.75" & Chr(34), bIncludeArgumentName:=False, iPosition:=2) + Case "0, 0.2, 0.4, 0.6, 0.8, 1" + clsConcatenateFunction.AddParameter("q0", Chr(34) & "q0" & Chr(34), bIncludeArgumentName:=False, iPosition:=0) + clsConcatenateFunction.AddParameter("q0.2", Chr(34) & "q0.2" & Chr(34), bIncludeArgumentName:=False, iPosition:=1) + clsConcatenateFunction.AddParameter("q0.4", Chr(34) & "q0.4" & Chr(34), bIncludeArgumentName:=False, iPosition:=2) + clsConcatenateFunction.AddParameter("q0.6", Chr(34) & "q0.6" & Chr(34), bIncludeArgumentName:=False, iPosition:=3) + clsConcatenateFunction.AddParameter("q0.8", Chr(34) & "q0.8" & Chr(34), bIncludeArgumentName:=False, iPosition:=4) + clsConcatenateFunction.AddParameter("q1", Chr(34) & "q1" & Chr(34), bIncludeArgumentName:=False, iPosition:=5) + Case "0.5, 0.8, 1" + clsConcatenateFunction.AddParameter("q0.5", Chr(34) & "q0.5" & Chr(34), bIncludeArgumentName:=False, iPosition:=0) + clsConcatenateFunction.AddParameter("q0.8", Chr(34) & "q0.8" & Chr(34), bIncludeArgumentName:=False, iPosition:=1) + clsConcatenateFunction.AddParameter("q1", Chr(34) & "q1" & Chr(34), bIncludeArgumentName:=False, iPosition:=2) + Case Else + Dim iposition As Integer = 0 + For Each clsParameter In ucrInputProbability.clsRList.clsParameters + clsConcatenateFunction.AddParameter("q" & clsParameter.strArgumentValue, + Chr(34) & "q" & clsParameter.strArgumentValue & Chr(34), bIncludeArgumentName:=False, iPosition:=iposition) + iposition = iposition + 1 + Next + End Select End If End Sub + + Private Sub ucrReceiverForRowSummaries_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrReceiverForRowSummaries.ControlValueChanged + Dim clsGetColumnsFunction As New RFunction + clsGetColumnsFunction = ucrReceiverForRowSummaries.GetVariables() + clsGetColumnsFunction.SetAssignTo("columns") + clsAsMatrixFunction.AddParameter("columns", clsRFunctionParameter:=clsGetColumnsFunction, iPosition:=0, bIncludeArgumentName:=False) + clsDimensionFunction.AddParameter("columns", clsRFunctionParameter:=clsGetColumnsFunction, iPosition:=0, bIncludeArgumentName:=False) + AddConcatenateParameters() + End Sub + + Private Sub ucrInputProbability_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrInputProbability.ControlValueChanged + clsRowQuantilesFunction.AddParameter("probs", "c(" & ucrInputProbability.GetText & ")", iPosition:=1) + AddConcatenateParameters() + End Sub + + Private Sub ucrSelectorForRowSummaries_ControlValueChanged(ucrChangedControl As ucrCore) Handles ucrSelectorForRowSummaries.ControlValueChanged + clsAddColumnsFunction.AddParameter("data_name", Chr(34) & ucrSelectorForRowSummaries.ucrAvailableDataFrames.cboAvailableDataFrames.Text & Chr(34), iPosition:=0) + End Sub + + Private Sub Controls_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrReceiverForRowSummaries.ControlContentsChanged, ucrPnlStatistics.ControlContentsChanged, + ucrSaveNewDataFrame.ControlContentsChanged, ucrInputProbability.ControlContentsChanged, ucrInputUserDefined.ControlContentsChanged, ucrPnlMultipleRowSummary.ControlContentsChanged, ucrPnlRowSummaries.ControlContentsChanged + TestOKEnabled() + End Sub End Class \ No newline at end of file diff --git a/instat/instat.vbproj b/instat/instat.vbproj index f3bc5d59b0c..a94538d14b0 100644 --- a/instat/instat.vbproj +++ b/instat/instat.vbproj @@ -1701,12 +1701,6 @@ Form - - dlgPopulationPyramids.vb - - - Form - dlgPrincipalComponentAnalysis.vb @@ -2749,12 +2743,6 @@ UserControl - - ucrSaveGraph.vb - - - UserControl - ucrSaveModel.vb @@ -3811,12 +3799,6 @@ dlgPICSATemperature.vb - - dlgPopulationPyramids.vb - - - dlgPopulationPyramids.vb - dlgPrincipalComponentAnalysis.vb @@ -5082,12 +5064,6 @@ ucrSave.vb - - ucrSaveGraph.vb - - - ucrSaveGraph.vb - ucrSaveModel.vb diff --git a/instat/static/Help/R-Instat.chm b/instat/static/Help/R-Instat.chm index da02eefbe75..9f2cf933a6f 100644 Binary files a/instat/static/Help/R-Instat.chm and b/instat/static/Help/R-Instat.chm differ diff --git a/instat/static/InstatObject/R/data_object_R6.R b/instat/static/InstatObject/R/data_object_R6.R index 5f74b085749..6c687878d85 100644 --- a/instat/static/InstatObject/R/data_object_R6.R +++ b/instat/static/InstatObject/R/data_object_R6.R @@ -1072,8 +1072,8 @@ DataSheet$set("public", "append_to_variables_metadata", function(col_names, prop for (curr_col in col_names) { #see comments in PR #7247 to understand why ' property == labels_label && new_val == "" ' check was added #see comments in issue #7337 to understand why the !is.null(new_val) check was added. - if (property == labels_label && !is.null(new_val) && new_val == "") { - #reset the column labels property + if (((property == labels_label && new_val == "") || (property == colour_label && new_val == -1)) && !is.null(new_val)) { + #reset the column labels or colour property attr(private$data[[curr_col]], property) <- NULL } else { attr(private$data[[curr_col]], property) <- new_val @@ -1084,8 +1084,8 @@ DataSheet$set("public", "append_to_variables_metadata", function(col_names, prop for (col_name in self$get_column_names()) { #see comments in PR #7247 to understand why ' property == labels_label && new_val == "" ' check was added #see comments in issue #7337 to understand why the !is.null(new_val) check was added. - if (property == labels_label && !is.null(new_val) && new_val == "") { - #reset the column labels property + if (((property == labels_label && new_val == "") || (property == colour_label && new_val == -1)) && !is.null(new_val)) { + #reset the column labels or colour property attr(private$data[[col_name]], property) <- NULL } else { attr(private$data[[col_name]], property) <- new_val @@ -2331,7 +2331,8 @@ DataSheet$set("public", "has_colours", function(columns) { } ) -DataSheet$set("public", "set_column_colours_by_metadata", function(columns, property) { +DataSheet$set("public", "set_column_colours_by_metadata", function(data_name, columns, property) { +if(!missing(data_name) && missing(columns)) columns <- names(self$get_data_frame(data_name = data_name)) if(missing(columns)) property_values <- self$get_variables_metadata(property = property) else property_values <- self$get_variables_metadata(property = property, column = columns) diff --git a/instat/static/InstatObject/R/install_packages.R b/instat/static/InstatObject/R/install_packages.R index 411776b8d83..73ce9f5b765 100644 --- a/instat/static/InstatObject/R/install_packages.R +++ b/instat/static/InstatObject/R/install_packages.R @@ -126,7 +126,9 @@ pkgs <- "mc2d", "skimr", # For fast creation of dummy (binary) variables from categories variables in Prepare > Column:Factor > Dummy Variables - "fastDummies" + "fastDummies", + # For most frequent values in Prepare > Column:Numeric > Row Summaries + "statip" # also install mmtable2 from GitHub devtools::install_github("ianmoran11/mmtable2") ) pkgList <- pkgDep(pkgs, type="win.binary", repos = "https://cran.rstudio.com/", suggests = FALSE, includeBasePkgs = FALSE, Rversion = r_version) diff --git a/instat/static/InstatObject/R/instat_object_R6.R b/instat/static/InstatObject/R/instat_object_R6.R index d689387e716..5c71fb13656 100644 --- a/instat/static/InstatObject/R/instat_object_R6.R +++ b/instat/static/InstatObject/R/instat_object_R6.R @@ -395,7 +395,13 @@ DataBook$set("public", "get_combined_metadata", function(convert_to_character = if(length(templist[[j]]) > 1 || is.list(templist[[j]])) templist[[j]] <- paste(as.character(templist[[j]]), collapse = ",") retlist[i, names(templist[j])] = templist[[j]] } - if(all(c(data_name_label, label_label) %in% names(retlist))) retlist <- retlist[ ,c(c(data_name_label, label_label), sort(setdiff(names(retlist), c(data_name_label, label_label))))] + if(all(c(data_name_label, label_label, row_count_label, column_count_label, + data_type_label, is_calculated_label, is_hidden_label, is_linkable, key_label) %in% names(retlist))){ + retlist <- retlist[ ,c(c(data_name_label, label_label, row_count_label, column_count_label, data_type_label, + is_calculated_label, is_hidden_label, is_linkable, key_label), + sort(setdiff(names(retlist), c(data_name_label,label_label, row_count_label, column_count_label, + data_type_label, is_calculated_label,is_hidden_label,is_linkable, key_label))))] + } else if(data_name_label %in% names(retlist)) retlist <- retlist[ ,c(data_name_label, sort(setdiff(names(retlist), data_name_label)))] i = i + 1 } @@ -1384,7 +1390,7 @@ DataBook$set("public", "remove_column_colours", function(data_name) { ) DataBook$set("public","set_column_colours_by_metadata", function(data_name, columns, property) { - self$get_data_objects(data_name)$set_column_colours_by_metadata(columns, property) + self$get_data_objects(data_name)$set_column_colours_by_metadata(data_name, columns, property) } ) diff --git a/instat/static/InstatObject/R/labels_and_defaults.R b/instat/static/InstatObject/R/labels_and_defaults.R index ed6338aac03..e0b7e357d63 100644 --- a/instat/static/InstatObject/R/labels_and_defaults.R +++ b/instat/static/InstatObject/R/labels_and_defaults.R @@ -26,8 +26,8 @@ decimal_places_label="Decimal_Places" columns_label="columns" summarised_from_label="summarised_from" key_label="key" -row_count_label="Row_Count" -column_count_label="Column_Count" +row_count_label="Rows" +column_count_label="Columns" is_linkable="Is_Linkable" #variables_metadata labels diff --git a/instat/static/InstatObject/R/stand_alone_functions.R b/instat/static/InstatObject/R/stand_alone_functions.R index f0b87d85e93..d9131063505 100644 --- a/instat/static/InstatObject/R/stand_alone_functions.R +++ b/instat/static/InstatObject/R/stand_alone_functions.R @@ -1235,6 +1235,11 @@ convert_to_dec_deg <- function (dd, mm = 0 , ss = 0, dir) { return(decdeg) } +convert_yy_to_yyyy <- function (x, base) { + if(missing(base)) stop("base year must be supplied") + dplyr::if_else(x+2000 <= base, x+2000, x+1900) +} + create_av_packs <- function() { av_packs <<- available.packages(repos = "https://cran.rstudio.com/") av_packs <<- data.frame(av_packs) diff --git a/instat/ucrDistributionsWithParameters.vb b/instat/ucrDistributionsWithParameters.vb index ab763c246d6..35025ad3da6 100644 --- a/instat/ucrDistributionsWithParameters.vb +++ b/instat/ucrDistributionsWithParameters.vb @@ -120,7 +120,7 @@ Public Class ucrDistributionsWithParameters OnControlValueChanged() End Sub - Private Sub ucrInputParameter2_ContentsChanged() Handles ucrInputParameter2.ContentsChanged + Private Sub ucrInputParameter2_ControlContentsChanged(ucrChangedControl As ucrCore) Handles ucrInputParameter2.ControlContentsChanged If lstCurrArguments IsNot Nothing AndAlso lstCurrArguments.Count > 1 Then If clsCurrDistribution.strNameTag = "Discrete_Empirical" Then AddParameter(lstCurrArguments(1), "c(" & ucrInputParameter2.GetText & ")") diff --git a/instat/ucrInput.vb b/instat/ucrInput.vb index 8098024c5ec..f6627c6fed5 100644 --- a/instat/ucrInput.vb +++ b/instat/ucrInput.vb @@ -20,9 +20,8 @@ Imports RDotNet Public Class ucrInput Public bUserTyped As Boolean = False Public Event NameChanged() - Public Event ContentsChanged() Protected strValidationType As String = "None" - Dim strReservedWords() As String = ({"if", "else", "repeat", "while", "function", "for", "in", "next", "break", "TRUE", "FALSE", "NULL", "Inf", "NaN", "NA", "NA_integer_", "NA_real_", "NA_complex_", "NA_character_"}) + Protected ReadOnly strReservedWords() As String = ({"if", "else", "repeat", "while", "function", "for", "in", "next", "break", "TRUE", "FALSE", "NULL", "Inf", "NaN", "NA", "NA_integer_", "NA_real_", "NA_complex_", "NA_character_"}) Public clsRList As New RFunction Protected dcmMinimum As Decimal = Decimal.MinValue Protected dcmMaximum As Decimal = Decimal.MaxValue @@ -86,11 +85,6 @@ Public Class ucrInput End If End Sub - Public Sub OnContentsChanged() - RaiseEvent ContentsChanged() - OnControlContentsChanged() - End Sub - Public Function UserTyped() As Boolean Return bUserTyped End Function diff --git a/instat/ucrInputComboBox.vb b/instat/ucrInputComboBox.vb index 3cdd7568e41..927af99a2be 100644 --- a/instat/ucrInputComboBox.vb +++ b/instat/ucrInputComboBox.vb @@ -290,7 +290,8 @@ Public Class ucrInputComboBox End Sub Private Sub cboInput_TextChanged(sender As Object, e As EventArgs) Handles cboInput.TextChanged - OnContentsChanged() + 'shouldn't we be raising OnControlValueChanged instead? see issue #7367 + OnControlContentsChanged() End Sub Private Sub cboInput_Click(sender As Object, e As EventArgs) Handles cboInput.Click OnControlClicked() diff --git a/instat/ucrInputTextBox.vb b/instat/ucrInputTextBox.vb index 2c59a0a6bc3..f911cce9ee3 100644 --- a/instat/ucrInputTextBox.vb +++ b/instat/ucrInputTextBox.vb @@ -54,7 +54,11 @@ Public Class ucrInputTextBox Else e.Cancel = Not ValidateText(strCurrent) End If - If Not e.Cancel Then OnNameChanged() + If Not e.Cancel Then + 'Note. calling this subroutine internally raises + 'ControlContentsChanged and ControlValueChanged events + OnNameChanged() + End If End Sub Public Overrides Function GetText() As String @@ -74,7 +78,8 @@ Public Class ucrInputTextBox End Function Private Sub txtInput_TextChanged(sender As Object, e As EventArgs) Handles txtInput.TextChanged - OnContentsChanged() + 'shouldn't we be raising OnControlValueChanged instead? see issue #7367 + OnControlContentsChanged() End Sub Private Sub txtInput_Click(sender As Object, e As EventArgs) Handles txtInput.Click diff --git a/instat/ucrSaveGraph.Designer.vb b/instat/ucrSaveGraph.Designer.vb deleted file mode 100644 index f4bc0b3b0c9..00000000000 --- a/instat/ucrSaveGraph.Designer.vb +++ /dev/null @@ -1,83 +0,0 @@ -' R- Instat -' Copyright (C) 2015-2017 -' -' This program is free software: you can redistribute it and/or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, or -' (at your option) any later version. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU General Public License for more details. -' -' You should have received a copy of the GNU General Public License -' along with this program. If not, see . - - -Partial Class ucrSaveGraph - Inherits System.Windows.Forms.UserControl - - 'UserControl overrides dispose to clean up the component list. - _ - Protected Overrides Sub Dispose(ByVal disposing As Boolean) - Try - If disposing AndAlso components IsNot Nothing Then - components.Dispose() - End If - Finally - MyBase.Dispose(disposing) - End Try - End Sub - - 'Required by the Windows Form Designer - Private components As System.ComponentModel.IContainer - - 'NOTE: The following procedure is required by the Windows Form Designer - 'It can be modified using the Windows Form Designer. - 'Do not modify it using the code editor. - _ - Private Sub InitializeComponent() - Me.ucrInputGraphName = New instat.ucrInputComboBox() - Me.chkSaveGraph = New System.Windows.Forms.CheckBox() - Me.SuspendLayout() - ' - 'ucrInputGraphName - ' - Me.ucrInputGraphName.AddQuotesIfUnrecognised = True - Me.ucrInputGraphName.AutoSizeMode = System.Windows.Forms.AutoSizeMode.GrowAndShrink - Me.ucrInputGraphName.GetSetSelectedIndex = -1 - Me.ucrInputGraphName.IsReadOnly = False - Me.ucrInputGraphName.Location = New System.Drawing.Point(146, 3) - Me.ucrInputGraphName.Name = "ucrInputGraphName" - Me.ucrInputGraphName.Size = New System.Drawing.Size(151, 29) - Me.ucrInputGraphName.TabIndex = 0 - ' - 'chkSaveGraph - ' - Me.chkSaveGraph.AutoSize = True - Me.chkSaveGraph.Location = New System.Drawing.Point(0, 3) - Me.chkSaveGraph.Name = "chkSaveGraph" - Me.chkSaveGraph.Size = New System.Drawing.Size(83, 17) - Me.chkSaveGraph.TabIndex = 1 - Me.chkSaveGraph.Tag = "Save_Graph" - Me.chkSaveGraph.Text = "Save Graph" - Me.chkSaveGraph.UseVisualStyleBackColor = True - ' - 'ucrSaveGraph - ' - Me.AutoScaleDimensions = New System.Drawing.SizeF(96.0!, 96.0!) - Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Dpi - Me.AutoSize = True - Me.Controls.Add(Me.chkSaveGraph) - Me.Controls.Add(Me.ucrInputGraphName) - Me.Name = "ucrSaveGraph" - Me.Size = New System.Drawing.Size(313, 35) - Me.ResumeLayout(False) - Me.PerformLayout() - - End Sub - - Friend WithEvents ucrInputGraphName As ucrInputComboBox - Friend WithEvents chkSaveGraph As CheckBox -End Class diff --git a/instat/ucrSaveGraph.resx b/instat/ucrSaveGraph.resx deleted file mode 100644 index 1af7de150c9..00000000000 --- a/instat/ucrSaveGraph.resx +++ /dev/null @@ -1,120 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - \ No newline at end of file diff --git a/instat/ucrSaveGraph.sw-KE.resx b/instat/ucrSaveGraph.sw-KE.resx deleted file mode 100644 index 0e517ba7e70..00000000000 --- a/instat/ucrSaveGraph.sw-KE.resx +++ /dev/null @@ -1,45 +0,0 @@ - - - - text/microsoft-resx - - - 2.0 - - - System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - - 86, 0 - - - 180, 20 - - - 0 - - - True - - - 0, 3 - - - 83, 17 - - - 1 - - - 6, 13 - - - 265, 20 - - - True - - \ No newline at end of file diff --git a/instat/ucrSaveGraph.vb b/instat/ucrSaveGraph.vb deleted file mode 100644 index 134c669fd1d..00000000000 --- a/instat/ucrSaveGraph.vb +++ /dev/null @@ -1,132 +0,0 @@ -' R- Instat -' Copyright (C) 2015-2017 -' -' This program is free software: you can redistribute it and/or modify -' it under the terms of the GNU General Public License as published by -' the Free Software Foundation, either version 3 of the License, or -' (at your option) any later version. -' -' This program is distributed in the hope that it will be useful, -' but WITHOUT ANY WARRANTY; without even the implied warranty of -' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -' GNU General Public License for more details. -' -' You should have received a copy of the GNU General Public License -' along with this program. If not, see . - - - -''' This control allows the user to specify how an object should be saved. -''' -''' This control can save the object of type 'graph'. -''' The user can enter/update the name of the saved object via a text box or combo box. -''' A combo box may be used to display a list of possible save names (e.g. the existing -''' graph names). -''' An optional check box allows the text/combo box to be made visible or not visible. -''' -''' -Public Class ucrSaveGraph - Public Event SaveGraphCheckedChanged() - Public Event GraphNameChanged() - Public Event ContentsChanged() - Public bFirstLoad As Boolean - - '''-------------------------------------------------------------------------------------------- - ''' Constructs and initializes this component. - '''-------------------------------------------------------------------------------------------- - Public Sub New() - ' This call is required by the designer. - InitializeComponent() - - ' Add any initialization after the InitializeComponent() call. - ucrInputGraphName.SetDefaultTypeAsGraph() - ucrInputGraphName.SetItemsTypeAsGraphs() - ucrInputGraphName.SetValidationTypeAsRVariable() - bFirstLoad = True - End Sub - '''-------------------------------------------------------------------------------------------- - ''' Executes whenever this control loads. - ''' If this is the first time that the control has loaded then sets the control to - ''' the default state. - ''' If the control has already been loaded then this function does nothing. - ''' - ''' Source of the event. - ''' Event information. - '''-------------------------------------------------------------------------------------------- - Private Sub ucrSaveGraph_Load(sender As Object, e As EventArgs) Handles MyBase.Load - If bFirstLoad Then - SetDefaults() - bFirstLoad = False - End If - End Sub - '''-------------------------------------------------------------- - ''' Sets the control to its default state. - '''-------------------------------------------------------------- - Private Sub SetDefaults() - chkSaveGraph.Checked = False - ucrInputGraphName.Visible = False - End Sub - '''------------------------------------------------------------------ - ''' Resets the control to its default state. - '''------------------------------------------------------------------ - Public Sub Reset() - SetDefaults() - End Sub - '''------------------------------------------------------------------------------------------------- - ''' Sets the new data frame selector and links the selector to the combo box. - ''' The new data frame selector. - '''------------------------------------------------------------------------------------------------- - Public Sub SetDataFrameSelector(ucrNewDataFrameSelector As ucrDataFrame) - ucrInputGraphName.SetDataFrameSelector(ucrNewDataFrameSelector) - End Sub - '''---------------------------------------------------------------------------------------- - ''' Handles event triggered when the state of the check box changes. - ''' Source of the event. - ''' Event information. - '''---------------------------------------------------------------------------------------- - Private Sub chkSaveGraph_CheckedChanged(sender As Object, e As EventArgs) Handles chkSaveGraph.CheckedChanged - ucrInputGraphName.Enabled = chkSaveGraph.Checked - ucrInputGraphName.Visible = chkSaveGraph.Checked - RaiseEvent SaveGraphCheckedChanged() - End Sub - '''-------------------------------------------------------------------------------- - ''' Handles event triggered when the combo box name changes. - '''-------------------------------------------------------------------------------- - Private Sub ucrInputGraphName_NameChanged() Handles ucrInputGraphName.NameChanged - If chkSaveGraph.Checked Then - RaiseEvent GraphNameChanged() - End If - End Sub - '''----------------------------------------------------------------------------------- - ''' Handles event triggered when the combo box contents changes. - '''----------------------------------------------------------------------------------- - Private Sub ucrInputGraphName_ContentsChanged() Handles ucrInputGraphName.ContentsChanged - RaiseEvent ContentsChanged() - End Sub - '''---------------------------------------------------------------------- - ''' Returns the state of the save graph check box. - ''' True if the check box is checked. - '''---------------------------------------------------------------------- - Public ReadOnly Property bSaveGraph() As Boolean - Get - Return chkSaveGraph.Checked - End Get - End Property - '''--------------------------------------------------------------------- - ''' Sets the name of the graph in the combo box. - ''' Return the name graph. - '''--------------------------------------------------------------------- - Public ReadOnly Property strGraphName() As String - Get - Return ucrInputGraphName.GetText() - End Get - End Property - '''--------------------------------------------------------------------------------- - ''' Sets the prefix for the combo box value to the new prefix. - '''--------------------------------------------------------------------------------- - Public WriteOnly Property strPrefix() As String - Set(strNewPrefix As String) - ucrInputGraphName.SetPrefix(strNewPrefix) - End Set - End Property -End Class